@shawnstack/quickforge 1.6.9 → 1.6.10
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/README.md +452 -452
- package/dist/assets/AgentProfilesPage-BtZpDV-3.js +1 -0
- package/dist/assets/{ChatPanelHost-BNFeNRy-.js → ChatPanelHost-BF1V-xOV.js} +49 -49
- package/dist/assets/{PluginsPage-C5OClNdT.js → PluginsPage-CCIj8-Mn.js} +1 -1
- package/dist/assets/{ScheduledTasksPage-yT10oaaM.js → ScheduledTasksPage-DIMewQ3i.js} +2 -2
- package/dist/assets/{SettingsWorkspacePage-DuXwIeLd.js → SettingsWorkspacePage-BPD495WT.js} +348 -353
- package/dist/assets/{SharedConversationPage-ClpUSa0F.js → SharedConversationPage-B_oMTp7B.js} +1 -1
- package/dist/assets/TerminalDock-wgW7kSC4.js +2 -0
- package/dist/assets/WorkspaceInspector-CdX45r3u.js +13 -0
- package/dist/assets/index-Bxg5fT2p.css +3 -0
- package/dist/assets/index-DKmdePUP.js +63 -0
- package/dist/assets/{mcp-servers-dialog-DC2Zfojn.js → mcp-servers-dialog-jHlDR9jP.js} +2 -2
- package/dist/assets/{skills-dialog-Mnj8fZwq.js → skills-dialog-DvSnPPzu.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +1 -1
- package/server/routes/backup.mjs +135 -48
- package/server/routes/workspace.mjs +56 -0
- package/server/utils/platform.mjs +4 -4
- package/dist/assets/AgentProfilesPage-5eqU0Cjk.js +0 -1
- package/dist/assets/TerminalDock-BmL-FeKv.js +0 -2
- package/dist/assets/WorkspaceInspector-yH23pXpj.js +0 -13
- package/dist/assets/index-Qof73j0o.css +0 -3
- package/dist/assets/index-_ut7awrd.js +0 -63
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{$ as t,At as n,B as r,C as i,Et as a,It as o,M as s,N as c,Ot as l,P as u,Q as d,R as f,Rt as p,U as m,Vt as h,W as g,Y as _,Z as v,_ as ee,_t as y,at as b,b as te,c as ne,ct as re,et as x,ft as ie,gt as S,ht as ae,jt as oe,lt as se,mt as ce,n as le,nt as C,o as ue,ot as w,pt as de,q as fe,rt as pe,st as me,tt as he,ut as ge,v as _e,x as ve}from"./icons-C7j5jdKo.js";import{n as ye}from"./react-vendor-VqdnQHHS.js";import{A as T,B as be,M as xe,V as Se,_ as Ce,a as E,ct as D,d as we,f as Te,g as Ee,h as De,i as O,lt as k,m as Oe,n as A,o as ke,p as Ae,pt as j,r as M,t as je,u as Me,v as Ne,y as Pe}from"./index-_ut7awrd.js";import{n as N,r as Fe,t as Ie}from"./mermaid-renderer-BmbSAmpG.js";import{TerminalDock as Le,t as Re}from"./TerminalDock-BmL-FeKv.js";import{n as ze,t as Be}from"./monaco-CdOyGlWD.js";var P=e(h(),1),F=ye();function Ve(e){let t=e.trim();if(!t.startsWith(`/api/workspace/preview/`))return!1;try{let e=new URL(t,window.location.origin);return e.origin===window.location.origin&&e.pathname.startsWith(`/api/workspace/preview/`)}catch{return!1}}function He(e){let t=e.trim().replace(/\\/g,`/`);return t.startsWith(`/`)||/^[a-zA-Z]:\//.test(t)}function Ue(e,t){let n=e.trim();if(!t||!Ve(n))return n;try{let e=new URL(n,window.location.origin),r=`/api/workspace/preview/${encodeURIComponent(t)}/`;return e.pathname.startsWith(r)?e.pathname.slice(r.length).split(`/`).map(e=>decodeURIComponent(e)).join(`/`):n}catch{return n}}function We(e,t){let n=e.trim();if(!n)return{url:``,displayUrl:``,error:``};if(Ve(n)){let e=new URL(n,window.location.origin);return{url:`${e.pathname}${e.search}${e.hash}`,displayUrl:Ue(n,t),error:``}}if(t&&He(n))return{url:ke(t,n),displayUrl:n,error:``};let r=/^https?:\/\//i.test(n)?n:`http://${n}`;try{let e=new URL(r);return e.protocol!==`http:`&&e.protocol!==`https:`?{url:``,displayUrl:n,error:j(`invalidPreviewUrl`)}:{url:e.toString(),displayUrl:e.toString(),error:``}}catch{return{url:``,displayUrl:n,error:j(`invalidPreviewUrl`)}}}function Ge({url:e,onUrlChange:t,projectId:n}){let r=(0,P.useMemo)(()=>We(e,n),[n,e]),[a,o]=(0,P.useState)({sourceUrl:e,value:r.displayUrl}),[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(0),[f,m]=(0,P.useState)(!1),[h,_]=(0,P.useState)(100),v=(0,P.useRef)(null),ee=(0,P.useRef)(null),y=r.url,b=y.startsWith(`/api/workspace/preview/`)?`allow-scripts allow-same-origin allow-forms`:`allow-scripts allow-same-origin allow-forms allow-popups allow-downloads allow-modals allow-pointer-lock`,te=a.sourceUrl===e?a.value:r.displayUrl;(0,P.useEffect)(()=>{if(!f)return;function e(e){v.current?.contains(e.target)||m(!1)}return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[f]);function ne(){try{ee.current?.contentWindow?.history.back()}catch{}}function re(e=te){let r=We(e,n);if(r.error){l(r.error);return}l(``),o({sourceUrl:r.displayUrl,value:r.displayUrl}),t(r.displayUrl),r.url&&d(e=>e+1)}function x(){y&&d(e=>e+1)}function S(){y&&window.open(y,`_blank`,`noopener,noreferrer`)}return(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,F.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-border p-3`,children:[(0,F.jsxs)(`form`,{className:`flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),re()},children:[(0,F.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,onClick:ne,disabled:!y,"aria-label":j(`back`),title:j(`back`),children:(0,F.jsx)(p,{className:`size-4`})}),(0,F.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,onClick:x,disabled:!y,"aria-label":j(`refreshPreview`),title:j(`refreshPreview`),children:(0,F.jsx)(ve,{className:`size-4`})}),(0,F.jsxs)(`label`,{className:`mx-auto flex h-9 min-w-0 max-w-xl flex-1 items-center rounded-full border border-[color-mix(in_oklab,var(--border)_42%,transparent)] bg-muted/30 px-3 text-sm text-muted-foreground/65 focus-within:bg-background focus-within:text-foreground/85`,children:[(0,F.jsx)(`span`,{className:`sr-only`,children:j(`previewUrl`)}),(0,F.jsx)(`input`,{value:te,onChange:t=>{o({sourceUrl:e,value:t.target.value}),c&&l(``)},placeholder:j(`previewUrlPlaceholder`),className:`min-w-0 flex-1 bg-transparent text-center text-sm text-foreground/85 outline-none placeholder:text-muted-foreground/55`})]}),(0,F.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,onClick:S,disabled:!y,"aria-label":j(`openInBrowser`),title:j(`openInBrowser`),children:(0,F.jsx)(ge,{className:`size-4`})}),(0,F.jsxs)(`div`,{ref:v,className:`relative shrink-0`,children:[(0,F.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>m(e=>!e),"aria-label":j(`more`),title:j(`more`),"aria-haspopup":`menu`,"aria-expanded":f,children:(0,F.jsx)(ie,{className:`size-4`})}),f?(0,F.jsxs)(`div`,{className:`absolute right-0 top-10 z-30 w-48 rounded-2xl border border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-popover p-2 shadow-quickforge`,role:`menu`,children:[(0,F.jsx)(`div`,{className:`px-2 py-1.5 text-xs font-medium text-muted-foreground`,children:j(`zoom`)}),(0,F.jsxs)(`div`,{className:`flex items-center justify-between gap-2 rounded-xl px-1 py-1.5`,children:[(0,F.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8`,onClick:()=>_(e=>Math.max(50,e-10)),"aria-label":j(`zoomOut`),title:j(`zoomOut`),children:(0,F.jsx)(s,{className:`size-4`})}),(0,F.jsxs)(`button`,{type:`button`,className:`min-w-14 rounded-lg px-2 py-1 text-sm font-medium text-foreground/85 hover:bg-muted/50`,onClick:()=>_(100),title:j(`resetZoom`),children:[h,`%`]}),(0,F.jsx)(D,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8`,onClick:()=>_(e=>Math.min(200,e+10)),"aria-label":j(`zoomIn`),title:j(`zoomIn`),children:(0,F.jsx)(i,{className:`size-4`})})]})]}):null]})]}),c?(0,F.jsx)(`div`,{className:`text-xs text-destructive`,children:c}):null]}),(0,F.jsx)(`div`,{className:`min-h-0 flex-1 bg-muted/10`,children:y?(0,F.jsx)(`div`,{className:`h-full w-full overflow-auto bg-background`,children:(0,F.jsx)(`iframe`,{ref:ee,title:j(`webPreview`),src:y,sandbox:b,className:`origin-top-left border-0 bg-background`,style:{width:`${1e4/h}%`,height:`${1e4/h}%`,transform:`scale(${h/100})`}},`${y}:${u}`)}):(0,F.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-8 text-center`,children:[(0,F.jsx)(g,{className:`size-20 stroke-[1.55] text-muted-foreground/75`}),(0,F.jsx)(`div`,{className:`mt-8 text-xl font-semibold tracking-tight text-foreground/88`,children:j(`noPreviewUrlTitle`)}),(0,F.jsx)(`div`,{className:`mt-4 max-w-xs text-base leading-6 text-muted-foreground/82`,children:j(`noPreviewUrlDescription`)})]})})]})}function Ke({source:e}){let[t,n]=(0,P.useState)({source:e,value:`preview`}),[r,i]=(0,P.useState)({source:``,dataUrl:``,error:!1});(0,P.useEffect)(()=>{let t=!1;return Fe(e).then(n=>{t||i({source:e,dataUrl:Ie(n),error:!1})}).catch(()=>{t||i({source:e,dataUrl:``,error:!0})}),()=>{t=!0}},[e]);let a=r.source===e?r:{source:e,dataUrl:``,error:!1},o=t.source===e?t.value:`preview`,s=r.source!==e,c=o===`source`||a.error;return(0,F.jsxs)(`figure`,{className:`my-5 overflow-hidden rounded-xl border border-border bg-muted/20`,children:[(0,F.jsxs)(`figcaption`,{className:`flex min-h-9 items-center justify-between gap-3 border-b border-border px-3 py-1.5`,children:[(0,F.jsx)(`span`,{className:`font-mono text-[11px] text-muted-foreground/65`,children:`mermaid`}),(0,F.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md bg-background/70 p-0.5`,children:[(0,F.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40`,disabled:!a.dataUrl,"aria-pressed":!c,onClick:()=>n({source:e,value:`preview`}),children:j(`svgPreviewMode`)}),(0,F.jsx)(`button`,{type:`button`,className:`rounded px-2 py-1 text-[11px] text-muted-foreground transition-colors hover:text-foreground`,"aria-pressed":c,onClick:()=>n({source:e,value:`source`}),children:j(`svgSourceMode`)})]})]}),s?(0,F.jsx)(`div`,{className:`flex min-h-28 items-center justify-center px-4 py-8 text-xs text-muted-foreground/70`,role:`status`,children:j(`mermaidRendering`)}):c?(0,F.jsxs)(F.Fragment,{children:[a.error?(0,F.jsx)(`p`,{className:`px-4 pt-3 text-xs text-muted-foreground`,children:j(`mermaidRenderFailed`)}):null,(0,F.jsx)(`pre`,{className:`overflow-auto p-4 text-[12px] leading-5`,children:(0,F.jsx)(`code`,{children:e})})]}):(0,F.jsx)(`div`,{className:`flex min-h-28 justify-center overflow-auto bg-background/45 p-4`,children:(0,F.jsx)(`img`,{className:`h-auto max-w-full object-contain`,src:a.dataUrl,alt:j(`mermaidPreviewLabel`)})})]})}function qe(){let[e,t]=(0,P.useState)(()=>xe());return(0,P.useEffect)(()=>{if(typeof window>`u`)return;let e=()=>t(xe());return window.addEventListener(T,e),()=>window.removeEventListener(T,e)},[]),e}function I({path:e,content:t,language:n}){let r=Re(),i=qe();return(0,F.jsx)(Be,{value:t,language:n,theme:r===`dark`?`vs-dark`:`vs`,options:{readOnly:!0,contextmenu:!1,automaticLayout:!0,minimap:{enabled:!1},fontFamily:getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace`,fontSize:i.fontSize,lineHeight:i.lineHeight,lineNumbers:`on`,scrollBeyondLastLine:!1,wordWrap:`off`,renderLineHighlight:`line`,folding:!1,glyphMargin:!1,scrollbar:{verticalScrollbarSize:8,horizontalScrollbarSize:8}}},e)}function Je(e){let t=e.trim();if(t&&!/^(javascript|data|vbscript):/i.test(t)&&/^(https?:|mailto:|#|\/|\.\.?\/)/i.test(t))return t}function L(e,t){let n=[],r=/`([^`]+)`|\[([^\]]+)\]\(([^)\s]+)(?:\s+"[^"]*")?\)|\*\*([^*]+)\*\*|__([^_]+)__|\*([^*\n]+)\*|_([^_\n]+)_/g,i=0,a=0,o;for(;o=r.exec(e);){o.index>i&&n.push(e.slice(i,o.index));let s=`${t}-inline-${a++}`;if(o[1])n.push((0,F.jsx)(`code`,{className:`rounded bg-muted/35 px-1 py-0.5 font-mono text-[0.85em] text-foreground/90`,children:o[1]},s));else if(o[2]&&o[3]){let e=Je(o[3]);n.push(e?(0,F.jsx)(`a`,{className:`text-primary underline-offset-4 hover:underline`,href:e,target:e.startsWith(`http`)?`_blank`:void 0,rel:`noreferrer`,children:o[2]},s):`[${o[2]}](${o[3]})`)}else o[4]||o[5]?n.push((0,F.jsx)(`strong`,{className:`font-semibold text-foreground/95`,children:o[4]||o[5]},s)):(o[6]||o[7])&&n.push((0,F.jsx)(`em`,{className:`italic`,children:o[6]||o[7]},s));i=r.lastIndex}return i<e.length&&n.push(e.slice(i)),n.length?n:[e]}function Ye(e,t){return e.split(`
|
|
2
|
-
`).flatMap((e,n)=>{let r=L(e,`${t}-line-${n}`);return n===0?r:[(0,F.jsx)(`br`,{},`${t}-br-${n}`),...r]})}function R(e){return/^\s*(```|~~~)/.test(e)}function Xe(e){return/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/.test(e)}function Ze(e,t){return!!(e[t]?.includes(`|`)&&e[t+1]&&Xe(e[t+1]))}function Qe(e,t){let n=e[t]??``;return R(n)||Ze(e,t)||/^\s{0,3}#{1,6}\s+/.test(n)||/^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/.test(n)||/^\s{0,3}>\s?/.test(n)||/^\s{0,3}[-*+]\s+/.test(n)||/^\s{0,3}\d+[.)]\s+/.test(n)}function z(e){return e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>e.trim())}function $e(e){let t=e.replace(/\r\n?/g,`
|
|
3
|
-
`).split(`
|
|
4
|
-
`),n=[],r=0,i=0;for(;r<t.length;){let e=t[r],a=`markdown-block-${i++}`;if(!e.trim()){r+=1;continue}if(R(e)){let i=e.match(/^\s*(```|~~~)\s*([^`]*)$/),o=i?.[1]??"```",s=i?.[2]?.trim(),c=[];for(r+=1;r<t.length&&!t[r].trimStart().startsWith(o);)c.push(t[r]),r+=1;r<t.length&&(r+=1);let l=c.join(`
|
|
5
|
-
`);N(s)?n.push((0,F.jsx)(Ke,{source:l},a)):n.push((0,F.jsxs)(`figure`,{className:`my-5 overflow-hidden rounded-xl border border-border bg-muted/20`,children:[s?(0,F.jsx)(`figcaption`,{className:`border-b border-border px-3 py-1.5 font-mono text-[11px] text-muted-foreground/65`,children:s}):null,(0,F.jsx)(`pre`,{className:`overflow-auto p-4 text-[12px] leading-5`,children:(0,F.jsx)(`code`,{children:l})})]},a));continue}let o=e.match(/^\s{0,3}(#{1,6})\s+(.+?)\s*#*\s*$/);if(o){let e=o[1].length,t=o[2],i=[`mt-8 mb-3 border-border text-foreground/95`,e===1?`border-b pb-3 text-3xl font-semibold tracking-tight`:``,e===2?`border-b pb-2 text-2xl font-semibold tracking-tight`:``,e===3?`text-xl font-semibold`:``,e===4?`text-lg font-semibold`:``,e>=5?`text-base font-semibold`:``].filter(Boolean).join(` `),s=L(t,`${a}-heading`);e===1?n.push((0,F.jsx)(`h1`,{className:i,children:s},a)):e===2?n.push((0,F.jsx)(`h2`,{className:i,children:s},a)):e===3?n.push((0,F.jsx)(`h3`,{className:i,children:s},a)):e===4?n.push((0,F.jsx)(`h4`,{className:i,children:s},a)):e===5?n.push((0,F.jsx)(`h5`,{className:i,children:s},a)):n.push((0,F.jsx)(`h6`,{className:i,children:s},a)),r+=1;continue}if(/^\s{0,3}([-*_])(?:\s*\1){2,}\s*$/.test(e)){n.push((0,F.jsx)(`hr`,{className:`my-6 border-border`},a)),r+=1;continue}if(Ze(t,r)){let e=z(t[r]);r+=2;let i=[];for(;r<t.length&&t[r].includes(`|`)&&t[r].trim();)i.push(z(t[r])),r+=1;n.push((0,F.jsx)(`div`,{className:`my-5 overflow-auto rounded-xl border border-border`,children:(0,F.jsxs)(`table`,{className:`w-full border-collapse text-left text-sm`,children:[(0,F.jsx)(`thead`,{className:`bg-muted/25 text-foreground/90`,children:(0,F.jsx)(`tr`,{children:e.map((e,t)=>(0,F.jsx)(`th`,{className:`border-b border-border px-3 py-2 font-semibold`,children:L(e,`${a}-th-${t}`)},`${a}-th-${t}`))})}),(0,F.jsx)(`tbody`,{children:i.map((t,n)=>(0,F.jsx)(`tr`,{className:`border-t border-border/70`,children:e.map((e,r)=>(0,F.jsx)(`td`,{className:`px-3 py-2 align-top text-foreground/85`,children:L(t[r]??``,`${a}-td-${n}-${r}`)},`${a}-td-${n}-${r}`))},`${a}-row-${n}`))})]})},a));continue}if(/^\s{0,3}>\s?/.test(e)){let e=[];for(;r<t.length&&/^\s{0,3}>\s?/.test(t[r]);)e.push(t[r].replace(/^\s{0,3}>\s?/,``)),r+=1;n.push((0,F.jsx)(`blockquote`,{className:`my-4 border-l-2 border-border pl-4 text-muted-foreground/85`,children:Ye(e.join(`
|
|
6
|
-
`),`${a}-quote`)},a));continue}if(/^\s{0,3}[-*+]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s{0,3}[-*+]\s+/.test(t[r]);)e.push(t[r].replace(/^\s{0,3}[-*+]\s+/,``)),r+=1;n.push((0,F.jsx)(`ul`,{className:`my-4 list-disc space-y-1 pl-6`,children:e.map((e,t)=>(0,F.jsx)(`li`,{children:L(e,`${a}-li-${t}`)},`${a}-li-${t}`))},a));continue}if(/^\s{0,3}\d+[.)]\s+/.test(e)){let e=[];for(;r<t.length&&/^\s{0,3}\d+[.)]\s+/.test(t[r]);)e.push(t[r].replace(/^\s{0,3}\d+[.)]\s+/,``)),r+=1;n.push((0,F.jsx)(`ol`,{className:`my-4 list-decimal space-y-1 pl-6`,children:e.map((e,t)=>(0,F.jsx)(`li`,{children:L(e,`${a}-li-${t}`)},`${a}-li-${t}`))},a));continue}let s=[];for(;r<t.length&&t[r].trim()&&!Qe(t,r);)s.push(t[r].trim()),r+=1;n.push((0,F.jsx)(`p`,{className:`my-4 text-foreground/86`,children:L(s.join(` `),`${a}-p`)},a))}return n}function et({path:e,content:t,language:n,mode:r}){let i=(0,P.useMemo)(()=>$e(t),[t]);return(0,F.jsx)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,children:(0,F.jsx)(`div`,{className:`min-h-0 flex-1`,children:r===`source`?(0,F.jsx)(I,{path:e,content:t,language:n}):(0,F.jsx)(`div`,{className:`h-full overflow-auto bg-background`,children:(0,F.jsx)(`article`,{className:`quickforge-markdown-reader mx-auto max-w-3xl px-8 py-7 text-sm leading-7 text-foreground/88`,children:i.length?i:(0,F.jsx)(`p`,{className:`text-muted-foreground/70`,children:`This Markdown file is empty.`})})})})})}function tt({path:e,oldContent:t,newContent:n,language:r,status:i}){let a=Re(),o=qe();return(0,F.jsx)(ze,{original:t,modified:n,language:r,theme:a===`dark`?`vs-dark`:`vs`,options:{readOnly:!0,contextmenu:!1,automaticLayout:!0,renderSideBySide:!0,minimap:{enabled:!1},fontFamily:getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace`,fontSize:o.fontSize,lineHeight:o.lineHeight,scrollBeyondLastLine:!1,ignoreTrimWhitespace:!1,folding:!1,glyphMargin:!1,scrollbar:{verticalScrollbarSize:8,horizontalScrollbarSize:8}}},`${i}:${e}`)}function B(e,t){let n=e.replace(/\r\n?/g,`
|
|
7
|
-
`).split(`
|
|
8
|
-
`),r=t.replace(/\r\n?/g,`
|
|
9
|
-
`).split(`
|
|
10
|
-
`),i=n.length,a=r.length;if(i*a>4e6)return;let o=Array(a+1).fill(0),s=Array(a+1).fill(0);for(let e=1;e<=i;e++){let t=n[e-1];for(let e=1;e<=a;e++)s[e]=t===r[e-1]?o[e-1]+1:Math.max(o[e],s[e-1]);let i=o;o=s,s=i}let c=o[a];return{added:a-c,removed:i-c}}var V=3,nt=5e7;function H(e){let t=e.replace(/\r\n/g,`
|
|
11
|
-
`).replace(/\r/g,`
|
|
12
|
-
`).split(`
|
|
13
|
-
`);return t.length>1&&t[t.length-1]===``&&t.pop(),t}function U(e,t){let n=H(e),r=H(t);if(n.length*r.length>nt)return;let i=Array.from({length:n.length+1},()=>new Uint32Array(r.length+1));for(let e=n.length-1;e>=0;--e)for(let t=r.length-1;t>=0;--t)i[e][t]=n[e]===r[t]?i[e+1][t+1]+1:Math.max(i[e+1][t],i[e][t+1]);let a=[],o=0,s=0,c=1,l=1;for(;o<n.length||s<r.length;){if(o<n.length&&s<r.length&&n[o]===r[s]){a.push({kind:`context`,oldLine:c,newLine:l,text:n[o]}),o+=1,s+=1,c+=1,l+=1;continue}if(s<r.length&&(o>=n.length||i[o][s+1]>=i[o+1][s])){a.push({kind:`add`,newLine:l,text:r[s]}),s+=1,l+=1;continue}o<n.length&&(a.push({kind:`delete`,oldLine:c,text:n[o]}),o+=1,c+=1)}return a}function rt(e){let t=e.map(e=>e.kind!==`context`);e.forEach((n,r)=>{if(n.kind===`context`)return;let i=Math.max(0,r-V),a=Math.min(e.length-1,r+V);for(let e=i;e<=a;e+=1)t[e]=!0});let n=[],r=0,i=0;for(;r<e.length;){if(t[r]||e[r].kind!==`context`){n.push(e[r]),r+=1;continue}let a=r;for(;r<e.length&&!t[r]&&e[r].kind===`context`;)r+=1;let o=e.slice(a,r);n.push({kind:`collapsed`,id:`collapsed-${i++}-${a}`,count:o.length,rows:o})}return n}function it(e){return e===`add`?`bg-emerald-500/12 text-foreground`:e===`delete`?`bg-red-500/12 text-foreground`:`bg-background text-foreground/90`}function at(e){return e===`add`?`+`:e===`delete`?`-`:` `}function ot({row:e}){let t=e.kind===`delete`?e.oldLine:e.newLine??e.oldLine;return(0,F.jsxs)(`div`,{className:k(`grid min-w-max grid-cols-[3rem_minmax(34rem,1fr)] text-[13px] leading-6`,it(e.kind)),children:[(0,F.jsx)(`span`,{className:k(`select-none pr-3 text-right font-mono`,e.kind===`delete`&&`text-red-600 dark:text-red-500`,e.kind===`add`&&`text-emerald-600 dark:text-emerald-500`,e.kind===`context`&&`text-muted-foreground/62`),children:t??``}),(0,F.jsxs)(`code`,{className:`whitespace-pre pr-4 font-mono`,children:[(0,F.jsx)(`span`,{className:k(`mr-3 select-none`,e.kind===`add`&&`text-emerald-600 dark:text-emerald-500`,e.kind===`delete`&&`text-red-600 dark:text-red-500`),children:at(e.kind)}),e.text||` `]})]})}function st(e,t,n){let r=new Set(e[t]??[]);return r.has(n)?r.delete(n):r.add(n),{...e,[t]:[...r]}}function W({diff:e,loading:t,error:r}){let[i,a]=(0,P.useState)({}),o=e?`${e.path}\u0000${e.oldContent.length}\u0000${e.newContent.length}`:``,s=(0,P.useMemo)(()=>new Set(i[o]??[]),[o,i]),c=(0,P.useMemo)(()=>{if(!e)return;let t=U(e.oldContent,e.newContent);return t?rt(t):void 0},[e]);return t?(0,F.jsx)(`div`,{className:`border-t border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-background px-3 py-4 text-sm text-muted-foreground/70`,children:j(`workspaceLoadingDiff`)}):r?(0,F.jsx)(`div`,{className:`border-t border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-background px-3 py-4 text-sm text-destructive`,children:r}):e?c?c.length===0?(0,F.jsx)(`div`,{className:`border-t border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-background px-3 py-4 text-sm text-muted-foreground/70`,children:j(`workspaceNoDiffPreview`)}):(0,F.jsx)(`div`,{className:`rounded-b-xl border-t border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-background`,children:(0,F.jsx)(`div`,{className:`max-h-[28rem] overflow-auto pb-1`,children:(0,F.jsx)(`div`,{className:`min-w-max py-2`,children:c.map(e=>{if(e.kind!==`collapsed`)return(0,F.jsx)(ot,{row:e},`${e.kind}:${e.oldLine??``}:${e.newLine??``}:${e.text}`);let t=s.has(e.id);return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`div`,{className:`grid min-w-max grid-cols-[3rem_minmax(34rem,1fr)] gap-1 py-1 pr-4`,children:[(0,F.jsx)(`button`,{type:`button`,className:`flex h-12 items-center justify-center rounded-lg bg-muted/60 text-muted-foreground/75 transition-colors hover:bg-muted/78 hover:text-foreground/80`,onClick:()=>{a(t=>st(t,o,e.id))},"aria-expanded":t,title:j(`workspaceUnmodifiedLines`,{count:e.count}),children:(0,F.jsx)(n,{className:k(`size-4 transition-transform`,t&&`rotate-180`)})}),(0,F.jsx)(`button`,{type:`button`,className:`flex h-12 items-center rounded-lg bg-muted/60 px-4 text-left text-base font-medium text-muted-foreground/80 transition-colors hover:bg-muted/78 hover:text-foreground/80`,onClick:()=>{a(t=>st(t,o,e.id))},"aria-expanded":t,children:j(`workspaceUnmodifiedLines`,{count:e.count})})]}),t?e.rows.map(t=>(0,F.jsx)(ot,{row:t},`hidden:${e.id}:${t.oldLine}:${t.newLine}`)):null]},e.id)})})})}):(0,F.jsx)(`div`,{className:`border-t border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-background px-3 py-4 text-sm text-muted-foreground/70`,children:j(`workspaceDiffTooLarge`)}):(0,F.jsx)(`div`,{className:`border-t border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-background px-3 py-4 text-sm text-muted-foreground/70`,children:j(`workspaceNoDiffPreview`)})}var ct={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,css:`css`,scss:`scss`,less:`less`,html:`html`,htm:`html`,md:`markdown`,markdown:`markdown`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,c:`c`,h:`c`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,hpp:`cpp`,cs:`csharp`,php:`php`,swift:`swift`,kt:`kotlin`,kts:`kotlin`,sh:`shell`,bash:`shell`,zsh:`shell`,ps1:`powershell`,yml:`yaml`,yaml:`yaml`,xml:`xml`,sql:`sql`,dockerfile:`dockerfile`,toml:`toml`,ini:`ini`,env:`ini`};function G(e){let t=e.split(`/`).pop()?.toLowerCase()??``;return t===`dockerfile`||t.endsWith(`.dockerfile`)?`dockerfile`:ct[t.includes(`.`)?t.split(`.`).pop()??``:t]??`plaintext`}function K(e){return e.slice(e.lastIndexOf(`/`)+1)}function q(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t+1):``}var lt={typescript:{Icon:w,className:`text-sky-500 dark:text-sky-400`},javascript:{Icon:w,className:`text-amber-500 dark:text-amber-400`},python:{Icon:w,className:`text-blue-600 dark:text-blue-400`},go:{Icon:w,className:`text-cyan-600 dark:text-cyan-400`},rust:{Icon:w,className:`text-orange-600 dark:text-orange-400`},java:{Icon:w,className:`text-red-500 dark:text-red-400`},c:{Icon:w,className:`text-blue-500 dark:text-blue-400`},cpp:{Icon:w,className:`text-indigo-500 dark:text-indigo-400`},csharp:{Icon:w,className:`text-violet-500 dark:text-violet-400`},php:{Icon:w,className:`text-indigo-500 dark:text-indigo-400`},ruby:{Icon:w,className:`text-rose-500 dark:text-rose-400`},swift:{Icon:w,className:`text-orange-500 dark:text-orange-400`},kotlin:{Icon:w,className:`text-violet-500 dark:text-violet-400`},shell:{Icon:w,className:`text-green-600 dark:text-green-400`},powershell:{Icon:w,className:`text-blue-600 dark:text-blue-400`},json:{Icon:me,className:`text-amber-600 dark:text-amber-400`},css:{Icon:m,className:`text-sky-500 dark:text-sky-400`},scss:{Icon:m,className:`text-pink-500 dark:text-pink-400`},less:{Icon:m,className:`text-sky-500 dark:text-sky-400`},html:{Icon:de,className:`text-orange-500 dark:text-orange-400`},markdown:{Icon:x,className:`text-slate-500 dark:text-slate-400`},yaml:{Icon:b,className:`text-slate-500 dark:text-slate-400`},toml:{Icon:b,className:`text-slate-500 dark:text-slate-400`},ini:{Icon:b,className:`text-slate-500 dark:text-slate-400`},xml:{Icon:w,className:`text-slate-500 dark:text-slate-400`},sql:{Icon:ce,className:`text-indigo-500 dark:text-indigo-400`},dockerfile:{Icon:S,className:`text-sky-600 dark:text-sky-400`},plaintext:{Icon:x,className:`text-slate-500 dark:text-slate-400`}},ut=new Set([`png`,`jpg`,`jpeg`,`gif`,`svg`,`ico`,`webp`,`bmp`,`avif`]),J=new Set([`zip`,`tar`,`gz`,`tgz`,`rar`,`7z`,`bz2`,`xz`]),dt=new Set([`csv`,`tsv`,`xls`,`xlsx`]);function ft(e){if(e===`readme`||e.startsWith(`readme.`))return{Icon:o,className:`text-sky-500 dark:text-sky-400`};if(e===`license`||e.startsWith(`license.`)||e===`licence`||e.startsWith(`licence.`)||e===`copying`||e.startsWith(`copying.`))return{Icon:_e,className:`text-slate-500 dark:text-slate-400`};if(e===`makefile`||e.startsWith(`makefile.`))return{Icon:ue,className:`text-slate-500 dark:text-slate-400`};if(e.startsWith(`docker-compose`))return{Icon:S,className:`text-sky-600 dark:text-sky-400`};if(e===`.gitignore`||e===`.gitattributes`||e===`.gitmodules`)return{Icon:_e,className:`text-orange-500 dark:text-orange-400`};if(e===`.env`||e.startsWith(`.env.`))return{Icon:b,className:`text-slate-500 dark:text-slate-400`};if(e.endsWith(`.lock`)||e.endsWith(`-lock.json`)||e.endsWith(`-lock.yaml`))return{Icon:C,className:`text-slate-500 dark:text-slate-400`}}function pt(e){let n=K(e).toLowerCase(),r=ft(n);if(r)return r;let i=q(n);return ut.has(i)?{Icon:pe,className:`text-purple-500 dark:text-purple-400`}:J.has(i)?{Icon:re,className:`text-slate-500 dark:text-slate-400`}:dt.has(i)?{Icon:he,className:`text-green-600 dark:text-green-400`}:lt[G(e)]||{Icon:t,className:`text-slate-500 dark:text-slate-400`}}function mt(e,t){let n=e.toLowerCase();return n===`.git`||n===`.svn`||n===`.hg`?{Icon:d,className:`text-orange-500 dark:text-orange-400`}:{Icon:t?v:_,className:`text-slate-500 dark:text-slate-400`}}function ht({path:e,className:t=`size-3.5`}){let{Icon:n,className:r}=pt(e);return(0,F.jsx)(n,{className:`${r} ${t}`})}function gt({name:e,open:t,className:n=`size-3.5`}){let{Icon:r,className:i}=mt(e,t);return(0,F.jsx)(r,{className:`${i} ${n}`})}function _t(e){return j(e===`added`?`workspaceStatusAdded`:e===`deleted`?`workspaceStatusDeleted`:e===`renamed`?`workspaceStatusRenamed`:e===`untracked`?`workspaceStatusUntracked`:e===`conflicted`?`workspaceStatusConflict`:`workspaceStatusModified`)}function vt(e){let t=e.replace(/\\/g,`/`);return t.split(`/`).filter(Boolean).pop()||t||`—`}function Y(e,t,n){return e?.action===t&&(n?e.path===n:!e.path)}function yt(e){return!!(e.unstaged||e.status===`untracked`||e.conflict||!e.staged)}function bt({files:e,selectedPath:t,expandedDiff:n,expandedLoading:a,expandedError:o,onSelectFile:c,onRestoreFile:l,onStageFile:u,onUnstageFile:d,onOpenFile:f,onRestoreAll:p,onStageAll:m,onUnstageAll:h,showUnstageAll:g=!1,pendingAction:_,emptyMessage:v=j(`workspaceNoWorkingTreeChanges`)}){let ee=e.filter(yt),y=e.filter(e=>e.staged),b=Y(_,`restore`),ne=Y(_,`stage`),re=Y(_,`unstage`),x=!!_;return(0,F.jsxs)(`div`,{className:`relative flex min-h-0 flex-1 flex-col bg-background`,children:[(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-2 pb-20 pt-1`,children:e.length===0?(0,F.jsx)(`div`,{className:`px-3 py-4 text-xs text-muted-foreground/70`,children:v}):(0,F.jsx)(`div`,{className:`divide-y divide-[color-mix(in_oklab,var(--border)_28%,transparent)]`,children:e.map(e=>{let p=t===e.path,m=vt(e.path),h=Y(_,`restore`,e.path),v=Y(_,`stage`,e.path),ee=Y(_,`unstage`,e.path),y=e.status===`deleted`,b=g,ne=x||(b?!d||!e.staged:!u||!yt(e)),re=x||!l,ie=x||!f||y,S=e.oldPath?`${e.oldPath} → ${e.path}`:e.path;return(0,F.jsxs)(`div`,{className:k(`group overflow-hidden`,p&&`rounded-xl bg-muted/30`),children:[(0,F.jsxs)(`div`,{className:k(`grid min-h-[40px] grid-cols-[minmax(0,1fr)_auto] items-center gap-2 rounded-xl transition-colors`,p?`bg-muted/40`:`hover:bg-muted/24`),children:[(0,F.jsxs)(`button`,{type:`button`,className:`grid min-w-0 grid-cols-[24px_minmax(0,1fr)_auto] items-center gap-3 px-3 py-2 text-left text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:()=>c(e.path),title:`${_t(e.status)} · ${S}`,"aria-expanded":p,children:[(0,F.jsx)(ht,{path:e.path,className:`size-[15px] shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 truncate font-medium leading-[18px] text-foreground/90`,children:m}),typeof e.additions==`number`&&typeof e.deletions==`number`?(0,F.jsxs)(`span`,{className:`min-w-[64px] shrink-0 whitespace-nowrap text-right font-mono text-sm font-medium leading-[18px]`,children:[(0,F.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,e.additions]}),(0,F.jsxs)(`span`,{className:`ml-1.5 text-red-600 dark:text-red-500`,children:[`-`,e.deletions]})]}):(0,F.jsx)(`span`,{className:`min-w-[64px]`})]}),(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 pr-2 text-muted-foreground/55 opacity-80 transition-opacity group-hover:opacity-100`,children:[(0,F.jsx)(`button`,{type:`button`,className:`inline-flex size-[26px] items-center justify-center rounded-full transition-colors hover:bg-destructive/10 hover:text-destructive disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>l?.(e),disabled:re,"aria-label":j(`workspaceRestoreFile`),title:j(`workspaceRestoreFile`),children:h?(0,F.jsx)(r,{className:`size-3.5 animate-spin`}):(0,F.jsx)(te,{className:`size-4`})}),(0,F.jsx)(`button`,{type:`button`,className:k(`inline-flex size-[26px] items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-40`,b?`hover:bg-amber-500/10 hover:text-amber-600 dark:hover:text-amber-500`:`hover:bg-emerald-500/10 hover:text-emerald-600 dark:hover:text-emerald-500`),onClick:()=>b?d?.(e):u?.(e),disabled:ne,"aria-label":j(b?`workspaceUnstageFile`:`workspaceStageFile`),title:j(b?`workspaceUnstageFile`:`workspaceStageFile`),children:v||ee?(0,F.jsx)(r,{className:`size-3.5 animate-spin`}):b?(0,F.jsx)(s,{className:`size-4`}):(0,F.jsx)(i,{className:`size-4`})}),(0,F.jsx)(`button`,{type:`button`,className:`inline-flex size-[26px] items-center justify-center rounded-full transition-colors hover:bg-muted/35 hover:text-foreground/85 disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>f?.(e),disabled:ie,"aria-label":j(`workspaceOpenFileInNewTab`),title:j(y?`workspaceCannotOpenDeletedFile`:`workspaceOpenFileInNewTab`),children:(0,F.jsx)(ge,{className:`size-4`})})]})]}),p?(0,F.jsx)(W,{diff:n,loading:a,error:o}):null]},`${e.status}:${e.oldPath??``}:${e.path}`)})})}),(0,F.jsx)(`div`,{className:`pointer-events-none absolute bottom-4 left-1/2 z-20 -translate-x-1/2`,children:(0,F.jsxs)(`div`,{className:`pointer-events-auto inline-flex items-center gap-1 rounded-full border border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-background/95 p-1 shadow-quickforge`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 items-center gap-2 rounded-full px-3 text-sm font-medium text-muted-foreground/78 transition-colors hover:bg-destructive/10 hover:text-destructive disabled:cursor-not-allowed disabled:opacity-40`,onClick:p,disabled:!p||e.length===0||x,"aria-label":j(`workspaceRestoreAll`),title:j(`workspaceRestoreAll`),children:[b?(0,F.jsx)(r,{className:`size-3.5 animate-spin`}):(0,F.jsx)(te,{className:`size-3.5`}),(0,F.jsx)(`span`,{children:j(`workspaceRestoreAll`)})]}),(0,F.jsxs)(`button`,{type:`button`,className:k(`inline-flex h-8 items-center gap-2 rounded-full px-3 text-sm font-medium text-muted-foreground/78 transition-colors disabled:cursor-not-allowed disabled:opacity-40`,g?`hover:bg-amber-500/10 hover:text-amber-600 dark:hover:text-amber-500`:`hover:bg-emerald-500/10 hover:text-emerald-600 dark:hover:text-emerald-500`),onClick:g?h:m,disabled:g?!h||y.length===0||x:!m||ee.length===0||x,"aria-label":j(g?`workspaceUnstageAll`:`workspaceStageAll`),title:j(g?`workspaceUnstageAll`:`workspaceStageAll`),children:[ne||re?(0,F.jsx)(r,{className:`size-3.5 animate-spin`}):g?(0,F.jsx)(s,{className:`size-3.5`}):(0,F.jsx)(i,{className:`size-3.5`}),(0,F.jsx)(`span`,{children:j(g?`workspaceUnstageAll`:`workspaceStageAll`)})]})]})})]})}function xt(e){return e?e.status===`added`?`A`:e.status===`deleted`?`D`:e.status===`renamed`?`R`:e.status===`untracked`?`U`:`M`:``}function St({projectId:e,path:t}){let[n,r]=(0,P.useState)(!1);return n?(0,F.jsx)(ht,{path:t,className:`size-3.5 shrink-0`}):(0,F.jsx)(`img`,{src:ke(e,t),alt:``,"aria-hidden":!0,loading:`lazy`,decoding:`async`,onError:()=>r(!0),className:`size-3.5 shrink-0 rounded-[3px] object-cover ring-1 ring-black/5 dark:ring-white/10`})}function Ct({node:e,depth:t,selectedPath:n,gitStatuses:r,onSelectFile:i,onPreviewFile:a,projectId:o}){let[s,c]=(0,P.useState)(t<1),u=e.type===`directory`,d=n===e.path,f=xt(r[e.path]),p=(u?void 0:A(e.path))===`image`,m=!!o&&p,h=!!a&&(p||O(e.path));function g(){a?.(e.path)}return(0,F.jsxs)(`div`,{children:[(0,F.jsxs)(`button`,{type:`button`,className:`group flex h-7 w-full items-center gap-1.5 rounded-md px-2 text-left text-xs transition-colors ${d?`bg-muted/28 text-foreground/90`:`text-muted-foreground/72 hover:bg-muted/20 hover:text-foreground/85`}`,style:{paddingLeft:`${.5+t*.75}rem`},onClick:()=>{u?c(e=>!e):p&&a?g():i(e.path)},title:e.path,children:[u?(0,F.jsx)(l,{className:`size-3 shrink-0 transition-transform ${s?`rotate-90`:``}`}):(0,F.jsx)(`span`,{className:`w-3 shrink-0`}),u?(0,F.jsx)(gt,{name:e.name,open:s,className:`size-3.5 shrink-0`}):m?(0,F.jsx)(St,{projectId:o,path:e.path}):(0,F.jsx)(ht,{path:e.path,className:`size-3.5 shrink-0`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),f?(0,F.jsx)(`span`,{className:`shrink-0 font-mono text-[0.68rem] text-emerald-600 dark:text-emerald-500`,children:f}):null,h?(0,F.jsx)(`span`,{role:`button`,tabIndex:0,"aria-label":j(`openPreview`),title:j(`openPreview`),className:`-mr-1 shrink-0 rounded p-0.5 text-muted-foreground/60 opacity-0 transition-opacity hover:bg-muted/40 hover:text-foreground/85 focus-visible:opacity-100 focus-visible:text-foreground/85 focus-visible:outline-none group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),g()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),g())},children:(0,F.jsx)(se,{className:`size-3.5`})}):null]}),u&&s?(0,F.jsx)(`div`,{children:(e.children??[]).map(e=>(0,F.jsx)(Ct,{node:e,depth:t+1,selectedPath:n,gitStatuses:r,onSelectFile:i,onPreviewFile:a,projectId:o},e.path))}):null]})}function wt({tree:e,selectedPath:t,gitStatuses:n={},onSelectFile:r,onPreviewFile:i,projectId:a}){return e.length===0?(0,F.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground/70`,children:j(`workspaceNoFilesToDisplay`)}):(0,F.jsx)(`div`,{className:`space-y-0.5`,children:e.map(e=>(0,F.jsx)(Ct,{node:e,depth:0,selectedPath:t,gitStatuses:n,onSelectFile:r,onPreviewFile:i,projectId:a},e.path))})}function Tt(e,t,n){return!!(e&&t&&e.projectId===t&&e.id!==n)}var Et=`quickforge:workspace-inspector-tabs:v1:`;function Dt(e){return`${Et}${e}`}function Ot(e,t){return e===`browser`?`browser`:`${e}:${t}`}function kt(e){return e===`files`||e===`review`||e===`terminal`||e===`browser`||e===`reader`}function At(){try{return globalThis.localStorage}catch{return}}function jt(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let r of e){if(!r||typeof r!=`object`||Array.isArray(r))continue;let e=r;if(!(typeof e.id!=`string`||!e.id||!kt(e.kind))){if(e.kind===`review`){if(t.has(e.kind))continue;t.add(e.kind)}if(e.kind===`reader`){let t=e.reader;if(!t||t.mode!==`file`||typeof t.path!=`string`||!t.path)continue;let r=Ot(t.mode,t.path);n.push({id:e.id,kind:e.kind,readerTabs:[{id:r,mode:t.mode,path:t.path,loading:!0}],activeReaderTabId:r});continue}n.push({id:e.id,kind:e.kind,...e.kind===`browser`&&typeof e.url==`string`?{url:e.url}:{},...e.kind===`review`?{reviewView:e.reviewView===`review`?`review`:`changes`}:{},...e.kind===`terminal`&&typeof e.terminalSessionId==`string`?{terminalSessionId:e.terminalSessionId}:{},...e.kind===`files`||e.kind===`review`?{readerTabs:[],activeReaderTabId:void 0}:{}})}}return n}function Mt(e,t=At()){if(!t)return{tabs:[]};try{let n=t.getItem(Dt(e));if(!n)return{tabs:[]};let r=JSON.parse(n),i=jt(r?.tabs),a=typeof r?.activePanelTabId==`string`&&i.some(e=>e.id===r.activePanelTabId)?r.activePanelTabId:i[0]?.id;return a?{tabs:i,activePanelTabId:a}:{tabs:i}}catch{return{tabs:[]}}}function Nt(e,t){let n=e.flatMap(e=>{if(e.kind===`reader`){let t=e.readerTabs?.find(t=>t.id===e.activeReaderTabId)??e.readerTabs?.[0];return!t||t.mode!==`file`?[]:[{id:e.id,kind:e.kind,reader:{mode:t.mode,path:t.path}}]}return[{id:e.id,kind:e.kind,...e.kind===`browser`?{url:e.url||``}:{},...e.kind===`review`?{reviewView:e.reviewView||`changes`}:{},...e.kind===`terminal`&&e.terminalSessionId?{terminalSessionId:e.terminalSessionId}:{}}]});return{tabs:n,activePanelTabId:t&&n.some(e=>e.id===t)?t:n[0]?.id}}function Pt(e,t,n,r=At()){if(!r)return!1;try{return r.setItem(Dt(e),JSON.stringify(Nt(t,n))),!0}catch{return!1}}function Ft(e){return e.reduce((e,t)=>{let n=t.id.match(/-(\d+)$/);if(!n)return e;let r=Number(n[1]);return Number.isFinite(r)?Math.max(e,r):e},0)+1}function It(){let e,t=0;return{token:n=>(n!==e&&(e=n,t+=1),{projectId:n,epoch:t}),isCurrent:n=>n.projectId===e&&n.epoch===t,invalidate:()=>(t+=1,t)}}function Lt(){if(typeof window>`u`)return 0;let e=window.getComputedStyle(document.body).getPropertyValue(`--quickforge-desktop-titlebar-height`).trim();if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Rt(e,t){return e===`browser`?`browser`:`${e}:${t}`}var zt=[{kind:`files`,label:j(`rightPanelFiles`),description:j(`rightPanelFilesDesc`),icon:_},{kind:`review`,label:j(`rightPanelReview`),description:j(`rightPanelReviewDesc`),icon:fe},{kind:`terminal`,label:j(`rightPanelTerminal`),description:j(`rightPanelTerminalDesc`),icon:ne},{kind:`browser`,label:j(`rightPanelBrowser`),description:j(`rightPanelBrowserDesc`),icon:g}],Bt=[{value:`unstaged`,label:j(`workspaceReviewFilterUnstaged`)},{value:`staged`,label:j(`workspaceReviewFilterStaged`)},{value:`all`,label:j(`workspaceReviewFilterAllBranches`)},{value:`last`,label:j(`workspaceReviewFilterLastRun`)}],Vt=Object.fromEntries(zt.map(e=>[e.kind,e]));function Ht(e){return e===`review`?`changes`:e}function X(e){let t=e.trim();if(!t)return`about:blank`;try{let e=new URL(t);return e.protocol===`about:`?t:e.host||t}catch{return t.split(/[\\/]/).pop()||t}}function Ut(e,t){if(e.kind===`terminal`)return t||j(`rightPanelTerminal`);if(e.kind===`browser`)return X(e.url||``);if(e.kind===`reader`){let t=e.readerTabs?.find(t=>t.id===e.activeReaderTabId)??e.readerTabs?.[0];return t?je(t.path):j(`rightPanelFiles`)}return Vt[e.kind].label}var Wt=340,Z=380,Q=640,Gt=`quickforge_workspaceInspectorWidth_v2`,Kt=140,qt=200,Jt=400;function Yt(){if(typeof window>`u`)return Z;try{let e=window.localStorage.getItem(Gt);if(!e)return Z;let t=Number(e);return Number.isFinite(t)?Math.min(Q,Math.max(Wt,t)):Z}catch{return Z}}function Xt(e,t){let n=t.trim().toLowerCase();return n?e.flatMap(e=>{let t=e.children?Xt(e.children,n):void 0;return!(e.name.toLowerCase().includes(n)||e.path.toLowerCase().includes(n))&&(!t||t.length===0)?[]:[{...e,...t?{children:t}:{}}]}):e}function Zt(e,t){let n=e?.trim();if(!n)return``;let r=n.replace(/\\/g,`/`).replace(/^\.\/+/g,``),i=t?.trim().replace(/\\/g,`/`).replace(/\/+$/g,``);return i&&r.startsWith(`${i}/`)&&(r=r.slice(i.length+1)),r.replace(/^\/+/,``)}function Qt(e,t){let n=new Set;for(let r of e){let e=Zt(r.path,t),i=Zt(r.outputFile,t);e&&n.add(e),i&&n.add(i)}return n}function $t(e){return j(e===`staged`?`workspaceNoStagedChanges`:e===`last`?`workspaceNoLastRunChanges`:`workspaceNoWorkingTreeChanges`)}function en(e){return e?e.language===`markdown`||/\.(md|markdown)$/i.test(e.path):!1}function tn(e,t=!1){return j(t?`readerFileMarkdownPrompt`:`readerFilePrompt`,{path:e})}function $(e){return j(`readerDiffPrompt`,{path:e})}function nn(e){return`Diff for ${e.oldPath?`${e.oldPath} -> ${e.path}`:e.path}\n\n--- OLD\n${e.oldContent}\n\n--- NEW\n${e.newContent}`}function rn({mode:e,file:t,diff:n,loading:r,error:i,onClose:a,onDraftRequest:o}){let[s,c]=(0,P.useState)(),[l,d]=(0,P.useState)(`preview`);async function f(e,t){t&&(await navigator.clipboard.writeText(t),c(e),window.setTimeout(()=>c(void 0),1200))}let p=e===`file`?t?.path:n?.path,m=e===`file`&&en(t),h=e===`file`?t?.content:n?nn(n):void 0,g=e===`file`&&t?tn(t.path,m):e===`diff`&&n?$(n.path):void 0,_=(0,P.useMemo)(()=>e===`diff`&&n?B(n.oldContent,n.newContent):void 0,[e,n]);return(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,F.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-border px-3`,children:[m?(0,F.jsx)(`div`,{className:`inline-flex rounded-full bg-muted/25 p-1 text-xs`,children:[`preview`,`source`].map(e=>(0,F.jsx)(`button`,{type:`button`,className:e===l?`rounded-full bg-background px-3 py-1 font-medium text-foreground/90 shadow-[0_8px_20px_-16px_rgb(15_23_42_/_0.42)]`:`rounded-full px-3 py-1 text-muted-foreground/70 hover:text-foreground/85`,onClick:()=>d(e),children:j(e===`preview`?`markdownPreview`:`markdownSource`)},e))}):null,_?(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] font-medium`,children:[(0,F.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:[`+`,_.added]}),(0,F.jsxs)(`span`,{className:`ml-1.5 text-red-600 dark:text-red-400`,children:[`-`,_.removed]})]}):null,(0,F.jsx)(`div`,{className:`flex-1`}),(0,F.jsx)(D,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:()=>void f(`path`,p),disabled:!p,"aria-label":j(`copyPath`),title:j(`copyPath`),children:s===`path`?(0,F.jsx)(oe,{className:`size-3.5`}):(0,F.jsx)(ae,{className:`size-3.5`})}),(0,F.jsx)(D,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:()=>void f(`content`,h),disabled:!h,"aria-label":j(`copyContent`),title:j(e===`file`?`copyContent`:`copyDiffContent`),children:s===`content`?(0,F.jsx)(oe,{className:`size-3.5`}):(0,F.jsx)(ae,{className:`size-3.5`})}),(0,F.jsx)(D,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:()=>g&&o?.(g),disabled:!g||!o,"aria-label":j(`askAiAboutThis`),title:j(`askAiAboutThis`),children:(0,F.jsx)(u,{className:`size-3.5`})}),(0,F.jsx)(D,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:a,"aria-label":j(`close`),title:j(`close`),children:(0,F.jsx)(le,{className:`size-3.5`})})]}),(0,F.jsxs)(`div`,{className:`min-h-0 flex-1 bg-background`,children:[r?(0,F.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground/70`,children:j(`openingReader`)}):null,!r&&i?(0,F.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:i}):null,!r&&!i&&e===`file`&&t?m?(0,F.jsx)(et,{path:t.path,content:t.content,language:t.language,mode:l},t.path):(0,F.jsx)(I,{path:t.path,content:t.content,language:t.language}):null,!r&&!i&&e===`diff`&&n?(0,F.jsx)(tt,{path:n.path,oldContent:n.oldContent,newContent:n.newContent,language:n.language,status:n.status}):null]})]})}function an({project:e,artifacts:t,changesCount:r,changedPaths:i,isGitRepository:a,gitBranch:o,onSelectFile:s,onSelectDiff:c,onPreviewFile:l}){let[u,d]=(0,P.useState)(!1),[f,p]=(0,P.useState)(()=>new Set),m=E(t),h=t.filter(e=>e.command);function g(e){p(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,F.jsxs)(`div`,{className:`space-y-3 p-2`,children:[(0,F.jsxs)(`div`,{className:`rounded-lg border border-border bg-background px-3 py-3`,children:[(0,F.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-foreground/90`,children:[(0,F.jsx)(y,{className:`size-3.5 text-emerald-600 dark:text-emerald-500`}),j(`workspaceCurrentArtifacts`)]}),t.length===0?(0,F.jsx)(`div`,{className:`mt-2 text-xs leading-5 text-muted-foreground/70`,children:j(`workspaceNoArtifacts`)}):(0,F.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[m.length?(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsxs)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60`,children:[j(`workspaceFiles`),` `,m.length]}),m.slice(0,8).map(e=>{let t=e.path,n=M(t),r=i.has(t),a=typeof e.addedLines==`number`||typeof e.removedLines==`number`;return(0,F.jsxs)(`div`,{className:`group flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-xs text-foreground/85 transition-colors hover:bg-muted/20`,children:[(0,F.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 truncate text-left font-medium`,onClick:()=>n?l(t):r?c(t):s(t),title:t,children:e.title||je(t)}),a?(0,F.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] font-medium`,children:[(0,F.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:[`+`,e.addedLines??0]}),(0,F.jsxs)(`span`,{className:`ml-1 text-red-600 dark:text-red-400`,children:[`-`,e.removedLines??0]})]}):null,(0,F.jsx)(`span`,{className:`shrink-0 rounded-full bg-muted/30 px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground/70`,children:e.kind}),n?(0,F.jsx)(`button`,{type:`button`,className:`shrink-0 inline-flex size-5 items-center justify-center text-blue-600 opacity-0 transition-opacity hover:bg-blue-500/10 hover:text-blue-700 group-hover:opacity-100 dark:text-blue-400`,onClick:()=>l(t),"aria-label":j(`previewArtifact`),title:j(`previewArtifact`),children:(0,F.jsx)(se,{className:`size-3.5`})}):null,(0,F.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground/70 opacity-0 transition-opacity hover:bg-muted/25 group-hover:opacity-100`,onClick:()=>r?c(t):s(t),children:j(r?`workspaceViewDiff`:`artifactPreviewViewSource`)})]},e.id)}),m.length>8?(0,F.jsxs)(`div`,{className:`px-2 text-[11px] text-muted-foreground/60`,children:[`+`,m.length-8]}):null]}):null,h.length?(0,F.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-1 py-1 text-left text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60 transition-colors hover:bg-muted/15 hover:text-foreground/75`,onClick:()=>d(e=>!e),"aria-expanded":u,children:[(0,F.jsx)(n,{className:k(`size-3.5 transition-transform`,u?``:`-rotate-90`)}),(0,F.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[j(`workspaceCommands`),` `,h.length]})]}),u?(0,F.jsx)(`div`,{className:`space-y-1`,children:h.map((e,t)=>{let r=f.has(e.id);return(0,F.jsxs)(`div`,{className:`rounded-md bg-muted/15 text-[11px] text-muted-foreground/80`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-2 py-1.5 text-left transition-colors hover:bg-muted/20`,onClick:()=>g(e.id),"aria-expanded":r,children:[(0,F.jsx)(n,{className:k(`size-3 shrink-0 transition-transform`,r?``:`-rotate-90`)}),(0,F.jsxs)(`span`,{className:`shrink-0 font-medium text-muted-foreground/65`,children:[`#`,t+1]}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.command})]}),r?(0,F.jsxs)(`div`,{className:`space-y-1 px-2 pb-2 pt-1.5`,children:[(0,F.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[11px] leading-5 text-foreground/80`,children:e.command}),e.outputFile?(0,F.jsxs)(`div`,{className:`text-[10px] text-muted-foreground/65`,children:[j(`workspaceCommandOutput`),`: `,(0,F.jsx)(`span`,{className:`font-mono`,children:e.outputFile})]}):null]}):null]},e.id)})}):null]}):null]})]}),(0,F.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/10 px-3 py-3`,children:[(0,F.jsx)(`div`,{className:`text-xs font-medium text-foreground/85`,children:e?.name??j(`noProjectSelected`)}),(0,F.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/65`,children:a?`${j(`workspaceCurrentBranch`)}: ${o||j(`unknown`)} · ${r} ${j(`workspaceChangeCount`)}`:j(`workspaceNotGitRepository`)})]})]})}function on({project:e,open:t,onOpenChange:r,onPreviewArtifact:o,onDraftRequest:s,request:l,onRequestHandled:u,artifacts:d=[],pendingTerminalCommand:p,onPendingTerminalCommandHandled:m}){let[h,g]=(0,P.useState)([]),[_,v]=(0,P.useState)([]),[b,te]=(0,P.useState)(),[ne,re]=(0,P.useState)(!1),[x,ie]=(0,P.useState)(!1),[S,ae]=(0,P.useState)(),[se,ce]=(0,P.useState)(``),[C,ue]=(0,P.useState)(`unstaged`),[w,de]=(0,P.useState)(),[fe,pe]=(0,P.useState)(),[me,he]=(0,P.useState)(!1),[ge,_e]=(0,P.useState)(),ye=(0,P.useRef)(void 0);ye.current||=e?.id?Mt(e.id):{tabs:[]};let[T,xe]=(0,P.useState)(()=>ye.current?.tabs??[]),[E,O]=(0,P.useState)(()=>ye.current?.activePanelTabId),[A,ke]=(0,P.useState)(!1),[M,je]=(0,P.useState)(!1),[N,Fe]=(0,P.useState)(!1),[Ie,Re]=(0,P.useState)(),[ze,Be]=(0,P.useState)(qt),[Ve,He]=(0,P.useState)(!1),[Ue,We]=(0,P.useState)(t),[Ke,qe]=(0,P.useState)(!1),[I,Je]=(0,P.useState)(Yt),[L,Ye]=(0,P.useState)(!1),[R,Xe]=(0,P.useState)(!1),[Ze,Qe]=(0,P.useState)(!1),z=(0,P.useRef)(null),$e=(0,P.useRef)(null),et=(0,P.useRef)(null),tt=(0,P.useRef)(null),B=(0,P.useRef)(null),V=(0,P.useRef)(null),nt=(0,P.useRef)(null),H=(0,P.useRef)(null),U=(0,P.useRef)(null),rt=(0,P.useRef)(null),it=(0,P.useRef)(Ft(ye.current?.tabs??[])),at=(0,P.useRef)(void 0),ot=(0,P.useRef)(void 0),st=(0,P.useRef)(void 0),W=(0,P.useRef)(It()),ct=(0,P.useRef)(new Set),G=(0,P.useRef)(0);(0,P.useEffect)(()=>{let e=W.current;return()=>{e.invalidate()}},[]);let K=e?.id;K&&W.current.token(K);let q=(0,P.useMemo)(()=>T.find(e=>e.id===E),[E,T]),lt=q?.activeReaderTabId,ut=(0,P.useMemo)(()=>q?.readerTabs||[],[q?.readerTabs]),J=(0,P.useMemo)(()=>ut.find(e=>e.id===lt),[lt,ut]),dt=!!(J&&J.mode!==`browser`&&(q?.kind===`reader`||q?.kind===`files`||q?.kind===`review`&&J.mode===`diff`)),ft=q?.kind===`review`?q.reviewView===`review`?`overview`:`changes`:`files`,pt=(0,P.useMemo)(()=>{let e={};for(let t of _)e[t.path]=t;return e},[_]),mt=(0,P.useMemo)(()=>{let e=new Set;for(let t of _)e.add(t.path),t.oldPath&&e.add(t.oldPath);return e},[_]),ht=(0,P.useMemo)(()=>Xt(h,se),[se,h]),gt=(0,P.useMemo)(()=>Qt(d,e?.path),[d,e?.path]),_t=(0,P.useMemo)(()=>C===`staged`?_.filter(e=>e.staged):C===`all`?_:C===`last`?_.filter(e=>gt.has(e.path)||(e.oldPath?gt.has(e.oldPath):!1)):_.filter(e=>e.unstaged||e.status===`untracked`||e.conflict||e.status===`conflicted`),[_,gt,C]);function vt(e){v(e.files),te(e.branch),re(e.isGitRepository)}async function Y(e,t,n,r){Re({action:e,path:t});try{vt(await n())}catch(e){await be(e instanceof Error?e.message:r)}finally{Re(void 0)}}async function yt(e){K&&await Y(`stage`,e.path,()=>Ce(K,e.path),j(`workspaceStageFailed`))}async function xt(){K&&await Y(`stage`,void 0,()=>Ee(K),j(`workspaceStageFailed`))}async function St(e){K&&await Y(`unstage`,e.path,()=>Pe(K,e.path),j(`workspaceUnstageFailed`))}async function Ct(){K&&await Y(`unstage`,void 0,()=>Ne(K),j(`workspaceUnstageFailed`))}async function Et(e){K&&await Se({title:j(`workspaceRestoreConfirmTitle`),description:j(`workspaceRestoreFileConfirm`,{path:e.path}),confirmLabel:j(`workspaceRestoreFile`),cancelLabel:j(`cancel`),variant:`destructive`})&&await Y(`restore`,e.path,()=>De(K,e.path),j(`workspaceRestoreFailed`))}async function Dt(){K&&await Se({title:j(`workspaceRestoreConfirmTitle`),description:j(`workspaceRestoreAllConfirm`),confirmLabel:j(`workspaceRestoreAll`),cancelLabel:j(`cancel`),variant:`destructive`})&&await Y(`restore`,void 0,()=>Oe(K),j(`workspaceRestoreFailed`))}function Ot(e){e.status!==`deleted`&&$(e.path)}(0,P.useEffect)(()=>{!w||_t.some(e=>e.path===w)||(de(void 0),pe(void 0),_e(void 0),he(!1))},[w,_t]),(0,P.useEffect)(()=>{if(t){let e=!1;return queueMicrotask(()=>{e||(We(!0),window.requestAnimationFrame(()=>{e||qe(!0)}))}),()=>{e=!0}}let e=!1;queueMicrotask(()=>{e||qe(!1)});let n=window.setTimeout(()=>We(!1),180);return()=>{e=!0,window.clearTimeout(n)}},[t]),(0,P.useEffect)(()=>{if(!A&&!M&&!N)return;let e=e=>{let t=e.target;A&&!$e.current?.contains(t)&&ke(!1),M&&!et.current?.contains(t)&&je(!1),N&&!tt.current?.contains(t)&&Fe(!1)},t=e=>{e.key===`Escape`&&(ke(!1),je(!1),Fe(!1))};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[A,N,M]),(0,P.useEffect)(()=>{!t||!Tt(l,K,st.current)||(st.current=l.id,l.kind===`review`?at.current?.(`review`,l.view):l.kind===`reader`?ot.current?.(l.path):l.kind===`browser`?at.current?.(`browser`,`browser`,{url:l.url}):at.current?.(l.kind,Ht(l.kind)),u?.(l.id))},[u,t,K,l]),(0,P.useEffect)(()=>{try{window.localStorage.setItem(Gt,String(I))}catch{}},[I]);let kt=(0,P.useCallback)(()=>{Je(e=>e<Q?Q:e)},[]);(0,P.useEffect)(()=>{!Ke||R||(q?.kind===`browser`||q?.kind===`terminal`||lt)&&kt()},[q?.kind,lt,Ke,R,kt]);let At=(0,P.useCallback)(async e=>{if(K){ie(!0),ae(void 0);try{let[t,n]=await Promise.all([Ae(K),we(K)]);if(e?.())return;g(t.tree),v(n.files),te(n.branch),re(n.isGitRepository)}catch(t){e?.()||ae(t instanceof Error?t.message:j(`workspaceLoadFailed`))}finally{e?.()||ie(!1)}}},[K]);(0,P.useEffect)(()=>{let e=!1;if(!(!K||!t))return queueMicrotask(()=>{e||At(()=>e)}),()=>{e=!0}},[At,t,K]),(0,P.useEffect)(()=>{K&&Pt(K,T,E)},[E,T,K]),(0,P.useEffect)(()=>{!E||T.some(e=>e.id===E)||O(T[0]?.id)},[E,T]),(0,P.useEffect)(()=>{if(!K)return;let e=T.flatMap(e=>e.kind===`reader`?(e.readerTabs||[]).filter(e=>e.loading&&e.mode===`file`).map(t=>({panelTabId:e.id,reader:t})):[]);for(let{panelTabId:t,reader:n}of e){let e=`${K}:${n.id}`;if(ct.current.has(e))continue;ct.current.add(e);let r=W.current.token(K);Te(K,n.path).then(e=>({file:e})).then(e=>{W.current.isCurrent(r)&&X(t,t=>({...t,readerTabs:(t.readerTabs||[]).map(t=>t.id===n.id?{...t,...e,loading:!1,error:void 0}:t)}))}).catch(e=>{W.current.isCurrent(r)&&X(t,t=>({...t,readerTabs:(t.readerTabs||[]).map(t=>t.id===n.id?{...t,loading:!1,error:e instanceof Error?e.message:j(`workspaceOpenFileFailed`)}:t)}))}).finally(()=>{ct.current.delete(e)})}},[T,K]);function jt(e,t){let n=`${e}-${it.current++}`;return e===`browser`?{id:n,kind:e,url:t?.url||``}:e===`reader`?{id:n,kind:e,readerTabs:t?.readerTab?[t.readerTab]:[],activeReaderTabId:t?.readerTab?.id}:e===`files`||e===`review`?{id:n,kind:e,...e===`review`?{reviewView:t?.reviewView||`changes`}:{},readerTabs:t?.readerTab?[t.readerTab]:[],activeReaderTabId:t?.readerTab?.id}:{id:n,kind:e}}function Nt(e){return jt(`reader`,{readerTab:e})}function X(e,t){xe(n=>n.map(n=>n.id===e?t(n):n))}function Z(e,t=Ht(e),n){let r=e===`review`?T.find(e=>e.kind===`review`):void 0,i=r||jt(e,{...n,...e===`review`?{reviewView:t===`review`?`review`:`changes`}:{}});return r||xe(e=>[...e,i]),r?.kind===`review`&&X(r.id,e=>({...e,reviewView:t===`review`?`review`:`changes`})),O(i.id),ke(!1),i}at.current=Z;function Zt(e){O(e.id)}function en(e){xe(t=>{let n=t.findIndex(t=>t.id===e),i=t.filter(t=>t.id!==e);return i.length===0?(O(void 0),r(!1),i):(E===e&&O((i[n]??i[n-1])?.id),i)})}function tn(e){if(o&&K){o(K,e);return}$(e)}async function $(e){if(!K)return;let t=W.current.token(K),n=Rt(`file`,e),r=T.find(e=>e.kind===`reader`&&e.readerTabs?.some(e=>e.id===n));if(r){O(r.id),X(r.id,e=>({...e,activeReaderTabId:n}));return}let i=Nt({id:n,mode:`file`,path:e,loading:!0});xe(e=>[...e,i]),O(i.id);try{let r=await Te(K,e);if(!W.current.isCurrent(t))return;X(i.id,e=>({...e,readerTabs:(e.readerTabs||[]).map(e=>e.id===n?{...e,file:r,loading:!1,error:void 0}:e)}))}catch(e){if(!W.current.isCurrent(t))return;X(i.id,t=>({...t,readerTabs:(t.readerTabs||[]).map(t=>t.id===n?{...t,loading:!1,error:e instanceof Error?e.message:j(`workspaceOpenFileFailed`)}:t)}))}}ot.current=$;async function nn(e,t){if(!K)return;let n=W.current.token(K),r=T.find(e=>e.kind===`review`)||Z(`review`,t?`changes`:`review`);O(r.id),t&&r.kind===`review`&&X(r.id,e=>({...e,reviewView:`changes`}));let i=Rt(`diff`,e);if(r.readerTabs?.some(e=>e.id===i)){X(r.id,e=>({...e,activeReaderTabId:i}));return}let a={id:i,mode:`diff`,path:e,loading:!0};X(r.id,e=>({...e,readerTabs:[...e.readerTabs||[],a],activeReaderTabId:i}));try{let t=await Me(K,e);if(!W.current.isCurrent(n))return;X(r.id,e=>({...e,readerTabs:(e.readerTabs||[]).map(e=>e.id===i?{...e,diff:t,loading:!1,error:void 0}:e)}))}catch(e){if(!W.current.isCurrent(n))return;X(r.id,t=>({...t,readerTabs:(t.readerTabs||[]).map(t=>t.id===i?{...t,loading:!1,error:e instanceof Error?e.message:j(`workspaceOpenDiffFailed`)}:t)}))}}async function on(e){if(!K)return;let t=W.current.token(K);if(w===e){G.current+=1,de(void 0),pe(void 0),_e(void 0),he(!1);return}let n=G.current+1;G.current=n,de(e),pe(void 0),_e(void 0),he(!0);try{let r=await Me(K,e);if(G.current!==n||!W.current.isCurrent(t))return;pe(r)}catch(e){if(G.current!==n||!W.current.isCurrent(t))return;_e(e instanceof Error?e.message:j(`workspaceOpenDiffFailed`))}finally{G.current===n&&W.current.isCurrent(t)&&he(!1)}}function sn(e){q&&X(q.id,t=>{let n=t.readerTabs||[],r=n.findIndex(t=>t.id===e),i=n.filter(t=>t.id!==e),a=t.activeReaderTabId===e?(i[r]??i[r-1])?.id:t.activeReaderTabId;return{...t,readerTabs:i,activeReaderTabId:a}})}async function cn(e){await nn(e,!1)}function ln(e){nt.current={startX:e.clientX,startWidth:I,currentWidth:I},rt.current={cursor:document.body.style.cursor,userSelect:document.body.style.userSelect},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,Ye(!0),e.preventDefault();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}function un(e){let t=nt.current,n=z.current;!t||!n||(t.currentWidth=Math.min(Q,Math.max(Wt,t.startWidth+t.startX-e.clientX)),H.current===null&&(H.current=window.requestAnimationFrame(()=>{H.current=null;let e=nt.current;!e||!z.current||(z.current.style.width=`${e.currentWidth}px`)})))}function dn(e){let t=nt.current?.currentWidth;nt.current=null,H.current!==null&&(window.cancelAnimationFrame(H.current),H.current=null),typeof t==`number`&&(z.current&&(z.current.style.width=`${t}px`),Je(t));let n=rt.current;n&&(document.body.style.cursor=n.cursor,document.body.style.userSelect=n.userSelect,rt.current=null),Ye(!1);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}function fn(e){B.current={startX:e.clientX,startWidth:ze,currentWidth:ze},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,He(!0),e.preventDefault();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}function pn(e){let t=B.current;t&&(t.currentWidth=Math.min(Jt,Math.max(Kt,t.startWidth+e.clientX-t.startX)),V.current===null&&(V.current=window.requestAnimationFrame(()=>{V.current=null;let e=B.current;e&&Be(e.currentWidth)})))}function mn(e){let t=B.current?.currentWidth;B.current=null,V.current!==null&&(window.cancelAnimationFrame(V.current),V.current=null),typeof t==`number`&&Be(t),document.body.style.cursor=``,document.body.style.userSelect=``,He(!1);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}let hn=(0,P.useCallback)(()=>{let e=z.current;if(!e){Xe(e=>!e);return}U.current?.cancel();let t=e.getBoundingClientRect(),n=window.innerWidth,r=Lt(),i=window.innerHeight-r,a=`${r}px`,o=`${i}px`,s=`cubic-bezier(0.22, 1, 0.36, 1)`;if(Qe(!0),!R){window.requestAnimationFrame(()=>{let e=z.current;if(!e)return;Object.assign(e.style,{position:`fixed`,left:`${t.left}px`,top:`${t.top}px`,right:`auto`,bottom:`auto`,width:`${t.width}px`,height:`${t.height}px`,minWidth:`0px`,maxWidth:`none`,zIndex:`40`});let r=e.animate([{left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`},{left:`0px`,top:a,width:`${n}px`,height:o}],{duration:240,easing:s,fill:`forwards`});U.current=r,r.onfinish=()=>{U.current=null,Xe(!0),window.requestAnimationFrame(()=>{r.cancel(),e.removeAttribute(`style`),window.requestAnimationFrame(()=>Qe(!1))})},r.oncancel=()=>{U.current=null,Qe(!1)}});return}window.requestAnimationFrame(()=>{let e=z.current;if(!e)return;Object.assign(e.style,{position:`fixed`,left:`0px`,top:a,right:`auto`,bottom:`auto`,width:`${t.width}px`,height:o,zIndex:`40`});let r=n-I,i=e.animate([{left:`0px`,top:a,width:`${t.width}px`,height:o},{left:`${r}px`,top:a,width:`${I}px`,height:o}],{duration:240,easing:s,fill:`forwards`});U.current=i,i.onfinish=()=>{U.current=null,Xe(!1),window.requestAnimationFrame(()=>{i.cancel(),e.style.position=``,e.style.left=``,e.style.top=``,e.style.right=``,e.style.bottom=``,e.style.height=``,e.style.zIndex=``,e.style.width=`${I}px`,e.style.minWidth=`${Wt}px`,e.style.maxWidth=`${Q}px`,window.requestAnimationFrame(()=>Qe(!1))})},i.oncancel=()=>{U.current=null,Qe(!1)}})},[R,I]);return(0,P.useEffect)(()=>{if(!R)return;let e=e=>{e.key===`Escape`&&Xe(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[R]),(0,P.useEffect)(()=>()=>{H.current!==null&&window.cancelAnimationFrame(H.current),V.current!==null&&window.cancelAnimationFrame(V.current),U.current?.cancel(),z.current&&z.current.removeAttribute(`style`);let e=rt.current;e&&(document.body.style.cursor=e.cursor,document.body.style.userSelect=e.userSelect)},[]),Ue?(0,F.jsx)(F.Fragment,{children:(0,F.jsxs)(`aside`,{ref:z,className:k(`relative hidden shrink-0 overflow-hidden flex-col bg-background transition-[width,min-width,max-width,opacity,transform] duration-200 ease-out will-change-[width,opacity,transform] lg:flex`,Ke?`translate-x-0 opacity-100`:`w-0 min-w-0 max-w-0 translate-x-4 opacity-0`,L?`transition-none`:``,R?`quickforge-workspace-inspector-fullscreen z-40 rounded-none border-l-0`:`lg:rounded-l-2xl`),style:Ke?R?void 0:{width:I,minWidth:Wt,maxWidth:Q}:void 0,children:[Ke&&!R?(0,F.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":Wt,"aria-valuemax":Q,"aria-valuenow":I,className:k(`group absolute inset-y-0 -left-2 z-20 flex w-4 cursor-col-resize items-center justify-center bg-transparent transition-colors hover:bg-border/40`,L?`bg-border/45`:``),onPointerDown:ln,onPointerMove:un,onPointerUp:dn,onPointerCancel:dn,children:(0,F.jsx)(`div`,{className:k(`flex h-10 w-3 items-center justify-center rounded-full border border-border bg-background text-muted-foreground/60 opacity-0 shadow-sm transition-opacity`,L?`opacity-100`:`group-hover:opacity-100`),children:(0,F.jsx)(a,{className:`size-3`})})}):null,(0,F.jsxs)(`div`,{className:k(`flex h-14 shrink-0 items-center gap-2 border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-background px-3 pr-20 transition-opacity duration-150`,Ze?`opacity-0`:`opacity-100`),children:[T.length>0?(0,F.jsxs)(`div`,{ref:et,className:`relative shrink-0`,children:[(0,F.jsx)(`button`,{type:`button`,className:`flex size-9 items-center justify-center rounded-2xl bg-transparent text-muted-foreground/85 transition-colors hover:bg-muted/45 hover:text-foreground/90`,onClick:()=>je(e=>!e),"aria-label":j(`rightPanelOpenTabsTitle`),title:j(`rightPanelOpenTabsTitle`),"aria-haspopup":`menu`,"aria-expanded":M,children:(0,F.jsx)(n,{className:k(`size-4 transition-transform`,M&&`rotate-180`)})}),M?(0,F.jsx)(`div`,{className:`absolute left-0 top-12 z-40 w-72 max-w-[calc(100vw-2rem)] rounded-2xl border border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-popover p-2 shadow-quickforge`,role:`menu`,children:T.map(t=>{let n=(t.kind===`reader`?void 0:Vt[t.kind])?.icon??y,r=t.id===E,i=Ut(t,e?.name);return(0,F.jsxs)(`div`,{className:k(`group flex h-10 w-full items-center gap-2 rounded-xl px-2 transition-colors`,r?`bg-muted/55 text-foreground`:`text-foreground/86 hover:bg-muted/34 hover:text-foreground`),role:`none`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`flex min-w-0 flex-1 items-center gap-2 text-left text-sm font-medium`,onClick:()=>{Zt(t),je(!1)},role:`menuitem`,title:i,children:[(0,F.jsx)(n,{className:`size-4 shrink-0 text-muted-foreground/80`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:i})]}),(0,F.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-full text-muted-foreground/70 opacity-70 transition-colors hover:bg-destructive/10 hover:text-destructive group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),en(t.id)},"aria-label":j(`close`),children:(0,F.jsx)(le,{className:`size-3.5`})})]},t.id)})}):null]}):null,(0,F.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-hidden`,children:[T.map((t,n)=>{let r=(t.kind===`reader`?void 0:Vt[t.kind])?.icon??y,i=t.id===E,a=Ut(t,e?.name);return(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[n>0?(0,F.jsx)(`span`,{"aria-hidden":`true`,className:`mx-0.5 h-3.5 w-px bg-[color-mix(in_oklab,var(--muted-foreground)_18%,transparent)]`}):null,(0,F.jsxs)(`button`,{type:`button`,className:k(`group flex h-10 max-w-40 items-center gap-2 rounded-2xl px-3 text-[13px] font-medium transition-colors`,i?`bg-[color-mix(in_oklab,var(--muted)_86%,transparent)] text-foreground/82 hover:bg-[color-mix(in_oklab,var(--muted)_86%,transparent)]`:`text-muted-foreground/45 hover:bg-[color-mix(in_oklab,var(--muted)_72%,transparent)] hover:text-muted-foreground/72`),onClick:()=>Zt(t),title:a,children:[(0,F.jsx)(r,{className:k(`size-4 shrink-0`,i?`text-foreground/74`:`text-muted-foreground/45 group-hover:text-muted-foreground/72`)}),(0,F.jsx)(`span`,{className:`min-w-0 truncate`,children:a}),(0,F.jsx)(`span`,{role:`button`,tabIndex:0,className:k(`ml-0.5 inline-flex size-5 shrink-0 items-center justify-center rounded-full opacity-0 transition-all hover:bg-black hover:text-white group-hover:opacity-100`,i&&`opacity-100`),onClick:e=>{e.stopPropagation(),en(t.id)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),en(t.id))},"aria-label":j(`close`),children:(0,F.jsx)(le,{className:`size-3.5`})})]})]},t.id)}),T.length===0?(0,F.jsx)(`div`,{className:`min-w-0 flex-1`}):null]}),T.length>0?(0,F.jsxs)(`div`,{ref:$e,className:`relative shrink-0`,children:[(0,F.jsx)(`button`,{type:`button`,className:`flex size-9 items-center justify-center rounded-2xl bg-transparent text-muted-foreground/85 transition-colors hover:bg-muted/45 hover:text-foreground/90`,onClick:()=>ke(e=>!e),"aria-label":j(`rightPanelAddTab`),title:j(`rightPanelAddTab`),"aria-haspopup":`menu`,"aria-expanded":A,children:(0,F.jsx)(i,{className:`size-4 stroke-[1.9]`})}),A?(0,F.jsx)(`div`,{className:`absolute right-0 top-12 z-40 w-64 rounded-2xl border border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-popover p-2 shadow-quickforge`,role:`menu`,children:zt.map(e=>{let t=e.icon;return(0,F.jsxs)(`button`,{type:`button`,className:k(`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-[15px] font-medium transition-colors`,e.kind===q?.kind?`bg-muted/55 text-foreground`:`text-foreground/86 hover:bg-muted/34 hover:text-foreground`),onClick:()=>Z(e.kind,Ht(e.kind)),role:`menuitem`,children:[(0,F.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground/80`}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label})]},e.kind)})}):null]}):null,(0,F.jsx)(D,{variant:`ghost`,size:`icon`,className:`shrink-0`,onClick:hn,"aria-label":j(R?`workspaceExitFullscreen`:`workspaceFullscreen`),title:j(R?`workspaceExitFullscreen`:`workspaceFullscreen`),children:R?(0,F.jsx)(c,{className:`size-4`}):(0,F.jsx)(f,{className:`size-4`})})]}),(0,F.jsx)(`div`,{className:k(`flex min-h-0 flex-1 transition-opacity duration-150`,Ze?`opacity-0`:`opacity-100`),children:e?.id?q?q.kind===`browser`?(0,F.jsx)(Ge,{url:q.url||``,onUrlChange:e=>{X(q.id,t=>({...t,url:e}))},projectId:e.id}):q.kind===`terminal`?(0,F.jsx)(Le,{project:e,pendingCommand:p,onPendingCommandHandled:m,onCollapse:()=>en(q.id),variant:`panel`,singleSession:!0,panelInstanceId:q.id,panelSessionId:q.terminalSessionId,onPanelSessionReady:e=>X(q.id,t=>({...t,terminalSessionId:e}))},q.id):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{className:k(`flex min-h-0 flex-col bg-muted/20`,dt?`shrink-0 border-r-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)]`:`flex-1`),style:dt?{width:ze,minWidth:Kt,maxWidth:Jt}:void 0,children:S?(0,F.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:S}):(0,F.jsxs)(`div`,{className:k(`min-h-0 flex-1 p-2`,ft===`changes`?`flex flex-col overflow-hidden`:`overflow-auto`),children:[x?(0,F.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground/70`,children:j(`workspaceLoading`)}):null,!x&&ft===`overview`?(0,F.jsx)(an,{project:e,artifacts:d,changesCount:_.length,changedPaths:mt,isGitRepository:ne,gitBranch:b,onSelectFile:$,onSelectDiff:cn,onPreviewFile:tn}):null,!x&&ft===`files`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`label`,{className:`mb-2 flex items-center gap-2 rounded-md border-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-background px-2 py-1.5 text-xs text-muted-foreground/65 focus-within:text-foreground/85`,children:[(0,F.jsx)(ee,{className:`size-3.5 shrink-0`}),(0,F.jsx)(`input`,{value:se,onChange:e=>ce(e.target.value),placeholder:j(`workspaceFilterFiles`),className:`min-w-0 flex-1 bg-transparent text-xs text-foreground/85 outline-none placeholder:text-muted-foreground/50`})]}),(0,F.jsx)(wt,{tree:ht,selectedPath:J?.mode===`file`?J.path:void 0,gitStatuses:pt,onSelectFile:$,onPreviewFile:tn,projectId:K})]}):null,!x&&ft===`changes`?ne?(0,F.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,F.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 px-2 pb-2`,children:[(0,F.jsxs)(`div`,{ref:tt,className:`relative min-w-0`,children:[(0,F.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 min-w-32 items-center gap-2 rounded-xl border border-[color-mix(in_oklab,var(--border)_45%,transparent)] bg-background px-3 text-sm font-medium text-foreground/86 transition-colors hover:border-border/60 hover:bg-muted/30 hover:text-foreground`,onClick:()=>Fe(e=>!e),"aria-haspopup":`menu`,"aria-expanded":N,title:j(`workspaceReviewFilter`),children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:Bt.find(e=>e.value===C)?.label}),(0,F.jsx)(n,{className:k(`size-3.5 shrink-0 text-muted-foreground/70 transition-transform`,N&&`rotate-180`)})]}),N?(0,F.jsx)(`div`,{className:`absolute left-0 top-10 z-40 w-48 rounded-2xl border border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-popover p-1.5 shadow-quickforge`,role:`menu`,"aria-label":j(`workspaceReviewFilter`),children:Bt.map(e=>{let t=e.value===C;return(0,F.jsxs)(`button`,{type:`button`,className:k(`flex h-9 w-full items-center gap-2 rounded-xl px-2.5 text-left text-sm font-medium transition-colors`,t?`bg-muted/55 text-foreground`:`text-foreground/82 hover:bg-muted/34 hover:text-foreground`),onClick:()=>{ue(e.value),Fe(!1)},role:`menuitemradio`,"aria-checked":t,children:[(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),t?(0,F.jsx)(oe,{className:`size-3.5 shrink-0 text-muted-foreground/80`}):null]},e.value)})}):null]}),(0,F.jsxs)(`button`,{type:`button`,className:`inline-flex h-8 shrink-0 items-center gap-1.5 rounded-xl px-2.5 text-sm font-medium text-muted-foreground/72 transition-colors hover:bg-muted/30 hover:text-foreground/85 disabled:cursor-not-allowed disabled:opacity-60`,onClick:()=>void At(),disabled:x,"aria-label":j(`refreshWorkspace`),title:j(`refreshWorkspace`),children:[(0,F.jsx)(ve,{className:k(`size-3.5`,x&&`animate-spin`)}),(0,F.jsx)(`span`,{children:j(`refresh`)})]})]}),(0,F.jsx)(bt,{files:_t,selectedPath:w,expandedDiff:fe,expandedLoading:me,expandedError:ge,onSelectFile:on,onRestoreFile:Et,onStageFile:yt,onUnstageFile:St,onOpenFile:Ot,onRestoreAll:Dt,onStageAll:xt,onUnstageAll:Ct,showUnstageAll:C===`staged`,pendingAction:Ie,emptyMessage:$t(C)})]}):(0,F.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground/70`,children:j(`workspaceNotGitRepository`)}):null]})}),dt?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":Kt,"aria-valuemax":Jt,"aria-valuenow":ze,className:k(`group relative z-10 w-1.5 shrink-0 cursor-col-resize bg-transparent transition-colors`,Ve?`bg-primary/30`:`hover:bg-[color-mix(in_oklab,var(--border)_52%,transparent)]`),onPointerDown:fn,onPointerMove:pn,onPointerUp:mn,onPointerCancel:mn}),(0,F.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col bg-background`,children:J?(0,F.jsx)(rn,{mode:J.mode,file:J.file,diff:J.diff,loading:J.loading,error:J.error,onClose:()=>q.kind===`reader`?en(q.id):sn(J.id),onDraftRequest:s}):null})]}):null]}):(0,F.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center px-5`,children:(0,F.jsxs)(`div`,{className:`w-full max-w-[26rem] space-y-4`,children:[(0,F.jsxs)(`div`,{className:`text-center font-sans`,children:[(0,F.jsx)(`div`,{className:`text-lg font-semibold leading-tight tracking-[-0.01em] text-foreground/90`,children:j(`rightPanelOpenTabsTitle`)}),(0,F.jsx)(`div`,{className:`mt-2 text-sm leading-5 text-muted-foreground/70`,children:j(`rightPanelOpenTabsDescription`)})]}),(0,F.jsx)(`div`,{className:`space-y-2`,children:zt.map(e=>{let t=e.icon;return(0,F.jsxs)(`button`,{type:`button`,className:`flex w-full cursor-pointer items-center gap-3 rounded-xl border border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-muted/60 px-4 py-3 text-left transition-colors hover:bg-muted/72 active:bg-muted/82`,onClick:()=>Z(e.kind,Ht(e.kind)),children:[(0,F.jsx)(t,{className:`size-4 shrink-0 text-muted-foreground/78`}),(0,F.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,F.jsx)(`div`,{className:`text-sm font-medium text-foreground/90`,children:e.label}),(0,F.jsx)(`div`,{className:`mt-0.5 text-xs leading-4 text-muted-foreground/60`,children:e.description})]})]},e.kind)})})]})}):(0,F.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground/70`,children:j(`workspaceSelectProject`)})})]})}):null}export{on as WorkspaceInspector};
|