pi-web-ui 0.114.2 → 0.114.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/server/agent-service.js +29 -5
  3. package/dist/server/context-usage.js +105 -0
  4. package/dist/server/protocol-version.js +1 -1
  5. package/package.json +1 -1
  6. package/web/dist/.build-assets.json +1 -1
  7. package/web/dist/assets/{BgTasksModal-BIlQ89vr.js → BgTasksModal-BvnUHjFe.js} +1 -1
  8. package/web/dist/assets/{BgTasksModal-Ck2sjlPM.js → BgTasksModal-DSC8ncW3.js} +1 -1
  9. package/web/dist/assets/{CanvasStudio-B3W6b_rA.js → CanvasStudio-BSg9ghPV.js} +2 -2
  10. package/web/dist/assets/{CanvasStudio-Csv1Sj1-.js → CanvasStudio-DxW7C3Sz.js} +2 -2
  11. package/web/dist/assets/{DeviceCenter-BQdDcO8A.js → DeviceCenter-Bmgr-Bwm.js} +1 -1
  12. package/web/dist/assets/{DeviceCenter-CHRKL0Vy.js → DeviceCenter-Cl9MBXaH.js} +1 -1
  13. package/web/dist/assets/{DeviceGroups-D2rogxEN.js → DeviceGroups-aeLD2msl.js} +1 -1
  14. package/web/dist/assets/{Dropdown-ZLS04O8p.js → Dropdown-D1Jl35dw.js} +1 -1
  15. package/web/dist/assets/{FilePreview-B9xoU6ON.js → FilePreview-6CqoDF_P.js} +1 -1
  16. package/web/dist/assets/{FilePreview-DUQpVZkH.js → FilePreview-CJa27G_Q.js} +1 -1
  17. package/web/dist/assets/{GlobalSearchModal-BXEGvUZq.js → GlobalSearchModal-CJX35rZL.js} +1 -1
  18. package/web/dist/assets/{GlobalSearchModal-CnVPmfOI.js → GlobalSearchModal-CMW0xz0P.js} +1 -1
  19. package/web/dist/assets/{GroupConversation-CyIpQzDd.js → GroupConversation-Cq4daBFb.js} +1 -1
  20. package/web/dist/assets/{GroupConversation-DgYV3uYS.js → GroupConversation-DoELa83U.js} +1 -1
  21. package/web/dist/assets/{ModelConfigModal-DDZccDYt.js → ModelConfigModal-Bp7tfKYh.js} +1 -1
  22. package/web/dist/assets/{PiSetupModal-DHbqfx8T.js → PiSetupModal-DD8srwBJ.js} +1 -1
  23. package/web/dist/assets/{ProviderOAuthControls-C-MK36Dk.js → ProviderOAuthControls-C6tfXb88.js} +1 -1
  24. package/web/dist/assets/{SCMPanel-sVZcV7dR.js → SCMPanel-CghgsyBN.js} +1 -1
  25. package/web/dist/assets/{SCMPanel-imYI2Ecw.js → SCMPanel-D8-8aqwC.js} +1 -1
  26. package/web/dist/assets/{SettingsModal-Xw1Yoi3_.js → SettingsModal-BbBe2rYo.js} +1 -1
  27. package/web/dist/assets/{SettingsModal-mb4e34-0.js → SettingsModal-qETiVPKj.js} +1 -1
  28. package/web/dist/assets/{TerminalPanel-CLkJJvxg.js → TerminalPanel-Da-Xs4Wk.js} +1 -1
  29. package/web/dist/assets/{TerminalPanel-DpcIellm.js → TerminalPanel-DnS4tFQO.js} +1 -1
  30. package/web/dist/assets/{TuiOverlayModal-4-fFAZe7.js → TuiOverlayModal-CGyGkKYl.js} +1 -1
  31. package/web/dist/assets/{TuiOverlayModal-DCu01lks.js → TuiOverlayModal-CpBKjG6x.js} +1 -1
  32. package/web/dist/assets/{desktop-YguLbrX1.js → desktop-7EvUHhKQ.js} +1 -1
  33. package/web/dist/assets/{fi-DaSO0Q-m.js → fi-NyN-ZrgD.js} +2 -2
  34. package/web/dist/assets/{index-Cdh3sibd.js → index-DK3F5ZJo.js} +50 -50
  35. package/web/dist/assets/{index-DWw_SxRq.js → index-DQMii2he.js} +50 -50
  36. package/web/dist/assets/index-vwBnwzkr.css +1 -0
  37. package/web/dist/assets/{plugin-host-BRBg6zmQ.js → plugin-host-BCnX3P8U.js} +1 -1
  38. package/web/dist/assets/{theme-DDl-Oy1b.js → theme-D2DMH6tH.js} +1 -1
  39. package/web/dist/index.html +8 -8
  40. package/web/dist/sw.js +1 -1
  41. package/web/dist/assets/index-DDZMv6LO.css +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{N as t,Tt as n,Yt as r,an as i}from"./fi-DaSO0Q-m.js";import{i as a,t as o}from"./react-CR5VJ85Q.js";import{r as s}from"./desktop-YguLbrX1.js";import{l as c,t as l}from"./app-globals-DcyO0UPi.js";import{t as u}from"./ProviderOAuthControls-C-MK36Dk.js";var d=e(a(),1),f=o();function p({piConfigured:e,piAgentInstalled:a,providers:o,providerOAuthFlows:p,providerOAuthResults:m,installResult:h,onClose:g}){let _=i(),v=s(),y=c(),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)(``),[E,D]=(0,d.useState)(!1);(0,d.useEffect)(()=>{l({type:`list_providers`}),l({type:`list_provider_oauth_flows`})},[]),(0,d.useEffect)(()=>{e&&g()},[e,g]),(0,d.useEffect)(()=>{h&&x(!1)},[h]),(0,d.useEffect)(()=>{!S&&o.length>0&&C(o.find(e=>!e.configured)?.id??o[0].id)},[o,S]);let O=()=>{b||(x(!0),l({type:`install_pi_agent`}))},k=()=>{w.trim()&&!E&&(D(!0),l({type:`set_provider_api_key`,provider:S.trim(),apiKey:w.trim()}),setTimeout(()=>D(!1),3e3))},A=()=>{l({type:`get_state`}),l({type:`list_providers`})},j=o.find(e=>e.id===S),M=h!==null&&!h.ok;return(0,f.jsx)(`div`,{className:`modal-backdrop`,children:(0,f.jsxs)(`div`,{className:`modal setup-modal`,children:[(0,f.jsx)(`button`,{type:`button`,className:`modal-close`,"aria-label":_(`close`),onClick:g,children:(0,f.jsx)(r,{})}),(0,f.jsxs)(`div`,{className:`modal-head`,children:[(0,f.jsx)(t,{className:`modal-head-icon`}),(0,f.jsx)(`h2`,{children:_(`setupTitle`)})]}),(0,f.jsx)(`p`,{className:`modal-desc`,children:_(`setupDesc`)}),M?(0,f.jsxs)(`div`,{className:`setup-failed`,children:[(0,f.jsx)(`div`,{className:`setup-done`,children:_(`installFailed`)}),(0,f.jsx)(`pre`,{className:`setup-detail`,children:h.detail}),(0,f.jsxs)(`div`,{className:`setup-actions`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:b,onClick:O,children:_(`retryInstall`)}),(0,f.jsx)(`button`,{type:`button`,className:`btn`,onClick:g,children:_(`skip`)})]})]}):a||h?.ok||v?(0,f.jsxs)(`div`,{className:`setup-key-form`,children:[(0,f.jsx)(`div`,{className:`setup-done`,children:h?.ok?_(`installDone`):_(`cliReadyHint`)}),(0,f.jsxs)(`label`,{className:`field`,children:[(0,f.jsx)(`span`,{className:`field-label`,children:_(`provider`)}),(0,f.jsxs)(`select`,{value:S,onChange:e=>C(e.target.value),children:[o.length===0&&(0,f.jsx)(`option`,{value:``,children:_(`loading`)}),o.map(e=>(0,f.jsxs)(`option`,{value:e.id,children:[e.name,`(`,e.id,`)`,e.configured?` · ${_(`configured`)}`:``]},e.id))]}),j?.configured&&(0,f.jsx)(`div`,{className:`field-hint`,children:_(`providerKeyReady`)})]}),j?.supportsOAuth&&(0,f.jsx)(u,{provider:j,flow:p.find(e=>e.provider===j.id),result:m[j.id]}),j?.supportsApiKey&&(0,f.jsxs)(`label`,{className:`field`,children:[(0,f.jsx)(`span`,{className:`field-label`,children:_(`apiKey`)}),(0,f.jsx)(`input`,{type:`password`,value:w,onChange:e=>T(e.target.value),placeholder:`sk-…`})]}),(0,f.jsxs)(`div`,{className:`setup-actions`,children:[j?.supportsApiKey&&(0,f.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:!w.trim()||E||!S,onClick:k,children:_(E?`saving`:`saveAndStart`)}),(0,f.jsxs)(`button`,{type:`button`,className:`btn`,onClick:A,children:[(0,f.jsx)(n,{}),` `,_(`recheck`)]})]})]}):y?(0,f.jsxs)(`div`,{className:`setup-actions`,children:[(0,f.jsx)(`div`,{className:`setup-done`,children:_(`updatesManaged`)}),(0,f.jsx)(`button`,{type:`button`,className:`btn`,onClick:g,children:_(`skip`)})]}):(0,f.jsxs)(`div`,{className:`setup-actions`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:b,onClick:O,children:_(b?`installing`:`autoInstall`)}),(0,f.jsx)(`button`,{type:`button`,className:`btn`,onClick:g,children:_(`skip`)})]})]})})}export{p as PiSetupModal};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{N as t,Tt as n,Yt as r,an as i}from"./fi-NyN-ZrgD.js";import{i as a,t as o}from"./react-CR5VJ85Q.js";import{r as s}from"./desktop-7EvUHhKQ.js";import{l as c,t as l}from"./app-globals-DcyO0UPi.js";import{t as u}from"./ProviderOAuthControls-C6tfXb88.js";var d=e(a(),1),f=o();function p({piConfigured:e,piAgentInstalled:a,providers:o,providerOAuthFlows:p,providerOAuthResults:m,installResult:h,onClose:g}){let _=i(),v=s(),y=c(),[b,x]=(0,d.useState)(!1),[S,C]=(0,d.useState)(``),[w,T]=(0,d.useState)(``),[E,D]=(0,d.useState)(!1);(0,d.useEffect)(()=>{l({type:`list_providers`}),l({type:`list_provider_oauth_flows`})},[]),(0,d.useEffect)(()=>{e&&g()},[e,g]),(0,d.useEffect)(()=>{h&&x(!1)},[h]),(0,d.useEffect)(()=>{!S&&o.length>0&&C(o.find(e=>!e.configured)?.id??o[0].id)},[o,S]);let O=()=>{b||(x(!0),l({type:`install_pi_agent`}))},k=()=>{w.trim()&&!E&&(D(!0),l({type:`set_provider_api_key`,provider:S.trim(),apiKey:w.trim()}),setTimeout(()=>D(!1),3e3))},A=()=>{l({type:`get_state`}),l({type:`list_providers`})},j=o.find(e=>e.id===S),M=h!==null&&!h.ok;return(0,f.jsx)(`div`,{className:`modal-backdrop`,children:(0,f.jsxs)(`div`,{className:`modal setup-modal`,children:[(0,f.jsx)(`button`,{type:`button`,className:`modal-close`,"aria-label":_(`close`),onClick:g,children:(0,f.jsx)(r,{})}),(0,f.jsxs)(`div`,{className:`modal-head`,children:[(0,f.jsx)(t,{className:`modal-head-icon`}),(0,f.jsx)(`h2`,{children:_(`setupTitle`)})]}),(0,f.jsx)(`p`,{className:`modal-desc`,children:_(`setupDesc`)}),M?(0,f.jsxs)(`div`,{className:`setup-failed`,children:[(0,f.jsx)(`div`,{className:`setup-done`,children:_(`installFailed`)}),(0,f.jsx)(`pre`,{className:`setup-detail`,children:h.detail}),(0,f.jsxs)(`div`,{className:`setup-actions`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:b,onClick:O,children:_(`retryInstall`)}),(0,f.jsx)(`button`,{type:`button`,className:`btn`,onClick:g,children:_(`skip`)})]})]}):a||h?.ok||v?(0,f.jsxs)(`div`,{className:`setup-key-form`,children:[(0,f.jsx)(`div`,{className:`setup-done`,children:h?.ok?_(`installDone`):_(`cliReadyHint`)}),(0,f.jsxs)(`label`,{className:`field`,children:[(0,f.jsx)(`span`,{className:`field-label`,children:_(`provider`)}),(0,f.jsxs)(`select`,{value:S,onChange:e=>C(e.target.value),children:[o.length===0&&(0,f.jsx)(`option`,{value:``,children:_(`loading`)}),o.map(e=>(0,f.jsxs)(`option`,{value:e.id,children:[e.name,`(`,e.id,`)`,e.configured?` · ${_(`configured`)}`:``]},e.id))]}),j?.configured&&(0,f.jsx)(`div`,{className:`field-hint`,children:_(`providerKeyReady`)})]}),j?.supportsOAuth&&(0,f.jsx)(u,{provider:j,flow:p.find(e=>e.provider===j.id),result:m[j.id]}),j?.supportsApiKey&&(0,f.jsxs)(`label`,{className:`field`,children:[(0,f.jsx)(`span`,{className:`field-label`,children:_(`apiKey`)}),(0,f.jsx)(`input`,{type:`password`,value:w,onChange:e=>T(e.target.value),placeholder:`sk-…`})]}),(0,f.jsxs)(`div`,{className:`setup-actions`,children:[j?.supportsApiKey&&(0,f.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:!w.trim()||E||!S,onClick:k,children:_(E?`saving`:`saveAndStart`)}),(0,f.jsxs)(`button`,{type:`button`,className:`btn`,onClick:A,children:[(0,f.jsx)(n,{}),` `,_(`recheck`)]})]})]}):y?(0,f.jsxs)(`div`,{className:`setup-actions`,children:[(0,f.jsx)(`div`,{className:`setup-done`,children:_(`updatesManaged`)}),(0,f.jsx)(`button`,{type:`button`,className:`btn`,onClick:g,children:_(`skip`)})]}):(0,f.jsxs)(`div`,{className:`setup-actions`,children:[(0,f.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:b,onClick:O,children:_(b?`installing`:`autoInstall`)}),(0,f.jsx)(`button`,{type:`button`,className:`btn`,onClick:g,children:_(`skip`)})]})]})})}export{p as PiSetupModal};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{an as t}from"./fi-DaSO0Q-m.js";import{i as n,t as r}from"./react-CR5VJ85Q.js";import{t as i}from"./app-globals-DcyO0UPi.js";var a=e(n(),1),o=r();function s({provider:e,flow:n,result:r}){let s=t(),c=n?.event,l=e.oauthName??e.name,[u,d]=(0,a.useState)(``);return(0,a.useEffect)(()=>d(``),[n?.promptId]),e.usingOAuth?(0,o.jsxs)(`div`,{className:`provider-oauth`,children:[(0,o.jsx)(`span`,{className:`provider-oauth-status`,children:s(`oauthConnected`,{name:l})}),(0,o.jsx)(`button`,{type:`button`,className:`btn sm danger`,"data-provider-oauth-logout":e.id,onClick:()=>i({type:`provider_oauth_logout`,provider:e.id}),children:s(`oauthLogout`)}),r?.error&&(0,o.jsx)(`div`,{className:`provider-oauth-error`,children:r.error})]}):(0,o.jsxs)(`div`,{className:`provider-oauth`,children:[n?(0,o.jsxs)(o.Fragment,{children:[c?.type===`device_code`&&(0,o.jsxs)(`div`,{className:`provider-oauth-device`,children:[(0,o.jsx)(`div`,{children:s(`oauthDeviceCode`)}),(0,o.jsx)(`code`,{"data-oauth-device-code":!0,children:c.userCode}),(0,o.jsx)(`a`,{"data-oauth-verification-url":!0,href:c.verificationUri,target:`_blank`,rel:`noreferrer`,children:s(`oauthOpenVerification`)})]}),c?.type===`auth_url`&&(0,o.jsxs)(`div`,{className:`provider-oauth-event`,children:[c.instructions&&(0,o.jsx)(`div`,{children:c.instructions}),(0,o.jsx)(`a`,{href:c.url,target:`_blank`,rel:`noreferrer`,children:s(`oauthOpenVerification`)})]}),c?.type===`progress`&&(0,o.jsx)(`div`,{className:`provider-oauth-message`,children:c.message}),c?.type===`info`&&(0,o.jsxs)(`div`,{className:`provider-oauth-event`,children:[(0,o.jsx)(`div`,{children:c.message}),c.links?.map(e=>(0,o.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:e.label??e.url},e.url))]}),n.prompt&&(0,o.jsx)(`div`,{className:`provider-oauth-message`,children:n.prompt.message}),n.prompt?.type===`select`&&n.promptId&&(0,o.jsx)(`div`,{className:`provider-oauth-options`,children:n.prompt.options.map(e=>(0,o.jsx)(`button`,{type:`button`,className:`btn sm`,"data-oauth-option":e.id,onClick:()=>i({type:`provider_oauth_reply`,flowId:n.flowId,promptId:n.promptId,value:e.id}),children:e.label},e.id))}),n.prompt&&n.prompt.type!==`select`&&n.promptId&&(0,o.jsxs)(`form`,{className:`provider-oauth-prompt`,onSubmit:e=>{e.preventDefault(),u.trim()&&i({type:`provider_oauth_reply`,flowId:n.flowId,promptId:n.promptId,value:u.trim()})},children:[(0,o.jsx)(`input`,{"data-oauth-prompt-input":!0,type:n.prompt.type===`secret`?`password`:`text`,className:`key-input`,placeholder:n.prompt.placeholder,value:u,onChange:e=>d(e.target.value)}),(0,o.jsx)(`button`,{type:`submit`,className:`btn primary sm`,"data-oauth-prompt-submit":!0,disabled:!u.trim(),children:s(`oauthContinue`)})]}),(0,o.jsx)(`button`,{type:`button`,className:`btn sm danger`,"data-oauth-cancel":n.flowId,onClick:()=>i({type:`provider_oauth_cancel`,flowId:n.flowId}),children:s(`cancel`)})]}):(0,o.jsx)(`button`,{type:`button`,className:`btn primary sm`,"data-provider-oauth-login":e.id,onClick:()=>i({type:`provider_oauth_start`,provider:e.id}),children:s(`oauthLogin`,{name:l})}),r?.error&&(0,o.jsx)(`div`,{className:`provider-oauth-error`,children:r.error})]})}export{s as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{an as t}from"./fi-NyN-ZrgD.js";import{i as n,t as r}from"./react-CR5VJ85Q.js";import{t as i}from"./app-globals-DcyO0UPi.js";var a=e(n(),1),o=r();function s({provider:e,flow:n,result:r}){let s=t(),c=n?.event,l=e.oauthName??e.name,[u,d]=(0,a.useState)(``);return(0,a.useEffect)(()=>d(``),[n?.promptId]),e.usingOAuth?(0,o.jsxs)(`div`,{className:`provider-oauth`,children:[(0,o.jsx)(`span`,{className:`provider-oauth-status`,children:s(`oauthConnected`,{name:l})}),(0,o.jsx)(`button`,{type:`button`,className:`btn sm danger`,"data-provider-oauth-logout":e.id,onClick:()=>i({type:`provider_oauth_logout`,provider:e.id}),children:s(`oauthLogout`)}),r?.error&&(0,o.jsx)(`div`,{className:`provider-oauth-error`,children:r.error})]}):(0,o.jsxs)(`div`,{className:`provider-oauth`,children:[n?(0,o.jsxs)(o.Fragment,{children:[c?.type===`device_code`&&(0,o.jsxs)(`div`,{className:`provider-oauth-device`,children:[(0,o.jsx)(`div`,{children:s(`oauthDeviceCode`)}),(0,o.jsx)(`code`,{"data-oauth-device-code":!0,children:c.userCode}),(0,o.jsx)(`a`,{"data-oauth-verification-url":!0,href:c.verificationUri,target:`_blank`,rel:`noreferrer`,children:s(`oauthOpenVerification`)})]}),c?.type===`auth_url`&&(0,o.jsxs)(`div`,{className:`provider-oauth-event`,children:[c.instructions&&(0,o.jsx)(`div`,{children:c.instructions}),(0,o.jsx)(`a`,{href:c.url,target:`_blank`,rel:`noreferrer`,children:s(`oauthOpenVerification`)})]}),c?.type===`progress`&&(0,o.jsx)(`div`,{className:`provider-oauth-message`,children:c.message}),c?.type===`info`&&(0,o.jsxs)(`div`,{className:`provider-oauth-event`,children:[(0,o.jsx)(`div`,{children:c.message}),c.links?.map(e=>(0,o.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,children:e.label??e.url},e.url))]}),n.prompt&&(0,o.jsx)(`div`,{className:`provider-oauth-message`,children:n.prompt.message}),n.prompt?.type===`select`&&n.promptId&&(0,o.jsx)(`div`,{className:`provider-oauth-options`,children:n.prompt.options.map(e=>(0,o.jsx)(`button`,{type:`button`,className:`btn sm`,"data-oauth-option":e.id,onClick:()=>i({type:`provider_oauth_reply`,flowId:n.flowId,promptId:n.promptId,value:e.id}),children:e.label},e.id))}),n.prompt&&n.prompt.type!==`select`&&n.promptId&&(0,o.jsxs)(`form`,{className:`provider-oauth-prompt`,onSubmit:e=>{e.preventDefault(),u.trim()&&i({type:`provider_oauth_reply`,flowId:n.flowId,promptId:n.promptId,value:u.trim()})},children:[(0,o.jsx)(`input`,{"data-oauth-prompt-input":!0,type:n.prompt.type===`secret`?`password`:`text`,className:`key-input`,placeholder:n.prompt.placeholder,value:u,onChange:e=>d(e.target.value)}),(0,o.jsx)(`button`,{type:`submit`,className:`btn primary sm`,"data-oauth-prompt-submit":!0,disabled:!u.trim(),children:s(`oauthContinue`)})]}),(0,o.jsx)(`button`,{type:`button`,className:`btn sm danger`,"data-oauth-cancel":n.flowId,onClick:()=>i({type:`provider_oauth_cancel`,flowId:n.flowId}),children:s(`cancel`)})]}):(0,o.jsx)(`button`,{type:`button`,className:`btn primary sm`,"data-provider-oauth-login":e.id,onClick:()=>i({type:`provider_oauth_start`,provider:e.id}),children:s(`oauthLogin`,{name:l})}),r?.error&&(0,o.jsx)(`div`,{className:`provider-oauth-error`,children:r.error})]})}export{s as t};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Bt as t,N as n,Tt as r,Y as i,_ as a,an as ee,l as te,s as ne}from"./fi-DaSO0Q-m.js";import{i as o,t as s}from"./react-CR5VJ85Q.js";import{t as re}from"./uuid-BzDIGCwP.js";import{t as ie}from"./app-globals-DcyO0UPi.js";import{U as c}from"./index-DWw_SxRq.js";var l=e(o(),1),ae=e=>`'${e.replace(/'/g,`'\\''`)}'`,oe=`pi-web-ui:scm-sidebar-width`;function se(e,t=0){if(!Number.isFinite(e))return 300;let n=Math.max(200,Math.min(720,t>0?t-220:720));return Math.min(n,Math.max(200,Math.round(e)))}function ce(e){return e===null||e.trim()===``?300:se(Number(e))}function u(e,t){let n=t.toLowerCase();return e.subject.toLowerCase().includes(n)||e.author.toLowerCase().includes(n)||e.shortHash.toLowerCase().includes(n)||e.hash.toLowerCase().includes(n)||e.decorations!==void 0&&e.decorations.toLowerCase().includes(n)}function le(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?e:e.filter(e=>n.every(t=>u(e,t)))}var d=`scm-commit-history`;function f(e=localStorage){try{let t=e.getItem(d);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):[]}catch{return[]}}function ue(e,t=localStorage){let n=e.trim();if(!n)return f(t);let r=[n,...f(t).filter(e=>e!==n)].slice(0,20);try{t.setItem(d,JSON.stringify(r))}catch{}return r}var p={idx:-1,draft:``};function de(e,t,n,r){return e.length===0?null:r===`up`?t.idx>=e.length-1?null:t.idx===-1?{state:{idx:0,draft:n},text:e[0]}:{state:{idx:t.idx+1,draft:t.draft},text:e[t.idx+1]}:t.idx===-1?null:t.idx===0?{state:p,text:t.draft}:{state:{idx:t.idx-1,draft:t.draft},text:e[t.idx-1]}}var m=s();function fe(e){if(e.x===`?`&&e.y===`?`)return`untracked`;let t=e.x!==` `&&e.x!==`?`,n=e.y!==` `&&e.y!==`?`;return t&&n?`both`:t?`staged`:`unstaged`}function h({chat:e,terminal:o,active:s,onSwitchToTerminal:u,uiScmToolbar:d,onUiAction:h}){let g=ee(),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)([]),[x,pe]=(0,l.useState)(``),[me,he]=(0,l.useState)(new Map),[S,ge]=(0,l.useState)(`changes`),[C,_e]=(0,l.useState)([]),[w,T]=(0,l.useState)(null),[ve,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(!1),[k,A]=(0,l.useState)(null),[j,M]=(0,l.useState)(null),[ye,N]=(0,l.useState)(!1),[be,xe]=(0,l.useState)(!1),[Se,Ce]=(0,l.useState)(!1),[P,F]=(0,l.useState)(null),[I,we]=(0,l.useState)(!1),[L,R]=(0,l.useState)(!1),[Te,z]=(0,l.useState)(null),[B,Ee]=(0,l.useState)(()=>ce(localStorage.getItem(oe))),[V,H]=(0,l.useState)(``),[U,De]=(0,l.useState)(``),[Oe,ke]=(0,l.useState)(()=>f()),W=(0,l.useRef)(p),Ae=(0,l.useRef)(0),je=(0,l.useRef)(-1),Me=(0,l.useRef)(-1),Ne=(0,l.useRef)(-1),G=(0,l.useRef)(-1),K=(0,l.useRef)(-1),Pe=(0,l.useRef)(void 0),Fe=(0,l.useRef)(null),Ie=(0,l.useRef)([]),Le=(0,l.useRef)(B);Le.current=B;let Re=(0,l.useRef)(null),q=(0,l.useCallback)(e=>{try{localStorage.setItem(oe,String(e))}catch{}},[]),ze=(0,l.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=Le.current,r=Re.current?.getBoundingClientRect().width??0,i=n,a=e=>{i=se(n+(e.clientX-t),r),Ee(i)},ee=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,ee),document.body.classList.remove(`panel-resizing`),q(i)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,ee),document.body.classList.add(`panel-resizing`)},[q]),Be=(0,l.useCallback)(()=>{Ee(300),q(300)},[q]),Ve=(0,l.useCallback)(e=>{if(e.reqId===je.current){if(je.current=-1,xe(!1),F(null),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}if(e.notRepo){we(!0),v(null),b([]),he(new Map),_e([]),T(null),E(``),M(null);return}we(!1);let t={branch:e.branch??``,detached:!!e.detached,upstream:e.upstream??null,ahead:e.ahead??0,behind:e.behind??0,upstreamGone:!!e.upstreamGone,files:(e.files??[]).map(e=>({...e}))},n=(e.branches??[]).map(e=>({...e})),r=new Map;for(let[t,n]of Object.entries(e.stats??{}))r.set(t,{add:n[0],del:n[1]});v(t),b(n),he(r),pe(e=>t.detached?e||``:t.branch&&n.some(e=>e.name===t.branch)?t.branch:e&&n.some(t=>t.name===e)?e:n[0]?.name??``),M(e=>e&&!t.files.some(t=>t.path===e.file.path)?null:e)}else if(e.reqId===Me.current){if(Me.current=-1,N(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}let t=Fe.current;if(!t)return;M({file:t,staged:e.stagedText??``,worktree:e.worktreeText??``,untracked:!1})}else if(e.reqId===G.current){if(G.current=-1,Ce(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}_e((e.history??[]).map(e=>({...e})))}else if(e.reqId===Ne.current){if(Ne.current=-1,O(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}E(e.text??``)}else if(e.reqId===K.current){if(K.current=-1,R(!1),!e.ok){z(e.error??g(`scmGenMsgFail`));return}z(null),H(e.text??``)}},[]);(0,l.useEffect)(()=>{let t=e.scmData;t&&t.type===`scm_data`&&Ve(t)},[e.scmData,Ve]);let J=(0,l.useCallback)((t,n)=>{if(!e.ready||e.status!==`open`)return!1;let r=++Ae.current;return ie({...t,reqId:r})?(n.current=r,!0):(--Ae.current,!1)},[e.ready,e.status]),Y=(0,l.useCallback)((t=!1,n=!1)=>{e.ready&&e.status===`open`&&e.state?.cwd&&(Pe.current!==void 0&&Pe.current!==e.state.cwd&&(v(null),b([]),he(new Map),_e([]),De(``),Ce(!1),G.current=-1,T(null),E(``),M(null),A(null),z(null),R(!1),K.current=-1),Pe.current=e.state.cwd,F(null),J({type:`scm_status`},je)&&(n||xe(!0)))},[e.ready,e.state?.cwd,e.status,J]),He=(0,l.useCallback)(e=>{if(A(e),T(null),Fe.current=e,e.x===`?`&&e.y===`?`){M({file:e,staged:``,worktree:``,untracked:!0});return}N(!0),F(null),J({type:`scm_filediff`,path:e.path},Me)||N(!1)},[J]),Ue=(0,l.useCallback)(e=>{T(e),A(null),M(null),E(``),O(!0),F(null),J({type:`scm_commit`,hash:e.hash},Ne)||O(!1)},[J]),X=(0,l.useCallback)((t,n)=>{if(!e.ready)return;let r={name:t,command:n,cwd:"${pwd}"},i,a=e.terminals.find(e=>e.title===t);a?(o.restart(a.id),ie({type:`run_command`,terminalId:a.id,conversationId:a.conversationId,command:r,cols:80,rows:24}),i=a.id):(i=re(),o.create({id:i,conversationId:e.activeConversationId||e.state?.conversationId||``,title:t,cwd:e.state?.cwd??``,cols:80,rows:24,running:!0,exitCode:null,command:r})),o.select(i),u()},[e.ready,e.state?.cwd,e.terminals,u,o]),We=(0,l.useCallback)(()=>{let e=V.trim();if(!e||I)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git commit -m "${t}"`),ke(ue(e)),H(``),W.current=p},[V,I,X]),Ge=(0,l.useCallback)(()=>{let e=V.trim();if(!e||I)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git add -A && git commit -m "${t}"`),ke(ue(e)),H(``),W.current=p},[V,I,X]),Ke=(0,l.useCallback)(e=>{I||X(`git add`,`git add -- ${ae(e.path)}`)},[I,X]),qe=(0,l.useCallback)(e=>{I||X(`git reset`,`git reset HEAD -- ${ae(e.path)}`)},[I,X]),Je=(0,l.useCallback)(()=>{if(!x||I)return;let e=y.find(e=>e.name===x);if(e?.remote&&typeof e.remote==`string`){let t=x.slice(e.remote.length+1);X(`git checkout`,`git checkout -b ${t} ${x} || git checkout ${x}`)}else X(`git checkout`,`git checkout ${x}`)},[x,y,I,X]),Ye=(0,l.useCallback)(()=>X(`git push`,`git push`),[X]),Xe=(0,l.useCallback)(()=>X(`git pull`,`git pull`),[X]),Ze=(0,l.useCallback)(()=>{L||I||!e.ready||e.status!==`open`||(z(null),J({type:`scm_commitmsg`},K)?R(!0):z(g(`scmGenMsgFail`)))},[L,I,e.ready,e.status,J,g]),Z=(0,l.useCallback)(()=>{J({type:`scm_history`},G)||(G.current=-1)},[J]);(0,l.useEffect)(()=>{s&&Y()},[s,Y]),(0,l.useEffect)(()=>{S===`history`&&_&&Z()},[S,_,Z]),(0,l.useEffect)(()=>{e.scmDirty>0&&s&&Y(!1,!0)},[e.scmDirty]),(0,l.useEffect)(()=>{if(!s||!e.ready||e.status!==`open`)return;let t=setInterval(()=>{document.visibilityState!==`hidden`&&Y(!1,!0)},3e4);return()=>clearInterval(t)},[s,e.ready,e.status,Y]),(0,l.useEffect)(()=>{let t=Ie.current;Ie.current=e.terminals,s&&e.terminals.some(e=>e.running===!1&&t.find(t=>t.id===e.id)?.running===!0&&e.title.startsWith(`git `))&&e.ready&&e.status===`open`&&(Y(!1,!0),S===`history`&&_&&Z())},[e.terminals,s,e.ready,e.status,Y,S,_,Z]);let Qe={staged:g(`scmStaged`),unstaged:g(`scmUnstaged`),untracked:g(`scmUntracked`),both:g(`scmStagedUnstaged`)},$e=le(C,U),et=e=>{let t=e.split(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Bt as t,N as n,Tt as r,Y as i,_ as a,an as ee,l as te,s as ne}from"./fi-NyN-ZrgD.js";import{i as o,t as s}from"./react-CR5VJ85Q.js";import{t as re}from"./uuid-BzDIGCwP.js";import{t as ie}from"./app-globals-DcyO0UPi.js";import{U as c}from"./index-DQMii2he.js";var l=e(o(),1),ae=e=>`'${e.replace(/'/g,`'\\''`)}'`,oe=`pi-web-ui:scm-sidebar-width`;function se(e,t=0){if(!Number.isFinite(e))return 300;let n=Math.max(200,Math.min(720,t>0?t-220:720));return Math.min(n,Math.max(200,Math.round(e)))}function ce(e){return e===null||e.trim()===``?300:se(Number(e))}function u(e,t){let n=t.toLowerCase();return e.subject.toLowerCase().includes(n)||e.author.toLowerCase().includes(n)||e.shortHash.toLowerCase().includes(n)||e.hash.toLowerCase().includes(n)||e.decorations!==void 0&&e.decorations.toLowerCase().includes(n)}function le(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?e:e.filter(e=>n.every(t=>u(e,t)))}var d=`scm-commit-history`;function f(e=localStorage){try{let t=e.getItem(d);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):[]}catch{return[]}}function ue(e,t=localStorage){let n=e.trim();if(!n)return f(t);let r=[n,...f(t).filter(e=>e!==n)].slice(0,20);try{t.setItem(d,JSON.stringify(r))}catch{}return r}var p={idx:-1,draft:``};function de(e,t,n,r){return e.length===0?null:r===`up`?t.idx>=e.length-1?null:t.idx===-1?{state:{idx:0,draft:n},text:e[0]}:{state:{idx:t.idx+1,draft:t.draft},text:e[t.idx+1]}:t.idx===-1?null:t.idx===0?{state:p,text:t.draft}:{state:{idx:t.idx-1,draft:t.draft},text:e[t.idx-1]}}var m=s();function fe(e){if(e.x===`?`&&e.y===`?`)return`untracked`;let t=e.x!==` `&&e.x!==`?`,n=e.y!==` `&&e.y!==`?`;return t&&n?`both`:t?`staged`:`unstaged`}function h({chat:e,terminal:o,active:s,onSwitchToTerminal:u,uiScmToolbar:d,onUiAction:h}){let g=ee(),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)([]),[x,pe]=(0,l.useState)(``),[me,he]=(0,l.useState)(new Map),[S,ge]=(0,l.useState)(`changes`),[C,_e]=(0,l.useState)([]),[w,T]=(0,l.useState)(null),[ve,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(!1),[k,A]=(0,l.useState)(null),[j,M]=(0,l.useState)(null),[ye,N]=(0,l.useState)(!1),[be,xe]=(0,l.useState)(!1),[Se,Ce]=(0,l.useState)(!1),[P,F]=(0,l.useState)(null),[I,we]=(0,l.useState)(!1),[L,R]=(0,l.useState)(!1),[Te,z]=(0,l.useState)(null),[B,Ee]=(0,l.useState)(()=>ce(localStorage.getItem(oe))),[V,H]=(0,l.useState)(``),[U,De]=(0,l.useState)(``),[Oe,ke]=(0,l.useState)(()=>f()),W=(0,l.useRef)(p),Ae=(0,l.useRef)(0),je=(0,l.useRef)(-1),Me=(0,l.useRef)(-1),Ne=(0,l.useRef)(-1),G=(0,l.useRef)(-1),K=(0,l.useRef)(-1),Pe=(0,l.useRef)(void 0),Fe=(0,l.useRef)(null),Ie=(0,l.useRef)([]),Le=(0,l.useRef)(B);Le.current=B;let Re=(0,l.useRef)(null),q=(0,l.useCallback)(e=>{try{localStorage.setItem(oe,String(e))}catch{}},[]),ze=(0,l.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=Le.current,r=Re.current?.getBoundingClientRect().width??0,i=n,a=e=>{i=se(n+(e.clientX-t),r),Ee(i)},ee=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,ee),document.body.classList.remove(`panel-resizing`),q(i)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,ee),document.body.classList.add(`panel-resizing`)},[q]),Be=(0,l.useCallback)(()=>{Ee(300),q(300)},[q]),Ve=(0,l.useCallback)(e=>{if(e.reqId===je.current){if(je.current=-1,xe(!1),F(null),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}if(e.notRepo){we(!0),v(null),b([]),he(new Map),_e([]),T(null),E(``),M(null);return}we(!1);let t={branch:e.branch??``,detached:!!e.detached,upstream:e.upstream??null,ahead:e.ahead??0,behind:e.behind??0,upstreamGone:!!e.upstreamGone,files:(e.files??[]).map(e=>({...e}))},n=(e.branches??[]).map(e=>({...e})),r=new Map;for(let[t,n]of Object.entries(e.stats??{}))r.set(t,{add:n[0],del:n[1]});v(t),b(n),he(r),pe(e=>t.detached?e||``:t.branch&&n.some(e=>e.name===t.branch)?t.branch:e&&n.some(t=>t.name===e)?e:n[0]?.name??``),M(e=>e&&!t.files.some(t=>t.path===e.file.path)?null:e)}else if(e.reqId===Me.current){if(Me.current=-1,N(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}let t=Fe.current;if(!t)return;M({file:t,staged:e.stagedText??``,worktree:e.worktreeText??``,untracked:!1})}else if(e.reqId===G.current){if(G.current=-1,Ce(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}_e((e.history??[]).map(e=>({...e})))}else if(e.reqId===Ne.current){if(Ne.current=-1,O(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}E(e.text??``)}else if(e.reqId===K.current){if(K.current=-1,R(!1),!e.ok){z(e.error??g(`scmGenMsgFail`));return}z(null),H(e.text??``)}},[]);(0,l.useEffect)(()=>{let t=e.scmData;t&&t.type===`scm_data`&&Ve(t)},[e.scmData,Ve]);let J=(0,l.useCallback)((t,n)=>{if(!e.ready||e.status!==`open`)return!1;let r=++Ae.current;return ie({...t,reqId:r})?(n.current=r,!0):(--Ae.current,!1)},[e.ready,e.status]),Y=(0,l.useCallback)((t=!1,n=!1)=>{e.ready&&e.status===`open`&&e.state?.cwd&&(Pe.current!==void 0&&Pe.current!==e.state.cwd&&(v(null),b([]),he(new Map),_e([]),De(``),Ce(!1),G.current=-1,T(null),E(``),M(null),A(null),z(null),R(!1),K.current=-1),Pe.current=e.state.cwd,F(null),J({type:`scm_status`},je)&&(n||xe(!0)))},[e.ready,e.state?.cwd,e.status,J]),He=(0,l.useCallback)(e=>{if(A(e),T(null),Fe.current=e,e.x===`?`&&e.y===`?`){M({file:e,staged:``,worktree:``,untracked:!0});return}N(!0),F(null),J({type:`scm_filediff`,path:e.path},Me)||N(!1)},[J]),Ue=(0,l.useCallback)(e=>{T(e),A(null),M(null),E(``),O(!0),F(null),J({type:`scm_commit`,hash:e.hash},Ne)||O(!1)},[J]),X=(0,l.useCallback)((t,n)=>{if(!e.ready)return;let r={name:t,command:n,cwd:"${pwd}"},i,a=e.terminals.find(e=>e.title===t);a?(o.restart(a.id),ie({type:`run_command`,terminalId:a.id,conversationId:a.conversationId,command:r,cols:80,rows:24}),i=a.id):(i=re(),o.create({id:i,conversationId:e.activeConversationId||e.state?.conversationId||``,title:t,cwd:e.state?.cwd??``,cols:80,rows:24,running:!0,exitCode:null,command:r})),o.select(i),u()},[e.ready,e.state?.cwd,e.terminals,u,o]),We=(0,l.useCallback)(()=>{let e=V.trim();if(!e||I)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git commit -m "${t}"`),ke(ue(e)),H(``),W.current=p},[V,I,X]),Ge=(0,l.useCallback)(()=>{let e=V.trim();if(!e||I)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git add -A && git commit -m "${t}"`),ke(ue(e)),H(``),W.current=p},[V,I,X]),Ke=(0,l.useCallback)(e=>{I||X(`git add`,`git add -- ${ae(e.path)}`)},[I,X]),qe=(0,l.useCallback)(e=>{I||X(`git reset`,`git reset HEAD -- ${ae(e.path)}`)},[I,X]),Je=(0,l.useCallback)(()=>{if(!x||I)return;let e=y.find(e=>e.name===x);if(e?.remote&&typeof e.remote==`string`){let t=x.slice(e.remote.length+1);X(`git checkout`,`git checkout -b ${t} ${x} || git checkout ${x}`)}else X(`git checkout`,`git checkout ${x}`)},[x,y,I,X]),Ye=(0,l.useCallback)(()=>X(`git push`,`git push`),[X]),Xe=(0,l.useCallback)(()=>X(`git pull`,`git pull`),[X]),Ze=(0,l.useCallback)(()=>{L||I||!e.ready||e.status!==`open`||(z(null),J({type:`scm_commitmsg`},K)?R(!0):z(g(`scmGenMsgFail`)))},[L,I,e.ready,e.status,J,g]),Z=(0,l.useCallback)(()=>{J({type:`scm_history`},G)||(G.current=-1)},[J]);(0,l.useEffect)(()=>{s&&Y()},[s,Y]),(0,l.useEffect)(()=>{S===`history`&&_&&Z()},[S,_,Z]),(0,l.useEffect)(()=>{e.scmDirty>0&&s&&Y(!1,!0)},[e.scmDirty]),(0,l.useEffect)(()=>{if(!s||!e.ready||e.status!==`open`)return;let t=setInterval(()=>{document.visibilityState!==`hidden`&&Y(!1,!0)},3e4);return()=>clearInterval(t)},[s,e.ready,e.status,Y]),(0,l.useEffect)(()=>{let t=Ie.current;Ie.current=e.terminals,s&&e.terminals.some(e=>e.running===!1&&t.find(t=>t.id===e.id)?.running===!0&&e.title.startsWith(`git `))&&e.ready&&e.status===`open`&&(Y(!1,!0),S===`history`&&_&&Z())},[e.terminals,s,e.ready,e.status,Y,S,_,Z]);let Qe={staged:g(`scmStaged`),unstaged:g(`scmUnstaged`),untracked:g(`scmUntracked`),both:g(`scmStagedUnstaged`)},$e=le(C,U),et=e=>{let t=e.split(`
2
2
  `);return(0,m.jsx)(`pre`,{className:`scm-diff-pre`,children:t.map((e,t)=>{let n=``;return e.startsWith(`diff --git`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`similarity index`)||e.startsWith(`rename `)||e.startsWith(`copy `)||e.startsWith(`Binary files`)||e.startsWith(`---`)||e.startsWith(`+++`)?n=`hdr`:e.startsWith(`@@`)?n=`hunk`:e.startsWith(`+`)?n=`add`:e.startsWith(`-`)&&(n=`del`),(0,m.jsx)(`div`,{className:`scm-diff-line ${n}`,children:e||` `},t)})})},tt=d===void 0?[`host:scm-changes`,`host:scm-history`,`host:scm-refresh`,`host:scm-branch`,`host:scm-switch`,`host:scm-push`,`host:scm-pull`,`host:scm-input`,`host:scm-genmsg`,`host:scm-commit`,`host:scm-commit-all`,`host:scm-term`].map(e=>({id:e,source:`host`})):d.filter(e=>!e.hidden),nt=[`host:scm-branch`,`host:scm-switch`,`host:scm-push`,`host:scm-pull`,`host:scm-input`,`host:scm-genmsg`,`host:scm-commit`,`host:scm-commit-all`],rt=(e,t)=>{let n=new Set(e);return tt.filter(e=>n.has(e.id)||t&&e.source!==`host`)},it=e=>d===void 0||!d.some(t=>t.id===e&&t.hidden),Q=(e,t)=>{let n=tt.find(t=>t.id===e);return n?.labelExplicit?n.label:t},$={"host:scm-changes":(0,m.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`changes`,className:S===`changes`?`active`:``,onClick:()=>{ge(`changes`),F(null)},children:Q(`host:scm-changes`,g(`scmChanges`))}),"host:scm-history":(0,m.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`history`,className:S===`history`?`active`:``,onClick:()=>{ge(`history`),F(null)},children:Q(`host:scm-history`,g(`scmHistory`))}),"host:scm-refresh":(0,m.jsx)(`button`,{type:`button`,className:`panel-refresh`,title:g(`scmRefreshTip`),disabled:be,onClick:()=>Y(!0),children:(0,m.jsx)(r,{className:be?`scm-spin`:``})}),"host:scm-branch":(0,m.jsxs)(`select`,{className:`scm-select`,value:x,disabled:I||y.length===0,title:Q(`host:scm-branch`,g(`scmSwitchBranch`)),onChange:e=>pe(e.target.value),children:[(0,m.jsx)(`option`,{value:``,disabled:!0,children:g(`scmSelectBranch`)}),y.filter(e=>!e.remote).map(e=>(0,m.jsx)(`option`,{value:e.name,children:e.current?`* ${e.name}`:e.name},e.name)),y.some(e=>e.remote)&&(0,m.jsx)(`optgroup`,{label:g(`scmRemoteBranches`),children:y.filter(e=>e.remote).map(e=>(0,m.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),"host:scm-switch":(0,m.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!x||x===_?.branch||I,title:g(`scmSwitchBranchTip`,{branch:x}),onClick:Je,children:[(0,m.jsx)(i,{}),Q(`host:scm-switch`,g(`scmSwitch`))]}),"host:scm-push":(0,m.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!_||_.detached||I,title:g(`scmPushTip`),onClick:Ye,children:[(0,m.jsx)(te,{}),Q(`host:scm-push`,g(`scmPush`))]}),"host:scm-pull":(0,m.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!_||_.detached||I,title:g(`scmPullTip`),onClick:Xe,children:[(0,m.jsx)(ne,{}),Q(`host:scm-pull`,g(`scmPull`))]}),"host:scm-input":(0,m.jsx)(`input`,{className:`scm-commit-input`,value:V,placeholder:g(`scmCommitPlaceholder`),disabled:I,title:Oe.length>0?g(`scmCommitHistoryTip`):void 0,onChange:e=>{H(e.target.value),W.current=p},onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(e.key===`Enter`){We();return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){let t=de(Oe,W.current,V,e.key===`ArrowUp`?`up`:`down`);t&&(e.preventDefault(),W.current=t.state,H(t.text))}}}}),"host:scm-genmsg":(0,m.jsxs)(`button`,{type:`button`,className:`btn`,disabled:L||I||!_||_.files.length===0,title:g(`scmGenMsgTip`),onClick:Ze,children:[(0,m.jsx)(n,{className:L?`scm-spin`:``}),L?g(`scmGenMsgRunning`):Q(`host:scm-genmsg`,g(`scmGenMsg`))]}),"host:scm-commit":(0,m.jsxs)(`button`,{type:`button`,className:`btn primary`,disabled:!V.trim()||I,title:g(`scmCommitTip`),onClick:We,children:[(0,m.jsx)(a,{}),Q(`host:scm-commit`,g(`scmCommit`))]}),"host:scm-commit-all":(0,m.jsx)(`button`,{type:`button`,className:`btn`,disabled:!V.trim()||I,title:g(`scmCommitAllTip`),onClick:Ge,children:Q(`host:scm-commit-all`,g(`scmCommitAll`))})};return(0,m.jsxs)(`div`,{className:`scm-view`,children:[(0,m.jsxs)(`div`,{className:`scm-header`,children:[(0,m.jsxs)(`div`,{className:`scm-title-row`,children:[(0,m.jsxs)(`span`,{className:`scm-title`,children:[(0,m.jsx)(i,{}),g(`scmTitle`)]}),(0,m.jsx)(`div`,{className:`scm-view-tabs`,role:`tablist`,children:c(rt([`host:scm-changes`,`host:scm-history`],!1),$,h)}),c(rt([`host:scm-refresh`],!0),$,h)]}),(0,m.jsxs)(`div`,{className:`scm-row`,children:[(0,m.jsxs)(`span`,{className:`scm-branch-current`,title:g(`scmCurrentBranch`),children:[(0,m.jsx)(i,{}),_?_.detached?g(`scmDetached`):_.branch:`…`,_?.upstream&&(0,m.jsx)(`span`,{className:`scm-upstream`,children:_.upstreamGone?g(`scmUpstreamGone`):_.ahead>0||_.behind>0?g(`scmAheadBehind`,{ahead:_.ahead,behind:_.behind}):_.upstream})]}),c(rt(nt,!1),$,h)]}),Te&&(0,m.jsx)(`div`,{className:`scm-gen-error`,role:`alert`,title:g(`close`),onClick:()=>z(null),children:Te})]}),(0,m.jsxs)(`div`,{className:`scm-body`,ref:Re,style:{"--scm-sidebar-w":`${B}px`},children:[S===`history`?(0,m.jsxs)(`div`,{className:`scm-history`,children:[(0,m.jsxs)(`div`,{className:`scm-files-header`,children:[(0,m.jsx)(`span`,{children:g(`scmHistory`)}),C.length>0&&(0,m.jsx)(`span`,{className:`scm-files-count`,children:U.trim()?`${$e.length}/${C.length}`:C.length})]}),C.length>0&&!I&&(0,m.jsx)(`input`,{className:`scm-history-filter`,value:U,placeholder:g(`scmHistoryFilterPlaceholder`),title:g(`scmHistoryFilterTip`),onChange:e=>De(e.target.value)}),(0,m.jsx)(`div`,{className:`scm-history-list`,children:I?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNotGitRepo`)}):!_||Se?(0,m.jsx)(`div`,{className:`scm-empty`,children:e.status===`open`?g(`scmLoading`):g(`scmConnecting`)}):C.length===0?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNoHistory`)}):$e.length===0?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmHistoryFilterEmpty`)}):$e.map(e=>(0,m.jsxs)(`button`,{type:`button`,className:`scm-commit ${w?.hash===e.hash?`active`:``}`,onClick:()=>Ue(e),title:e.hash,children:[(0,m.jsx)(`span`,{className:`scm-commit-graph`,"aria-hidden":`true`,children:e.graph||`* `}),(0,m.jsxs)(`span`,{className:`scm-commit-info`,children:[(0,m.jsx)(`span`,{className:`scm-commit-subject`,children:e.subject}),(0,m.jsxs)(`span`,{className:`scm-commit-meta`,children:[e.shortHash,` · `,e.author,` · `,e.date]}),e.decorations&&(0,m.jsx)(`span`,{className:`scm-commit-refs`,children:e.decorations})]})]},e.hash))})]}):(0,m.jsxs)(`div`,{className:`scm-files`,children:[(0,m.jsxs)(`div`,{className:`scm-files-header`,children:[(0,m.jsx)(`span`,{children:g(`scmChanges`)}),_&&_.files.length>0&&(0,m.jsx)(`span`,{className:`scm-files-count`,children:_.files.length})]}),(0,m.jsx)(`div`,{className:`scm-files-list`,children:I?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNotGitRepo`)}):_?_.files.length===0?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNoChanges`)}):_.files.map(e=>{let t=fe(e),n=me.get(e.path);return(0,m.jsxs)(`div`,{className:`scm-file ${k?.path===e.path?`active`:``}`,title:Qe[t],onClick:()=>He(e),children:[(0,m.jsx)(`span`,{className:`scm-file-xy ${t===`untracked`?`q`:`x`}`,children:e.x===` `?`\xA0`:e.x}),(0,m.jsx)(`span`,{className:`scm-file-xy ${t===`untracked`?`q`:`y`}`,children:e.y===` `?`\xA0`:e.y}),(0,m.jsx)(`span`,{className:`scm-file-path`,children:e.path}),n&&(n.add>0||n.del>0)&&(0,m.jsxs)(`span`,{className:`scm-file-stat`,children:[n.add>0&&(0,m.jsxs)(`span`,{className:`add`,children:[`+`,n.add]}),n.del>0&&(0,m.jsxs)(`span`,{className:`del`,children:[`-`,n.del]})]}),(0,m.jsxs)(`span`,{className:`scm-file-actions`,children:[(e.y!==` `||t===`untracked`)&&(0,m.jsx)(`button`,{type:`button`,className:`scm-act`,title:g(`scmStageTip`,{path:e.path}),onClick:t=>{t.stopPropagation(),Ke(e)},children:`+`}),t===`staged`||t===`both`?(0,m.jsx)(`button`,{type:`button`,className:`scm-act`,title:g(`scmUnstageTip`,{path:e.path}),onClick:t=>{t.stopPropagation(),qe(e)},children:`−`}):null]})]},e.path)}):(0,m.jsx)(`div`,{className:`scm-empty`,children:e.status===`open`?g(`scmLoading`):g(`scmConnecting`)})})]}),(0,m.jsx)(`div`,{className:`scm-divider`,role:`separator`,"aria-orientation":`vertical`,title:g(`dragToResize`),onPointerDown:ze,onDoubleClick:Be}),(0,m.jsxs)(`div`,{className:`scm-diff`,children:[(0,m.jsxs)(`div`,{className:`scm-diff-header`,children:[(0,m.jsx)(`span`,{children:S===`history`?w?`${w.shortHash} ${w.subject}`:g(`scmCommitDetail`):k?k.path:g(`scmDiff`)}),(S===`history`?D:ye)&&(0,m.jsx)(`span`,{className:`scm-diff-loading`,children:g(`scmLoading`)})]}),(0,m.jsx)(`div`,{className:`scm-diff-body`,children:S===`history`?(0,m.jsxs)(m.Fragment,{children:[P&&(0,m.jsx)(`div`,{className:`scm-error`,children:P}),!w&&!P&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmSelectCommitHint`)}),w&&D&&!P&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmLoading`)}),w&&!D&&!P&&ve?et(ve):null]}):(0,m.jsxs)(m.Fragment,{children:[P&&(0,m.jsx)(`div`,{className:`scm-error`,children:P}),!k&&!P&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmSelectFileHint`)}),k&&!j&&!P&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmLoading`)}),k&&j&&j.untracked&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmUntrackedNote`)}),k&&j&&!j.untracked&&(0,m.jsxs)(m.Fragment,{children:[j.staged&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`scm-diff-section`,children:g(`scmStaged`)}),et(j.staged)]}),j.worktree&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`scm-diff-section`,children:g(`scmUnstaged`)}),et(j.worktree)]}),!j.staged&&!j.worktree&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNoDiff`)})]})]})})]})]}),(0,m.jsxs)(`div`,{className:`scm-hint`,children:[(0,m.jsx)(t,{}),(0,m.jsx)(`span`,{children:g(`scmRunsInTerminal`)}),it(`host:scm-term`)&&(0,m.jsx)(`button`,{type:`button`,className:`scm-goto-term`,onClick:u,children:Q(`host:scm-term`,g(`scmViewTerminal`))})]})]})}export{h as ScmPanel};
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Bt as t,N as n,Tt as r,Y as i,_ as a,an as ee,l as te,s as ne}from"./fi-DaSO0Q-m.js";import{i as o,t as s}from"./react-CR5VJ85Q.js";import{t as re}from"./uuid-BzDIGCwP.js";import{t as ie}from"./app-globals-DcyO0UPi.js";import{U as c}from"./index-Cdh3sibd.js";var l=e(o(),1),ae=e=>`'${e.replace(/'/g,`'\\''`)}'`,oe=`pi-web-ui:scm-sidebar-width`;function se(e,t=0){if(!Number.isFinite(e))return 300;let n=Math.max(200,Math.min(720,t>0?t-220:720));return Math.min(n,Math.max(200,Math.round(e)))}function ce(e){return e===null||e.trim()===``?300:se(Number(e))}function u(e,t){let n=t.toLowerCase();return e.subject.toLowerCase().includes(n)||e.author.toLowerCase().includes(n)||e.shortHash.toLowerCase().includes(n)||e.hash.toLowerCase().includes(n)||e.decorations!==void 0&&e.decorations.toLowerCase().includes(n)}function le(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?e:e.filter(e=>n.every(t=>u(e,t)))}var d=`scm-commit-history`;function f(e=localStorage){try{let t=e.getItem(d);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):[]}catch{return[]}}function ue(e,t=localStorage){let n=e.trim();if(!n)return f(t);let r=[n,...f(t).filter(e=>e!==n)].slice(0,20);try{t.setItem(d,JSON.stringify(r))}catch{}return r}var p={idx:-1,draft:``};function de(e,t,n,r){return e.length===0?null:r===`up`?t.idx>=e.length-1?null:t.idx===-1?{state:{idx:0,draft:n},text:e[0]}:{state:{idx:t.idx+1,draft:t.draft},text:e[t.idx+1]}:t.idx===-1?null:t.idx===0?{state:p,text:t.draft}:{state:{idx:t.idx-1,draft:t.draft},text:e[t.idx-1]}}var m=s();function fe(e){if(e.x===`?`&&e.y===`?`)return`untracked`;let t=e.x!==` `&&e.x!==`?`,n=e.y!==` `&&e.y!==`?`;return t&&n?`both`:t?`staged`:`unstaged`}function h({chat:e,terminal:o,active:s,onSwitchToTerminal:u,uiScmToolbar:d,onUiAction:h}){let g=ee(),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)([]),[x,pe]=(0,l.useState)(``),[me,he]=(0,l.useState)(new Map),[S,ge]=(0,l.useState)(`changes`),[C,_e]=(0,l.useState)([]),[w,T]=(0,l.useState)(null),[ve,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(!1),[k,A]=(0,l.useState)(null),[j,M]=(0,l.useState)(null),[ye,N]=(0,l.useState)(!1),[be,xe]=(0,l.useState)(!1),[Se,Ce]=(0,l.useState)(!1),[P,F]=(0,l.useState)(null),[I,we]=(0,l.useState)(!1),[L,R]=(0,l.useState)(!1),[Te,z]=(0,l.useState)(null),[B,Ee]=(0,l.useState)(()=>ce(localStorage.getItem(oe))),[V,H]=(0,l.useState)(``),[U,De]=(0,l.useState)(``),[Oe,ke]=(0,l.useState)(()=>f()),W=(0,l.useRef)(p),Ae=(0,l.useRef)(0),je=(0,l.useRef)(-1),Me=(0,l.useRef)(-1),Ne=(0,l.useRef)(-1),G=(0,l.useRef)(-1),K=(0,l.useRef)(-1),Pe=(0,l.useRef)(void 0),Fe=(0,l.useRef)(null),Ie=(0,l.useRef)([]),Le=(0,l.useRef)(B);Le.current=B;let Re=(0,l.useRef)(null),q=(0,l.useCallback)(e=>{try{localStorage.setItem(oe,String(e))}catch{}},[]),ze=(0,l.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=Le.current,r=Re.current?.getBoundingClientRect().width??0,i=n,a=e=>{i=se(n+(e.clientX-t),r),Ee(i)},ee=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,ee),document.body.classList.remove(`panel-resizing`),q(i)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,ee),document.body.classList.add(`panel-resizing`)},[q]),Be=(0,l.useCallback)(()=>{Ee(300),q(300)},[q]),Ve=(0,l.useCallback)(e=>{if(e.reqId===je.current){if(je.current=-1,xe(!1),F(null),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}if(e.notRepo){we(!0),v(null),b([]),he(new Map),_e([]),T(null),E(``),M(null);return}we(!1);let t={branch:e.branch??``,detached:!!e.detached,upstream:e.upstream??null,ahead:e.ahead??0,behind:e.behind??0,upstreamGone:!!e.upstreamGone,files:(e.files??[]).map(e=>({...e}))},n=(e.branches??[]).map(e=>({...e})),r=new Map;for(let[t,n]of Object.entries(e.stats??{}))r.set(t,{add:n[0],del:n[1]});v(t),b(n),he(r),pe(e=>t.detached?e||``:t.branch&&n.some(e=>e.name===t.branch)?t.branch:e&&n.some(t=>t.name===e)?e:n[0]?.name??``),M(e=>e&&!t.files.some(t=>t.path===e.file.path)?null:e)}else if(e.reqId===Me.current){if(Me.current=-1,N(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}let t=Fe.current;if(!t)return;M({file:t,staged:e.stagedText??``,worktree:e.worktreeText??``,untracked:!1})}else if(e.reqId===G.current){if(G.current=-1,Ce(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}_e((e.history??[]).map(e=>({...e})))}else if(e.reqId===Ne.current){if(Ne.current=-1,O(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}E(e.text??``)}else if(e.reqId===K.current){if(K.current=-1,R(!1),!e.ok){z(e.error??g(`scmGenMsgFail`));return}z(null),H(e.text??``)}},[]);(0,l.useEffect)(()=>{let t=e.scmData;t&&t.type===`scm_data`&&Ve(t)},[e.scmData,Ve]);let J=(0,l.useCallback)((t,n)=>{if(!e.ready||e.status!==`open`)return!1;let r=++Ae.current;return ie({...t,reqId:r})?(n.current=r,!0):(--Ae.current,!1)},[e.ready,e.status]),Y=(0,l.useCallback)((t=!1,n=!1)=>{e.ready&&e.status===`open`&&e.state?.cwd&&(Pe.current!==void 0&&Pe.current!==e.state.cwd&&(v(null),b([]),he(new Map),_e([]),De(``),Ce(!1),G.current=-1,T(null),E(``),M(null),A(null),z(null),R(!1),K.current=-1),Pe.current=e.state.cwd,F(null),J({type:`scm_status`},je)&&(n||xe(!0)))},[e.ready,e.state?.cwd,e.status,J]),He=(0,l.useCallback)(e=>{if(A(e),T(null),Fe.current=e,e.x===`?`&&e.y===`?`){M({file:e,staged:``,worktree:``,untracked:!0});return}N(!0),F(null),J({type:`scm_filediff`,path:e.path},Me)||N(!1)},[J]),Ue=(0,l.useCallback)(e=>{T(e),A(null),M(null),E(``),O(!0),F(null),J({type:`scm_commit`,hash:e.hash},Ne)||O(!1)},[J]),X=(0,l.useCallback)((t,n)=>{if(!e.ready)return;let r={name:t,command:n,cwd:"${pwd}"},i,a=e.terminals.find(e=>e.title===t);a?(o.restart(a.id),ie({type:`run_command`,terminalId:a.id,conversationId:a.conversationId,command:r,cols:80,rows:24}),i=a.id):(i=re(),o.create({id:i,conversationId:e.activeConversationId||e.state?.conversationId||``,title:t,cwd:e.state?.cwd??``,cols:80,rows:24,running:!0,exitCode:null,command:r})),o.select(i),u()},[e.ready,e.state?.cwd,e.terminals,u,o]),We=(0,l.useCallback)(()=>{let e=V.trim();if(!e||I)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git commit -m "${t}"`),ke(ue(e)),H(``),W.current=p},[V,I,X]),Ge=(0,l.useCallback)(()=>{let e=V.trim();if(!e||I)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git add -A && git commit -m "${t}"`),ke(ue(e)),H(``),W.current=p},[V,I,X]),Ke=(0,l.useCallback)(e=>{I||X(`git add`,`git add -- ${ae(e.path)}`)},[I,X]),qe=(0,l.useCallback)(e=>{I||X(`git reset`,`git reset HEAD -- ${ae(e.path)}`)},[I,X]),Je=(0,l.useCallback)(()=>{if(!x||I)return;let e=y.find(e=>e.name===x);if(e?.remote&&typeof e.remote==`string`){let t=x.slice(e.remote.length+1);X(`git checkout`,`git checkout -b ${t} ${x} || git checkout ${x}`)}else X(`git checkout`,`git checkout ${x}`)},[x,y,I,X]),Ye=(0,l.useCallback)(()=>X(`git push`,`git push`),[X]),Xe=(0,l.useCallback)(()=>X(`git pull`,`git pull`),[X]),Ze=(0,l.useCallback)(()=>{L||I||!e.ready||e.status!==`open`||(z(null),J({type:`scm_commitmsg`},K)?R(!0):z(g(`scmGenMsgFail`)))},[L,I,e.ready,e.status,J,g]),Z=(0,l.useCallback)(()=>{J({type:`scm_history`},G)||(G.current=-1)},[J]);(0,l.useEffect)(()=>{s&&Y()},[s,Y]),(0,l.useEffect)(()=>{S===`history`&&_&&Z()},[S,_,Z]),(0,l.useEffect)(()=>{e.scmDirty>0&&s&&Y(!1,!0)},[e.scmDirty]),(0,l.useEffect)(()=>{if(!s||!e.ready||e.status!==`open`)return;let t=setInterval(()=>{document.visibilityState!==`hidden`&&Y(!1,!0)},3e4);return()=>clearInterval(t)},[s,e.ready,e.status,Y]),(0,l.useEffect)(()=>{let t=Ie.current;Ie.current=e.terminals,s&&e.terminals.some(e=>e.running===!1&&t.find(t=>t.id===e.id)?.running===!0&&e.title.startsWith(`git `))&&e.ready&&e.status===`open`&&(Y(!1,!0),S===`history`&&_&&Z())},[e.terminals,s,e.ready,e.status,Y,S,_,Z]);let Qe={staged:g(`scmStaged`),unstaged:g(`scmUnstaged`),untracked:g(`scmUntracked`),both:g(`scmStagedUnstaged`)},$e=le(C,U),et=e=>{let t=e.split(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Bt as t,N as n,Tt as r,Y as i,_ as a,an as ee,l as te,s as ne}from"./fi-NyN-ZrgD.js";import{i as o,t as s}from"./react-CR5VJ85Q.js";import{t as re}from"./uuid-BzDIGCwP.js";import{t as ie}from"./app-globals-DcyO0UPi.js";import{U as c}from"./index-DK3F5ZJo.js";var l=e(o(),1),ae=e=>`'${e.replace(/'/g,`'\\''`)}'`,oe=`pi-web-ui:scm-sidebar-width`;function se(e,t=0){if(!Number.isFinite(e))return 300;let n=Math.max(200,Math.min(720,t>0?t-220:720));return Math.min(n,Math.max(200,Math.round(e)))}function ce(e){return e===null||e.trim()===``?300:se(Number(e))}function u(e,t){let n=t.toLowerCase();return e.subject.toLowerCase().includes(n)||e.author.toLowerCase().includes(n)||e.shortHash.toLowerCase().includes(n)||e.hash.toLowerCase().includes(n)||e.decorations!==void 0&&e.decorations.toLowerCase().includes(n)}function le(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);return n.length===0?e:e.filter(e=>n.every(t=>u(e,t)))}var d=`scm-commit-history`;function f(e=localStorage){try{let t=e.getItem(d);if(!t)return[];let n=JSON.parse(t);return Array.isArray(n)?n.filter(e=>typeof e==`string`&&e.length>0):[]}catch{return[]}}function ue(e,t=localStorage){let n=e.trim();if(!n)return f(t);let r=[n,...f(t).filter(e=>e!==n)].slice(0,20);try{t.setItem(d,JSON.stringify(r))}catch{}return r}var p={idx:-1,draft:``};function de(e,t,n,r){return e.length===0?null:r===`up`?t.idx>=e.length-1?null:t.idx===-1?{state:{idx:0,draft:n},text:e[0]}:{state:{idx:t.idx+1,draft:t.draft},text:e[t.idx+1]}:t.idx===-1?null:t.idx===0?{state:p,text:t.draft}:{state:{idx:t.idx-1,draft:t.draft},text:e[t.idx-1]}}var m=s();function fe(e){if(e.x===`?`&&e.y===`?`)return`untracked`;let t=e.x!==` `&&e.x!==`?`,n=e.y!==` `&&e.y!==`?`;return t&&n?`both`:t?`staged`:`unstaged`}function h({chat:e,terminal:o,active:s,onSwitchToTerminal:u,uiScmToolbar:d,onUiAction:h}){let g=ee(),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)([]),[x,pe]=(0,l.useState)(``),[me,he]=(0,l.useState)(new Map),[S,ge]=(0,l.useState)(`changes`),[C,_e]=(0,l.useState)([]),[w,T]=(0,l.useState)(null),[ve,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(!1),[k,A]=(0,l.useState)(null),[j,M]=(0,l.useState)(null),[ye,N]=(0,l.useState)(!1),[be,xe]=(0,l.useState)(!1),[Se,Ce]=(0,l.useState)(!1),[P,F]=(0,l.useState)(null),[I,we]=(0,l.useState)(!1),[L,R]=(0,l.useState)(!1),[Te,z]=(0,l.useState)(null),[B,Ee]=(0,l.useState)(()=>ce(localStorage.getItem(oe))),[V,H]=(0,l.useState)(``),[U,De]=(0,l.useState)(``),[Oe,ke]=(0,l.useState)(()=>f()),W=(0,l.useRef)(p),Ae=(0,l.useRef)(0),je=(0,l.useRef)(-1),Me=(0,l.useRef)(-1),Ne=(0,l.useRef)(-1),G=(0,l.useRef)(-1),K=(0,l.useRef)(-1),Pe=(0,l.useRef)(void 0),Fe=(0,l.useRef)(null),Ie=(0,l.useRef)([]),Le=(0,l.useRef)(B);Le.current=B;let Re=(0,l.useRef)(null),q=(0,l.useCallback)(e=>{try{localStorage.setItem(oe,String(e))}catch{}},[]),ze=(0,l.useCallback)(e=>{e.preventDefault();let t=e.clientX,n=Le.current,r=Re.current?.getBoundingClientRect().width??0,i=n,a=e=>{i=se(n+(e.clientX-t),r),Ee(i)},ee=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,ee),document.body.classList.remove(`panel-resizing`),q(i)};window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,ee),document.body.classList.add(`panel-resizing`)},[q]),Be=(0,l.useCallback)(()=>{Ee(300),q(300)},[q]),Ve=(0,l.useCallback)(e=>{if(e.reqId===je.current){if(je.current=-1,xe(!1),F(null),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}if(e.notRepo){we(!0),v(null),b([]),he(new Map),_e([]),T(null),E(``),M(null);return}we(!1);let t={branch:e.branch??``,detached:!!e.detached,upstream:e.upstream??null,ahead:e.ahead??0,behind:e.behind??0,upstreamGone:!!e.upstreamGone,files:(e.files??[]).map(e=>({...e}))},n=(e.branches??[]).map(e=>({...e})),r=new Map;for(let[t,n]of Object.entries(e.stats??{}))r.set(t,{add:n[0],del:n[1]});v(t),b(n),he(r),pe(e=>t.detached?e||``:t.branch&&n.some(e=>e.name===t.branch)?t.branch:e&&n.some(t=>t.name===e)?e:n[0]?.name??``),M(e=>e&&!t.files.some(t=>t.path===e.file.path)?null:e)}else if(e.reqId===Me.current){if(Me.current=-1,N(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}let t=Fe.current;if(!t)return;M({file:t,staged:e.stagedText??``,worktree:e.worktreeText??``,untracked:!1})}else if(e.reqId===G.current){if(G.current=-1,Ce(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}_e((e.history??[]).map(e=>({...e})))}else if(e.reqId===Ne.current){if(Ne.current=-1,O(!1),!e.ok){F(e.error??g(`scmQueryFailedShort`));return}E(e.text??``)}else if(e.reqId===K.current){if(K.current=-1,R(!1),!e.ok){z(e.error??g(`scmGenMsgFail`));return}z(null),H(e.text??``)}},[]);(0,l.useEffect)(()=>{let t=e.scmData;t&&t.type===`scm_data`&&Ve(t)},[e.scmData,Ve]);let J=(0,l.useCallback)((t,n)=>{if(!e.ready||e.status!==`open`)return!1;let r=++Ae.current;return ie({...t,reqId:r})?(n.current=r,!0):(--Ae.current,!1)},[e.ready,e.status]),Y=(0,l.useCallback)((t=!1,n=!1)=>{e.ready&&e.status===`open`&&e.state?.cwd&&(Pe.current!==void 0&&Pe.current!==e.state.cwd&&(v(null),b([]),he(new Map),_e([]),De(``),Ce(!1),G.current=-1,T(null),E(``),M(null),A(null),z(null),R(!1),K.current=-1),Pe.current=e.state.cwd,F(null),J({type:`scm_status`},je)&&(n||xe(!0)))},[e.ready,e.state?.cwd,e.status,J]),He=(0,l.useCallback)(e=>{if(A(e),T(null),Fe.current=e,e.x===`?`&&e.y===`?`){M({file:e,staged:``,worktree:``,untracked:!0});return}N(!0),F(null),J({type:`scm_filediff`,path:e.path},Me)||N(!1)},[J]),Ue=(0,l.useCallback)(e=>{T(e),A(null),M(null),E(``),O(!0),F(null),J({type:`scm_commit`,hash:e.hash},Ne)||O(!1)},[J]),X=(0,l.useCallback)((t,n)=>{if(!e.ready)return;let r={name:t,command:n,cwd:"${pwd}"},i,a=e.terminals.find(e=>e.title===t);a?(o.restart(a.id),ie({type:`run_command`,terminalId:a.id,conversationId:a.conversationId,command:r,cols:80,rows:24}),i=a.id):(i=re(),o.create({id:i,conversationId:e.activeConversationId||e.state?.conversationId||``,title:t,cwd:e.state?.cwd??``,cols:80,rows:24,running:!0,exitCode:null,command:r})),o.select(i),u()},[e.ready,e.state?.cwd,e.terminals,u,o]),We=(0,l.useCallback)(()=>{let e=V.trim();if(!e||I)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git commit -m "${t}"`),ke(ue(e)),H(``),W.current=p},[V,I,X]),Ge=(0,l.useCallback)(()=>{let e=V.trim();if(!e||I)return;let t=e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/`/g,"\\`").replace(/\$/g,`\\$`);X(`git commit`,`git add -A && git commit -m "${t}"`),ke(ue(e)),H(``),W.current=p},[V,I,X]),Ke=(0,l.useCallback)(e=>{I||X(`git add`,`git add -- ${ae(e.path)}`)},[I,X]),qe=(0,l.useCallback)(e=>{I||X(`git reset`,`git reset HEAD -- ${ae(e.path)}`)},[I,X]),Je=(0,l.useCallback)(()=>{if(!x||I)return;let e=y.find(e=>e.name===x);if(e?.remote&&typeof e.remote==`string`){let t=x.slice(e.remote.length+1);X(`git checkout`,`git checkout -b ${t} ${x} || git checkout ${x}`)}else X(`git checkout`,`git checkout ${x}`)},[x,y,I,X]),Ye=(0,l.useCallback)(()=>X(`git push`,`git push`),[X]),Xe=(0,l.useCallback)(()=>X(`git pull`,`git pull`),[X]),Ze=(0,l.useCallback)(()=>{L||I||!e.ready||e.status!==`open`||(z(null),J({type:`scm_commitmsg`},K)?R(!0):z(g(`scmGenMsgFail`)))},[L,I,e.ready,e.status,J,g]),Z=(0,l.useCallback)(()=>{J({type:`scm_history`},G)||(G.current=-1)},[J]);(0,l.useEffect)(()=>{s&&Y()},[s,Y]),(0,l.useEffect)(()=>{S===`history`&&_&&Z()},[S,_,Z]),(0,l.useEffect)(()=>{e.scmDirty>0&&s&&Y(!1,!0)},[e.scmDirty]),(0,l.useEffect)(()=>{if(!s||!e.ready||e.status!==`open`)return;let t=setInterval(()=>{document.visibilityState!==`hidden`&&Y(!1,!0)},3e4);return()=>clearInterval(t)},[s,e.ready,e.status,Y]),(0,l.useEffect)(()=>{let t=Ie.current;Ie.current=e.terminals,s&&e.terminals.some(e=>e.running===!1&&t.find(t=>t.id===e.id)?.running===!0&&e.title.startsWith(`git `))&&e.ready&&e.status===`open`&&(Y(!1,!0),S===`history`&&_&&Z())},[e.terminals,s,e.ready,e.status,Y,S,_,Z]);let Qe={staged:g(`scmStaged`),unstaged:g(`scmUnstaged`),untracked:g(`scmUntracked`),both:g(`scmStagedUnstaged`)},$e=le(C,U),et=e=>{let t=e.split(`
2
2
  `);return(0,m.jsx)(`pre`,{className:`scm-diff-pre`,children:t.map((e,t)=>{let n=``;return e.startsWith(`diff --git`)||e.startsWith(`index `)||e.startsWith(`new file`)||e.startsWith(`deleted file`)||e.startsWith(`old mode`)||e.startsWith(`new mode`)||e.startsWith(`similarity index`)||e.startsWith(`rename `)||e.startsWith(`copy `)||e.startsWith(`Binary files`)||e.startsWith(`---`)||e.startsWith(`+++`)?n=`hdr`:e.startsWith(`@@`)?n=`hunk`:e.startsWith(`+`)?n=`add`:e.startsWith(`-`)&&(n=`del`),(0,m.jsx)(`div`,{className:`scm-diff-line ${n}`,children:e||` `},t)})})},tt=d===void 0?[`host:scm-changes`,`host:scm-history`,`host:scm-refresh`,`host:scm-branch`,`host:scm-switch`,`host:scm-push`,`host:scm-pull`,`host:scm-input`,`host:scm-genmsg`,`host:scm-commit`,`host:scm-commit-all`,`host:scm-term`].map(e=>({id:e,source:`host`})):d.filter(e=>!e.hidden),nt=[`host:scm-branch`,`host:scm-switch`,`host:scm-push`,`host:scm-pull`,`host:scm-input`,`host:scm-genmsg`,`host:scm-commit`,`host:scm-commit-all`],rt=(e,t)=>{let n=new Set(e);return tt.filter(e=>n.has(e.id)||t&&e.source!==`host`)},it=e=>d===void 0||!d.some(t=>t.id===e&&t.hidden),Q=(e,t)=>{let n=tt.find(t=>t.id===e);return n?.labelExplicit?n.label:t},$={"host:scm-changes":(0,m.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`changes`,className:S===`changes`?`active`:``,onClick:()=>{ge(`changes`),F(null)},children:Q(`host:scm-changes`,g(`scmChanges`))}),"host:scm-history":(0,m.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":S===`history`,className:S===`history`?`active`:``,onClick:()=>{ge(`history`),F(null)},children:Q(`host:scm-history`,g(`scmHistory`))}),"host:scm-refresh":(0,m.jsx)(`button`,{type:`button`,className:`panel-refresh`,title:g(`scmRefreshTip`),disabled:be,onClick:()=>Y(!0),children:(0,m.jsx)(r,{className:be?`scm-spin`:``})}),"host:scm-branch":(0,m.jsxs)(`select`,{className:`scm-select`,value:x,disabled:I||y.length===0,title:Q(`host:scm-branch`,g(`scmSwitchBranch`)),onChange:e=>pe(e.target.value),children:[(0,m.jsx)(`option`,{value:``,disabled:!0,children:g(`scmSelectBranch`)}),y.filter(e=>!e.remote).map(e=>(0,m.jsx)(`option`,{value:e.name,children:e.current?`* ${e.name}`:e.name},e.name)),y.some(e=>e.remote)&&(0,m.jsx)(`optgroup`,{label:g(`scmRemoteBranches`),children:y.filter(e=>e.remote).map(e=>(0,m.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),"host:scm-switch":(0,m.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!x||x===_?.branch||I,title:g(`scmSwitchBranchTip`,{branch:x}),onClick:Je,children:[(0,m.jsx)(i,{}),Q(`host:scm-switch`,g(`scmSwitch`))]}),"host:scm-push":(0,m.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!_||_.detached||I,title:g(`scmPushTip`),onClick:Ye,children:[(0,m.jsx)(te,{}),Q(`host:scm-push`,g(`scmPush`))]}),"host:scm-pull":(0,m.jsxs)(`button`,{type:`button`,className:`btn`,disabled:!_||_.detached||I,title:g(`scmPullTip`),onClick:Xe,children:[(0,m.jsx)(ne,{}),Q(`host:scm-pull`,g(`scmPull`))]}),"host:scm-input":(0,m.jsx)(`input`,{className:`scm-commit-input`,value:V,placeholder:g(`scmCommitPlaceholder`),disabled:I,title:Oe.length>0?g(`scmCommitHistoryTip`):void 0,onChange:e=>{H(e.target.value),W.current=p},onKeyDown:e=>{if(!e.nativeEvent.isComposing){if(e.key===`Enter`){We();return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){let t=de(Oe,W.current,V,e.key===`ArrowUp`?`up`:`down`);t&&(e.preventDefault(),W.current=t.state,H(t.text))}}}}),"host:scm-genmsg":(0,m.jsxs)(`button`,{type:`button`,className:`btn`,disabled:L||I||!_||_.files.length===0,title:g(`scmGenMsgTip`),onClick:Ze,children:[(0,m.jsx)(n,{className:L?`scm-spin`:``}),L?g(`scmGenMsgRunning`):Q(`host:scm-genmsg`,g(`scmGenMsg`))]}),"host:scm-commit":(0,m.jsxs)(`button`,{type:`button`,className:`btn primary`,disabled:!V.trim()||I,title:g(`scmCommitTip`),onClick:We,children:[(0,m.jsx)(a,{}),Q(`host:scm-commit`,g(`scmCommit`))]}),"host:scm-commit-all":(0,m.jsx)(`button`,{type:`button`,className:`btn`,disabled:!V.trim()||I,title:g(`scmCommitAllTip`),onClick:Ge,children:Q(`host:scm-commit-all`,g(`scmCommitAll`))})};return(0,m.jsxs)(`div`,{className:`scm-view`,children:[(0,m.jsxs)(`div`,{className:`scm-header`,children:[(0,m.jsxs)(`div`,{className:`scm-title-row`,children:[(0,m.jsxs)(`span`,{className:`scm-title`,children:[(0,m.jsx)(i,{}),g(`scmTitle`)]}),(0,m.jsx)(`div`,{className:`scm-view-tabs`,role:`tablist`,children:c(rt([`host:scm-changes`,`host:scm-history`],!1),$,h)}),c(rt([`host:scm-refresh`],!0),$,h)]}),(0,m.jsxs)(`div`,{className:`scm-row`,children:[(0,m.jsxs)(`span`,{className:`scm-branch-current`,title:g(`scmCurrentBranch`),children:[(0,m.jsx)(i,{}),_?_.detached?g(`scmDetached`):_.branch:`…`,_?.upstream&&(0,m.jsx)(`span`,{className:`scm-upstream`,children:_.upstreamGone?g(`scmUpstreamGone`):_.ahead>0||_.behind>0?g(`scmAheadBehind`,{ahead:_.ahead,behind:_.behind}):_.upstream})]}),c(rt(nt,!1),$,h)]}),Te&&(0,m.jsx)(`div`,{className:`scm-gen-error`,role:`alert`,title:g(`close`),onClick:()=>z(null),children:Te})]}),(0,m.jsxs)(`div`,{className:`scm-body`,ref:Re,style:{"--scm-sidebar-w":`${B}px`},children:[S===`history`?(0,m.jsxs)(`div`,{className:`scm-history`,children:[(0,m.jsxs)(`div`,{className:`scm-files-header`,children:[(0,m.jsx)(`span`,{children:g(`scmHistory`)}),C.length>0&&(0,m.jsx)(`span`,{className:`scm-files-count`,children:U.trim()?`${$e.length}/${C.length}`:C.length})]}),C.length>0&&!I&&(0,m.jsx)(`input`,{className:`scm-history-filter`,value:U,placeholder:g(`scmHistoryFilterPlaceholder`),title:g(`scmHistoryFilterTip`),onChange:e=>De(e.target.value)}),(0,m.jsx)(`div`,{className:`scm-history-list`,children:I?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNotGitRepo`)}):!_||Se?(0,m.jsx)(`div`,{className:`scm-empty`,children:e.status===`open`?g(`scmLoading`):g(`scmConnecting`)}):C.length===0?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNoHistory`)}):$e.length===0?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmHistoryFilterEmpty`)}):$e.map(e=>(0,m.jsxs)(`button`,{type:`button`,className:`scm-commit ${w?.hash===e.hash?`active`:``}`,onClick:()=>Ue(e),title:e.hash,children:[(0,m.jsx)(`span`,{className:`scm-commit-graph`,"aria-hidden":`true`,children:e.graph||`* `}),(0,m.jsxs)(`span`,{className:`scm-commit-info`,children:[(0,m.jsx)(`span`,{className:`scm-commit-subject`,children:e.subject}),(0,m.jsxs)(`span`,{className:`scm-commit-meta`,children:[e.shortHash,` · `,e.author,` · `,e.date]}),e.decorations&&(0,m.jsx)(`span`,{className:`scm-commit-refs`,children:e.decorations})]})]},e.hash))})]}):(0,m.jsxs)(`div`,{className:`scm-files`,children:[(0,m.jsxs)(`div`,{className:`scm-files-header`,children:[(0,m.jsx)(`span`,{children:g(`scmChanges`)}),_&&_.files.length>0&&(0,m.jsx)(`span`,{className:`scm-files-count`,children:_.files.length})]}),(0,m.jsx)(`div`,{className:`scm-files-list`,children:I?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNotGitRepo`)}):_?_.files.length===0?(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNoChanges`)}):_.files.map(e=>{let t=fe(e),n=me.get(e.path);return(0,m.jsxs)(`div`,{className:`scm-file ${k?.path===e.path?`active`:``}`,title:Qe[t],onClick:()=>He(e),children:[(0,m.jsx)(`span`,{className:`scm-file-xy ${t===`untracked`?`q`:`x`}`,children:e.x===` `?`\xA0`:e.x}),(0,m.jsx)(`span`,{className:`scm-file-xy ${t===`untracked`?`q`:`y`}`,children:e.y===` `?`\xA0`:e.y}),(0,m.jsx)(`span`,{className:`scm-file-path`,children:e.path}),n&&(n.add>0||n.del>0)&&(0,m.jsxs)(`span`,{className:`scm-file-stat`,children:[n.add>0&&(0,m.jsxs)(`span`,{className:`add`,children:[`+`,n.add]}),n.del>0&&(0,m.jsxs)(`span`,{className:`del`,children:[`-`,n.del]})]}),(0,m.jsxs)(`span`,{className:`scm-file-actions`,children:[(e.y!==` `||t===`untracked`)&&(0,m.jsx)(`button`,{type:`button`,className:`scm-act`,title:g(`scmStageTip`,{path:e.path}),onClick:t=>{t.stopPropagation(),Ke(e)},children:`+`}),t===`staged`||t===`both`?(0,m.jsx)(`button`,{type:`button`,className:`scm-act`,title:g(`scmUnstageTip`,{path:e.path}),onClick:t=>{t.stopPropagation(),qe(e)},children:`−`}):null]})]},e.path)}):(0,m.jsx)(`div`,{className:`scm-empty`,children:e.status===`open`?g(`scmLoading`):g(`scmConnecting`)})})]}),(0,m.jsx)(`div`,{className:`scm-divider`,role:`separator`,"aria-orientation":`vertical`,title:g(`dragToResize`),onPointerDown:ze,onDoubleClick:Be}),(0,m.jsxs)(`div`,{className:`scm-diff`,children:[(0,m.jsxs)(`div`,{className:`scm-diff-header`,children:[(0,m.jsx)(`span`,{children:S===`history`?w?`${w.shortHash} ${w.subject}`:g(`scmCommitDetail`):k?k.path:g(`scmDiff`)}),(S===`history`?D:ye)&&(0,m.jsx)(`span`,{className:`scm-diff-loading`,children:g(`scmLoading`)})]}),(0,m.jsx)(`div`,{className:`scm-diff-body`,children:S===`history`?(0,m.jsxs)(m.Fragment,{children:[P&&(0,m.jsx)(`div`,{className:`scm-error`,children:P}),!w&&!P&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmSelectCommitHint`)}),w&&D&&!P&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmLoading`)}),w&&!D&&!P&&ve?et(ve):null]}):(0,m.jsxs)(m.Fragment,{children:[P&&(0,m.jsx)(`div`,{className:`scm-error`,children:P}),!k&&!P&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmSelectFileHint`)}),k&&!j&&!P&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmLoading`)}),k&&j&&j.untracked&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmUntrackedNote`)}),k&&j&&!j.untracked&&(0,m.jsxs)(m.Fragment,{children:[j.staged&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`scm-diff-section`,children:g(`scmStaged`)}),et(j.staged)]}),j.worktree&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{className:`scm-diff-section`,children:g(`scmUnstaged`)}),et(j.worktree)]}),!j.staged&&!j.worktree&&(0,m.jsx)(`div`,{className:`scm-empty`,children:g(`scmNoDiff`)})]})]})})]})]}),(0,m.jsxs)(`div`,{className:`scm-hint`,children:[(0,m.jsx)(t,{}),(0,m.jsx)(`span`,{children:g(`scmRunsInTerminal`)}),it(`host:scm-term`)&&(0,m.jsx)(`button`,{type:`button`,className:`scm-goto-term`,onClick:u,children:Q(`host:scm-term`,g(`scmViewTerminal`))})]})]})}export{h as ScmPanel};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{At as t,B as n,Bt as r,C as i,Ct as a,E as o,Ft as s,G as c,Gt as l,Ht as u,It as d,Jt as f,K as p,Kt as m,L as h,Mt as g,N as ee,Nt as te,Pt as ne,R as re,Tt as _,V as ie,Vt as ae,Xt as oe,Y as se,Yt as v,Z as ce,_ as le,a as ue,an as y,at as de,b as fe,cn as b,et as pe,f as x,h as me,it as he,jt as ge,kt as S,mt as _e,o as ve,q as ye,qt as be,r as xe,rn as Se,wt as C,xt as Ce,z as w}from"./fi-DaSO0Q-m.js";import{i as T,t as we}from"./react-CR5VJ85Q.js";import{t as Te}from"./shortcut-stack-hhrDyRBn.js";import{t as E}from"./uuid-BzDIGCwP.js";import{c as Ee,f as D,p as O}from"./plugin-host-BRBg6zmQ.js";import{a as k,s as A,t as j}from"./app-globals-DcyO0UPi.js";import{$ as M,A as De,At as Oe,B as ke,C as Ae,Ct as je,D as Me,Dt as Ne,E as Pe,Et as Fe,Ft as Ie,G as Le,I as Re,It as ze,J as Be,L as Ve,Lt as He,M as Ue,Mt as We,N as Ge,Nt as Ke,Ot as qe,Pt as Je,Q as Ye,R as Xe,Rt as Ze,S as Qe,St as $e,Tt as N,V as et,X as tt,Y as P,Z as nt,_ as rt,at as it,b as at,c as F,d as ot,et as st,f as ct,ft as lt,g as I,gt as ut,h as dt,ht as ft,i as pt,it as L,j as mt,jt as ht,k as gt,kt as _t,l as vt,lt as yt,m as bt,mt as xt,n as St,o as Ct,ot as wt,p as Tt,pt as Et,q as R,r as Dt,rt as Ot,s as kt,st as At,t as jt,u as Mt,ut as Nt,v as Pt,w as Ft,wt as It,x as Lt,xt as Rt,y as zt,z as Bt}from"./index-DWw_SxRq.js";var z=e(T(),1),B=we();function Vt({name:e,override:t,onApply:n,onClose:r}){let i=y(),a=st(e),[o,s]=(0,z.useState)(()=>t?.description??``),[c,l]=(0,z.useState)(()=>t?.promptSnippet??``),[u,d]=(0,z.useState)(()=>(t?.promptGuidelines??[]).join(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{At as t,B as n,Bt as r,C as i,Ct as a,E as o,Ft as s,G as c,Gt as l,Ht as u,It as d,Jt as f,K as p,Kt as m,L as h,Mt as g,N as ee,Nt as te,Pt as ne,R as re,Tt as _,V as ie,Vt as ae,Xt as oe,Y as se,Yt as v,Z as ce,_ as le,a as ue,an as y,at as de,b as fe,cn as b,et as pe,f as x,h as me,it as he,jt as ge,kt as S,mt as _e,o as ve,q as ye,qt as be,r as xe,rn as Se,wt as C,xt as Ce,z as w}from"./fi-NyN-ZrgD.js";import{i as T,t as we}from"./react-CR5VJ85Q.js";import{t as Te}from"./shortcut-stack-hhrDyRBn.js";import{t as E}from"./uuid-BzDIGCwP.js";import{c as Ee,f as D,p as O}from"./plugin-host-BCnX3P8U.js";import{a as k,s as A,t as j}from"./app-globals-DcyO0UPi.js";import{$ as M,A as De,At as Oe,B as ke,C as Ae,Ct as je,D as Me,Dt as Ne,E as Pe,Et as Fe,Ft as Ie,G as Le,I as Re,It as ze,J as Be,L as Ve,Lt as He,M as Ue,Mt as We,N as Ge,Nt as Ke,Ot as qe,Pt as Je,Q as Ye,R as Xe,Rt as Ze,S as Qe,St as $e,Tt as N,V as et,X as tt,Y as P,Z as nt,_ as rt,at as it,b as at,c as F,d as ot,et as st,f as ct,ft as lt,g as I,gt as ut,h as dt,ht as ft,i as pt,it as L,j as mt,jt as ht,k as gt,kt as _t,l as vt,lt as yt,m as bt,mt as xt,n as St,o as Ct,ot as wt,p as Tt,pt as Et,q as R,r as Dt,rt as Ot,s as kt,st as At,t as jt,u as Mt,ut as Nt,v as Pt,w as Ft,wt as It,x as Lt,xt as Rt,y as zt,z as Bt}from"./index-DQMii2he.js";var z=e(T(),1),B=we();function Vt({name:e,override:t,onApply:n,onClose:r}){let i=y(),a=st(e),[o,s]=(0,z.useState)(()=>t?.description??``),[c,l]=(0,z.useState)(()=>t?.promptSnippet??``),[u,d]=(0,z.useState)(()=>(t?.promptGuidelines??[]).join(`
2
2
  `));(0,z.useEffect)(()=>{M(e)},[e]);let f=(0,z.useMemo)(()=>(a?.defaultPromptGuidelines??[]).join(`
3
3
  `),[a]),p=a?.status===`unsupported`||a?.status===`missing`;return(0,B.jsx)(je,{className:`tool-prompt-editor`,title:`${i(`toolPromptEdit`)} · ${e}`,icon:(0,B.jsx)(w,{}),onClose:r,children:(0,B.jsxs)(`div`,{className:`tool-prompt-body`,children:[p&&(0,B.jsx)(`p`,{className:`set-note`,children:i(`toolPromptUnavailable`)}),(0,B.jsx)(`p`,{className:`set-note`,children:i(`toolPromptHint`)}),(0,B.jsxs)(`label`,{className:`tool-prompt-field`,children:[(0,B.jsx)(`span`,{className:`set-field-label`,children:i(`toolPromptDescription`)}),(0,B.jsx)(`textarea`,{className:`set-prompt-input`,rows:5,value:o,placeholder:a?.defaultDescription??``,onChange:e=>s(e.target.value)}),a?.defaultDescription&&(0,B.jsxs)(`details`,{className:`tool-prompt-default`,children:[(0,B.jsx)(`summary`,{children:i(`toolPromptDefault`)}),(0,B.jsx)(`pre`,{children:a.defaultDescription})]})]}),(0,B.jsxs)(`label`,{className:`tool-prompt-field`,children:[(0,B.jsx)(`span`,{className:`set-field-label`,children:i(`toolPromptSnippet`)}),(0,B.jsx)(`input`,{type:`text`,className:`set-input`,value:c,placeholder:a?.defaultPromptSnippet??``,onChange:e=>l(e.target.value)}),a?.defaultPromptSnippet&&(0,B.jsxs)(`details`,{className:`tool-prompt-default`,children:[(0,B.jsx)(`summary`,{children:i(`toolPromptDefault`)}),(0,B.jsx)(`pre`,{children:a.defaultPromptSnippet})]})]}),(0,B.jsxs)(`label`,{className:`tool-prompt-field`,children:[(0,B.jsx)(`span`,{className:`set-field-label`,children:i(`toolPromptGuidelines`)}),(0,B.jsx)(`textarea`,{className:`set-prompt-input tool-prompt-guidelines`,rows:4,value:u,placeholder:f,onChange:e=>d(e.target.value)}),f&&(0,B.jsxs)(`details`,{className:`tool-prompt-default`,children:[(0,B.jsx)(`summary`,{children:i(`toolPromptDefault`)}),(0,B.jsx)(`pre`,{children:f})]})]}),(0,B.jsxs)(`div`,{className:`tool-prompt-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>{n(e,null),Ye(e),r()},children:i(`toolPromptReset`)}),(0,B.jsx)(`button`,{type:`button`,className:`btn primary`,onClick:()=>{let t={},i=o.trim();i&&(t.description=i);let a=c.trim();a&&(t.promptSnippet=a);let s=u.split(`
4
4
  `).map(e=>e.trim()).filter(Boolean);s.length>0&&(t.promptGuidelines=s),n(e,Object.keys(t).length>0?t:null),Ye(e),r()},children:i(`toolPromptSave`)})]})]})})}var Ht=[{id:`awesome-mcp-zh`,name:`Awesome MCP ZH (中文精选合集)`,nameZh:`Awesome MCP 中文精选市场与资源列表`,description:`The most popular Chinese curated list of Model Context Protocol servers, client integrations, and practical tutorials.`,descriptionZh:`7,700+ 星标的中文最全 MCP 精选合集:涵盖高德、飞书、微信、音视频、知识库等各类国内 MCP 插件列表与配置教程。`,url:`https://github.com/yzfly/Awesome-MCP-ZH`,category:`community`,region:`cn`,author:`yzfly`,badge:`7.7k★`,badgeZh:`7700星推荐`,tags:[`中文精选`,`国内生态`,`7700+星`,`教程指南`]},{id:`awesome-china-mcp`,name:`Awesome China MCP (国内常用应用市场)`,nameZh:`国内常用应用 MCP 专区列表`,description:`Curated index of MCP servers for Chinese apps: connect AI agents to AMap, 12306, Xiaohongshu, Feishu, Yuque, A-shares and more.`,descriptionZh:`专为国内生态打造的 MCP 列表专区:收录高德地图、12306 查票、小红书、飞书、语雀文档、A股量化等常用国内服务。`,url:`https://github.com/zackchewa/awesome-china-mcp`,category:`community`,region:`cn`,author:`zackchewa`,badge:`China Apps`,badgeZh:`国内应用专区`,tags:[`国内常用`,`高德地图`,`12306`,`飞书`,`小红书`]},{id:`awesome-mcp-wong2`,name:`Awesome MCP Servers (wong2)`,nameZh:`wong2 精选 MCP 服务与客户端合集`,description:`High-quality curated collection of MCP servers, clients, multi-language libraries, and developer tutorials.`,descriptionZh:`4,300+ 星标的经典精选合集,系统化整理了全球与中文优秀 MCP 服务实现、适配客户端与开发库。`,url:`https://github.com/wong2/awesome-mcp-servers`,category:`community`,region:`cn`,author:`wong2`,badge:`4.3k★`,badgeZh:`4300星精选`,tags:[`中文精选`,`多语言库`,`客户端`,`开发指南`]},{id:`smithery-ai`,name:`Smithery.ai MCP Registry`,nameZh:`Smithery 3,000+ 在线插件市场`,description:`The premier registry for discovering, deploying, and connecting 3,000+ Model Context Protocol servers with live search and CLI commands.`,descriptionZh:`主流的 MCP 服务器发现与注册市场,收录 3,000+ 个可在线检索与一键配置的 MCP 服务及连接命令。`,url:`https://smithery.ai/`,category:`marketplace`,region:`global`,author:`Smithery`,badge:`3000+ Servers`,badgeZh:`3000+插件`,tags:[`Marketplace`,`Registry`,`3000+ Servers`,`One-Click`]},{id:`mcpservers-org`,name:`mcpservers.org (9,800+ Servers)`,nameZh:`mcpservers.org 综合插件市场`,description:`Extensive directory and live search engine showcasing 9,800+ Model Context Protocol servers across categories.`,descriptionZh:`汇聚 9,800+ 款开源 MCP 服务器的大型在线市场,支持按分类检索、星标排行与一键复制配置命令。`,url:`https://mcpservers.org/`,category:`marketplace`,region:`global`,author:`mcpservers.org`,badge:`9800+ Servers`,badgeZh:`9800+插件`,tags:[`Directory`,`9800+ Servers`,`Search`,`Verified`]},{id:`glama-mcp`,name:`Glama MCP Marketplace`,nameZh:`Glama 开发者 MCP 市场`,description:`Explore hundreds of verified community MCP servers with live server status, developer reviews, configuration snippets, and security insights.`,descriptionZh:`发现经过检验的社区 MCP 服务器,支持在线服务状态监测、开发者评分、配置代码与安全合规提示。`,url:`https://glama.ai/mcp/servers`,category:`marketplace`,region:`global`,author:`Glama`,badge:`Market`,badgeZh:`开发者市场`,tags:[`Marketplace`,`Verified`,`Inspect`,`Reviews`]},{id:`pulsemcp`,name:`PulseMCP Ecosystem Hub`,nameZh:`PulseMCP 实时生态与趋势雷达`,description:`Weekly updated directory of trending MCP servers, tools, news, clients, and active developer projects in the ecosystem.`,descriptionZh:`每周动态更新的 MCP 趋势雷达与目录,汇集每周热门服务器、实用开发工具、适配客户端与生态快讯。`,url:`https://www.pulsemcp.com/`,category:`directory`,region:`global`,author:`PulseMCP`,badge:`Trending`,badgeZh:`实时趋势`,tags:[`Directory`,`Trending`,`Weekly Top`,`Ecosystem`]},{id:`mcp-so`,name:`MCP.so Directory`,nameZh:`MCP.so 综合分类导航目录`,description:`Comprehensive index of Model Context Protocol servers, searchable by category, tags, hosting requirements, and platform integrations.`,descriptionZh:`全面的 MCP 服务器目录索引,支持按业务分类、协议类型、部署依赖与集成目标精准筛选检索。`,url:`https://mcp.so/`,category:`directory`,region:`global`,author:`MCP.so`,badge:`Directory`,badgeZh:`分类导航`,tags:[`Directory`,`Search`,`Index`,`Categorized`]},{id:`mcp-get`,name:`mcp-get Registry`,nameZh:`mcp-get 发现与包管理平台`,description:`Package discovery and CLI registry for community MCP servers, making it easy to find and run verified servers across environments.`,descriptionZh:`面向开发者打造的 MCP 服务发现与命令行管理平台,便于快速定位并执行跨环境 MCP 服务。`,url:`https://mcp-get.com/`,category:`marketplace`,region:`global`,author:`mcp-get`,badge:`Registry`,badgeZh:`包检索`,tags:[`Registry`,`Package Manager`,`CLI`]},{id:`awesome-mcp-punkpeye`,name:`Awesome MCP Servers (Punkpeye)`,nameZh:`Punkpeye 1.6万星全球开源合集`,description:`A highly-rated curated list of Model Context Protocol servers, frameworks, and tools categorized by capability.`,descriptionZh:`GitHub 上 16,000+ 星标的最权威开源 MCP 清单,按开发、数据库、文件、搜索等数十个能力分类列出。`,url:`https://github.com/punkpeye/awesome-mcp-servers`,category:`community`,region:`global`,author:`Punkpeye & Contributors`,badge:`16k★`,badgeZh:`1.6万星合集`,tags:[`Awesome`,`GitHub`,`Curated`,`Global Top`]},{id:`mcp-official-servers`,name:`Anthropic MCP Reference Servers`,nameZh:`Anthropic 官方核心参考服务集目录`,description:`Anthropic's official open-source collection of reference MCP servers: filesystem, fetch, memory, sqlite, git, github, postgres, and more.`,descriptionZh:`Anthropic 官方开源的核心参考服务仓库目录:文件系统、网页抓取、持久记忆图谱、SQLite、Git、GitHub 等官方服务清单。`,url:`https://github.com/modelcontextprotocol/servers`,category:`official`,region:`global`,author:`Anthropic`,badge:`Official`,badgeZh:`官方参考`,tags:[`Official`,`Reference`,`GitHub`,`Core`]},{id:`github-topic-mcp`,name:`GitHub: #model-context-protocol`,nameZh:`GitHub 全球开源 MCP 仓库实时列表`,description:`Live directory of open-source repositories tagged with #model-context-protocol on GitHub, sorted by stars and recent activity.`,descriptionZh:`GitHub 官方标签直达,全球开源智能体 MCP 仓库实时列表,可按 Star 数和最新活跃度在线浏览。`,url:`https://github.com/topics/model-context-protocol`,category:`directory`,region:`global`,author:`GitHub Community`,badge:`GitHub Topic`,badgeZh:`全球开源`,tags:[`GitHub`,`Topic`,`Open Source`,`Real-Time`]},{id:`github-topic-mcp-server`,name:`GitHub: #mcp-server`,nameZh:`GitHub #mcp-server 实时开源服务列表`,description:`Live directory of thousands of open-source MCP server implementations on GitHub, filtered by #mcp-server topic.`,descriptionZh:`GitHub 官方 #mcp-server 标签实时聚合,直达全球开发者开源的具体 MCP Server 代码仓库列表。`,url:`https://github.com/topics/mcp-server`,category:`directory`,region:`global`,author:`GitHub Community`,badge:`GitHub Topic`,badgeZh:`服务实现`,tags:[`GitHub`,`Topic`,`mcp-server`,`Real-Time`]}];function Ut(e){return{name:e.name,scope:e.scope,transport:e.url||e.type===`http`||e.type===`streamable-http`?`http`:`stdio`,command:e.command??``,args:[...e.args??[]],cwd:e.cwd??``,env:Object.entries(e.env??{}).map(([e,t])=>({key:e,value:t})),url:e.url??``,headers:Object.entries(e.headers??{}).map(([e,t])=>({key:e,value:t})),timeout:e.timeout===void 0?``:String(e.timeout),description:e.description??``,enabled:e.enabled!==!1,isNew:!1,prevName:e.name,prevScope:e.scope,original:{...e,args:e.args?[...e.args]:void 0,env:e.env?{...e.env}:void 0,headers:e.headers?{...e.headers}:void 0}}}function Wt(e){let t=e.overriddenBy?`stopped`:e.status??`stopped`;return{status:t,label:e.overriddenBy?`mcpStatusOverridden`:e.usingPreviousConfig?`mcpStatusPreviousConfig`:t===`running`?`mcpStatusRunning`:t===`error`?`mcpStatusError`:`mcpStatusStopped`,toolsCount:e.overriddenBy?0:e.tools?.length??0}}function Gt(e){let t=e=>{let t=e.filter(e=>e.key.trim()).map(({key:e,value:t})=>[e.trim(),t]);return t.length?Object.fromEntries(t):void 0},n=Number(e.timeout);return{name:e.name.trim(),scope:e.scope,type:e.transport,command:e.transport===`stdio`&&e.command.trim()||void 0,args:e.transport===`stdio`?[...e.args]:void 0,cwd:e.transport===`stdio`&&e.cwd.trim()||void 0,env:e.transport===`stdio`?t(e.env):void 0,url:e.transport===`http`&&e.url.trim()||void 0,headers:e.transport===`http`?t(e.headers):void 0,timeout:Number.isFinite(n)&&n>0?n:void 0,description:e.description.trim()||void 0,enabled:e.enabled}}function Kt(e){let t=Gt(e);if(!e.original)return t;let{status:n,error:r,tools:i,overriddenBy:a,usingPreviousConfig:o,...s}=e.original,c=Gt(Ut(e.original)),l=c.type!==t.type,u=new Set([`type`,`command`,`args`,`cwd`,`env`,`url`,`headers`]);for(let e of Object.keys(t))(l&&u.has(e)||JSON.stringify(t[e])!==JSON.stringify(c[e]))&&Object.assign(s,{[e]:t[e]});return s}var qt=[{id:`custom`,label:`mcpPresetCustom`,description:`mcpPresetCustomDesc`,transport:`stdio`},{id:`filesystem`,label:`mcpPresetFilesystem`,description:`mcpPresetFilesystemDesc`,transport:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-filesystem`,`.`]},{id:`fetch`,label:`mcpPresetFetch`,description:`mcpPresetFetchDesc`,transport:`stdio`,command:`uvx`,args:[`mcp-server-fetch`]},{id:`memory`,label:`mcpPresetMemory`,description:`mcpPresetMemoryDesc`,transport:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-memory`]},{id:`github`,label:`mcpPresetGithub`,description:`mcpPresetGithubDesc`,transport:`stdio`,command:`npx`,args:[`-y`,`@modelcontextprotocol/server-github`],env:[{key:`GITHUB_PERSONAL_ACCESS_TOKEN`,value:``}]},{id:`sqlite`,label:`mcpPresetSqlite`,description:`mcpPresetSqliteDesc`,transport:`stdio`,command:`uvx`,args:[`mcp-server-sqlite`,`--db-path`,`./app.db`]}];function Jt({settings:e,chat:t}){let a=y(),[o,c]=(0,z.useState)(null),[l,d]=(0,z.useState)(``),[f,p]=(0,z.useState)(!1),m=t?.mcpOAuthResult?.reqId===o?.reqId?t?.mcpOAuthResult:null;(0,z.useEffect)(()=>{if(o)return()=>{j({type:`mcp_oauth_cancel`,reqId:o.reqId})}},[o]),(0,z.useEffect)(()=>{if(!o||!m?.id||m.status!==`pending`)return;let e=m.id,t=window.setInterval(()=>j({type:`mcp_oauth_status`,reqId:o.reqId,id:e}),1500);return()=>window.clearInterval(t)},[o,m?.id,m?.status]),(0,z.useEffect)(()=>{(m?.status===`complete`||m?.status===`error`||m?.error)&&(p(!1),d(``))},[m]);let h=()=>{c(null),d(``),p(!1)},g=e=>{let t=E();c({reqId:t,name:e.name}),d(``),p(!1),j({type:`mcp_oauth_start`,reqId:t,name:e.name,scope:e.scope})},{locale:ee}=Se(),[ne,ie]=(0,z.useState)(`configured`),[ae,oe]=(0,z.useState)(`all`),[se,ue]=(0,z.useState)(`all`),[pe,x]=(0,z.useState)(``),[me,he]=(0,z.useState)(null),[_e,ve]=(0,z.useState)({}),[be,Ce]=(0,z.useState)(!1),[w,T]=(0,z.useState)(null),[we,Te]=(0,z.useState)(null),[Ee,D]=(0,z.useState)(`custom`),O=e.mcpServers??[],k=e.mcpGlobalConfigPath||``,A=e.mcpProjectConfigPath||``,M=(0,z.useMemo)(()=>ae===`all`?O:O.filter(e=>e.scope===ae),[O,ae]),De=(e,t)=>{navigator.clipboard.writeText(t).then(()=>{he(e),setTimeout(()=>he(null),1500)},()=>{})},Oe=(0,z.useMemo)(()=>{let e=pe.trim().toLowerCase();return Ht.filter(t=>{if(se===`cn`&&t.region!==`cn`||se===`marketplace`&&t.category!==`marketplace`||se===`community`&&t.category!==`community`||se===`official`&&t.category!==`official`&&t.category!==`directory`)return!1;if(!e)return!0;let n=t.name.toLowerCase().includes(e)||t.nameZh.toLowerCase().includes(e),r=t.description.toLowerCase().includes(e)||t.descriptionZh.toLowerCase().includes(e),i=t.url.toLowerCase().includes(e),a=t.tags?.some(t=>t.toLowerCase().includes(e));return n||r||i||a})},[se,pe]),ke=(0,z.useMemo)(()=>O.filter(e=>e.scope===`global`).length,[O]),Ae=(0,z.useMemo)(()=>O.filter(e=>e.scope===`project`).length,[O]),je=()=>{Ce(!0),j({type:`reload_mcp`}),setTimeout(()=>Ce(!1),800)},Me=e=>{j({type:`toggle_mcp_server`,name:e.name,scope:e.scope,enabled:!e.enabled})},Ne=(e,t)=>{j({type:`delete_mcp_server`,name:e,scope:t}),Te(null)},Pe=e=>{ve(t=>({...t,[e]:!t[e]}))},Fe=(e=`global`,t=`custom`)=>{let n=qt.find(e=>e.id===t)||qt[0];D(n.id),T({name:n.id===`custom`?``:n.id,scope:e,transport:n.transport,command:n.command??``,args:[...n.args??[]],cwd:``,env:n.env?[...n.env]:[],url:n.url??``,headers:[],timeout:``,description:``,enabled:!0,isNew:!0})},Ie=e=>{D(`custom`),T(Ut(e))},Le=e=>{D(e);let t=qt.find(t=>t.id===e);t&&w&&e!==`custom`&&T(e=>e?{...e,name:e.name?e.name:t.id,transport:t.transport,command:t.command??e.command,args:t.args?[...t.args]:e.args,env:t.env?[...t.env]:e.env,url:t.url??e.url}:null)};return(0,B.jsxs)(`div`,{className:`set-section mcp-section`,children:[(0,B.jsxs)(`div`,{className:`set-section-title`,children:[(0,B.jsx)(ge,{className:`set-section-icon`}),a(`settingsMcp`),(0,B.jsx)(N,{text:a(`settingsMcpDesc`)}),(0,B.jsx)(`span`,{className:`set-count`,children:O.length}),(0,B.jsxs)(`div`,{className:`mcp-title-actions`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`set-save-btn mcp-reload-btn${be?` spinning`:``}`,title:a(`mcpReload`),onClick:je,children:[(0,B.jsx)(_,{}),(0,B.jsx)(`span`,{children:a(`mcpReload`)})]}),(0,B.jsxs)(`button`,{type:`button`,className:`set-save-btn mcp-add-btn`,title:a(`mcpAddServer`),onClick:()=>Fe(ae===`project`?`project`:`global`),children:[(0,B.jsx)(C,{}),(0,B.jsx)(`span`,{children:a(`mcpAddServer`)})]})]})]}),(0,B.jsxs)(`div`,{className:`mcp-tab-bar`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`mcp-tab-btn${ne===`configured`?` active`:``}`,onClick:()=>ie(`configured`),children:[(0,B.jsx)(ge,{}),(0,B.jsx)(`span`,{children:a(`mcpTabConfigured`)}),(0,B.jsx)(`span`,{className:`set-count`,children:O.length})]}),(0,B.jsxs)(`button`,{type:`button`,className:`mcp-tab-btn${ne===`market`?` active`:``}`,onClick:()=>ie(`market`),children:[(0,B.jsx)(s,{}),(0,B.jsx)(`span`,{children:a(`mcpTabMarket`)}),(0,B.jsx)(`span`,{className:`set-count`,children:Ht.length})]})]}),ne===`configured`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`mcp-meta-card`,children:[(0,B.jsxs)(`div`,{className:`mcp-scope-filter`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`mcp-scope-btn${ae===`all`?` active`:``}`,onClick:()=>oe(`all`),children:[a(`mcpFilterAll`),(0,B.jsx)(`span`,{className:`mcp-filter-count`,children:O.length})]}),(0,B.jsxs)(`button`,{type:`button`,className:`mcp-scope-btn${ae===`global`?` active`:``}`,onClick:()=>oe(`global`),children:[a(`mcpFilterGlobal`),(0,B.jsx)(`span`,{className:`mcp-filter-count`,children:ke})]}),(0,B.jsxs)(`button`,{type:`button`,className:`mcp-scope-btn${ae===`project`?` active`:``}`,onClick:()=>oe(`project`),children:[a(`mcpFilterProject`),(0,B.jsx)(`span`,{className:`mcp-filter-count`,children:Ae})]})]}),(0,B.jsxs)(`div`,{className:`mcp-paths-summary`,children:[k&&(0,B.jsxs)(`div`,{className:`mcp-path-row`,children:[(0,B.jsxs)(`span`,{className:`mcp-path-label`,children:[a(`mcpGlobalPath`),`:`]}),(0,B.jsx)(`code`,{className:`mcp-path-text`,title:k,children:k}),(0,B.jsx)(xt,{text:k})]}),A&&(0,B.jsxs)(`div`,{className:`mcp-path-row`,children:[(0,B.jsxs)(`span`,{className:`mcp-path-label`,children:[a(`mcpProjectPath`),`:`]}),(0,B.jsx)(`code`,{className:`mcp-path-text`,title:A,children:A}),(0,B.jsx)(xt,{text:A})]})]})]}),M.length===0?(0,B.jsxs)(`div`,{className:`mcp-empty-card`,children:[(0,B.jsx)(`div`,{className:`mcp-empty-icon`,children:(0,B.jsx)(ge,{})}),(0,B.jsx)(`div`,{className:`mcp-empty-title`,children:a(`mcpEmptyTitle`)}),(0,B.jsx)(`div`,{className:`mcp-empty-desc`,children:a(`mcpEmptyDesc`)}),(0,B.jsxs)(`div`,{className:`mcp-empty-quick-presets`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`mcp-goto-market-btn`,onClick:()=>ie(`market`),children:[(0,B.jsx)(s,{}),a(`mcpBrowseMarket`)]}),(0,B.jsxs)(`span`,{className:`mcp-quick-label`,children:[a(`mcpQuickAdd`),`:`]}),qt.filter(e=>e.id!==`custom`).map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`mcp-quick-btn`,onClick:()=>Fe(`global`,e.id),children:[(0,B.jsx)(C,{}),a(e.label)]},e.id))]})]}):(0,B.jsx)(`div`,{className:`mcp-servers-list`,children:M.map(e=>{let t=`${e.scope}:${e.name}`,n=!!_e[t],{status:s,label:c,toolsCount:l}=Wt(e);return(0,B.jsxs)(`div`,{className:`mcp-server-card${e.enabled?``:` disabled`}`,children:[(0,B.jsxs)(`div`,{className:`mcp-card-head`,children:[(0,B.jsxs)(`div`,{className:`mcp-card-title-group`,children:[(0,B.jsx)(`span`,{className:`mcp-server-name`,children:e.name}),(0,B.jsx)(`span`,{className:`mcp-scope-badge scope-${e.scope}`,children:e.scope===`global`?a(`mcpScopeGlobal`):a(`mcpScopeProject`)}),(0,B.jsx)(`span`,{className:`mcp-transport-badge`,children:e.url?`HTTP`:`stdio`}),(0,B.jsxs)(`span`,{className:`mcp-status-pill status-${s}`,children:[(0,B.jsx)(`span`,{className:`mcp-status-dot`}),a(c),s===`running`&&l>0?` (${l})`:``]})]}),(0,B.jsxs)(`div`,{className:`mcp-card-actions`,children:[e.url&&(0,B.jsx)(`button`,{type:`button`,className:`mcp-quick-btn`,disabled:!!o,onClick:()=>g(e),children:a(`mcpOAuthLogin`)}),(0,B.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e.enabled,className:`set-switch${e.enabled?` on`:``}`,title:e.enabled?a(`mcpDisableHint`):a(`mcpEnableHint`),onClick:()=>Me(e),children:(0,B.jsx)(`span`,{className:`set-switch-knob`})}),(0,B.jsx)(`button`,{type:`button`,className:`icon-btn mcp-action-btn`,title:a(`edit`),onClick:()=>Ie(e),children:(0,B.jsx)(re,{})}),(0,B.jsx)(`button`,{type:`button`,className:`icon-btn mcp-action-btn delete-btn`,title:a(`delete`),onClick:()=>Te({name:e.name,scope:e.scope}),children:(0,B.jsx)(u,{})})]})]}),(0,B.jsxs)(`div`,{className:`mcp-card-body`,children:[e.description&&(0,B.jsx)(`div`,{className:`mcp-server-desc`,children:e.description}),(0,B.jsx)(`div`,{className:`mcp-spec-line`,children:e.url?(0,B.jsxs)(`div`,{className:`mcp-spec-http`,children:[(0,B.jsx)(ce,{className:`mcp-spec-icon`}),(0,B.jsx)(`code`,{className:`mcp-spec-code`,children:e.url})]}):(0,B.jsxs)(`div`,{className:`mcp-spec-cmd`,children:[(0,B.jsx)(r,{className:`mcp-spec-icon`}),(0,B.jsxs)(`code`,{className:`mcp-spec-code`,children:[e.command,` `,e.args?.join(` `)]})]})}),e.cwd&&(0,B.jsxs)(`div`,{className:`mcp-spec-detail`,children:[(0,B.jsx)(ye,{className:`mcp-detail-icon`}),(0,B.jsx)(`span`,{className:`mcp-detail-label`,children:`cwd:`}),(0,B.jsx)(`code`,{children:e.cwd})]}),e.env&&Object.keys(e.env).length>0&&(0,B.jsxs)(`div`,{className:`mcp-spec-detail`,children:[(0,B.jsx)(`span`,{className:`mcp-detail-label`,children:`env:`}),(0,B.jsx)(`span`,{className:`mcp-env-tags`,children:Object.keys(e.env).map(e=>(0,B.jsx)(`span`,{className:`mcp-env-tag`,children:e},e))})]}),e.error&&(0,B.jsxs)(`div`,{className:`mcp-error-box`,children:[(0,B.jsx)(xe,{className:`mcp-error-icon`}),(0,B.jsx)(`div`,{className:`mcp-error-text`,children:e.error})]}),l>0&&(0,B.jsxs)(`div`,{className:`mcp-tools-accordion`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`mcp-tools-toggle`,onClick:()=>Pe(t),children:[(0,B.jsx)(de,{className:`mcp-tools-icon`}),(0,B.jsx)(`span`,{children:a(`mcpToolsCount`,{count:l})}),n?(0,B.jsx)(i,{}):(0,B.jsx)(fe,{})]}),n&&(0,B.jsx)(`div`,{className:`mcp-tools-content`,children:e.tools?.map(e=>(0,B.jsxs)(`div`,{className:`mcp-tool-item`,children:[(0,B.jsx)(`span`,{className:`mcp-tool-name`,children:e.name}),e.description&&(0,B.jsx)(`span`,{className:`mcp-tool-desc`,children:e.description})]},e.name))})]})]})]},t)})})]}),ne===`market`&&(0,B.jsxs)(`div`,{className:`mcp-market-view skill-market-view`,children:[(0,B.jsxs)(`div`,{className:`mcp-market-toolbar`,children:[(0,B.jsxs)(`div`,{className:`mcp-search-wrap`,children:[(0,B.jsx)(S,{className:`mcp-search-icon`}),(0,B.jsx)(`input`,{type:`text`,className:`set-input mcp-search-input`,placeholder:a(`mcpMarketSearchPlaceholder`),value:pe,onChange:e=>x(e.target.value)}),pe&&(0,B.jsx)(`button`,{type:`button`,className:`mcp-search-clear`,onClick:()=>x(``),children:(0,B.jsx)(v,{})})]}),(0,B.jsx)(`div`,{className:`mcp-category-chips`,children:[{id:`all`,label:`${a(`mcpCatAll`)} (${Ht.length})`},{id:`cn`,label:`${a(`mcpCatCn`)} (${Ht.filter(e=>e.region===`cn`).length})`},{id:`marketplace`,label:`${a(`mcpCatMarketplace`)} (${Ht.filter(e=>e.category===`marketplace`).length})`},{id:`community`,label:`${a(`mcpCatCommunity`)} (${Ht.filter(e=>e.category===`community`).length})`},{id:`official`,label:`${a(`mcpCatOfficial`)} (${Ht.filter(e=>e.category===`official`||e.category===`directory`).length})`}].map(e=>(0,B.jsx)(`button`,{type:`button`,className:`mcp-cat-chip${se===e.id?` active`:``}`,onClick:()=>ue(e.id),children:e.label},e.id))})]}),Oe.length===0?(0,B.jsxs)(`div`,{className:`mcp-empty-card`,children:[(0,B.jsx)(`div`,{className:`mcp-empty-icon`,children:(0,B.jsx)(S,{})}),(0,B.jsx)(`div`,{className:`mcp-empty-title`,children:a(`mcpMarketEmpty`)}),(0,B.jsx)(`button`,{type:`button`,className:`mcp-mini-btn`,onClick:()=>{x(``),ue(`all`)},children:a(`mcpMarketEmptyClear`)})]}):(0,B.jsx)(`div`,{className:`mcp-market-grid`,children:Oe.map(e=>{let t=b(ee)?e.descriptionZh:e.description,r=b(ee)?e.badgeZh||e.badge:e.badge||e.badgeZh;return(0,B.jsxs)(`div`,{className:`mcp-market-card skill-market-card`,children:[(0,B.jsxs)(`div`,{className:`mcp-market-card-head`,children:[(0,B.jsxs)(`div`,{className:`mcp-market-title-wrap`,children:[(0,B.jsx)(`span`,{className:`mcp-market-name`,children:e.name}),b(ee)&&e.nameZh!==e.name&&(0,B.jsxs)(`span`,{className:`mcp-market-subname`,children:[`(`,e.nameZh,`)`]})]}),r&&(0,B.jsx)(`span`,{className:`mcp-badge-official`,children:r})]}),(0,B.jsx)(`p`,{className:`mcp-market-desc`,children:t}),(0,B.jsxs)(`div`,{className:`skill-market-url-row`,title:e.url,children:[(0,B.jsx)(ce,{className:`skill-market-url-icon`}),(0,B.jsx)(`span`,{className:`skill-market-url-text`,children:e.url})]}),e.tags&&e.tags.length>0&&(0,B.jsx)(`div`,{className:`skill-market-tags`,children:e.tags.map(e=>(0,B.jsxs)(`span`,{className:`skill-market-tag-chip`,children:[`#`,e]},e))}),(0,B.jsxs)(`div`,{className:`skill-market-card-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`skill-market-copy-btn`,title:e.url,onClick:()=>De(e.id,e.url),children:me===e.id?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(le,{}),(0,B.jsx)(`span`,{children:a(`mcpMarketCopied`)})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(te,{}),(0,B.jsx)(`span`,{children:a(`mcpMarketCopyLink`)})]})}),(0,B.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`skill-market-open-btn`,title:a(`mcpMarketVisit`),children:[(0,B.jsx)(`span`,{children:a(`mcpMarketVisit`)}),(0,B.jsx)(n,{})]})]})]},e.id)})})]}),o&&(0,B.jsx)(`div`,{className:`modal-backdrop sub-modal`,onClick:h,children:(0,B.jsxs)(`div`,{className:`modal mcp-edit-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`mcp-oauth-title`,onClick:e=>e.stopPropagation(),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),h())},children:[(0,B.jsx)(`div`,{className:`modal-head`,children:(0,B.jsxs)(`h3`,{id:`mcp-oauth-title`,children:[a(`mcpOAuthLogin`),` · `,o.name]})}),(0,B.jsxs)(`div`,{className:`modal-body`,children:[!m&&(0,B.jsx)(`p`,{role:`status`,children:a(`mcpOAuthStarting`)}),m?.status===`complete`&&(0,B.jsx)(`p`,{role:`status`,children:a(`mcpOAuthComplete`)}),m?.status===`error`&&(0,B.jsx)(`p`,{role:`alert`,children:a(`mcpOAuthError`)}),m?.status===`pending`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{children:a(`mcpOAuthInstructions`)}),m.authorizationUrl&&(0,B.jsxs)(`a`,{className:`mcp-quick-btn`,href:m.authorizationUrl,target:`_blank`,rel:`noopener noreferrer`,children:[a(`mcpOAuthOpen`),` `,(0,B.jsx)(n,{})]}),(0,B.jsx)(`p`,{role:`status`,children:a(f?`mcpOAuthFinishing`:`mcpOAuthWaiting`)}),m.error&&(0,B.jsx)(`p`,{role:`alert`,children:a(`mcpOAuthInvalidRedirect`)}),(0,B.jsx)(`label`,{htmlFor:`mcp-oauth-redirect`,children:a(`mcpOAuthRedirect`)}),(0,B.jsx)(`input`,{id:`mcp-oauth-redirect`,className:`set-input`,type:`url`,autoComplete:`off`,spellCheck:!1,value:l,disabled:f,onChange:e=>d(e.target.value)})]})]}),(0,B.jsxs)(`div`,{className:`modal-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`set-cancel-btn`,onClick:h,children:m?.status===`complete`||m?.status===`error`?a(`close`):a(`cancel`)}),m?.status===`pending`&&(0,B.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:f||!l.trim()||!m.id,onClick:()=>{m.id&&(p(!0),j({type:`mcp_oauth_finish`,reqId:o.reqId,id:m.id,redirectUrl:l.trim()}),d(``))},children:a(`mcpOAuthFinish`)})]})]})}),we&&(0,B.jsx)(`div`,{className:`modal-backdrop sub-modal`,onClick:()=>Te(null),children:(0,B.jsxs)(`div`,{className:`modal confirm-modal`,onClick:e=>e.stopPropagation(),children:[(0,B.jsxs)(`div`,{className:`modal-head`,children:[(0,B.jsx)(xe,{className:`modal-head-icon`}),(0,B.jsx)(`h3`,{children:a(`mcpDeleteConfirmTitle`)})]}),(0,B.jsx)(`div`,{className:`modal-body`,children:(0,B.jsx)(`p`,{children:a(`mcpDeleteConfirmDesc`,{name:we.name,scope:we.scope===`global`?a(`mcpScopeGlobal`):a(`mcpScopeProject`)})})}),(0,B.jsxs)(`div`,{className:`modal-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`set-cancel-btn`,onClick:()=>Te(null),children:a(`cancel`)}),(0,B.jsx)(`button`,{type:`button`,className:`btn-danger`,onClick:()=>Ne(we.name,we.scope),children:a(`delete`)})]})]})}),w&&(0,B.jsx)(`div`,{className:`modal-backdrop sub-modal`,onClick:()=>T(null),children:(0,B.jsxs)(`div`,{className:`modal mcp-edit-modal`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{type:`button`,className:`modal-close`,"aria-label":a(`close`),onClick:()=>T(null),children:(0,B.jsx)(v,{})}),(0,B.jsxs)(`div`,{className:`modal-head`,children:[(0,B.jsx)(ge,{className:`modal-head-icon`}),(0,B.jsx)(`h3`,{children:w.isNew?a(`mcpAddModalTitle`):a(`mcpEditModalTitle`)})]}),(0,B.jsxs)(`div`,{className:`modal-body mcp-form-body`,children:[w.isNew&&(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:a(`mcpPresetSelect`)}),(0,B.jsx)(`select`,{className:`set-select`,value:Ee,onChange:e=>Le(e.target.value),children:qt.map(e=>(0,B.jsx)(`option`,{value:e.id,children:a(e.label)},e.id))})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsxs)(`label`,{className:`set-field-label`,children:[a(`mcpScopeLabel`),(0,B.jsx)(`span`,{className:`field-required`,children:`*`})]}),(0,B.jsxs)(`div`,{className:`mcp-scope-selector`,children:[(0,B.jsxs)(`label`,{className:`mcp-scope-radio${w.scope===`global`?` selected`:``}`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`scope`,checked:w.scope===`global`,onChange:()=>T(e=>e?{...e,scope:`global`}:null)}),(0,B.jsxs)(`div`,{className:`mcp-radio-content`,children:[(0,B.jsx)(`div`,{className:`mcp-radio-title`,children:a(`mcpScopeGlobal`)}),(0,B.jsx)(`div`,{className:`mcp-radio-hint`,children:a(`mcpScopeGlobalHint`)})]})]}),(0,B.jsxs)(`label`,{className:`mcp-scope-radio${w.scope===`project`?` selected`:``}`,children:[(0,B.jsx)(`input`,{type:`radio`,name:`scope`,checked:w.scope===`project`,onChange:()=>T(e=>e?{...e,scope:`project`}:null)}),(0,B.jsxs)(`div`,{className:`mcp-radio-content`,children:[(0,B.jsx)(`div`,{className:`mcp-radio-title`,children:a(`mcpScopeProject`)}),(0,B.jsx)(`div`,{className:`mcp-radio-hint`,children:a(`mcpScopeProjectHint`)})]})]})]})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsxs)(`label`,{className:`set-field-label`,children:[a(`mcpNameLabel`),(0,B.jsx)(`span`,{className:`field-required`,children:`*`})]}),(0,B.jsx)(`input`,{type:`text`,className:`set-input`,placeholder:a(`mcpNamePlaceholder`),value:w.name,onChange:e=>T(t=>t?{...t,name:e.target.value}:null)})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:a(`mcpTransportLabel`)}),(0,B.jsxs)(`div`,{className:`mcp-transport-selector`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`mcp-transport-btn${w.transport===`stdio`?` active`:``}`,onClick:()=>T(e=>e?{...e,transport:`stdio`}:null),children:[(0,B.jsx)(r,{}),`stdio (`,a(`mcpTransportStdio`),`)`]}),(0,B.jsxs)(`button`,{type:`button`,className:`mcp-transport-btn${w.transport===`http`?` active`:``}`,onClick:()=>T(e=>e?{...e,transport:`http`}:null),children:[(0,B.jsx)(ce,{}),`HTTP (`,a(`mcpTransportHttp`),`)`]})]})]}),w.transport===`stdio`?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsxs)(`label`,{className:`set-field-label`,children:[a(`mcpCommandLabel`),(0,B.jsx)(`span`,{className:`field-required`,children:`*`})]}),(0,B.jsx)(`input`,{type:`text`,className:`set-input`,placeholder:a(`mcpCommandPlaceholder`),value:w.command,onChange:e=>T(t=>t?{...t,command:e.target.value}:null)})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsxs)(`div`,{className:`mcp-field-header`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:a(`mcpArgsLabel`)}),(0,B.jsx)(`button`,{type:`button`,className:`mcp-mini-btn`,"aria-label":`${a(`mcpArgsLabel`)} +`,onClick:()=>T(e=>e?{...e,args:[...e.args,``]}:null),children:(0,B.jsx)(C,{})})]}),w.args.map((e,t)=>(0,B.jsxs)(`div`,{className:`mcp-kv-row`,children:[(0,B.jsx)(`textarea`,{className:`set-input`,rows:1,"aria-label":`${a(`mcpArgsLabel`)} ${t+1}`,value:e,onChange:e=>T(n=>n?{...n,args:n.args.map((n,r)=>r===t?e.target.value:n)}:null)}),(0,B.jsx)(`button`,{type:`button`,className:`mcp-mini-btn`,"aria-label":`${a(`delete`)} ${a(`mcpArgsLabel`)} ${t+1}`,onClick:()=>T(e=>e?{...e,args:e.args.filter((e,n)=>n!==t)}:null),children:(0,B.jsx)(v,{})})]},t))]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:a(`mcpCwdLabel`)}),(0,B.jsx)(`input`,{type:`text`,className:`set-input`,placeholder:a(`mcpCwdPlaceholder`),value:w.cwd,onChange:e=>T(t=>t?{...t,cwd:e.target.value}:null)})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsxs)(`div`,{className:`mcp-field-header`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:a(`mcpEnvLabel`)}),(0,B.jsxs)(`button`,{type:`button`,className:`mcp-mini-btn`,onClick:()=>T(e=>e?{...e,env:[...e.env,{key:``,value:``}]}:null),children:[(0,B.jsx)(C,{}),a(`mcpAddEnv`)]})]}),w.env.map((e,t)=>(0,B.jsxs)(`div`,{className:`mcp-kv-row`,children:[(0,B.jsx)(`input`,{type:`text`,className:`set-input mcp-kv-key`,placeholder:a(`mcpEnvKeyPlaceholder`),value:e.key,onChange:e=>{let n=[...w.env];n[t].key=e.target.value,T(e=>e?{...e,env:n}:null)}}),(0,B.jsx)(`input`,{type:`text`,className:`set-input mcp-kv-val`,placeholder:a(`mcpEnvValuePlaceholder`),value:e.value,onChange:e=>{let n=[...w.env];n[t].value=e.target.value,T(e=>e?{...e,env:n}:null)}}),(0,B.jsx)(`button`,{type:`button`,className:`icon-btn delete-btn`,onClick:()=>{let e=w.env.filter((e,n)=>n!==t);T(t=>t?{...t,env:e}:null)},children:(0,B.jsx)(u,{})})]},t))]})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsxs)(`label`,{className:`set-field-label`,children:[a(`mcpUrlLabel`),(0,B.jsx)(`span`,{className:`field-required`,children:`*`})]}),(0,B.jsx)(`input`,{type:`text`,className:`set-input`,placeholder:a(`mcpUrlPlaceholder`),value:w.url,onChange:e=>T(t=>t?{...t,url:e.target.value}:null)})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsxs)(`div`,{className:`mcp-field-header`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:a(`mcpHeadersLabel`)}),(0,B.jsxs)(`button`,{type:`button`,className:`mcp-mini-btn`,onClick:()=>T(e=>e?{...e,headers:[...e.headers,{key:``,value:``}]}:null),children:[(0,B.jsx)(C,{}),a(`mcpAddHeader`)]})]}),w.headers.map((e,t)=>(0,B.jsxs)(`div`,{className:`mcp-kv-row`,children:[(0,B.jsx)(`input`,{type:`text`,className:`set-input mcp-kv-key`,placeholder:a(`mcpHeaderKeyPlaceholder`),value:e.key,onChange:e=>{let n=[...w.headers];n[t].key=e.target.value,T(e=>e?{...e,headers:n}:null)}}),(0,B.jsx)(`input`,{type:`text`,className:`set-input mcp-kv-val`,placeholder:a(`mcpHeaderValuePlaceholder`),value:e.value,onChange:e=>{let n=[...w.headers];n[t].value=e.target.value,T(e=>e?{...e,headers:n}:null)}}),(0,B.jsx)(`button`,{type:`button`,className:`icon-btn delete-btn`,onClick:()=>{let e=w.headers.filter((e,n)=>n!==t);T(t=>t?{...t,headers:e}:null)},children:(0,B.jsx)(u,{})})]},t))]})]}),(0,B.jsxs)(`div`,{className:`set-field`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:a(`mcpDescriptionLabel`)}),(0,B.jsx)(`input`,{type:`text`,className:`set-input`,placeholder:a(`mcpDescriptionPlaceholder`),value:w.description,onChange:e=>T(t=>t?{...t,description:e.target.value}:null)})]}),(0,B.jsxs)(`div`,{className:`set-row`,children:[(0,B.jsxs)(`div`,{className:`set-row-text`,children:[(0,B.jsx)(`div`,{className:`set-row-label`,children:a(`mcpEnabledLabel`)}),(0,B.jsx)(`div`,{className:`set-row-desc`,children:a(`mcpEnabledDesc`)})]}),(0,B.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":w.enabled,className:`set-switch${w.enabled?` on`:``}`,onClick:()=>T(e=>e?{...e,enabled:!e.enabled}:null),children:(0,B.jsx)(`span`,{className:`set-switch-knob`})})]})]}),(0,B.jsxs)(`div`,{className:`modal-actions`,children:[(0,B.jsx)(`button`,{type:`button`,className:`set-cancel-btn`,onClick:()=>T(null),children:a(`cancel`)}),(0,B.jsxs)(`button`,{type:`button`,className:`set-save-btn`,disabled:!w.name.trim()||w.transport===`stdio`&&!w.command.trim()||w.transport===`http`&&!w.url.trim(),onClick:()=>{if(!w||!w.name.trim())return;let e=Kt(w);j({type:`save_mcp_server`,server:e,prevName:w.isNew?void 0:w.prevName,prevScope:w.isNew?void 0:w.prevScope}),T(null)},children:[(0,B.jsx)(le,{}),(0,B.jsx)(`span`,{children:a(`save`)})]})]})]})})]})}var Yt=[{id:`agentskills-me`,name:`Discover Agent Skills`,nameZh:`AgentSkills 技能发现市场`,description:`Browse and discover 500+ curated AI agent skills with live search, install commands, and GitHub stars.`,descriptionZh:`在线浏览与检索 500+ 个实测 Agent Skills,支持搜索筛选、多平台一键安装命令与中文标签。`,url:`https://agentskills.me/`,category:`marketplace`,author:`AgentSkills.me`,badge:`Market`,badgeZh:`在线市场`,tags:[`Marketplace`,`500+ Skills`,`Multi-Agent`]},{id:`agentskills-to`,name:`AgentSkills Marketplace`,nameZh:`AgentSkills 开放技能市场`,description:`Open marketplace showcasing 4,000+ developer agent skills, trending automations, and category rankings.`,descriptionZh:`汇聚 4,000+ 开发者 Agent 技能的开放市场,首页直展 Trending 与最新实战技能卡片。`,url:`https://www.agentskills.to/`,category:`marketplace`,author:`AgentSkills.to`,badge:`Market`,badgeZh:`开放市场`,tags:[`Marketplace`,`Claude Code`,`Cursor`]},{id:`anthropic-skills`,name:`Anthropic Official Skills`,nameZh:`Anthropic 官方技能目录`,description:`Anthropic's official directory of Agent Skills: docx, pptx, xlsx, canvas-design, mcp-builder, and more.`,descriptionZh:`Anthropic 官方核心 skills 目录,直达 docx, pptx, xlsx, canvas-design, mcp-builder 等数十个官方技能。`,url:`https://github.com/anthropics/skills/tree/main/skills`,category:`official`,author:`Anthropic`,badge:`Official`,badgeZh:`官方规范`,tags:[`Official`,`Anthropic`,`Reference`]},{id:`addyosmani-skills`,name:`Addy Osmani's Production Skills`,nameZh:`Addy Osmani 生产级工程技能库`,description:`Production-grade engineering skills directory: api-design, code-review, performance, security, and TDD.`,descriptionZh:`Google 技术总监维护的 25+ 个生产级工程技能目录:架构设计、性能优化、安全加固与测试驱动。`,url:`https://github.com/addyosmani/agent-skills/tree/main/skills`,category:`community`,author:`Addy Osmani`,badge:`110k★`,badgeZh:`11万星推荐`,tags:[`Production`,`Engineering`,`Best Practices`]},{id:`superpowers-skills`,name:`Superpowers Agent Skills`,nameZh:`Superpowers 实战技能合集`,description:`Battle-tested agent skills directory: subagent-driven development, systematic debugging, writing plans, and worktrees.`,descriptionZh:`名声斐然的实战技能目录:子代理编排驱动、系统化调试诊断、计划编写与 Git Worktree 高效协同。`,url:`https://github.com/obra/superpowers/tree/main/skills`,category:`community`,author:`obra & Contributors`,badge:`Workflow`,badgeZh:`深度工作流`,tags:[`Workflows`,`Debugging`,`Subagents`]},{id:`scientific-skills`,name:`Scientific Agent Skills`,nameZh:`科研与科学计算技能库`,description:`Directory of 150+ validated scientific agent skills for biology, chemistry, data analysis, and literature review.`,descriptionZh:`直达 150+ 个面向生物计算、化学建模、学术研读与量化数据分析的专业领域 Agent Skills 目录。`,url:`https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills`,category:`directory`,author:`K-Dense-AI`,badge:`Science`,badgeZh:`科研专区`,tags:[`Science`,`Research`,`Data Analysis`]},{id:`composio-skills`,name:`Composio Awesome Claude Skills`,nameZh:`Composio Claude 技能精选合集`,description:`Curated collection linking directly to hundreds of specialized Claude and agent skills grouped by category.`,descriptionZh:`直接锚定直达 #skills 章节,收录涵盖办公、分析、多工具调用等数十个分类的上百个现成技能清单。`,url:`https://github.com/ComposioHQ/awesome-claude-skills#skills`,category:`community`,author:`Composio`,badge:`78k★`,badgeZh:`社区精选`,tags:[`Awesome`,`Composio`,`Categorized`]},{id:`awesome-claude-skills`,name:`Awesome Claude Code Skills`,nameZh:`Awesome Claude Code 技能聚合`,description:`Direct index of community skills: Archify, thinking protocols, diagram design, and developer automations.`,descriptionZh:`直接直达技能列表锚点,汇集社区贡献的思考规约、架构绘图、思维链强化与自动化脚本。`,url:`https://github.com/hesreallyhim/awesome-claude-code#skills`,category:`community`,author:`hesreallyhim`,badge:`Curated`,badgeZh:`高星榜单`,tags:[`Claude Code`,`Community`,`Tools`]},{id:`marketing-skills`,name:`Marketing & Growth Skills`,nameZh:`业务营销与产品增长技能库`,description:`Agent skills directory for product launches, conversion optimization, email sequences, and copy crafting.`,descriptionZh:`面向商业增长的技能目录:涵盖产品发布策略、转化率优化、自动化邮件序列与文案撰写规约。`,url:`https://github.com/coreyhaines31/marketingskills/tree/main/skills`,category:`directory`,author:`coreyhaines31`,badge:`Growth`,badgeZh:`业务与增长`,tags:[`Marketing`,`Copywriting`,`Growth`]},{id:`github-topic-agent-skills`,name:`GitHub: #agent-skills`,nameZh:`GitHub #agent-skills 全球仓库列表`,description:`Live directory of 38,000+ open-source repositories tagged with #agent-skills, sorted by activity and stars.`,descriptionZh:`GitHub 官方标签直达,全球 38,000+ 开源智能体技能与工具仓库实时列表,可按活跃度与星标浏览。`,url:`https://github.com/topics/agent-skills`,category:`directory`,author:`GitHub Community`,badge:`38k+ Repos`,badgeZh:`3.8万开源库`,tags:[`GitHub`,`Topics`,`Open Source`]}],Xt=[{value:`0 9 * * *`,key:`schedulerPresetDaily`},{value:`0 * * * *`,key:`schedulerPresetHourly`},{value:`*/30 * * * *`,key:`schedulerPresetHalfHour`},{value:`0 9 * * 1-5`,key:`schedulerPresetWorkday`},{value:`0 9 * * 1`,key:`schedulerPresetMonday`}];function Zt(e){return{target:`conversation`,graphId:``,id:``,name:``,description:``,cwd:e,kind:`cron`,cron:`0 9 * * *`,preset:`0 9 * * *`,intervalMinutes:`60`,prompt:``,model:``,thinkingLevel:``,catchUp:!1}}function Qt(e){let t=e.kind===`cron`&&Xt.some(t=>t.value===e.spec);return{target:e.target??(e.graphId?`canvas`:`conversation`),graphId:e.graphId??``,id:e.id,name:e.name,description:e.description,cwd:e.cwd,kind:e.kind,cron:e.kind===`cron`?e.spec:`0 9 * * *`,preset:t?e.spec:`custom`,intervalMinutes:e.kind===`interval`?String(Math.max(1,Math.round(Number(e.spec)/6e4))):`60`,prompt:e.prompt,model:e.model,thinkingLevel:e.thinkingLevel,catchUp:e.catchUp===`once`}}function V(e,t,n){return!!(e.name.trim()&&e.cwd.trim()&&(e.target===`canvas`?!n&&t.some(t=>t.id===e.graphId):e.prompt.trim()))}function $t(e){return{...e.id?{id:e.id}:{},target:e.target,...e.target===`canvas`?{graphId:e.graphId}:{},name:e.name.trim(),description:e.description.trim(),cwd:e.cwd.trim(),kind:e.kind,spec:e.kind===`cron`?e.cron.trim():String(Math.max(1,Math.floor(Number(e.intervalMinutes)||0))*6e4),prompt:e.prompt.trim(),...e.target===`conversation`&&e.model.trim()?{model:e.model.trim()}:{},...e.target===`conversation`&&e.thinkingLevel.trim()?{thinkingLevel:e.thinkingLevel.trim()}:{},catchUp:e.catchUp?`once`:`skip`}}function en(e,t){if(e.kind===`interval`){let n=Math.round(Number(e.spec)/6e4);return n<60?`${t(`schedulerKindInterval`)} · ${n} min`:n%60==0?`${t(`schedulerKindInterval`)} · ${n/60} h`:`${t(`schedulerKindInterval`)} · ${n} min`}let n=Xt.find(t=>t.value===e.spec);return n?t(n.key):e.spec}function tn(e){if(!e)return``;try{return new Date(e).toLocaleString()}catch{return String(e)}}function nn({tasks:e,cwd:t,models:n}){let r=y(),[i,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(!1),[d,f]=(0,z.useState)([]),[p,m]=(0,z.useState)(!1),h=i?.target;(0,z.useEffect)(()=>{if(h!==`canvas`)return;let e=!0;return f([]),m(!0),ut(()=>j({type:`canvas_list`})).then(t=>{e&&(f(t),m(!1))}),()=>{e=!1}},[h,t]);let[g,ee]=(0,z.useState)(new Set);(0,z.useEffect)(()=>{j({type:`schedule_list`})},[]);let te=e=>ee(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n});return(0,B.jsxs)(`div`,{className:`set-section`,children:[(0,B.jsxs)(`div`,{className:`set-section-title`,children:[(0,B.jsx)(o,{className:`set-section-icon`}),r(`settingsScheduler`),(0,B.jsx)(N,{text:r(`schedulerDesc`)}),(0,B.jsx)(`span`,{className:`set-count`,children:e.length}),(0,B.jsxs)(`button`,{type:`button`,className:`set-save-btn`,title:r(`schedulerNew`),onClick:()=>{s(Zt(t)),l(!0)},children:[(0,B.jsx)(C,{}),` `,r(`schedulerNew`)]})]}),e.length===0?(0,B.jsx)(`p`,{className:`set-hint`,children:r(`schedulerEmpty`)}):(0,B.jsx)(`ul`,{className:`scheduler-list`,children:e.map(e=>(0,B.jsxs)(`li`,{className:`scheduler-item ${e.enabled?``:`off`}`,children:[(0,B.jsxs)(`div`,{className:`scheduler-line1`,children:[(0,B.jsxs)(`span`,{className:`scheduler-name`,title:e.description||e.name,children:[e.running?`${r(`schedulerRunning`)} `:``,e.name]}),(0,B.jsx)(`span`,{className:`scheduler-badge ${e.enabled?`on`:``}`,children:e.enabled?r(`schedulerEnabled`):r(`schedulerDisabled`)}),(0,B.jsx)(`button`,{type:`button`,className:`set-switch ${e.enabled?`on`:``}`,title:e.enabled?r(`schedulerDisable`):r(`schedulerEnable`),onClick:()=>j({type:`schedule_toggle`,id:e.id,enabled:!e.enabled}),children:(0,B.jsx)(`span`,{className:`set-switch-knob`})})]}),(0,B.jsxs)(`div`,{className:`scheduler-line2`,children:[(e.target??(e.graphId?`canvas`:`conversation`))===`canvas`&&(0,B.jsxs)(`span`,{children:[r(`schedulerTargetCanvas`),` · `,e.graphId]}),(0,B.jsx)(`span`,{title:e.cwd,children:e.cwd}),(0,B.jsx)(`span`,{children:`·`}),(0,B.jsx)(`span`,{title:e.kind===`cron`?e.spec:`${e.spec} ms`,children:en(e,r)})]}),(0,B.jsxs)(`div`,{className:`scheduler-line2`,children:[(0,B.jsxs)(`span`,{children:[r(`schedulerNextFire`),`: `,e.nextFire?tn(e.nextFire):`—`]}),(0,B.jsx)(`span`,{children:`·`}),(0,B.jsxs)(`span`,{children:[r(`schedulerLastRun`),`:`,` `,e.lastRun?(0,B.jsxs)(B.Fragment,{children:[tn(e.lastRun.at),` ·`,` `,(0,B.jsx)(`span`,{className:e.lastRun.ok?`scheduler-ok`:`scheduler-fail`,children:e.lastRun.ok?r(`schedulerRunOk`):r(`schedulerRunFail`)}),e.lastRun.manual?` · ${r(`schedulerManualBadge`)}`:``,e.lastRun.error?` · ${e.lastRun.error}`:``]}):r(`schedulerNeverRun`)]}),e.history.length>1&&(0,B.jsxs)(`button`,{type:`button`,className:`scheduler-link`,onClick:()=>te(e.id),children:[r(`schedulerHistory`),` (`,e.history.length,`)`]})]}),g.has(e.id)&&e.history.length>0&&(0,B.jsx)(`ul`,{className:`scheduler-history`,children:e.history.map((e,t)=>(0,B.jsxs)(`li`,{children:[tn(e.at),` ·`,` `,(0,B.jsx)(`span`,{className:e.ok?`scheduler-ok`:`scheduler-fail`,children:e.ok?r(`schedulerRunOk`):r(`schedulerRunFail`)}),` · ${(e.durationMs/1e3).toFixed(0)}s`,e.manual?` · ${r(`schedulerManualBadge`)}`:``,e.error?` · ${e.error}`:``]},`${e.at}-${t}`))}),(0,B.jsxs)(`div`,{className:`scheduler-actions`,children:[(0,B.jsxs)(`button`,{type:`button`,className:`btn`,disabled:e.running,title:r(`schedulerRunNow`),onClick:()=>j({type:`schedule_run`,id:e.id}),children:[(0,B.jsx)(a,{}),` `,r(`schedulerRunNow`)]}),(0,B.jsxs)(`button`,{type:`button`,className:`btn`,title:r(`schedulerEdit`),onClick:()=>{s(Qt(e)),l(!1)},children:[(0,B.jsx)(w,{}),` `,r(`schedulerEdit`)]}),(0,B.jsxs)(`button`,{type:`button`,className:`btn`,title:r(`schedulerDelete`),onClick:()=>{window.confirm(r(`schedulerConfirmDelete`,{name:e.name}))&&j({type:`schedule_delete`,id:e.id})},children:[(0,B.jsx)(u,{}),` `,r(`schedulerDelete`)]})]})]},e.id))}),i&&(0,B.jsx)(`div`,{className:`modal-backdrop`,onClick:()=>s(null),children:(0,B.jsxs)(`div`,{className:`modal`,onClick:e=>e.stopPropagation(),children:[(0,B.jsx)(`button`,{type:`button`,className:`modal-close`,"aria-label":r(`close`),onClick:()=>s(null),children:(0,B.jsx)(v,{})}),(0,B.jsxs)(`div`,{className:`modal-head`,children:[(0,B.jsx)(o,{className:`modal-head-icon`}),(0,B.jsx)(`h2`,{children:c?r(`schedulerNew`):`${r(`schedulerEdit`)} · ${i.name||``}`})]}),(0,B.jsxs)(`div`,{className:`modal-body`,children:[(0,B.jsxs)(`div`,{className:`tpl-fields`,children:[(0,B.jsx)(`input`,{className:`set-input`,placeholder:r(`schedulerNamePlaceholder`),value:i.name,onChange:e=>s({...i,name:e.target.value})}),(0,B.jsx)(`input`,{className:`set-input`,placeholder:r(`schedulerDescPlaceholder`),value:i.description,onChange:e=>s({...i,description:e.target.value})})]}),(0,B.jsxs)(`div`,{className:`set-mode-row`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:r(i.target===`canvas`?`schedulerRunBaseLabel`:`schedulerCwdLabel`)}),(0,B.jsxs)(`div`,{className:`scheduler-cwd-row`,children:[(0,B.jsx)(`input`,{className:`set-input`,placeholder:r(`schedulerCwdPlaceholder`),value:i.cwd,onChange:e=>s({...i,cwd:e.target.value})}),(0,B.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s({...i,cwd:t}),children:r(`schedulerUseCurrentCwd`)})]})]}),(0,B.jsxs)(`div`,{className:`set-mode-row`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:r(`schedulerTargetLabel`)}),(0,B.jsxs)(`select`,{className:`set-select`,"aria-label":r(`schedulerTargetLabel`),value:i.target,onChange:e=>s({...i,target:e.target.value}),children:[(0,B.jsx)(`option`,{value:`conversation`,children:r(`schedulerTargetConversation`)}),(0,B.jsx)(`option`,{value:`canvas`,children:r(`schedulerTargetCanvas`)})]})]}),i.target===`canvas`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`set-mode-row`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:r(`schedulerGraphLabel`)}),(0,B.jsxs)(`select`,{className:`set-select`,"aria-label":r(`schedulerGraphLabel`),value:i.graphId,disabled:p,onChange:e=>s({...i,graphId:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:r(`schedulerGraphPlaceholder`)}),i.graphId&&!d.some(e=>e.id===i.graphId)&&(0,B.jsxs)(`option`,{value:i.graphId,children:[i.graphId,` · `,r(`schedulerGraphUnavailable`)]}),d.map(e=>(0,B.jsxs)(`option`,{value:e.id,children:[e.name,` · `,e.id]},e.id))]})]}),!p&&(!i.graphId||!d.some(e=>e.id===i.graphId))&&(0,B.jsx)(`p`,{className:`set-hint`,children:r(`schedulerGraphHint`)})]}),(0,B.jsxs)(`div`,{className:`set-mode-row`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:r(`schedulerKindLabel`)}),(0,B.jsxs)(`select`,{className:`set-select`,value:i.kind,onChange:e=>s({...i,kind:e.target.value}),children:[(0,B.jsx)(`option`,{value:`cron`,children:r(`schedulerKindCron`)}),(0,B.jsx)(`option`,{value:`interval`,children:r(`schedulerKindInterval`)})]})]}),i.kind===`cron`?(0,B.jsxs)(`div`,{className:`set-mode-row`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:r(`schedulerKindCron`)}),(0,B.jsxs)(`div`,{className:`scheduler-cwd-row`,children:[(0,B.jsxs)(`select`,{className:`set-select`,value:i.preset,onChange:e=>{let t=e.target.value;s({...i,preset:t,...t===`custom`?{}:{cron:t}})},children:[Xt.map(e=>(0,B.jsxs)(`option`,{value:e.value,children:[r(e.key),` · `,e.value]},e.value)),(0,B.jsx)(`option`,{value:`custom`,children:r(`schedulerPresetCustom`)})]}),i.preset===`custom`&&(0,B.jsx)(`input`,{className:`set-input`,placeholder:r(`schedulerCronPlaceholder`),value:i.cron,onChange:e=>s({...i,cron:e.target.value})})]})]}):(0,B.jsxs)(`div`,{className:`set-mode-row`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:r(`schedulerKindInterval`)}),(0,B.jsx)(`input`,{className:`set-input`,type:`number`,min:1,placeholder:r(`schedulerIntervalMinutes`),value:i.intervalMinutes,onChange:e=>s({...i,intervalMinutes:e.target.value})})]}),(0,B.jsx)(`div`,{className:`tpl-fields`,children:(0,B.jsx)(`textarea`,{className:`set-input`,rows:4,placeholder:r(i.target===`canvas`?`schedulerCanvasPromptPlaceholder`:`schedulerPromptPlaceholder`),value:i.prompt,onChange:e=>s({...i,prompt:e.target.value})})}),i.target===`conversation`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`set-mode-row`,children:[(0,B.jsx)(`label`,{className:`set-field-label`,children:r(`schedulerModelLabel`)}),(0,B.jsxs)(`select`,{className:`set-select`,value:i.model,onChange:e=>s({...i,model:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:r(`subagentFollowMain`)}),n.map(e=>(0,B.jsx)(`option`,{value:`${e.provider}/${e.id}`,children:e.label},`${e.provider}/${e.id}`))]})]}),n.length===0&&(0,B.jsx)(`p`,{className:`set-hint`,children:r(`subagentNoModels`)}),(0,B.jsxs)(`div`,{className:`set-mode-row`,children:[(0,B.jsxs)(`label`,{className:`set-field-label`,children:[r(`schedulerThinkingLabel`),` `,(0,B.jsx)(N,{text:r(`tplThinkingHint`)})]}),(0,B.jsxs)(`select`,{className:`set-select`,value:i.thinkingLevel,onChange:e=>s({...i,thinkingLevel:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:r(`tplThinkingFollowMain`)}),It.map(e=>(0,B.jsx)(`option`,{value:e,children:r(`thinking.${e}`)},e))]})]})]}),(0,B.jsxs)(`label`,{className:`scheduler-check`,children:[(0,B.jsx)(`input`,{type:`checkbox`,checked:i.catchUp,onChange:e=>s({...i,catchUp:e.target.checked})}),(0,B.jsxs)(`span`,{children:[r(`schedulerCatchUp`),` `,(0,B.jsx)(N,{text:r(`schedulerCatchUpHint`)})]})]}),(0,B.jsxs)(`div`,{className:`scheduler-foot`,children:[(0,B.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s(null),children:r(`schedulerCancelEdit`)}),(0,B.jsx)(`button`,{type:`button`,className:`btn primary`,disabled:!V(i,d,p),onClick:()=>{i&&V(i,d,p)&&(j({type:`schedule_save`,task:$t(i)}),s(null))},children:r(`schedulerSave`)})]})]})]})})]})}var rn=[{kind:`question`,labelKey:`sound.question`,descKey:`sound.question.desc`},{kind:`done`,labelKey:`sound.done`,descKey:`sound.done.desc`},{kind:`subagentDone`,labelKey:`sound.subagentDone`,descKey:`sound.subagentDone.desc`},{kind:`start`,labelKey:`sound.start`,descKey:`sound.start.desc`},{kind:`error`,labelKey:`sound.error`,descKey:`sound.error.desc`},{kind:`approval`,labelKey:`sound.approval`,descKey:`sound.approval.desc`}];function an({settings:e,onChange:t,onPreview:n}){let r=y(),i=n=>t({...e,...n});return(0,B.jsxs)(`div`,{className:`sound-menu`,children:[(0,B.jsx)(`div`,{className:`dd-header`,children:r(`soundHeader`)}),(0,B.jsxs)(`label`,{className:`sound-row sound-master`,children:[(0,B.jsxs)(`span`,{className:`sound-label`,children:[(0,B.jsx)(f,{className:`sound-icon`}),(0,B.jsx)(`span`,{children:r(`enableSound`)})]}),(0,B.jsx)(`input`,{type:`checkbox`,checked:e.enabled,onChange:e=>i({enabled:e.target.checked})})]}),rn.map(({kind:t,labelKey:a,descKey:o})=>(0,B.jsxs)(`label`,{className:`sound-row ${e.enabled?``:`disabled`}`,children:[(0,B.jsxs)(`span`,{className:`sound-label`,children:[(0,B.jsx)(`span`,{className:`sound-name`,children:r(a)}),(0,B.jsx)(`span`,{className:`sound-desc`,children:r(o)})]}),(0,B.jsxs)(`span`,{className:`sound-right`,children:[(0,B.jsx)(`button`,{type:`button`,className:`sound-preview`,title:r(`preview`),disabled:!e.enabled,onClick:e=>{e.preventDefault(),n(t)},children:r(`preview`)}),(0,B.jsx)(`input`,{type:`checkbox`,checked:e[t],disabled:!e.enabled,onChange:e=>i({[t]:e.target.checked})})]})]},t)),(0,B.jsxs)(`div`,{className:`sound-volume ${e.enabled?``:`disabled`}`,children:[(0,B.jsx)(`span`,{className:`sound-name`,children:r(`volume`)}),(0,B.jsx)(`input`,{type:`range`,min:0,max:100,step:5,value:e.volume,disabled:!e.enabled,onChange:e=>i({volume:Number(e.target.value)})}),(0,B.jsxs)(`span`,{className:`sound-vol-num`,children:[e.volume,`%`]})]})]})}function on(){let[e,t]=(0,z.useState)([]);return(0,z.useEffect)(()=>{if(!L())return;let e=window.speechSynthesis,n=()=>t(e.getVoices().map(e=>({voiceURI:e.voiceURI,lang:e.lang,name:e.name,localService:e.localService})));return n(),e.addEventListener?.(`voiceschanged`,n),()=>e.removeEventListener?.(`voiceschanged`,n)},[]),e}function sn(){let[e,t]=(0,z.useState)(()=>D());return(0,z.useEffect)(()=>O(()=>{t(D())}),[]),e}function cn({settings:e,onChange:t,onPreview:n}){let r=y(),{locale:i}=Se(),a=on(),o=sn(),s=!!(e.engine&&e.engine!==`builtin`),c=s?Ee(e.engine):null,l=s?!!c:L(),[u,d]=(0,z.useState)([]);(0,z.useEffect)(()=>{if(!s||!c?.getVoices){d([]);return}let e=!1;return Promise.resolve(c.getVoices()).then(t=>{!e&&Array.isArray(t)&&d(t)}).catch(()=>{e||d([])}),()=>{e=!0}},[s,c,e.engine]);let p=n=>t({...e,...n});return(0,B.jsxs)(`div`,{className:`sound-menu`,children:[(0,B.jsx)(`div`,{className:`dd-header`,children:r(`ttsHeader`)}),!l&&(0,B.jsx)(`div`,{className:`sound-desc tts-unavailable`,children:r(`ttsUnavailable`)}),(0,B.jsxs)(`label`,{className:`sound-row sound-master ${l?``:`disabled`}`,children:[(0,B.jsxs)(`span`,{className:`sound-label`,children:[(0,B.jsx)(f,{className:`sound-icon`}),(0,B.jsx)(`span`,{className:`sound-name`,children:r(`ttsEnable`)}),(0,B.jsx)(`span`,{className:`sound-desc`,children:r(`ttsEnableDesc`)})]}),(0,B.jsx)(`input`,{type:`checkbox`,checked:e.enabled,disabled:!l,onChange:e=>p({enabled:e.target.checked})})]}),o.length>0&&(0,B.jsxs)(`div`,{className:`sound-volume ${l?``:`disabled`}`,children:[(0,B.jsx)(`span`,{className:`sound-name`,children:r(`ttsEngine`)}),(0,B.jsxs)(`select`,{className:`set-input tts-voice-select`,value:e.engine||`builtin`,disabled:!l,onChange:e=>p({engine:e.target.value,voiceURI:``}),children:[(0,B.jsx)(`option`,{value:`builtin`,children:r(`ttsEngineBuiltin`)}),o.map(e=>(0,B.jsx)(`option`,{value:e.id,children:i===`zh`?e.label:e.labelEn||e.label},e.id))]})]}),(0,B.jsxs)(`label`,{className:`sound-row ${e.enabled&&l?``:`disabled`}`,children:[(0,B.jsxs)(`span`,{className:`sound-label`,children:[(0,B.jsx)(`span`,{className:`sound-name`,children:r(`ttsAnnounce`)}),(0,B.jsx)(`span`,{className:`sound-desc`,children:r(`ttsAnnounceDesc`)})]}),(0,B.jsx)(`input`,{type:`checkbox`,checked:e.announce,disabled:!e.enabled||!l,onChange:e=>p({announce:e.target.checked})})]}),(0,B.jsxs)(`label`,{className:`sound-row ${e.enabled&&l?``:`disabled`}`,children:[(0,B.jsxs)(`span`,{className:`sound-label`,children:[(0,B.jsx)(`span`,{className:`sound-name`,children:r(`ttsReadReplies`)}),(0,B.jsx)(`span`,{className:`sound-desc`,children:r(`ttsReadRepliesDesc`)})]}),(0,B.jsx)(`input`,{type:`checkbox`,checked:e.readReplies,disabled:!e.enabled||!l,onChange:e=>p({readReplies:e.target.checked})})]}),(0,B.jsxs)(`label`,{className:`sound-row ${e.enabled&&e.readReplies&&l?``:`disabled`}`,children:[(0,B.jsxs)(`span`,{className:`sound-label`,children:[(0,B.jsx)(`span`,{className:`sound-name`,children:r(`ttsStreamReplies`)}),(0,B.jsx)(`span`,{className:`sound-desc`,children:r(`ttsStreamRepliesDesc`)})]}),(0,B.jsx)(`input`,{type:`checkbox`,checked:e.streamReplies,disabled:!e.enabled||!e.readReplies||!l,onChange:e=>p({streamReplies:e.target.checked})})]}),(0,B.jsxs)(`div`,{className:`sound-volume ${l?``:`disabled`}`,children:[(0,B.jsx)(`span`,{className:`sound-name`,children:r(`ttsRate`)}),(0,B.jsx)(`input`,{type:`range`,min:.5,max:2,step:.1,value:e.rate,disabled:!l,onChange:e=>p({rate:Number(e.target.value)})}),(0,B.jsxs)(`span`,{className:`sound-vol-num`,children:[e.rate.toFixed(1),`×`]})]}),(0,B.jsxs)(`div`,{className:`sound-volume ${l?``:`disabled`}`,children:[(0,B.jsx)(`span`,{className:`sound-name`,children:r(`ttsVoice`)}),(0,B.jsxs)(`select`,{className:`set-input tts-voice-select`,value:e.voiceURI,disabled:!l,onChange:e=>p({voiceURI:e.target.value}),children:[(0,B.jsx)(`option`,{value:``,children:r(`ttsVoiceAuto`)}),s?u.map(e=>(0,B.jsxs)(`option`,{value:e.voiceURI,children:[e.name,e.lang?` (${e.lang})`:``]},e.voiceURI)):a.map(e=>(0,B.jsxs)(`option`,{value:e.voiceURI,children:[e.name,` (`,e.lang,`)`,e.localService?``:` · ${r(`ttsVoiceOnline`)}`]},e.voiceURI))]}),(0,B.jsx)(`button`,{type:`button`,className:`sound-preview tts-preview`,disabled:!l,onClick:()=>{if(!s&&e.voiceURI&&!it(e.voiceURI,a,navigator.language)){t({...Ot,...e,voiceURI:``});return}n()},children:r(`preview`)})]})]})}var ln=!1;function un(){let e=y(),[t,n]=(0,z.useState)(Pt),[r,i]=(0,z.useState)(()=>zt()),[a,o]=(0,z.useState)(null),s=at(),c=s!==null,l=rt();(0,z.useEffect)(()=>{let e=()=>i(zt());return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,e),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,e)}},[]);let u=async e=>{let r={...t,enabled:e};if(n(r),Qe(r),e){let e=await Lt();if(i(e),e!==`granted`){let e={...r,enabled:!1};n(e),Qe(e)}}};return(0,B.jsxs)(`div`,{className:`sound-menu notify-menu`,children:[(0,B.jsx)(`div`,{className:`dd-header`,children:e(`notifyHeader`)}),(0,B.jsxs)(`label`,{className:`sound-row sound-master${c?` disabled`:``}`,children:[(0,B.jsxs)(`span`,{className:`sound-label`,children:[(0,B.jsx)(x,{className:`sound-icon`}),(0,B.jsx)(`span`,{children:e(`notifyEnable`)})]}),(0,B.jsx)(`input`,{type:`checkbox`,checked:t.enabled&&!c,disabled:c,onChange:e=>u(e.target.checked)})]}),(0,B.jsx)(`div`,{className:`sound-hint`,children:e(`notifyEnableDesc`)}),(0,B.jsxs)(`details`,{children:[(0,B.jsx)(`summary`,{className:`sound-row`,children:e(`notifyEventSettings`)}),(0,B.jsx)(`div`,{className:`sound-hint`,children:e(`notifyEventSettingsDesc`)}),I.map(r=>(0,B.jsxs)(`label`,{className:`sound-row`,children:[(0,B.jsx)(`span`,{className:`sound-label`,children:e(`sound.${r}`)}),(0,B.jsxs)(`select`,{"aria-label":e(`sound.${r}`),value:t.events?.[r]??`follow`,disabled:c||!t.enabled,onChange:e=>{let i={...t,events:{...t.events,[r]:e.target.value}};n(i),Qe(i)},children:[(0,B.jsx)(`option`,{value:`follow`,children:e(`notifyEventFollow`)}),(0,B.jsx)(`option`,{value:`on`,children:e(`notifyEventOn`)}),(0,B.jsx)(`option`,{value:`off`,children:e(`notifyEventOff`)})]})]},r))]}),s===`insecure`&&(0,B.jsx)(`div`,{className:`sound-hint`,children:e(`notifyInsecure`)}),s===`unsupported`&&(0,B.jsx)(`div`,{className:`sound-hint`,children:e(`notifyUnsupported`)}),!c&&r===`denied`&&(0,B.jsx)(`div`,{className:`sound-hint`,children:e(`notifyDenied`)}),!c&&l&&(0,B.jsx)(`div`,{className:`sound-hint`,children:e(`notifyWindowsHint`)}),ln]})}function dn(e){if(e==null)return 0;if(typeof e==`number`){if(!Number.isFinite(e)||e<=0)return 0;let t=Math.floor(e);return t<=1e3?t*1e3:Math.min(1e7,t)}let t=String(e).trim().toLowerCase().replace(/[,_\s]/g,``);if(!t)return 0;let n=t.match(/^(\d+(?:\.\d+)?)([km])?$/);if(!n)return 0;let r=parseFloat(n[1]);if(!Number.isFinite(r)||r<=0)return 0;let i=n[2],a;return i===`k`?a=Math.floor(r*1e3):i===`m`?a=Math.floor(r*1e6):(a=Math.floor(r),a<=1e3&&(a*=1e3)),Math.min(1e7,Math.max(0,a))}function fn(e){return!e||e<=0||!Number.isFinite(e)?``:e>=1e6&&e%1e5==0?`${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`:e>=1e3&&e%1e3==0?`${e/1e3}k`:String(e)}function pn(e){if(typeof e!=`string`||e.length>300)return;let t=e.trim();if(!t||/[\s\\\x00-\x1f\x7f]/.test(t))return;let n=t;if(t.startsWith(`https://`))try{let e=new URL(t);if(e.hostname!==`github.com`||e.username||e.password||e.port||e.search)return;n=e.pathname.slice(1)+e.hash}catch{return}let[r,i,a]=n.split(`#`);if(a!==void 0||!r||i!==void 0&&!/^[A-Za-z0-9_./-]+$/.test(i))return;let o=r.split(`/`);if(!(o.length<2||o.some(e=>!/^[A-Za-z0-9_.-]+$/.test(e)||e===`.`||e===`..`))&&!i?.split(`/`).some(e=>!e||e===`.`||e===`..`))return n}function mn(e,t){let n=pn(e.source??t.find(t=>t.id===e.id)?.source);if(n)return{id:e.id,name:e.name,version:e.version,source:n}}function hn(e,t,n=[]){let r=t.find(t=>t.id===e.id);return{plugin:r,missing:!r,disabled:!!r&&n.includes(r.id),versionMismatch:!!r&&!!e.version&&r.version!==e.version}}function gn(e,t){return Object.values(t).find(t=>t.pluginId===e&&t.phase!==`done`)}function _n(e){return!!e&&typeof e==`object`&&Object.keys(e).length===0}var H=[`prompt`,`tools`,`terminal`,`skills`,`ai`,`ui`,`engine`],vn={prompt:[`promptMode`,`customSystemPrompt`,`promptTemplate`,`promptOverrides`,`promptDisabled`,`reviewPrompt`,`reviewDisabledSkills`],tools:[`disabledAgentTools`,`disabledPluginTools`,`toolPromptOverrides`,`toolLazyLoading`,`codemodeMode`,`codemodeInlineBudget`,`readDirEnabled`,`toolApprovalEnabled`,`toolWatchdogTimeoutMs`,`questionnaireEnabled`,`questionPresentation`,`toolApprovalPresentation`,`questionTimeoutSeconds`,`editSoftEnabled`,`terminalToolsEnabled`],terminal:[`terminalBash`,`terminalBashIdleMs`,`terminalBashMaxForegroundMs`],skills:[`disabledSkills`,`disabledExtensions`,`skillsFullText`,`skillsCatalogMaxDesc`,`skillsCatalogShowLocation`,`skillsCatalogBudget`],ai:[`steeringMode`,`followUpMode`,`retryMaxAttempts`,`softCapTokens`,`softCapByModel`,`subagentDefaultModel`,`subagentMaxDepth`,`subagentAutoWakeMaxTurns`,`visionBridgeEnabled`,`visionBridgeModel`,`visionBridgePromptMode`,`visionBridgePrompt`,`scmCommitMsgPromptMode`,`scmCommitMsgPrompt`,`planModePromptMode`,`planModePrompt`,`goalModeEnabled`,`parallelReminderEnabled`],ui:[`uiLayout`,`disabledPlugins`,`thinkingWrap`,`toolsWrap`,`toolImagesEnabled`,`keepRecentMessages`,`reversePagination`,`showForkedParentSessions`,`retainFinishedConversations`,`openRecentSessionOnProjectSwitch`,`chatUploadMaxMb`,`workspaceUploadMaxMb`,`folderUploadMaxMb`,`bgAutoCleanupMin`,`quickPhrases`,`quickPhrasesEnabled`,`minimalNewChat`,`preserveDraftAcrossConversations`,`devNoCache`,`autoReload`],engine:[`defaultAgentPreset`,`defaultPermissionPreset`]};(()=>{let e=[];for(let t of H)for(let n of vn[t])e.includes(n)||e.push(n);return e})();function yn(e){let t=new Set(e),n=[];for(let e of H){let r=vn[e].filter(e=>t.has(e));r.length>0&&n.push({group:e,fields:r})}return n}var bn={promptMode:{labelZh:`提示词模式`,labelEn:`Prompt Mode`,hintZh:`追加到内置提示词 (append) 或完全替换系统内置提示词 (replace)`,hintEn:`Append to built-in prompt or completely replace it`},customSystemPrompt:{labelZh:`自定义系统提示词`,labelEn:`Custom System Prompt`,hintZh:`定制 AI 基础人设与工作规约的主提示词`,hintEn:`Main prompt customizing AI persona and instructions`},promptTemplate:{labelZh:`组合模板`,labelEn:`Prompt Template`,hintZh:`高级提示词组装模板(包含各个 slot 占位符)`,hintEn:`Advanced prompt composition template with slot placeholders`},promptOverrides:{labelZh:`逐段提示词覆盖`,labelEn:`Sectional Prompt Overrides`,hintZh:`微调特定提示词段落(如 soul/cwd/skills 等)`,hintEn:`Overrides for specific prompt sections (soul, cwd, skills, etc.)`},reviewPrompt:{labelZh:`目标模式审查提示词`,labelEn:`Goal Mode Review Prompt`,hintZh:`目标模式 2.0 中审查者专用的判定与指导提示词`,hintEn:`Prompt for the reviewer in Goal Mode 2.0`},reviewDisabledSkills:{labelZh:`审查时禁用的技能`,labelEn:`Skills Disabled in Review`,hintZh:`仅在目标审查阶段禁止审查者调用的技能列表`,hintEn:`Skills unavailable to the reviewer in Goal Mode`},promptDisabled:{labelZh:`禁用的提示词段`,labelEn:`Disabled Prompt Sections`,hintZh:`组合模板中不渲染的提示词段(如 soul/skills)`,hintEn:`Prompt sections excluded from the composed template`},disabledAgentTools:{labelZh:`禁用的内置工具`,labelEn:`Disabled Agent Tools`,hintZh:`不在 AI 可用工具列表中暴露的内置工具`,hintEn:`Built-in tools removed from agent visibility`},disabledPluginTools:{labelZh:`禁用的插件工具`,labelEn:`Disabled Plugin Tools`,hintZh:`禁止向 AI 注册的第三方插件工具`,hintEn:`Plugin-provided tools removed from agent visibility`},toolPromptOverrides:{labelZh:`工具提示词覆盖`,labelEn:`Tool Prompt Overrides`,hintZh:`微调工具在模型视野中的描述、触发条件与使用指南`,hintEn:`Custom descriptions, snippets and guidelines for tools`},toolLazyLoading:{labelZh:`工具按需延迟加载`,labelEn:`Tool Lazy Loading`,hintZh:`仅常驻核心工具,其余工具通过 load_tools 按需动态引入(节省上下文)`,hintEn:`Keep only core tools active; load others on demand (saves context)`},codemodeMode:{labelZh:`codemode 运行模式`,labelEn:`Codemode Execution Mode`,hintZh:`常规模式(on)或纯代码模式(only,仅通过沙箱脚本调用工具)`,hintEn:`Regular mode (on) or strict code mode (only, all tool calls run via sandbox script)`},codemodeInlineBudget:{labelZh:`codemode 工具声明预算`,labelEn:`Codemode Inline Budget`,hintZh:`直接嵌入在 codemode 系统提示词中的工具声明 Token 预算(默认 3000)`,hintEn:`Token budget for tool declarations directly embedded in the codemode prompt (default: 3000)`},readDirEnabled:{labelZh:`read 工具列目录`,labelEn:`Directory Listing in read`,hintZh:`允许 read 工具在路径为目录时直接返回文件列表`,hintEn:`Allow read tool to list directory entries when target is a folder`},toolApprovalEnabled:{labelZh:`工具执行审批门禁`,labelEn:`Tool Execution Approval`,hintZh:`执行危险或写操作工具前弹出用户确认确认框`,hintEn:`Require user approval before executing tools`},chatUploadMaxMb:{labelZh:`聊天附件大小上限`,labelEn:`Chat attachment size limit`,hintZh:`单个文件大小,单位 MB(1–100)`,hintEn:`Per-file limit in MB (1–100)`},workspaceUploadMaxMb:{labelZh:`文件面板上传大小上限`,labelEn:`File panel upload size limit`,hintZh:`单个文件大小,单位 MB(1–100)`,hintEn:`Per-file limit in MB (1–100)`},folderUploadMaxMb:{labelZh:`文件夹上传大小上限`,labelEn:`Folder upload size limit`,hintZh:`每个文件的大小,单位 MB(1–100)`,hintEn:`Per-file limit in MB (1–100)`},bgAutoCleanupMin:{labelZh:`后台任务自动清理`,labelEn:`Background Task Auto-cleanup`,hintZh:`定期清理闲置超阈值的 AI 起后台实例(分钟;0 = 关;面板里📌钉住的不算)`,hintEn:`Periodically clean AI-started background instances idle past the threshold (minutes; 0 = off; pinned ones skipped)`},toolWatchdogTimeoutMs:{labelZh:`工具看门狗超时`,labelEn:`Tool Watchdog Timeout`,hintZh:`工具长时间未返回时的最长等待熔断时间`,hintEn:`Maximum execution time before aborting stuck tools`},questionnaireEnabled:{labelZh:`问卷模式 (ask_user_question)`,labelEn:`Questionnaire Mode`,hintZh:`允许 AI 遇到歧义时弹窗向用户多选/单选确认`,hintEn:`Allow agent to ask interactive multiple-choice questions`},questionPresentation:{labelZh:`问卷提醒方式`,labelEn:`Questionnaire reminders`,hintZh:`当前对话弹出、全部弹出或仅队列`,hintEn:`Current conversation, all popups, or manual queue`},toolApprovalPresentation:{labelZh:`工具审批提醒方式`,labelEn:`Tool approval reminders`,hintZh:`当前对话弹出、全部弹出或仅队列`,hintEn:`Current conversation, all popups, or manual queue`},questionTimeoutSeconds:{labelZh:`子代理问卷等待期限`,labelEn:`Subagent question timeout`,hintZh:`秒;0 为持续等待,超时不自动选择答案`,hintEn:`Seconds; 0 waits indefinitely, timeout never selects an answer`},editSoftEnabled:{labelZh:`宽松缩进编辑 (edit_soft)`,labelEn:`Soft Indentation Edit`,hintZh:`提供忽略前导空白缩进差异的鲁棒编辑工具`,hintEn:`Provide indentation-tolerant text replacement tool`},terminalToolsEnabled:{labelZh:`终端工具集`,labelEn:`Terminal Toolset`,hintZh:`向 AI 开放持久交互式 PTY 终端驱动工具`,hintEn:`Enable persistent PTY interactive terminal tools`},terminalBash:{labelZh:`终端接管 Bash`,labelEn:`Terminal Takes Over Bash`,hintZh:`将 bash 工具调用分流至可见交互终端并实时回显`,hintEn:`Route bash execution into the visible interactive terminal`},terminalBashIdleMs:{labelZh:`终端静默超时`,labelEn:`Terminal Idle Timeout`,hintZh:`终端无新输出时判定为完成的静默时间`,hintEn:`Idle duration before assuming command finished`},terminalBashMaxForegroundMs:{labelZh:`前台最长运行时间`,labelEn:`Max Foreground Runtime`,hintZh:`前台命令超时未退出的强制截断时间`,hintEn:`Timeout before cutting off long foreground commands`},disabledSkills:{labelZh:`禁用的技能`,labelEn:`Disabled Skills`,hintZh:`在当前工作区中禁用的技能列表`,hintEn:`Skills excluded in the current workspace`},disabledExtensions:{labelZh:`禁用的扩展`,labelEn:`Disabled Extensions`,hintZh:`在当前项目中禁用的扩展列表`,hintEn:`Extensions excluded in the current project`},skillsFullText:{labelZh:`技能全文常驻`,labelEn:`Skills Full Text in Context`,hintZh:`将指定技能的完整正文直接注入上下文,跳过 skill 工具按需载入`,hintEn:`Inject full text of selected skills directly into context`},skillsCatalogMaxDesc:{labelZh:`技能描述截断字符数`,labelEn:`Skill Description Cap`,hintZh:`名录中单条技能描述最大字符数(默认 250,0 为不截断)`,hintEn:`Max characters per skill description in catalog (default 250, 0 to disable)`},skillsCatalogShowLocation:{labelZh:`名录显示物理路径`,labelEn:`Show Skill Location`,hintZh:`是否在技能名录中输出 location 文件绝对路径(默认关,避免浪费 token 和泄露路径)`,hintEn:`Whether to output file path in skill catalog (default off to save tokens and prevent path leak)`},skillsCatalogBudget:{labelZh:`技能名录总字符预算`,labelEn:`Skill Catalog Budget`,hintZh:`技能名录字符上限(默认 20000),超限自动降级为紧凑名称索引`,hintEn:`Total catalog character limit (default 20000), falls back to compact name index when exceeded`},steeringMode:{labelZh:`插话队列模式`,labelEn:`Steering Queue Mode`,hintZh:`一次处理全部插话或每次一条`,hintEn:`Process all queued steering messages or one at a time`},followUpMode:{labelZh:`追问队列模式`,labelEn:`Follow-Up Queue Mode`,hintZh:`一次处理全部追问或每次一条`,hintEn:`Process all queued follow-up messages or one at a time`},retryMaxAttempts:{labelZh:`网络重试上限`,labelEn:`Network Retry Attempts`,hintZh:`模型网络请求失败时的最大自动重试次数`,hintEn:`Max auto-retries when model requests fail`},softCapTokens:{labelZh:`上下文压缩软上限`,labelEn:`Context Soft-Cap Tokens`,hintZh:`提前触发上下文平滑压缩的 token 阈值(默认 16384)`,hintEn:`Token threshold to trigger context compaction early`},softCapByModel:{labelZh:`分模型压缩软上限`,labelEn:`Per-Model Soft-Cap`,hintZh:`针对不同模型单独设置的上下文压缩阈值`,hintEn:`Custom soft-cap thresholds configured per model`},subagentDefaultModel:{labelZh:`子代理默认模型`,labelEn:`Subagent Default Model`,hintZh:`派生子代理时优先使用的专用模型(留空跟随主对话)`,hintEn:`Dedicated model for subagents (empty to follow main chat)`},subagentMaxDepth:{labelZh:`子代理最大嵌套层数`,labelEn:`Subagent Max Depth`,hintZh:`主对话下最多几层子代理(0 = 不限制,1 = 子代理不能再派发)`,hintEn:`Max subagent layers below the main chat (0 = unlimited, 1 = subagents cannot spawn)`},subagentAutoWakeMaxTurns:{labelZh:`子代理自动唤醒轮数上限`,labelEn:`Subagent Max Auto-Wake Rounds`,hintZh:`连续自动唤醒父对话的最大轮数(默认 5,0 = 不限制,挂起期间通知不丢)`,hintEn:`Max consecutive autonomous wake rounds (default 5, 0 = unlimited; buffered on suspend)`},visionBridgeEnabled:{labelZh:`视觉桥 (看图转写)`,labelEn:`Vision Bridge`,hintZh:`主模型不具备识图能力时,自动使用带视觉的模型预先转写图片`,hintEn:`Use vision model to describe images when main model is text-only`},visionBridgeModel:{labelZh:`视觉桥专属模型`,labelEn:`Vision Bridge Model`,hintZh:`用于看图转写的视觉模型 ID`,hintEn:`Model ID used for vision transcription`},visionBridgePromptMode:{labelZh:`视觉桥提示词模式`,labelEn:`Vision Bridge Prompt Mode`,hintZh:`视觉桥转写提示词的追加/替换模式`,hintEn:`Append or replace mode for vision bridge prompt`},visionBridgePrompt:{labelZh:`视觉桥提示词`,labelEn:`Vision Bridge Prompt`,hintZh:`指导视觉模型如何描述图片的系统提示词`,hintEn:`System prompt guiding image transcription`},scmCommitMsgPromptMode:{labelZh:`Git 提交信息提示词模式`,labelEn:`Git Commit Prompt Mode`,hintZh:`AI 生成 Git 提交信息时的提示词模式`,hintEn:`Prompt mode for AI-generated Git commit messages`},scmCommitMsgPrompt:{labelZh:`Git 提交信息提示词`,labelEn:`Git Commit Prompt`,hintZh:`指导 AI 根据 git diff 撰写提交信息的规范提示词`,hintEn:`Prompt guiding AI to write commit messages from git diff`},planModePromptMode:{labelZh:`计划模式提示词模式`,labelEn:`Plan Mode Prompt Mode`,hintZh:`计划模式提示词的追加/替换模式`,hintEn:`Append or replace mode for Plan Mode prompt`},planModePrompt:{labelZh:`计划模式提示词`,labelEn:`Plan Mode Prompt`,hintZh:`计划模式下限制模型只规划不施工的系统提示词`,hintEn:`System prompt restricting agent to planning only`},goalModeEnabled:{labelZh:`目标模式 2.0`,labelEn:`Goal Mode 2.0`,hintZh:`主对话当审查者,服务端常驻执行对话协同干活`,hintEn:`Reviewer/executor loop architecture for goal tasks`},parallelReminderEnabled:{labelZh:`并行编辑提醒`,labelEn:`Parallel Edit Reminder`,hintZh:`多个标签页同时编辑同一会话时的冲突告警`,hintEn:`Warn when multiple tabs edit the same session`},uiLayout:{labelZh:`界面布局与图标排列`,labelEn:`UI Layout & Icons`,hintZh:`顶栏、底栏、左右侧边栏按钮的自定义顺序、可见性与对齐`,hintEn:`Custom order, visibility and alignment for bars and docks`},disabledPlugins:{labelZh:`禁用的插件`,labelEn:`Disabled Plugins`,hintZh:`停用的 UI 插件列表`,hintEn:`List of deactivated UI plugins`},thinkingWrap:{labelZh:`思考区自动折行`,labelEn:`Thinking Block Word Wrap`,hintZh:`思考展开区长文本是否自动折行`,hintEn:`Enable word wrap inside thinking blocks`},toolsWrap:{labelZh:`工具调用自动折行`,labelEn:`Tool Call Word Wrap`,hintZh:`工具调用参数与结果长文本是否自动折行`,hintEn:`Enable word wrap for tool parameters and results`},toolImagesEnabled:{labelZh:`工具调用图片渲染`,labelEn:`Tool Image Preview`,hintZh:`直接在工具卡片内渲染输出的图片文件`,hintEn:`Render image output directly in tool cards`},keepRecentMessages:{labelZh:`常驻渲染消息数`,labelEn:`Messages Kept In Full`,hintZh:`消息列表尾部保持完整渲染的消息条数;更早的折叠为摘要行`,hintEn:`Recent messages rendered in full; older ones collapse to summary rows`},reversePagination:{labelZh:`向上分页加载`,labelEn:`Load Earlier Messages`,hintZh:`默认仅挂载最近消息,向上滚动或点击加载更早历史,完全跳过视口占位符获得原生流畅度`,hintEn:`Only mount recent messages; scroll up or click to load earlier history with zero placeholders`},showForkedParentSessions:{labelZh:`显示已分支的父会话`,labelEn:`Show Forked Parent Sessions`,hintZh:`编辑历史提问或派生分支后,在历史对话列表中同时保留原父会话`,hintEn:`Keep original parent sessions visible in the history list after editing a message or forking`},retainFinishedConversations:{labelZh:`保留已结束的运行对话`,labelEn:`Retain Finished Running Conversations`,hintZh:`切换对话或新建对话时,已结束(空闲)的对话依然保留在运行列表中,直到手动移出`,hintEn:`Keep finished (idle) conversations in the Running Chats list when switching away until manually removed`},openRecentSessionOnProjectSwitch:{labelZh:`切换项目时打开最近会话`,labelEn:`Open Recent Session on Project Switch`,hintZh:`切换到新项目时自动打开该项目最近的会话;关闭后切换项目将直接创建全新空白对话`,hintEn:`Automatically resume the most recent session when switching projects. When off, always create a fresh blank chat`},quickPhrases:{labelZh:`快捷短语列表`,labelEn:`Quick Phrases List`,hintZh:`输入框上方的常用提示短语快捷按钮`,hintEn:`Quick prompt phrase buttons above composer`},quickPhrasesEnabled:{labelZh:`启用快捷短语`,labelEn:`Enable Quick Phrases`,hintZh:`是否在输入框上方显示快捷短语药丸栏`,hintEn:`Display quick phrases bar above composer`},minimalNewChat:{labelZh:`极简新对话`,labelEn:`Minimalist New Chat`,hintZh:`新对话隐藏提示词模板并隐藏快捷短语,呈现现代极简风格`,hintEn:`Hide prompt templates and quick phrases on new chat for a clean modern look`},preserveDraftAcrossConversations:{labelZh:`输入框文字跨对话保留`,labelEn:`Preserve Composer Text Across Conversations`,hintZh:`开启:输入文字切换别的会话不清空;关闭:仅保留当前会话文字,切换其他会话时清空或显示该会话已保留文字,切回时恢复当前会话文字`,hintEn:`Enabled: keep composer text when switching conversations. Disabled: retain text only for the current conversation`},devNoCache:{labelZh:`开发者免缓存模式`,labelEn:`Developer No-Cache Mode`,hintZh:`前端静态资源强制请求最新,不走缓存`,hintEn:`Bypass browser cache for static frontend assets`},autoReload:{labelZh:`插件自动热重载`,labelEn:`Auto Reload on File Change`,hintZh:`本地插件文件变更时自动刷新插件运行时`,hintEn:`Automatically reload plugins when files change`},defaultAgentPreset:{labelZh:`默认智能体预设`,labelEn:`Default Agent Preset`,hintZh:`新建会话时默认加载的智能体预设(DSH 多引擎)`,hintEn:`Default agent preset applied to new sessions (DSH)`},defaultPermissionPreset:{labelZh:`默认权限预设`,labelEn:`Default Permission Preset`,hintZh:`新建会话时默认加载的权限预设`,hintEn:`Default permission preset applied to new sessions`}};function xn(e,t=`zh`){let n=bn[e];return n?t===`zh`?n.labelZh:n.labelEn:e}function Sn(e,t=`zh`){let n=bn[e];return n&&(t===`zh`?n.hintZh:n.hintEn)||``}function Cn(e,t,n=`zh`){let r=n===`zh`;if(t==null)return{summary:r?`未配置(跟随当前值)`:`Not configured (keeps current)`};if(e===`disabledAgentTools`){let e=Array.isArray(t)?t.filter(e=>typeof e==`string`&&!!e):[],n=Ze(e);return e.length===0?{summary:r?`全部启用(共 ${n.length} 个可用工具)`:`All enabled (${n.length} available tools)`,detail:[`[${r?`已启用可用工具`:`Enabled Tools`} (${n.length})]`,...n.map(e=>` ✓ ${e}`)].join(`