@shawnstack/quickforge 1.5.6 → 1.6.3

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.
Files changed (37) hide show
  1. package/README.md +19 -17
  2. package/dist/assets/AgentProfilesPage-BTWTENpJ.js +1 -0
  3. package/dist/assets/{ChatPanelHost-CBoFtBvB.js → ChatPanelHost-DBCQpcp1.js} +2 -2
  4. package/dist/assets/PluginsPage-DRbQLXc6.js +1 -0
  5. package/dist/assets/ScheduledTasksPage-_Te96TTL.js +2 -0
  6. package/dist/assets/SettingsWorkspacePage-B3KByRv9.js +1412 -0
  7. package/dist/assets/{SharedConversationPage-7I9MiMcj.js → SharedConversationPage-CJr-rzR4.js} +1 -1
  8. package/dist/assets/TerminalDock-DSsVoL0f.js +2 -0
  9. package/dist/assets/WorkspaceInspector-HuIqe-Y6.js +3 -0
  10. package/dist/assets/{WorkspaceReaderDialog-Dli8GgAq.js → WorkspaceReaderDialog-au2UL_Ti.js} +1 -1
  11. package/dist/assets/{diff-line-counts-Dvz3MNk2.js → diff-line-counts-CnZu37tM.js} +1 -1
  12. package/dist/assets/{icons-DXrzz0RO.js → icons-B0ihJZtt.js} +1 -1
  13. package/dist/assets/index-CTo6RkZO.js +63 -0
  14. package/dist/assets/index-hb3vYF5_.css +3 -0
  15. package/dist/assets/mcp-servers-dialog-1Y9X80tB.js +5 -0
  16. package/dist/assets/{monaco-k8av2MY0.js → monaco-BKEc9mhB.js} +1 -1
  17. package/dist/assets/{react-vendor-xMa3TUTb.js → react-vendor-EwqQ8x7m.js} +1 -1
  18. package/dist/assets/skills-dialog-vMwLkH49.js +1 -0
  19. package/dist/assets/{useAppTheme-BzB8Q6AC.js → useAppTheme-CG1_MfzA.js} +1 -1
  20. package/dist/index.html +6 -6
  21. package/package.json +4 -1
  22. package/server/agent-manager.mjs +3 -1
  23. package/server/index.mjs +4 -3
  24. package/server/routes/backup.mjs +80 -6
  25. package/server/routes/system.mjs +5 -0
  26. package/server/storage.mjs +6 -5
  27. package/server/utils/package-update.mjs +46 -0
  28. package/dist/assets/AgentProfilesPage-DFUA4KiP.js +0 -1
  29. package/dist/assets/PluginsPage-CKOP-P02.js +0 -1
  30. package/dist/assets/ScheduledTasksPage-CRPvyfmE.js +0 -2
  31. package/dist/assets/SettingsWorkspacePage-Csr6xu0M.js +0 -1320
  32. package/dist/assets/TerminalDock-DWZAOy7v.js +0 -2
  33. package/dist/assets/WorkspaceInspector-D4k8zQ4s.js +0 -3
  34. package/dist/assets/index-BDNDRaPf.css +0 -3
  35. package/dist/assets/index-BIslkXQt.js +0 -69
  36. package/dist/assets/mcp-servers-dialog-DXR3fnZY.js +0 -20
  37. package/dist/assets/skills-dialog-Dax-_Ze5.js +0 -1
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t,I as n,P as r,bt as i,k as a,n as o,s,x as c}from"./icons-DXrzz0RO.js";import{n as l}from"./react-vendor-xMa3TUTb.js";import{$ as u,et as d,it as f}from"./index-BIslkXQt.js";import{n as p,t as m}from"./xterm-BtSXYfUR.js";import{t as h}from"./useAppTheme-BzB8Q6AC.js";var g=e(t(),1);async function _(e,t){let n=await fetch(e,{cache:`no-store`,...t}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`Request failed: ${n.status}`);return r}function v(){return _(`/api/terminal/capabilities`)}function y(e){return _(`/api/terminal/sessions${e?`?projectId=${encodeURIComponent(e)}`:``}`)}function b(e){return _(`/api/terminal/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)})}function x(e){return _(`/api/terminal/sessions/${encodeURIComponent(e)}`,{method:`DELETE`})}function S(e,t){return _(`/api/terminal/sessions/${encodeURIComponent(e)}/input`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({data:t})})}function C(){return``}function w(){let e=C();if(e){let t=new URL(e);return t.protocol=t.protocol===`https:`?`wss:`:`ws:`,t.toString().replace(/\/$/,``)}return`${location.protocol===`https:`?`wss:`:`ws:`}//${location.host}`}var T=l(),E={light:{background:`#ffffff`,foreground:`#1f2937`,cursor:`#1f2937`,selectionBackground:`#dbeafe`},dark:{background:`#171717`,foreground:`#e5e7eb`,cursor:`#e5e7eb`,selectionBackground:`#3f3f46`}};function ee({session:e,active:t,height:n,onReady:r,onExited:i,onConnectionError:a}){let o=h(),s=E[o],c=(0,g.useRef)(null),l=(0,g.useRef)(null),u=(0,g.useRef)(null),d=(0,g.useRef)(null),_=(0,g.useRef)(null),v=(0,g.useRef)(null);return(0,g.useEffect)(()=>{let t=c.current;if(!t)return;let n=!1,o=!1,h=!1,g=!1,y=t=>{n||h||g||(g=!0,a(e.id,t))},b=new p({cursorBlink:!0,convertEol:!1,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,fontSize:12,lineHeight:1.2,scrollback:5e3,theme:s}),x=new m;b.loadAddon(x),b.open(t),b.writeln(`\x1b[2mConnected to ${e.cwd}\x1b[0m`),l.current=b,u.current=x;let S=()=>{if(t.isConnected)try{x.fit();let{cols:e,rows:t}=b,n=d.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:`resize`,cols:e,rows:t}))}catch{}},C=new WebSocket(`${w()}/api/terminal/sessions/${encodeURIComponent(e.id)}/ws`);d.current=C,C.addEventListener(`open`,()=>{o=!0,g=!1,a(e.id,void 0),_.current=b.onData(e=>{C.readyState===WebSocket.OPEN&&C.send(JSON.stringify({type:`input`,data:e}))}),window.setTimeout(S,0)}),C.addEventListener(`message`,t=>{try{let n=JSON.parse(String(t.data));n.type===`ready`?r(e.id):n.type===`output`?b.write(n.data):n.type===`exit`?(h=!0,b.writeln(``),b.writeln(`\x1b[33m[process exited with code ${n.exitCode??`unknown`}]\x1b[0m`),i(e.id)):n.type===`error`&&b.writeln(`\x1b[31m${n.message}\x1b[0m`)}catch{}}),C.addEventListener(`error`,()=>{y(f(o?`terminalConnectionClosedUnexpectedly`:`terminalConnectionFailed`))}),C.addEventListener(`close`,e=>{_.current?.dispose(),_.current=null,!(n||h)&&(!e.wasClean||e.code!==1e3)&&y(f(o?`terminalConnectionClosedUnexpectedly`:`terminalConnectionFailed`))});let T=new ResizeObserver(()=>S());return T.observe(t),v.current=T,window.setTimeout(S,50),()=>{n=!0,T.disconnect(),v.current=null,_.current?.dispose(),_.current=null,C.close(),d.current=null,b.dispose(),l.current=null,u.current=null}},[o,a,i,r,e.cwd,e.id,s]),(0,g.useEffect)(()=>{if(!t)return;let e=u.current,n=l.current;window.setTimeout(()=>{try{e?.fit(),n?.focus()}catch{}},0)},[t,n]),(0,T.jsx)(`div`,{ref:c,className:t?`h-full min-h-0 w-full`:`hidden`,"aria-hidden":!t})}var te=180,ne=.7,re=320;function D(e,t){let n=t?t.name:`Terminal`,r=new Set(e.map(e=>e.name));if(n!==`Terminal`&&!r.has(n))return n;let i=1;for(;r.has(`${n} ${i}`);)i+=1;return`${n} ${i}`}function O(e,t){let n=e?.terminalShellProfiles||[],r=t||e?.defaultTerminalShellProfileId||``;return n.find(e=>e.id===r)||n[0]}function k({project:e,onCollapse:t,pendingCommand:l,onPendingCommandHandled:p}){let[m,h]=(0,g.useState)(null),[_,C]=(0,g.useState)([]),[w,E]=(0,g.useState)(),[k,ie]=(0,g.useState)(re),[A,j]=(0,g.useState)(!0),[M,N]=(0,g.useState)(!1),[ae,P]=(0,g.useState)(),[oe,F]=(0,g.useState)({}),[I,L]=(0,g.useState)(!1),[R,z]=(0,g.useState)(!1),B=(0,g.useRef)(!1),V=(0,g.useRef)(new Set),H=(0,g.useRef)(l),U=(0,g.useRef)(new Set),W=(0,g.useRef)(new Set),G=(0,g.useRef)(new Map),K=(0,g.useRef)(!0),[q,J]=(0,g.useState)(()=>new Set),Y=(0,g.useRef)(null),se=(0,g.useRef)(null),X=e?.id,Z=(0,g.useMemo)(()=>_.find(e=>e.id===w)??_[0],[w,_]);(0,g.useEffect)(()=>{H.current=l},[l]),(0,g.useEffect)(()=>()=>{K.current=!1},[]);let ce=(0,g.useCallback)(async()=>{let e=await y(X);return C(e.sessions),E(t=>t&&e.sessions.some(e=>e.id===t)?t:e.sessions[0]?.id),e.sessions},[X]),le=(0,g.useCallback)(async(e,t)=>{if(B.current)return;let n=O(m,t);B.current=!0,N(!0),P(void 0),F({});try{let t=await b({projectId:X,name:D(e,n),cols:120,rows:30,shellProfileId:n?.id,shellProfileName:n?.name});C(e=>[...e,t]),E(t.id)}catch(e){P(e instanceof Error?e.message:f(`terminalCreateFailed`))}finally{B.current=!1,N(!1)}},[m,X]);(0,g.useEffect)(()=>{let e=!1;return(async()=>{j(!0),P(void 0);try{let[t,n]=await Promise.all([v(),y(X)]);if(e)return;if(h(t),C(n.sessions),E(n.sessions[0]?.id),t.enabled&&n.sessions.length===0&&!H.current){let n=O(t);b({projectId:X,name:D([],n),cols:120,rows:30,shellProfileId:n?.id,shellProfileName:n?.name}).then(t=>{if(e){x(t.id).catch(()=>{});return}C([t]),E(t.id)}).catch(t=>{e||P(t instanceof Error?t.message:f(`terminalCreateFailed`))})}}catch(t){e||P(t instanceof Error?t.message:f(`terminalUnavailable`))}finally{e||j(!1)}})(),()=>{e=!0}},[X]),(0,g.useEffect)(()=>{if(!I)return;let e=e=>{se.current?.contains(e.target)||L(!1)},t=e=>{e.key===`Escape`&&L(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[I]),(0,g.useEffect)(()=>{if(!R)return;let e=e=>{e.key===`Escape`&&z(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[R]),(0,g.useEffect)(()=>{if(!l||V.current.has(l.id)||G.current.has(l.id)||U.current.has(l.id)||A||M||!m)return;if(!m.enabled){V.current.add(l.id),window.setTimeout(()=>{P(m.reason||f(`terminalUnavailable`)),p?.(l.id)},0);return}let e=Z&&!Z.exited?Z:_.find(e=>!e.exited);if(e){G.current.set(l.id,e.id),window.setTimeout(()=>{K.current&&E(e.id)},0);return}U.current.add(l.id),window.setTimeout(()=>{K.current&&P(void 0)},0);let t=O(m);b({projectId:X,name:D(_,t),cols:120,rows:30,shellProfileId:t?.id,shellProfileName:t?.name}).then(e=>{if(!K.current){x(e.id).catch(()=>{});return}G.current.set(l.id,e.id),C(t=>t.some(t=>t.id===e.id)?t:[...t,e]),E(e.id)}).catch(e=>{K.current&&(P(e instanceof Error?e.message:f(`terminalCommandExecuteFailed`)),V.current.add(l.id),p?.(l.id))}).finally(()=>{U.current.delete(l.id)})},[Z,m,M,A,p,l,X,_]),(0,g.useEffect)(()=>{if(!l||V.current.has(l.id)||W.current.has(l.id))return;let e=G.current.get(l.id),t=e?_.find(t=>t.id===e):Z&&!Z.exited?Z:_.find(e=>!e.exited);!t||t.exited||!q.has(t.id)||(W.current.add(l.id),window.setTimeout(()=>{K.current&&(E(t.id),P(void 0))},0),(async()=>{try{if(l.execute){let e=l.command.split(`
2
- `),n=e.flatMap((t,n)=>n<e.length-1?[t,`\r`]:[t]);n.push(`\r`),await S(t.id,n.join(``))}else await S(t.id,l.command)}catch(e){K.current&&P(e instanceof Error?e.message:f(`terminalCommandExecuteFailed`))}finally{V.current.add(l.id),W.current.delete(l.id),G.current.delete(l.id),K.current&&p?.(l.id)}})())},[Z,p,l,q,_]);let ue=async e=>{P(void 0),F(t=>{if(!t[e])return t;let n={...t};return delete n[e],n});let t=_.filter(t=>t.id!==e);C(t),w===e&&E(t[0]?.id);try{await x(e)}catch(e){P(e instanceof Error?e.message:f(`terminalCloseFailed`)),ce().catch(()=>{})}},de=(0,g.useCallback)(e=>{C(t=>t.map(t=>t.id===e?{...t,exited:!0}:t)),J(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},[]),fe=(0,g.useCallback)(e=>{J(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n})},[]),pe=(0,g.useCallback)((e,t)=>{F(n=>{if(!t){if(!n[e])return n;let t={...n};return delete t[e],t}return n[e]===t?n:{...n,[e]:t}})},[]),me=e=>{Y.current={startY:e.clientY,startHeight:k},e.currentTarget.setPointerCapture(e.pointerId)},he=e=>{let t=Y.current;if(!t)return;let n=Math.max(te,Math.floor(window.innerHeight*ne));ie(Math.min(n,Math.max(te,t.startHeight+t.startY-e.clientY)))},ge=e=>{Y.current=null;try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}},Q=m?.terminalShellProfiles||[],_e=m?.defaultTerminalShellProfileId||``,ve=Q.find(e=>e.id===_e)||Q[0],ye=!!(m&&_.length>=m.maxSessions),be=M||ye,xe=Z?oe[Z.id]:void 0,$=ae??xe,Se=R?$?`calc(100% - 4.25rem)`:`calc(100% - 2.25rem)`:$?k-72:k-45;return(0,T.jsxs)(`div`,{className:d(`shrink-0 border-t border-border bg-background`,R&&`quickforge-terminal-fullscreen z-40 flex flex-col border-t-0`),style:R?void 0:{height:k},children:[R?null:(0,T.jsx)(`div`,{className:`h-1 cursor-row-resize bg-transparent hover:bg-border`,onPointerDown:me,onPointerMove:he,onPointerUp:ge,onPointerCancel:ge}),(0,T.jsxs)(`div`,{className:`flex h-9 items-center gap-1 border-b border-border px-2`,children:[(0,T.jsx)(s,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,T.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1 overflow-x-auto`,children:_.map(e=>(0,T.jsxs)(`button`,{type:`button`,className:d(`group flex max-w-44 shrink-0 items-center gap-1 rounded-md px-2 py-1 text-xs text-muted-foreground/72 hover:bg-muted/20 hover:text-foreground/85`,Z?.id===e.id&&`bg-muted/28 text-foreground/90`),onClick:()=>E(e.id),title:`${e.name} — ${e.cwd}`,children:[(0,T.jsx)(`span`,{className:d(`size-1.5 rounded-full`,e.exited?`bg-muted-foreground/40`:`bg-emerald-500/80`)}),(0,T.jsx)(`span`,{className:`truncate`,children:e.name}),(0,T.jsx)(`span`,{role:`button`,tabIndex:0,className:`ml-1 rounded-sm p-0.5 opacity-60 hover:bg-background hover:opacity-100`,onClick:t=>{t.stopPropagation(),ue(e.id)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),ue(e.id))},"aria-label":f(`terminalCloseSession`,{name:e.name}),children:(0,T.jsx)(o,{className:`size-3`})})]},e.id))}),(0,T.jsxs)(`div`,{className:`relative shrink-0`,ref:se,children:[(0,T.jsxs)(`div`,{className:`flex items-center overflow-hidden rounded-md border border-border bg-background`,children:[(0,T.jsx)(`button`,{type:`button`,className:`inline-flex h-7 w-7 items-center justify-center text-foreground/85 transition-colors hover:bg-muted/20 disabled:pointer-events-none disabled:opacity-50`,onClick:()=>void le(_),disabled:be,title:ve?f(`terminalNewWithProfile`,{name:ve.name}):f(`terminalNew`),"aria-label":f(`terminalNew`),children:M?(0,T.jsx)(n,{className:`size-3.5 animate-spin`}):(0,T.jsx)(c,{className:`size-3.5`})}),Q.length>0?(0,T.jsx)(`button`,{type:`button`,className:`inline-flex h-7 w-7 items-center justify-center border-l border-border text-muted-foreground/72 transition-colors hover:bg-muted/20 hover:text-foreground/85 disabled:pointer-events-none disabled:opacity-50`,onClick:()=>L(e=>!e),disabled:be,title:f(`terminalSelectShell`),"aria-label":f(`terminalSelectShell`),"aria-expanded":I,children:(0,T.jsx)(i,{className:`size-3.5`})}):null]}),I?(0,T.jsxs)(`div`,{className:`absolute bottom-9 right-0 z-30 w-64 overflow-hidden rounded-lg border border-border bg-background p-1.5 shadow-[0_16px_38px_-22px_rgb(15_23_42_/_0.65)]`,children:[(0,T.jsx)(`div`,{className:`px-2 pb-1.5 pt-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60`,children:f(`terminalNewWith`)}),Q.map(e=>(0,T.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs text-muted-foreground/80 hover:bg-muted/20 hover:text-foreground/90`,onClick:()=>{L(!1),le(_,e.id)},children:[(0,T.jsx)(`span`,{className:`inline-flex size-5 shrink-0 items-center justify-center rounded bg-muted/20 text-[10px] text-muted-foreground/70`,children:e.name.slice(0,1).toUpperCase()}),(0,T.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`span`,{className:`block truncate font-medium`,children:e.name}),(0,T.jsx)(`span`,{className:`block truncate font-mono text-[11px] text-muted-foreground/55`,children:e.command})]})]},e.id))]}):null]}),(0,T.jsx)(u,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:()=>z(e=>!e),title:f(R?`terminalExitFullscreen`:`terminalFullscreen`),"aria-label":f(R?`terminalExitFullscreen`:`terminalFullscreen`),children:R?(0,T.jsx)(a,{className:`size-3.5`}):(0,T.jsx)(r,{className:`size-3.5`})}),(0,T.jsx)(u,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:t,title:f(`terminalCollapse`),"aria-label":f(`terminalCollapse`),children:(0,T.jsx)(i,{className:`size-3.5`})})]}),$?(0,T.jsx)(`div`,{className:`border-b border-border px-3 py-1.5 text-xs text-destructive`,children:$}):null,(0,T.jsx)(`div`,{className:`min-h-0 bg-background`,style:{height:Se},children:A?(0,T.jsxs)(`div`,{className:`flex h-full items-center justify-center gap-2 text-xs text-muted-foreground/60`,children:[(0,T.jsx)(n,{className:`size-4 animate-spin`}),` `,f(`terminalStarting`)]}):m&&!m.enabled?(0,T.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-muted-foreground/60`,children:m.reason||f(`terminalUnavailable`)}):_.length===0?(0,T.jsx)(`div`,{className:`flex h-full items-center justify-center text-xs text-muted-foreground/60`,children:f(`terminalNoSessions`)}):_.map(e=>(0,T.jsx)(ee,{session:e,active:e.id===Z?.id,height:R?window.innerHeight-36:k,onReady:fe,onExited:de,onConnectionError:pe},e.id))})]})}export{k as TerminalDock};
@@ -1,3 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{$ as t,A as n,At as r,B as i,Et as a,G as o,H as s,J as c,K as l,L as u,P as d,Q as f,W as p,X as m,Y as h,Z as g,_,at as v,bt as ee,ct as te,et as ne,g as re,gt as ie,it as y,k as ae,n as oe,nt as se,o as ce,ot as b,q as le,st as x,tt as S,vt as C,xt as w,y as ue,z as T}from"./icons-DXrzz0RO.js";import{n as E}from"./react-vendor-xMa3TUTb.js";import{$ as D,a as de,c as fe,et as O,i as pe,it as k,l as me,n as he,o as ge,r as _e,s as ve,t as A,u as ye}from"./index-BIslkXQt.js";import{i as be,n as j,r as xe,t as M}from"./diff-line-counts-Dvz3MNk2.js";var N=e(r(),1),P=E();function F(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 I(e){let t=e.trim().replace(/\\/g,`/`);return t.startsWith(`/`)||/^[a-zA-Z]:\//.test(t)}function L(e,t){let n=e.trim();if(!t||!F(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 R(e,t){let n=e.trim();if(!n)return{url:``,displayUrl:``,error:``};if(F(n)){let e=new URL(n,window.location.origin);return{url:`${e.pathname}${e.search}${e.hash}`,displayUrl:L(n,t),error:``}}if(t&&I(n))return{url:ge(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:k(`invalidPreviewUrl`)}:{url:e.toString(),displayUrl:e.toString(),error:``}}catch{return{url:``,displayUrl:n,error:k(`invalidPreviewUrl`)}}}function Se({url:e,onUrlChange:t,projectId:n}){let r=(0,N.useMemo)(()=>R(e,n),[n,e]),[i,a]=(0,N.useState)({sourceUrl:e,value:r.displayUrl}),[o,s]=(0,N.useState)(``),[c,l]=(0,N.useState)(0),u=r.url,d=u.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`,f=i.sourceUrl===e?i.value:r.displayUrl;function p(e=f){let r=R(e,n);if(r.error){s(r.error);return}s(``),a({sourceUrl:r.displayUrl,value:r.displayUrl}),t(r.displayUrl),r.url&&l(e=>e+1)}function m(){u&&l(e=>e+1)}function h(){u&&window.open(u,`_blank`,`noopener,noreferrer`)}return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 border-b border-border p-3`,children:[(0,P.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,P.jsxs)(`label`,{className:`flex min-w-0 flex-1 items-center rounded-md border border-border bg-background px-2 py-1.5 text-xs text-muted-foreground/65 focus-within:text-foreground/85`,children:[(0,P.jsx)(`span`,{className:`sr-only`,children:k(`previewUrl`)}),(0,P.jsx)(`input`,{value:f,onChange:t=>{a({sourceUrl:e,value:t.target.value}),o&&s(``)},placeholder:k(`previewUrlPlaceholder`),className:`min-w-0 flex-1 bg-transparent text-xs text-foreground/85 outline-none placeholder:text-muted-foreground/50`})]}),(0,P.jsx)(D,{type:`submit`,variant:`outline`,size:`sm`,className:`h-8 shrink-0 px-3 text-xs`,children:k(`openPreview`)}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,onClick:m,disabled:!u,"aria-label":k(`refreshPreview`),title:k(`refreshPreview`),children:(0,P.jsx)(ue,{className:`size-4`})}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,onClick:h,disabled:!u,"aria-label":k(`openInBrowser`),title:k(`openInBrowser`),children:(0,P.jsx)(se,{className:`size-4`})})]}),o?(0,P.jsx)(`div`,{className:`text-xs text-destructive`,children:o}):null]}),(0,P.jsx)(`div`,{className:`min-h-0 flex-1 bg-muted/10`,children:u?(0,P.jsx)(`iframe`,{title:k(`webPreview`),src:u,sandbox:d,className:`h-full w-full border-0 bg-background`},`${u}:${c}`):(0,P.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-8 text-center`,children:[(0,P.jsx)(`div`,{className:`rounded-full bg-muted/20 p-3 text-muted-foreground/70`,children:(0,P.jsx)(y,{className:`size-5`})}),(0,P.jsx)(`div`,{className:`mt-4 text-sm font-medium text-foreground/85`,children:k(`noPreviewUrlTitle`)}),(0,P.jsx)(`div`,{className:`mt-2 max-w-xs text-xs leading-5 text-muted-foreground/70`,children:k(`noPreviewUrlDescription`)})]})})]})}var z={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 B(e){let t=e.split(`/`).pop()?.toLowerCase()??``;return t===`dockerfile`||t.endsWith(`.dockerfile`)?`dockerfile`:z[t.includes(`.`)?t.split(`.`).pop()??``:t]??`plaintext`}function Ce(e){return e.slice(e.lastIndexOf(`/`)+1)}function V(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t+1):``}var H={typescript:{Icon:f,className:`text-sky-500 dark:text-sky-400`},javascript:{Icon:f,className:`text-amber-500 dark:text-amber-400`},python:{Icon:f,className:`text-blue-600 dark:text-blue-400`},go:{Icon:f,className:`text-cyan-600 dark:text-cyan-400`},rust:{Icon:f,className:`text-orange-600 dark:text-orange-400`},java:{Icon:f,className:`text-red-500 dark:text-red-400`},c:{Icon:f,className:`text-blue-500 dark:text-blue-400`},cpp:{Icon:f,className:`text-indigo-500 dark:text-indigo-400`},csharp:{Icon:f,className:`text-violet-500 dark:text-violet-400`},php:{Icon:f,className:`text-indigo-500 dark:text-indigo-400`},ruby:{Icon:f,className:`text-rose-500 dark:text-rose-400`},swift:{Icon:f,className:`text-orange-500 dark:text-orange-400`},kotlin:{Icon:f,className:`text-violet-500 dark:text-violet-400`},shell:{Icon:f,className:`text-green-600 dark:text-green-400`},powershell:{Icon:f,className:`text-blue-600 dark:text-blue-400`},json:{Icon:t,className:`text-amber-600 dark:text-amber-400`},css:{Icon:T,className:`text-sky-500 dark:text-sky-400`},scss:{Icon:T,className:`text-pink-500 dark:text-pink-400`},less:{Icon:T,className:`text-sky-500 dark:text-sky-400`},html:{Icon:y,className:`text-orange-500 dark:text-orange-400`},markdown:{Icon:le,className:`text-slate-500 dark:text-slate-400`},yaml:{Icon:g,className:`text-slate-500 dark:text-slate-400`},toml:{Icon:g,className:`text-slate-500 dark:text-slate-400`},ini:{Icon:g,className:`text-slate-500 dark:text-slate-400`},xml:{Icon:f,className:`text-slate-500 dark:text-slate-400`},sql:{Icon:v,className:`text-indigo-500 dark:text-indigo-400`},dockerfile:{Icon:x,className:`text-sky-600 dark:text-sky-400`},plaintext:{Icon:le,className:`text-slate-500 dark:text-slate-400`}},U=new Set([`png`,`jpg`,`jpeg`,`gif`,`svg`,`ico`,`webp`,`bmp`,`avif`]),W=new Set([`zip`,`tar`,`gz`,`tgz`,`rar`,`7z`,`bz2`,`xz`]),G=new Set([`csv`,`tsv`,`xls`,`xlsx`]);function K(e){if(e===`readme`||e.startsWith(`readme.`))return{Icon:a,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:_,className:`text-slate-500 dark:text-slate-400`};if(e===`makefile`||e.startsWith(`makefile.`))return{Icon:ce,className:`text-slate-500 dark:text-slate-400`};if(e.startsWith(`docker-compose`))return{Icon:x,className:`text-sky-600 dark:text-sky-400`};if(e===`.gitignore`||e===`.gitattributes`||e===`.gitmodules`)return{Icon:_,className:`text-orange-500 dark:text-orange-400`};if(e===`.env`||e.startsWith(`.env.`))return{Icon:g,className:`text-slate-500 dark:text-slate-400`};if(e.endsWith(`.lock`)||e.endsWith(`-lock.json`)||e.endsWith(`-lock.yaml`))return{Icon:h,className:`text-slate-500 dark:text-slate-400`}}function we(e){let t=Ce(e).toLowerCase(),n=K(t);if(n)return n;let r=V(t);return U.has(r)?{Icon:m,className:`text-purple-500 dark:text-purple-400`}:W.has(r)?{Icon:ne,className:`text-slate-500 dark:text-slate-400`}:G.has(r)?{Icon:c,className:`text-green-600 dark:text-green-400`}:H[B(e)]||{Icon:l,className:`text-slate-500 dark:text-slate-400`}}function Te(e,t){let n=e.toLowerCase();return n===`.git`||n===`.svn`||n===`.hg`?{Icon:o,className:`text-orange-500 dark:text-orange-400`}:{Icon:t?p:s,className:`text-slate-500 dark:text-slate-400`}}function q({path:e,className:t=`size-3.5`}){let{Icon:n,className:r}=we(e);return(0,P.jsx)(n,{className:`${r} ${t}`})}function J({name:e,open:t,className:n=`size-3.5`}){let{Icon:r,className:i}=Te(e,t);return(0,P.jsx)(r,{className:`${i} ${n}`})}function Ee(e){return e===`added`?{label:`A`,text:k(`workspaceStatusAdded`),className:`text-emerald-600 dark:text-emerald-500`}:e===`deleted`?{label:`D`,text:k(`workspaceStatusDeleted`),className:`text-red-600 dark:text-red-500`}:e===`renamed`?{label:`R`,text:k(`workspaceStatusRenamed`),className:`text-blue-600 dark:text-blue-500`}:e===`untracked`?{label:`U`,text:k(`workspaceStatusUntracked`),className:`text-amber-600 dark:text-amber-500`}:e===`conflicted`?{label:`!`,text:k(`workspaceStatusConflict`),className:`text-red-600 dark:text-red-500`}:{label:`M`,text:k(`workspaceStatusModified`),className:`text-emerald-600 dark:text-emerald-500`}}function De({files:e,selectedPath:t,onSelectFile:n,emptyMessage:r=k(`workspaceNoWorkingTreeChanges`)}){return e.length===0?(0,P.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground/70`,children:r}):(0,P.jsx)(`div`,{className:`space-y-0.5`,children:e.map(e=>{let r=Ee(e.status);return(0,P.jsxs)(`button`,{type:`button`,className:`flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-xs transition-colors ${t===e.path?`bg-muted/28 text-foreground/90`:`text-muted-foreground/72 hover:bg-muted/20 hover:text-foreground/85`}`,onClick:()=>n(e.path),title:e.oldPath?`${e.oldPath} → ${e.path}`:e.path,children:[(0,P.jsx)(`span`,{className:`w-4 shrink-0 font-mono text-[0.68rem] font-semibold ${r.className}`,children:r.label}),(0,P.jsx)(q,{path:e.path,className:`size-3.5 shrink-0`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.path}),typeof e.additions==`number`&&typeof e.deletions==`number`?(0,P.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] font-medium`,children:[(0,P.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,e.additions]}),(0,P.jsxs)(`span`,{className:`ml-1 text-red-600 dark:text-red-500`,children:[`-`,e.deletions]})]}):null,(0,P.jsx)(`span`,{className:`shrink-0 text-[0.68rem] text-muted-foreground/55`,children:r.text})]},`${e.status}:${e.oldPath??``}:${e.path}`)})})}function Oe(e){return e?e.status===`added`?`A`:e.status===`deleted`?`D`:e.status===`renamed`?`R`:e.status===`untracked`?`U`:`M`:``}function ke({projectId:e,path:t}){let[n,r]=(0,N.useState)(!1);return n?(0,P.jsx)(q,{path:t,className:`size-3.5 shrink-0`}):(0,P.jsx)(`img`,{src:ge(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 Ae({node:e,depth:t,selectedPath:n,gitStatuses:r,onSelectFile:i,onPreviewFile:a,projectId:o}){let[s,c]=(0,N.useState)(t<1),l=e.type===`directory`,u=n===e.path,d=Oe(r[e.path]),f=(l?void 0:he(e.path))===`image`,p=!!o&&f,m=!!a&&(f||pe(e.path));function h(){a?.(e.path)}return(0,P.jsxs)(`div`,{children:[(0,P.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 ${u?`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:()=>{l?c(e=>!e):f&&a?h():i(e.path)},title:e.path,children:[l?(0,P.jsx)(C,{className:`size-3 shrink-0 transition-transform ${s?`rotate-90`:``}`}):(0,P.jsx)(`span`,{className:`w-3 shrink-0`}),l?(0,P.jsx)(J,{name:e.name,open:s,className:`size-3.5 shrink-0`}):p?(0,P.jsx)(ke,{projectId:o,path:e.path}):(0,P.jsx)(q,{path:e.path,className:`size-3.5 shrink-0`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),d?(0,P.jsx)(`span`,{className:`shrink-0 font-mono text-[0.68rem] text-emerald-600 dark:text-emerald-500`,children:d}):null,m?(0,P.jsx)(`span`,{role:`button`,tabIndex:0,"aria-label":k(`openPreview`),title:k(`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(),h()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),e.stopPropagation(),h())},children:(0,P.jsx)(S,{className:`size-3.5`})}):null]}),l&&s?(0,P.jsx)(`div`,{children:(e.children??[]).map(e=>(0,P.jsx)(Ae,{node:e,depth:t+1,selectedPath:n,gitStatuses:r,onSelectFile:i,onPreviewFile:a,projectId:o},e.path))}):null]})}function je({tree:e,selectedPath:t,gitStatuses:n={},onSelectFile:r,onPreviewFile:i,projectId:a}){return e.length===0?(0,P.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground/70`,children:k(`workspaceNoFilesToDisplay`)}):(0,P.jsx)(`div`,{className:`space-y-0.5`,children:e.map(e=>(0,P.jsx)(Ae,{node:e,depth:0,selectedPath:t,gitStatuses:n,onSelectFile:r,onPreviewFile:i,projectId:a},e.path))})}function Me(){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 Ne(e,t){return e===`browser`?`browser`:`${e}:${t}`}var Pe=[{view:`overview`,label:k(`workspaceOverview`),icon:u},{view:`files`,label:k(`workspaceFiles`),icon:s},{view:`changes`,label:k(`workspaceChanges`),icon:i},{view:`browser`,label:k(`workspaceBrowser`),icon:y}],Y=380,X=480,Z=800,Fe=`quickforge_workspaceInspectorWidth`,Ie=140,Le=200,Re=400;function ze(){if(typeof window>`u`)return X;try{let e=window.localStorage.getItem(Fe);if(!e)return X;let t=Number(e);return Number.isFinite(t)?Math.min(Z,Math.max(Y,t)):X}catch{return X}}function Be(e,t){let n=t.trim().toLowerCase();return n?e.flatMap(e=>{let t=e.children?Be(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 Ve(e){return k(`workspaceReviewPrompt`,{list:e.map(e=>`- ${e.status}: ${e.oldPath?`${e.oldPath} -> `:``}${e.path}`).join(`
2
- `)})}function He(e){return k(`workspaceCommitMessagePrompt`,{list:e.map(e=>`- ${e.status}: ${e.oldPath?`${e.oldPath} -> `:``}${e.path}`).join(`
3
- `)})}function Ue(e,t){let n=[`${k(`workspaceCurrentBranch`)}: ${e||k(`unknown`)}`];return t?.total&&n.push(`${t.total} ${k(`workspaceChangeCount`)}`),n.join(` · `)}function We({title:e,files:t,selectedPath:n,onSelectFile:r}){return t.length===0?null:(0,P.jsxs)(`div`,{className:`space-y-1`,children:[(0,P.jsxs)(`div`,{className:`px-2 text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60`,children:[e,` `,t.length]}),(0,P.jsx)(De,{files:t,selectedPath:n,onSelectFile:r})]})}function Ge({view:e,changesCount:t,open:n,onOpenChange:r,onViewChange:i}){let a=Pe.find(t=>t.view===e)??Pe[0],o=a.icon;return(0,P.jsxs)(`div`,{className:`relative min-w-0`,children:[(0,P.jsxs)(`button`,{type:`button`,className:`flex max-w-full items-center gap-2 rounded-xl bg-muted/20 px-2.5 py-1.5 text-left text-sm font-semibold text-foreground/90 transition-colors hover:bg-muted/28`,onClick:()=>r(!n),"aria-haspopup":`menu`,"aria-expanded":n,children:[(0,P.jsx)(o,{className:`size-4 shrink-0 text-foreground/75`}),(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:a.label}),(0,P.jsx)(ee,{className:O(`size-4 shrink-0 text-muted-foreground/65 transition-transform`,n?`rotate-180`:``)})]}),n?(0,P.jsx)(`div`,{className:`absolute left-0 top-11 z-40 w-60 rounded-2xl border border-border bg-popover p-2 shadow-quickforge`,children:Pe.map(n=>{let a=n.icon,o=n.view===e;return(0,P.jsxs)(`button`,{type:`button`,className:O(`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors`,o?`bg-muted/28 text-foreground/90`:`text-foreground/80 hover:bg-muted/20 hover:text-foreground/90`),onClick:()=>{i(n.view),r(!1)},children:[(0,P.jsx)(a,{className:`size-4 shrink-0`}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[n.label,n.view===`changes`&&t?` ${t}`:``]}),o?(0,P.jsx)(w,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-500`}):null]},n.view)})}):null]})}function Q(e){return e?e.language===`markdown`||/\.(md|markdown)$/i.test(e.path):!1}function Ke(e,t=!1){return k(t?`readerFileMarkdownPrompt`:`readerFilePrompt`,{path:e})}function qe(e){return k(`readerDiffPrompt`,{path:e})}function $(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 Je({tabs:e,activeId:t,onSelect:n,onClose:r}){return(0,P.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 items-center gap-0.5 overflow-x-auto px-1.5`,children:e.map(e=>{let i=e.id===t,a=e.mode===`browser`,o=a?k(`workspaceBrowser`):e.path.split(`/`).pop()||e.path,s=e.path.split(`.`).pop()||``;return(0,P.jsxs)(`button`,{type:`button`,className:O(`group flex max-w-44 shrink-0 items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium transition-colors`,i?`bg-background shadow-sm text-foreground`:`text-muted-foreground/70 hover:bg-muted/40 hover:text-foreground/85`),onClick:()=>n(e.id),title:e.path,children:[(0,P.jsx)(`span`,{className:O(`flex size-4 shrink-0 items-center justify-center rounded-sm`,i?`bg-primary/10 text-primary`:`bg-muted/30 text-muted-foreground/60`),children:e.loading?(0,P.jsx)(d,{className:`size-2.5 animate-spin`}):a?(0,P.jsx)(y,{className:`size-2.5`}):s===`md`||s===`markdown`?(0,P.jsx)(u,{className:`size-2.5`}):(0,P.jsx)(f,{className:`size-2.5`})}),(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:o}),(0,P.jsx)(`span`,{role:`button`,tabIndex:0,className:O(`ml-0.5 shrink-0 rounded-sm p-0.5 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-destructive/15 hover:text-destructive`,i&&`opacity-100`),onClick:t=>{t.stopPropagation(),r(e.id)},onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),t.stopPropagation(),r(e.id))},"aria-label":k(`close`),children:(0,P.jsx)(oe,{className:`size-3`})})]},e.id)})})}function Ye({mode:e,file:t,diff:r,loading:i,error:a,onClose:o,onDraftRequest:s}){let[c,l]=(0,N.useState)(),[u,d]=(0,N.useState)(`preview`);async function f(e,t){t&&(await navigator.clipboard.writeText(t),l(e),window.setTimeout(()=>l(void 0),1200))}let p=e===`file`?t?.path:r?.path,m=e===`file`&&Q(t),h=e===`file`?t?.content:r?$(r):void 0,g=e===`file`&&t?Ke(t.path,m):e===`diff`&&r?qe(r.path):void 0,_=(0,N.useMemo)(()=>e===`diff`&&r?M(r.oldContent,r.newContent):void 0,[e,r]);return(0,P.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,P.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-border px-3`,children:[m?(0,P.jsx)(`div`,{className:`inline-flex rounded-full bg-muted/25 p-1 text-xs`,children:[`preview`,`source`].map(e=>(0,P.jsx)(`button`,{type:`button`,className:e===u?`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:k(e===`preview`?`markdownPreview`:`markdownSource`)},e))}):null,_?(0,P.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] font-medium`,children:[(0,P.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:[`+`,_.added]}),(0,P.jsxs)(`span`,{className:`ml-1.5 text-red-600 dark:text-red-400`,children:[`-`,_.removed]})]}):null,(0,P.jsx)(`div`,{className:`flex-1`}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:()=>void f(`path`,p),disabled:!p,"aria-label":k(`copyPath`),title:k(`copyPath`),children:c===`path`?(0,P.jsx)(w,{className:`size-3.5`}):(0,P.jsx)(b,{className:`size-3.5`})}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:()=>void f(`content`,h),disabled:!h,"aria-label":k(`copyContent`),title:k(e===`file`?`copyContent`:`copyDiffContent`),children:c===`content`?(0,P.jsx)(w,{className:`size-3.5`}):(0,P.jsx)(b,{className:`size-3.5`})}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:()=>g&&s?.(g),disabled:!g||!s,"aria-label":k(`askAiAboutThis`),title:k(`askAiAboutThis`),children:(0,P.jsx)(n,{className:`size-3.5`})}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,className:`size-7`,onClick:o,"aria-label":k(`close`),title:k(`close`),children:(0,P.jsx)(oe,{className:`size-3.5`})})]}),(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 bg-background`,children:[i?(0,P.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground/70`,children:k(`openingReader`)}):null,!i&&a?(0,P.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:a}):null,!i&&!a&&e===`file`&&t?m?(0,P.jsx)(xe,{path:t.path,content:t.content,language:t.language,mode:u},t.path):(0,P.jsx)(be,{path:t.path,content:t.content,language:t.language}):null,!i&&!a&&e===`diff`&&r?(0,P.jsx)(j,{path:r.path,oldContent:r.oldContent,newContent:r.newContent,language:r.language,status:r.status}):null]})]})}function Xe({project:e,artifacts:t,changesCount:n,changedPaths:r,isGitRepository:i,gitBranch:a,onSelectFile:o,onSelectDiff:s,onPreviewFile:c}){let[l,u]=(0,N.useState)(!1),[d,f]=(0,N.useState)(()=>new Set),p=de(t),m=t.filter(e=>e.command);function h(e){f(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:`space-y-3 p-2`,children:[(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-background px-3 py-3`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-semibold text-foreground/90`,children:[(0,P.jsx)(te,{className:`size-3.5 text-emerald-600 dark:text-emerald-500`}),k(`workspaceCurrentArtifacts`)]}),t.length===0?(0,P.jsx)(`div`,{className:`mt-2 text-xs leading-5 text-muted-foreground/70`,children:k(`workspaceNoArtifacts`)}):(0,P.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[p.length?(0,P.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,P.jsxs)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground/60`,children:[k(`workspaceFiles`),` `,p.length]}),p.slice(0,8).map(e=>{let t=e.path,n=_e(t),i=r.has(t),a=typeof e.addedLines==`number`||typeof e.removedLines==`number`;return(0,P.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,P.jsx)(`button`,{type:`button`,className:`min-w-0 flex-1 truncate text-left font-medium`,onClick:()=>n?c(t):i?s(t):o(t),title:t,children:e.title||A(t)}),a?(0,P.jsxs)(`span`,{className:`shrink-0 font-mono text-[10px] font-medium`,children:[(0,P.jsxs)(`span`,{className:`text-emerald-600 dark:text-emerald-400`,children:[`+`,e.addedLines??0]}),(0,P.jsxs)(`span`,{className:`ml-1 text-red-600 dark:text-red-400`,children:[`-`,e.removedLines??0]})]}):null,(0,P.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,P.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:()=>c(t),"aria-label":k(`previewArtifact`),title:k(`previewArtifact`),children:(0,P.jsx)(S,{className:`size-3.5`})}):null,(0,P.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:()=>i?s(t):o(t),children:k(i?`workspaceViewDiff`:`artifactPreviewViewSource`)})]},e.id)}),p.length>8?(0,P.jsxs)(`div`,{className:`px-2 text-[11px] text-muted-foreground/60`,children:[`+`,p.length-8]}):null]}):null,m.length?(0,P.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,P.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:()=>u(e=>!e),"aria-expanded":l,children:[(0,P.jsx)(ee,{className:O(`size-3.5 transition-transform`,l?``:`-rotate-90`)}),(0,P.jsxs)(`span`,{className:`min-w-0 flex-1 truncate`,children:[k(`workspaceCommands`),` `,m.length]})]}),l?(0,P.jsx)(`div`,{className:`space-y-1`,children:m.map((e,t)=>{let n=d.has(e.id);return(0,P.jsxs)(`div`,{className:`rounded-md bg-muted/15 text-[11px] text-muted-foreground/80`,children:[(0,P.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:()=>h(e.id),"aria-expanded":n,children:[(0,P.jsx)(ee,{className:O(`size-3 shrink-0 transition-transform`,n?``:`-rotate-90`)}),(0,P.jsxs)(`span`,{className:`shrink-0 font-medium text-muted-foreground/65`,children:[`#`,t+1]}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,children:e.command})]}),n?(0,P.jsxs)(`div`,{className:`space-y-1 px-2 pb-2 pt-1.5`,children:[(0,P.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-[11px] leading-5 text-foreground/80`,children:e.command}),e.outputFile?(0,P.jsxs)(`div`,{className:`text-[10px] text-muted-foreground/65`,children:[k(`workspaceCommandOutput`),`: `,(0,P.jsx)(`span`,{className:`font-mono`,children:e.outputFile})]}):null]}):null]},e.id)})}):null]}):null]})]}),(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/10 px-3 py-3`,children:[(0,P.jsx)(`div`,{className:`text-xs font-medium text-foreground/85`,children:e?.name??k(`noProjectSelected`)}),(0,P.jsx)(`div`,{className:`mt-1 text-[11px] text-muted-foreground/65`,children:i?`${k(`workspaceCurrentBranch`)}: ${a||k(`unknown`)} · ${n} ${k(`workspaceChangeCount`)}`:k(`workspaceNotGitRepository`)})]})]})}function Ze({project:e,open:t,view:r,onViewChange:i,onPreviewArtifact:a,onDraftRequest:o,focusTarget:s,previewUrl:c,onPreviewUrlChange:l,artifacts:u=[]}){let[f,p]=(0,N.useState)([]),[m,h]=(0,N.useState)([]),[g,_]=(0,N.useState)(),[v,ee]=(0,N.useState)(),[te,ne]=(0,N.useState)(!1),[y,oe]=(0,N.useState)(!1),[se,ce]=(0,N.useState)(),[b,le]=(0,N.useState)(``),[x,S]=(0,N.useState)([]),[C,w]=(0,N.useState)(),[ue,T]=(0,N.useState)(!1),[E,de]=(0,N.useState)(Le),[pe,he]=(0,N.useState)(!1),[ge,_e]=(0,N.useState)(t),[A,be]=(0,N.useState)(!1),[j,xe]=(0,N.useState)(ze),[M,F]=(0,N.useState)(!1),[I,L]=(0,N.useState)(!1),[R,z]=(0,N.useState)(!1),B=(0,N.useRef)(null),Ce=(0,N.useRef)(null),V=(0,N.useRef)(null),H=(0,N.useRef)(null),U=(0,N.useRef)(null),W=(0,N.useRef)(null),G=(0,N.useRef)(null),K=(0,N.useRef)(null),we=(0,N.useRef)(void 0),Te=(0,N.useRef)(void 0),q=e?.id,J=(0,N.useMemo)(()=>x.find(e=>e.id===C),[C,x]),Ee=J?.mode===`browser`,De=!!(J&&J.mode!==`browser`),Oe=r===`browser`?`files`:r,ke=J?.id,Ae=(0,N.useMemo)(()=>{let e={};for(let t of m)e[t.path]=t;return e},[m]),Pe=(0,N.useMemo)(()=>{let e=new Set;for(let t of m)e.add(t.path),t.oldPath&&e.add(t.oldPath);return e},[m]),X=(0,N.useMemo)(()=>Be(f,b),[b,f]),Q=(0,N.useMemo)(()=>({conflicts:m.filter(e=>e.conflict||e.status===`conflicted`),staged:m.filter(e=>!e.conflict&&e.status!==`untracked`&&e.staged),unstaged:m.filter(e=>!e.conflict&&e.status!==`untracked`&&e.unstaged),untracked:m.filter(e=>!e.conflict&&e.status===`untracked`)}),[m]);(0,N.useEffect)(()=>{if(t){let e=!1;return queueMicrotask(()=>{e||(_e(!0),window.requestAnimationFrame(()=>{e||be(!0)}))}),()=>{e=!0}}let e=!1;queueMicrotask(()=>{e||be(!1)});let n=window.setTimeout(()=>_e(!1),180);return()=>{e=!0,window.clearTimeout(n)}},[t]),(0,N.useEffect)(()=>{if(!ue)return;let e=e=>{Ce.current?.contains(e.target)||T(!1)},t=e=>{e.key===`Escape`&&T(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[ue]),(0,N.useEffect)(()=>{let e=!1;return!t||!s||queueMicrotask(()=>{e||(i(s.tab===`git`?`changes`:`files`),s.filePath&&we.current?.(s.filePath))}),()=>{e=!0}},[s,i,t]),(0,N.useEffect)(()=>{if(!t)return;let e=x.find(e=>e.mode===`browser`);if(r===`browser`){if(!e){let e=Ne(`browser`,``);S(t=>t.some(t=>t.id===e)?t:[...t,{id:e,mode:`browser`,path:``,loading:!1}]),w(e);return}C!==e.id&&w(e.id)}else J?.mode===`browser`&&w(x.find(e=>e.mode!==`browser`)?.id)},[r,t,C,J,x]),(0,N.useEffect)(()=>{try{window.localStorage.setItem(Fe,String(j))}catch{}},[j]);let Ke=(0,N.useCallback)(()=>{xe(e=>e<Z?Z:e)},[]);(0,N.useEffect)(()=>{!A||I||(r===`browser`||r!==`overview`&&ke)&&Ke()},[ke,r,A,I,Ke]),(0,N.useEffect)(()=>{let e=!1;if(!(!q||!t))return queueMicrotask(()=>{e||(oe(!0),ce(void 0),Promise.all([ye(q),fe(q)]).then(([t,n])=>{e||(p(t.tree),h(n.files),_(n.branch),ee(n.counts),ne(n.isGitRepository))}).catch(t=>{e||ce(t instanceof Error?t.message:k(`workspaceLoadFailed`))}).finally(()=>{e||oe(!1)}))}),()=>{e=!0}},[t,q]),(0,N.useEffect)(()=>{let e=Te.current;Te.current=q,!(e===void 0||e===q)&&(S([]),w(void 0))},[q]);function qe(e){if(a){a(e);return}$(e)}async function $(e){if(!q)return;i(`files`);let t=Ne(`file`,e);if(x.some(e=>e.id===t)){w(t);return}let n={id:t,mode:`file`,path:e,loading:!0};S(e=>[...e,n]),w(t);try{let n=await me(q,e);S(e=>e.map(e=>e.id===t?{...e,file:n,loading:!1}:e))}catch(e){S(n=>n.map(n=>n.id===t?{...n,loading:!1,error:e instanceof Error?e.message:k(`workspaceOpenFileFailed`)}:n))}}we.current=$;function Ze(){let e=Ne(`browser`,``);if(x.some(t=>t.id===e)){w(e),i(`browser`);return}let t={id:e,mode:`browser`,path:``,loading:!1};S(e=>[...e,t]),w(e),i(`browser`)}async function Qe(e,t){if(!q)return;t&&i(`changes`);let n=Ne(`diff`,e);if(x.some(e=>e.id===n)){w(n);return}let r={id:n,mode:`diff`,path:e,loading:!0};S(e=>[...e,r]),w(n);try{let t=await ve(q,e);S(e=>e.map(e=>e.id===n?{...e,diff:t,loading:!1}:e))}catch(e){S(t=>t.map(t=>t.id===n?{...t,loading:!1,error:e instanceof Error?e.message:k(`workspaceOpenDiffFailed`)}:t))}}function $e(e){S(t=>{let n=t.findIndex(t=>t.id===e),r=t.filter(t=>t.id!==e);return C===e&&w((r[n]??r[n-1])?.id),r})}async function et(e){await Qe(e,!0)}async function tt(e){await Qe(e,!1)}function nt(e){U.current={startX:e.clientX,startWidth:j,currentWidth:j},K.current={cursor:document.body.style.cursor,userSelect:document.body.style.userSelect},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,F(!0),e.preventDefault();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}function rt(e){let t=U.current,n=B.current;!t||!n||(t.currentWidth=Math.min(Z,Math.max(Y,t.startWidth+t.startX-e.clientX)),W.current===null&&(W.current=window.requestAnimationFrame(()=>{W.current=null;let e=U.current;!e||!B.current||(B.current.style.width=`${e.currentWidth}px`)})))}function it(e){let t=U.current?.currentWidth;U.current=null,W.current!==null&&(window.cancelAnimationFrame(W.current),W.current=null),typeof t==`number`&&(B.current&&(B.current.style.width=`${t}px`),xe(t));let n=K.current;n&&(document.body.style.cursor=n.cursor,document.body.style.userSelect=n.userSelect,K.current=null),F(!1);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}function at(e){V.current={startX:e.clientX,startWidth:E,currentWidth:E},document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,he(!0),e.preventDefault();try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}function ot(e){let t=V.current;t&&(t.currentWidth=Math.min(Re,Math.max(Ie,t.startWidth+e.clientX-t.startX)),H.current===null&&(H.current=window.requestAnimationFrame(()=>{H.current=null;let e=V.current;e&&de(e.currentWidth)})))}function st(e){let t=V.current?.currentWidth;V.current=null,H.current!==null&&(window.cancelAnimationFrame(H.current),H.current=null),typeof t==`number`&&de(t),document.body.style.cursor=``,document.body.style.userSelect=``,he(!1);try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}}let ct=(0,N.useCallback)(()=>{let e=B.current;if(!e){L(e=>!e);return}G.current?.cancel();let t=e.getBoundingClientRect(),n=window.innerWidth,r=Me(),i=window.innerHeight-r,a=`${r}px`,o=`${i}px`,s=`cubic-bezier(0.22, 1, 0.36, 1)`;if(z(!0),!I){window.requestAnimationFrame(()=>{let e=B.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`});G.current=r,r.onfinish=()=>{G.current=null,L(!0),window.requestAnimationFrame(()=>{r.cancel(),e.removeAttribute(`style`),window.requestAnimationFrame(()=>z(!1))})},r.oncancel=()=>{G.current=null,z(!1)}});return}window.requestAnimationFrame(()=>{let e=B.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-j,i=e.animate([{left:`0px`,top:a,width:`${t.width}px`,height:o},{left:`${r}px`,top:a,width:`${j}px`,height:o}],{duration:240,easing:s,fill:`forwards`});G.current=i,i.onfinish=()=>{G.current=null,L(!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=`${j}px`,e.style.minWidth=`${Y}px`,e.style.maxWidth=`${Z}px`,window.requestAnimationFrame(()=>z(!1))})},i.oncancel=()=>{G.current=null,z(!1)}})},[I,j]);return(0,N.useEffect)(()=>{if(!I)return;let e=e=>{e.key===`Escape`&&L(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[I]),(0,N.useEffect)(()=>()=>{W.current!==null&&window.cancelAnimationFrame(W.current),H.current!==null&&window.cancelAnimationFrame(H.current),G.current?.cancel(),B.current&&B.current.removeAttribute(`style`);let e=K.current;e&&(document.body.style.cursor=e.cursor,document.body.style.userSelect=e.userSelect)},[]),ge?(0,P.jsx)(P.Fragment,{children:(0,P.jsxs)(`aside`,{ref:B,className:O(`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`,A?`translate-x-0 opacity-100`:`w-0 min-w-0 max-w-0 translate-x-4 opacity-0`,M?`transition-none`:``,I?`quickforge-workspace-inspector-fullscreen z-40 rounded-none border-l-0`:`lg:rounded-l-2xl`),style:A?I?void 0:{width:j,minWidth:Y,maxWidth:Z}:void 0,children:[A&&!I?(0,P.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":Y,"aria-valuemax":Z,"aria-valuenow":j,className:O(`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`,M?`bg-border/45`:``),onPointerDown:nt,onPointerMove:rt,onPointerUp:it,onPointerCancel:it,children:(0,P.jsx)(`div`,{className:O(`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`,M?`opacity-100`:`group-hover:opacity-100`),children:(0,P.jsx)(ie,{className:`size-3`})})}):null,(0,P.jsxs)(`div`,{className:O(`flex h-14 shrink-0 items-center gap-2 border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] bg-muted/20 px-3 pr-20 transition-opacity duration-150`,R?`opacity-0`:`opacity-100`),children:[(0,P.jsx)(`div`,{ref:Ce,className:`shrink-0`,children:(0,P.jsx)(Ge,{view:r,changesCount:m.length,open:ue,onOpenChange:T,onViewChange:e=>{e===`browser`?Ze():i(e)}})}),(0,P.jsx)(`div`,{className:`h-5 w-px shrink-0 bg-[color-mix(in_oklab,var(--border)_34%,transparent)]`}),(0,P.jsx)(Je,{tabs:x,activeId:C,onSelect:e=>{w(e),x.find(t=>t.id===e)?.mode===`browser`?r!==`browser`&&i(`browser`):r===`browser`&&i(`files`)},onClose:$e}),(0,P.jsx)(D,{variant:`ghost`,size:`icon`,className:`shrink-0`,onClick:ct,"aria-label":k(I?`workspaceExitFullscreen`:`workspaceFullscreen`),title:k(I?`workspaceExitFullscreen`:`workspaceFullscreen`),children:I?(0,P.jsx)(ae,{className:`size-4`}):(0,P.jsx)(d,{className:`size-4`})})]}),(0,P.jsx)(`div`,{className:O(`flex min-h-0 flex-1 transition-opacity duration-150`,R?`opacity-0`:`opacity-100`),children:e?.id?Ee?(0,P.jsx)(Se,{url:c,onUrlChange:l,projectId:e.id}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{className:O(`flex min-h-0 flex-col bg-muted/20`,De?`shrink-0 border-r-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)]`:`flex-1`),style:De?{width:E,minWidth:Ie,maxWidth:Re}:void 0,children:se?(0,P.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:se}):(0,P.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-auto p-2`,children:[y?(0,P.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground/70`,children:k(`workspaceLoading`)}):null,!y&&Oe===`overview`?(0,P.jsx)(Xe,{project:e,artifacts:u,changesCount:m.length,changedPaths:Pe,isGitRepository:te,gitBranch:g,onSelectFile:$,onSelectDiff:tt,onPreviewFile:qe}):null,!y&&Oe===`files`?(0,P.jsxs)(P.Fragment,{children:[(0,P.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,P.jsx)(re,{className:`size-3.5 shrink-0`}),(0,P.jsx)(`input`,{value:b,onChange:e=>le(e.target.value),placeholder:k(`workspaceFilterFiles`),className:`min-w-0 flex-1 bg-transparent text-xs text-foreground/85 outline-none placeholder:text-muted-foreground/50`})]}),(0,P.jsx)(je,{tree:X,selectedPath:void 0,gitStatuses:Ae,onSelectFile:$,onPreviewFile:qe,projectId:q})]}):null,!y&&Oe===`changes`?te?(0,P.jsxs)(`div`,{className:`space-y-3`,children:[m.length===0?(0,P.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground/70`,children:k(`workspaceNoWorkingTreeChanges`)}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(We,{title:k(`workspaceConflicts`),files:Q.conflicts,selectedPath:void 0,onSelectFile:et}),(0,P.jsx)(We,{title:k(`workspaceStagedChanges`),files:Q.staged,selectedPath:void 0,onSelectFile:et}),(0,P.jsx)(We,{title:k(`workspaceChanges`),files:Q.unstaged,selectedPath:void 0,onSelectFile:et}),(0,P.jsx)(We,{title:k(`workspaceUntracked`),files:Q.untracked,selectedPath:void 0,onSelectFile:et})]}),(0,P.jsxs)(`div`,{className:`rounded-lg border border-border bg-muted/10 px-3 py-2`,children:[(0,P.jsx)(`div`,{className:`truncate text-xs font-medium text-foreground/85`,children:Ue(g,v)}),(0,P.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-muted-foreground/60`,children:[(0,P.jsxs)(`span`,{children:[k(`workspaceStaged`),` `,v?.staged??0]}),(0,P.jsxs)(`span`,{children:[k(`workspaceChanges`),` `,v?.unstaged??0]}),(0,P.jsxs)(`span`,{children:[k(`workspaceUntracked`),` `,v?.untracked??0]}),v?.conflicts?(0,P.jsxs)(`span`,{className:`text-red-600 dark:text-red-500`,children:[k(`workspaceConflicts`),` `,v.conflicts]}):null]}),m.length>0&&o?(0,P.jsxs)(`div`,{className:`mt-2 flex gap-1.5`,children:[(0,P.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-medium text-muted-foreground/72 transition-colors hover:bg-muted/20 hover:text-foreground/85`,onClick:()=>o(Ve(m)),children:[(0,P.jsx)(n,{className:`size-3`}),k(`workspaceReview`)]}),(0,P.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 rounded-md px-1.5 py-1 text-[11px] font-medium text-muted-foreground/72 transition-colors hover:bg-muted/20 hover:text-foreground/85`,onClick:()=>o(He(m)),children:[(0,P.jsx)(n,{className:`size-3`}),k(`workspaceCommitMessage`)]})]}):null]})]}):(0,P.jsx)(`div`,{className:`px-2 py-3 text-xs text-muted-foreground/70`,children:k(`workspaceNotGitRepository`)}):null]})}),De?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-valuemin":Ie,"aria-valuemax":Re,"aria-valuenow":E,className:O(`group relative z-10 w-1.5 shrink-0 cursor-col-resize bg-transparent transition-colors`,pe?`bg-primary/30`:`hover:bg-[color-mix(in_oklab,var(--border)_52%,transparent)]`),onPointerDown:at,onPointerMove:ot,onPointerUp:st,onPointerCancel:st}),(0,P.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col bg-background`,children:J?(0,P.jsx)(Ye,{mode:J.mode,file:J.file,diff:J.diff,loading:J.loading,error:J.error,onClose:()=>$e(J.id),onDraftRequest:o}):null})]}):null]}):(0,P.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground/70`,children:k(`workspaceSelectProject`)})})]})}):null}export{Ze as WorkspaceInspector};