@openchamber/web 1.11.0 → 1.11.1
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/assets/{JsonTreeView-CUIfrcFf.js → JsonTreeView-bLRkNPS9.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-Bma9y3dD.js → MarkdownRendererImpl-FSTq-eVA.js} +2 -2
- package/dist/assets/{MultiRunWindow-Cwc0x7fs.js → MultiRunWindow-DezP_Pyy.js} +1 -1
- package/dist/assets/{OnboardingScreen-BhozUlcE.js → OnboardingScreen-CeZMVgH8.js} +1 -1
- package/dist/assets/{SettingsWindow-B4B2bn0C.js → SettingsWindow-Dlfk0yzA.js} +1 -1
- package/dist/assets/TerminalView-CdCfCaFq.js +1 -0
- package/dist/assets/{ToolOutputDialog-7U42lN20.js → ToolOutputDialog-CePopKV7.js} +6 -6
- package/dist/assets/es-CyjenLd8.js +15 -0
- package/dist/assets/index-NnYXwoao.css +1 -0
- package/dist/assets/ko-Cs7yF9Jn.js +15 -0
- package/dist/assets/{main-rHOaDqOy.js → main-BvaFBcXN.js} +2 -2
- package/dist/assets/main-DcpUnRRo.js +225 -0
- package/dist/assets/miniChat-Dmzb8Mwv.js +2 -0
- package/dist/assets/{modelPrefsAutoSave-D5z_F_WP.js → modelPrefsAutoSave-HUPrH1r2.js} +99 -93
- package/dist/assets/pl-XjTt7Hsk.js +15 -0
- package/dist/assets/pt-BR-knvpJ94d.js +15 -0
- package/dist/assets/renderElectronMiniChatApp-EXGwfTjq.js +2 -0
- package/dist/assets/uk-DUPvcQAj.js +15 -0
- package/dist/assets/zh-CN-DWiTG93s.js +15 -0
- package/dist/index.html +3 -3
- package/dist/mini-chat.html +3 -3
- package/package.json +1 -1
- package/server/lib/preview/proxy-runtime.js +43 -3
- package/dist/assets/TerminalView-BpoHWJj6.js +0 -1
- package/dist/assets/es-DLzL0vVb.js +0 -15
- package/dist/assets/index-D5TVqnib.css +0 -1
- package/dist/assets/ko-apnbnEuD.js +0 -15
- package/dist/assets/main-ClS4RVxe.js +0 -217
- package/dist/assets/miniChat-Cx8YK32Y.js +0 -2
- package/dist/assets/pl-DUKUujvh.js +0 -15
- package/dist/assets/pt-BR-D0UPeIZC.js +0 -15
- package/dist/assets/renderElectronMiniChatApp-zbukf-1g.js +0 -2
- package/dist/assets/uk-CaTe2At9.js +0 -15
- package/dist/assets/zh-CN-D-oQmPdK.js +0 -15
- /package/dist/assets/{index-B2ztI3pp.js → index-CKlDk4Io.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as s,j as e}from"./vendor-.bun-BFTPeDgG.js";import{u as j,
|
|
1
|
+
import{R as s,j as e}from"./vendor-.bun-BFTPeDgG.js";import{u as j,at as u,I as x,eR as b}from"./modelPrefsAutoSave-HUPrH1r2.js";const N=s.memo(function({jsonString:t,className:l,maxHeight:i="100%",initiallyExpandedDepth:m=2}){const{t:r}=j(),n=s.useRef(null),[c,o]=s.useState(null),d=s.useMemo(()=>{try{const a=t.trim();if(!a)return o(r("jsonTreeView.error.emptyJson")),null;const f=JSON.parse(a);return o(null),f}catch(a){return o(a instanceof Error?a.message:r("jsonTreeView.error.invalidJson")),null}},[t,r]),p=s.useCallback(()=>{n.current?.expandAll()},[]),v=s.useCallback(()=>{n.current?.collapseAll()},[]);return c?e.jsx("div",{className:l,children:e.jsxs("div",{className:"rounded-md border border-[var(--interactive-border)] bg-[var(--syntax-base-background)] p-4",children:[e.jsx("div",{className:"mb-1 font-medium text-[var(--surface-foreground)]",children:r("jsonTreeView.error.invalidJsonTitle")}),e.jsx("div",{className:"font-mono text-xs text-[var(--surface-mutedForeground)]",children:c})]})}):d===null?null:e.jsxs("div",{className:l,children:[e.jsxs("div",{className:"flex items-center gap-1 border-b border-[var(--interactive-border)] px-2 py-1",children:[e.jsxs(u,{variant:"ghost",size:"xs",onClick:p,className:"gap-1 text-xs text-muted-foreground",children:[e.jsx(x,{name:"arrow-down-s",className:"h-3 w-3"}),r("jsonTreeView.actions.expandAll")]}),e.jsxs(u,{variant:"ghost",size:"xs",onClick:v,className:"gap-1 text-xs text-muted-foreground",children:[e.jsx(x,{name:"arrow-up-s",className:"h-3 w-3"}),r("jsonTreeView.actions.collapseAll")]})]}),e.jsx("div",{className:"bg-[var(--syntax-base-background)] py-1",style:{maxHeight:i,overflow:"auto"},children:e.jsx(b,{ref:n,data:d,maxHeight:i,initiallyExpandedDepth:m})})]})});export{N as J};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{R as C,c as V,by as We,bz as Ue,j as a,bA as He,bB as Ve,bC as qe,bD as Ze,bE as Ke,bF as Ge,ak as
|
|
1
|
+
import{R as C,c as V,by as We,bz as Ue,j as a,bA as He,bB as Ve,bC as qe,bD as Ze,bE as Ke,bF as Ge,ak as Ye}from"./vendor-.bun-BFTPeDgG.js";import{M as Ce,b8 as Re,a as be,u as le,bK as Ee,c as L,bu as Qe,bw as ke,eO as Je,eP as he,O as Xe,eQ as et,I as U,b as ge,v as se,w as Te}from"./modelPrefsAutoSave-HUPrH1r2.js";import"./index-CKlDk4Io.js";const we=()=>{const t=V.c(4),e=Qe();let n;t[0]===Symbol.for("react.memo_cache_sentinel")?(n=ke(!1),t[0]=n):n=t[0];const s=n;let r;t[1]===Symbol.for("react.memo_cache_sentinel")?(r=ke(!0),t[1]=r):r=t[1];const o=r;let i;return t[2]!==e?.currentTheme?(i=e?.currentTheme??(typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").matches?o:s),t[2]=e?.currentTheme,t[3]=i):i=t[3],i},Me=t=>{const e=V.c(4),{containerRef:n,enabled:s}=t;let r,o;e[0]!==n||e[1]!==s?(r=()=>{if(s===!1)return;const i=n.current;if(!i)return;const c=Mt;return i.addEventListener("click",c),()=>{i.removeEventListener("click",c)}},o=[n,s],e[0]=n,e[1]=s,e[2]=r,e[3]=o):(r=e[2],o=e[3]),C.useEffect(r,o)},Ae=t=>{const e=[],n=[],s=t.querySelector("thead");s&&s.querySelectorAll("th").forEach(i=>e.push(i.innerText.trim()));const r=t.querySelector("tbody");return r&&r.querySelectorAll("tr").forEach(i=>{const c=i.querySelectorAll("td"),d=[];c.forEach(l=>d.push(l.innerText.trim())),n.push(d)}),{headers:e,rows:n}},Le=({headers:t,rows:e})=>{const n=r=>r.includes(",")||r.includes('"')||r.includes(`
|
|
2
2
|
`)?`"${r.replace(/"/g,'""')}"`:r,s=[];return t.length>0&&s.push(t.map(n).join(",")),e.forEach(r=>s.push(r.map(n).join(","))),s.join(`
|
|
3
3
|
`)},tt=({headers:t,rows:e})=>{const n=r=>r.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),s=[];return t.length>0&&s.push(t.map(n).join(" ")),e.forEach(r=>s.push(r.map(n).join(" "))),s.join(`
|
|
4
4
|
`)},rt=({headers:t,rows:e})=>{if(t.length===0)return"";const n=r=>r.replace(/\\/g,"\\\\").replace(/\|/g,"\\|"),s=[];return s.push(`| ${t.map(n).join(" | ")} |`),s.push(`| ${t.map(()=>"---").join(" | ")} |`),e.forEach(r=>{const o=t.map((i,c)=>n(r[c]||""));s.push(`| ${o.join(" | ")} |`)}),s.join(`
|
|
5
5
|
`)},nt=(t,e,n)=>{const s=new Blob([e],{type:n}),r=URL.createObjectURL(s),o=document.createElement("a");o.href=r,o.download=t,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)},ot=t=>{const e=V.c(20),{tableRef:n}=t,{t:s}=le(),[r,o]=C.useState(!1),[i,c]=C.useState(!1),d=C.useRef(null);let l,f;e[0]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{const h=g=>{d.current&&!d.current.contains(g.target)&&c(!1)};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},f=[],e[0]=l,e[1]=f):(l=e[0],f=e[1]),C.useEffect(l,f);let w;e[2]!==n?(w=async h=>{const g=n.current?.querySelector("table");if(!g)return;const T=Ae(g),A=h==="csv"?Le(T):tt(T);try{await navigator.clipboard.write([new ClipboardItem({"text/plain":new Blob([A],{type:"text/plain"}),"text/html":new Blob([g.outerHTML],{type:"text/html"})})]),o(!0),c(!1),setTimeout(()=>o(!1),2e3)}catch(R){const E=R;if((await se(A)).ok){o(!0),c(!1),setTimeout(()=>o(!1),2e3);return}console.error("Failed to copy table:",E)}},e[2]=n,e[3]=w):w=e[3];const u=w;let p;e[4]!==i?(p=()=>c(!i),e[4]=i,e[5]=p):p=e[5];let x;e[6]!==s?(x=s("markdownRenderer.table.actions.copyTitle"),e[6]=s,e[7]=x):x=e[7];let m;e[8]!==r?(m=r?a.jsx(U,{name:"check",className:"size-3.5"}):a.jsx(U,{name:"file-copy",className:"size-3.5"}),e[8]=r,e[9]=m):m=e[9];let v;e[10]!==p||e[11]!==x||e[12]!==m?(v=a.jsx("button",{onClick:p,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:x,children:m}),e[10]=p,e[11]=x,e[12]=m,e[13]=v):v=e[13];let k;e[14]!==u||e[15]!==i?(k=i&&a.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[100px] overflow-hidden rounded-md border border-border bg-background shadow-none",children:[a.jsx("button",{className:"w-full px-3 py-1.5 text-left text-sm transition-colors hover:bg-interactive-hover/40",onClick:()=>u("csv"),children:"CSV"}),a.jsx("button",{className:"w-full px-3 py-1.5 text-left text-sm transition-colors hover:bg-interactive-hover/40",onClick:()=>u("tsv"),children:"TSV"})]}),e[14]=u,e[15]=i,e[16]=k):k=e[16];let y;return e[17]!==v||e[18]!==k?(y=a.jsxs("div",{className:"relative",ref:d,children:[v,k]}),e[17]=v,e[18]=k,e[19]=y):y=e[19],y},st=t=>{const e=V.c(19),{tableRef:n}=t,{t:s}=le(),[r,o]=C.useState(!1),i=C.useRef(null);let c,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(c=()=>{const k=y=>{i.current&&!i.current.contains(y.target)&&o(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},d=[],e[0]=c,e[1]=d):(c=e[0],d=e[1]),C.useEffect(c,d);let l;e[2]!==s||e[3]!==n?(l=k=>{const y=n.current?.querySelector("table");if(!y)return;const h=Ae(y),g=k==="csv"?Le(h):rt(h);nt(k==="csv"?"table.csv":"table.md",g,k==="csv"?"text/csv":"text/markdown"),o(!1),Te.success(s("markdownRenderer.table.toast.downloadedAsFormat",{format:k.toUpperCase()}))},e[2]=s,e[3]=n,e[4]=l):l=e[4];const f=l;let w;e[5]!==r?(w=()=>o(!r),e[5]=r,e[6]=w):w=e[6];let u;e[7]!==s?(u=s("markdownRenderer.table.actions.downloadTitle"),e[7]=s,e[8]=u):u=e[8];let p;e[9]===Symbol.for("react.memo_cache_sentinel")?(p=a.jsx(U,{name:"download",className:"size-3.5"}),e[9]=p):p=e[9];let x;e[10]!==w||e[11]!==u?(x=a.jsx("button",{onClick:w,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:u,children:p}),e[10]=w,e[11]=u,e[12]=x):x=e[12];let m;e[13]!==f||e[14]!==r?(m=r&&a.jsxs("div",{className:"absolute top-full right-0 z-10 mt-1 min-w-[100px] overflow-hidden rounded-md border border-border bg-background shadow-none",children:[a.jsx("button",{className:"w-full px-3 py-1.5 text-left text-sm transition-colors hover:bg-interactive-hover/40",onClick:()=>f("csv"),children:"CSV"}),a.jsx("button",{className:"w-full px-3 py-1.5 text-left text-sm transition-colors hover:bg-interactive-hover/40",onClick:()=>f("markdown"),children:"Markdown"})]}),e[13]=f,e[14]=r,e[15]=m):m=e[15];let v;return e[16]!==x||e[17]!==m?(v=a.jsxs("div",{className:"relative",ref:i,children:[x,m]}),e[16]=x,e[17]=m,e[18]=v):v=e[18],v},at=t=>{const e=V.c(14),{children:n,className:s}=t,r=C.useRef(null),{isMobile:o,isTablet:i}=ge(),d=o||i?"opacity-100":"opacity-0 group-hover:opacity-100";let l;e[0]!==d?(l=L("flex items-center justify-end gap-1 transition-opacity",d),e[0]=d,e[1]=l):l=e[1];let f,w;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=a.jsx(ot,{tableRef:r}),w=a.jsx(st,{tableRef:r}),e[2]=f,e[3]=w):(f=e[2],w=e[3]);let u;e[4]!==l?(u=a.jsxs("div",{className:l,children:[f,w]}),e[4]=l,e[5]=u):u=e[5];let p;e[6]!==s?(p=L("w-full border-collapse text-sm",s),e[6]=s,e[7]=p):p=e[7];let x;e[8]!==n||e[9]!==p?(x=a.jsx("div",{className:"overflow-x-auto rounded-lg border border-border/80 bg-[var(--surface-elevated)]",children:a.jsx("table",{className:p,"data-markdown":"table",children:n})}),e[8]=n,e[9]=p,e[10]=x):x=e[10];let m;return e[11]!==u||e[12]!==x?(m=a.jsxs("div",{className:"group my-4 flex flex-col space-y-2","data-markdown":"table-wrapper",ref:r,children:[u,x]}),e[11]=u,e[12]=x,e[13]=m):m=e[13],m},lt=t=>{const e=V.c(83),{source:n,mode:s}=t,{t:r}=le(),o=we(),{isMobile:i,isTablet:c}=ge(),[d,l]=C.useState(!1),[f,w]=C.useState(!1);let u;e:{if(s!=="svg"){u="";break e}try{let b;e[0]!==o.colors.interactive.border||e[1]!==o.colors.primary.base||e[2]!==o.colors.surface.elevated||e[3]!==o.colors.surface.foreground||e[4]!==o.colors.surface.muted||e[5]!==o.colors.surface.mutedForeground||e[6]!==n?(b=Ke(n,{bg:o.colors.surface.elevated,fg:o.colors.surface.foreground,line:o.colors.interactive.border,accent:o.colors.primary.base,muted:o.colors.surface.mutedForeground,surface:o.colors.surface.muted,border:o.colors.interactive.border,transparent:!0,font:"IBM Plex Sans, sans-serif"}),e[0]=o.colors.interactive.border,e[1]=o.colors.primary.base,e[2]=o.colors.surface.elevated,e[3]=o.colors.surface.foreground,e[4]=o.colors.surface.muted,e[5]=o.colors.surface.mutedForeground,e[6]=n,e[7]=b):b=e[7],u=b}catch{u=""}}const p=u;let x;e:{if(s!=="ascii"){x="";break e}try{let b;e[8]!==n?(b=Ge(n),e[8]=n,e[9]=b):b=e[9],x=b}catch{x=""}}const m=x,v=i||c?"opacity-100":"opacity-0 group-hover:opacity-100";let k;e[10]===Symbol.for("react.memo_cache_sentinel")?(k=async b=>{if(!b)return;(await se(b)).ok&&(l(!0),setTimeout(()=>l(!1),2e3))},e[10]=k):k=e[10];const y=k;let h;e[11]!==n?(h=async()=>{if(!n)return;(await se(n)).ok&&(l(!0),setTimeout(()=>l(!1),2e3))},e[11]=n,e[12]=h):h=e[12];const g=h;let T;e[13]!==p||e[14]!==r?(T=()=>{if(p)try{const b=new Blob([p],{type:"image/svg+xml;charset=utf-8"}),j=URL.createObjectURL(b),N=document.createElement("a");N.href=j,N.download=`diagram-${Date.now()}.svg`,document.body.appendChild(N),N.click(),document.body.removeChild(N),URL.revokeObjectURL(j),w(!0),setTimeout(()=>w(!1),2e3)}catch{Te.error(r("markdownRenderer.mermaid.toast.downloadFailed"))}},e[13]=p,e[14]=r,e[15]=T):T=e[15];const A=T;if(s==="ascii"){const b=m||n;let j;e[16]!==b?(j=a.jsx("div",{"data-markdown":"mermaid-scroll",children:a.jsx("pre",{"data-markdown":"mermaid-ascii",children:b})}),e[16]=b,e[17]=j):j=e[17];let N;e[18]!==v?(N=L("absolute top-1 right-2 transition-opacity",v),e[18]=v,e[19]=N):N=e[19];let S;e[20]!==b?(S=()=>y(b),e[20]=b,e[21]=S):S=e[21];let M;e[22]!==r?(M=r("markdownRenderer.mermaid.actions.copyTitle"),e[22]=r,e[23]=M):M=e[23];let _;e[24]!==d?(_=d?a.jsx(U,{name:"check",className:"size-3.5"}):a.jsx(U,{name:"file-copy",className:"size-3.5"}),e[24]=d,e[25]=_):_=e[25];let W;e[26]!==_||e[27]!==S||e[28]!==M?(W=a.jsx("button",{onClick:S,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:M,children:_}),e[26]=_,e[27]=S,e[28]=M,e[29]=W):W=e[29];let H;e[30]!==W||e[31]!==N?(H=a.jsx("div",{className:N,children:W}),e[30]=W,e[31]=N,e[32]=H):H=e[32];let Z;return e[33]!==H||e[34]!==j?(Z=a.jsxs("div",{"data-markdown":"mermaid-block",className:"group",children:[j,H]}),e[33]=H,e[34]=j,e[35]=Z):Z=e[35],Z}if(!p){let b;e[36]!==n?(b=a.jsx("div",{"data-markdown":"mermaid-scroll",children:a.jsx("pre",{"data-markdown":"mermaid-ascii",children:n})}),e[36]=n,e[37]=b):b=e[37];let j;e[38]!==v?(j=L("absolute top-1 right-2 transition-opacity",v),e[38]=v,e[39]=j):j=e[39];let N;e[40]!==n?(N=()=>y(n),e[40]=n,e[41]=N):N=e[41];let S;e[42]!==r?(S=r("markdownRenderer.mermaid.actions.copyTitle"),e[42]=r,e[43]=S):S=e[43];let M;e[44]!==d?(M=d?a.jsx(U,{name:"check",className:"size-3.5"}):a.jsx(U,{name:"file-copy",className:"size-3.5"}),e[44]=d,e[45]=M):M=e[45];let _;e[46]!==M||e[47]!==N||e[48]!==S?(_=a.jsx("button",{onClick:N,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:S,children:M}),e[46]=M,e[47]=N,e[48]=S,e[49]=_):_=e[49];let W;e[50]!==_||e[51]!==j?(W=a.jsx("div",{className:j,children:_}),e[50]=_,e[51]=j,e[52]=W):W=e[52];let H;return e[53]!==W||e[54]!==b?(H=a.jsxs("div",{"data-markdown":"mermaid-block",className:"group",children:[b,W]}),e[53]=W,e[54]=b,e[55]=H):H=e[55],H}let R;e[56]!==p?(R=a.jsx("div",{"data-markdown":"mermaid-scroll",children:a.jsx("div",{"data-markdown":"mermaid",dangerouslySetInnerHTML:{__html:p}})}),e[56]=p,e[57]=R):R=e[57];let E;e[58]!==v?(E=L("absolute top-1 right-2 flex items-center gap-1 transition-opacity",v),e[58]=v,e[59]=E):E=e[59];let O;e[60]!==r?(O=r("markdownRenderer.mermaid.actions.copySourceTitle"),e[60]=r,e[61]=O):O=e[61];let F;e[62]!==d?(F=d?a.jsx(U,{name:"check",className:"size-3.5"}):a.jsx(U,{name:"file-copy",className:"size-3.5"}),e[62]=d,e[63]=F):F=e[63];let P;e[64]!==g||e[65]!==O||e[66]!==F?(P=a.jsx("button",{onClick:g,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:O,children:F}),e[64]=g,e[65]=O,e[66]=F,e[67]=P):P=e[67];let I;e[68]!==r?(I=r("markdownRenderer.mermaid.actions.downloadSvgTitle"),e[68]=r,e[69]=I):I=e[69];let $;e[70]!==f?($=f?a.jsx(U,{name:"check",className:"size-3.5"}):a.jsx(U,{name:"download",className:"size-3.5"}),e[70]=f,e[71]=$):$=e[71];let z;e[72]!==A||e[73]!==I||e[74]!==$?(z=a.jsx("button",{onClick:A,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:I,children:$}),e[72]=A,e[73]=I,e[74]=$,e[75]=z):z=e[75];let D;e[76]!==P||e[77]!==z||e[78]!==E?(D=a.jsxs("div",{className:E,children:[P,z]}),e[76]=P,e[77]=z,e[78]=E,e[79]=D):D=e[79];let B;return e[80]!==D||e[81]!==R?(B=a.jsxs("div",{"data-markdown":"mermaid-block",className:"group",children:[R,D]}),e[80]=D,e[81]=R,e[82]=B):B=e[82],B},_e=t=>{if(!t.includes("mermaid"))return[];const e=[],n=/(?:^|\r?\n)(`{3,}|~{3,})mermaid[^\n\r]*\r?\n([\s\S]*?)\r?\n\1(?=\r?\n|$)/gi;let s=n.exec(t);for(;s;){const r=(s[2]??"").replace(/\s+$/,"");e.push(r),s=n.exec(t)}return e},it=t=>{const e=t.match(/^(?:\uFEFF)?(---|\+\+\+)[^\S\r\n]*\r?\n[\s\S]*?\r?\n\1[^\S\r\n]*(?:\r?\n|$)/);return e?t.slice(e[0].length):t},ct=t=>/^\[[^\]]+\]:\s+\S+/m.test(t)||/^\[\^[^\]]+\]:\s+/m.test(t),dt=t=>{const e=t.match(/^[ \t]{0,3}(`{3,}|~{3,})/);if(!e)return!1;const n=e[1];if(!n)return!1;const s=n[0],r=n.length,o=t.trimEnd().split(`
|
|
6
|
-
`).at(-1)?.trim()??"";return!new RegExp(`^[\\t ]{0,3}${s}{${r},}[\\t ]*$`).test(o)},ye=t=>Ue(t,{linkMode:"text-only"}),mt=t=>{let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.charCodeAt(n),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16)},re=(t,e,n,s)=>{const r=e.length>400?`${e.slice(0,200)}${e.slice(-200)}`:e;return`${t}:${n}:${s}:${e.length}:${mt(r)}`},ut=(t,e,n)=>{if(!e)return[{key:re(n,t,0,"full"),raw:t,src:t,mode:"full"}];const s=ye(t);if(ct(t))return[{key:re(n,t,0,"live"),raw:t,src:s,mode:"live"}];const r=We.lexer(t),o=[];let i=0;for(let c=0;c<r.length;c+=1){const d=r[c];if(d.type==="space")continue;const l=d.raw??"",f=c===r.length-1||r.slice(c+1).every(p=>p.type==="space"),w=f?"live":"full",u=f&&d.type==="code"&&dt(l)?l:ye(l);o.push({key:re(n,l,i,w),raw:l,src:u,mode:w}),i+=1}return o.length===0?[{key:re(n,t,0,"live"),raw:t,src:s,mode:"live"}]:o},Fe=(t,e,n)=>{const s=C.useRef([]);return C.useMemo(()=>{const r=ut(t,e,n),o=s.current,i=r.map((d,l)=>{const f=o[l];return f&&f.key===d.key&&f.src===d.src?f:d});return i.length===o.length&&i.every((d,l)=>d===o[l])?o:(s.current=i,i)},[n,e,t])},pe=t=>typeof t=="string"?t:Array.isArray(t)?t.map(e=>pe(e)).join(""):C.isValidElement(t)?pe(t.props.children):"",ft=t=>t?.match(/language-([\w-]+)/)?.[1]?.toLowerCase()??"text",ht=t=>{let e=t;for(let n=0;n<3;n+=1){const s=e.replace(/"/g,'"').replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");if(s===e)return e;e=s}return e},pt=(t,e)=>!["json","jsonc","json5"].includes(e)||!/&(quot|#34|amp;quot|lt|gt|amp|apos|#39);/.test(t)?t:ht(t),bt=300,ne={margin:0,background:"transparent",padding:0,fontSize:"var(--text-code)",lineHeight:"var(--markdown-code-block-line-height)"},gt=(t,e,n)=>{if(!(typeof window>"u"))try{const s=new Blob([t],{type:n}),r=URL.createObjectURL(s),o=document.createElement("a");o.href=r,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}catch{}},wt=t=>{const e=V.c(49),{code:n,language:s,syntaxTheme:r}=t,[o,i]=C.useState(!1),[c,d]=C.useState(!0),[l,f]=C.useState("code"),w=C.useRef(n),u=C.useRef(null),{isMobile:p,isTablet:x}=ge(),m=s==="html"||s==="htm";let v,k;e[0]!==m||e[1]!==l?(v=()=>{!m&&l!=="code"&&f("code")},k=[m,l],e[0]=m,e[1]=l,e[2]=v,e[3]=k):(v=e[2],k=e[3]),C.useEffect(v,k);let y,h;e[4]!==n?(y=()=>{if(w.current!==n)return w.current=n,u.current&&clearTimeout(u.current),d(!1),u.current=setTimeout(()=>{d(!0),u.current=null},bt),()=>{u.current&&(clearTimeout(u.current),u.current=null)}},h=[n],e[4]=n,e[5]=y,e[6]=h):(y=e[5],h=e[6]),C.useEffect(y,h);let g;e[7]!==n?(g=async()=>{(await se(n)).ok&&(i(!0),window.setTimeout(()=>i(!1),2e3))},e[7]=n,e[8]=g):g=e[8];const T=g;let A;e[9]!==m||e[10]!==n?(A=()=>{if(!m)return;const _=Date.now().toString(36);gt(n,`preview-${_}.html`,"text/html;charset=utf-8")},e[9]=m,e[10]=n,e[11]=A):A=e[11];const R=A;let E;e[12]!==s?(E=a.jsx("span",{className:"font-mono text-[13px] text-muted-foreground",children:s}),e[12]=s,e[13]=E):E=e[13];const O=p||x?"opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100";let F;e[14]!==O?(F=L("flex items-center gap-1 transition-opacity",O),e[14]=O,e[15]=F):F=e[15];let P;e[16]!==m||e[17]!==l?(P=m?a.jsx("button",{type:"button",onClick:()=>f(At),className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:l==="preview"?"Show code":"Preview","aria-pressed":l==="preview","aria-label":l==="preview"?"Show code":"Preview HTML",children:l==="preview"?a.jsx(U,{name:"code",className:"size-3.5"}):a.jsx(U,{name:"eye",className:"size-3.5"})}):null,e[16]=m,e[17]=l,e[18]=P):P=e[18];let I;e[19]!==m||e[20]!==R?(I=m?a.jsx("button",{type:"button",onClick:R,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:"Download HTML","aria-label":"Download HTML",children:a.jsx(U,{name:"download",className:"size-3.5"})}):null,e[19]=m,e[20]=R,e[21]=I):I=e[21];let $;e[22]!==T?($=()=>{T()},e[22]=T,e[23]=$):$=e[23];const z=o?"Copied":"Copy code",D=o?"Copied":"Copy code";let B;e[24]!==o?(B=o?a.jsx(U,{name:"check",className:"size-3.5"}):a.jsx(U,{name:"file-copy",className:"size-3.5"}),e[24]=o,e[25]=B):B=e[25];let b;e[26]!==$||e[27]!==z||e[28]!==D||e[29]!==B?(b=a.jsx("button",{type:"button",onClick:$,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:z,"aria-label":D,children:B}),e[26]=$,e[27]=z,e[28]=D,e[29]=B,e[30]=b):b=e[30];let j;e[31]!==P||e[32]!==I||e[33]!==b||e[34]!==F?(j=a.jsxs("div",{className:F,children:[P,I,b]}),e[31]=P,e[32]=I,e[33]=b,e[34]=F,e[35]=j):j=e[35];let N;e[36]!==j||e[37]!==E?(N=a.jsxs("div",{className:"flex items-center justify-between border-b border-border/70 px-3 py-1.5",children:[E,j]}),e[36]=j,e[37]=E,e[38]=N):N=e[38];let S;e[39]!==m||e[40]!==n||e[41]!==c||e[42]!==s||e[43]!==r||e[44]!==l?(S=m&&l==="preview"?a.jsx("div",{className:"h-[320px] md:h-[420px] bg-background",children:a.jsx("iframe",{srcDoc:n,title:"HTML preview",className:"h-full w-full border-0",sandbox:"allow-scripts allow-forms"})}):a.jsx("div",{className:"px-3 py-2.5",children:c?a.jsx(Je,{language:s,style:r,customStyle:ne,codeTagProps:{style:ne},PreTag:"pre",children:n}):a.jsx("pre",{style:ne,children:a.jsx("code",{style:ne,children:n})})}),e[39]=m,e[40]=n,e[41]=c,e[42]=s,e[43]=r,e[44]=l,e[45]=S):S=e[45];let M;return e[46]!==N||e[47]!==S?(M=a.jsxs("div",{"data-component":"markdown-code",className:"my-4 group overflow-hidden rounded-2xl border border-border/80 bg-[var(--surface-elevated)]",children:[N,S]}),e[46]=N,e[47]=S,e[48]=M):M=e[48],M},$e=({syntaxTheme:t,onPreviewLoopback:e,previewLabel:n,previewTitle:s})=>({table({children:r,...o}){return a.jsx(at,{className:o.className,children:r})},h1({children:r,...o}){return a.jsx("h1",{...o,className:L("typography-markdown-h1 mt-4 mb-2 text-[var(--markdown-heading1,var(--primary))] font-semibold",o.className),children:r})},h2({children:r,...o}){return a.jsx("h2",{...o,className:L("typography-markdown-h2 mt-3.5 mb-1.5 text-[var(--markdown-heading2,var(--primary))] font-semibold",o.className),children:r})},h3({children:r,...o}){return a.jsx("h3",{...o,className:L("typography-markdown-h3 mt-3 mb-1 text-[var(--markdown-heading3,var(--primary))] font-semibold",o.className),children:r})},h4({children:r,...o}){return a.jsx("h4",{...o,className:L("typography-markdown-h4 mt-2.5 mb-1 text-[var(--markdown-heading4,var(--foreground))] font-semibold",o.className),children:r})},h5({children:r,...o}){return a.jsx("h5",{...o,className:L("typography-markdown-h4 mt-2.5 mb-1 text-[var(--markdown-heading4,var(--foreground))] font-semibold",o.className),children:r})},h6({children:r,...o}){return a.jsx("h6",{...o,className:L("typography-markdown-h4 mt-2.5 mb-1 text-[var(--markdown-heading4,var(--foreground))] font-semibold",o.className),children:r})},p({children:r,...o}){return a.jsx("p",{...o,className:L("typography-markdown-body my-2 text-foreground/90",o.className),children:r})},thead({children:r,...o}){return a.jsx("thead",{...o,className:L("[&_tr]:border-b [&_tr]:border-border/80",o.className),children:r})},tbody({children:r,...o}){return a.jsx("tbody",{...o,className:L("[&_tr:last-child]:border-0",o.className),children:r})},tr({children:r,...o}){return a.jsx("tr",{...o,className:L("border-b border-border/60",o.className),children:r})},th({children:r,...o}){return a.jsx("th",{...o,className:L("border-r border-border/60 px-4 py-2.5 text-left align-middle font-semibold text-foreground last:border-r-0",o.className),children:r})},td({children:r,...o}){return a.jsx("td",{...o,className:L("border-r border-border/60 px-4 py-2.5 align-middle text-foreground/90 last:border-r-0",o.className),children:r})},ul({children:r,...o}){return a.jsx("ul",{...o,className:L("typography-markdown-body my-2",o.className),children:r})},ol({children:r,...o}){return a.jsx("ol",{...o,className:L("typography-markdown-body my-2",o.className),children:r})},li({children:r,...o}){return a.jsx("li",{...o,className:L("typography-markdown-body my-0.5 text-foreground/90",o.className),children:r})},blockquote({children:r,...o}){return a.jsx("blockquote",{...o,className:L("my-3 border-l-2 border-[var(--markdown-blockquote-border,var(--border))] pl-4 typography-markdown-body text-[var(--markdown-blockquote,var(--muted-foreground))]",o.className),children:r})},pre({children:r,...o}){const i=C.Children.only(r),c=i.props.className,d=ft(c),l=pt(pe(i.props.children).replace(/\n$/,""),d);return d==="mermaid"?a.jsx(lt,{source:l,mode:be.getState().mermaidRenderingMode}):a.jsx(wt,{code:l,language:d,syntaxTheme:t,...o})},code({className:r,children:o,...i}){return a.jsx("code",{...i,className:L("rounded bg-[var(--surface-elevated)] px-1 py-0.5 font-mono text-[0.95em]",r),"data-markdown":"inline-code",children:o})},a({href:r,children:o,...i}){const c=r??"",d=e?et(c):!1;return a.jsxs(a.Fragment,{children:[a.jsx("a",{...i,href:r,target:he(c)?"_blank":void 0,rel:he(c)?"noopener noreferrer":void 0,children:o}),d&&e?a.jsxs("button",{type:"button",onClick:l=>{l.preventDefault(),l.stopPropagation(),e(c)},className:"ml-1 inline-flex h-5 items-center gap-0.5 rounded border border-[var(--border)] bg-[var(--surface-background)] px-1.5 align-middle text-[11px] leading-none text-[var(--muted-foreground)] transition-colors hover:bg-[var(--surface-hover)] hover:text-[var(--foreground)]","aria-label":s??n??"Open preview pane",title:s??n??"Open preview pane","data-loopback-preview-trigger":"true",children:[a.jsx(U,{name:"eye",className:"size-3","aria-hidden":"true"}),a.jsx("span",{className:"font-medium",children:n??"Preview"})]}):null]})}}),ve=C.memo(t=>{const e=V.c(5),{block:n,components:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=[Ve,qe],e[0]=r):r=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=[[Ze,{throwOnError:!1,errorColor:"var(--destructive)"}]],e[1]=o):o=e[1];let i;return e[2]!==n.src||e[3]!==s?(i=a.jsx(He,{remarkPlugins:r,rehypePlugins:o,components:s,children:n.src}),e[2]=n.src,e[3]=s,e[4]=i):i=e[4],i},(t,e)=>t.block===e.block&&t.components===e.components);ve.displayName="MarkdownBlockView";const de='[data-markdown="mermaid-block"]',vt='[data-openchamber-file-link="true"]',xt=4,Ne=new Map;let oe=0;const je=[],kt=/^[A-Za-z]:[\\/]/,yt=/^\\\\[^\\]+\\[^\\]+/,Pe=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Se=Array.from(Pe).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),K=t=>{const e=(t||"").trim();if(!e)return"";const n=e.replace(/\\/g,"/"),s=n.startsWith("//");let r=n.replace(/\/+/g,"/");s&&!r.startsWith("//")&&(r=`/${r}`);const o=r==="/",i=/^[A-Za-z]:\/$/.test(r);return!o&&!i&&(r=r.replace(/\/+$/,"")),r},Ie=t=>t.startsWith("/")||kt.test(t)||yt.test(t)||t.startsWith("//"),Nt=(t,e)=>{const n=K(e);if(!n)return K(t);if(Ie(n))return n;const s=K(t);if(!s)return n;const r=/^[A-Za-z]:/.test(s),o=r?s.slice(0,2):"",c=(r?s.slice(2):s).split("/").filter(Boolean),d=n.split("/").filter(Boolean);for(const l of d)if(l!=="."){if(l===".."){c.length>0&&c.pop();continue}c.push(l)}return r?`${o}/${c.join("/")}`:`/${c.join("/")}`},ae=t=>{let e=(t||"").trim();return e?((e.startsWith("`")&&e.endsWith("`")||e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e=e.replace(/[.,;!?]+$/g,""),e.endsWith(")")&&!e.includes("(")&&(e=e.slice(0,-1)),e.endsWith("]")&&!e.includes("[")&&(e=e.slice(0,-1)),e):""},me=t=>{let e=ae(t);if(!e)return"";const n=e.indexOf(";");n>=0&&(e=e.slice(0,n)),e=e.replace(/#.*$/,"");const s=e.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);s&&(e=s[1]??e);const r=Se.length>0?e.match(new RegExp(`^(.*(?:/|^)(${Se})):.*$`,"i")):null;return r&&(e=r[1]??e),ae(e)},De=t=>{const e=ae(t);if(!e)return null;const n=e.indexOf(";"),s=n>=0?ae(e.slice(0,n)):e;if(!s)return null;const r=s.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(r){const c=me(r[1]??""),d=Number.parseInt(r[2]??"",10),l=r[3]?Number.parseInt(r[3],10):void 0;return!c||!Number.isFinite(d)?null:{path:c,line:d,column:Number.isFinite(l??Number.NaN)?l:void 0}}const o=s.match(/^(.*):(\d+)(?::(\d+))?$/);if(o){const c=me(o[1]??""),d=Number.parseInt(o[2]??"",10),l=o[3]?Number.parseInt(o[3],10):void 0;return!c||!Number.isFinite(d)?null:{path:c,line:d,column:Number.isFinite(l??Number.NaN)?l:void 0}}const i=me(s);return i?{path:i}:null},jt=t=>{const e=t.split("/").filter(Boolean).pop()??"";return!e||e.endsWith(".")?!1:/\.[A-Za-z0-9_-]{1,16}$/.test(e)},ze=t=>{if(!t||t.startsWith("--")||t.includes("://")||/[<>]/.test(t)||/\s{2,}/.test(t))return!1;const e=K(t),n=e.split("/").filter(Boolean).pop()??e;if(!n||n==="."||n==="..")return!1;const s=n.toLowerCase();return Pe.has(s)||s.startsWith(".")&&s.length>1?!0:jt(e)},St=t=>{const e=De(t);return e?ze(e.path):!1},ue=t=>{if(t.tagName.toLowerCase()==="a"){const e=t.getAttribute("href")?.trim();if(e&&St(e))return e}return(t.textContent||"").trim()},fe=(t,e)=>{const n=De(t);if(!n||!ze(n.path))return null;const s=Ie(n.path)?K(n.path):Nt(e,n.path);return s?{...n,resolvedPath:s}:null},Ct=t=>{const e=K(t);if(!e)return Promise.resolve(!1);const n=Ne.get(e);if(n)return n;const s=new Promise(r=>{const o=()=>{oe+=1,fetch(`/api/fs/stat?path=${encodeURIComponent(e)}`,{method:"GET",cache:"no-store"}).then(i=>r(i.ok)).catch(()=>r(!1)).finally(()=>{oe=Math.max(0,oe-1),je.shift()?.()})};if(oe<xt){o();return}je.push(o)});return Ne.set(e,s),s},Rt=(t,e)=>{const n=K(t);if(n)return n;const s=K(e);return s.replace(/\/[^/]*$/,"")||s},Be=t=>{const e=V.c(7),{containerRef:n,effectiveDirectory:s,editor:r,preferRuntimeEditor:o,enabled:i}=t,c=C.useRef(null);let d,l;e[0]!==n||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==o?(d=()=>{const f=n.current;if(!f)return;let w=!1;const u=Lt,p=()=>{const y=f.querySelectorAll('[data-markdown="inline-code"], a');for(const h of Array.from(y)){const g=ue(h),T=fe(g,s);u(h),!(!i||!T)&&Ct(T.resolvedPath).then(A=>{if(w||!A||!f.contains(h))return;const R=ue(h),E=fe(R,s);!E||E.resolvedPath!==T.resolvedPath||(h.setAttribute("data-openchamber-file-link","true"),h.setAttribute("data-openchamber-file-ref",R),h.setAttribute("data-openchamber-file-path",E.resolvedPath),h.setAttribute("title","Open file"),h.tagName.toLowerCase()!=="a"&&(h.setAttribute("role","button"),h.setAttribute("tabindex","0")))})}},x=y=>{const h=y.getAttribute("data-openchamber-file-ref")||ue(y),g=fe(h,s);if(!g)return;const T=Rt(s,g.resolvedPath);if(o&&r){r.openFile(g.resolvedPath,Number.isFinite(g.line??Number.NaN)?Math.max(1,Math.trunc(g.line)):void 0,Number.isFinite(g.column??Number.NaN)?Math.max(1,Math.trunc(g.column)):void 0);return}const A=be.getState();Number.isFinite(g.line??Number.NaN)?A.openContextFileAtLine(T,g.resolvedPath,Math.max(1,Math.trunc(g.line)),Number.isFinite(g.column??Number.NaN)?Math.max(1,Math.trunc(g.column)):1):A.openContextFile(T,g.resolvedPath)},m=y=>{const h=y.target;if(!(h instanceof Element))return;const g=h.closest(vt);g instanceof HTMLElement&&(y.preventDefault(),y.stopPropagation(),x(g))},v=y=>{if(y.key!=="Enter"&&y.key!==" ")return;const h=y.target;!(h instanceof HTMLElement)||h.getAttribute("data-openchamber-file-link")!=="true"||(y.preventDefault(),y.stopPropagation(),x(h))};p();const k=new MutationObserver(()=>{if(c.current!==null&&typeof window<"u"&&window.clearTimeout(c.current),typeof window>"u"){p();return}c.current=window.setTimeout(()=>{c.current=null,p()},120)});return k.observe(f,{childList:!0,subtree:!0}),f.addEventListener("click",m),f.addEventListener("keydown",v),()=>{w=!0,c.current!==null&&typeof window<"u"&&window.clearTimeout(c.current),c.current=null,k.disconnect(),f.removeEventListener("click",m),f.removeEventListener("keydown",v)}},l=[n,r,s,o,i],e[0]=n,e[1]=r,e[2]=s,e[3]=i,e[4]=o,e[5]=d,e[6]=l):(d=e[5],l=e[6]),C.useEffect(d,l)},Oe=t=>{const e=V.c(6),{containerRef:n,mermaidBlocks:s,onShowPopup:r,allowWheelZoom:o}=t;let i,c;e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==r?(i=()=>{const d=n.current;if(!d)return;const l=w=>{if(!r)return;const u=w.target;if(!(u instanceof Element)||u.closest('button, a, [role="button"]'))return;const p=u.closest(de);if(!p)return;const m=Array.from(d.querySelectorAll(de)).indexOf(p);if(m<0)return;const v=s[m];if(!v||v.trim().length===0)return;const k=`Diagram ${m+1}`;r({open:!0,title:k,content:"",metadata:{tool:"mermaid-preview",filename:k},mermaid:{url:`data:text/plain;charset=utf-8,${encodeURIComponent(v)}`,source:v,filename:k}})},f=w=>{if(o)return;const u=w.target;!(u instanceof Element)||!u.closest(de)||w.stopPropagation()};return d.addEventListener("click",l),d.addEventListener("wheel",f,{capture:!0,passive:!0}),()=>{d.removeEventListener("click",l),d.removeEventListener("wheel",f,!0)}},c=[o,n,s,r],e[0]=o,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=c):(i=e[4],c=e[5]),C.useEffect(i,c)},Et=t=>{const e=V.c(42),{content:n,part:s,messageId:r,isAnimated:o,skipFadeIn:i,className:c,isStreaming:d,disableStreamAnimation:l,variant:f,onShowPopup:w,enableFileReferences:u}=t,p=o===void 0?!0:o,x=i===void 0?!1:i,m=d===void 0?!1:d,v=l===void 0?!1:l,k=f===void 0?"assistant":f,y=u===void 0?!0:u,h=we(),{editor:g,runtime:T}=Ce(),A=C.useRef(null),R=Re()??"";let E;e[0]!==n?(E=_e(n),e[0]=n,e[1]=E):E=e[1];const O=E;let F;e[2]!==O||e[3]!==w?(F={containerRef:A,mermaidBlocks:O,onShowPopup:w},e[2]=O,e[3]=w,e[4]=F):F=e[4],Oe(F);const P=y&&!m;let I;e[5]!==g||e[6]!==R||e[7]!==T.isVSCode||e[8]!==P?(I={containerRef:A,effectiveDirectory:R,editor:g,preferRuntimeEditor:T.isVSCode,enabled:P},e[5]=g,e[6]=R,e[7]=T.isVSCode,e[8]=P,e[9]=I):I=e[9],Be(I);let $;e[10]===Symbol.for("react.memo_cache_sentinel")?($={containerRef:A},e[10]=$):$=e[10],Me($);const z=be(_t),{t:D}=le();let B;e[11]!==R||e[12]!==z?(B=q=>{R&&z(R,q)},e[11]=R,e[12]=z,e[13]=B):B=e[13];const b=B;let j;e[14]!==D?(j=D("terminalView.preview.open"),e[14]=D,e[15]=j):j=e[15];const N=j;let S;e[16]!==D?(S=D("terminalView.preview.openTitle"),e[16]=D,e[17]=S):S=e[17];const M=S;let _;e[18]!==h?(_=Ee(h),e[18]=h,e[19]=_):_=e[19];const W=_,H=R?b:void 0;let Z;e[20]!==N||e[21]!==M||e[22]!==W||e[23]!==H?(Z=$e({syntaxTheme:W,onPreviewLoopback:H,previewLabel:N,previewTitle:M}),e[20]=N,e[21]=M,e[22]=W,e[23]=H,e[24]=Z):Z=e[24];const Q=Z,X=`markdown-${s?.id?`part-${s.id}`:`message-${r}`}`,ie=Fe(n,m&&!v,X),ce=k==="tool"?"markdown-content markdown-tool":k==="reasoning"?"markdown-content markdown-reasoning":"markdown-content leading-relaxed";let G;e[25]!==c?(G=L("break-words w-full min-w-0",c),e[25]=c,e[26]=G):G=e[26];let J;if(e[27]!==ie||e[28]!==Q){let q;e[30]!==Q?(q=xe=>a.jsx(ve,{block:xe,components:Q},xe.key),e[30]=Q,e[31]=q):q=e[31],J=ie.map(q),e[27]=ie,e[28]=Q,e[29]=J}else J=e[29];let Y;e[32]!==ce||e[33]!==J?(Y=a.jsx("div",{className:ce,children:J}),e[32]=ce,e[33]=J,e[34]=Y):Y=e[34];let ee;e[35]!==G||e[36]!==Y?(ee=a.jsx("div",{className:G,ref:A,children:Y}),e[35]=G,e[36]=Y,e[37]=ee):ee=e[37];const te=ee;if(p){let q;return e[38]!==X||e[39]!==te||e[40]!==x?(q=a.jsx(Qe,{skipAnimation:x,children:te},X),e[38]=X,e[39]=te,e[40]=x,e[41]=q):q=e[41],q}return te},It=C.memo(Et,(t,e)=>t.content===e.content&&t.isStreaming===e.isStreaming&&t.disableStreamAnimation===e.disableStreamAnimation&&t.variant===e.variant&&t.isAnimated===e.isAnimated&&t.skipFadeIn===e.skipFadeIn&&t.className===e.className&&t.messageId===e.messageId&&t.onShowPopup===e.onShowPopup&&t.part?.id===e.part?.id),Tt=t=>{const e=V.c(33),{content:n,className:s,variant:r,disableLinkSafety:o,stripFrontmatter:i,onShowPopup:c,allowMermaidWheelZoom:d,enableFileReferences:l}=t,f=r===void 0?"assistant":r,w=i===void 0?!1:i,u=d===void 0?!1:d,p=l===void 0?!0:l,{editor:x,runtime:m}=Ce();let v;e[0]!==n||e[1]!==w?(v=w?it(n):n,e[0]=n,e[1]=w,e[2]=v):v=e[2];const k=v,y=we(),h=C.useRef(null),g=Re()??"";let T;e[3]!==k?(T=_e(k),e[3]=k,e[4]=T):T=e[4];const A=T;let R;e[5]!==u||e[6]!==A||e[7]!==c?(R={containerRef:h,mermaidBlocks:A,onShowPopup:c,allowWheelZoom:u},e[5]=u,e[6]=A,e[7]=c,e[8]=R):R=e[8],Oe(R);let E;e[9]!==x||e[10]!==g||e[11]!==p||e[12]!==m.isVSCode?(E={containerRef:h,effectiveDirectory:g,editor:x,preferRuntimeEditor:m.isVSCode,enabled:p},e[9]=x,e[10]=g,e[11]=p,e[12]=m.isVSCode,e[13]=E):E=e[13],Be(E);const O=!o;let F;e[14]!==O?(F={containerRef:h,enabled:O},e[14]=O,e[15]=F):F=e[15],Me(F);let P;e[16]!==y?(P=Ee(y),e[16]=y,e[17]=P):P=e[17];const I=P;let $;e[18]!==I?($=$e({syntaxTheme:I}),e[18]=I,e[19]=$):$=e[19];const z=$,D=Fe(k,!1,`simple:${f}`),B=f==="tool"?"markdown-content markdown-tool":f==="reasoning"?"markdown-content markdown-reasoning":"markdown-content leading-relaxed";let b;e[20]!==s?(b=L("break-words w-full min-w-0",s),e[20]=s,e[21]=b):b=e[21];let j;if(e[22]!==D||e[23]!==z){let M;e[25]!==z?(M=_=>a.jsx(ve,{block:_,components:z},_.key),e[25]=z,e[26]=M):M=e[26],j=D.map(M),e[22]=D,e[23]=z,e[24]=j}else j=e[24];let N;e[27]!==B||e[28]!==j?(N=a.jsx("div",{className:B,children:j}),e[27]=B,e[28]=j,e[29]=N):N=e[29];let S;return e[30]!==b||e[31]!==N?(S=a.jsx("div",{className:b,ref:h,children:N}),e[30]=b,e[31]=N,e[32]=S):S=e[32],S},Dt=C.memo(Tt,(t,e)=>t.content===e.content&&t.variant===e.variant&&t.className===e.className&&t.disableLinkSafety===e.disableLinkSafety&&t.stripFrontmatter===e.stripFrontmatter&&t.onShowPopup===e.onShowPopup&&t.allowMermaidWheelZoom===e.allowMermaidWheelZoom&&t.enableFileReferences===e.enableFileReferences);function Mt(t){if(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.altKey||t.shiftKey)return;const e=t.target;if(!(e instanceof Element))return;const n=e.closest("a[href]");if(!(n instanceof HTMLAnchorElement)||n.getAttribute("data-openchamber-file-link")==="true")return;const s=n.getAttribute("href")??"";he(s)&&(t.preventDefault(),t.stopPropagation(),Xe(s))}function At(t){return t==="preview"?"code":"preview"}function Lt(t){t.removeAttribute("data-openchamber-file-link"),t.removeAttribute("data-openchamber-file-ref"),t.removeAttribute("data-openchamber-file-path"),t.getAttribute("title")==="Open file"&&t.removeAttribute("title"),t.tagName.toLowerCase()!=="a"&&(t.removeAttribute("role"),t.removeAttribute("tabindex"))}function _t(t){return t.openContextPreview}export{It as MarkdownRenderer,Dt as SimpleMarkdownRenderer};
|
|
6
|
+
`).at(-1)?.trim()??"";return!new RegExp(`^[\\t ]{0,3}${s}{${r},}[\\t ]*$`).test(o)},ye=t=>Ue(t,{linkMode:"text-only"}),mt=t=>{let e=2166136261;for(let n=0;n<t.length;n+=1)e^=t.charCodeAt(n),e=e+((e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24))>>>0;return e.toString(16)},re=(t,e,n,s)=>{const r=e.length>400?`${e.slice(0,200)}${e.slice(-200)}`:e;return`${t}:${n}:${s}:${e.length}:${mt(r)}`},ut=(t,e,n)=>{if(!e)return[{key:re(n,t,0,"full"),raw:t,src:t,mode:"full"}];const s=ye(t);if(ct(t))return[{key:re(n,t,0,"live"),raw:t,src:s,mode:"live"}];const r=We.lexer(t),o=[];let i=0;for(let c=0;c<r.length;c+=1){const d=r[c];if(d.type==="space")continue;const l=d.raw??"",f=c===r.length-1||r.slice(c+1).every(p=>p.type==="space"),w=f?"live":"full",u=f&&d.type==="code"&&dt(l)?l:ye(l);o.push({key:re(n,l,i,w),raw:l,src:u,mode:w}),i+=1}return o.length===0?[{key:re(n,t,0,"live"),raw:t,src:s,mode:"live"}]:o},Fe=(t,e,n)=>{const s=C.useRef([]);return C.useMemo(()=>{const r=ut(t,e,n),o=s.current,i=r.map((d,l)=>{const f=o[l];return f&&f.key===d.key&&f.src===d.src?f:d});return i.length===o.length&&i.every((d,l)=>d===o[l])?o:(s.current=i,i)},[n,e,t])},pe=t=>typeof t=="string"?t:Array.isArray(t)?t.map(e=>pe(e)).join(""):C.isValidElement(t)?pe(t.props.children):"",ft=t=>t?.match(/language-([\w-]+)/)?.[1]?.toLowerCase()??"text",ht=t=>{let e=t;for(let n=0;n<3;n+=1){const s=e.replace(/"/g,'"').replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");if(s===e)return e;e=s}return e},pt=(t,e)=>!["json","jsonc","json5"].includes(e)||!/&(quot|#34|amp;quot|lt|gt|amp|apos|#39);/.test(t)?t:ht(t),bt=300,ne={margin:0,background:"transparent",padding:0,fontSize:"var(--text-code)",lineHeight:"var(--markdown-code-block-line-height)"},gt=(t,e,n)=>{if(!(typeof window>"u"))try{const s=new Blob([t],{type:n}),r=URL.createObjectURL(s),o=document.createElement("a");o.href=r,o.download=e,document.body.appendChild(o),o.click(),document.body.removeChild(o),URL.revokeObjectURL(r)}catch{}},wt=t=>{const e=V.c(49),{code:n,language:s,syntaxTheme:r}=t,[o,i]=C.useState(!1),[c,d]=C.useState(!0),[l,f]=C.useState("code"),w=C.useRef(n),u=C.useRef(null),{isMobile:p,isTablet:x}=ge(),m=s==="html"||s==="htm";let v,k;e[0]!==m||e[1]!==l?(v=()=>{!m&&l!=="code"&&f("code")},k=[m,l],e[0]=m,e[1]=l,e[2]=v,e[3]=k):(v=e[2],k=e[3]),C.useEffect(v,k);let y,h;e[4]!==n?(y=()=>{if(w.current!==n)return w.current=n,u.current&&clearTimeout(u.current),d(!1),u.current=setTimeout(()=>{d(!0),u.current=null},bt),()=>{u.current&&(clearTimeout(u.current),u.current=null)}},h=[n],e[4]=n,e[5]=y,e[6]=h):(y=e[5],h=e[6]),C.useEffect(y,h);let g;e[7]!==n?(g=async()=>{(await se(n)).ok&&(i(!0),window.setTimeout(()=>i(!1),2e3))},e[7]=n,e[8]=g):g=e[8];const T=g;let A;e[9]!==m||e[10]!==n?(A=()=>{if(!m)return;const _=Date.now().toString(36);gt(n,`preview-${_}.html`,"text/html;charset=utf-8")},e[9]=m,e[10]=n,e[11]=A):A=e[11];const R=A;let E;e[12]!==s?(E=a.jsx("span",{className:"font-mono text-[13px] text-muted-foreground",children:s}),e[12]=s,e[13]=E):E=e[13];const O=p||x?"opacity-100":"opacity-100 md:opacity-0 md:group-hover:opacity-100";let F;e[14]!==O?(F=L("flex items-center gap-1 transition-opacity",O),e[14]=O,e[15]=F):F=e[15];let P;e[16]!==m||e[17]!==l?(P=m?a.jsx("button",{type:"button",onClick:()=>f(At),className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:l==="preview"?"Show code":"Preview","aria-pressed":l==="preview","aria-label":l==="preview"?"Show code":"Preview HTML",children:l==="preview"?a.jsx(U,{name:"code",className:"size-3.5"}):a.jsx(U,{name:"eye",className:"size-3.5"})}):null,e[16]=m,e[17]=l,e[18]=P):P=e[18];let I;e[19]!==m||e[20]!==R?(I=m?a.jsx("button",{type:"button",onClick:R,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:"Download HTML","aria-label":"Download HTML",children:a.jsx(U,{name:"download",className:"size-3.5"})}):null,e[19]=m,e[20]=R,e[21]=I):I=e[21];let $;e[22]!==T?($=()=>{T()},e[22]=T,e[23]=$):$=e[23];const z=o?"Copied":"Copy code",D=o?"Copied":"Copy code";let B;e[24]!==o?(B=o?a.jsx(U,{name:"check",className:"size-3.5"}):a.jsx(U,{name:"file-copy",className:"size-3.5"}),e[24]=o,e[25]=B):B=e[25];let b;e[26]!==$||e[27]!==z||e[28]!==D||e[29]!==B?(b=a.jsx("button",{type:"button",onClick:$,className:"p-1 rounded hover:bg-interactive-hover/60 text-muted-foreground hover:text-foreground transition-colors",title:z,"aria-label":D,children:B}),e[26]=$,e[27]=z,e[28]=D,e[29]=B,e[30]=b):b=e[30];let j;e[31]!==P||e[32]!==I||e[33]!==b||e[34]!==F?(j=a.jsxs("div",{className:F,children:[P,I,b]}),e[31]=P,e[32]=I,e[33]=b,e[34]=F,e[35]=j):j=e[35];let N;e[36]!==j||e[37]!==E?(N=a.jsxs("div",{className:"flex items-center justify-between border-b border-border/70 px-3 py-1.5",children:[E,j]}),e[36]=j,e[37]=E,e[38]=N):N=e[38];let S;e[39]!==m||e[40]!==n||e[41]!==c||e[42]!==s||e[43]!==r||e[44]!==l?(S=m&&l==="preview"?a.jsx("div",{className:"h-[320px] md:h-[420px] bg-background",children:a.jsx("iframe",{srcDoc:n,title:"HTML preview",className:"h-full w-full border-0",sandbox:"allow-scripts allow-forms"})}):a.jsx("div",{className:"px-3 py-2.5",children:c?a.jsx(Ye,{language:s,style:r,customStyle:ne,codeTagProps:{style:ne},PreTag:"pre",children:n}):a.jsx("pre",{style:ne,children:a.jsx("code",{style:ne,children:n})})}),e[39]=m,e[40]=n,e[41]=c,e[42]=s,e[43]=r,e[44]=l,e[45]=S):S=e[45];let M;return e[46]!==N||e[47]!==S?(M=a.jsxs("div",{"data-component":"markdown-code",className:"my-4 group overflow-hidden rounded-2xl border border-border/80 bg-[var(--surface-elevated)]",children:[N,S]}),e[46]=N,e[47]=S,e[48]=M):M=e[48],M},$e=({syntaxTheme:t,onPreviewLoopback:e,previewLabel:n,previewTitle:s})=>({table({children:r,...o}){return a.jsx(at,{className:o.className,children:r})},h1({children:r,...o}){return a.jsx("h1",{...o,className:L("typography-markdown-h1 mt-4 mb-2 text-[var(--markdown-heading1,var(--primary))] font-semibold",o.className),children:r})},h2({children:r,...o}){return a.jsx("h2",{...o,className:L("typography-markdown-h2 mt-3.5 mb-1.5 text-[var(--markdown-heading2,var(--primary))] font-semibold",o.className),children:r})},h3({children:r,...o}){return a.jsx("h3",{...o,className:L("typography-markdown-h3 mt-3 mb-1 text-[var(--markdown-heading3,var(--primary))] font-semibold",o.className),children:r})},h4({children:r,...o}){return a.jsx("h4",{...o,className:L("typography-markdown-h4 mt-2.5 mb-1 text-[var(--markdown-heading4,var(--foreground))] font-semibold",o.className),children:r})},h5({children:r,...o}){return a.jsx("h5",{...o,className:L("typography-markdown-h4 mt-2.5 mb-1 text-[var(--markdown-heading4,var(--foreground))] font-semibold",o.className),children:r})},h6({children:r,...o}){return a.jsx("h6",{...o,className:L("typography-markdown-h4 mt-2.5 mb-1 text-[var(--markdown-heading4,var(--foreground))] font-semibold",o.className),children:r})},p({children:r,...o}){return a.jsx("p",{...o,className:L("typography-markdown-body my-2 text-foreground/90",o.className),children:r})},thead({children:r,...o}){return a.jsx("thead",{...o,className:L("[&_tr]:border-b [&_tr]:border-border/80",o.className),children:r})},tbody({children:r,...o}){return a.jsx("tbody",{...o,className:L("[&_tr:last-child]:border-0",o.className),children:r})},tr({children:r,...o}){return a.jsx("tr",{...o,className:L("border-b border-border/60",o.className),children:r})},th({children:r,...o}){return a.jsx("th",{...o,className:L("border-r border-border/60 px-4 py-2.5 text-left align-middle font-semibold text-foreground last:border-r-0",o.className),children:r})},td({children:r,...o}){return a.jsx("td",{...o,className:L("border-r border-border/60 px-4 py-2.5 align-middle text-foreground/90 last:border-r-0",o.className),children:r})},ul({children:r,...o}){return a.jsx("ul",{...o,className:L("typography-markdown-body my-2",o.className),children:r})},ol({children:r,...o}){return a.jsx("ol",{...o,className:L("typography-markdown-body my-2",o.className),children:r})},li({children:r,...o}){return a.jsx("li",{...o,className:L("typography-markdown-body my-0.5 text-foreground/90",o.className),children:r})},blockquote({children:r,...o}){return a.jsx("blockquote",{...o,className:L("my-3 border-l-2 border-[var(--markdown-blockquote-border,var(--border))] pl-4 typography-markdown-body text-[var(--markdown-blockquote,var(--muted-foreground))]",o.className),children:r})},pre({children:r,...o}){const i=C.Children.only(r),c=i.props.className,d=ft(c),l=pt(pe(i.props.children).replace(/\n$/,""),d);return d==="mermaid"?a.jsx(lt,{source:l,mode:be.getState().mermaidRenderingMode}):a.jsx(wt,{code:l,language:d,syntaxTheme:t,...o})},code({className:r,children:o,...i}){return a.jsx("code",{...i,className:L("rounded bg-[var(--surface-elevated)] px-1 py-0.5 font-mono text-[0.95em]",r),"data-markdown":"inline-code",children:o})},a({href:r,children:o,...i}){const c=r??"",d=e?et(c):!1;return a.jsxs(a.Fragment,{children:[a.jsx("a",{...i,href:r,target:he(c)?"_blank":void 0,rel:he(c)?"noopener noreferrer":void 0,children:o}),d&&e?a.jsxs("button",{type:"button",onClick:l=>{l.preventDefault(),l.stopPropagation(),e(c)},className:"ml-1 inline-flex h-5 items-center gap-0.5 rounded border border-[var(--border)] bg-[var(--surface-background)] px-1.5 align-middle text-[11px] leading-none text-[var(--muted-foreground)] transition-colors hover:bg-[var(--surface-hover)] hover:text-[var(--foreground)]","aria-label":s??n??"Open preview pane",title:s??n??"Open preview pane","data-loopback-preview-trigger":"true",children:[a.jsx(U,{name:"eye",className:"size-3","aria-hidden":"true"}),a.jsx("span",{className:"font-medium",children:n??"Preview"})]}):null]})}}),ve=C.memo(t=>{const e=V.c(5),{block:n,components:s}=t;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=[Ve,qe],e[0]=r):r=e[0];let o;e[1]===Symbol.for("react.memo_cache_sentinel")?(o=[[Ze,{throwOnError:!1,errorColor:"var(--destructive)"}]],e[1]=o):o=e[1];let i;return e[2]!==n.src||e[3]!==s?(i=a.jsx(He,{remarkPlugins:r,rehypePlugins:o,components:s,children:n.src}),e[2]=n.src,e[3]=s,e[4]=i):i=e[4],i},(t,e)=>t.block===e.block&&t.components===e.components);ve.displayName="MarkdownBlockView";const de='[data-markdown="mermaid-block"]',vt='[data-openchamber-file-link="true"]',xt=4,Ne=new Map;let oe=0;const je=[],kt=/^[A-Za-z]:[\\/]/,yt=/^\\\\[^\\]+\\[^\\]+/,Pe=new Set(["dockerfile","makefile","readme","license",".env",".gitignore",".npmrc"]),Se=Array.from(Pe).map(t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),K=t=>{const e=(t||"").trim();if(!e)return"";const n=e.replace(/\\/g,"/"),s=n.startsWith("//");let r=n.replace(/\/+/g,"/");s&&!r.startsWith("//")&&(r=`/${r}`);const o=r==="/",i=/^[A-Za-z]:\/$/.test(r);return!o&&!i&&(r=r.replace(/\/+$/,"")),r},Ie=t=>t.startsWith("/")||kt.test(t)||yt.test(t)||t.startsWith("//"),Nt=(t,e)=>{const n=K(e);if(!n)return K(t);if(Ie(n))return n;const s=K(t);if(!s)return n;const r=/^[A-Za-z]:/.test(s),o=r?s.slice(0,2):"",c=(r?s.slice(2):s).split("/").filter(Boolean),d=n.split("/").filter(Boolean);for(const l of d)if(l!=="."){if(l===".."){c.length>0&&c.pop();continue}c.push(l)}return r?`${o}/${c.join("/")}`:`/${c.join("/")}`},ae=t=>{let e=(t||"").trim();return e?((e.startsWith("`")&&e.endsWith("`")||e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e=e.replace(/[.,;!?]+$/g,""),e.endsWith(")")&&!e.includes("(")&&(e=e.slice(0,-1)),e.endsWith("]")&&!e.includes("[")&&(e=e.slice(0,-1)),e):""},me=t=>{let e=ae(t);if(!e)return"";const n=e.indexOf(";");n>=0&&(e=e.slice(0,n)),e=e.replace(/#.*$/,"");const s=e.match(/^(.*\.[A-Za-z0-9_-]{1,16}):.*$/);s&&(e=s[1]??e);const r=Se.length>0?e.match(new RegExp(`^(.*(?:/|^)(${Se})):.*$`,"i")):null;return r&&(e=r[1]??e),ae(e)},De=t=>{const e=ae(t);if(!e)return null;const n=e.indexOf(";"),s=n>=0?ae(e.slice(0,n)):e;if(!s)return null;const r=s.match(/^(.*)#L(\d+)(?:C(\d+))?$/i);if(r){const c=me(r[1]??""),d=Number.parseInt(r[2]??"",10),l=r[3]?Number.parseInt(r[3],10):void 0;return!c||!Number.isFinite(d)?null:{path:c,line:d,column:Number.isFinite(l??Number.NaN)?l:void 0}}const o=s.match(/^(.*):(\d+)(?::(\d+))?$/);if(o){const c=me(o[1]??""),d=Number.parseInt(o[2]??"",10),l=o[3]?Number.parseInt(o[3],10):void 0;return!c||!Number.isFinite(d)?null:{path:c,line:d,column:Number.isFinite(l??Number.NaN)?l:void 0}}const i=me(s);return i?{path:i}:null},jt=t=>{const e=t.split("/").filter(Boolean).pop()??"";return!e||e.endsWith(".")?!1:/\.[A-Za-z0-9_-]{1,16}$/.test(e)},ze=t=>{if(!t||t.startsWith("--")||t.includes("://")||/[<>]/.test(t)||/\s{2,}/.test(t))return!1;const e=K(t),n=e.split("/").filter(Boolean).pop()??e;if(!n||n==="."||n==="..")return!1;const s=n.toLowerCase();return Pe.has(s)||s.startsWith(".")&&s.length>1?!0:jt(e)},St=t=>{const e=De(t);return e?ze(e.path):!1},ue=t=>{if(t.tagName.toLowerCase()==="a"){const e=t.getAttribute("href")?.trim();if(e&&St(e))return e}return(t.textContent||"").trim()},fe=(t,e)=>{const n=De(t);if(!n||!ze(n.path))return null;const s=Ie(n.path)?K(n.path):Nt(e,n.path);return s?{...n,resolvedPath:s}:null},Ct=t=>{const e=K(t);if(!e)return Promise.resolve(!1);const n=Ne.get(e);if(n)return n;const s=new Promise(r=>{const o=()=>{oe+=1,fetch(`/api/fs/stat?path=${encodeURIComponent(e)}`,{method:"GET",cache:"no-store"}).then(i=>r(i.ok)).catch(()=>r(!1)).finally(()=>{oe=Math.max(0,oe-1),je.shift()?.()})};if(oe<xt){o();return}je.push(o)});return Ne.set(e,s),s},Rt=(t,e)=>{const n=K(t);if(n)return n;const s=K(e);return s.replace(/\/[^/]*$/,"")||s},Be=t=>{const e=V.c(7),{containerRef:n,effectiveDirectory:s,editor:r,preferRuntimeEditor:o,enabled:i}=t,c=C.useRef(null);let d,l;e[0]!==n||e[1]!==r||e[2]!==s||e[3]!==i||e[4]!==o?(d=()=>{const f=n.current;if(!f)return;let w=!1;const u=Lt,p=()=>{const y=f.querySelectorAll('[data-markdown="inline-code"], a');for(const h of Array.from(y)){const g=ue(h),T=fe(g,s);u(h),!(!i||!T)&&Ct(T.resolvedPath).then(A=>{if(w||!A||!f.contains(h))return;const R=ue(h),E=fe(R,s);!E||E.resolvedPath!==T.resolvedPath||(h.setAttribute("data-openchamber-file-link","true"),h.setAttribute("data-openchamber-file-ref",R),h.setAttribute("data-openchamber-file-path",E.resolvedPath),h.setAttribute("title","Open file"),h.tagName.toLowerCase()!=="a"&&(h.setAttribute("role","button"),h.setAttribute("tabindex","0")))})}},x=y=>{const h=y.getAttribute("data-openchamber-file-ref")||ue(y),g=fe(h,s);if(!g)return;const T=Rt(s,g.resolvedPath);if(o&&r){r.openFile(g.resolvedPath,Number.isFinite(g.line??Number.NaN)?Math.max(1,Math.trunc(g.line)):void 0,Number.isFinite(g.column??Number.NaN)?Math.max(1,Math.trunc(g.column)):void 0);return}const A=be.getState();Number.isFinite(g.line??Number.NaN)?A.openContextFileAtLine(T,g.resolvedPath,Math.max(1,Math.trunc(g.line)),Number.isFinite(g.column??Number.NaN)?Math.max(1,Math.trunc(g.column)):1):A.openContextFile(T,g.resolvedPath)},m=y=>{const h=y.target;if(!(h instanceof Element))return;const g=h.closest(vt);g instanceof HTMLElement&&(y.preventDefault(),y.stopPropagation(),x(g))},v=y=>{if(y.key!=="Enter"&&y.key!==" ")return;const h=y.target;!(h instanceof HTMLElement)||h.getAttribute("data-openchamber-file-link")!=="true"||(y.preventDefault(),y.stopPropagation(),x(h))};p();const k=new MutationObserver(()=>{if(c.current!==null&&typeof window<"u"&&window.clearTimeout(c.current),typeof window>"u"){p();return}c.current=window.setTimeout(()=>{c.current=null,p()},120)});return k.observe(f,{childList:!0,subtree:!0}),f.addEventListener("click",m),f.addEventListener("keydown",v),()=>{w=!0,c.current!==null&&typeof window<"u"&&window.clearTimeout(c.current),c.current=null,k.disconnect(),f.removeEventListener("click",m),f.removeEventListener("keydown",v)}},l=[n,r,s,o,i],e[0]=n,e[1]=r,e[2]=s,e[3]=i,e[4]=o,e[5]=d,e[6]=l):(d=e[5],l=e[6]),C.useEffect(d,l)},Oe=t=>{const e=V.c(6),{containerRef:n,mermaidBlocks:s,onShowPopup:r,allowWheelZoom:o}=t;let i,c;e[0]!==o||e[1]!==n||e[2]!==s||e[3]!==r?(i=()=>{const d=n.current;if(!d)return;const l=w=>{if(!r)return;const u=w.target;if(!(u instanceof Element)||u.closest('button, a, [role="button"]'))return;const p=u.closest(de);if(!p)return;const m=Array.from(d.querySelectorAll(de)).indexOf(p);if(m<0)return;const v=s[m];if(!v||v.trim().length===0)return;const k=`Diagram ${m+1}`;r({open:!0,title:k,content:"",metadata:{tool:"mermaid-preview",filename:k},mermaid:{url:`data:text/plain;charset=utf-8,${encodeURIComponent(v)}`,source:v,filename:k}})},f=w=>{if(o)return;const u=w.target;!(u instanceof Element)||!u.closest(de)||w.stopPropagation()};return d.addEventListener("click",l),d.addEventListener("wheel",f,{capture:!0,passive:!0}),()=>{d.removeEventListener("click",l),d.removeEventListener("wheel",f,!0)}},c=[o,n,s,r],e[0]=o,e[1]=n,e[2]=s,e[3]=r,e[4]=i,e[5]=c):(i=e[4],c=e[5]),C.useEffect(i,c)},Et=t=>{const e=V.c(42),{content:n,part:s,messageId:r,isAnimated:o,skipFadeIn:i,className:c,isStreaming:d,disableStreamAnimation:l,variant:f,onShowPopup:w,enableFileReferences:u}=t,p=o===void 0?!0:o,x=i===void 0?!1:i,m=d===void 0?!1:d,v=l===void 0?!1:l,k=f===void 0?"assistant":f,y=u===void 0?!0:u,h=we(),{editor:g,runtime:T}=Ce(),A=C.useRef(null),R=Re()??"";let E;e[0]!==n?(E=_e(n),e[0]=n,e[1]=E):E=e[1];const O=E;let F;e[2]!==O||e[3]!==w?(F={containerRef:A,mermaidBlocks:O,onShowPopup:w},e[2]=O,e[3]=w,e[4]=F):F=e[4],Oe(F);const P=y&&!m;let I;e[5]!==g||e[6]!==R||e[7]!==T.isVSCode||e[8]!==P?(I={containerRef:A,effectiveDirectory:R,editor:g,preferRuntimeEditor:T.isVSCode,enabled:P},e[5]=g,e[6]=R,e[7]=T.isVSCode,e[8]=P,e[9]=I):I=e[9],Be(I);let $;e[10]===Symbol.for("react.memo_cache_sentinel")?($={containerRef:A},e[10]=$):$=e[10],Me($);const z=be(_t),{t:D}=le();let B;e[11]!==R||e[12]!==z?(B=q=>{R&&z(R,q)},e[11]=R,e[12]=z,e[13]=B):B=e[13];const b=B;let j;e[14]!==D?(j=D("terminalView.preview.open"),e[14]=D,e[15]=j):j=e[15];const N=j;let S;e[16]!==D?(S=D("terminalView.preview.openTitle"),e[16]=D,e[17]=S):S=e[17];const M=S;let _;e[18]!==h?(_=Ee(h),e[18]=h,e[19]=_):_=e[19];const W=_,H=R?b:void 0;let Z;e[20]!==N||e[21]!==M||e[22]!==W||e[23]!==H?(Z=$e({syntaxTheme:W,onPreviewLoopback:H,previewLabel:N,previewTitle:M}),e[20]=N,e[21]=M,e[22]=W,e[23]=H,e[24]=Z):Z=e[24];const J=Z,X=`markdown-${s?.id?`part-${s.id}`:`message-${r}`}`,ie=Fe(n,m&&!v,X),ce=k==="tool"?"markdown-content markdown-tool":k==="reasoning"?"markdown-content markdown-reasoning":"markdown-content leading-relaxed";let G;e[25]!==c?(G=L("break-words w-full min-w-0",c),e[25]=c,e[26]=G):G=e[26];let Y;if(e[27]!==ie||e[28]!==J){let q;e[30]!==J?(q=xe=>a.jsx(ve,{block:xe,components:J},xe.key),e[30]=J,e[31]=q):q=e[31],Y=ie.map(q),e[27]=ie,e[28]=J,e[29]=Y}else Y=e[29];let Q;e[32]!==ce||e[33]!==Y?(Q=a.jsx("div",{className:ce,children:Y}),e[32]=ce,e[33]=Y,e[34]=Q):Q=e[34];let ee;e[35]!==G||e[36]!==Q?(ee=a.jsx("div",{className:G,ref:A,children:Q}),e[35]=G,e[36]=Q,e[37]=ee):ee=e[37];const te=ee;if(p){let q;return e[38]!==X||e[39]!==te||e[40]!==x?(q=a.jsx(Je,{skipAnimation:x,children:te},X),e[38]=X,e[39]=te,e[40]=x,e[41]=q):q=e[41],q}return te},It=C.memo(Et,(t,e)=>t.content===e.content&&t.isStreaming===e.isStreaming&&t.disableStreamAnimation===e.disableStreamAnimation&&t.variant===e.variant&&t.isAnimated===e.isAnimated&&t.skipFadeIn===e.skipFadeIn&&t.className===e.className&&t.messageId===e.messageId&&t.onShowPopup===e.onShowPopup&&t.part?.id===e.part?.id),Tt=t=>{const e=V.c(33),{content:n,className:s,variant:r,disableLinkSafety:o,stripFrontmatter:i,onShowPopup:c,allowMermaidWheelZoom:d,enableFileReferences:l}=t,f=r===void 0?"assistant":r,w=i===void 0?!1:i,u=d===void 0?!1:d,p=l===void 0?!0:l,{editor:x,runtime:m}=Ce();let v;e[0]!==n||e[1]!==w?(v=w?it(n):n,e[0]=n,e[1]=w,e[2]=v):v=e[2];const k=v,y=we(),h=C.useRef(null),g=Re()??"";let T;e[3]!==k?(T=_e(k),e[3]=k,e[4]=T):T=e[4];const A=T;let R;e[5]!==u||e[6]!==A||e[7]!==c?(R={containerRef:h,mermaidBlocks:A,onShowPopup:c,allowWheelZoom:u},e[5]=u,e[6]=A,e[7]=c,e[8]=R):R=e[8],Oe(R);let E;e[9]!==x||e[10]!==g||e[11]!==p||e[12]!==m.isVSCode?(E={containerRef:h,effectiveDirectory:g,editor:x,preferRuntimeEditor:m.isVSCode,enabled:p},e[9]=x,e[10]=g,e[11]=p,e[12]=m.isVSCode,e[13]=E):E=e[13],Be(E);const O=!o;let F;e[14]!==O?(F={containerRef:h,enabled:O},e[14]=O,e[15]=F):F=e[15],Me(F);let P;e[16]!==y?(P=Ee(y),e[16]=y,e[17]=P):P=e[17];const I=P;let $;e[18]!==I?($=$e({syntaxTheme:I}),e[18]=I,e[19]=$):$=e[19];const z=$,D=Fe(k,!1,`simple:${f}`),B=f==="tool"?"markdown-content markdown-tool":f==="reasoning"?"markdown-content markdown-reasoning":"markdown-content leading-relaxed";let b;e[20]!==s?(b=L("break-words w-full min-w-0",s),e[20]=s,e[21]=b):b=e[21];let j;if(e[22]!==D||e[23]!==z){let M;e[25]!==z?(M=_=>a.jsx(ve,{block:_,components:z},_.key),e[25]=z,e[26]=M):M=e[26],j=D.map(M),e[22]=D,e[23]=z,e[24]=j}else j=e[24];let N;e[27]!==B||e[28]!==j?(N=a.jsx("div",{className:B,children:j}),e[27]=B,e[28]=j,e[29]=N):N=e[29];let S;return e[30]!==b||e[31]!==N?(S=a.jsx("div",{className:b,ref:h,children:N}),e[30]=b,e[31]=N,e[32]=S):S=e[32],S},Dt=C.memo(Tt,(t,e)=>t.content===e.content&&t.variant===e.variant&&t.className===e.className&&t.disableLinkSafety===e.disableLinkSafety&&t.stripFrontmatter===e.stripFrontmatter&&t.onShowPopup===e.onShowPopup&&t.allowMermaidWheelZoom===e.allowMermaidWheelZoom&&t.enableFileReferences===e.enableFileReferences);function Mt(t){if(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.altKey||t.shiftKey)return;const e=t.target;if(!(e instanceof Element))return;const n=e.closest("a[href]");if(!(n instanceof HTMLAnchorElement)||n.getAttribute("data-openchamber-file-link")==="true")return;const s=n.getAttribute("href")??"";he(s)&&(t.preventDefault(),t.stopPropagation(),Xe(s))}function At(t){return t==="preview"?"code":"preview"}function Lt(t){t.removeAttribute("data-openchamber-file-link"),t.removeAttribute("data-openchamber-file-ref"),t.removeAttribute("data-openchamber-file-path"),t.getAttribute("title")==="Open file"&&t.removeAttribute("title"),t.tagName.toLowerCase()!=="a"&&(t.removeAttribute("role"),t.removeAttribute("tabindex"))}function _t(t){return t.openContextPreview}export{It as MarkdownRenderer,Dt as SimpleMarkdownRenderer};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as _,R as k,j as n,aW as D,aY as C,b0 as I,a$ as M,aZ as S}from"./vendor-.bun-BFTPeDgG.js";import{u as z,c as w,I as O}from"./modelPrefsAutoSave-
|
|
1
|
+
import{c as _,R as k,j as n,aW as D,aY as C,b0 as I,a$ as M,aZ as S}from"./vendor-.bun-BFTPeDgG.js";import{u as z,c as w,I as O}from"./modelPrefsAutoSave-HUPrH1r2.js";import{M as P}from"./main-DcpUnRRo.js";import"./index-CKlDk4Io.js";import"./JsonTreeView-bLRkNPS9.js";const F=R=>{const e=_.c(33),{open:b,onOpenChange:t,initialPrompt:v}=R,a=k.useId(),{t:i}=z(),N=W;let o;e[0]!==t?(o=j=>{!j&&N()||t(j)},e[0]=t,e[1]=o):o=e[1];let x;e[2]===Symbol.for("react.memo_cache_sentinel")?(x=n.jsx(D,{className:w("fixed inset-0 z-50 bg-black/50 dark:bg-black/75","transition-opacity duration-150 ease-out","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0")}),e[2]=x):x=e[2];let g;e[3]===Symbol.for("react.memo_cache_sentinel")?(g=w("relative pointer-events-auto","w-[90vw] max-w-[720px] h-[680px] max-h-[85vh]","flex flex-col rounded-xl border shadow-none overflow-hidden origin-center","bg-background","transition-all duration-150 ease-out","data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]","data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]"),e[3]=g):g=e[3];let s;e[4]!==t?(s=()=>t(!1),e[4]=t,e[5]=s):s=e[5];let l;e[6]!==i?(l=i("multiRun.window.actions.closeAria"),e[6]=i,e[7]=l):l=e[7];let h;e[8]===Symbol.for("react.memo_cache_sentinel")?(h=n.jsx(O,{name:"close",className:"h-5 w-5"}),e[8]=h):h=e[8];let r;e[9]!==s||e[10]!==l?(r=n.jsx("div",{className:"absolute right-0.5 top-0.5 z-50",children:n.jsx("button",{type:"button",onClick:s,"aria-label":l,className:"inline-flex h-7 w-7 items-center justify-center rounded-md p-0.5 text-muted-foreground hover:text-foreground hover:bg-interactive-hover/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:h})}),e[9]=s,e[10]=l,e[11]=r):r=e[11];let c;e[12]!==i?(c=i("multiRun.window.description"),e[12]=i,e[13]=c):c=e[13];let d;e[14]!==a||e[15]!==c?(d=n.jsx(C,{id:a,className:"sr-only",children:c}),e[14]=a,e[15]=c,e[16]=d):d=e[16];let u,f;e[17]!==t?(u=()=>t(!1),f=()=>t(!1),e[17]=t,e[18]=u,e[19]=f):(u=e[18],f=e[19]);let m;e[20]!==v||e[21]!==u||e[22]!==f?(m=n.jsx(P,{initialPrompt:v,onCreated:u,onCancel:f,isWindowed:!0}),e[20]=v,e[21]=u,e[22]=f,e[23]=m):m=e[23];let p;e[24]!==a||e[25]!==m||e[26]!==r||e[27]!==d?(p=n.jsxs(I,{children:[x,n.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center pointer-events-none",children:n.jsxs(M,{"aria-describedby":a,className:g,children:[r,d,m]})})]}),e[24]=a,e[25]=m,e[26]=r,e[27]=d,e[28]=p):p=e[28];let y;return e[29]!==b||e[30]!==o||e[31]!==p?(y=n.jsx(S,{open:b,onOpenChange:o,children:p}),e[29]=b,e[30]=o,e[31]=p,e[32]=y):y=e[32],y};function W(){return typeof document>"u"?!1:!!document.querySelector('[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]')}export{F as MultiRunWindow};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-.bun-BFTPeDgG.js","assets/vendor--V65Sl9C2.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as O,j as t,R as s,c as $,_ as le}from"./vendor-.bun-BFTPeDgG.js";import{u as z,eE as ie,eF as Q,a1 as X,eG as q,m as L,as as T,ak as H,N as oe,ab as ce,d as ne,cR as W,v as se,c as G,I,a3 as Y}from"./modelPrefsAutoSave-D5z_F_WP.js";import"./index-B2ztI3pp.js";function de(l){switch(l){case"ok":return null;case"auth":return"onboarding.remoteConnection.probe.authMessage";case"wrong-service":return"onboarding.remoteConnection.probe.wrongServiceMessage";case"unreachable":return"onboarding.remoteConnection.probe.unreachableMessage";default:return null}}function V(l){return l==="wrong-service"||l==="unreachable"}function ae({onBack:l,showBackButton:e=!0,initialUrl:c="",initialLabel:a="",isRecoveryMode:o=!1,onConnect:x,onSwitchToLocal:i}){const{t:n}=z(),[m,k]=O.useState(c),[g,_]=O.useState(a),[N,p]=O.useState("idle"),[h,w]=O.useState(null),[R,S]=O.useState(""),b=ie(m),f=O.useCallback(u=>{k(u.target.value),p("idle"),w(null),S("")},[]),j=O.useCallback(u=>{_(u.target.value)},[]),v=O.useCallback(async()=>{if(b){p("testing"),w(null),S("");try{const u=await Q(b);w(u),p(u.status==="ok"?"success":"error")}catch(u){S(u instanceof Error?u.message:n("onboarding.remoteConnection.errors.connectionTestFailed")),p("error")}}},[b,n]),C=O.useCallback(async()=>{if(b){p("testing"),w(null),S("");try{const u=await Q(b);if(w(u),V(u.status)){p("error");return}const r=await X(),y=g.trim()||b,K=r.hosts.find(M=>M.url===b),P=K?K.id:`host-${Date.now().toString(16)}`,J={id:P,label:y,url:b},re=K?r.hosts.map(M=>M.id===P?J:M):[...r.hosts,J];await q({hosts:re,defaultHostId:P,initialHostChoiceCompleted:!0}),x?.(),L()&&await window.__TAURI__?.core?.invoke?.("desktop_restart")}catch(u){S(u instanceof Error?u.message:n("onboarding.remoteConnection.errors.failedToSaveConnection")),p("error")}}},[b,g,x,n]),U=N==="testing",D=b!==null&&!U,A=b!==null&&!U&&!V(h?.status??null),E=de(h?.status??null),F=h?.status==="ok",B=h?.status==="auth",d=V(h?.status??null);return t.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:t.jsxs("div",{className:"w-full max-w-md space-y-6",children:[e&&t.jsx("div",{className:"flex items-center",children:t.jsx(T,{variant:"ghost",onClick:l,className:"p-0 text-muted-foreground hover:text-foreground",children:n("onboarding.common.actions.back")})}),t.jsxs("div",{className:"space-y-2 text-center",children:[t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:n(o?"onboarding.remoteConnection.titleRecovery":"onboarding.remoteConnection.title")}),t.jsx("p",{className:"text-muted-foreground text-sm",children:n("onboarding.remoteConnection.description")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:"remote-url",className:"text-sm text-foreground",children:n("onboarding.remoteConnection.field.serverAddress")}),t.jsx(H,{id:"remote-url",type:"url",value:m,onChange:f,placeholder:n("onboarding.remoteConnection.field.serverAddressPlaceholder"),disabled:U})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:"remote-label",className:"text-sm text-foreground",children:n("onboarding.remoteConnection.field.nameOptional")}),t.jsx(H,{id:"remote-label",type:"text",value:g,onChange:j,placeholder:n("onboarding.remoteConnection.field.namePlaceholder"),disabled:U})]})]}),h&&F&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-success)",color:"var(--status-success)"},children:n("onboarding.remoteConnection.status.connectedSuccessfully",{latencyMs:h.latencyMs})}),h&&B&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-warning)",color:"var(--status-warning)"},children:n("onboarding.remoteConnection.status.authWarning")}),h&&d&&t.jsxs("div",{className:"rounded-lg border p-3 text-sm space-y-3",style:{borderColor:"var(--status-error)",color:"var(--status-error)"},children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold mb-1",children:n("onboarding.remoteConnection.status.connectionFailed")}),t.jsx("div",{className:"opacity-90",children:E?n(E):null})]}),t.jsx("div",{className:"text-xs opacity-80",children:h.status==="unreachable"?n("onboarding.remoteConnection.status.suggestionsUnreachable"):n("onboarding.remoteConnection.status.suggestionsWrongService")})]}),R&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-error)",color:"var(--status-error)"},children:R}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx(T,{variant:"outline",onClick:v,disabled:!D,children:n(U?"onboarding.remoteConnection.actions.testing":"onboarding.remoteConnection.actions.testConnection")}),t.jsx(T,{onClick:C,disabled:!A,children:n("onboarding.remoteConnection.actions.connectAndRestart")})]}),d&&t.jsxs("div",{className:"flex flex-col gap-2 pt-2 border-t border-border",children:[t.jsx("div",{className:"text-xs text-muted-foreground text-center",children:n("onboarding.remoteConnection.actions.whatToDo")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(T,{variant:"outline",size:"sm",onClick:l,className:"flex-1",children:n("onboarding.remoteConnection.actions.chooseDifferentServer")}),!o&&i&&t.jsx(T,{variant:"outline",size:"sm",onClick:i,className:"flex-1",children:n("onboarding.remoteConnection.actions.useLocalInstead")})]})]})]})})}const ue="curl -fsSL https://opencode.ai/install | bash",me="https://opencode.ai/docs",pe="https://opencode.ai/docs/windows-wsl",Z=2500;function he(l){const e=$.c(5),{onCopy:c,copyTitle:a}=l;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("code",{className:"flex-1 text-left overflow-x-auto whitespace-nowrap",children:[t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"curl"}),t.jsx("span",{className:"text-muted-foreground",children:" -fsSL "}),t.jsx("span",{style:{color:"var(--syntax-string)"},children:"https://opencode.ai/install"}),t.jsx("span",{className:"text-muted-foreground",children:" | "}),t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"bash"})]}),e[0]=o):o=e[0];let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(I,{name:"file-copy",className:"h-4 w-4"}),e[1]=x):x=e[1];let i;return e[2]!==a||e[3]!==c?(i=t.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[o,t.jsx("button",{onClick:c,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0",title:a,"aria-label":a,children:x})]}),e[2]=a,e[3]=c,e[4]=i):i=e[4],i}function fe({onCliAvailable:l}){const{t:e}=z(),[c,a]=s.useState(!1),[o,x]=s.useState(!1),[i,n]=s.useState(!1),[m,k]=s.useState(!1),[g,_]=s.useState(""),[N,p]=s.useState("unknown"),[h,w]=s.useState("local"),[R,S]=s.useState(!1),[b,f]=s.useState(!1);s.useEffect(()=>{x(oe())},[]),s.useEffect(()=>{if(typeof navigator>"u"){p("unknown");return}const r=navigator.userAgent||"";/Windows/i.test(r)?p("windows"):/Macintosh|Mac OS X/i.test(r)?p("macos"):/Linux/i.test(r)?p("linux"):p("unknown")},[]),s.useEffect(()=>{let r=!1;return(async()=>{try{const y=await fetch("/api/config/settings",{method:"GET",headers:{Accept:"application/json"}});if(!y.ok)return;const K=await y.json().catch(()=>null);if(!K||r)return;const P=typeof K.opencodeBinary=="string"?K.opencodeBinary.trim():"";P&&_(P)}catch{}})(),()=>{r=!0}},[]);const j=s.useCallback(async r=>{const y=r.target;y.closest(".app-region-no-drag")||y.closest("button, a, input, select, textarea, code, summary, details")||r.button===0&&o&&await ce()},[o]),v=s.useCallback(async()=>{try{const r=await fetch("/health");if(!r.ok)return!1;const y=await r.json();return y.openCodeRunning===!0||y.isOpenCodeReady===!0}catch{return!1}},[]),C=s.useCallback(async r=>{if(!L())return;const y=await X();await q({...y,...r==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})},[]),U=s.useCallback(async()=>{L()&&await C("local"),l?.()},[l,C]);s.useEffect(()=>{if(h!=="local")return;let r=!1,y=null;const K=async()=>{if(!r){try{const P=await v();if(r)return;if(P){await U();return}}catch{}r||(y=setTimeout(K,Z))}};return y=setTimeout(K,Z),()=>{r=!0,y&&clearTimeout(y)}},[h,v,U]);const D=s.useCallback(async()=>{k(!0);try{await v()&&await U()}finally{k(!1)}},[v,U]),A=s.useCallback(async()=>{if(typeof window>"u"||!o||!L())return;const r=window.__TAURI__;if(r?.dialog?.open)try{const y=await r.dialog.open({title:e("onboarding.localSetup.dialog.selectOpencodeBinary"),multiple:!1,directory:!1});typeof y=="string"&&y.trim().length>0&&_(y.trim())}catch{}},[o,e]),E=s.useCallback(async()=>{n(!0);try{if(await ne({opencodeBinary:g.trim()}),L()){await C("local"),await W();return}await fetch("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>n(!1),1e3)}},[g,C]),F=s.useCallback(async()=>{const r=await se(ue);r.ok?(a(!0),setTimeout(()=>a(!1),2e3)):console.error("Failed to copy:",r.error)},[]),B=N==="windows"?pe:me,d=N==="windows"?"C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd":N==="linux"?"/home/you/.bun/bin/opencode":"/Users/you/.bun/bin/opencode",u=!o||!L()||h==="local";return t.jsx("div",{className:"app-region-drag h-full flex items-center justify-center bg-transparent p-8 cursor-default select-none overflow-y-auto",onMouseDown:j,children:t.jsxs("div",{className:"w-full max-w-md space-y-7",children:[t.jsxs("header",{className:"text-center space-y-1.5",children:[t.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:e("onboarding.chooser.title")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:e("onboarding.chooser.description")})]}),o&&L()&&t.jsxs("div",{className:"app-region-no-drag flex gap-1.5",children:[t.jsx("button",{type:"button",className:G("flex-1 px-4 py-2 rounded-lg border transition-colors text-sm",h==="local"?"border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground"),onClick:()=>w("local"),children:e("onboarding.chooser.tabs.localInstall")}),t.jsx("button",{type:"button",className:G("flex-1 px-4 py-2 rounded-lg border transition-colors text-sm",h==="remote"?"border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground"),onClick:()=>w("remote"),children:e("onboarding.chooser.tabs.connectRemote")})]}),o&&L()&&h==="remote"?t.jsx("div",{className:"app-region-no-drag",children:t.jsx(ae,{onBack:()=>w("local"),showBackButton:!1,onSwitchToLocal:()=>w("local")})}):null,u&&t.jsxs("div",{className:"space-y-4",children:[N==="windows"&&t.jsxs("div",{className:"rounded-lg border border-border bg-background/50 p-4",children:[t.jsx("div",{className:"text-sm text-foreground",children:e("onboarding.localSetup.windows.title")}),t.jsxs("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground",children:[t.jsxs("li",{children:[e("onboarding.localSetup.windows.stepInstallWsl")," ",t.jsx("code",{className:"text-foreground/80",children:"wsl --install"})," ",e("onboarding.localSetup.windows.stepInstallWslSuffix")]}),t.jsx("li",{children:e("onboarding.localSetup.windows.stepRunInstallInWsl")}),t.jsx("li",{children:e("onboarding.localSetup.windows.stepSetBinaryPath")})]})]}),t.jsx("p",{className:"text-sm text-muted-foreground text-center leading-relaxed",children:e("onboarding.localSetup.intro")}),t.jsx("div",{className:"app-region-no-drag rounded-lg border border-border bg-background/60 backdrop-blur-sm px-4 py-3 font-mono text-sm",children:c?t.jsxs("div",{className:"flex items-center gap-2",style:{color:"var(--status-success)"},children:[t.jsx(I,{name:"check",className:"h-4 w-4"}),e("onboarding.common.status.copiedToClipboard")]}):t.jsx(he,{onCopy:F,copyTitle:e("onboarding.common.copyToClipboard")})}),t.jsxs("div",{className:"app-region-no-drag flex items-center justify-between",children:[t.jsxs("a",{href:B,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1",children:[e(N==="windows"?"onboarding.localSetup.docs.windows":"onboarding.localSetup.docs.default"),t.jsx(I,{name:"external-link",className:"h-3 w-3"})]}),t.jsx("button",{type:"button",onClick:D,disabled:m,className:"text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:e(m?"onboarding.localSetup.actions.checking":"onboarding.localSetup.actions.checkNow")})]}),t.jsxs("div",{className:"rounded-lg border px-4 py-3 flex items-center gap-3",style:{borderColor:"color-mix(in srgb, var(--primary-base) 20%, transparent)",backgroundColor:"color-mix(in srgb, var(--primary-base) 6%, transparent)"},role:"status","aria-live":"polite",children:[t.jsxs("span",{className:"relative inline-flex h-2.5 w-2.5 shrink-0","aria-hidden":!0,children:[t.jsx("span",{className:"absolute inset-0 rounded-full",style:{backgroundColor:"var(--primary-base)",animation:"pulse-opacity 1.6s ease-in-out infinite"}}),t.jsx("span",{className:"absolute inset-[-4px] rounded-full",style:{backgroundColor:"var(--primary-base)",animation:"pulse-opacity-dim 1.6s ease-in-out infinite",opacity:0}})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm text-foreground leading-tight",children:e("onboarding.localSetup.status.watching")}),t.jsx("div",{className:"text-xs text-muted-foreground leading-tight mt-0.5",children:e("onboarding.localSetup.status.autoContinue")})]})]}),t.jsxs("details",{className:"app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors",open:R,onToggle:r=>S(r.currentTarget.open),children:[t.jsxs("summary",{className:"flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden",children:[t.jsx("span",{children:e("onboarding.localSetup.advanced.title")}),t.jsx(I,{name:"arrow-down-s",className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),t.jsxs("div",{className:"pb-4 space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H,{value:g,onChange:r=>_(r.target.value),placeholder:d,disabled:i,className:"flex-1 font-mono text-xs"}),t.jsx(T,{type:"button",variant:"secondary",size:"sm",onClick:A,disabled:i||!o||!L(),children:e("onboarding.localSetup.actions.browse")}),t.jsx(T,{type:"button",size:"sm",onClick:E,disabled:i||!g.trim(),children:e("onboarding.localSetup.actions.apply")})]}),t.jsx("p",{className:"text-xs text-muted-foreground/70",children:e("onboarding.localSetup.helper.saveAndReload")})]})]}),t.jsxs("details",{className:"app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors",open:b,onToggle:r=>f(r.currentTarget.open),children:[t.jsxs("summary",{className:"flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden",children:[t.jsx("span",{children:e("onboarding.localSetup.troubleshoot.title")}),t.jsx(I,{name:"arrow-down-s",className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),t.jsx("ul",{className:"pb-4 space-y-1.5 text-xs text-muted-foreground list-disc pl-4",children:N==="windows"?t.jsxs(t.Fragment,{children:[t.jsx("li",{children:e("onboarding.localSetup.windows.hintInstallInWsl")}),t.jsx("li",{children:e("onboarding.localSetup.windows.hintDetectionFailed")})]}):t.jsxs(t.Fragment,{children:[t.jsx("li",{children:e("onboarding.localSetup.hint.ensurePath")}),t.jsx("li",{children:e("onboarding.localSetup.hint.setEnv")}),t.jsx("li",{children:e("onboarding.localSetup.hint.missingRuntime")})]})})]})]})]})})}const xe="curl -fsSL https://opencode.ai/install | bash",ge="https://opencode.ai/docs",be="https://opencode.ai/docs/windows-wsl";function ye(l){const e=$.c(5),{onCopy:c,copyTitle:a}=l;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("code",{children:[t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"curl"}),t.jsx("span",{className:"text-muted-foreground",children:" -fsSL "}),t.jsx("span",{style:{color:"var(--syntax-string)"},children:"https://opencode.ai/install"}),t.jsx("span",{className:"text-muted-foreground",children:" | "}),t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"bash"})]}),e[0]=o):o=e[0];let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(I,{name:"file-copy",className:"h-4 w-4"}),e[1]=x):x=e[1];let i;return e[2]!==a||e[3]!==c?(i=t.jsxs("div",{className:"flex items-center justify-center gap-3",children:[o,t.jsx("button",{onClick:c,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors",title:a,children:x})]}),e[2]=a,e[3]=c,e[4]=i):i=e[4],i}const ve=3e4;function we({onBack:l,onCliAvailable:e,isFromRecovery:c=!1,onSwitchToRemote:a}){const{t:o}=z(),[x,i]=s.useState(!1),[n,m]=s.useState(!1),[k,g]=s.useState(!1),[_,N]=s.useState(!1),[p,h]=s.useState(!1),[w,R]=s.useState(null),[S,b]=s.useState(""),[f,j]=s.useState("unknown");s.useEffect(()=>{const d=setTimeout(()=>m(!0),ve);return()=>clearTimeout(d)},[]),s.useEffect(()=>{g(oe())},[]),s.useEffect(()=>{if(typeof navigator>"u"){j("unknown");return}const d=navigator.userAgent||"";if(/Windows/i.test(d)){j("windows");return}if(/Macintosh|Mac OS X/i.test(d)){j("macos");return}if(/Linux/i.test(d)){j("linux");return}j("unknown")},[]),s.useEffect(()=>{let d=!1;return(async()=>{try{const u=await fetch("/api/config/settings",{method:"GET",headers:{Accept:"application/json"}});if(!u.ok)return;const r=await u.json().catch(()=>null);if(!r||d)return;const y=typeof r.opencodeBinary=="string"?r.opencodeBinary.trim():"";y&&b(y)}catch{}})(),()=>{d=!0}},[]);const v=s.useCallback(async d=>{if(!d.target.closest("button, a, input, select, textarea, code")&&d.button===0&&k&&L())try{const{getCurrentWindow:u}=await le(async()=>{const{getCurrentWindow:y}=await import("./vendor-.bun-BFTPeDgG.js").then(K=>K.bK);return{getCurrentWindow:y}},__vite__mapDeps([0,1]));await u().startDragging()}catch(u){console.error("Failed to start window dragging:",u)}},[k]),C=s.useCallback(async()=>{try{const d=await fetch("/health");if(!d.ok)return!1;const u=await d.json();return u.openCodeRunning===!0||u.isOpenCodeReady===!0}catch{return!1}},[]),U=s.useCallback(async()=>{if(typeof window>"u"||!k||!L())return;const d=window.__TAURI__;if(d?.dialog?.open)try{const u=await d.dialog.open({title:o("onboarding.localSetup.dialog.selectOpencodeBinary"),multiple:!1,directory:!1});typeof u=="string"&&u.trim().length>0&&b(u.trim())}catch{}},[k,o]),D=s.useCallback(async()=>{N(!0);try{if(await ne({opencodeBinary:S.trim()}),L()){await W();return}await fetch("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>N(!1),1e3)}},[S]),A=s.useCallback(async()=>{const d=await se(xe);d.ok?(i(!0),setTimeout(()=>i(!1),2e3)):console.error("Failed to copy:",d.error)},[]),E=s.useCallback(async()=>{h(!0),R(null);try{await C()?e?.():R(o("onboarding.localSetup.errors.cliNotReady"))}catch(d){R(d instanceof Error?d.message:o("onboarding.localSetup.errors.detectionFailed"))}finally{h(!1)}},[C,e,o]),F=f==="windows"?be:ge,B=f==="windows"?"C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd":f==="linux"?"/home/you/.bun/bin/opencode":"/Users/you/.bun/bin/opencode";return t.jsxs("div",{className:"h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none",onMouseDown:v,children:[t.jsxs("div",{className:"w-full max-w-lg space-y-4 text-center",children:[t.jsx("div",{className:"flex items-center",children:t.jsx(T,{variant:"ghost",onClick:l,className:"p-0 text-muted-foreground hover:text-foreground",children:o("onboarding.common.actions.back")})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-foreground",children:o("onboarding.localSetup.title")}),t.jsx("p",{className:"text-muted-foreground",children:o("onboarding.localSetup.description")})]}),f==="windows"&&t.jsxs("div",{className:"mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-left",children:[t.jsx("div",{className:"text-sm text-foreground",children:o("onboarding.localSetup.windows.title")}),t.jsxs("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground",children:[t.jsxs("li",{children:[o("onboarding.localSetup.windows.stepInstallWsl")," ",t.jsx("code",{className:"text-foreground/80",children:"wsl --install"})," ",o("onboarding.localSetup.windows.stepInstallWslSuffix")]}),t.jsx("li",{children:o("onboarding.localSetup.windows.stepRunInstallInWsl")}),t.jsx("li",{children:o("onboarding.localSetup.windows.stepSetBinaryPath")})]})]}),t.jsx("div",{className:"flex justify-center",children:t.jsx("div",{className:"bg-background/60 backdrop-blur-sm border border-border rounded-lg px-5 py-3 font-mono text-sm w-fit",children:x?t.jsxs("div",{className:"flex items-center justify-center gap-2",style:{color:"var(--status-success)"},children:[t.jsx(I,{name:"check",className:"h-4 w-4"}),o("onboarding.common.status.copiedToClipboard")]}):t.jsx(ye,{onCopy:A,copyTitle:o("onboarding.common.copyToClipboard")})})}),t.jsxs("a",{href:F,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1 justify-center",children:[o(f==="windows"?"onboarding.localSetup.docs.windows":"onboarding.localSetup.docs.default"),t.jsx(I,{name:"external-link",className:"h-3 w-3"})]}),w&&t.jsx("div",{className:"mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive",children:w}),t.jsxs("div",{className:"space-y-3",children:[t.jsx(T,{type:"button",onClick:E,disabled:p,className:"w-full max-w-xs",size:"lg",children:o(p?"onboarding.localSetup.actions.checking":"onboarding.localSetup.actions.checkAndContinue")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o("onboarding.localSetup.helper.checkAndContinue")})]}),t.jsx("div",{className:"mx-auto w-full max-w-xl pt-4",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"text-sm text-muted-foreground",children:o("onboarding.localSetup.field.alreadyInstalled")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H,{value:S,onChange:d=>b(d.target.value),placeholder:B,disabled:_,className:"flex-1 font-mono text-xs"}),t.jsx(T,{type:"button",variant:"secondary",onClick:U,disabled:_||!k||!L(),children:o("onboarding.localSetup.actions.browse")}),t.jsx(T,{type:"button",onClick:D,disabled:_,children:o("onboarding.localSetup.actions.apply")})]}),t.jsx("div",{className:"text-xs text-muted-foreground/70",children:o("onboarding.localSetup.helper.saveAndReload")})]})}),c&&a&&t.jsxs("div",{className:"text-center pt-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:o("onboarding.localSetup.remotePreference")}),t.jsx(T,{variant:"link",onClick:a,children:o("onboarding.localSetup.actions.connectRemoteServer")})]})]}),n&&t.jsx("div",{className:"absolute bottom-8 left-0 right-0 text-center space-y-1",children:f==="windows"?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.windows.hintInstallInWsl")}),t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.windows.hintDetectionFailed")})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.hint.ensurePath")}),t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.hint.setEnv")}),t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.hint.missingRuntime")})]})})]})}function ee(l,e){if(l?.trim())return Y(l.trim());if(e)return Y(e)}function je(l,e,c){switch(l){case"local-unavailable":return{title:"Local OpenCode Unavailable",description:"OpenCode CLI could not be started or is not installed. Install OpenCode or connect to a remote server instead.",titleKey:"onboarding.desktopRecovery.localUnavailable.title",descriptionKey:"onboarding.desktopRecovery.localUnavailable.description",iconKey:"local",showRetry:!0,retryLabel:"Retry Local",retryLabelKey:"onboarding.desktopRecovery.localUnavailable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Set Up Local",useLocalLabelKey:"onboarding.desktopRecovery.localUnavailable.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};case"remote-missing":return{title:"No Default Connection",description:"Your saved default connection could not be found. Choose how you want to connect.",titleKey:"onboarding.desktopRecovery.noDefaultConnection.title",descriptionKey:"onboarding.desktopRecovery.noDefaultConnection.description",iconKey:"local",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};case"remote-unreachable":{const a=ee(e,c);return{title:"Remote Server Unreachable",description:`Could not connect to "${a||"the remote server"}". Check your network connection and verify the server address.`,titleKey:"onboarding.desktopRecovery.remoteUnreachable.title",descriptionKey:"onboarding.desktopRecovery.remoteUnreachable.description",descriptionParams:a?{host:a}:void 0,iconKey:"remote",showRetry:!0,retryLabel:"Retry Connection",retryLabelKey:"onboarding.desktopRecovery.remoteUnreachable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"remote-wrong-service":{const a=ee(e,c);return{title:"Incompatible Server",description:`The server at "${a||"unknown"}" is not running OpenChamber. Verify the address points to an OpenChamber server.`,titleKey:"onboarding.desktopRecovery.incompatibleServer.title",descriptionKey:"onboarding.desktopRecovery.incompatibleServer.description",descriptionParams:a?{host:a}:void 0,iconKey:"remote",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"missing-default-host":return{title:"No Default Connection",description:"Your saved default connection could not be found. Choose how you want to connect.",titleKey:"onboarding.desktopRecovery.noDefaultConnection.title",descriptionKey:"onboarding.desktopRecovery.noDefaultConnection.description",iconKey:"local",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};default:{const a=l;throw new Error(`Unknown recovery variant: ${a}`)}}}function ke(l){switch(l){case"local":return t.jsx(I,{name:"macbook",className:"h-8 w-8"});case"remote":return t.jsx(I,{name:"server",className:"h-8 w-8"})}}function Ce({variant:l,hostLabel:e,hostUrl:c,onRetry:a,onUseLocal:o,onUseRemote:x,isRetrying:i=!1}){const{t:n}=z(),m=je(l,e,c),k=m.retryLabelKey??"onboarding.desktopRecovery.actions.retryConnection",g=s.useMemo(()=>{if(m.descriptionParams?.host)return m.descriptionParams;if(l==="remote-unreachable")return{host:n("onboarding.desktopRecovery.placeholders.remoteServer")};if(l==="remote-wrong-service")return{host:n("onboarding.desktopRecovery.placeholders.unknownServer")}},[m.descriptionParams,n,l]);return t.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:t.jsxs("div",{className:"w-full max-w-md space-y-6",children:[t.jsxs("div",{className:"flex flex-col items-center space-y-3 text-center",children:[t.jsx("div",{className:"p-3 rounded-full",style:{backgroundColor:"var(--status-warning)",opacity:.15},children:t.jsx("div",{style:{color:"var(--status-warning)"},children:ke(m.iconKey)})}),t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:n(m.titleKey)}),t.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:n(m.descriptionKey,g)})]}),c&&(l==="remote-unreachable"||l==="remote-wrong-service")&&t.jsxs("div",{className:"rounded-lg border border-border bg-background/50 p-3",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:n("onboarding.remoteConnection.field.serverAddress")}),t.jsx("div",{className:"font-mono text-sm text-foreground truncate",children:Y(c)})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[m.showRetry&&a&&t.jsxs(T,{onClick:a,disabled:i,className:"w-full",children:[t.jsx(I,{name:"refresh",className:G("h-4 w-4",i&&"animate-spin")}),n(i?"onboarding.desktopRecovery.actions.retrying":k)]}),t.jsxs("div",{className:"flex gap-2",children:[m.showUseLocal&&o&&t.jsxs(T,{variant:"outline",onClick:o,disabled:i,className:"flex-1",children:[t.jsx(I,{name:"macbook",className:"h-4 w-4"}),n(m.useLocalLabelKey)]}),m.showUseRemote&&x&&t.jsxs(T,{variant:"outline",onClick:x,disabled:i,className:"flex-1",children:[t.jsx(I,{name:"server",className:"h-4 w-4"}),n(m.useRemoteLabelKey)]})]})]})]})})}function te(l,e){if(e==="use-remote")return{kind:"remote-form"};switch(l){case"local-unavailable":return{kind:"local-setup"};case"remote-unreachable":case"remote-wrong-service":case"remote-missing":case"missing-default-host":return{kind:"switch-default-to-local"};default:{const c=l;throw new Error(`Unhandled RecoveryVariant: ${c}`)}}}function Se(l){const e=$.c(27),{variant:c,hostUrl:a,hostLabel:o,onRetry:x,onChooseRemote:i,showRemoteForm:n,onCloseRemoteForm:m,onSwitchToLocalFromRemote:k,onEnterLocalSetup:g,isRetrying:_}=l,N=n===void 0?!1:n,p=_===void 0?!1:_,h=Ne;let w;e[0]!==x?(w=async()=>{if(L()){await W();return}await fetch("/api/config/reload",{method:"POST"}),x?.()},e[0]=x,e[1]=w):w=e[1];const R=w;let S;e[2]!==g||e[3]!==c?(S=async()=>{if(te(c,"use-local").kind==="local-setup"){g?.();return}if(await h("local"),L()){await W();return}window.location.reload()},e[2]=g,e[3]=c,e[4]=S):S=e[4];const b=S;let f;e[5]!==i||e[6]!==c?(f=()=>{te(c,"use-remote").kind==="remote-form"&&i?.()},e[5]=i,e[6]=c,e[7]=f):f=e[7];const j=f;if(N){const C=c==="remote-wrong-service"?"":a||"",U=c==="remote-wrong-service"?"":o||"";let D;e[8]!==i||e[9]!==m?(D=m||(()=>i?.()),e[8]=i,e[9]=m,e[10]=D):D=e[10];let A;e[11]!==g||e[12]!==k?(A=k||(()=>{h("local").then(()=>{L()?W():g?.()})}),e[11]=g,e[12]=k,e[13]=A):A=e[13];let E;return e[14]!==U||e[15]!==C||e[16]!==D||e[17]!==A?(E=t.jsx(ae,{onBack:D,initialUrl:C,initialLabel:U,isRecoveryMode:!0,onSwitchToLocal:A}),e[14]=U,e[15]=C,e[16]=D,e[17]=A,e[18]=E):E=e[18],E}let v;return e[19]!==R||e[20]!==b||e[21]!==j||e[22]!==o||e[23]!==a||e[24]!==p||e[25]!==c?(v=t.jsx(Ce,{variant:c,hostLabel:o,hostUrl:a,onRetry:R,onUseLocal:b,onUseRemote:j,isRetrying:p}),e[19]=R,e[20]=b,e[21]=j,e[22]=o,e[23]=a,e[24]=p,e[25]=c,e[26]=v):v=e[26],v}async function Ne(l){if(!L())return;const e=await X();await q({...e,...l==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})}function Ue(l){const e=$.c(26),{onBack:c,onCliAvailable:a,mode:o,recoveryVariant:x,recoveryHostUrl:i,recoveryHostLabel:n,onEnterLocalSetup:m}=l,k=o===void 0?"first-launch":o,g=x===void 0?"missing-default-host":x,[_,N]=s.useState(!1),[p,h]=s.useState(!1);let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{h(!1),N(!1)},e[0]=w):w=e[0];let R;e[1]!==k||e[2]!==n||e[3]!==i||e[4]!==g?(R=[k,g,i,n],e[1]=k,e[2]=n,e[3]=i,e[4]=g,e[5]=R):R=e[5],s.useEffect(w,R);const S=p?"local-setup":k;if(S==="recovery"){let f,j;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>N(!1),j=()=>{N(!1),h(!0)},e[6]=f,e[7]=j):(f=e[6],j=e[7]);let v;e[8]!==m?(v=()=>{h(!0),m?.()},e[8]=m,e[9]=v):v=e[9];let C;return e[10]!==n||e[11]!==i||e[12]!==g||e[13]!==_||e[14]!==v?(C=t.jsx(Se,{variant:g,hostUrl:i,hostLabel:n,showRemoteForm:_,onCloseRemoteForm:f,onSwitchToLocalFromRemote:j,onEnterLocalSetup:v}),e[10]=n,e[11]=i,e[12]=g,e[13]=_,e[14]=v,e[15]=C):C=e[15],C}if(S==="local-setup"){let f;e[16]!==c||e[17]!==p?(f=()=>{p?h(!1):c?.()},e[16]=c,e[17]=p,e[18]=f):f=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=()=>N(!0),e[19]=j):j=e[19];let v;return e[20]!==a||e[21]!==p||e[22]!==f?(v=t.jsx(we,{onBack:f,onCliAvailable:a,isFromRecovery:p,onSwitchToRemote:j}),e[20]=a,e[21]=p,e[22]=f,e[23]=v):v=e[23],v}let b;return e[24]!==a?(b=t.jsx(fe,{onCliAvailable:a}),e[24]=a,e[25]=b):b=e[25],b}export{Ue as OnboardingScreen};
|
|
2
|
+
import{r as O,j as t,R as s,c as $,_ as le}from"./vendor-.bun-BFTPeDgG.js";import{u as z,eJ as ie,eK as Q,a1 as X,eL as J,m as L,at as T,al as H,N as oe,ab as ce,d as ne,cS as W,v as se,c as G,I,a3 as Y}from"./modelPrefsAutoSave-HUPrH1r2.js";import"./index-CKlDk4Io.js";function de(l){switch(l){case"ok":return null;case"auth":return"onboarding.remoteConnection.probe.authMessage";case"wrong-service":return"onboarding.remoteConnection.probe.wrongServiceMessage";case"unreachable":return"onboarding.remoteConnection.probe.unreachableMessage";default:return null}}function V(l){return l==="wrong-service"||l==="unreachable"}function ae({onBack:l,showBackButton:e=!0,initialUrl:c="",initialLabel:a="",isRecoveryMode:o=!1,onConnect:x,onSwitchToLocal:i}){const{t:n}=z(),[m,k]=O.useState(c),[g,_]=O.useState(a),[N,p]=O.useState("idle"),[h,w]=O.useState(null),[R,S]=O.useState(""),b=ie(m),f=O.useCallback(u=>{k(u.target.value),p("idle"),w(null),S("")},[]),j=O.useCallback(u=>{_(u.target.value)},[]),v=O.useCallback(async()=>{if(b){p("testing"),w(null),S("");try{const u=await Q(b);w(u),p(u.status==="ok"?"success":"error")}catch(u){S(u instanceof Error?u.message:n("onboarding.remoteConnection.errors.connectionTestFailed")),p("error")}}},[b,n]),C=O.useCallback(async()=>{if(b){p("testing"),w(null),S("");try{const u=await Q(b);if(w(u),V(u.status)){p("error");return}const r=await X(),y=g.trim()||b,K=r.hosts.find(M=>M.url===b),P=K?K.id:`host-${Date.now().toString(16)}`,q={id:P,label:y,url:b},re=K?r.hosts.map(M=>M.id===P?q:M):[...r.hosts,q];await J({hosts:re,defaultHostId:P,initialHostChoiceCompleted:!0}),x?.(),L()&&await window.__TAURI__?.core?.invoke?.("desktop_restart")}catch(u){S(u instanceof Error?u.message:n("onboarding.remoteConnection.errors.failedToSaveConnection")),p("error")}}},[b,g,x,n]),U=N==="testing",D=b!==null&&!U,A=b!==null&&!U&&!V(h?.status??null),E=de(h?.status??null),F=h?.status==="ok",B=h?.status==="auth",d=V(h?.status??null);return t.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:t.jsxs("div",{className:"w-full max-w-md space-y-6",children:[e&&t.jsx("div",{className:"flex items-center",children:t.jsx(T,{variant:"ghost",onClick:l,className:"p-0 text-muted-foreground hover:text-foreground",children:n("onboarding.common.actions.back")})}),t.jsxs("div",{className:"space-y-2 text-center",children:[t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:n(o?"onboarding.remoteConnection.titleRecovery":"onboarding.remoteConnection.title")}),t.jsx("p",{className:"text-muted-foreground text-sm",children:n("onboarding.remoteConnection.description")})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:"remote-url",className:"text-sm text-foreground",children:n("onboarding.remoteConnection.field.serverAddress")}),t.jsx(H,{id:"remote-url",type:"url",value:m,onChange:f,placeholder:n("onboarding.remoteConnection.field.serverAddressPlaceholder"),disabled:U})]}),t.jsxs("div",{className:"space-y-2",children:[t.jsx("label",{htmlFor:"remote-label",className:"text-sm text-foreground",children:n("onboarding.remoteConnection.field.nameOptional")}),t.jsx(H,{id:"remote-label",type:"text",value:g,onChange:j,placeholder:n("onboarding.remoteConnection.field.namePlaceholder"),disabled:U})]})]}),h&&F&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-success)",color:"var(--status-success)"},children:n("onboarding.remoteConnection.status.connectedSuccessfully",{latencyMs:h.latencyMs})}),h&&B&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-warning)",color:"var(--status-warning)"},children:n("onboarding.remoteConnection.status.authWarning")}),h&&d&&t.jsxs("div",{className:"rounded-lg border p-3 text-sm space-y-3",style:{borderColor:"var(--status-error)",color:"var(--status-error)"},children:[t.jsxs("div",{children:[t.jsx("div",{className:"font-semibold mb-1",children:n("onboarding.remoteConnection.status.connectionFailed")}),t.jsx("div",{className:"opacity-90",children:E?n(E):null})]}),t.jsx("div",{className:"text-xs opacity-80",children:h.status==="unreachable"?n("onboarding.remoteConnection.status.suggestionsUnreachable"):n("onboarding.remoteConnection.status.suggestionsWrongService")})]}),R&&t.jsx("div",{className:"rounded-lg border p-3 text-sm",style:{borderColor:"var(--status-error)",color:"var(--status-error)"},children:R}),t.jsxs("div",{className:"flex gap-3",children:[t.jsx(T,{variant:"outline",onClick:v,disabled:!D,children:n(U?"onboarding.remoteConnection.actions.testing":"onboarding.remoteConnection.actions.testConnection")}),t.jsx(T,{onClick:C,disabled:!A,children:n("onboarding.remoteConnection.actions.connectAndRestart")})]}),d&&t.jsxs("div",{className:"flex flex-col gap-2 pt-2 border-t border-border",children:[t.jsx("div",{className:"text-xs text-muted-foreground text-center",children:n("onboarding.remoteConnection.actions.whatToDo")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(T,{variant:"outline",size:"sm",onClick:l,className:"flex-1",children:n("onboarding.remoteConnection.actions.chooseDifferentServer")}),!o&&i&&t.jsx(T,{variant:"outline",size:"sm",onClick:i,className:"flex-1",children:n("onboarding.remoteConnection.actions.useLocalInstead")})]})]})]})})}const ue="curl -fsSL https://opencode.ai/install | bash",me="https://opencode.ai/docs",pe="https://opencode.ai/docs/windows-wsl",Z=2500;function he(l){const e=$.c(5),{onCopy:c,copyTitle:a}=l;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("code",{className:"flex-1 text-left overflow-x-auto whitespace-nowrap",children:[t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"curl"}),t.jsx("span",{className:"text-muted-foreground",children:" -fsSL "}),t.jsx("span",{style:{color:"var(--syntax-string)"},children:"https://opencode.ai/install"}),t.jsx("span",{className:"text-muted-foreground",children:" | "}),t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"bash"})]}),e[0]=o):o=e[0];let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(I,{name:"file-copy",className:"h-4 w-4"}),e[1]=x):x=e[1];let i;return e[2]!==a||e[3]!==c?(i=t.jsxs("div",{className:"flex items-center justify-between gap-3 w-full",children:[o,t.jsx("button",{onClick:c,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors shrink-0",title:a,"aria-label":a,children:x})]}),e[2]=a,e[3]=c,e[4]=i):i=e[4],i}function fe({onCliAvailable:l}){const{t:e}=z(),[c,a]=s.useState(!1),[o,x]=s.useState(!1),[i,n]=s.useState(!1),[m,k]=s.useState(!1),[g,_]=s.useState(""),[N,p]=s.useState("unknown"),[h,w]=s.useState("local"),[R,S]=s.useState(!1),[b,f]=s.useState(!1);s.useEffect(()=>{x(oe())},[]),s.useEffect(()=>{if(typeof navigator>"u"){p("unknown");return}const r=navigator.userAgent||"";/Windows/i.test(r)?p("windows"):/Macintosh|Mac OS X/i.test(r)?p("macos"):/Linux/i.test(r)?p("linux"):p("unknown")},[]),s.useEffect(()=>{let r=!1;return(async()=>{try{const y=await fetch("/api/config/settings",{method:"GET",headers:{Accept:"application/json"}});if(!y.ok)return;const K=await y.json().catch(()=>null);if(!K||r)return;const P=typeof K.opencodeBinary=="string"?K.opencodeBinary.trim():"";P&&_(P)}catch{}})(),()=>{r=!0}},[]);const j=s.useCallback(async r=>{const y=r.target;y.closest(".app-region-no-drag")||y.closest("button, a, input, select, textarea, code, summary, details")||r.button===0&&o&&await ce()},[o]),v=s.useCallback(async()=>{try{const r=await fetch("/health");if(!r.ok)return!1;const y=await r.json();return y.openCodeRunning===!0||y.isOpenCodeReady===!0}catch{return!1}},[]),C=s.useCallback(async r=>{if(!L())return;const y=await X();await J({...y,...r==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})},[]),U=s.useCallback(async()=>{L()&&await C("local"),l?.()},[l,C]);s.useEffect(()=>{if(h!=="local")return;let r=!1,y=null;const K=async()=>{if(!r){try{const P=await v();if(r)return;if(P){await U();return}}catch{}r||(y=setTimeout(K,Z))}};return y=setTimeout(K,Z),()=>{r=!0,y&&clearTimeout(y)}},[h,v,U]);const D=s.useCallback(async()=>{k(!0);try{await v()&&await U()}finally{k(!1)}},[v,U]),A=s.useCallback(async()=>{if(typeof window>"u"||!o||!L())return;const r=window.__TAURI__;if(r?.dialog?.open)try{const y=await r.dialog.open({title:e("onboarding.localSetup.dialog.selectOpencodeBinary"),multiple:!1,directory:!1});typeof y=="string"&&y.trim().length>0&&_(y.trim())}catch{}},[o,e]),E=s.useCallback(async()=>{n(!0);try{if(await ne({opencodeBinary:g.trim()}),L()){await C("local"),await W();return}await fetch("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>n(!1),1e3)}},[g,C]),F=s.useCallback(async()=>{const r=await se(ue);r.ok?(a(!0),setTimeout(()=>a(!1),2e3)):console.error("Failed to copy:",r.error)},[]),B=N==="windows"?pe:me,d=N==="windows"?"C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd":N==="linux"?"/home/you/.bun/bin/opencode":"/Users/you/.bun/bin/opencode",u=!o||!L()||h==="local";return t.jsx("div",{className:"app-region-drag h-full flex items-center justify-center bg-transparent p-8 cursor-default select-none overflow-y-auto",onMouseDown:j,children:t.jsxs("div",{className:"w-full max-w-md space-y-7",children:[t.jsxs("header",{className:"text-center space-y-1.5",children:[t.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:e("onboarding.chooser.title")}),t.jsx("p",{className:"text-sm text-muted-foreground",children:e("onboarding.chooser.description")})]}),o&&L()&&t.jsxs("div",{className:"app-region-no-drag flex gap-1.5",children:[t.jsx("button",{type:"button",className:G("flex-1 px-4 py-2 rounded-lg border transition-colors text-sm",h==="local"?"border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground"),onClick:()=>w("local"),children:e("onboarding.chooser.tabs.localInstall")}),t.jsx("button",{type:"button",className:G("flex-1 px-4 py-2 rounded-lg border transition-colors text-sm",h==="remote"?"border-[var(--interactive-selection)] text-foreground bg-[var(--interactive-selection)]/10":"border-border text-muted-foreground hover:text-foreground hover:border-muted-foreground"),onClick:()=>w("remote"),children:e("onboarding.chooser.tabs.connectRemote")})]}),o&&L()&&h==="remote"?t.jsx("div",{className:"app-region-no-drag",children:t.jsx(ae,{onBack:()=>w("local"),showBackButton:!1,onSwitchToLocal:()=>w("local")})}):null,u&&t.jsxs("div",{className:"space-y-4",children:[N==="windows"&&t.jsxs("div",{className:"rounded-lg border border-border bg-background/50 p-4",children:[t.jsx("div",{className:"text-sm text-foreground",children:e("onboarding.localSetup.windows.title")}),t.jsxs("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground",children:[t.jsxs("li",{children:[e("onboarding.localSetup.windows.stepInstallWsl")," ",t.jsx("code",{className:"text-foreground/80",children:"wsl --install"})," ",e("onboarding.localSetup.windows.stepInstallWslSuffix")]}),t.jsx("li",{children:e("onboarding.localSetup.windows.stepRunInstallInWsl")}),t.jsx("li",{children:e("onboarding.localSetup.windows.stepSetBinaryPath")})]})]}),t.jsx("p",{className:"text-sm text-muted-foreground text-center leading-relaxed",children:e("onboarding.localSetup.intro")}),t.jsx("div",{className:"app-region-no-drag rounded-lg border border-border bg-background/60 backdrop-blur-sm px-4 py-3 font-mono text-sm",children:c?t.jsxs("div",{className:"flex items-center gap-2",style:{color:"var(--status-success)"},children:[t.jsx(I,{name:"check",className:"h-4 w-4"}),e("onboarding.common.status.copiedToClipboard")]}):t.jsx(he,{onCopy:F,copyTitle:e("onboarding.common.copyToClipboard")})}),t.jsxs("div",{className:"app-region-no-drag flex items-center justify-between",children:[t.jsxs("a",{href:B,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1",children:[e(N==="windows"?"onboarding.localSetup.docs.windows":"onboarding.localSetup.docs.default"),t.jsx(I,{name:"external-link",className:"h-3 w-3"})]}),t.jsx("button",{type:"button",onClick:D,disabled:m,className:"text-xs text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:e(m?"onboarding.localSetup.actions.checking":"onboarding.localSetup.actions.checkNow")})]}),t.jsxs("div",{className:"rounded-lg border px-4 py-3 flex items-center gap-3",style:{borderColor:"color-mix(in srgb, var(--primary-base) 20%, transparent)",backgroundColor:"color-mix(in srgb, var(--primary-base) 6%, transparent)"},role:"status","aria-live":"polite",children:[t.jsxs("span",{className:"relative inline-flex h-2.5 w-2.5 shrink-0","aria-hidden":!0,children:[t.jsx("span",{className:"absolute inset-0 rounded-full",style:{backgroundColor:"var(--primary-base)",animation:"pulse-opacity 1.6s ease-in-out infinite"}}),t.jsx("span",{className:"absolute inset-[-4px] rounded-full",style:{backgroundColor:"var(--primary-base)",animation:"pulse-opacity-dim 1.6s ease-in-out infinite",opacity:0}})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("div",{className:"text-sm text-foreground leading-tight",children:e("onboarding.localSetup.status.watching")}),t.jsx("div",{className:"text-xs text-muted-foreground leading-tight mt-0.5",children:e("onboarding.localSetup.status.autoContinue")})]})]}),t.jsxs("details",{className:"app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors",open:R,onToggle:r=>S(r.currentTarget.open),children:[t.jsxs("summary",{className:"flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden",children:[t.jsx("span",{children:e("onboarding.localSetup.advanced.title")}),t.jsx(I,{name:"arrow-down-s",className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),t.jsxs("div",{className:"pb-4 space-y-2",children:[t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H,{value:g,onChange:r=>_(r.target.value),placeholder:d,disabled:i,className:"flex-1 font-mono text-xs"}),t.jsx(T,{type:"button",variant:"secondary",size:"sm",onClick:A,disabled:i||!o||!L(),children:e("onboarding.localSetup.actions.browse")}),t.jsx(T,{type:"button",size:"sm",onClick:E,disabled:i||!g.trim(),children:e("onboarding.localSetup.actions.apply")})]}),t.jsx("p",{className:"text-xs text-muted-foreground/70",children:e("onboarding.localSetup.helper.saveAndReload")})]})]}),t.jsxs("details",{className:"app-region-no-drag group rounded-lg border border-border/60 px-4 open:bg-background/40 transition-colors",open:b,onToggle:r=>f(r.currentTarget.open),children:[t.jsxs("summary",{className:"flex items-center justify-between cursor-pointer py-2.5 text-sm text-muted-foreground hover:text-foreground transition-colors list-none [&::-webkit-details-marker]:hidden",children:[t.jsx("span",{children:e("onboarding.localSetup.troubleshoot.title")}),t.jsx(I,{name:"arrow-down-s",className:"h-4 w-4 transition-transform group-open:rotate-180"})]}),t.jsx("ul",{className:"pb-4 space-y-1.5 text-xs text-muted-foreground list-disc pl-4",children:N==="windows"?t.jsxs(t.Fragment,{children:[t.jsx("li",{children:e("onboarding.localSetup.windows.hintInstallInWsl")}),t.jsx("li",{children:e("onboarding.localSetup.windows.hintDetectionFailed")})]}):t.jsxs(t.Fragment,{children:[t.jsx("li",{children:e("onboarding.localSetup.hint.ensurePath")}),t.jsx("li",{children:e("onboarding.localSetup.hint.setEnv")}),t.jsx("li",{children:e("onboarding.localSetup.hint.missingRuntime")})]})})]})]})]})})}const xe="curl -fsSL https://opencode.ai/install | bash",ge="https://opencode.ai/docs",be="https://opencode.ai/docs/windows-wsl";function ye(l){const e=$.c(5),{onCopy:c,copyTitle:a}=l;let o;e[0]===Symbol.for("react.memo_cache_sentinel")?(o=t.jsxs("code",{children:[t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"curl"}),t.jsx("span",{className:"text-muted-foreground",children:" -fsSL "}),t.jsx("span",{style:{color:"var(--syntax-string)"},children:"https://opencode.ai/install"}),t.jsx("span",{className:"text-muted-foreground",children:" | "}),t.jsx("span",{style:{color:"var(--syntax-keyword)"},children:"bash"})]}),e[0]=o):o=e[0];let x;e[1]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(I,{name:"file-copy",className:"h-4 w-4"}),e[1]=x):x=e[1];let i;return e[2]!==a||e[3]!==c?(i=t.jsxs("div",{className:"flex items-center justify-center gap-3",children:[o,t.jsx("button",{onClick:c,className:"inline-flex items-center text-muted-foreground hover:text-foreground transition-colors",title:a,children:x})]}),e[2]=a,e[3]=c,e[4]=i):i=e[4],i}const ve=3e4;function we({onBack:l,onCliAvailable:e,isFromRecovery:c=!1,onSwitchToRemote:a}){const{t:o}=z(),[x,i]=s.useState(!1),[n,m]=s.useState(!1),[k,g]=s.useState(!1),[_,N]=s.useState(!1),[p,h]=s.useState(!1),[w,R]=s.useState(null),[S,b]=s.useState(""),[f,j]=s.useState("unknown");s.useEffect(()=>{const d=setTimeout(()=>m(!0),ve);return()=>clearTimeout(d)},[]),s.useEffect(()=>{g(oe())},[]),s.useEffect(()=>{if(typeof navigator>"u"){j("unknown");return}const d=navigator.userAgent||"";if(/Windows/i.test(d)){j("windows");return}if(/Macintosh|Mac OS X/i.test(d)){j("macos");return}if(/Linux/i.test(d)){j("linux");return}j("unknown")},[]),s.useEffect(()=>{let d=!1;return(async()=>{try{const u=await fetch("/api/config/settings",{method:"GET",headers:{Accept:"application/json"}});if(!u.ok)return;const r=await u.json().catch(()=>null);if(!r||d)return;const y=typeof r.opencodeBinary=="string"?r.opencodeBinary.trim():"";y&&b(y)}catch{}})(),()=>{d=!0}},[]);const v=s.useCallback(async d=>{if(!d.target.closest("button, a, input, select, textarea, code")&&d.button===0&&k&&L())try{const{getCurrentWindow:u}=await le(async()=>{const{getCurrentWindow:y}=await import("./vendor-.bun-BFTPeDgG.js").then(K=>K.bK);return{getCurrentWindow:y}},__vite__mapDeps([0,1]));await u().startDragging()}catch(u){console.error("Failed to start window dragging:",u)}},[k]),C=s.useCallback(async()=>{try{const d=await fetch("/health");if(!d.ok)return!1;const u=await d.json();return u.openCodeRunning===!0||u.isOpenCodeReady===!0}catch{return!1}},[]),U=s.useCallback(async()=>{if(typeof window>"u"||!k||!L())return;const d=window.__TAURI__;if(d?.dialog?.open)try{const u=await d.dialog.open({title:o("onboarding.localSetup.dialog.selectOpencodeBinary"),multiple:!1,directory:!1});typeof u=="string"&&u.trim().length>0&&b(u.trim())}catch{}},[k,o]),D=s.useCallback(async()=>{N(!0);try{if(await ne({opencodeBinary:S.trim()}),L()){await W();return}await fetch("/api/config/reload",{method:"POST"})}finally{setTimeout(()=>N(!1),1e3)}},[S]),A=s.useCallback(async()=>{const d=await se(xe);d.ok?(i(!0),setTimeout(()=>i(!1),2e3)):console.error("Failed to copy:",d.error)},[]),E=s.useCallback(async()=>{h(!0),R(null);try{await C()?e?.():R(o("onboarding.localSetup.errors.cliNotReady"))}catch(d){R(d instanceof Error?d.message:o("onboarding.localSetup.errors.detectionFailed"))}finally{h(!1)}},[C,e,o]),F=f==="windows"?be:ge,B=f==="windows"?"C:\\Users\\you\\AppData\\Roaming\\npm\\opencode.cmd":f==="linux"?"/home/you/.bun/bin/opencode":"/Users/you/.bun/bin/opencode";return t.jsxs("div",{className:"h-full flex items-center justify-center bg-transparent p-8 relative cursor-default select-none",onMouseDown:v,children:[t.jsxs("div",{className:"w-full max-w-lg space-y-4 text-center",children:[t.jsx("div",{className:"flex items-center",children:t.jsx(T,{variant:"ghost",onClick:l,className:"p-0 text-muted-foreground hover:text-foreground",children:o("onboarding.common.actions.back")})}),t.jsxs("div",{className:"space-y-4",children:[t.jsx("h1",{className:"text-3xl font-semibold tracking-tight text-foreground",children:o("onboarding.localSetup.title")}),t.jsx("p",{className:"text-muted-foreground",children:o("onboarding.localSetup.description")})]}),f==="windows"&&t.jsxs("div",{className:"mx-auto max-w-2xl rounded-lg border border-border bg-background/50 p-4 text-left",children:[t.jsx("div",{className:"text-sm text-foreground",children:o("onboarding.localSetup.windows.title")}),t.jsxs("ol",{className:"mt-2 list-decimal space-y-1 pl-5 text-sm text-muted-foreground",children:[t.jsxs("li",{children:[o("onboarding.localSetup.windows.stepInstallWsl")," ",t.jsx("code",{className:"text-foreground/80",children:"wsl --install"})," ",o("onboarding.localSetup.windows.stepInstallWslSuffix")]}),t.jsx("li",{children:o("onboarding.localSetup.windows.stepRunInstallInWsl")}),t.jsx("li",{children:o("onboarding.localSetup.windows.stepSetBinaryPath")})]})]}),t.jsx("div",{className:"flex justify-center",children:t.jsx("div",{className:"bg-background/60 backdrop-blur-sm border border-border rounded-lg px-5 py-3 font-mono text-sm w-fit",children:x?t.jsxs("div",{className:"flex items-center justify-center gap-2",style:{color:"var(--status-success)"},children:[t.jsx(I,{name:"check",className:"h-4 w-4"}),o("onboarding.common.status.copiedToClipboard")]}):t.jsx(ye,{onCopy:A,copyTitle:o("onboarding.common.copyToClipboard")})})}),t.jsxs("a",{href:F,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1 justify-center",children:[o(f==="windows"?"onboarding.localSetup.docs.windows":"onboarding.localSetup.docs.default"),t.jsx(I,{name:"external-link",className:"h-3 w-3"})]}),w&&t.jsx("div",{className:"mx-auto max-w-md rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive",children:w}),t.jsxs("div",{className:"space-y-3",children:[t.jsx(T,{type:"button",onClick:E,disabled:p,className:"w-full max-w-xs",size:"lg",children:o(p?"onboarding.localSetup.actions.checking":"onboarding.localSetup.actions.checkAndContinue")}),t.jsx("p",{className:"text-xs text-muted-foreground",children:o("onboarding.localSetup.helper.checkAndContinue")})]}),t.jsx("div",{className:"mx-auto w-full max-w-xl pt-4",children:t.jsxs("div",{className:"space-y-2",children:[t.jsx("div",{className:"text-sm text-muted-foreground",children:o("onboarding.localSetup.field.alreadyInstalled")}),t.jsxs("div",{className:"flex gap-2",children:[t.jsx(H,{value:S,onChange:d=>b(d.target.value),placeholder:B,disabled:_,className:"flex-1 font-mono text-xs"}),t.jsx(T,{type:"button",variant:"secondary",onClick:U,disabled:_||!k||!L(),children:o("onboarding.localSetup.actions.browse")}),t.jsx(T,{type:"button",onClick:D,disabled:_,children:o("onboarding.localSetup.actions.apply")})]}),t.jsx("div",{className:"text-xs text-muted-foreground/70",children:o("onboarding.localSetup.helper.saveAndReload")})]})}),c&&a&&t.jsxs("div",{className:"text-center pt-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:o("onboarding.localSetup.remotePreference")}),t.jsx(T,{variant:"link",onClick:a,children:o("onboarding.localSetup.actions.connectRemoteServer")})]})]}),n&&t.jsx("div",{className:"absolute bottom-8 left-0 right-0 text-center space-y-1",children:f==="windows"?t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.windows.hintInstallInWsl")}),t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.windows.hintDetectionFailed")})]}):t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.hint.ensurePath")}),t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.hint.setEnv")}),t.jsx("p",{className:"text-sm text-muted-foreground/70",children:o("onboarding.localSetup.hint.missingRuntime")})]})})]})}function ee(l,e){if(l?.trim())return Y(l.trim());if(e)return Y(e)}function je(l,e,c){switch(l){case"local-unavailable":return{title:"Local OpenCode Unavailable",description:"OpenCode CLI could not be started or is not installed. Install OpenCode or connect to a remote server instead.",titleKey:"onboarding.desktopRecovery.localUnavailable.title",descriptionKey:"onboarding.desktopRecovery.localUnavailable.description",iconKey:"local",showRetry:!0,retryLabel:"Retry Local",retryLabelKey:"onboarding.desktopRecovery.localUnavailable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Set Up Local",useLocalLabelKey:"onboarding.desktopRecovery.localUnavailable.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};case"remote-missing":return{title:"No Default Connection",description:"Your saved default connection could not be found. Choose how you want to connect.",titleKey:"onboarding.desktopRecovery.noDefaultConnection.title",descriptionKey:"onboarding.desktopRecovery.noDefaultConnection.description",iconKey:"local",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};case"remote-unreachable":{const a=ee(e,c);return{title:"Remote Server Unreachable",description:`Could not connect to "${a||"the remote server"}". Check your network connection and verify the server address.`,titleKey:"onboarding.desktopRecovery.remoteUnreachable.title",descriptionKey:"onboarding.desktopRecovery.remoteUnreachable.description",descriptionParams:a?{host:a}:void 0,iconKey:"remote",showRetry:!0,retryLabel:"Retry Connection",retryLabelKey:"onboarding.desktopRecovery.remoteUnreachable.retry",showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"remote-wrong-service":{const a=ee(e,c);return{title:"Incompatible Server",description:`The server at "${a||"unknown"}" is not running OpenChamber. Verify the address points to an OpenChamber server.`,titleKey:"onboarding.desktopRecovery.incompatibleServer.title",descriptionKey:"onboarding.desktopRecovery.incompatibleServer.description",descriptionParams:a?{host:a}:void 0,iconKey:"remote",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"}}case"missing-default-host":return{title:"No Default Connection",description:"Your saved default connection could not be found. Choose how you want to connect.",titleKey:"onboarding.desktopRecovery.noDefaultConnection.title",descriptionKey:"onboarding.desktopRecovery.noDefaultConnection.description",iconKey:"local",showRetry:!1,showUseLocal:!0,showUseRemote:!0,useLocalLabel:"Use Local",useLocalLabelKey:"onboarding.desktopRecovery.common.useLocal",useRemoteLabel:"Use Remote",useRemoteLabelKey:"onboarding.desktopRecovery.common.useRemote"};default:{const a=l;throw new Error(`Unknown recovery variant: ${a}`)}}}function ke(l){switch(l){case"local":return t.jsx(I,{name:"macbook",className:"h-8 w-8"});case"remote":return t.jsx(I,{name:"server",className:"h-8 w-8"})}}function Ce({variant:l,hostLabel:e,hostUrl:c,onRetry:a,onUseLocal:o,onUseRemote:x,isRetrying:i=!1}){const{t:n}=z(),m=je(l,e,c),k=m.retryLabelKey??"onboarding.desktopRecovery.actions.retryConnection",g=s.useMemo(()=>{if(m.descriptionParams?.host)return m.descriptionParams;if(l==="remote-unreachable")return{host:n("onboarding.desktopRecovery.placeholders.remoteServer")};if(l==="remote-wrong-service")return{host:n("onboarding.desktopRecovery.placeholders.unknownServer")}},[m.descriptionParams,n,l]);return t.jsx("div",{className:"flex flex-col items-center justify-center h-full p-8",children:t.jsxs("div",{className:"w-full max-w-md space-y-6",children:[t.jsxs("div",{className:"flex flex-col items-center space-y-3 text-center",children:[t.jsx("div",{className:"p-3 rounded-full",style:{backgroundColor:"var(--status-warning)",opacity:.15},children:t.jsx("div",{style:{color:"var(--status-warning)"},children:ke(m.iconKey)})}),t.jsx("h1",{className:"typography-ui-header text-xl font-semibold text-foreground",children:n(m.titleKey)}),t.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:n(m.descriptionKey,g)})]}),c&&(l==="remote-unreachable"||l==="remote-wrong-service")&&t.jsxs("div",{className:"rounded-lg border border-border bg-background/50 p-3",children:[t.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:n("onboarding.remoteConnection.field.serverAddress")}),t.jsx("div",{className:"font-mono text-sm text-foreground truncate",children:Y(c)})]}),t.jsxs("div",{className:"flex flex-col gap-2",children:[m.showRetry&&a&&t.jsxs(T,{onClick:a,disabled:i,className:"w-full",children:[t.jsx(I,{name:"refresh",className:G("h-4 w-4",i&&"animate-spin")}),n(i?"onboarding.desktopRecovery.actions.retrying":k)]}),t.jsxs("div",{className:"flex gap-2",children:[m.showUseLocal&&o&&t.jsxs(T,{variant:"outline",onClick:o,disabled:i,className:"flex-1",children:[t.jsx(I,{name:"macbook",className:"h-4 w-4"}),n(m.useLocalLabelKey)]}),m.showUseRemote&&x&&t.jsxs(T,{variant:"outline",onClick:x,disabled:i,className:"flex-1",children:[t.jsx(I,{name:"server",className:"h-4 w-4"}),n(m.useRemoteLabelKey)]})]})]})]})})}function te(l,e){if(e==="use-remote")return{kind:"remote-form"};switch(l){case"local-unavailable":return{kind:"local-setup"};case"remote-unreachable":case"remote-wrong-service":case"remote-missing":case"missing-default-host":return{kind:"switch-default-to-local"};default:{const c=l;throw new Error(`Unhandled RecoveryVariant: ${c}`)}}}function Se(l){const e=$.c(27),{variant:c,hostUrl:a,hostLabel:o,onRetry:x,onChooseRemote:i,showRemoteForm:n,onCloseRemoteForm:m,onSwitchToLocalFromRemote:k,onEnterLocalSetup:g,isRetrying:_}=l,N=n===void 0?!1:n,p=_===void 0?!1:_,h=Ne;let w;e[0]!==x?(w=async()=>{if(L()){await W();return}await fetch("/api/config/reload",{method:"POST"}),x?.()},e[0]=x,e[1]=w):w=e[1];const R=w;let S;e[2]!==g||e[3]!==c?(S=async()=>{if(te(c,"use-local").kind==="local-setup"){g?.();return}if(await h("local"),L()){await W();return}window.location.reload()},e[2]=g,e[3]=c,e[4]=S):S=e[4];const b=S;let f;e[5]!==i||e[6]!==c?(f=()=>{te(c,"use-remote").kind==="remote-form"&&i?.()},e[5]=i,e[6]=c,e[7]=f):f=e[7];const j=f;if(N){const C=c==="remote-wrong-service"?"":a||"",U=c==="remote-wrong-service"?"":o||"";let D;e[8]!==i||e[9]!==m?(D=m||(()=>i?.()),e[8]=i,e[9]=m,e[10]=D):D=e[10];let A;e[11]!==g||e[12]!==k?(A=k||(()=>{h("local").then(()=>{L()?W():g?.()})}),e[11]=g,e[12]=k,e[13]=A):A=e[13];let E;return e[14]!==U||e[15]!==C||e[16]!==D||e[17]!==A?(E=t.jsx(ae,{onBack:D,initialUrl:C,initialLabel:U,isRecoveryMode:!0,onSwitchToLocal:A}),e[14]=U,e[15]=C,e[16]=D,e[17]=A,e[18]=E):E=e[18],E}let v;return e[19]!==R||e[20]!==b||e[21]!==j||e[22]!==o||e[23]!==a||e[24]!==p||e[25]!==c?(v=t.jsx(Ce,{variant:c,hostLabel:o,hostUrl:a,onRetry:R,onUseLocal:b,onUseRemote:j,isRetrying:p}),e[19]=R,e[20]=b,e[21]=j,e[22]=o,e[23]=a,e[24]=p,e[25]=c,e[26]=v):v=e[26],v}async function Ne(l){if(!L())return;const e=await X();await J({...e,...l==="local"?{defaultHostId:"local"}:{},initialHostChoiceCompleted:!0})}function Ue(l){const e=$.c(26),{onBack:c,onCliAvailable:a,mode:o,recoveryVariant:x,recoveryHostUrl:i,recoveryHostLabel:n,onEnterLocalSetup:m}=l,k=o===void 0?"first-launch":o,g=x===void 0?"missing-default-host":x,[_,N]=s.useState(!1),[p,h]=s.useState(!1);let w;e[0]===Symbol.for("react.memo_cache_sentinel")?(w=()=>{h(!1),N(!1)},e[0]=w):w=e[0];let R;e[1]!==k||e[2]!==n||e[3]!==i||e[4]!==g?(R=[k,g,i,n],e[1]=k,e[2]=n,e[3]=i,e[4]=g,e[5]=R):R=e[5],s.useEffect(w,R);const S=p?"local-setup":k;if(S==="recovery"){let f,j;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=()=>N(!1),j=()=>{N(!1),h(!0)},e[6]=f,e[7]=j):(f=e[6],j=e[7]);let v;e[8]!==m?(v=()=>{h(!0),m?.()},e[8]=m,e[9]=v):v=e[9];let C;return e[10]!==n||e[11]!==i||e[12]!==g||e[13]!==_||e[14]!==v?(C=t.jsx(Se,{variant:g,hostUrl:i,hostLabel:n,showRemoteForm:_,onCloseRemoteForm:f,onSwitchToLocalFromRemote:j,onEnterLocalSetup:v}),e[10]=n,e[11]=i,e[12]=g,e[13]=_,e[14]=v,e[15]=C):C=e[15],C}if(S==="local-setup"){let f;e[16]!==c||e[17]!==p?(f=()=>{p?h(!1):c?.()},e[16]=c,e[17]=p,e[18]=f):f=e[18];let j;e[19]===Symbol.for("react.memo_cache_sentinel")?(j=()=>N(!0),e[19]=j):j=e[19];let v;return e[20]!==a||e[21]!==p||e[22]!==f?(v=t.jsx(we,{onBack:f,onCliAvailable:a,isFromRecovery:p,onSwitchToRemote:j}),e[20]=a,e[21]=p,e[22]=f,e[23]=v):v=e[23],v}let b;return e[24]!==a?(b=t.jsx(fe,{onCliAvailable:a}),e[24]=a,e[25]=b):b=e[25],b}export{Ue as OnboardingScreen};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as h,R as b,j as t,aW as w,aY as j,b0 as v,a$ as D,aZ as k}from"./vendor-.bun-BFTPeDgG.js";import{u as R,c as g}from"./modelPrefsAutoSave-
|
|
1
|
+
import{c as h,R as b,j as t,aW as w,aY as j,b0 as v,a$ as D,aZ as k}from"./vendor-.bun-BFTPeDgG.js";import{u as R,c as g}from"./modelPrefsAutoSave-HUPrH1r2.js";import{a as S}from"./main-DcpUnRRo.js";import"./index-CKlDk4Io.js";import"./JsonTreeView-bLRkNPS9.js";const z=x=>{const e=h.c(19),{open:m,onOpenChange:a}=x,{t:u}=R(),n=b.useId(),y=_;let s;e[0]!==a?(s=f=>{!f&&y()||a(f)},e[0]=a,e[1]=s):s=e[1];let c;e[2]===Symbol.for("react.memo_cache_sentinel")?(c=t.jsx(w,{className:g("fixed inset-0 z-50 bg-black/50 dark:bg-black/75","transition-opacity duration-150 ease-out","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0")}),e[2]=c):c=e[2];let d;e[3]===Symbol.for("react.memo_cache_sentinel")?(d=g("relative pointer-events-auto","w-[90vw] max-w-[1200px] h-[85vh] max-h-[900px]","rounded-xl border shadow-none overflow-hidden origin-center","bg-background","transition-all duration-150 ease-out","data-[starting-style]:opacity-0 data-[starting-style]:scale-[0.98]","data-[ending-style]:opacity-0 data-[ending-style]:scale-[0.98]"),e[3]=d):d=e[3];let o;e[4]!==u?(o=u("settings.window.description"),e[4]=u,e[5]=o):o=e[5];let i;e[6]!==n||e[7]!==o?(i=t.jsx(j,{id:n,className:"sr-only",children:o}),e[6]=n,e[7]=o,e[8]=i):i=e[8];let l;e[9]!==a?(l=t.jsx(S,{onClose:()=>a(!1),isWindowed:!0}),e[9]=a,e[10]=l):l=e[10];let r;e[11]!==n||e[12]!==i||e[13]!==l?(r=t.jsxs(v,{children:[c,t.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center pointer-events-none",children:t.jsxs(D,{"aria-describedby":n,className:d,children:[i,l]})})]}),e[11]=n,e[12]=i,e[13]=l,e[14]=r):r=e[14];let p;return e[15]!==m||e[16]!==s||e[17]!==r?(p=t.jsx(k,{open:m,onOpenChange:s,children:r}),e[15]=m,e[16]=s,e[17]=r,e[18]=p):p=e[18],p};function _(){return typeof document>"u"?!1:!!document.querySelector('[data-slot="dropdown-menu-content"][data-open], [data-slot="select-content"][data-open]')}export{z as SettingsWindow};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as n,j as a,s as yt,bv as ht,bw as bt,bx as gt}from"./vendor-.bun-BFTPeDgG.js";import{u as dt,v as xt,a_ as vt,c as Ue,M as Tt,bF as kt,eM as Ct,a as Ie,b as Et,V as ft,b8 as Rt,I as ie,eN as et,ct,at as Z}from"./modelPrefsAutoSave-HUPrH1r2.js";import{u as J,P as At,S as St}from"./main-DcpUnRRo.js";import{a3 as It}from"./index-CKlDk4Io.js";import"./JsonTreeView-bLRkNPS9.js";function Mt(f){const{colors:p}=f,m=p.syntax.base;return{background:p.surface.background,foreground:m.foreground,cursor:p.interactive.cursor,cursorAccent:p.surface.background,selectionBackground:p.interactive.selection,selectionForeground:p.interactive.selectionForeground,selectionInactiveBackground:p.interactive.selection+"50",black:p.surface.muted,red:p.status.error,green:p.status.success,yellow:p.status.warning,blue:m.function,magenta:m.keyword,cyan:m.type,white:m.foreground,brightBlack:m.comment,brightRed:p.status.error,brightGreen:p.status.success,brightYellow:p.status.warning,brightBlue:m.function,brightMagenta:m.keyword,brightCyan:m.type,brightWhite:p.surface.elevatedForeground}}function Bt(f,p,m,ee,de=!1){const ye=`${f}, "JetBrainsMonoNL Nerd Font", "FiraCode Nerd Font", "Cascadia Code PL", "Fira Code", "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", "Courier New", monospace`;return{cursorBlink:!1,cursorStyle:"bar",fontSize:p,lineHeight:1.15,fontFamily:ye,allowTransparency:!1,theme:{background:m.background,foreground:m.foreground,cursor:m.cursor,cursorAccent:m.cursorAccent,selectionBackground:m.selectionBackground,selectionForeground:m.selectionForeground,black:m.black,red:m.red,green:m.green,yellow:m.yellow,blue:m.blue,magenta:m.magenta,cyan:m.cyan,white:m.white,brightBlack:m.brightBlack,brightRed:m.brightRed,brightGreen:m.brightGreen,brightYellow:m.brightYellow,brightBlue:m.brightBlue,brightMagenta:m.brightMagenta,brightCyan:m.brightCyan,brightWhite:m.brightWhite},scrollback:1e4,ghostty:ee,disableStdin:de}}let lt=null;function Dt(){return lt||(lt=gt.load()),lt}function Nt(f){if(typeof window>"u")return null;const p=[f,...Array.from(f.querySelectorAll("*"))];let m=null;for(const ee of p){const Me=window.getComputedStyle(ee).overflowY;if(!(Me!=="auto"&&Me!=="scroll")){if(ee.scrollHeight-ee.clientHeight>2)return ee;m||(m=ee)}}return m}const pt=n.forwardRef(({sessionKey:f,chunks:p,onInput:m,onResize:ee,theme:de,fontFamily:Me,fontSize:ye,className:Be,enableTouchScroll:E,autoFocus:tt=!0,isVisible:je=!0},he)=>{const{t:F}=dt(),N=n.useRef(null),Fe=n.useRef(null),I=n.useRef(null),_e=n.useRef(null),P=n.useRef(m),ze=n.useRef(ee),h=n.useRef(null),be=n.useRef(""),te=n.useRef(null),Le=n.useRef(!1),Ke=n.useRef(null),pe=n.useRef(!0),ne=n.useRef(null),q=n.useRef(null),ge=n.useRef(0),re=n.useRef(null),qe=n.useRef(null),ce=n.useRef(!1),k=n.useRef(!1),R=n.useRef(null),me=n.useRef(null),Ye=n.useRef(null),j=n.useRef(""),Oe=n.useRef(null),xe=n.useRef(!E),$e=n.useRef(je),[,nt]=n.useReducer(e=>e+1,0),[We,O]=n.useReducer(e=>e+1,0);P.current=m,ze.current=ee;const at=typeof navigator<"u"&&(/Android/i.test(navigator.userAgent)||navigator.userAgentData?.platform==="Android"),y=!!E;n.useEffect(()=>{if(!E){xe.current=!0,$e.current=je;return}!$e.current&&je&&(xe.current=!1),$e.current=je},[E,je]);const ve=n.useCallback(()=>{if(!y)return;const e=N.current,o=re.current;if(!e)return;const s=[];e.getAttribute("contenteditable")==="true"&&s.push(e),s.push(...Array.from(e.querySelectorAll('[contenteditable="true"]'))),s.forEach(r=>{r.setAttribute("data-terminal-disabled-contenteditable","true"),r.setAttribute("contenteditable","false"),r.setAttribute("aria-hidden","true"),r.tabIndex=-1,r.style.setProperty("caret-color","transparent"),r.style.color="transparent",r.style.setProperty("-webkit-text-fill-color","transparent"),r.style.background="transparent",r.style.outline="none",r.style.boxShadow="none",r.style.textShadow="none",r.style.setProperty("user-select","none"),r.style.setProperty("-webkit-user-select","none")}),e.tabIndex=-1,e.removeAttribute("role"),e.removeAttribute("aria-multiline"),Array.from(e.querySelectorAll("textarea")).forEach(r=>{r.style.setProperty("caret-color","transparent"),r.style.color="transparent",r.style.setProperty("-webkit-text-fill-color","transparent"),r.style.background="transparent",r.style.border="0",r.style.outline="none",r.style.boxShadow="none",r.style.textShadow="none",r.style.fontSize="0",r.style.lineHeight="0",r!==o&&r.getAttribute("data-terminal-disabled-input")!=="true"&&(r.setAttribute("data-terminal-disabled-input","true"),r.setAttribute("aria-hidden","true"),r.tabIndex=-1,r.disabled=!0,r.style.position="absolute",r.style.opacity="0",r.style.width="0px",r.style.height="0px",r.style.pointerEvents="none",r.style.zIndex="-1")})},[y]),A=n.useCallback(e=>{if(Oe.current===e)return;const o=I.current;if(o)try{if(typeof o.setOption=="function"){o.setOption("cursorBlink",e),Oe.current=e;return}o.options&&(o.options.cursorBlink=e,Oe.current=e)}catch{}},[]),M=y&&at,C=n.useCallback((e,o)=>{const s=M?qe.current:re.current,c=N.current;if(!s||!c)return;const r=c.getBoundingClientRect(),v=typeof window<"u"?window.innerWidth:r.width,S=typeof window<"u"?window.innerHeight:r.height,D=r.left+r.width/2,G=r.top+r.height-12,l=typeof e=="number"?e:D,T=typeof o=="number"?o:G,V=8,H=Math.max(V,Math.min(v-V,l)),K=Math.max(V,Math.min(S-V,T));s.style.left=`${H}px`,s.style.top=`${K}px`,s.style.bottom="",(s instanceof HTMLTextAreaElement||s instanceof HTMLInputElement)&&(s.disabled=!1,s.readOnly=!1,s.removeAttribute("disabled"),s.removeAttribute("readonly"));try{s.focus({preventScroll:!0})}catch{try{s.focus()}catch{}}},[M]),Te=n.useCallback(()=>{if(y){C(),A(!0);return}I.current?.focus(),A(!0)},[C,A,y]),le=n.useCallback(e=>e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement?e.value:e.textContent??"",[]),W=n.useCallback(e=>{if(e instanceof HTMLTextAreaElement||e instanceof HTMLInputElement){e.value="";return}e.textContent=""},[]),He=n.useCallback(e=>{if(typeof window>"u"||M)return;Ye.current!==null&&(window.clearTimeout(Ye.current),Ye.current=null);let o=0;const s=3,c=()=>{Ye.current=window.setTimeout(()=>{Ye.current=null;const r=le(e);if(!r){if(o+=1,o<s){c();return}return}const v=j.current;j.current=r;const S=r.startsWith(v)?r.slice(v.length):r;S&&P.current(S.replace(/\r\n|\r|\n/g,"\r")),W(e),j.current=""},o===0?0:24)};c()},[W,le,M]);n.useEffect(()=>{const e=N.current;if(!y||!e||E)return;const o=s=>{const c=s.target;if(c&&c.getAttribute("data-terminal-hidden-input")!=="true"&&e.contains(c)){try{c.blur()}catch{}C()}};return e.addEventListener("focusin",o,!0),()=>{e.removeEventListener("focusin",o,!0)}},[E,y,C]);const De=n.useCallback(()=>{const e=I.current;if(!e||typeof e.getSelection!="function")return"";const o=e.getSelection();return typeof o=="string"?o:""},[]),ue=n.useCallback(()=>{if(typeof window>"u")return"";const e=window.getSelection();if(!e)return"";const o=e.toString();if(!o.trim())return"";const s=N.current;if(!s)return"";const c=e.anchorNode,r=e.focusNode;return c&&!s.contains(c)||r&&!s.contains(r)?"":o},[]),ke=n.useCallback(async()=>{if(typeof document>"u")return;const e=De()||ue();e.trim()&&await xt(e)},[ue,De]),X=n.useCallback(()=>De().trim()?!0:!!ue().trim(),[ue,De]);n.useEffect(()=>{if(typeof window>"u")return;const e=o=>{X()&&(o.preventDefault(),ke())};return window.addEventListener("openchamber:copy",e),()=>{window.removeEventListener("openchamber:copy",e)}},[ke,X]);const U=n.useCallback(()=>{be.current="",te.current!==null&&typeof window<"u"&&window.cancelAnimationFrame(te.current),te.current=null,Le.current=!1,Ke.current=null},[]),L=n.useCallback(()=>{const e=_e.current,o=I.current,s=N.current;if(!e||!o||!s)return;const c=s.getBoundingClientRect();if(!(c.width<24||c.height<24))try{e.fit();const r={cols:o.cols,rows:o.rows},v=h.current;(!v||v.cols!==r.cols||v.rows!==r.rows)&&(h.current=r,ze.current(r.cols,r.rows))}catch{}},[]),Ne=n.useCallback(()=>{if(Le.current)return;const e=I.current;if(!e){U();return}if(!be.current)return;const o=be.current;be.current="",Le.current=!0,e.write(o,()=>{Le.current=!1,be.current&&(typeof window<"u"?te.current=window.requestAnimationFrame(()=>{te.current=null,Ne()}):Ne())})},[U]),Ge=n.useCallback(()=>{te.current===null&&(typeof window<"u"?te.current=window.requestAnimationFrame(()=>{te.current=null,Ne()}):Ne())},[Ne]),Xe=n.useCallback(e=>{e&&(be.current+=e,Ge())},[Ge]),Ce=n.useCallback(()=>{if(ne.current?.(),ne.current=null,q.current!==null&&typeof window<"u"&&(window.clearTimeout(q.current),q.current=null),!E){ge.current=0;return}const e=N.current;if(!e)return;const o=I.current;if(!o)return;ge.current=0;const s=2.2,c=2.8,r=25,v=.25,S=8,D=.05,G=.015,l={lastY:null,lastTime:null,velocity:0,rafId:null,startX:null,startY:null,didMove:!1},T=()=>typeof performance<"u"?performance.now():Date.now(),V=Math.max(12,Math.round(ye*1.35));let H=0;const K=t=>{if(!t)return!1;const u=o.getViewportY(),i=H+t,b=Math.trunc(i/V);return H=i-b*V,b!==0&&o.scrollLines(b),o.getViewportY()!==u},Y=()=>{l.rafId!==null&&typeof window<"u"&&window.cancelAnimationFrame(l.rafId),l.rafId=null},x={passive:!1,capture:!1};if(typeof window<"u"&&"PointerEvent"in window){const t=Object.assign(l,{pointerId:null,startX:null,startY:null,moved:!1}),u=6,i=d=>{if(d.pointerType==="touch"){Y(),t.pointerId=d.pointerId,t.startX=d.clientX,t.startY=d.clientY,t.moved=!1,t.lastY=d.clientY,t.lastTime=T(),t.velocity=0;try{e.setPointerCapture(d.pointerId)}catch{}}},b=d=>{if(d.pointerType!=="touch"||t.pointerId!==d.pointerId)return;if(t.startX!==null&&t.startY!==null&&!t.moved){const mt=d.clientX-t.startX,wt=d.clientY-t.startY;Math.hypot(mt,wt)>=u&&(t.moved=!0)}if(t.lastY===null){t.lastY=d.clientY,t.lastTime=T();return}const _=t.lastY,oe=t.lastTime??T(),$=T();t.lastY=d.clientY,t.lastTime=$;const ae=_-d.clientY;if(Math.abs(ae)<1)return;const Se=Math.max($-oe,8),se=s+Math.min(c,Math.abs(ae)/r),Pe=ae*se,Je=Pe/Se;t.velocity=t.velocity*(1-v)+Je*v,t.velocity>S?t.velocity=S:t.velocity<-S&&(t.velocity=-S),t.moved&&(d.cancelable&&d.preventDefault(),d.stopPropagation()),K(Pe)},w=d=>{if(d.pointerType!=="touch"||t.pointerId!==d.pointerId)return;const _=!t.moved;t.pointerId=null,t.startX=null,t.startY=null,t.moved=!1,t.lastY=null,t.lastTime=null;try{e.releasePointerCapture(d.pointerId)}catch{}if(_){y?C(d.clientX,d.clientY):E&&!xe.current&&(xe.current=!0,I.current?.focus());return}if(typeof window>"u")return;if(Math.abs(t.velocity)<D){t.velocity=0;return}let oe=T();const $=()=>{const ae=T(),Se=Math.max(ae-oe,8);oe=ae;const se=K(t.velocity*Se)??!1,Pe=Math.sign(t.velocity),Je=Math.max(0,Math.abs(t.velocity)-G*Se);if(t.velocity=Je*Pe,!se||Je<=D){Y(),t.velocity=0;return}t.rafId=window.requestAnimationFrame($)};t.rafId=window.requestAnimationFrame($)};e.addEventListener("pointerdown",i,x),e.addEventListener("pointermove",b,x),e.addEventListener("pointerup",w,x),e.addEventListener("pointercancel",w,x);const g=e.style.touchAction;e.style.touchAction="manipulation",ne.current=()=>{Y(),q.current!==null&&typeof window<"u"&&(window.clearTimeout(q.current),q.current=null),ge.current=0,e.removeEventListener("pointerdown",i,x),e.removeEventListener("pointermove",b,x),e.removeEventListener("pointerup",w,x),e.removeEventListener("pointercancel",w,x),e.style.touchAction=g};return}const Re=6,z=t=>{t.touches.length===1&&(Y(),l.lastY=t.touches[0].clientY,l.lastTime=T(),l.velocity=0,l.startX=t.touches[0].clientX,l.startY=t.touches[0].clientY,l.didMove=!1)},Ve=t=>{if(t.touches.length!==1){l.lastY=null,l.lastTime=null,l.velocity=0,l.startX=null,l.startY=null,l.didMove=!1,Y();return}const u=t.touches[0].clientX,i=t.touches[0].clientY;if(l.startX!==null&&l.startY!==null&&!l.didMove){const Se=u-l.startX,se=i-l.startY;Math.hypot(Se,se)>=Re&&(l.didMove=!0)}if(l.lastY===null){l.lastY=i,l.lastTime=T();return}const b=l.lastY,w=l.lastTime??T(),g=T();l.lastY=i,l.lastTime=g;const d=b-i;if(Math.abs(d)<1)return;const _=Math.max(g-w,8),oe=s+Math.min(c,Math.abs(d)/r),$=d*oe,ae=$/_;l.velocity=l.velocity*(1-v)+ae*v,l.velocity>S?l.velocity=S:l.velocity<-S&&(l.velocity=-S),l.didMove&&(t.preventDefault(),t.stopPropagation()),K($)},Ae=t=>{const u=!l.didMove;l.lastY=null,l.lastTime=null;const i=l.velocity;if(l.startX=null,l.startY=null,l.didMove=!1,u){const g=t.changedTouches?.[0];y?C(g?.clientX,g?.clientY):E&&!xe.current&&(xe.current=!0,I.current?.focus());return}if(typeof window>"u")return;if(Math.abs(i)<D){l.velocity=0;return}let b=T();const w=()=>{const g=T(),d=Math.max(g-b,8);b=g;const _=K(l.velocity*d)??!1,oe=Math.sign(l.velocity),$=Math.max(0,Math.abs(l.velocity)-G*d);if(l.velocity=$*oe,!_||$<=D){Y(),l.velocity=0;return}l.rafId=window.requestAnimationFrame(w)};l.rafId=window.requestAnimationFrame(w)};e.addEventListener("touchstart",z,x),e.addEventListener("touchmove",Ve,x),e.addEventListener("touchend",Ae,x),e.addEventListener("touchcancel",Ae,x);const Q=e.style.touchAction;e.style.touchAction="manipulation",ne.current=()=>{Y(),q.current!==null&&typeof window<"u"&&(window.clearTimeout(q.current),q.current=null),ge.current=0,e.removeEventListener("touchstart",z,x),e.removeEventListener("touchmove",Ve,x),e.removeEventListener("touchend",Ae,x),e.removeEventListener("touchcancel",Ae,x),e.style.touchAction=Q}},[E,y,C,ye]);n.useEffect(()=>{let e=!1,o=null,s=null,c=null,r=[],v=null,S=null;const D=N.current;if(!D)return;if(D.tabIndex=y?-1:0,y){const Y=D.focus.bind(D),x=D;x.focus=((...B)=>{C()}),S=()=>{x.focus=Y}}const G=()=>{A(!0)},l=()=>{A(!1)},T=Y=>{const x=Y.target;if(x&&D.contains(x)){if(y&&x instanceof HTMLElement){window.setTimeout(()=>{x.blur(),C()},0),A(!1);return}if(E&&!xe.current&&x instanceof HTMLElement){window.setTimeout(()=>{x.blur()},0),A(!1);return}A(!0);return}A(!1)},V=()=>{A(!1)};let H=null;return(async()=>{try{const Y=await Dt();if(e)return;const x=Bt(Me,ye,de,Y,!1),B=new ht(x);pe.current=!0,y&&(B.focus=()=>{});const Re=B;if(typeof Re.scrollToBottom=="function"){const Q=Re.scrollToBottom.bind(Re);Re.scrollToBottom=()=>{pe.current&&Q()},v=()=>{Re.scrollToBottom=Q}}const z=new bt;o=B,I.current=B,_e.current=z,B.loadAddon(z),B.open(D),O(),Oe.current=!1,H=B.textarea??D.querySelector("textarea"),H&&(H.addEventListener("focus",G),H.addEventListener("blur",l)),ve(),typeof MutationObserver<"u"&&(c=new MutationObserver(()=>{ve()}),c.observe(D,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["contenteditable","role","tabindex","aria-label"]}));const Ve=Nt(D);Ve?(Ve.classList.add("overlay-scrollbar-target","overlay-scrollbar-container"),Fe.current=Ve,nt()):Fe.current=null,L();const Ae=z;typeof Ae.observeResize=="function"&&Ae.observeResize(),Ce(),r=[B.onData(Q=>{P.current(Q)}),B.onScroll(Q=>{if(typeof Q=="number"&&Number.isFinite(Q)){const t=typeof B.hasSelection=="function"&&B.hasSelection();pe.current=!t&&Q<=.5}}),B.onSelectionChange(()=>{if(typeof B.hasSelection=="function"&&B.hasSelection()){pe.current=!1;return}const t=typeof B.getViewportY=="function"?B.getViewportY():0;pe.current=t<=.5})],s=new ResizeObserver(()=>{L()}),s.observe(D),typeof window<"u"&&window.setTimeout(()=>{L()},0)}catch{}})(),document.addEventListener("focusin",T,!0),window.addEventListener("blur",V),()=>{e=!0,ne.current?.(),ne.current=null,document.removeEventListener("focusin",T,!0),window.removeEventListener("blur",V),r.forEach(Y=>Y.dispose()),v?.(),v=null,H&&(H.removeEventListener("focus",G),H.removeEventListener("blur",l)),s?.disconnect(),c?.disconnect(),S?.(),o?.dispose(),I.current=null,_e.current=null,Fe.current=null,h.current=null,Oe.current=null,U()}},[ve,E,L,C,Me,ye,Ce,de,U,A,y]),n.useEffect(()=>{const e=I.current;e&&(e.reset(),U(),h.current=null,L())},[f,We,L,U]),n.useEffect(()=>{!tt||!I.current||Te()},[tt,Te,f,We]),n.useEffect(()=>(Ce(),()=>{ne.current?.(),ne.current=null}),[Ce,f]),n.useEffect(()=>{const e=I.current;if(!e)return;if(p.length===0){Ke.current!==null&&(e.reset(),U(),L());return}const o=Ke.current;let s;if(o===null)s=p;else{const c=p.findIndex(r=>r.id===o);s=c>=0?p.slice(c+1):p}s.length>0&&Xe(s.map(c=>c.data).join("")),Ke.current=p[p.length-1].id},[p,We,Xe,L,U]),n.useImperativeHandle(he,()=>({focus:()=>{Te()},clear:()=>{const e=I.current;e&&(e.reset(),U(),L())},fit:()=>{L()}}),[Te,L,U]);const Qe=n.useCallback(e=>{if(!y)return;const o=N.current,s=e.relatedTarget,c=s?.tagName,r=c==="INPUT"||c==="TEXTAREA"||s?.isContentEditable,v=s?.getAttribute("data-terminal-hidden-input")==="true",S=!!(s&&o?.contains(s))},[y]),we=n.useCallback(e=>{const o=e.nativeEvent,s=o?.inputType??"",c=typeof o?.data=="string"?o.data:"";if(me.current=typeof performance<"u"?performance.now():Date.now(),s==="insertCompositionText"){ce.current=!0;return}if(!s&&c){if(ce.current)return;e.preventDefault(),P.current(c),R.current={type:"insertText",at:typeof performance<"u"?performance.now():Date.now()},k.current=!0;return}if(s==="insertText"&&c){if(ce.current)return;e.preventDefault(),P.current(c),R.current={type:s,at:typeof performance<"u"?performance.now():Date.now()},k.current=!0;return}if(s==="insertLineBreak"){if(ce.current)return;e.preventDefault(),P.current("\r"),R.current={type:s,at:typeof performance<"u"?performance.now():Date.now()},k.current=!0;return}if(s==="deleteContentBackward"){if(ce.current)return;e.preventDefault(),P.current(""),R.current={type:s,at:typeof performance<"u"?performance.now():Date.now()},k.current=!0}},[]),fe=n.useCallback(e=>{const o=e.currentTarget;if(me.current=typeof performance<"u"?performance.now():Date.now(),ce.current)return;if(k.current){const r=R.current,v=typeof performance<"u"?performance.now():Date.now();if(r&&v-r.at<50){k.current=!1,W(o);return}k.current=!1}const s=le(o);if(!s)return;j.current=s;const c=s.replace(/\r\n|\r|\n/g,"\r");P.current(c),W(o),j.current=""},[W,le]),rt=n.useCallback(e=>{e.stopPropagation();const o=e.key.toLowerCase(),s=e.metaKey&&!e.ctrlKey&&!e.altKey&&o==="c",c=e.ctrlKey&&e.shiftKey&&!e.metaKey&&!e.altKey&&o==="c";if((s||c)&&X()){e.preventDefault(),ke();return}if(e.ctrlKey&&!e.metaKey&&!e.altKey&&e.key.length===1){const V=e.key.toUpperCase();if(V>="A"&&V<="Z"){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),P.current(String.fromCharCode(V.charCodeAt(0)-64)),W(e.currentTarget);return}}if(e.altKey&&!e.ctrlKey&&!e.metaKey&&e.key.length===1){e.preventDefault(),e.nativeEvent?.stopImmediatePropagation(),P.current("\x1B"+e.key),W(e.currentTarget);return}const v={ArrowUp:"\x1B[A",ArrowDown:"\x1B[B",ArrowRight:"\x1B[C",ArrowLeft:"\x1B[D",Escape:"\x1B",Tab:" ",Delete:"\x1B[3~",Home:"\x1B[H",End:"\x1B[F"}[e.key];if(v){e.preventDefault(),P.current(v),W(e.currentTarget);return}const S=e.currentTarget;if(e.nativeEvent?.isComposing)return;const G=R.current,l=typeof performance<"u"?performance.now():Date.now(),T=!!(G&&l-G.at<50);if(e.key==="Enter"){if(T&&G?.type==="insertLineBreak")return;e.preventDefault(),P.current("\r"),W(S);return}if(e.key==="Backspace"){if(e.preventDefault(),T&&G?.type==="deleteContentBackward")return;le(S)||P.current("")}if(e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey){const V=me.current;V&&l-V<50||(e.preventDefault(),P.current(e.key),k.current=!0,R.current={type:"keydown-text",at:l})}He(S)},[W,ke,X,le,He]),Ee=n.useCallback(e=>{e.stopPropagation();const o=e.currentTarget;e.nativeEvent?.isComposing||He(o)},[He]),ot=n.useCallback(e=>{const o=e.currentTarget;ce.current=!1;const s=e.data||le(o);if(me.current=typeof performance<"u"?performance.now():Date.now(),!s)return;const c=s.replace(/\r\n|\r|\n/g,"\r");P.current(c),W(o),R.current={type:"compositionend",at:typeof performance<"u"?performance.now():Date.now()},k.current=!0},[W,le]),st=n.useCallback(e=>{e.stopPropagation();const o=e.clipboardData?.getData("text")??"";if(!o)return;e.preventDefault();const c=I.current?.hasBracketedPaste?.()?`\x1B[200~${o}\x1B[201~`:o;P.current(c)},[]),Ze={position:"fixed",left:0,top:0,width:1,height:1,opacity:0,zIndex:-1,background:"transparent",color:"transparent",WebkitTextFillColor:"transparent",caretColor:"transparent",textShadow:"none",WebkitAppearance:"none",appearance:"none",resize:"none",overflow:"hidden",whiteSpace:"nowrap",border:"0",padding:0,margin:0,outline:"none",outlineOffset:0,fontSize:16,fontWeight:400,pointerEvents:"none",WebkitUserSelect:"none",userSelect:"none"};return a.jsxs("div",{ref:N,className:Ue("relative h-full w-full terminal-viewport-container",Be),"data-hidden-input-overlay-active":y?"true":void 0,style:{backgroundColor:de.background},onTouchStart:e=>{if(!(!y||E)&&!X()){const o=e.touches?.[0];C(o?.clientX,o?.clientY)}},onClick:e=>{if(!E)if(y){if(X())return;C(e.clientX,e.clientY)}else I.current?.focus()},onMouseUp:()=>{!E&&X()&&ke()},onTouchEnd:()=>{!E&&X()&&ke()},children:[y&&typeof document<"u"?yt.createPortal(a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:qe,type:"text",inputMode:"text",autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,tabIndex:-1,enterKeyHint:"send","data-terminal-hidden-input":"true","aria-label":F("terminalView.viewport.inputAria"),"aria-hidden":"true",style:{...Ze,display:M?"block":"none"},onBlur:Qe,onBeforeInput:we,onCompositionStart:()=>{ce.current=!0},onInput:fe,onKeyDown:rt,onKeyUp:Ee,onCompositionEnd:ot,onPaste:st}),a.jsx("textarea",{ref:re,inputMode:"text",autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",spellCheck:!1,tabIndex:-1,enterKeyHint:"send","data-terminal-hidden-input":"true","aria-label":F("terminalView.viewport.inputAria"),"aria-hidden":"true",style:{...Ze,display:M?"none":"block"},onBlur:Qe,onBeforeInput:we,onCompositionStart:()=>{ce.current=!0},onInput:fe,onKeyDown:rt,onKeyUp:Ee,onCompositionEnd:ot,onPaste:st})]}),document.body):null,Fe.current&&!E?a.jsx(vt,{containerRef:Fe,disableHorizontal:!0,className:"overlay-scrollbar--flush overlay-scrollbar--dense overlay-scrollbar--zero"}):null]})});pt.displayName="TerminalViewport";const Vt={esc:"\x1B",tab:" ",enter:"\r","arrow-up":"\x1B[A","arrow-down":"\x1B[B","arrow-left":"\x1B[D","arrow-right":"\x1B[C"},it={ctrl:"5",cmd:"3"},ut={retry:{maxRetries:3,initialDelayMs:500,maxDelayMs:8e3},connectionTimeoutMs:1e4},Pt={retry:{...ut.retry,initialDelayMs:200,maxDelayMs:500},connectionTimeoutMs:1500},jt=(f,p)=>{if(p)switch(f){case"arrow-up":return`\x1B[1;${it[p]}A`;case"arrow-down":return`\x1B[1;${it[p]}B`;case"arrow-right":return`\x1B[1;${it[p]}C`;case"arrow-left":return`\x1B[1;${it[p]}D`}return Vt[f]??null},Ht=()=>{const{t:f}=dt(),{terminal:p,runtime:m}=Tt(),{currentTheme:ee}=kt(),{monoFont:de}=Ct(),Me=Ie(t=>t.terminalFontSize),ye=Ie(t=>t.bottomTerminalHeight),Be=Ie(t=>t.isBottomTerminalExpanded),{isMobile:E,isTablet:tt,hasTouchOnlyPointer:je}=Et(),he=E||tt,F=(he||je)&&m.platform==="web",N=m.platform!=="vscode",Fe=Ie(t=>t.showTerminalQuickKeysOnDesktop),I=he||Fe,_e=ft(t=>t.currentSessionId),P=ft(t=>t.newSessionDraft),ze=_e!==null||P?.open===!0,h=Rt()??null,be=J(t=>t.sessions),te=J(t=>t.hasHydrated),Le=J(t=>t.ensureDirectory),Ke=J(t=>t.createTab),pe=J(t=>t.setActiveTab),ne=J(t=>t.closeTab),q=J(t=>t.setTabSessionId),ge=J(t=>t.setTabLifecycle),re=J(t=>t.setConnecting),qe=J(t=>t.appendToBuffer),ce=Ie(t=>t.openContextPreview),k=n.useMemo(()=>{if(h)return be.get(h)},[be,h]),R=n.useMemo(()=>k?N?k.activeTabId??k.tabs[0]?.id??null:k.tabs[0]?.id??null:null,[k,N]),me=n.useMemo(()=>{if(k)return R?k.tabs.find(t=>t.id===R)??k.tabs[0]:k.tabs[0]},[k,R]),Ye=n.useMemo(()=>(k?.tabs??[]).map(t=>({icon:(()=>{const u=t.iconKey?At[t.iconKey]??"terminal":"terminal";return a.jsx(ie,{name:u,className:"h-4 w-4"})})(),id:t.id,label:t.label,title:t.label,closeLabel:f("terminalView.tabs.closeTabTitle")})),[k?.tabs,f]),j=me?.terminalSessionId??null,Oe=me?.lifecycle??"idle",xe=me?.bufferChunks??[],$e=me?.isConnecting??!1,nt=me?.previewUrl??null,[We,O]=n.useState(null),[at,y]=n.useState(!1),[ve,A]=n.useState(!1),[M,C]=n.useState(null),[Te,le]=n.useState(!1),[W,He]=n.useState(0),De=n.useRef(null),ue=n.useRef(null),ke=n.useRef(R),X=n.useRef(j),U=n.useRef(h),L=n.useRef(null),Ne=n.useRef(null),Ge=n.useRef(!1),Xe=n.useRef(null),Ce=n.useRef(new Set),Qe=n.useRef(!1),we=n.useCallback(()=>{F||typeof document<"u"&&!document.hasFocus()||L.current?.focus()},[F]),fe=n.useCallback(()=>{F||L.current?.focus()},[F]);n.useEffect(()=>{if(!te||Qe.current)return;Qe.current=!0;const t=new Set;for(const[,u]of J.getState().sessions.entries())for(const i of u.tabs)i.terminalSessionId&&t.add(i.terminalSessionId);Ce.current=t},[te]);const rt=Ie(t=>t.activeMainTab),Ee=Ie(t=>t.isBottomTerminalOpen),ot=Ie(t=>t.setBottomTerminalOpen),st=Ie(t=>t.setBottomTerminalExpanded),Ze=rt==="terminal",e=Ze||Ee,[o,s]=n.useState(e);n.useEffect(()=>{!e||m.platform==="vscode"||It()},[e,m.platform]),n.useEffect(()=>{e&&s(!0)},[e]),n.useEffect(()=>{Ge.current=e},[e]),n.useEffect(()=>{X.current=j},[j]),n.useEffect(()=>{ke.current=R},[R]),n.useEffect(()=>{U.current=h},[h]),n.useEffect(()=>{!I&&M!==null&&C(null)},[I,M,C]),n.useEffect(()=>{!j&&M!==null&&C(null)},[j,M,C]);const c=n.useCallback(()=>{De.current?.(),De.current=null,ue.current=null,A(!1)},[]);n.useEffect(()=>()=>{c(),X.current=null},[c]);const r=n.useCallback((t,u,i,b=ut)=>{if(ue.current===i)return;c(),ue.current=i;const w=p.connect(i,{onEvent:g=>{if(ue.current===i)switch(g.type){case"connected":{re(t,u,!1),O(null),y(!1),A(!1),we(),Xe.current===i&&(Xe.current=null,p.sendInput(i,"\r").catch(()=>{}));break}case"reconnecting":{O(null),y(!1),A(!0);break}case"data":{g.data&&qe(t,u,g.data);break}case"exit":{const d=typeof g.exitCode=="number"?g.exitCode:null,_=typeof g.signal=="number"?g.signal:null,$=!!J.getState().getDirectoryState(t)?.tabs.find(ae=>ae.id===u)?.label?.startsWith("Action:");qe(t,u,f("terminalView.stream.processExitedMessage",{exitCodeSegment:d!==null?f("terminalView.stream.processExitedWithCode",{exitCode:d}):"",signalSegment:_!==null?f("terminalView.stream.processExitedWithSignal",{signal:_}):""})),ge(t,u,"exited"),q(t,u,null),re(t,u,!1),O($?null:f("terminalView.error.sessionEnded")),y(!1),A(!1),c();break}}},onError:(g,d)=>{if(ue.current===i){if(!d){O(null),y(!1);return}A(!1),O(f("terminalView.error.connectionFailed",{message:g.message})),y(!0),re(t,u,!1),ge(t,u,"exited"),q(t,u,null),c()}}},b);De.current=()=>{w.close(),ue.current=null}},[qe,c,we,re,ge,q,f,p]);n.useEffect(()=>{let t=!1;if(!te||!o)return;if(!h){O(f(ze?"terminalView.empty.noWorkingDirectory":"terminalView.empty.selectSession")),c();return}return(async()=>{const i=h;if(!U.current||U.current!==i)return;Le(i);const b=J.getState().getDirectoryState(i);if(!b||b.tabs.length===0)return;const w=N?b.activeTabId??b.tabs[0]?.id??null:b.tabs[0]?.id??null;if(!w)return;const g=b.tabs.find(se=>se.id===w)??b.tabs[0];let d=g?.terminalSessionId??null;const _=g?.lifecycle??"idle",oe=!!g?.label?.startsWith("Action:"),$=(g?.bufferLength??0)>0||(g?.bufferChunks?.length??0)>0,ae=!!d&&Ce.current.has(d)&&(g?.bufferLength??0)===0&&(g?.bufferChunks?.length??0)===0,Se=!!d&&Ce.current.has(d);if(!d){if(_==="exited"){re(i,w,!1);return}if(oe&&$){re(i,w,!1);return}O(null),y(!1),A(!1),re(i,w,!0);try{const se=Ne.current,Pe=await p.createSession({cwd:i,cols:se?.cols,rows:se?.rows});if(!(!t&&U.current===i&&ke.current===w)){try{await p.close(Pe.sessionId)}catch{}return}q(i,w,Pe.sessionId),d=Pe.sessionId}catch(se){t||(O(se instanceof Error?se.message:f("terminalView.error.startSessionFailed")),y(!0),A(!1),re(i,w,!1));return}}!d||t||(X.current=d,Se&&Ce.current.delete(d),ae&&(Xe.current=d),r(i,w,d,Se?Pt:ut))})(),()=>{t=!0,X.current=null,c()}},[ze,h,j,Oe,R,o,N,te,Le,re,ge,q,r,c,f,p]),n.useEffect(()=>{if(!e||F)return;if(typeof window>"u"){we();return}const t=window.requestAnimationFrame(()=>{we()});return()=>{window.cancelAnimationFrame(t)}},[R,we,e,F]);const v=n.useCallback(async()=>{if(!h||Te)return;const t=J.getState().getDirectoryState(h),u=N?R??t?.activeTabId??t?.tabs[0]?.id??null:t?.tabs[0]?.id??null;if(u){le(!0),O(null),y(!1),A(!1),c();try{await ne(h,u)}catch(i){O(i instanceof Error?i.message:f("terminalView.error.restartFailed")),y(!0),A(!1)}finally{le(!1)}}},[R,ne,c,h,N,Te,f]),S=n.useCallback(async()=>{await v()},[v]),D=n.useCallback(()=>{if(!h)return;const t=Ke(h);pe(h,t),O(null),y(!1),A(!1),c()},[Ke,c,h,pe]),G=n.useCallback(t=>{h&&(pe(h,t),O(null),y(!1),A(!1),c())},[c,h,pe]),l=n.useCallback(t=>{h&&(t===R&&c(),O(null),y(!1),A(!1),ne(h,t))},[R,ne,c,h]),T=n.useCallback(t=>{if(!t||ve)return;let u=t,i=!1;if(M&&t.length>0){const w=t[0];if(w.length===1&&/[a-zA-Z]/.test(w)){const g=w.toUpperCase();(M==="ctrl"||M==="cmd")&&(u=String.fromCharCode(g.charCodeAt(0)&31),i=!0)}i||(i=!0)}const b=X.current;b&&(p.sendInput(b,u).catch(w=>{ve||O(w instanceof Error?w.message:f("terminalView.error.sendInputFailed"))}),i&&(C(null),fe()))},[M,fe,ve,C,f,p]),V=n.useCallback((t,u)=>{if(Ne.current={cols:t,rows:u},!Ge.current)return;const i=X.current;i&&p.resize({sessionId:i,cols:t,rows:u}).catch(()=>{})},[p]),H=n.useCallback(t=>{C(u=>u===t?null:t),fe()},[fe,C]),K=n.useCallback(t=>{const u=jt(t,M);u&&(T(u),C(null),fe())},[M,fe,T,C]);n.useEffect(()=>{if(!I||!M||!j)return;const t=u=>{if(u.repeat)return;const i=u.key;if(!i||i==="Control"||i==="Meta"||i==="Alt"||i==="Shift")return;const b=i.length===1?i.toLowerCase():i,w=u.code??"",g=w.startsWith("Key")&&w.length===4?w.slice(3).toUpperCase():null,d=i.length===1&&/[a-zA-Z]/.test(i)?i.toUpperCase():g,_={Tab:"tab",Enter:"enter",ArrowUp:"arrow-up",ArrowDown:"arrow-down",ArrowLeft:"arrow-left",ArrowRight:"arrow-right",Escape:"esc",tab:"tab",enter:"enter",arrowup:"arrow-up",arrowdown:"arrow-down",arrowleft:"arrow-left",arrowright:"arrow-right",escape:"esc"};if(b in _){u.preventDefault(),u.stopPropagation(),K(_[b]);return}if(M==="ctrl"&&d&&d.length===1&&d>="A"&&d<="Z"){const oe=String.fromCharCode(d.charCodeAt(0)&31);u.preventDefault(),u.stopPropagation(),T(oe),C(null),fe()}};return window.addEventListener("keydown",t),()=>{window.removeEventListener("keydown",t)}},[M,K,T,fe,I,C,j]);const Y=n.useMemo(()=>{const t=et[ct].stack;if(typeof window>"u")return(et[de]??et[ct]).stack;const i=window.getComputedStyle(document.documentElement).getPropertyValue("--font-family-mono");return i&&i.trim().length>0?i.trim():(et[de]??et[ct]).stack??t},[de]),x=n.useMemo(()=>Mt(ee),[ee]),B=n.useMemo(()=>`${h??"no-dir"}::${R??"no-tab"}::${j??"no-terminal"}`,[h,R,j]),Re=n.useMemo(()=>`${B}::layout-${W}`,[B,W]);if(n.useEffect(()=>{if(F||!Ee||!e)return;if(typeof window>"u"){He(u=>u+1);return}const t=window.setTimeout(()=>{He(u=>u+1)},140);return()=>{window.clearTimeout(t)}},[ye,Be,Ee,e,F]),n.useEffect(()=>{if(!e||F)return;const t=L.current;if(!t)return;const u=()=>{t.fit()};if(typeof window<"u"){const i=window.requestAnimationFrame(()=>{u(),we()}),b=[220,400].map(w=>window.setTimeout(u,w));return()=>{window.cancelAnimationFrame(i),b.forEach(w=>window.clearTimeout(w))}}u()},[we,e,F,B,j]),n.useEffect(()=>{if(F||!e||!Ee)return;const t=L.current;if(!t)return;const u=()=>{t.fit()};if(typeof window<"u"){const i=window.requestAnimationFrame(()=>{u()}),b=[0,80,180,320].map(w=>window.setTimeout(u,w));return()=>{window.cancelAnimationFrame(i),b.forEach(w=>window.clearTimeout(w))}}u()},[ye,Be,Ee,e,F]),!ze)return a.jsx("div",{className:"flex h-full items-center justify-center p-4 text-center text-sm text-muted-foreground",children:f("terminalView.empty.selectSession")});if(!h)return a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2 p-4 text-center text-sm text-muted-foreground",children:[a.jsx("p",{children:f("terminalView.empty.noWorkingDirectoryForSession")}),a.jsx("button",{onClick:v,className:"rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90",children:f("terminalView.actions.retry")})]});const z=!j||$e||Te||ve,Ve=o,Ae=!he&&Ee&&!Ze,Q=a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 px-2 text-xs",onClick:()=>K("esc"),disabled:z,children:f("terminalView.quickKeys.escape")}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 w-9 p-0",onClick:()=>K("tab"),disabled:z,children:[a.jsx(ie,{name:"arrow-right",className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:f("terminalView.quickKeys.tabAria")})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"chip","aria-pressed":M==="ctrl",className:"h-6 w-9 p-0",onClick:()=>H("ctrl"),disabled:z,children:[a.jsx("span",{className:"text-xs font-medium",children:f("terminalView.quickKeys.controlLabel")}),a.jsx("span",{className:"sr-only",children:f("terminalView.quickKeys.controlModifierAria")})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"chip","aria-pressed":M==="cmd",className:"h-6 w-9 p-0",onClick:()=>H("cmd"),disabled:z,children:[a.jsx(ie,{name:"command"}),a.jsx("span",{className:"sr-only",children:f("terminalView.quickKeys.commandModifierAria")})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 w-9 p-0",onClick:()=>K("arrow-up"),disabled:z,children:[a.jsx(ie,{name:"arrow-up"}),a.jsx("span",{className:"sr-only",children:f("terminalView.quickKeys.arrowUpAria")})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 w-9 p-0",onClick:()=>K("arrow-left"),disabled:z,children:[a.jsx(ie,{name:"arrow-left"}),a.jsx("span",{className:"sr-only",children:f("terminalView.quickKeys.arrowLeftAria")})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 w-9 p-0",onClick:()=>K("arrow-down"),disabled:z,children:[a.jsx(ie,{name:"arrow-down"}),a.jsx("span",{className:"sr-only",children:f("terminalView.quickKeys.arrowDownAria")})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 w-9 p-0",onClick:()=>K("arrow-right"),disabled:z,children:[a.jsx(ie,{name:"arrow-right"}),a.jsx("span",{className:"sr-only",children:f("terminalView.quickKeys.arrowRightAria")})]}),a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-6 w-9 p-0",onClick:()=>K("enter"),disabled:z,children:[a.jsx(ie,{name:"arrow-go-back"}),a.jsx("span",{className:"sr-only",children:f("terminalView.quickKeys.enterAria")})]})]});return a.jsxs("div",{className:"flex h-full flex-col overflow-hidden bg-[var(--surface-background)]",children:[a.jsxs("div",{className:Ue("app-region-no-drag sticky top-0 z-20 shrink-0 bg-[var(--surface-background)] text-xs",he?"px-3 py-1.5":"pl-3 pr-1.5 py-1"),children:[N&&k?a.jsxs("div",{className:"flex items-center gap-2 pl-1 pr-1",children:[a.jsx("div",{className:Ue("min-w-0 flex-1",he?"h-8":"h-7"),children:a.jsx(St,{items:Ye,activeId:R,onSelect:G,onClose:l,layoutMode:"scrollable",variant:"default",className:"h-full bg-transparent"})}),a.jsx(Z,{type:"button",size:"xs",variant:"ghost",className:Ue("shrink-0",he?"h-8 w-8 p-0":"h-7 w-7 p-0"),onClick:D,title:f("terminalView.tabs.newTabTitle"),children:a.jsx(ie,{name:"add",className:`${he?"h-[18px] w-[18px]":"h-4 w-4"}`})}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1 overflow-visible",children:[nt?a.jsxs(Z,{type:"button",size:"xs",variant:"outline",className:"h-6 shrink-0 gap-1 px-2",onClick:()=>{h&&ce(h,nt)},title:f("terminalView.preview.openTitle"),children:[a.jsx(ie,{name:"global",className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"whitespace-nowrap",children:f("terminalView.preview.open")})]}):null,Ae?a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",size:"xs",variant:"ghost",onClick:()=>st(!Be),className:Ue("shrink-0 p-0",E?"h-8 w-8":"h-7 w-7"),title:f(Be?"terminalView.bottomDock.restoreTitle":"terminalView.bottomDock.expandTitle"),"aria-label":f(Be?"terminalView.bottomDock.restoreAria":"terminalView.bottomDock.expandAria"),children:Be?a.jsx(ie,{name:"fullscreen-exit",className:"h-4 w-4"}):a.jsx(ie,{name:"fullscreen",className:"h-4 w-4"})}),a.jsx(Z,{type:"button",size:"xs",variant:"ghost",onClick:()=>ot(!1),className:Ue("shrink-0 p-0",E?"h-8 w-8":"h-7 w-7"),title:f("terminalView.bottomDock.closeTitle"),"aria-label":f("terminalView.bottomDock.closeAria"),children:a.jsx(ie,{name:"close",className:"h-4 w-4"})})]}):null]})]}):null,!E&&I&&N&&k?a.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-1 pl-1 pr-1",children:Q}):null,I&&(E||!N||!k)?a.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:Q}):null]}),a.jsxs("div",{className:"relative flex-1 overflow-hidden",style:{backgroundColor:x.background},children:[a.jsx("div",{className:"h-full w-full box-border pl-4 pr-1.5 pt-3 pb-4",children:Ve?a.jsx(pt,{ref:t=>{L.current=t},sessionKey:Re,chunks:xe,onInput:T,onResize:V,theme:x,fontFamily:Y,fontSize:Me,enableTouchScroll:F,autoFocus:!F&&e,isVisible:e}):null}),!ve&&We&&a.jsxs("div",{className:"absolute inset-x-0 bottom-0 bg-[var(--status-error-background)] px-3 py-2 text-xs text-[var(--status-error-foreground)] flex items-center justify-between gap-2",children:[a.jsx("span",{children:We}),at&&E&&a.jsx(Z,{size:"sm",variant:"secondary",className:"h-6 px-2 py-0 text-xs",onClick:S,disabled:Te,title:f("terminalView.actions.hardRestartTitle"),type:"button",children:f("terminalView.actions.hardRestart")})]})]})]})};export{Ht as TerminalView};
|