@openchamber/web 1.11.0 → 1.11.2
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-9F0tH9yA.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl-Bma9y3dD.js → MarkdownRendererImpl-C3QofAGm.js} +2 -2
- package/dist/assets/{MultiRunWindow-Cwc0x7fs.js → MultiRunWindow-wnUGv0Dl.js} +1 -1
- package/dist/assets/{OnboardingScreen-BhozUlcE.js → OnboardingScreen-17dAs0NH.js} +2 -2
- package/dist/assets/{SettingsWindow-B4B2bn0C.js → SettingsWindow-BgyVY5gz.js} +1 -1
- package/dist/assets/{TerminalView-BpoHWJj6.js → TerminalView-D11XIZuz.js} +1 -1
- package/dist/assets/{ToolOutputDialog-7U42lN20.js → ToolOutputDialog-DFG7ANVw.js} +6 -6
- package/dist/assets/es-Chl2Hu6K.js +15 -0
- package/dist/assets/index-0bVkxg-Z.css +1 -0
- package/dist/assets/{index-B2ztI3pp.js → index-BV2XTsJJ.js} +1 -1
- package/dist/assets/ko-BSrH3F9n.js +15 -0
- package/dist/assets/{main-rHOaDqOy.js → main-BHkNwOz1.js} +2 -2
- package/dist/assets/main-Bqf4fXgq.js +225 -0
- package/dist/assets/miniChat-BmB-E5xo.js +2 -0
- package/dist/assets/{modelPrefsAutoSave-D5z_F_WP.js → modelPrefsAutoSave-2uwW8uD9.js} +104 -96
- package/dist/assets/pl-YlGvPmFg.js +15 -0
- package/dist/assets/pt-BR-BonIMDN_.js +15 -0
- package/dist/assets/renderElectronMiniChatApp-B_qrXCU2.js +2 -0
- package/dist/assets/uk-lPqA3MHn.js +15 -0
- package/dist/assets/{vendor-.bun-BFTPeDgG.js → vendor-.bun-Boz6Tqcq.js} +20 -20
- package/dist/assets/zh-CN-C5nQQsUL.js +15 -0
- package/dist/index.html +4 -4
- package/dist/mini-chat.html +4 -4
- package/package.json +1 -1
- package/server/lib/git/DOCUMENTATION.md +1 -0
- package/server/lib/git/routes.js +26 -0
- package/server/lib/git/service.js +96 -10
- package/server/lib/git/service.test.js +39 -0
- package/server/lib/opencode/settings-helpers.js +10 -1
- package/server/lib/opencode/settings-helpers.test.js +35 -0
- package/server/lib/opencode/skill-routes.js +43 -49
- package/server/lib/opencode/skills.js +78 -10
- package/server/lib/preview/proxy-runtime.js +43 -3
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as s,j as e}from"./vendor-.bun-
|
|
1
|
+
import{R as s,j as e}from"./vendor-.bun-Boz6Tqcq.js";import{u as j,at as u,I as x,eS as b}from"./modelPrefsAutoSave-2uwW8uD9.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,
|
|
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,am as Ye}from"./vendor-.bun-Boz6Tqcq.js";import{M as Ce,bg as Re,a as be,u as le,bM as Ee,c as L,b1 as Qe,b3 as ke,eP as Je,eQ as he,O as Xe,eR as et,I as U,b as ge,v as se,w as Te}from"./modelPrefsAutoSave-2uwW8uD9.js";import"./index-BV2XTsJJ.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-
|
|
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-Boz6Tqcq.js";import{u as z,c as w,I as O}from"./modelPrefsAutoSave-2uwW8uD9.js";import{M as P}from"./main-Bqf4fXgq.js";import"./index-BV2XTsJJ.js";import"./JsonTreeView-9F0tH9yA.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
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-.bun-
|
|
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};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-.bun-Boz6Tqcq.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-Boz6Tqcq.js";import{u as z,eK as ie,eL as Q,a1 as X,eM as q,m as L,at as T,al as H,N as oe,ab as ce,d as ne,cT as W,v as se,c as G,I,a3 as Y}from"./modelPrefsAutoSave-2uwW8uD9.js";import"./index-BV2XTsJJ.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-Boz6Tqcq.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};
|
|
@@ -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-
|
|
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-Boz6Tqcq.js";import{u as R,c as g}from"./modelPrefsAutoSave-2uwW8uD9.js";import{a as S}from"./main-Bqf4fXgq.js";import"./index-BV2XTsJJ.js";import"./JsonTreeView-9F0tH9yA.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};
|