@shawnstack/quickforge 1.5.6 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +450 -450
- package/dist/assets/{AgentProfilesPage-DFUA4KiP.js → AgentProfilesPage-wpt1cJV0.js} +1 -1
- package/dist/assets/{ChatPanelHost-CBoFtBvB.js → ChatPanelHost-CnQoAfxW.js} +2 -2
- package/dist/assets/{PluginsPage-CKOP-P02.js → PluginsPage-0wwQydcP.js} +1 -1
- package/dist/assets/ScheduledTasksPage-qGHyGkjw.js +2 -0
- package/dist/assets/{SettingsWorkspacePage-Csr6xu0M.js → SettingsWorkspacePage-CeYg_VJl.js} +306 -306
- package/dist/assets/{SharedConversationPage-7I9MiMcj.js → SharedConversationPage-D97o9Ycp.js} +1 -1
- package/dist/assets/TerminalDock-D4zLoahb.js +2 -0
- package/dist/assets/WorkspaceInspector-Bn-am8g6.js +3 -0
- package/dist/assets/{WorkspaceReaderDialog-Dli8GgAq.js → WorkspaceReaderDialog-B2WEMVuF.js} +1 -1
- package/dist/assets/{diff-line-counts-Dvz3MNk2.js → diff-line-counts-B60LmPZX.js} +1 -1
- package/dist/assets/{icons-DXrzz0RO.js → icons-BlAm_pUr.js} +1 -1
- package/dist/assets/{index-BDNDRaPf.css → index-C3bhHGO4.css} +1 -1
- package/dist/assets/index-C_DXqhW8.js +69 -0
- package/dist/assets/{mcp-servers-dialog-DXR3fnZY.js → mcp-servers-dialog-DEyq3gmP.js} +3 -3
- package/dist/assets/{monaco-k8av2MY0.js → monaco-C5Lhy6-h.js} +1 -1
- package/dist/assets/{react-vendor-xMa3TUTb.js → react-vendor--m65aOgw.js} +1 -1
- package/dist/assets/{skills-dialog-Dax-_Ze5.js → skills-dialog-CZ3CuVtQ.js} +1 -1
- package/dist/assets/{useAppTheme-BzB8Q6AC.js → useAppTheme-ChXh3B2c.js} +1 -1
- package/dist/index.html +6 -6
- package/package.json +4 -1
- package/dist/assets/ScheduledTasksPage-CRPvyfmE.js +0 -2
- package/dist/assets/TerminalDock-DWZAOy7v.js +0 -2
- package/dist/assets/WorkspaceInspector-D4k8zQ4s.js +0 -3
- package/dist/assets/index-BIslkXQt.js +0 -69
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{L as t,Mt as n,T as r,a as i,h as a,tt as o,v as s,x as c,y as l}from"./icons-BlAm_pUr.js";import{n as u}from"./react-vendor--m65aOgw.js";import{$ as d,M as f,Q as p,et as m,it as h,m as g}from"./index-C_DXqhW8.js";var _=e(n(),1),v=u();function y(e){return e===`connected`?`bg-emerald-500/12 text-emerald-700 dark:text-emerald-300`:e===`error`?`bg-destructive/12 text-destructive`:e===`disabled`?`bg-muted text-muted-foreground`:`bg-amber-500/12 text-amber-700 dark:text-amber-300`}var b=12;function x({server:e,toggling:n,reconnecting:a,onToggle:o,onEdit:c,onDelete:l,onReconnect:u}){let f=e.tools?.slice(0,b)??[],p=e.toolCount??e.tools?.length??0,g=Math.max(0,p-f.length),_=e.enabled&&e.status!==`connected`;return(0,v.jsxs)(`div`,{className:`rounded-lg border border-border p-3`,children:[(0,v.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,v.jsxs)(`div`,{className:`min-w-0`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground/90`,children:e.name}),(0,v.jsx)(`span`,{className:m(`rounded-full px-2 py-0.5 text-[11px]`,y(e.status)),children:e.status||`unknown`}),(0,v.jsx)(`span`,{className:`text-[11px] text-muted-foreground/60`,children:h(`mcpToolsCount`,{count:p})})]}),(0,v.jsx)(`div`,{className:`mt-1 truncate text-xs text-muted-foreground/65`,children:e.transport===`stdio`?`${e.command} ${(e.args||[]).join(` `)}`:e.url}),e.error?(0,v.jsx)(`div`,{className:`mt-1 text-xs text-destructive`,children:e.error}):null]}),(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,v.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabled,disabled:n,className:m(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,e.enabled?`bg-emerald-500`:`bg-muted-foreground/30`),onClick:()=>o(e),title:e.enabled?h(`pauseTask`):h(`enable`),children:(0,v.jsx)(`span`,{className:m(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,e.enabled?`translate-x-5`:`translate-x-0`)})}),_?(0,v.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-muted-foreground`,onClick:()=>u(e.name),disabled:a,"aria-label":h(`mcpReconnectServer`),title:h(`mcpReconnectServer`),children:a?(0,v.jsx)(t,{className:`size-4 animate-spin`}):(0,v.jsx)(s,{className:`size-4`})}):null,(0,v.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-muted-foreground`,onClick:()=>c(e),"aria-label":h(`editTask`),title:h(`editTask`),children:(0,v.jsx)(r,{className:`size-4`})}),(0,v.jsx)(d,{type:`button`,variant:`ghost`,size:`icon`,className:`size-8 text-destructive`,onClick:()=>l(e.name),"aria-label":h(`delete`),title:h(`delete`),children:(0,v.jsx)(i,{className:`size-4`})})]})]}),f.length>0?(0,v.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[f.map(e=>(0,v.jsx)(`span`,{className:`rounded-md bg-muted/28 px-1.5 py-0.5 text-[11px] text-muted-foreground/75`,title:e.quickForgeName,children:e.name},e.quickForgeName)),g>0?(0,v.jsx)(`span`,{className:`rounded-md px-1.5 py-0.5 text-[11px] text-muted-foreground/55`,children:h(`mcpMoreTools`,{count:g})}):null]}):null]})}function S(){return{name:``,transport:`stdio`,command:``,args:[],url:``,cwd:``,env:{}}}function ee(e){return{name:e.name,transport:e.transport,command:e.command,args:e.args||[],url:e.url||``,cwd:e.cwd||``,env:e.env||{}}}function C(e){return(e||[]).join(`
|
|
2
2
|
`)}function w(e){return Object.entries(e||{}).map(([e,t])=>`${e}=${t}`).join(`
|
|
3
3
|
`)}function T(e){return e.split(`
|
|
4
4
|
`).map(e=>e.trim()).filter(Boolean)}function E(e){let t={};for(let n of e.split(`
|
|
5
|
-
`)){let e=n.trim();if(!e)continue;let r=e.indexOf(`=`);if(r<=0)continue;let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();i&&(t[i]=a)}return t}function D(e){let t={type:e.transport||`stdio`};e.transport===`stdio`?(t.command=e.command||``,t.args=e.args||[],e.cwd&&(t.cwd=e.cwd),e.env&&Object.keys(e.env).length>0&&(t.env=e.env)):(t.url=e.url||``,e.env&&Object.keys(e.env).length>0&&(t.headers=e.env));let n=e.name||`server`;return JSON.stringify({mcpServers:{[n]:t}},null,2)}function O(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function te(e){let t;try{t=JSON.parse(e)}catch{throw Error(h(`mcpInvalidJson`))}if(!O(t))throw Error(h(`mcpInvalidConfigJson`));let n=``,r=null;if(O(t.mcpServers)){let e=Object.entries(t.mcpServers);if(e.length===0)throw Error(h(`mcpEmptyConfigJson`));let[i,a]=e[0];n=i,O(a)&&(r=a)}else r=t;if(!r)throw Error(h(`mcpInvalidConfigJson`));let i=String(r.transport||r.type||`stdio`);if(![`stdio`,`http`,`sse`].includes(i))throw Error(h(`mcpInvalidTransport`,{name:n||`server`}));let a=r.env??r.headers??{};return{name:n,transport:i,command:String(r.command||``),args:Array.isArray(r.args)?r.args:[],url:String(r.url||``),cwd:String(r.cwd||``),env:O(a)?a:{}}}var k=`mb-1 block text-xs text-muted-foreground/72`,A=`min-h-20 w-full resize-y rounded-md border border-input bg-background px-2 py-1.5 font-mono text-xs text-foreground outline-none focus:border-ring`,j=`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm outline-none focus:border-ring`;function M({value:e,onChange:t,isEdit:n,disabled:r}){let i=e.transport===`stdio`,a=n=>t({...e,...n});return(0,v.jsxs)(`div`,{className:`space-y-3 p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground/60`,children:h(n?`mcpEditServer`:`mcpAddServer`)}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-name`,children:h(`mcpServerName`)}),(0,v.jsx)(g,{id:`mcp-server-name`,value:e.name,onChange:e=>a({name:e.target.value}),placeholder:h(`mcpNamePlaceholder`),disabled:n||r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-transport`,children:h(`mcpTransport`)}),(0,v.jsxs)(`select`,{id:`mcp-server-transport`,className:j,value:e.transport,onChange:e=>a({transport:e.target.value}),disabled:r,children:[(0,v.jsx)(`option`,{value:`stdio`,children:`stdio`}),(0,v.jsx)(`option`,{value:`http`,children:`http`}),(0,v.jsx)(`option`,{value:`sse`,children:`sse`})]})]}),i?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-command`,children:h(`mcpCommand`)}),(0,v.jsx)(g,{id:`mcp-server-command`,value:e.command,onChange:e=>a({command:e.target.value}),placeholder:h(`mcpCommandPlaceholder`),disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-args`,children:h(`mcpArgs`)}),(0,v.jsx)(`textarea`,{id:`mcp-server-args`,className:A,value:C(e.args),onChange:e=>a({args:T(e.target.value)}),spellCheck:!1,disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-cwd`,children:h(`mcpCwd`)}),(0,v.jsx)(g,{id:`mcp-server-cwd`,value:e.cwd,onChange:e=>a({cwd:e.target.value}),disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-env`,children:h(`mcpEnv`)}),(0,v.jsx)(`textarea`,{id:`mcp-server-env`,className:A,value:w(e.env),onChange:e=>a({env:E(e.target.value)}),spellCheck:!1,disabled:r})]})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-url`,children:h(`mcpUrl`)}),(0,v.jsx)(g,{id:`mcp-server-url`,value:e.url,onChange:e=>a({url:e.target.value}),placeholder:h(`mcpUrlPlaceholder`),disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-headers`,children:h(`mcpHeaders`)}),(0,v.jsx)(`textarea`,{id:`mcp-server-headers`,className:A,value:w(e.env),onChange:e=>a({env:E(e.target.value)}),spellCheck:!1,disabled:r})]})]})]})}function N({configText:e,onConfigTextChange:
|
|
5
|
+
`)){let e=n.trim();if(!e)continue;let r=e.indexOf(`=`);if(r<=0)continue;let i=e.slice(0,r).trim(),a=e.slice(r+1).trim();i&&(t[i]=a)}return t}function D(e){let t={type:e.transport||`stdio`};e.transport===`stdio`?(t.command=e.command||``,t.args=e.args||[],e.cwd&&(t.cwd=e.cwd),e.env&&Object.keys(e.env).length>0&&(t.env=e.env)):(t.url=e.url||``,e.env&&Object.keys(e.env).length>0&&(t.headers=e.env));let n=e.name||`server`;return JSON.stringify({mcpServers:{[n]:t}},null,2)}function O(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function te(e){let t;try{t=JSON.parse(e)}catch{throw Error(h(`mcpInvalidJson`))}if(!O(t))throw Error(h(`mcpInvalidConfigJson`));let n=``,r=null;if(O(t.mcpServers)){let e=Object.entries(t.mcpServers);if(e.length===0)throw Error(h(`mcpEmptyConfigJson`));let[i,a]=e[0];n=i,O(a)&&(r=a)}else r=t;if(!r)throw Error(h(`mcpInvalidConfigJson`));let i=String(r.transport||r.type||`stdio`);if(![`stdio`,`http`,`sse`].includes(i))throw Error(h(`mcpInvalidTransport`,{name:n||`server`}));let a=r.env??r.headers??{};return{name:n,transport:i,command:String(r.command||``),args:Array.isArray(r.args)?r.args:[],url:String(r.url||``),cwd:String(r.cwd||``),env:O(a)?a:{}}}var k=`mb-1 block text-xs text-muted-foreground/72`,A=`min-h-20 w-full resize-y rounded-md border border-input bg-background px-2 py-1.5 font-mono text-xs text-foreground outline-none focus:border-ring`,j=`flex h-9 w-full rounded-md border border-input bg-transparent px-3 text-sm outline-none focus:border-ring`;function M({value:e,onChange:t,isEdit:n,disabled:r}){let i=e.transport===`stdio`,a=n=>t({...e,...n});return(0,v.jsxs)(`div`,{className:`space-y-3 p-3`,children:[(0,v.jsx)(`div`,{className:`text-xs text-muted-foreground/60`,children:h(n?`mcpEditServer`:`mcpAddServer`)}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-name`,children:h(`mcpServerName`)}),(0,v.jsx)(g,{id:`mcp-server-name`,value:e.name,onChange:e=>a({name:e.target.value}),placeholder:h(`mcpNamePlaceholder`),disabled:n||r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-transport`,children:h(`mcpTransport`)}),(0,v.jsxs)(`select`,{id:`mcp-server-transport`,className:j,value:e.transport,onChange:e=>a({transport:e.target.value}),disabled:r,children:[(0,v.jsx)(`option`,{value:`stdio`,children:`stdio`}),(0,v.jsx)(`option`,{value:`http`,children:`http`}),(0,v.jsx)(`option`,{value:`sse`,children:`sse`})]})]}),i?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-command`,children:h(`mcpCommand`)}),(0,v.jsx)(g,{id:`mcp-server-command`,value:e.command,onChange:e=>a({command:e.target.value}),placeholder:h(`mcpCommandPlaceholder`),disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-args`,children:h(`mcpArgs`)}),(0,v.jsx)(`textarea`,{id:`mcp-server-args`,className:A,value:C(e.args),onChange:e=>a({args:T(e.target.value)}),spellCheck:!1,disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-cwd`,children:h(`mcpCwd`)}),(0,v.jsx)(g,{id:`mcp-server-cwd`,value:e.cwd,onChange:e=>a({cwd:e.target.value}),disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-env`,children:h(`mcpEnv`)}),(0,v.jsx)(`textarea`,{id:`mcp-server-env`,className:A,value:w(e.env),onChange:e=>a({env:E(e.target.value)}),spellCheck:!1,disabled:r})]})]}):(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-url`,children:h(`mcpUrl`)}),(0,v.jsx)(g,{id:`mcp-server-url`,value:e.url,onChange:e=>a({url:e.target.value}),placeholder:h(`mcpUrlPlaceholder`),disabled:r})]}),(0,v.jsxs)(`div`,{children:[(0,v.jsx)(`label`,{className:k,htmlFor:`mcp-server-headers`,children:h(`mcpHeaders`)}),(0,v.jsx)(`textarea`,{id:`mcp-server-headers`,className:A,value:w(e.env),onChange:e=>a({env:E(e.target.value)}),spellCheck:!1,disabled:r})]})]})]})}function N({configText:e,onConfigTextChange:n,onImport:r,onUseExample:i,saving:a}){return(0,v.jsxs)(`div`,{className:`space-y-3 p-3`,children:[(0,v.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 text-xs font-medium text-foreground/90`,children:[h(`mcpImportConfig`),(0,v.jsx)(p,{label:h(`mcpImportConfigDescription`)})]}),(0,v.jsx)(`textarea`,{className:`min-h-96 w-full resize-y rounded-md border border-input bg-background px-2 py-1.5 font-mono text-xs text-foreground outline-none focus:border-ring`,value:e,onChange:e=>n(e.target.value),spellCheck:!1}),(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsx)(d,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,disabled:a,children:h(`mcpUseExample`)}),(0,v.jsxs)(`div`,{className:`flex gap-2`,children:[(0,v.jsxs)(d,{type:`button`,size:`sm`,onClick:()=>r(`merge`),disabled:a||!e.trim(),children:[a?(0,v.jsx)(t,{className:`mr-1.5 size-3.5 animate-spin`}):(0,v.jsx)(c,{className:`mr-1.5 size-3.5`}),h(`mcpImportUpdate`)]}),(0,v.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>r(`replace`),disabled:a||!e.trim(),children:h(`mcpReplaceAll`)})]})]})]})}var P=`{
|
|
6
6
|
"mcpServers": {
|
|
7
7
|
"zai-mcp-server": {
|
|
8
8
|
"type": "stdio",
|
|
@@ -17,4 +17,4 @@ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{$ as t,At as n,I as r,
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
}`;async function F(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`HTTP ${e.status}`);return t}function I(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function ne(e){let t;try{t=JSON.parse(e)}catch{throw Error(h(`mcpInvalidJson`))}if(!I(t)||!I(t.mcpServers))throw Error(h(`mcpInvalidConfigJson`));let n=Object.entries(t.mcpServers);if(n.length===0)throw Error(h(`mcpEmptyConfigJson`));for(let[e,t]of n){if(!/^(?!.*--)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(e))throw Error(h(`mcpInvalidServerName`,{name:e}));if(!I(t))throw Error(h(`mcpInvalidServerConfig`,{name:e}));let n=String(t.transport||t.type||`stdio`);if(![`stdio`,`http`,`sse`].includes(n))throw Error(h(`mcpInvalidTransport`,{name:e}));if(n===`stdio`&&typeof t.command!=`string`)throw Error(h(`mcpMissingCommand`,{name:e}));if(n!==`stdio`&&typeof t.url!=`string`)throw Error(h(`mcpMissingUrl`,{name:e}));if(t.args!==void 0&&!Array.isArray(t.args))throw Error(h(`mcpArgsMustBeArray`,{name:e}));if(t.env!==void 0&&!I(t.env))throw Error(h(`mcpEnvMustBeObject`,{name:e}));if(t.headers!==void 0&&!I(t.headers))throw Error(h(`mcpHeadersMustBeObject`,{name:e}))}return t}function L({active:e=!0,className:n}){let[i
|
|
20
|
+
}`;async function F(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`HTTP ${e.status}`);return t}function I(e){return!!(e&&typeof e==`object`&&!Array.isArray(e))}function ne(e){let t;try{t=JSON.parse(e)}catch{throw Error(h(`mcpInvalidJson`))}if(!I(t)||!I(t.mcpServers))throw Error(h(`mcpInvalidConfigJson`));let n=Object.entries(t.mcpServers);if(n.length===0)throw Error(h(`mcpEmptyConfigJson`));for(let[e,t]of n){if(!/^(?!.*--)[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/.test(e))throw Error(h(`mcpInvalidServerName`,{name:e}));if(!I(t))throw Error(h(`mcpInvalidServerConfig`,{name:e}));let n=String(t.transport||t.type||`stdio`);if(![`stdio`,`http`,`sse`].includes(n))throw Error(h(`mcpInvalidTransport`,{name:e}));if(n===`stdio`&&typeof t.command!=`string`)throw Error(h(`mcpMissingCommand`,{name:e}));if(n!==`stdio`&&typeof t.url!=`string`)throw Error(h(`mcpMissingUrl`,{name:e}));if(t.args!==void 0&&!Array.isArray(t.args))throw Error(h(`mcpArgsMustBeArray`,{name:e}));if(t.env!==void 0&&!I(t.env))throw Error(h(`mcpEnvMustBeObject`,{name:e}));if(t.headers!==void 0&&!I(t.headers))throw Error(h(`mcpHeadersMustBeObject`,{name:e}))}return t}function L({active:e=!0,className:n}){let[r,i]=(0,_.useState)([]),[s,u]=(0,_.useState)(P),[g,y]=(0,_.useState)(!1),[b,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(!1),[E,O]=(0,_.useState)(new Set),[k,A]=(0,_.useState)(null),[j,I]=(0,_.useState)(``),[L,R]=(0,_.useState)(!1),[z,B]=(0,_.useState)(null),[V,H]=(0,_.useState)(S),[U,W]=(0,_.useState)(`form`),[G,K]=(0,_.useState)(``),[q,J]=(0,_.useState)(``),Y=(0,_.useCallback)(e=>{i(e?.servers??[])},[]),X=(0,_.useCallback)(async()=>{y(!0),I(``);try{Y(await F(await fetch(`/api/mcp/servers`)))}catch(e){I(e instanceof Error?e.message:h(`mcpLoadFailed`))}finally{y(!1)}},[Y]);if((0,_.useEffect)(()=>{if(!e)return;let t=window.setTimeout(()=>{X()},0);return()=>window.clearTimeout(t)},[e,X]),!e)return null;let Z=e=>{e===`json`&&(K(D(V)),J(``)),W(e)},re=()=>{B(null),H(S()),W(`form`),R(!0),I(``)},ie=e=>{let t=ee(e);B(e),H(t),K(D(t)),J(``),W(`form`),R(!0),I(``)},Q=()=>{R(!1),B(null),K(``),J(``),I(``)},ae=e=>{H(e)},oe=e=>{K(e);try{let t=te(e);H(e=>({...t,name:t.name||e.name})),J(``)}catch(e){J(e instanceof Error?e.message:h(`mcpInvalidJson`))}},se=async e=>{if(!w&&!(e===`replace`&&!await f({description:h(`mcpReplaceConfirm`),confirmLabel:h(`mcpReplaceAll`),cancelLabel:h(`cancel`)}))){T(!0),I(``);try{let t=ne(s);Y(await F(await fetch(`/api/mcp/config`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({mode:e,...t})})))}catch(e){I(e instanceof Error?e.message:h(`mcpSaveFailed`))}finally{T(!1)}}},ce=async()=>{if(!b){if(q&&U===`json`){I(q);return}C(!0),I(``);try{Y(await F(await fetch(`/api/mcp/servers`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({server:{...V,enabled:z?.enabled??!0}})}))),Q()}catch(e){I(e instanceof Error?e.message:h(`mcpSaveFailed`))}finally{C(!1)}}},le=async e=>{if(await f({description:h(`mcpDeleteConfirm`,{name:e}),confirmLabel:h(`confirmDelete`),cancelLabel:h(`cancel`),variant:`destructive`})){I(``);try{Y(await F(await fetch(`/api/mcp/servers/${encodeURIComponent(e)}`,{method:`DELETE`})))}catch(e){I(e instanceof Error?e.message:h(`mcpDeleteFailed`))}}},ue=async e=>{if(!E.has(e.name)){O(t=>new Set(t).add(e.name)),I(``);try{Y(await F(await fetch(`/api/mcp/servers/${encodeURIComponent(e.name)}/enabled`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})})))}catch(e){I(e instanceof Error?e.message:h(`mcpSaveFailed`))}finally{O(t=>{let n=new Set(t);return n.delete(e.name),n})}}},de=async()=>{y(!0),I(``);try{Y(await F(await fetch(`/api/mcp/reconnect`,{method:`POST`})))}catch(e){I(e instanceof Error?e.message:h(`mcpReconnectFailed`))}finally{y(!1)}},fe=async e=>{if(!k){A(e),I(``);try{Y(await F(await fetch(`/api/mcp/reconnect/${encodeURIComponent(e)}`,{method:`POST`})))}catch(e){I(e instanceof Error?e.message:h(`mcpReconnectFailed`))}finally{A(null)}}},$=!!z,pe=!!V.name.trim()&&!!(V.transport===`stdio`?V.command.trim():V.url.trim());return(0,v.jsxs)(`div`,{className:m(`flex h-full min-h-0 flex-col overflow-hidden bg-background`,n),children:[j?(0,v.jsx)(`div`,{className:`m-4 mb-0 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:j}):null,(0,v.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:(0,v.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_26rem]`,children:[(0,v.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,v.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,v.jsx)(`h3`,{className:`text-sm font-medium text-foreground/90`,children:h(`mcpConfiguredServers`)}),(0,v.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,v.jsxs)(d,{type:`button`,variant:`ghost`,size:`sm`,onClick:re,disabled:L&&!$,children:[(0,v.jsx)(c,{className:`mr-1.5 size-3.5`}),h(`mcpAddServer`)]}),(0,v.jsxs)(d,{type:`button`,variant:`ghost`,size:`sm`,onClick:de,disabled:g,children:[g?(0,v.jsx)(t,{className:`mr-1.5 size-3.5 animate-spin`}):(0,v.jsx)(l,{className:`mr-1.5 size-3.5`}),h(`mcpReconnect`)]})]})]}),g&&r.length===0?(0,v.jsxs)(`div`,{className:`flex items-center justify-center gap-2 rounded-lg border border-border py-8 text-sm text-muted-foreground`,children:[(0,v.jsx)(t,{className:`size-4 animate-spin`}),h(`loading`)]}):r.length===0?(0,v.jsx)(`div`,{className:`rounded-lg border border-border bg-muted/15 p-4 text-sm text-muted-foreground/72`,children:h(`mcpNoServersDescription`)}):r.map(e=>(0,v.jsx)(x,{server:e,toggling:E.has(e.name),reconnecting:k===e.name,onToggle:e=>{ue(e)},onEdit:ie,onDelete:e=>{le(e)},onReconnect:e=>{fe(e)}},e.name))]}),(0,v.jsx)(`div`,{className:`flex min-h-0 flex-col rounded-lg border border-border`,children:L?(0,v.jsxs)(v.Fragment,{children:[(0,v.jsxs)(`div`,{className:`flex border-b border-border`,children:[(0,v.jsxs)(`button`,{type:`button`,onClick:()=>Z(`form`),className:m(`flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-xs font-medium transition-colors`,U===`form`?`border-b-2 border-primary text-foreground/90 -mb-px`:`text-muted-foreground/60 hover:text-foreground/85`),children:[(0,v.jsx)(a,{className:`size-3.5`}),h(`mcpTabServer`)]}),(0,v.jsxs)(`button`,{type:`button`,onClick:()=>Z(`json`),className:m(`flex flex-1 items-center justify-center gap-1.5 px-3 py-2.5 text-xs font-medium transition-colors`,U===`json`?`border-b-2 border-primary text-foreground/90 -mb-px`:`text-muted-foreground/60 hover:text-foreground/85`),children:[(0,v.jsx)(o,{className:`size-3.5`}),h(`mcpTabJson`)]})]}),(0,v.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:U===`form`?(0,v.jsx)(M,{value:V,onChange:ae,isEdit:$,disabled:b}):(0,v.jsxs)(`div`,{className:`space-y-2 p-3`,children:[(0,v.jsx)(`textarea`,{className:`min-h-96 w-full resize-y rounded-md border border-input bg-background px-2 py-1.5 font-mono text-xs text-foreground outline-none focus:border-ring`,value:G,onChange:e=>oe(e.target.value),spellCheck:!1}),q?(0,v.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,children:q}):null,(0,v.jsxs)(`div`,{className:`inline-flex items-center gap-1.5 text-[11px] font-medium text-foreground/90`,children:[h(`mcpTabJson`),(0,v.jsx)(p,{label:h(`mcpImportConfigDescription`)})]})]})}),(0,v.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border p-3`,children:[(0,v.jsx)(d,{type:`button`,variant:`outline`,size:`sm`,onClick:Q,disabled:b,children:h(`cancel`)}),(0,v.jsxs)(d,{type:`button`,size:`sm`,onClick:()=>{ce()},disabled:b||!pe,children:[b?(0,v.jsx)(t,{className:`mr-1.5 size-3.5 animate-spin`}):null,h(`save`)]})]})]}):(0,v.jsx)(N,{configText:s,onConfigTextChange:u,onImport:e=>{se(e)},onUseExample:()=>{u(P),I(``)},saving:w})})]})})]})}export{L as McpServersPanel};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Mt as t}from"./icons-BlAm_pUr.js";function n(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function r(e){if(Array.isArray(e))return e}function i(e,t,n){return(t=p(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function o(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?s(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t){if(e==null)return{};var n,r,i=u(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function u(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function d(e,t){return r(e)||a(e,t)||m(e,t)||o()}function f(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function p(e){var t=f(e,`string`);return typeof t==`symbol`?t:t+``}function m(e,t){if(e){if(typeof e==`string`)return n(e,t);var r={}.toString.call(e).slice(8,-1);return r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`?Array.from(e):r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}}function h(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?g(Object(n),!0).forEach(function(t){h(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(){var e=[...arguments];return function(t){return e.reduceRight(function(e,t){return t(e)},t)}}function y(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function b(e){return{}.toString.call(e).includes(`Object`)}function x(e){return!Object.keys(e).length}function S(e){return typeof e==`function`}function C(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function w(e,t){return b(t)||k(`changeType`),Object.keys(t).some(function(t){return!C(e,t)})&&k(`changeField`),t}function T(e){S(e)||k(`selectorType`)}function E(e){S(e)||b(e)||k(`handlerType`),b(e)&&Object.values(e).some(function(e){return!S(e)})&&k(`handlersType`)}function D(e){e||k(`initialIsRequired`),b(e)||k(`initialType`),x(e)&&k(`initialContent`)}function O(e,t){throw Error(e[t]||e.default)}var k=y(O)({initialIsRequired:`initial state is required`,initialType:`initial state should be an object`,initialContent:`initial state shouldn't be an empty object`,handlerType:`handler should be an object or a function`,handlersType:`all handlers should be a functions`,selectorType:`selector should be a function`,changeType:`provided value of changes should be an object`,changeField:`it seams you want to change a field in the state which is not specified in the "initial" state`,default:"an unknown error accured in `state-local` package"}),A={changes:w,selector:T,handler:E,initial:D};function j(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};A.initial(e),A.handler(t);var n={current:e},r=y(P)(n,t),i=y(N)(n),a=y(A.changes)(e),o=y(M)(n);function s(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(e){return e};return A.selector(e),e(n.current)}function c(e){v(r,i,a,o)(e)}return[s,c]}function M(e,t){return S(t)?t(e.current):t}function N(e,t){return e.current=_(_({},e.current),t),t}function P(e,t,n){return S(t)?t(e.current):Object.keys(n).forEach(function(n){return t[n]?.call(t,e.current[n])}),n}var F={create:j},I={paths:{vs:`https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs`}};function ee(e){return function t(){var n=this,r=[...arguments];return r.length>=e.length?e.apply(this,r):function(){var e=[...arguments];return t.apply(n,[].concat(r,e))}}}function te(e){return{}.toString.call(e).includes(`Object`)}function ne(e){return e||R(`configIsRequired`),te(e)||R(`configType`),e.urls?(re(),{paths:{vs:e.urls.monacoBase}}):e}function re(){console.warn(L.deprecation)}function ie(e,t){throw Error(e[t]||e.default)}var L={configIsRequired:`the configuration object is required`,configType:`the configuration object should be an object`,default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
3
3
|
You are using deprecated way of configuration.
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t}from"./icons-DXrzz0RO.js";var n=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,ee=5,w=-1;function T(){return g?!0:!(e.unstable_now()-w<ee)}function E(){if(g=!1,S){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,k=O.port2;O.port1.onmessage=E,D=function(){k.postMessage(null)}}else D=function(){_(E,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),r=e(((e,t)=>{t.exports=n()})),i=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),a=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=e((e=>{var n=r(),i=t(),o=a();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},I=[],L=-1;function re(e){return{current:e}}function R(e){0>L||(e.current=I[L],I[L]=null,L--)}function z(e,t){L++,I[L]=e.current,e.current=t}var B=re(null),ie=re(null),ae=re(null),oe=re(null);function se(e,t){switch(z(ae,t),z(ie,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function ce(){R(B),R(ie),R(ae)}function V(e){e.memoizedState!==null&&z(oe,e);var t=B.current,n=Hd(t,e.type);t!==n&&(z(ie,e),z(B,n))}function le(e){ie.current===e&&(R(B),R(ie)),oe.current===e&&(R(oe),Qf._currentValue=ne)}var H,ue;function de(e){if(H===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||``,ue=-1<e.stack.indexOf(`
|
|
1
|
+
import{t as e}from"./rolldown-runtime-DWdDZTNf.js";import{Mt as t}from"./icons-BlAm_pUr.js";var n=e((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,D());else{var t=n(l);t!==null&&A(x,t.startTime-e)}}var S=!1,C=-1,ee=5,w=-1;function T(){return g?!0:!(e.unstable_now()-w<ee)}function E(){if(g=!1,S){var t=e.unstable_now();w=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&T());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&A(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?D():S=!1}}}var D;if(typeof y==`function`)D=function(){y(E)};else if(typeof MessageChannel<`u`){var O=new MessageChannel,k=O.port2;O.port1.onmessage=E,D=function(){k.postMessage(null)}}else D=function(){_(E,0)};function A(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):ee=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,A(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,D()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),r=e(((e,t)=>{t.exports=n()})),i=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.5`})),a=e(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=i()})),o=e((e=>{var n=r(),i=t(),o=a();function s(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function c(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function l(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function u(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function f(e){if(l(e)!==e)throw Error(s(188))}function p(e){var t=e.alternate;if(!t){if(t=l(e),t===null)throw Error(s(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return f(i),e;if(a===r)return f(i),t;a=a.sibling}throw Error(s(188))}if(n.return!==r.return)n=i,r=a;else{for(var o=!1,c=i.child;c;){if(c===n){o=!0,n=i,r=a;break}if(c===r){o=!0,r=i,n=a;break}c=c.sibling}if(!o){for(c=a.child;c;){if(c===n){o=!0,n=a,r=i;break}if(c===r){o=!0,r=a,n=i;break}c=c.sibling}if(!o)throw Error(s(189))}}if(n.alternate!==r)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var h=Object.assign,g=Symbol.for(`react.element`),_=Symbol.for(`react.transitional.element`),v=Symbol.for(`react.portal`),y=Symbol.for(`react.fragment`),b=Symbol.for(`react.strict_mode`),x=Symbol.for(`react.profiler`),S=Symbol.for(`react.consumer`),C=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function te(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var j=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===j?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case y:return`Fragment`;case x:return`Profiler`;case b:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case v:return`Portal`;case C:return e.displayName||`Context`;case S:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ne={pending:!1,data:null,method:null,action:null},I=[],L=-1;function re(e){return{current:e}}function R(e){0>L||(e.current=I[L],I[L]=null,L--)}function z(e,t){L++,I[L]=e.current,e.current=t}var B=re(null),ie=re(null),ae=re(null),oe=re(null);function se(e,t){switch(z(ae,t),z(ie,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function ce(){R(B),R(ie),R(ae)}function V(e){e.memoizedState!==null&&z(oe,e);var t=B.current,n=Hd(t,e.type);t!==n&&(z(ie,e),z(B,n))}function le(e){ie.current===e&&(R(B),R(ie)),oe.current===e&&(R(oe),Qf._currentValue=ne)}var H,ue;function de(e){if(H===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);H=t&&t[1]||``,ue=-1<e.stack.indexOf(`
|
|
2
2
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
3
3
|
`+H+e+ue}var fe=!1;function pe(e,t){if(!e||fe)return``;fe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,`props`,{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,`name`,{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
4
4
|
`),l=s.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t}from"./rolldown-runtime-DWdDZTNf.js";import{
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-DWdDZTNf.js";import{Ct as n,L as r,Mt as i,Ot as a,g as o,xt as s}from"./icons-BlAm_pUr.js";import{n as c}from"./react-vendor--m65aOgw.js";import{$ as l,Q as u,et as d,it as f}from"./index-C_DXqhW8.js";var p=t({SkillsDialog:()=>v,SkillsManagerPanel:()=>_}),m=e(i(),1),h=c();async function g(e){let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||`HTTP ${e.status}`);return t}function _({active:e=!0,scope:t,project:i,embedded:c=!1,closeOnSave:p=!1,onClose:_,onSaved:v}){let[y,b]=(0,m.useState)([]),[x,S]=(0,m.useState)(()=>new Set),[C,w]=(0,m.useState)(``),[T,E]=(0,m.useState)([]),[D,O]=(0,m.useState)(!1),[k,A]=(0,m.useState)(!1),[j,M]=(0,m.useState)(``),N=t===`project`,[P,F]=(0,m.useState)(null),[I,L]=(0,m.useState)(null),[R,z]=(0,m.useState)(!1),[B,V]=(0,m.useState)(``),H=(0,m.useCallback)(()=>{F(null),L(null),V(``)},[]),U=(0,m.useCallback)(()=>{H(),_?.()},[_,H]);(0,m.useEffect)(()=>{if(!e||N&&!i)return;let t=!1;return(async()=>{O(!0),M(``);try{let e=N?`/api/skills?projectId=${encodeURIComponent(i.id)}`:`/api/skills?scope=global`,n=await g(await fetch(e));if(t)return;b(Array.isArray(n.skills)?n.skills:[]),S(new Set(Array.isArray(n.selectedSkills)?n.selectedSkills:[])),E(Array.isArray(n.searchPaths)?n.searchPaths:[])}catch(e){t||M(e instanceof Error?e.message:f(`failedToLoadSkills`))}finally{t||O(!1)}})(),()=>{t=!0}},[e,i,N]),(0,m.useEffect)(()=>{if(!e||c)return;let t=e=>{e.key===`Escape`&&(P?H():k||U())};return document.addEventListener(`keydown`,t),()=>document.removeEventListener(`keydown`,t)},[e,U,c,k,P,H]);let W=(0,m.useMemo)(()=>{let e=C.trim().toLowerCase();return e?y.filter(t=>[t.name,t.displayName,t.description,t.source,t.compatibility,t.allowedTools,...t.tags??[],...t.triggers??[]].filter(Boolean).join(` `).toLowerCase().includes(e)):y},[C,y]),G=async e=>{F(e),L(null),V(``),z(!0);try{let t=new URLSearchParams({name:e});N&&i?(t.set(`scope`,`project`),t.set(`projectId`,i.id)):t.set(`scope`,`global`),L(await g(await fetch(`/api/skills/content?${t}`)))}catch(e){V(e instanceof Error?e.message:f(`failedToReadSkill`))}finally{z(!1)}},K=()=>{H()};if(!e||N&&!i)return null;let q=e=>{S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},J=async()=>{if(!k){A(!0),M(``);try{let e=await g(await fetch(N?`/api/skills/project`:`/api/skills/global`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(N?{projectId:i.id,selectedSkills:[...x]}:{selectedSkills:[...x]})}));v({scope:t,project:N?e.projects?.find(e=>e.id===i.id)??{...i,skills:e.selectedSkills}:void 0,projects:e.projects,selectedSkills:e.selectedSkills}),p&&U()}catch(e){M(e instanceof Error?e.message:f(`failedToSaveSkills`))}finally{A(!1)}}},Y=f(N?`projectSkills`:`globalSkills`),X=N?f(`projectSkillsDescription`,{project:i.name}):f(`globalSkillsDescription`),Z=!!P;return(0,h.jsx)(`div`,{className:c?`flex h-full min-h-0 flex-col`:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onClick:e=>{!c&&e.target===e.currentTarget&&!k&&U()},children:(0,h.jsxs)(`div`,{className:c?`flex h-full min-h-0 flex-col overflow-hidden bg-background`:`flex max-h-[85vh] w-full max-w-2xl flex-col rounded-lg border border-border bg-background shadow-quickforge`,children:[(0,h.jsx)(`div`,{className:`border-b border-border p-4`,children:Z?(0,h.jsxs)(`button`,{type:`button`,className:`flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors`,onClick:K,children:[(0,h.jsx)(s,{className:`size-4`}),f(`backToSkillList`)]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5 text-base font-semibold text-foreground`,children:[Y,(0,h.jsx)(u,{label:X})]}),T.length?(0,h.jsxs)(`p`,{className:`mt-2 break-all text-xs text-muted-foreground/65`,children:[f(`skillSearchPaths`),`: `,T.join(` · `)]}):null]})}),(0,h.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4`,children:Z?R?(0,h.jsxs)(`div`,{className:`flex items-center justify-center gap-2 py-8 text-sm text-muted-foreground`,children:[(0,h.jsx)(r,{className:`size-4 animate-spin`}),f(`loading`)]}):B?(0,h.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:B}):I?(0,h.jsxs)(`div`,{className:`space-y-3`,children:[(0,h.jsxs)(`div`,{className:`rounded-md border border-border px-3 py-2 text-sm space-y-1`,children:[(0,h.jsxs)(`div`,{className:`font-medium text-foreground/90`,children:[I.displayName||I.name,I.version?(0,h.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`v`,I.version]}):null]}),I.description?(0,h.jsx)(`div`,{className:`text-muted-foreground/70`,children:I.description}):null,(0,h.jsxs)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-0.5 text-xs text-muted-foreground/60`,children:[I.source?(0,h.jsx)(`span`,{children:I.source}):null,I.compatibility?(0,h.jsxs)(`span`,{children:[`· `,I.compatibility]}):null,I.allowedTools?(0,h.jsxs)(`span`,{children:[`· `,I.allowedTools]}):null,I.license?(0,h.jsxs)(`span`,{children:[`· `,I.license]}):null]}),I.tags?.length?(0,h.jsx)(`div`,{className:`flex flex-wrap gap-1 pt-1`,children:I.tags.map(e=>(0,h.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground`,children:e},e))}):null,I.triggers?.length?(0,h.jsxs)(`div`,{className:`text-xs text-muted-foreground/60`,children:[`Triggers: `,I.triggers.join(`, `)]}):null]}),I.instructions?(0,h.jsx)(`pre`,{className:`whitespace-pre-wrap break-words rounded-md border border-border bg-muted/30 px-4 py-3 text-sm leading-6 text-foreground/80 font-mono`,children:I.instructions}):(0,h.jsx)(`div`,{className:`py-4 text-center text-sm text-muted-foreground`,children:f(`noSkillContent`)})]}):null:(0,h.jsxs)(`div`,{className:`space-y-3`,children:[(0,h.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-input bg-background px-3 py-2`,children:[(0,h.jsx)(o,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,h.jsx)(`input`,{value:C,onChange:e=>w(e.target.value),placeholder:f(`searchSkills`),className:`min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground/45`,disabled:D||k})]}),j?(0,h.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:j}):null,(0,h.jsxs)(`div`,{className:`rounded-md border border-border`,children:[(0,h.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border px-3 py-2 text-xs text-muted-foreground`,children:[(0,h.jsx)(`span`,{children:f(`availableSkills`)}),(0,h.jsx)(`span`,{children:f(`selectedSkillsCount`,{count:x.size})})]}),(0,h.jsx)(`div`,{className:c?`min-h-0 flex-1 overflow-y-auto p-1`:`max-h-[46vh] overflow-y-auto p-1`,children:D?(0,h.jsxs)(`div`,{className:`flex items-center justify-center gap-2 px-3 py-8 text-sm text-muted-foreground`,children:[(0,h.jsx)(r,{className:`size-4 animate-spin`}),f(`loading`)]}):W.length===0?(0,h.jsx)(`div`,{className:`px-3 py-8 text-center text-sm text-muted-foreground`,children:f(`noMatchingSkills`)}):W.map(e=>{let t=x.has(e.name);return(0,h.jsxs)(`div`,{className:d(`flex w-full items-start gap-3 rounded-md px-3 py-3 text-left text-sm transition-colors hover:bg-muted/28 disabled:opacity-50`,t&&`bg-muted/28`),children:[(0,h.jsx)(`button`,{type:`button`,className:d(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded border border-input`,t&&`border-primary bg-primary text-primary-foreground`),onClick:()=>q(e.name),disabled:k,"aria-label":t?`Deselect ${e.name}`:`Select ${e.name}`,children:t?(0,h.jsx)(n,{className:`size-3.5`}):null}),(0,h.jsxs)(`span`,{className:`min-w-0 flex-1 cursor-pointer`,onClick:()=>q(e.name),children:[(0,h.jsx)(`span`,{className:`block truncate font-medium text-foreground/90`,children:e.displayName||e.name}),e.description?(0,h.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-muted-foreground/70`,children:e.description}):null,(0,h.jsxs)(`span`,{className:`mt-1 flex flex-wrap gap-1 text-[11px] text-muted-foreground/60`,children:[e.source?(0,h.jsx)(`span`,{children:e.source}):null,e.compatibility?(0,h.jsxs)(`span`,{children:[`· `,e.compatibility]}):null,e.allowedTools?(0,h.jsxs)(`span`,{children:[`· `,e.allowedTools]}):null]}),e.tags?.length?(0,h.jsx)(`span`,{className:`mt-2 flex flex-wrap gap-1`,children:e.tags.slice(0,5).map(e=>(0,h.jsx)(`span`,{className:`rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground`,children:e},e))}):null]}),(0,h.jsx)(`button`,{type:`button`,className:`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-md text-muted-foreground/60 transition-colors hover:bg-muted/28 hover:text-foreground`,onClick:()=>void G(e.name),disabled:k||R,title:f(`readSkill`),"aria-label":`${f(`readSkill`)}: ${e.displayName||e.name}`,children:(0,h.jsx)(a,{className:`size-4`})})]},e.name)})})]})]})}),Z?null:(0,h.jsxs)(`div`,{className:`flex justify-end gap-2 border-t border-border p-4`,children:[c?null:(0,h.jsx)(l,{type:`button`,variant:`outline`,onClick:U,disabled:k,children:f(`cancel`)}),(0,h.jsx)(l,{type:`button`,onClick:J,disabled:D||k,children:f(k?`saving`:`save`)})]})]})})}function v({open:e,scope:t,project:n,onOpenChange:r,onSaved:i}){return(0,h.jsx)(_,{active:e,scope:t,project:n,closeOnSave:!0,onClose:()=>r(!1),onSaved:i})}export{p as n,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{Mt as t}from"./icons-BlAm_pUr.js";import{y as n}from"./index-C_DXqhW8.js";var r=e(t(),1);function i(){let[e,t]=(0,r.useState)(()=>n());return(0,r.useEffect)(()=>{if(typeof document>`u`)return;let e=document.documentElement,r=()=>t(n());r();let i=new MutationObserver(r);return i.observe(e,{attributes:!0,attributeFilter:[`class`]}),()=>i.disconnect()},[]),e}export{i as t};
|
package/dist/index.html
CHANGED
|
@@ -11,18 +11,18 @@
|
|
|
11
11
|
<meta name="apple-mobile-web-app-title" content="QuickForge" />
|
|
12
12
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
|
13
13
|
<title>速构 QuickForge</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-C_DXqhW8.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-DWdDZTNf.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/pi-ai-Cx633yhb.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/lit-vendor-Dr3cpBGF.js">
|
|
18
18
|
<link rel="modulepreload" crossorigin href="/assets/pi-web-ui-DFNE2m5b.js">
|
|
19
19
|
<link rel="modulepreload" crossorigin href="/assets/css-utils-rkE68RDy.js">
|
|
20
|
-
<link rel="modulepreload" crossorigin href="/assets/icons-
|
|
21
|
-
<link rel="modulepreload" crossorigin href="/assets/react-vendor
|
|
20
|
+
<link rel="modulepreload" crossorigin href="/assets/icons-BlAm_pUr.js">
|
|
21
|
+
<link rel="modulepreload" crossorigin href="/assets/react-vendor--m65aOgw.js">
|
|
22
22
|
<link rel="modulepreload" crossorigin href="/assets/logger-B65Akg8A.js">
|
|
23
|
-
<link rel="modulepreload" crossorigin href="/assets/index-
|
|
24
|
-
<link rel="modulepreload" crossorigin href="/assets/skills-dialog-
|
|
25
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
23
|
+
<link rel="modulepreload" crossorigin href="/assets/index-C_DXqhW8.js">
|
|
24
|
+
<link rel="modulepreload" crossorigin href="/assets/skills-dialog-CZ3CuVtQ.js">
|
|
25
|
+
<link rel="stylesheet" crossorigin href="/assets/index-C3bhHGO4.css">
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
|
28
28
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shawnstack/quickforge",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.2",
|
|
4
4
|
"description": "AI chat application with Agent access modes for local workspace tools. React + Vite + Tailwind CSS frontend, local Node.js storage server.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
"url": "https://github.com/shawnstack/quickforge/issues"
|
|
28
28
|
},
|
|
29
29
|
"homepage": "https://github.com/shawnstack/quickforge#readme",
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=22.19.0"
|
|
32
|
+
},
|
|
30
33
|
"type": "module",
|
|
31
34
|
"main": "./server/public-api.mjs",
|
|
32
35
|
"bin": {
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{At as t,Ct as n,H as r,T as i,Tt as ee,a as te,c as ne,dt as re,g as ie,n as ae,pt as oe,rt as se,t as ce,tt as le,wt as ue}from"./icons-DXrzz0RO.js";import{n as a}from"./react-vendor-xMa3TUTb.js";import{$ as o,G as de,H as fe,K as pe,M as me,Q as s,U as he,W as ge,et as c,it as l}from"./index-BIslkXQt.js";var u=e(t(),1),d=a(),_e=[{value:`off`,label:()=>l(`thinkingOff`)},{value:`low`,label:()=>l(`thinkingLow`)},{value:`medium`,label:()=>l(`thinkingMedium`)},{value:`high`,label:()=>l(`thinkingHigh`)},{value:`xhigh`,label:()=>l(`thinkingXHigh`)}];function ve(e){return`${e.provider} / ${e.id}`}function ye(e,t){return!!(e&&t&&e.api===t.api&&e.provider===t.provider&&e.id===t.id)}function f(e){return String(e).padStart(2,`0`)}function p(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:`${t.getFullYear()}-${f(t.getMonth()+1)}-${f(t.getDate())} ${f(t.getHours())}:${f(t.getMinutes())}`}function be(e,t=20){let n=String(e||``).trim();return n.length>t?`${n.slice(0,t)}...`:n}function m(){return{scheduleText:``,title:``,instruction:``,cronExpression:``,scheduleRule:``,nextRunAt:``,enabled:!0,agentId:``,executionMode:`serial`}}function h(){return{taskId:``,status:``,trigger:``,keyword:``,startedFrom:``,startedTo:``,page:1,pageSize:10}}function xe(e){return{scheduleText:[e.scheduleRule,e.instruction].filter(Boolean).join(`
|
|
2
|
-
`),title:e.title,instruction:e.instruction,cronExpression:e.cronExpression??``,scheduleRule:e.scheduleRule,nextRunAt:e.nextRunAt,enabled:e.status!==`paused`,agentId:e.agentId??``,executionMode:e.executionMode??`serial`}}function Se(e,t){return{...t,title:e.title,instruction:e.instruction,cronExpression:e.cronExpression??``,scheduleRule:e.scheduleRule,nextRunAt:e.nextRunAt,enabled:t.enabled}}function Ce(e){return{title:e.title.trim(),instruction:e.instruction.trim(),scheduleType:`cron`,scheduleRule:e.scheduleRule.trim()||e.cronExpression.trim(),cronExpression:e.cronExpression.trim(),nextRunAt:e.nextRunAt,enabled:e.enabled,agentId:e.agentId||null,executionMode:e.executionMode}}function g(e){return!!(e.currentRunId||e.currentRunIds?.length)}function we(e){return(e.executionMode??`serial`)===`parallel`||!g(e)}function Te(e){return l(e===`parallel`?`taskExecutionModeParallel`:`taskExecutionModeSerial`)}function Ee(e){return!!(e.title.trim()&&e.instruction.trim()&&e.cronExpression.trim())}function De(e){return l(e===`enabled`?`taskEnabled`:e===`running`?`taskRunning`:e===`paused`?`taskPaused`:e===`completed`?`taskFinished`:e===`success`?`executionSuccess`:`taskFailed`)}function Oe(e){return e===`enabled`||e===`success`?`bg-emerald-500/10 text-emerald-700`:e===`running`?`bg-blue-500/10 text-blue-700`:e===`paused`?`bg-amber-500/10 text-amber-700`:`bg-muted text-muted-foreground`}async function _(e,t){let n=await fetch(e,{...t,headers:{"content-type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`请求失败`);return r}function v({onOpenSession:e}){let[t,a]=(0,u.useState)([]),[f,v]=(0,u.useState)(`tasks`),[y,b]=(0,u.useState)(()=>m()),[x,ke]=(0,u.useState)(null),[S,C]=(0,u.useState)(null),[w,T]=(0,u.useState)(null),[Ae,E]=(0,u.useState)(!1),[D,O]=(0,u.useState)(null),[je,k]=(0,u.useState)(``),[A,j]=(0,u.useState)(!1),[M,N]=(0,u.useState)(``),[P,Me]=(0,u.useState)([]),[F,I]=(0,u.useState)(),[L,R]=(0,u.useState)(`off`),[z,Ne]=(0,u.useState)([]),[Pe,B]=(0,u.useState)(``),[V,H]=(0,u.useState)(()=>h()),[U,W]=(0,u.useState)(()=>h()),[G,Fe]=(0,u.useState)({runs:[],total:0,page:1,pageSize:10}),[Ie,Le]=(0,u.useState)(!1),[Re,ze]=(0,u.useState)(null),[Be,Ve]=(0,u.useState)([]),He=z[0]?.id??``;(0,u.useEffect)(()=>{if(!w)return;let e=()=>T(null);return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e)}},[w]);async function Ue(){a((await _(`/api/scheduled-tasks`)).tasks)}async function K(e=U){Le(!0),N(``);try{let t=new URLSearchParams;t.set(`page`,String(e.page)),t.set(`pageSize`,String(e.pageSize)),e.taskId&&t.set(`taskId`,e.taskId),e.status&&t.set(`status`,e.status),e.trigger&&t.set(`trigger`,e.trigger),e.keyword.trim()&&t.set(`keyword`,e.keyword.trim()),e.startedFrom&&t.set(`startedFrom`,e.startedFrom),e.startedTo&&t.set(`startedTo`,e.startedTo),Fe(await _(`/api/scheduled-tasks/runs?${t.toString()}`))}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}finally{Le(!1)}}(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await _(`/api/project`);if(e)return;Ne(t.projects??[])}catch{}}return t(),()=>{e=!0}},[]),(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await ge(),n=await he(t),r=await de(t),i=r.model??await pe(t)??n[0];if(e)return;Me(n),I(i),R(r.thinkingLevel??fe(i))}catch(t){e||N(t instanceof Error?t.message:l(`requestFailed`))}}return t(),()=>{e=!0}},[]),(0,u.useEffect)(()=>{let e=!1,t=async()=>{try{let t=await _(`/api/scheduled-tasks`);e||a(t.tasks)}catch(t){e||N(t instanceof Error?t.message:l(`requestFailed`))}};t();let n=window.setInterval(t,10*1e3);return()=>{e=!0,window.clearInterval(n)}},[]),(0,u.useEffect)(()=>{let e=!1;async function t(){try{let t=await _(`/api/agent-profiles`);if(e)return;Ve(t.agents)}catch(t){e||N(t instanceof Error?t.message:l(`requestFailed`))}}return t(),()=>{e=!0}},[]);let We=(0,u.useMemo)(()=>t.find(e=>e.id===x),[x,t]),q=(0,u.useMemo)(()=>t.find(e=>e.id===S)??null,[S,t]),Ge=(0,u.useMemo)(()=>t.filter(e=>e.status===`enabled`).length,[t]),J=Math.max(1,Math.ceil(G.total/G.pageSize));function Y(e){return e?Be.find(t=>t.id===e||t.name===e)?.label??e:l(`defaultAgent`)}function X(e,t){b(n=>({...n,[e]:t}))}function Z(e,t){H(n=>({...n,[e]:t}))}function Ke(){ke(null),B(He),b(m()),O(null),k(``),N(``)}function qe(){Ke(),E(!0)}function Q(){A||(E(!1),Ke())}function Je(){let e={...V,page:1};H(e),W(e),K(e)}function Ye(){let e=h();H(e),W(e),K(e)}function Xe(e){let t=Math.min(Math.max(1,e),J),n={...U,page:t};H(n),W(n),K(n)}function Ze(e){let t={...U,page:1,pageSize:e};H(t),W(t),K(t)}async function Qe(){let e=y.scheduleText.trim();if(e){j(!0),N(``);try{let t=await _(`/api/scheduled-tasks/parse`,{method:`POST`,body:JSON.stringify({instruction:e,model:F,thinkingLevel:L})});if(t.needMoreInfo||!t.task){k(t.question||`请补充任务信息。`),O(null);return}let n=t.task;k(``),O(n),b(e=>Se(n,e))}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}finally{j(!1)}}}async function $e(){if(Ee(y)){j(!0),N(``);try{let e=z.find(e=>e.id===Pe),t={task:Ce(y),model:F,thinkingLevel:L,projectId:e?.id,projectName:e?.name};x?await _(`/api/scheduled-tasks/${encodeURIComponent(x)}`,{method:`PUT`,body:JSON.stringify(t)}):await _(`/api/scheduled-tasks`,{method:`POST`,body:JSON.stringify(t)}),Q(),await Ue(),f===`history`&&await K(U)}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}finally{j(!1)}}}function et(e){T(null),ke(e.id),b(xe(e)),O(null),k(``),N(``),B(e.projectId??``),e.model&&I(e.model),e.thinkingLevel&&R(e.thinkingLevel),E(!0)}async function $(e,t){if(N(``),T(null),!(t===`delete`&&!await me({description:l(`confirmDeleteTask`),confirmLabel:l(`confirmDelete`),cancelLabel:l(`cancel`),variant:`destructive`})))try{t===`delete`?(await _(`/api/scheduled-tasks/${encodeURIComponent(e)}`,{method:`DELETE`}),x===e&&Q(),S===e&&C(null)):await _(`/api/scheduled-tasks/${encodeURIComponent(e)}/${t}`,{method:`POST`}),await Ue(),f===`history`&&await K(U)}catch(e){N(e instanceof Error?e.message:l(`requestFailed`))}}function tt(t){return(0,d.jsxs)(`div`,{className:`mt-2 space-y-2 text-xs text-muted-foreground`,children:[t.sessionId?(0,d.jsx)(o,{variant:`outline`,size:`sm`,onClick:()=>e?.(t.sessionId),children:l(`viewConversation`)}):null,(0,d.jsxs)(`div`,{children:[l(`executionAgent`),t.agentLabel||Y(t.agentId)]}),t.warning?(0,d.jsx)(`div`,{className:`text-amber-600`,children:t.warning}):null,t.inputContent?(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`font-medium text-foreground`,children:l(`runInputContent`)}),(0,d.jsx)(`pre`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap`,children:t.inputContent})]}):null,t.aiResult||t.result?(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`font-medium text-foreground`,children:l(`runAiResult`)}),(0,d.jsx)(`pre`,{className:`mt-1 max-h-48 overflow-auto whitespace-pre-wrap`,children:t.aiResult||t.result})]}):null,t.errorMessage?(0,d.jsx)(`div`,{className:`text-destructive`,children:t.errorMessage}):null,t.durationMs?(0,d.jsxs)(`div`,{children:[l(`runDuration`),t.durationMs,`ms`]}):null]})}return(0,d.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden bg-background`,children:[(0,d.jsxs)(`div`,{className:`border-b border-border px-6 py-5`,children:[(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,d.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-2xl bg-primary/10 text-primary`,children:(0,d.jsx)(n,{className:`size-5`})}),(0,d.jsx)(`div`,{children:(0,d.jsxs)(`h1`,{className:`inline-flex items-center gap-1.5 text-lg font-semibold text-foreground`,children:[l(`scheduledTasks`),(0,d.jsx)(s,{label:l(`scheduledTasksDescription`)})]})})]}),(0,d.jsx)(o,{onClick:qe,children:l(`createTask`)})]}),(0,d.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,d.jsxs)(`button`,{type:`button`,className:c(`rounded-full px-4 py-2 text-sm font-medium transition-colors`,f===`tasks`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),onClick:()=>v(`tasks`),children:[l(`taskListTab`),` `,(0,d.jsx)(`span`,{className:`opacity-80`,children:t.length})]}),(0,d.jsx)(`button`,{type:`button`,className:c(`rounded-full px-4 py-2 text-sm font-medium transition-colors`,f===`history`?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:text-foreground`),onClick:()=>{v(`history`),K(U)},children:l(`executionHistoryTab`)})]})]}),(0,d.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-6`,children:(0,d.jsxs)(`div`,{className:`mx-auto max-w-5xl space-y-5`,children:[M&&!Ae?(0,d.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:M}):null,f===`tasks`?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:(0,d.jsx)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:l(`taskList`)}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l(`tasksCount`,{total:t.length,enabled:Ge})})]})})}),(0,d.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:t.length===0?(0,d.jsx)(`div`,{className:`rounded-lg px-3 py-3 text-center text-xs text-muted-foreground/55 md:col-span-2`,children:l(`noScheduledTasks`)}):t.map(e=>{let t=e.status===`enabled`,n=e.status===`completed`,r=g(e);return(0,d.jsxs)(`div`,{className:`relative cursor-pointer rounded-xl border border-border bg-card p-4 transition-colors hover:bg-muted/15`,onClick:()=>C(e.id),children:[(0,d.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,d.jsxs)(`div`,{className:`min-w-0`,children:[(0,d.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,d.jsx)(`h3`,{className:`truncate text-sm font-medium text-foreground/90`,children:e.title})}),(0,d.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:be(e.instruction,20)})]}),(0,d.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,onClick:e=>e.stopPropagation(),children:[(0,d.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,disabled:n,className:c(`relative h-6 w-11 rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-60`,t?`bg-emerald-500`:`bg-muted-foreground/30`),onClick:()=>void $(e.id,e.status===`paused`?`resume`:`pause`),title:e.status===`paused`?l(`enable`):l(`pauseTask`),children:(0,d.jsx)(`span`,{className:c(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow transition-transform`,t?`translate-x-5`:`translate-x-0`)})}),(0,d.jsxs)(`div`,{className:`relative`,children:[(0,d.jsx)(o,{variant:`ghost`,size:`icon`,onClick:()=>T(w===e.id?null:e.id),title:l(`moreActions`),children:(0,d.jsx)(se,{className:`size-4`})}),w===e.id?(0,d.jsxs)(`div`,{className:`absolute right-0 z-20 mt-1 w-36 overflow-hidden rounded-xl border border-border bg-popover py-1 text-sm shadow-quickforge`,children:[(0,d.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:!we(e),onClick:()=>void $(e.id,`run`),children:[(0,d.jsx)(ce,{className:`size-3.5`}),l(`executeNow`)]}),(0,d.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:r,onClick:()=>et(e),children:[(0,d.jsx)(i,{className:`size-3.5`}),l(`editTask`)]}),(0,d.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted`,onClick:()=>{T(null),C(e.id)},children:[(0,d.jsx)(le,{className:`size-3.5`}),l(`viewDetails`)]}),(0,d.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left text-destructive hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,disabled:r,onClick:()=>void $(e.id,`delete`),children:[(0,d.jsx)(te,{className:`size-3.5`}),l(`deleteTask`)]})]}):null]})]})]}),(0,d.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,d.jsx)(re,{className:`size-3`}),e.scheduleRule]}),(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,d.jsx)(ee,{className:`size-3`}),Y(e.agentId)]}),(0,d.jsxs)(`span`,{children:[l(`taskExecutionMode`),`:`,Te(e.executionMode)]}),e.projectName?(0,d.jsxs)(`span`,{children:[l(`taskProject`),e.projectName]}):null]}),(0,d.jsxs)(`div`,{className:`mt-4 grid gap-2 border-t border-border pt-3 text-xs text-muted-foreground sm:grid-cols-2`,children:[(0,d.jsxs)(`span`,{children:[l(`lastExecution`),p(e.lastRunAt)]}),(0,d.jsxs)(`span`,{children:[l(`nextExecution`),p(e.nextRunAt)]})]})]},e.id)})})]}):(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-card p-4`,children:[(0,d.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,d.jsx)(ie,{className:`size-4`}),l(`historyFilters`)]}),(0,d.jsxs)(`div`,{className:`grid gap-3 md:grid-cols-3`,children:[(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`taskName`),(0,d.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.taskId,onChange:e=>Z(`taskId`,e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:l(`allTasks`)}),t.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.title},e.id))]})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`status`),(0,d.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.status,onChange:e=>Z(`status`,e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:l(`allStatuses`)}),(0,d.jsx)(`option`,{value:`running`,children:l(`executionRunning`)}),(0,d.jsx)(`option`,{value:`success`,children:l(`executionSuccess`)}),(0,d.jsx)(`option`,{value:`failed`,children:l(`taskFailed`)})]})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`triggerType`),(0,d.jsxs)(`select`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.trigger,onChange:e=>Z(`trigger`,e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:l(`allTriggers`)}),(0,d.jsx)(`option`,{value:`schedule`,children:l(`autoRun`)}),(0,d.jsx)(`option`,{value:`manual`,children:l(`manualRun`)})]})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`startTime`),(0,d.jsx)(`input`,{type:`datetime-local`,className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.startedFrom,onChange:e=>Z(`startedFrom`,e.target.value)})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`endTime`),(0,d.jsx)(`input`,{type:`datetime-local`,className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.startedTo,onChange:e=>Z(`startedTo`,e.target.value)})]}),(0,d.jsxs)(`label`,{className:`block text-xs font-medium text-muted-foreground`,children:[l(`keyword`),(0,d.jsx)(`input`,{className:`mt-1 h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground`,value:V.keyword,onChange:e=>Z(`keyword`,e.target.value),placeholder:l(`keywordPlaceholder`)})]})]}),(0,d.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,d.jsx)(o,{variant:`outline`,onClick:Ye,children:l(`reset`)}),(0,d.jsx)(o,{onClick:Je,children:l(`query`)})]})]}),(0,d.jsxs)(`div`,{className:`overflow-hidden rounded-xl border border-border bg-card`,children:[(0,d.jsxs)(`div`,{className:`grid grid-cols-[1.3fr_0.7fr_0.7fr_1fr_0.7fr] gap-3 border-b border-border px-4 py-3 text-xs font-medium text-muted-foreground`,children:[(0,d.jsx)(`span`,{children:l(`taskName`)}),(0,d.jsx)(`span`,{children:l(`status`)}),(0,d.jsx)(`span`,{children:l(`triggerType`)}),(0,d.jsx)(`span`,{children:l(`startTime`)}),(0,d.jsx)(`span`,{children:l(`runDuration`)})]}),Ie?(0,d.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:l(`loading`)}):G.runs.length===0?(0,d.jsx)(`div`,{className:`p-8 text-center text-sm text-muted-foreground`,children:l(`noExecutionHistory`)}):G.runs.map(e=>(0,d.jsxs)(`div`,{className:`border-b border-border last:border-b-0`,children:[(0,d.jsxs)(`button`,{type:`button`,className:`grid w-full grid-cols-[1.3fr_0.7fr_0.7fr_1fr_0.7fr] gap-3 px-4 py-3 text-left text-sm hover:bg-muted/40`,onClick:()=>ze(Re===e.id?null:e.id),children:[(0,d.jsx)(`span`,{className:`min-w-0 truncate text-foreground`,children:e.taskTitle}),(0,d.jsx)(`span`,{children:(0,d.jsx)(`span`,{className:c(`rounded-full px-2 py-0.5 text-xs`,Oe(e.status)),children:De(e.status)})}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:e.trigger===`manual`?l(`manualRun`):l(`autoRun`)}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:p(e.startedAt)}),(0,d.jsx)(`span`,{className:`text-muted-foreground`,children:e.durationMs?`${e.durationMs}ms`:`-`})]}),Re===e.id?(0,d.jsx)(`div`,{className:`border-t border-border bg-muted/20 px-4 py-3`,children:tt(e)}):null]},`${e.taskId}:${e.id}`)),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3 text-sm text-muted-foreground`,children:[(0,d.jsx)(`span`,{children:l(`paginationSummary`,{page:G.page,pages:J,total:G.total})}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,d.jsx)(`select`,{className:`h-8 rounded-md border border-input bg-background px-2 text-sm`,value:G.pageSize,onChange:e=>Ze(Number(e.target.value)),children:[10,20,50,100].map(e=>(0,d.jsx)(`option`,{value:e,children:l(`pageSize`,{size:e})},e))}),(0,d.jsx)(o,{variant:`outline`,size:`sm`,disabled:G.page<=1,onClick:()=>Xe(G.page-1),children:l(`previousPage`)}),(0,d.jsx)(o,{variant:`outline`,size:`sm`,disabled:G.page>=J,onClick:()=>Xe(G.page+1),children:l(`nextPage`)})]})]})]})]})]})}),q?(0,d.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onMouseDown:e=>{e.target===e.currentTarget&&C(null)},children:(0,d.jsxs)(`div`,{className:`flex max-h-[90vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-quickforge`,onMouseDown:e=>e.stopPropagation(),children:[(0,d.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-border px-5 py-4`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,d.jsx)(`h2`,{className:`text-base font-semibold text-foreground`,children:q.title})}),(0,d.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:q.scheduleRule})]}),(0,d.jsx)(o,{variant:`ghost`,size:`icon`,onClick:()=>C(null),children:(0,d.jsx)(ae,{className:`size-4`})})]}),(0,d.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`space-y-4 text-sm`,children:[(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`mb-1 font-medium text-foreground`,children:l(`taskContent`)}),(0,d.jsx)(`pre`,{className:`max-h-48 overflow-auto whitespace-pre-wrap rounded-xl border border-border bg-muted/20 p-3 text-muted-foreground`,children:q.instruction})]}),(0,d.jsxs)(`div`,{className:`grid gap-3 text-muted-foreground sm:grid-cols-2`,children:[(0,d.jsxs)(`div`,{children:[l(`executionRule`),(0,d.jsx)(`span`,{className:`text-foreground`,children:q.scheduleRule})]}),(0,d.jsxs)(`div`,{children:[l(`taskExecutionMode`),`:`,(0,d.jsx)(`span`,{className:`text-foreground`,children:Te(q.executionMode)})]}),(0,d.jsxs)(`div`,{children:[`cron:`,(0,d.jsx)(`span`,{className:`font-mono text-foreground`,children:q.cronExpression??`-`})]}),(0,d.jsxs)(`div`,{children:[l(`lastExecution`),(0,d.jsx)(`span`,{className:`text-foreground`,children:p(q.lastRunAt)})]}),(0,d.jsxs)(`div`,{children:[l(`nextExecution`),(0,d.jsx)(`span`,{className:`text-foreground`,children:p(q.nextRunAt)})]}),(0,d.jsxs)(`div`,{children:[l(`executionAgent`),(0,d.jsx)(`span`,{className:`text-foreground`,children:Y(q.agentId)})]}),q.projectName?(0,d.jsxs)(`div`,{children:[l(`taskProject`),(0,d.jsx)(`span`,{className:`text-foreground`,children:q.projectName})]}):null,q.model?(0,d.jsxs)(`div`,{children:[l(`taskModel`),`:`,(0,d.jsx)(`span`,{className:`text-foreground`,children:ve(q.model)})]}):null,q.thinkingLevel?(0,d.jsxs)(`div`,{children:[l(`taskThinkingLevel`),(0,d.jsx)(`span`,{className:`text-foreground`,children:_e.find(e=>e.value===q.thinkingLevel)?.label()??q.thinkingLevel})]}):null,(0,d.jsxs)(`div`,{children:[l(`createdAt`),`:`,(0,d.jsx)(`span`,{className:`text-foreground`,children:p(q.createdAt)})]})]}),q.runs?.length>0?(0,d.jsxs)(`div`,{children:[(0,d.jsx)(`div`,{className:`mb-2 font-medium text-foreground`,children:l(`recentExecutions`)}),(0,d.jsx)(`div`,{className:`space-y-2`,children:q.runs.slice(0,5).map(e=>(0,d.jsxs)(`details`,{className:`rounded-lg border border-border bg-muted/20 p-2 text-xs text-muted-foreground`,children:[(0,d.jsxs)(`summary`,{className:`cursor-pointer text-foreground`,children:[p(e.startedAt),` · `,e.trigger===`manual`?l(`manualRun`):l(`autoRun`),` · `,De(e.status)]}),tt(e)]},e.id))})]}):null]})}),(0,d.jsx)(`div`,{className:`shrink-0 border-t border-border px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[q.lastSessionId?(0,d.jsx)(o,{variant:`outline`,onClick:()=>e?.(q.lastSessionId),children:l(`viewConversation`)}):null,(0,d.jsxs)(o,{variant:`outline`,disabled:!we(q),onClick:()=>void $(q.id,`run`),children:[(0,d.jsx)(ce,{className:`mr-1 size-3.5`}),l(`executeNow`)]}),(0,d.jsxs)(o,{variant:`outline`,disabled:g(q),onClick:()=>et(q),children:[(0,d.jsx)(i,{className:`mr-1 size-3.5`}),l(`editTask`)]}),(0,d.jsxs)(o,{variant:`destructive`,disabled:g(q),onClick:()=>void $(q.id,`delete`),children:[(0,d.jsx)(te,{className:`mr-1 size-3.5`}),l(`deleteTask`)]})]})})]})}):null,Ae?(0,d.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4`,onMouseDown:e=>{e.target===e.currentTarget&&Q()},children:(0,d.jsxs)(`div`,{className:`flex max-h-[90vh] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-border bg-background shadow-quickforge`,onMouseDown:e=>e.stopPropagation(),children:[(0,d.jsx)(`div`,{className:`shrink-0 border-b border-border px-5 py-4`,children:(0,d.jsxs)(`h2`,{className:`inline-flex items-center gap-1.5 text-base font-semibold text-foreground`,children:[l(We?`editTask`:`createTask`),(0,d.jsx)(s,{label:l(`quickAiParseTask`)})]})}),(0,d.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`space-y-4`,children:[(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[l(`taskScheduleDescriptionLabel`),(0,d.jsx)(`textarea`,{className:`mt-1 min-h-24 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground/65 focus:border-ring`,value:y.scheduleText,onChange:e=>X(`scheduleText`,e.target.value),placeholder:l(`taskScheduleDescriptionPlaceholder`)})]}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,d.jsxs)(o,{onClick:Qe,disabled:A||!F||!y.scheduleText.trim(),children:[(0,d.jsx)(ne,{className:`mr-1 size-3.5`}),l(`aiParseTask`)]}),je?(0,d.jsx)(`span`,{className:`text-sm text-amber-600`,children:je}):null]}),(0,d.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[l(`taskTitleLabel`),(0,d.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring`,value:y.title,onChange:e=>X(`title`,e.target.value),placeholder:l(`taskTitlePlaceholder`)})]}),(0,d.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[l(`executionRule`),(0,d.jsx)(`div`,{className:`mt-1 flex h-10 items-center rounded-md border border-input bg-muted/20 px-3 text-sm text-muted-foreground`,children:y.scheduleRule||`-`})]}),(0,d.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[`cron`,(0,d.jsx)(`div`,{className:`mt-1 flex h-10 items-center rounded-md border border-input bg-muted/20 px-3 font-mono text-sm text-muted-foreground`,children:y.cronExpression||`-`})]}),(0,d.jsxs)(`div`,{className:`block text-sm font-medium text-foreground`,children:[l(`nextExecutionTime`),(0,d.jsx)(`div`,{className:`mt-1 flex h-10 items-center rounded-md border border-input bg-muted/20 px-3 text-sm text-muted-foreground`,children:p(y.nextRunAt)})]}),(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[(0,d.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[l(`taskExecutionMode`),(0,d.jsx)(s,{label:l(`taskExecutionModeHelp`)})]}),(0,d.jsxs)(`select`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm text-foreground outline-none focus:border-ring`,value:y.executionMode,onChange:e=>X(`executionMode`,e.target.value),children:[(0,d.jsx)(`option`,{value:`serial`,children:l(`taskExecutionModeSerial`)}),(0,d.jsx)(`option`,{value:`parallel`,children:l(`taskExecutionModeParallel`)})]})]}),(0,d.jsxs)(`label`,{className:`block text-sm font-medium text-foreground sm:col-span-2`,children:[l(`promptContentLabel`),(0,d.jsx)(`textarea`,{className:`mt-1 min-h-28 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm text-foreground outline-none transition-colors placeholder:text-muted-foreground/65 focus:border-ring`,value:y.instruction,onChange:e=>X(`instruction`,e.target.value),placeholder:l(`promptContentPlaceholder`)})]})]}),(0,d.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,d.jsx)(`input`,{type:`checkbox`,checked:y.enabled,onChange:e=>X(`enabled`,e.target.checked)}),l(`taskEnabledSwitch`)]}),(0,d.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-xl border border-border bg-muted/20 px-2 py-2`,children:[(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(ne,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.jsxs)(`select`,{className:`h-8 max-w-[240px] rounded-md border border-transparent bg-transparent pl-7 pr-2 text-xs text-muted-foreground outline-none hover:bg-background focus:border-ring`,value:F?`${F.provider}\u0000${F.id}`:``,onChange:e=>{let t=P.find(t=>`${t.provider}\u0000${t.id}`===e.target.value);I(t),R(fe(t))},title:l(`taskModel`),children:[P.length===0?(0,d.jsx)(`option`,{value:``,children:l(`noModelAvailable`)}):null,P.map(e=>(0,d.jsxs)(`option`,{value:`${e.provider}\u0000${e.id}`,children:[ve(e),ye(e,F)?` ✓`:``]},`${e.provider}:${e.id}`))]})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(ue,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.jsx)(`select`,{className:`h-8 rounded-md border border-transparent bg-transparent pl-7 pr-2 text-xs text-muted-foreground outline-none hover:bg-background focus:border-ring`,value:L,onChange:e=>R(e.target.value),title:l(`taskThinking`),children:_e.map(e=>(0,d.jsx)(`option`,{value:e.value,children:e.label()},e.value))})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(r,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.jsxs)(`select`,{className:`h-8 max-w-[220px] rounded-md border border-transparent bg-transparent pl-7 pr-2 text-xs text-muted-foreground outline-none hover:bg-background focus:border-ring`,value:Pe,onChange:e=>B(e.target.value),title:l(`taskProjectLabel`),children:[(0,d.jsx)(`option`,{value:``,children:l(`noProjectBound`)}),z.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,d.jsxs)(`span`,{className:`relative inline-flex items-center`,children:[(0,d.jsx)(ee,{className:`pointer-events-none absolute left-2 size-3.5 text-muted-foreground/70`}),(0,d.jsxs)(`select`,{className:`h-8 max-w-[220px] rounded-md border border-transparent bg-transparent pl-7 pr-2 text-xs text-muted-foreground outline-none hover:bg-background focus:border-ring`,value:y.agentId,onChange:e=>X(`agentId`,e.target.value),title:l(`executionAgent`),children:[(0,d.jsx)(`option`,{value:``,children:l(`defaultAgent`)}),Be.map(e=>(0,d.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]})]}),D?(0,d.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/30 p-3 text-sm`,children:[(0,d.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 font-medium text-foreground`,children:[(0,d.jsx)(oe,{className:`size-4 text-emerald-600`}),l(`aiParsed`)]}),(0,d.jsxs)(`div`,{className:`grid gap-2 text-muted-foreground sm:grid-cols-2`,children:[(0,d.jsxs)(`div`,{children:[l(`taskName`),(0,d.jsx)(`span`,{className:`text-foreground`,children:D.title})]}),(0,d.jsxs)(`div`,{children:[l(`executionRule`),(0,d.jsx)(`span`,{className:`text-foreground`,children:D.scheduleRule})]}),(0,d.jsxs)(`div`,{children:[`cron:`,(0,d.jsx)(`span`,{className:`font-mono text-foreground`,children:D.cronExpression??`-`})]}),(0,d.jsxs)(`div`,{children:[l(`nextExecutionTime`),(0,d.jsx)(`span`,{className:`text-foreground`,children:p(D.nextRunAt)})]}),(0,d.jsxs)(`div`,{className:`sm:col-span-2`,children:[l(`aiInstruction`),(0,d.jsx)(`span`,{className:`text-foreground`,children:D.instruction})]})]})]}):null,M?(0,d.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:M}):null]})}),(0,d.jsx)(`div`,{className:`shrink-0 border-t border-border px-5 py-4`,children:(0,d.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,d.jsx)(o,{variant:`outline`,onClick:Q,disabled:A,children:l(`cancel`)}),(0,d.jsx)(o,{onClick:$e,disabled:A||!F||!Ee(y),children:l(We?`saveTask`:`confirmCreate`)})]})})]})}):null]})}export{v as ScheduledTasksPage};
|
|
@@ -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};
|