zen-gitsync 2.18.12 → 2.18.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli/ai/agent.js +1385 -1385
- package/src/cli/ai/context.js +431 -431
- package/src/cli/ai/context.test.js +376 -376
- package/src/cli/ai/turn.js +190 -190
- package/src/ui/public/assets/AgentView-CuEM6xzC.js +11 -0
- package/src/ui/public/assets/AppVersionBadge-BK1Fiv3b.js +2 -0
- package/src/ui/public/assets/BranchSelector-avxY_m05.js +1 -0
- package/src/ui/public/assets/CommitForm-hThTnoNt.js +14 -0
- package/src/ui/public/assets/CommonDialog-zaBdFGFH.js +1 -0
- package/src/ui/public/assets/CopySessionButton-CAxaqLQL.js +21 -0
- package/src/ui/public/assets/EditorView-iSA2SXJR.js +37 -0
- package/src/ui/public/assets/{FlowExecutionViewer-Ce4Q5ia6.js → FlowExecutionViewer-C5ylYV2C.js} +1 -1
- package/src/ui/public/assets/FlowOrchestrationWorkspace-CiQ07ZQv.js +21 -0
- package/src/ui/public/assets/LogList-Sjb8vmvq.js +7 -0
- package/src/ui/public/assets/MindmapView-B5rChFMP.js +2 -0
- package/src/ui/public/assets/MonitorView-Dcc-i2Fo.js +3 -0
- package/src/ui/public/assets/ProjectStartupButton-fz6eLCZU.js +1 -0
- package/src/ui/public/assets/RecentDirectoriesChat-BDnNp9jh.js +3 -0
- package/src/ui/public/assets/RemoteManagerDialog-NA1jRC7O.js +4 -0
- package/src/ui/public/assets/RemoteRepoCard-CKm4KqHs.js +7 -0
- package/src/ui/public/assets/SourceMapView-Drfato_u.js +3 -0
- package/src/ui/public/assets/SvgIcon-DR_79iBR.js +1 -0
- package/src/ui/public/assets/UserInputNode-DroKvDOa.js +1 -0
- package/src/ui/public/assets/WorkbenchView-CW7OACCU.js +326 -0
- package/src/ui/public/assets/{WorkbenchView-DzBtCzay.css → WorkbenchView-C_u6BptZ.css} +1 -1
- package/src/ui/public/assets/{_plugin-vue_export-helper-BY0jlMBE.js → _plugin-vue_export-helper-bQQyMRS6.js} +5 -5
- package/src/ui/public/assets/{agentConversations-CC01a7SP.js → agentConversations-wYAksLq1.js} +8 -8
- package/src/ui/public/assets/{configStore-EvRYufor.js → configStore-BeHB-gV4.js} +1 -1
- package/src/ui/public/assets/{css.worker-BDCmgL4U.js → css.worker-DFdt6_zu.js} +9 -9
- package/src/ui/public/assets/{dagre-Ct-SQ-7k.js → dagre-CXi8gaG9.js} +4 -4
- package/src/ui/public/assets/editor.worker-O-CH8JUO.js +26 -0
- package/src/ui/public/assets/{element-plus-D-6gla1z.css → element-plus-DJ3ZQa98.css} +1 -1
- package/src/ui/public/assets/element-plus-DgSY_Wt4.js +48 -0
- package/src/ui/public/assets/{flow-mindmap-C8x6ucsA.js → flow-mindmap-BsTRkgat.js} +56 -56
- package/src/ui/public/assets/{html.worker-DG8hnSJR.js → html.worker-JUzsMP-j.js} +8 -8
- package/src/ui/public/assets/index-BRQstBzy.js +211 -0
- package/src/ui/public/assets/json.worker-B4dEhy0e.js +58 -0
- package/src/ui/public/assets/{monaco-BV4P06MT.js → monaco-CnWeufxc.js} +6 -6
- package/src/ui/public/assets/{office-docx-B8BoOvth.js → office-docx-EUfAIM4w.js} +6 -6
- package/src/ui/public/assets/{office-excel-CFRkxKv8.js → office-excel-BZW0bXQo.js} +1 -1
- package/src/ui/public/assets/{office-pptx-DXdbDvLM.js → office-pptx-CBvDNZ4m.js} +3 -3
- package/src/ui/public/assets/{ts.worker-DgFMIcEs.js → ts.worker-CmEKzkmF.js} +49 -49
- package/src/ui/public/assets/{useOrchestrator-C8BD2JSO.js → useOrchestrator-Bhl7DGKW.js} +1 -1
- package/src/ui/public/assets/{vendor-DYtaPSUU.js → vendor-CZlKgriV.js} +43 -43
- package/src/ui/public/assets/vue-flow-DawpR_uk.js +39 -0
- package/src/ui/public/index.html +12 -12
- package/src/ui/server/routes/config.js +1348 -1348
- package/src/ui/server/routes/workbench/agentChat.js +752 -752
- package/src/ui/server/routes/workbench/agentChatShared.test.js +496 -496
- package/src/ui/server/routes/workbench/agentRoutes.js +13 -1
- package/src/ui/server/routes/workbench/agentRoutes.test.js +75 -0
- package/src/ui/server/routes/workbench/index.js +2 -1
- package/src/ui/server/routes/workbench/scheduleRoutes.js +2 -2
- package/src/ui/server/routes/workbench/shared.js +17 -0
- package/src/ui/public/assets/AgentView-CVbcrngz.js +0 -11
- package/src/ui/public/assets/AppVersionBadge-7gFB6t_t.js +0 -2
- package/src/ui/public/assets/BranchSelector-BIRNxA6U.js +0 -1
- package/src/ui/public/assets/CommitForm-CWpaazi7.js +0 -14
- package/src/ui/public/assets/CommonDialog-DrxsmpDL.js +0 -1
- package/src/ui/public/assets/CopySessionButton-C_01fcd3.js +0 -21
- package/src/ui/public/assets/EditorView-D80wG480.js +0 -37
- package/src/ui/public/assets/FlowOrchestrationWorkspace-Cq1zEt5K.js +0 -21
- package/src/ui/public/assets/LogList-DtmJG27U.js +0 -7
- package/src/ui/public/assets/MindmapView-BR2_C4Du.js +0 -2
- package/src/ui/public/assets/MonitorView-Cs_kwPBu.js +0 -3
- package/src/ui/public/assets/ProjectStartupButton-BfQJ0i5X.js +0 -1
- package/src/ui/public/assets/RecentDirectoriesChat-_gNQGqkM.js +0 -3
- package/src/ui/public/assets/RemoteManagerDialog-KY5I3Ftv.js +0 -4
- package/src/ui/public/assets/RemoteRepoCard-BUgdGtwC.js +0 -7
- package/src/ui/public/assets/SourceMapView-RkGgdvnN.js +0 -3
- package/src/ui/public/assets/SvgIcon-CP7WAT4C.js +0 -1
- package/src/ui/public/assets/UserInputNode-CwSqPh4O.js +0 -1
- package/src/ui/public/assets/WorkbenchView-CBfccRIP.js +0 -320
- package/src/ui/public/assets/editor.worker-GCPm6rMv.js +0 -26
- package/src/ui/public/assets/element-plus-CDrtgG55.js +0 -48
- package/src/ui/public/assets/index-CyEcaEC9.js +0 -211
- package/src/ui/public/assets/json.worker-CxwlJRnL.js +0 -58
- package/src/ui/public/assets/vue-flow-B7Hdmt-y.js +0 -39
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,An as t,At as n,Cn as r,Dn as i,F as a,Hn as o,I as s,In as c,J as l,Kn as u,Lr as d,On as f,Qr as p,Rn as m,Sn as h,Sr as g,Tn as _,U as ee,V as v,W as y,Xr as b,Y as x,Zn as te,a as S,bn as C,br as w,cr as T,dr as E,fn as D,hr as O,ht as k,jn as A,kn as j,ni as M,q as N,tr as P,un as F,ur as I,z as L}from"./element-plus-DgSY_Wt4.js";import{n as R,t as z}from"./_plugin-vue_export-helper-bQQyMRS6.js";import{t as B}from"./SvgIcon-DR_79iBR.js";import{o as ne,t as V}from"./configStore-BeHB-gV4.js";import{G as H,K as re,U,c as W,d as G,j as ie,l as K,s as ae,u as q}from"./index-BRQstBzy.js";o();var oe=m({__name:`GlobalLoading`,props:{visible:{type:Boolean,required:!1,default:!1},text:{type:String,required:!1,default:R(`@2AEBA:加载中...`)},showProgress:{type:Boolean,required:!1,default:!1},progress:{type:Number,required:!1,default:0},mock:{type:Boolean,required:!1,default:!1}},setup(e,{expose:t}){t();let n={};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}});o(),d(),D();var se={class:`loading-container`},J={class:`loading-text`},ce={key:0,class:`loading-progress`};function le(n,r,i,a,o,s){return e(),j(_,{to:`body`},[c(F,{name:`loading-fade`},{default:I(()=>[i.visible||i.mock?(e(),A(`div`,{key:0,class:`global-loading-overlay`,onClick:r[0]||=h(()=>{},[`stop`])},[f(`div`,se,[t(` 主加载器 `),r[1]||=f(`div`,{class:`loading-spinner`},[f(`div`,{class:`spinner-ring`}),f(`div`,{class:`spinner-ring`}),f(`div`,{class:`spinner-ring`})],-1),t(` 加载文字 `),f(`div`,J,M(i.text),1),t(` 进度条(可选/Mock) `),i.showProgress||i.mock?(e(),A(`div`,ce,[f(`div`,{class:b([`progress-bar`,{"is-mock":i.mock&&!i.showProgress}]),style:p(i.showProgress?{width:i.progress+`%`}:void 0)},null,6)])):t(`v-if`,!0)])])):t(`v-if`,!0)]),_:1})])}var ue=z(oe,[[`render`,le],[`__scopeId`,`data-v-77e24a5f`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/GlobalLoading.vue`]]);o();var Y=m({__name:`SuccessModal`,props:{visible:{type:Boolean,required:!1,default:!1},text:{type:String,required:!1,default:R(`@71545:操作成功!`)},description:{type:String,required:!1,default:``}},setup(e,{expose:t}){t();let n={};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}});o(),d(),D();var X={class:`success-container`},de={class:`success-text`},fe={key:0,class:`success-description`};function pe(n,r,i,a,o,s){return e(),j(_,{to:`body`},[c(F,{name:`success-fade`},{default:I(()=>[i.visible?(e(),A(`div`,{key:0,class:`success-overlay`,onClick:r[0]||=h(()=>{},[`stop`])},[f(`div`,X,[t(` 成功图标 `),r[1]||=f(`div`,{class:`success-icon`},[f(`svg`,{viewBox:`0 0 52 52`,class:`success-svg`},[f(`circle`,{class:`success-circle`,cx:`26`,cy:`26`,r:`25`,fill:`none`}),f(`path`,{class:`success-check`,fill:`none`,d:`m14.1 27.2l7.1 7.2 16.7-16.8`})])],-1),t(` 成功文字 `),f(`div`,de,M(i.text),1),t(` 描述文字 `),i.description?(e(),A(`div`,fe,M(i.description),1)):t(`v-if`,!0)])])):t(`v-if`,!0)]),_:1})])}var me=z(Y,[[`render`,pe],[`__scopeId`,`data-v-30ab4535`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/SuccessModal.vue`]]);O();var Z=w({visible:!1,text:R(`@F2A3A:加载中...`),showProgress:!1,progress:0});function he(){return{loadingState:Z,show:e=>{Z.visible=!0,Z.text=e?.text||R(`@F2A3A:加载中...`),Z.showProgress=e?.showProgress||!1,Z.progress=e?.progress||0},hide:()=>{Z.visible=!1},updateProgress:e=>{Z.progress=Math.max(0,Math.min(100,e))},updateText:e=>{Z.text=e},setText:e=>{Z.visible&&(Z.text=e)}}}O();var Q=w({visible:!1,text:R(`@B8591:操作成功!`),description:``});function ge(){let e=e=>{Q.visible=!0,Q.text=e?.text||R(`@B8591:操作成功!`),Q.description=e?.description||``;let n=e?.duration||2e3;setTimeout(()=>{t()},n)},t=()=>{Q.visible=!1};return{successState:Q,show:e,hide:t}}o();var _e=m({__name:`QuickCommitButton`,props:{from:{type:String,required:!1,default:`form`},hasUserCommitMessage:{type:Boolean,required:!1,default:!1},finalCommitMessage:{type:String,required:!1,default:``},skipHooks:{type:Boolean,required:!1,default:!1}},emits:[`beforeCommit`,`afterCommit`,`clearFields`],setup(e,{expose:t,emit:n}){let r=H(),a=V(),o=e,s=n,c=i(()=>r.fileList.some(e=>!U(e.path,a.lockedFiles))),l=i(()=>r.isSelectionMode&&r.selectedFiles.size>0&&r.selectedUnstagedPaths.length>0),u=i(()=>r.hasConflictedFiles?!0:r.isSelectionMode?!l.value||!o.hasUserCommitMessage:!c.value||!o.hasUserCommitMessage),d=i(()=>r.isAddingFiles||r.isCommiting),f=i(()=>r.hasConflictedFiles?R(`@2E184:存在冲突文件,请先解决冲突`):r.isSelectionMode?r.selectedFiles.size===0?R(`@2E184:请先勾选要提交的文件`):r.selectedUnstagedPaths.length===0?R(`@2E184:所选文件无需暂存或被锁定`):o.hasUserCommitMessage?R(`@2E184:一键完成:仅暂存所选文件 → 提交`):R(`@2E184:请输入提交信息`):c.value?o.hasUserCommitMessage?R(`@2E184:一键完成:暂存所有更改 → 提交`):R(`@2E184:请输入提交信息`):R(`@2E184:没有需要提交的更改`)),p=i(()=>r.isSelectionMode&&l.value?R(`@2E184:一键提交所选`):R(`@2E184:一键提交`)),m=i(()=>o.from===`form`?r.isSelectionMode&&l.value?R(`@2E184:暂存所选 + 提交`):R(`@2E184:暂存 + 提交`):``);async function h(){s(`beforeCommit`);try{let e=await r.stageSelectedAndCommit(o.finalCommitMessage,o.skipHooks);e&&s(`clearFields`),s(`afterCommit`,e)}catch(e){console.error(`一键提交失败:`,e),s(`afterCommit`,!1)}}t({triggerQuickCommit:h});let g={gitStore:r,configStore:a,props:o,emit:s,hasAnyChanges:c,hasSelectedToStage:l,isDisabled:u,isLoading:d,tooltipText:f,buttonTitle:p,buttonDesc:m,handleQuickCommit:h,get ElTooltip(){return y},get Edit(){return k}};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}});o(),d();var ve={class:`one-commit-content`},ye={class:`one-commit-text`},be={class:`one-commit-title`},xe={key:0,class:`one-commit-desc`};function Se(n,r,i,a,o,s){let u=l,d=L;return e(),A(`div`,null,[c(a.ElTooltip,{content:a.tooltipText,placement:`top`,"show-after":200},{default:I(()=>[c(d,{type:`primary`,onClick:a.handleQuickCommit,loading:a.isLoading,disabled:a.isDisabled,class:b([i.from,`one-commit-button`])},{default:I(()=>[f(`div`,ve,[c(u,{class:`one-commit-icon`},{default:I(()=>[c(a.Edit)]),_:1}),f(`div`,ye,[f(`span`,be,M(a.buttonTitle),1),i.from===`form`?(e(),A(`span`,xe,M(a.buttonDesc),1)):t(`v-if`,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}var Ce=z(_e,[[`render`,Se],[`__scopeId`,`data-v-0c962829`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/buttons/QuickCommitButton.vue`]]);o();var we=m({__name:`AiQuickPushButton`,props:{from:{type:String,required:!1,default:`form`},generating:{type:Boolean,required:!1,default:!1}},emits:[`trigger`],setup(e,{expose:t,emit:n}){t();let r=H(),a=V(),o=e,s=n,c=i(()=>r.fileList.some(e=>!U(e.path,a.lockedFiles))),l=i(()=>r.isSelectionMode&&r.selectedFiles.size>0&&r.selectedUnstagedPaths.length>0),u=i(()=>!r.isSelectionMode&&!c.value&&r.branchAhead>0),d=i(()=>r.hasConflictedFiles||!r.hasUpstream?!0:r.isSelectionMode?!l.value:!c.value&&r.branchAhead===0),f=i(()=>o.generating||r.isAddingFiles||r.isCommiting||r.isPushing),p=i(()=>r.hasConflictedFiles?R(`@2E184:存在冲突文件,请先解决冲突`):r.hasUpstream?o.generating?R(`@2E184:AI 正在生成提交信息…`):r.isSelectionMode?l.value?R(`@2E184:一键完成:AI 生成提交信息 → 仅暂存所选文件 → 提交 → 推送`):R(`@2E184:请先勾选要推送的文件`):!c.value&&r.branchAhead===0?R(`@2E184:没有需要提交或推送的更改`):c.value?R(`@2E184:一键完成:AI 生成提交信息 → 暂存所有更改 → 提交 → 推送`):R(`@2E184:本地已提交,AI 将直接推送到远程仓库`):R(`@2E184:当前分支没有上游分支`)),m=i(()=>o.generating?R(`@2E184:AI 正在生成提交信息…`):r.isSelectionMode&&l.value?R(`@2E184:AI 提交并推送所选`):R(`@2E184:AI 提交并推送`)),h=i(()=>o.from!==`form`||o.generating?``:u.value?R(`@2E184:本地已提交,直接推送`):R(`@2E184:AI 生成信息 + 推送`));function g(){d.value||f.value||s(`trigger`)}let _={gitStore:r,configStore:a,props:o,emit:s,hasAnyChanges:c,hasSelectedToStage:l,isPushOnly:u,isDisabled:d,isLoading:f,tooltipText:p,buttonTitle:m,buttonDesc:h,handleClick:g,get ElTooltip(){return y},SvgIcon:B};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}});o(),d();var $={class:`one-ai-push`},Te={class:`one-ai-push-content`},Ee={class:`one-ai-push-text`},De={class:`one-ai-push-title`},Oe={key:0,class:`one-ai-push-desc`};function ke(n,r,i,a,o,s){let l=L;return e(),A(`div`,$,[c(a.ElTooltip,{content:a.tooltipText,placement:`top`,"show-after":200},{default:I(()=>[c(l,{type:`primary`,onClick:a.handleClick,loading:a.isLoading,disabled:a.isDisabled,class:b([i.from,`one-ai-push-button`])},{default:I(()=>[f(`div`,Te,[c(a.SvgIcon,{class:`one-ai-push-icon`,"icon-class":`ai-commit`,style:{color:`#fff`}}),f(`div`,Ee,[f(`span`,De,M(a.buttonTitle),1),i.from===`form`?(e(),A(`span`,Oe,M(a.buttonDesc),1)):t(`v-if`,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}var Ae=z(we,[[`render`,ke],[`__scopeId`,`data-v-0a8120f6`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/buttons/AiQuickPushButton.vue`]]);o(),O();var je=m({__name:`GitActionButtons`,props:{hasUserCommitMessage:{type:Boolean,required:!1,default:!1},finalCommitMessage:{type:String,required:!1,default:``},skipHooks:{type:Boolean,required:!1,default:!1},from:{type:String,required:!1,default:`form`},aiGenerating:{type:Boolean,required:!1,default:!1}},emits:[`afterCommit`,`afterPush`,`beforePush`,`pushStart`,`clearFields`,`aiQuickPush`],setup(e,{expose:t,emit:n}){let r=n,i=g(null);function a(e){r(`afterCommit`,e)}function o(e){r(`afterPush`,e)}function s(){r(`beforePush`)}function c(){r(`pushStart`)}function l(){r(`clearFields`)}function u(){r(`aiQuickPush`)}async function d(){return i.value?.triggerQuickPush()}t({triggerQuickPush:d});let f={emit:r,quickPushRef:i,handleAfterCommit:a,handleAfterPush:o,handleBeforePush:s,handlePushStart:c,handleClearFields:l,handleAiQuickPush:u,triggerQuickPush:d,StageButton:G,CommitButton:q,PushButton:K,QuickPushButton:W,QuickCommitButton:Ce,AiQuickPushButton:Ae};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}});o();var Me={class:`form-bottom-actions`},Ne={class:`actions-flex-container`},Pe={class:`left-actions`},Fe={class:`button-grid`},Ie={class:`right-actions`};function Le(t,n,r,i,a,o){return e(),A(`div`,Me,[f(`div`,Ne,[f(`div`,Pe,[f(`div`,Fe,[c(i.StageButton,{onClick:()=>{},from:r.from},null,8,[`from`]),c(i.CommitButton,{"has-user-commit-message":r.hasUserCommitMessage,"final-commit-message":r.finalCommitMessage,"skip-hooks":r.skipHooks,onBeforeCommit:()=>{},onAfterCommit:i.handleAfterCommit,onClick:()=>{},from:r.from},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`from`]),c(i.PushButton,{onBeforePush:()=>{},onAfterPush:i.handleAfterPush,onClick:()=>{},from:r.from},null,8,[`from`])])]),f(`div`,Ie,[c(i.QuickCommitButton,{from:r.from,"has-user-commit-message":r.hasUserCommitMessage,"final-commit-message":r.finalCommitMessage,"skip-hooks":r.skipHooks,onAfterCommit:i.handleAfterCommit,onClearFields:i.handleClearFields},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),c(i.QuickPushButton,{ref:`quickPushRef`,from:r.from,"has-user-commit-message":r.hasUserCommitMessage,"final-commit-message":r.finalCommitMessage,"skip-hooks":r.skipHooks,onBeforePush:i.handleBeforePush,onPushStart:i.handlePushStart,onAfterPush:i.handleAfterPush,onClearFields:i.handleClearFields},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),c(i.AiQuickPushButton,{from:r.from,generating:r.aiGenerating,onTrigger:i.handleAiQuickPush},null,8,[`from`,`generating`])])])])}var Re=z(je,[[`render`,Le],[`__scopeId`,`data-v-12b4dc63`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/GitActionButtons.vue`]]);o(),O();var ze=m({__name:`CommitForm`,setup(e,{expose:t}){t();let r=g(!1),a=g(!1);async function o(){let e=l.isSelectionMode&&l.selectedFiles.size>0?[...l.selectedFiles]:[],t=ne(),n=await(await fetch(`/api/config/generate-commit-message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selectedPaths:e,locale:t.currentLocale})})).json();if(!n.success){let e=n.code,t=n.error||R(`@76872:AI生成失败`),r=e?{TIMEOUT:`@76872:AI生成超时,请重试或检查模型响应速度`,NO_MODEL:`@76872:未配置AI模型,请先在通用设置中添加模型`,NO_JSON:`@76872:AI未返回有效结果,请重试`,PARSE_FAILED:`@76872:AI返回格式无法解析,请重试`,GENERATE_FAILED:`@76872:AI生成失败`,HTTP_ERR:`@76872:AI生成失败`}[e]:null;return S.error(r?R(r):t),!1}let r=[`feat`,`fix`,`docs`,`style`,`refactor`,`test`,`chore`];if(b.value)n.type&&r.includes(n.type)&&(C.value=n.type),n.scope!==void 0&&(w.value=n.scope),n.description&&(E.value=n.description);else{let e=n.type&&n.description?n.scope?`${n.type}(${n.scope}): ${n.description}`:`${n.type}: ${n.description}`:n.description||``;e&&(f.value=e)}return!0}async function s(){if(!r.value){r.value=!0;try{if(!await o())return;S.success(R(`@76872:AI已生成提交信息`))}catch(e){S.error(`${R(`@76872:AI生成失败`)}: ${e.message}`)}finally{r.value=!1}}}async function c(){if(!a.value){a.value=!0;try{let e=l.isSelectionMode&&l.selectedFiles.size>0,t=l.fileList.some(e=>!U(e.path,d.lockedFiles));if(e||t){if(!await o())return;if(await u(),!G.value){S.error(R(`@76872:AI生成失败`));return}}await I.value?.triggerQuickPush?.()}catch(e){console.error(`AI 提交并推送失败:`,e),S.error(`${R(`@76872:AI生成失败`)}: ${e.message}`)}finally{a.value=!1}}}let l=H(),d=V(),f=g(``),{loadingState:p,show:m,hide:h,setText:_}=he(),{successState:ee}=ge(),v=g(!1),y=g(``),b=i({get:()=>d.isStandardCommit,set:e=>{d.isStandardCommit=e}}),C=g(`feat`),w=g(``),E=g(``),D=g(``),O=g(``),k=g([]),A=g(!1),j=g([]),M=g(!1),N=g(!1),P=i({get:()=>d.skipHooks,set:e=>{d.skipHooks=e}}),F=i({get:()=>d.autoQuickPushOnEnter,set:e=>{d.autoQuickPushOnEnter=e}}),I=g(null),L=g(!1),z=i(()=>[{value:`feat`,label:`feat: ${R(`@76872:新功能`)}`},{value:`fix`,label:`fix: ${R(`@76872:修复bug`)}`},{value:`docs`,label:`docs: ${R(`@76872:文档修改`)}`},{value:`style`,label:`style: ${R(`@76872:样式修改`)}`},{value:`refactor`,label:`refactor: ${R(`@76872:代码重构`)}`},{value:`test`,label:`test: ${R(`@76872:测试代码`)}`},{value:`chore`,label:`chore: ${R(`@76872:构建/工具修改`)}`}]),B=g([]),W=i(()=>{if(!b.value)return f.value||y.value;let e=`${C.value||``}`;return w.value&&(e+=`(${w.value})`),e+=`: ${E.value}`,D.value&&(e+=`\n\n${D.value}`),O.value&&(e+=`\n\n${O.value}`),e}),G=i(()=>b.value?(l.isMergeInProgress||(C.value||``).trim()!==``)&&(E.value||``).trim()!==``:f.value.trim()!==``),K=i(()=>l.hasConflictedFiles?!0:l.isMergeInProgress?!G.value:!l.fileList.some(e=>!U(e.path,d.lockedFiles))||!G.value),q=i(()=>{let e=`${R(`@76872:输入提交信息 (默认: `)}${y.value})`;return F.value?`${e}${R(`@76872:(按回车一键推送)`)}`:e}),oe=i(()=>{let e=R(`@76872:简短描述(必填)`);return F.value?R(`@76872:简短描述(必填,按回车一键推送)`):e}),se=i(()=>{let e=`git commit -m "${W.value}"`;return P.value&&(e+=` --no-verify`),e});function J(){let e=d.config;e&&(y.value=e.defaultCommitMessage||``,e.descriptionTemplates&&Array.isArray(e.descriptionTemplates)&&(k.value=e.descriptionTemplates),e.scopeTemplates&&Array.isArray(e.scopeTemplates)&&(j.value=e.scopeTemplates),e.messageTemplates&&Array.isArray(e.messageTemplates)&&(B.value=e.messageTemplates))}function ce(e){E.value=e,A.value=!1}function le(e){w.value=e,M.value=!1}function Y(){A.value=!0}function X(){M.value=!0}function de(){f.value=``,E.value=``,D.value=``,O.value=``,C.value=`feat`,d.autoSetDefaultMessage&&d.defaultCommitMessage&&(b.value?E.value=d.defaultCommitMessage:f.value=d.defaultCommitMessage)}function fe(){m({text:R(`@76872:正在暂存文件…`),showProgress:!1})}function pe(){h()}function Z(e){if(h(),e){v.value=!0;try{setTimeout(async()=>{try{console.log(R(`@76872:推送成功,状态已更新`))}catch(e){console.error(`一键推送后处理失败:`,e)}finally{v.value=!1}},1e3)}catch(e){console.error(`一键推送后处理失败:`,e),v.value=!1}}}function Q(e){f.value=e,N.value=!1}async function _e(e){if(!F.value||!G.value)return;let t=l.fileList.some(e=>!U(e.path,d.lockedFiles)),n=l.hasConflictedFiles;if(t&&G.value&&l.hasUpstream&&!n&&e.key===`Enter`&&!e.shiftKey){e.preventDefault();try{await I.value?.triggerQuickPush()}catch(e){console.error(`回车自动一键提交失败:`,e)}}}async function ve(e){try{await d.saveDefaultMessage(e)&&S.success(R(`@76872:默认提交信息设置成功`))}catch(e){S.error(`${R(`@76872:设置默认提交信息失败: `)}${e.message}`)}}T(()=>l.pendingMergeMessage,e=>{e&&(b.value?(C.value=``,E.value=e):f.value=e,l.pendingMergeMessage=``,S.info(R(`@76872:已自动填充合并提交信息`)))}),T(()=>l.isAddingFiles,e=>{e&&p.visible&&_(R(`@76872:正在暂存文件…`))}),T(()=>l.isCommiting,e=>{e&&p.visible&&_(R(`@76872:正在提交更改...`))}),T(()=>l.isPushing,e=>{e&&p.visible&&h()}),te(async()=>{T(()=>d.config,J,{immediate:!0}),d.config||await d.loadConfig(),d.autoSetDefaultMessage&&d.defaultCommitMessage&&(b.value?E.value||=d.defaultCommitMessage:f.value||=d.defaultCommitMessage),l.pendingMergeMessage&&(b.value?(C.value=``,E.value=l.pendingMergeMessage):f.value=l.pendingMergeMessage,l.pendingMergeMessage=``,S.info(R(`@76872:已自动填充合并提交信息`)))});function ye(e,t){t([...e?k.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):k.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function be(e,t){t([...e?j.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):j.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function xe(e){e.isSettings?(Y(),E.value=``):E.value=e.value}function Se(e){e.isSettings?(X(),w.value=``):w.value=e.value}function Ce(e,t){t([...e?B.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):B.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function we(e){e.isSettings?(N.value=!0,f.value=``):f.value=e.value}let $={aiGenerating:r,aiQuickPushing:a,requestAiCommitMessage:o,handleAiGenerateCommit:s,handleAiQuickPush:c,gitStore:l,configStore:d,commitMessage:f,loadingState:p,showLoading:m,hideLoading:h,setLoadingText:_,successState:ee,isUpdatingStatus:v,defaultCommitMessage:y,isStandardCommit:b,commitType:C,commitScope:w,commitDescription:E,commitBody:D,commitFooter:O,descriptionTemplates:k,descriptionDialogVisible:A,scopeTemplates:j,scopeDialogVisible:M,defaultMessageDialogVisible:N,skipHooks:P,autoQuickPushOnEnter:F,gitActionButtonsRef:I,showAdvancedFields:L,commitTypeOptions:z,messageTemplates:B,finalCommitMessage:W,hasUserCommitMessage:G,isCommitDisabled:K,commitMessagePlaceholder:q,descriptionPlaceholder:oe,gitCommandPreview:se,updateFromConfig:J,useTemplate:ce,useScopeTemplate:le,openDescriptionSettings:Y,openScopeSettings:X,clearCommitFields:de,handleQuickPushBefore:fe,handlePushStart:pe,handleQuickPushAfter:Z,useMessageTemplate:Q,handleEnterKey:_e,setDefaultFromTemplate:ve,queryDescriptionTemplates:ye,queryScopeTemplates:be,handleDescriptionSelect:xe,handleScopeSelect:Se,queryMessageTemplates:Ce,handleMessageSelect:we,get $t(){return R},get Loading(){return n},get ArrowDown(){return x},GlobalLoading:ue,SuccessModal:me,TemplateManager:ae,GitCommandPreview:ie,GitActionButtons:Re,IconButton:re};return Object.defineProperty($,"__isScriptSetup",{enumerable:!1,value:!0}),$}});o(),d(),D();var Be={class:`card-header app-card-header`},Ve={class:`header-left`},He={class:`card-content app-card-content`},Ue={class:`layout-container`},We={key:0,class:`git-config-warning`},Ge={key:0,class:`merge-in-progress-banner`},Ke={class:`commit-section`},qe={key:0,class:`commit-form`},Je={class:`description-container`},Ye={class:`standard-commit-form`},Xe={class:`standard-commit-header`},Ze={class:`type-scope-container`},Qe={class:`scope-wrapper`},$e={class:`description-container description-inline`},et=[`aria-expanded`],tt={class:`advanced-fields`},nt={key:0,class:`status-updating-indicator`},rt={key:0,class:`status-updating-indicator`};function it(n,i,o,u,d,p){let m=N,h=v,g=l,_=a,y=s,x=ee;return e(),A(r,null,[f(`div`,{class:b([`card app-card`,{"is-pushing":u.gitStore.isPushing}])},[f(`div`,Be,[f(`div`,Ve,[u.gitStore.userName!==``&&u.gitStore.userEmail!==``?(e(),j(u.GitActionButtons,{key:0,ref:`gitActionButtonsRef`,"has-user-commit-message":u.hasUserCommitMessage,"final-commit-message":u.finalCommitMessage,"skip-hooks":u.skipHooks,"ai-generating":u.aiQuickPushing,onAfterCommit:i[0]||=e=>{e&&u.clearCommitFields()},onAfterPush:u.handleQuickPushAfter,onBeforePush:u.handleQuickPushBefore,onPushStart:u.handlePushStart,onClearFields:u.clearCommitFields,onAiQuickPush:u.handleAiQuickPush},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`ai-generating`])):t(`v-if`,!0)]),t(` 「命令历史」与「Git 操作」2026-10-06 搬到顶栏(App.vue):这个面板在
|
|
2
|
+
"无事可做"时会整块收起,那两个入口必须常驻 —— 否则工作区干净时
|
|
3
|
+
连 pull / fetch / merge 都点不到。
|
|
4
|
+
2026-10-06:✨「AI 生成提交信息」也从这条工具条搬进了输入框那一行
|
|
5
|
+
(见下面 type-scope-container / description-container 末尾)——
|
|
6
|
+
它生成的就是这个输入框的内容,放在输入框里语义更直接,也省掉一条
|
|
7
|
+
只放一个图标的空工具条。 `)]),f(`div`,He,[f(`div`,Ue,[t(` 如果没有配置Git用户信息,显示提示 `),u.gitStore.userName===``||u.gitStore.userEmail===``?(e(),A(`div`,We,[c(m,{title:u.$t(`@76872:Git用户信息未配置`),type:`warning`,closable:!1,"show-icon":``},{default:I(()=>[f(`p`,null,M(u.$t(`@76872:您需要配置Git用户名和邮箱才能提交代码。请使用以下命令配置:`)),1),i[11]||=f(`pre`,{class:`config-command`},`git config --global user.name "Your Name"
|
|
8
|
+
git config --global user.email "your.email@example.com"`,-1)]),_:1},8,[`title`])])):(e(),A(r,{key:1},[t(` 正常的提交区域,仅在Git用户信息已配置时显示 `),t(` MERGING 状态提示 `),u.gitStore.isMergeInProgress?(e(),A(`div`,Ge,[c(m,{title:u.$t(`@76872:合并进行中`),type:`warning`,closable:!1,"show-icon":``},{default:I(()=>[f(`span`,null,M(u.$t(`@76872:分支合并尚未完成,请输入提交信息后点击「提交」按钮完成合并。`)),1)]),_:1},8,[`title`])])):t(`v-if`,!0),t(` 左侧:提交表单 `),f(`div`,Ke,[t(` 普通提交表单 `),u.isStandardCommit?(e(),A(r,{key:1},[t(` 标准化提交表单 `),f(`div`,Ye,[f(`div`,Xe,[f(`div`,Ze,[c(y,{modelValue:u.commitType,"onUpdate:modelValue":i[2]||=e=>u.commitType=e,placeholder:u.$t(`@76872:提交类型`),class:`type-select`,clearable:``},{default:I(()=>[(e(!0),A(r,null,P(u.commitTypeOptions,t=>(e(),j(_,{key:t.value,label:t.label,value:t.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`]),f(`div`,Qe,[c(h,{modelValue:u.commitScope,"onUpdate:modelValue":i[3]||=e=>u.commitScope=e,"fetch-suggestions":u.queryScopeTemplates,placeholder:u.$t(`@76872:作用域(可选)`),class:`scope-input`,clearable:``,onSelect:u.handleScopeSelect},null,8,[`modelValue`,`placeholder`])]),t(` 将简短描述放入同一行 `),f(`div`,$e,[c(h,{modelValue:u.commitDescription,"onUpdate:modelValue":i[4]||=e=>u.commitDescription=e,"fetch-suggestions":u.queryDescriptionTemplates,placeholder:u.descriptionPlaceholder,class:`description-input`,clearable:``,onSelect:u.handleDescriptionSelect,onKeydown:u.handleEnterKey},{suffix:I(()=>[c(u.IconButton,{"custom-class":`ai-suffix-btn`,tooltip:u.$t(`@76872:AI生成提交信息`),"icon-class":u.aiGenerating?``:`ai-commit`,size:`small`,disabled:u.aiGenerating,onClick:u.handleAiGenerateCommit},{default:I(()=>[u.aiGenerating?(e(),j(g,{key:0,class:`is-loading`},{default:I(()=>[c(u.Loading)]),_:1})):t(`v-if`,!0)]),_:1},8,[`tooltip`,`icon-class`,`disabled`])]),_:1},8,[`modelValue`,`placeholder`])])])]),t(` 添加展开/收起高级选项的控制按钮 `),f(`button`,{type:`button`,class:`advanced-options-toggle`,"aria-expanded":u.showAdvancedFields,onClick:i[5]||=e=>u.showAdvancedFields=!u.showAdvancedFields},[f(`span`,null,M(u.showAdvancedFields?u.$t(`@76872:收起`):u.$t(`@76872:正文及页脚`)),1),c(g,{class:b([`toggle-icon`,{"is-active":u.showAdvancedFields}])},{default:I(()=>[c(u.ArrowDown)]),_:1},8,[`class`])],8,et),t(` 使用过渡效果包装高级字段 `),E(f(`div`,tt,[c(x,{modelValue:u.commitBody,"onUpdate:modelValue":i[6]||=e=>u.commitBody=e,type:`textarea`,rows:4,placeholder:u.$t(`@76872:正文(可选):详细描述本次提交的内容和原因`),class:`body-input`,clearable:``},null,8,[`modelValue`,`placeholder`]),c(x,{modelValue:u.commitFooter,"onUpdate:modelValue":i[7]||=e=>u.commitFooter=e,placeholder:u.$t(`@76872:页脚(可选):如 Closes #123`),class:`footer-input`,clearable:``},null,8,[`modelValue`,`placeholder`])],512),[[C,u.showAdvancedFields]])])],2112)):(e(),A(`div`,qe,[f(`div`,Je,[c(h,{modelValue:u.commitMessage,"onUpdate:modelValue":i[1]||=e=>u.commitMessage=e,"fetch-suggestions":u.queryMessageTemplates,placeholder:u.commitMessagePlaceholder,type:`textarea`,rows:3,resize:`none`,class:`commit-message-input`,onSelect:u.handleMessageSelect,onKeydown:u.handleEnterKey},null,8,[`modelValue`,`placeholder`]),t(` 普通模式(3 行 textarea)**不能**像标准模式那样走 suffix 插槽:
|
|
9
|
+
EP 的 el-input 在 type="textarea" 时切到 el-textarea 分支,
|
|
10
|
+
suffix 插槽被 v-if 短路,整个 .el-input__suffix 容器根本不渲染
|
|
11
|
+
(实测 dump 出来只有 textarea 元素 + 两个 v-if 注释)。
|
|
12
|
+
所以这里回到绝对定位:贴框内右上角,靠 padding-right 让开。
|
|
13
|
+
类名刻意区分(ai-suffix-btn--ta),别和标准模式共用 ——
|
|
14
|
+
两者的定位机制完全不同,共用一套样式会在其中一个上失效。 `),c(u.IconButton,{"custom-class":`ai-suffix-btn ai-suffix-btn--ta`,tooltip:u.$t(`@76872:AI生成提交信息`),"icon-class":u.aiGenerating?``:`ai-commit`,size:`small`,disabled:u.aiGenerating,onClick:u.handleAiGenerateCommit},{default:I(()=>[u.aiGenerating?(e(),j(g,{key:0,class:`is-loading`},{default:I(()=>[c(u.Loading)]),_:1})):t(`v-if`,!0)]),_:1},8,[`tooltip`,`icon-class`,`disabled`])])])),u.isCommitDisabled?t(`v-if`,!0):(e(),j(u.GitCommandPreview,{key:2,command:u.gitCommandPreview,title:u.$t(`@76872:提交命令预览:`),placeholder:`git commit -m "<提交信息>"`},null,8,[`command`,`title`]))])],64))])])],2),t(` 简短描述模板设置 `),c(u.TemplateManager,{visible:u.descriptionDialogVisible,"onUpdate:visible":i[8]||=e=>u.descriptionDialogVisible=e,type:`description`,title:u.$t(`@76872:简短描述模板设置`),placeholder:u.$t(`@76872:输入新模板内容`),"edit-placeholder":u.$t(`@76872:编辑模板内容`),"empty-description":u.$t(`@76872:暂无保存的模板`),onUseTemplate:u.useTemplate},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),t(` 作用域设置弹窗 `),c(u.TemplateManager,{visible:u.scopeDialogVisible,"onUpdate:visible":i[9]||=e=>u.scopeDialogVisible=e,type:`scope`,title:u.$t(`@76872:作用域模板设置`),placeholder:u.$t(`@76872:输入新作用域模板`),"edit-placeholder":u.$t(`@76872:编辑作用域模板内容`),"empty-description":u.$t(`@76872:暂无保存的作用域`),onUseTemplate:u.useScopeTemplate},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),t(` 默认提交信息设置弹窗 `),c(u.TemplateManager,{visible:u.defaultMessageDialogVisible,"onUpdate:visible":i[10]||=e=>u.defaultMessageDialogVisible=e,type:`message`,title:u.$t(`@76872:默认提交信息设置`),placeholder:u.$t(`@76872:输入新模板内容`),"edit-placeholder":u.$t(`@76872:编辑模板内容`),"empty-description":u.$t(`@76872:暂无保存的模板`),"show-default-section":!0,"show-help-text":!0,onUseTemplate:u.useMessageTemplate,onSetDefault:u.setDefaultFromTemplate},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),t(` 状态更新指示器 `),c(F,{name:`el-fade-in-linear`},{default:I(()=>[u.isUpdatingStatus?(e(),A(`div`,nt,[c(g,{class:`is-loading`},{default:I(()=>[c(u.Loading)]),_:1}),f(`span`,null,M(u.$t(`@76872:更新状态中...`)),1)])):t(`v-if`,!0)]),_:1}),t(` 全局Loading组件 `),c(u.GlobalLoading,{visible:u.loadingState.visible,text:u.loadingState.text,"show-progress":u.loadingState.showProgress,progress:u.loadingState.progress},null,8,[`visible`,`text`,`show-progress`,`progress`]),t(` 成功提示组件 `),c(u.SuccessModal,{visible:u.successState.visible,text:u.successState.text,description:u.successState.description},null,8,[`visible`,`text`,`description`]),t(` 状态更新指示器 `),c(F,{name:`el-fade-in-linear`},{default:I(()=>[u.isUpdatingStatus?(e(),A(`div`,rt,[c(g,{class:`is-loading`},{default:I(()=>[c(u.Loading)]),_:1}),f(`span`,null,M(u.$t(`@76872:更新状态中...`)),1)])):t(`v-if`,!0)]),_:1})],64)}var at=z(ze,[[`render`,it],[`__scopeId`,`data-v-1ba78eef`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/views/components/CommitForm.vue`]]);export{at as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,An as t,Dn as n,E as r,Fn as i,Hn as a,In as o,Kn as s,Lr as c,Nn as l,On as u,Qr as d,Rn as f,Xr as p,kn as m,ni as h,nr as g,or as _,ur as v,z as y}from"./element-plus-DgSY_Wt4.js";import{n as b,t as x}from"./_plugin-vue_export-helper-bQQyMRS6.js";a();var S=f({__name:`CommonDialog`,props:{modelValue:{type:Boolean,required:!0},title:{type:String,required:!0},size:{type:String,required:!1,default:`medium`},type:{type:String,required:!1,default:`default`},width:{type:String,required:!1},height:{type:String,required:!1},top:{type:String,required:!1,default:`50px`},closeOnClickModal:{type:Boolean,required:!1,default:!1},closeOnPressEscape:{type:Boolean,required:!1,default:!0},destroyOnClose:{type:Boolean,required:!1,default:!1},draggable:{type:Boolean,required:!1,default:!1},customClass:{type:String,required:!1},modalClass:{type:String,required:!1},appendToBody:{type:Boolean,required:!1,default:!0},lockScroll:{type:Boolean,required:!1,default:!0},zIndex:{type:Number,required:!1},showClose:{type:Boolean,required:!1,default:!0},heightMode:{type:String,required:!1,default:`max`},heightOffset:{type:String,required:!1,default:`100px`},showFooter:{type:Boolean,required:!1,default:!1},confirmText:{type:String,required:!1,default:b(`@803A9:确定`)},cancelText:{type:String,required:!1,default:b(`@803A9:取消`)},showCancel:{type:Boolean,required:!1,default:!0},confirmLoading:{type:Boolean,required:!1,default:!1}},emits:[`update:modelValue`,`confirm`,`cancel`,`close`,`opened`,`closed`],setup(e,{expose:t,emit:i}){t();let a=e,o=i,c=n(()=>{if(a.width)return a.width;switch(a.size){case`small`:return`30%`;case`medium`:return`50%`;case`large`:return`80%`;case`extra-large`:return`90%`;case`fullscreen`:return`100vw`;default:return`50%`}}),l=_(),u=null;function d(){o(`opened`),s(()=>{let e=document.querySelector(`.el-dialog__wrapper:not([style*="display: none"]) .el-dialog`);e&&(e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)||e).focus?.()})}function f(){o(`closed`),u&&typeof u.focus==`function`&&(s(()=>u?.focus()),u=null)}function p(e){e&&!a.modelValue&&(u=document.activeElement),o(`update:modelValue`,e)}let m=n(()=>a.size===`fullscreen`?`0`:a.top),h=n(()=>{let e=[];return a.customClass&&e.push(a.customClass),a.type===`flex`&&e.push(`common-dialog--flex`),a.type===`full-height`&&e.push(`common-dialog--full-height`),a.size===`fullscreen`&&e.push(`common-dialog--fullscreen`),e.join(` `)}),g=n(()=>{if(a.size===`fullscreen`)return{height:`100vh`,maxHeight:`100vh`};let e=`calc(100% - ${a.heightOffset})`;return a.heightMode===`fixed`?{height:e}:{maxHeight:e}});function v(){o(`update:modelValue`,!1),o(`close`)}function y(){o(`confirm`)}function b(){o(`cancel`),v()}let x={props:a,emit:o,dialogWidth:c,titleId:l,get previouslyFocused(){return u},set previouslyFocused(e){u=e},handleOpened:d,handleClosed:f,handleUpdateModelValue:p,dialogTop:m,dialogClass:h,dialogStyle:g,handleClose:v,handleConfirm:y,handleCancel:b,get ElDialog(){return r}};return Object.defineProperty(x,"__isScriptSetup",{enumerable:!1,value:!0}),x}});a(),c();var C=[`id`],w={class:`common-dialog__footer`};function T(n,r,a,s,c,f){let _=y;return e(),m(s.ElDialog,{"model-value":a.modelValue,title:a.title,width:s.dialogWidth,top:s.dialogTop,style:d(s.dialogStyle),"z-index":a.zIndex,fullscreen:a.size===`fullscreen`,"close-on-click-modal":a.closeOnClickModal,"close-on-press-escape":a.closeOnPressEscape,"destroy-on-close":a.destroyOnClose,draggable:a.draggable,class:p(s.dialogClass),"show-close":a.showClose,"modal-class":a.modalClass,"data-dialog-shell":`common`,"append-to-body":a.appendToBody,"lock-scroll":a.lockScroll,"aria-modal":!0,"aria-labelledby":s.titleId,role:`dialog`,onClose:s.handleClose,"onUpdate:modelValue":s.handleUpdateModelValue,onOpened:s.handleOpened,onClosed:s.handleClosed},l({header:v(({titleClass:e})=>[u(`span`,{id:s.titleId,class:p([`el-dialog__title`,e]),role:`heading`,"aria-level":`2`},h(a.title),11,C)]),default:v(()=>[g(n.$slots,`default`,{},void 0,!0)]),_:2},[a.showFooter||n.$slots.footer?{name:`footer`,fn:v(()=>[g(n.$slots,`footer`,{},()=>[u(`div`,w,[a.showCancel?(e(),m(_,{key:0,type:`button`,onClick:s.handleCancel},{default:v(()=>[i(h(a.cancelText),1)]),_:1})):t(`v-if`,!0),o(_,{type:`primary`,loading:a.confirmLoading,onClick:s.handleConfirm},{default:v(()=>[i(h(a.confirmText),1)]),_:1},8,[`loading`])])],!0)]),key:`0`}:void 0]),1032,[`model-value`,`title`,`width`,`top`,`style`,`z-index`,`fullscreen`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`draggable`,`class`,`show-close`,`modal-class`,`append-to-body`,`lock-scroll`,`aria-labelledby`])}var E=x(S,[[`render`,T],[`__scopeId`,`data-v-c5fee217`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/CommonDialog.vue`]]);export{E as t};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,An as t,C as n,Cn as r,Dn as i,Fn as a,Hn as o,In as s,J as c,Kn as l,Lr as u,On as d,Rn as f,S as p,Sr as m,Xr as h,Y as g,Yn as _,Zn as ee,a as v,hr as y,jn as b,kn as x,ni as S,tr as te,tt as ne,ur as C,w}from"./element-plus-DgSY_Wt4.js";import{n as T,t as E}from"./_plugin-vue_export-helper-bQQyMRS6.js";import{t as D}from"./SvgIcon-DR_79iBR.js";import{c as O,l as k,s as re,t as ie}from"./configStore-BeHB-gV4.js";import{W as ae,h as oe,k as se}from"./index-BRQstBzy.js";import{f as ce,h as A,m as j,n as M,p as N}from"./agentConversations-wYAksLq1.js";o(),y();function P(e,t=680){let n=m(0),r=null;function a(){let t=e.value;return t?(n.value=t.clientWidth,typeof ResizeObserver>`u`||(r=new ResizeObserver(e=>{let t=e[0]?.contentRect?.width;typeof t==`number`&&(n.value=t)}),r.observe(t),!0)):!1}return ee(()=>{a()||l(()=>a())}),_(()=>{r?.disconnect(),r=null}),{width:n,narrow:i(()=>n.value>0&&n.value<t)}}y();var F=`agent.convListCollapsed.v1`;function I(){try{return localStorage.getItem(F)===`1`}catch{return!1}}var L=m(I());function R(){function e(e){L.value=e;try{localStorage.setItem(F,e?`1`:`0`)}catch{}}return{convListCollapsed:L,setConvListCollapsed:e}}o();function z(){let e=ie(),t=ae(),n=i({get:()=>e.resolvedTaskExecutor,set:t=>{O(t)&&e.setLastTaskExecutor(t)}}),r=i(()=>({claude:t.claudeAvailable,opencode:t.opencodeAvailable,codex:t.codexAvailable,codebuddy:t.codebuddyAvailable,pi:t.piAvailable})),a=i(()=>re.some(e=>r.value[e.id])),o=i(()=>r.value[n.value]?n.value:Object.keys(r.value).find(e=>r.value[e])??n.value);function s(e){r.value[e]&&(n.value=e)}function c(e){return t.executorModelText(e)}function l(e){return[c(e),t.executorModelDetail(e)].filter(Boolean).join(` · `)}return{selected:n,active:o,availability:r,hasAnyExecutor:a,choose:s,executorModelText:c,executorModelTitle:l}}o(),y();var B=f({__name:`AgentEngineSelector`,props:{engine:{type:String,required:!0},locked:{type:Boolean,required:!1}},emits:[`select`],setup(e,{expose:t,emit:r}){t();let a=e,o=r,{availability:s}=z(),l=i(()=>j(a.engine)),u=i(()=>({gai:!0,...s.value})),d=m(!1),f=m(null);function h(e){if(!a.locked){if(!u.value[e]){if(!A(e))return;f.value=e,d.value=!0;return}o(`select`,e)}}let _={props:a,emit:o,executorAvailability:s,engineName:l,engineAvailability:u,installDialogVisible:d,installTool:f,onCommand:h,get $t(){return T},get ElIcon(){return c},get ElDropdown(){return p},get ElDropdownMenu(){return w},get ElDropdownItem(){return n},get ArrowDown(){return g},get Check(){return ne},get AGENT_ENGINE_OPTIONS(){return ce},get BUILTIN_ENGINE_ICON(){return N},get isExternalAgentEngine(){return A},SvgIcon:D,TaskExecutorIcon:oe,ToolInstallDialog:se};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}});o(),u();var V={class:`agent-engine`},H=[`disabled`,`title`,`aria-label`],U={class:`agent-engine__name`},W={class:`agent-engine__item`},G={class:`agent-engine__item-name`},le={key:3,class:`agent-engine__item-missing`};function ue(n,i,a,o,c,l){return e(),b(r,null,[t(` 单根包一层:父级传下来的 class(Tab 行的 margin-left:auto、面板的 flex:none)
|
|
2
|
+
才能可靠落到这里 —— 多根组件会丢掉 fallthrough class。 `),d(`div`,V,[s(o.ElDropdown,{trigger:`click`,onCommand:o.onCommand},{dropdown:C(()=>[s(o.ElDropdownMenu,null,{default:C(()=>[(e(!0),b(r,null,te(o.AGENT_ENGINE_OPTIONS,n=>(e(),x(o.ElDropdownItem,{key:n.id,command:n.id},{default:C(()=>[d(`span`,W,[o.isExternalAgentEngine(n.id)?(e(),x(o.TaskExecutorIcon,{key:0,executor:n.id,class:`agent-engine__item-icon`},null,8,[`executor`])):(e(),x(o.SvgIcon,{key:1,"icon-class":o.BUILTIN_ENGINE_ICON,class:`agent-engine__item-icon`},null,8,[`icon-class`])),d(`span`,G,S(n.name),1),a.engine===n.id?(e(),x(o.ElIcon,{key:2,class:`agent-engine__item-check`},{default:C(()=>[s(o.Check)]),_:1})):o.engineAvailability[n.id]?t(`v-if`,!0):(e(),b(`span`,le,S(o.$t(`@42BB9:未安装`)),1))])]),_:2},1032,[`command`]))),128))]),_:1})]),default:C(()=>[d(`button`,{type:`button`,class:h([`agent-engine__btn`,{"is-locked":a.locked}]),disabled:a.locked,title:a.locked?o.$t(`@AGENT:本会话的引擎已锁定;要换引擎请新建会话`):o.$t(`@AGENT:新建会话使用的引擎`),"aria-label":o.$t(`@AGENT:智能体引擎`)},[o.isExternalAgentEngine(a.engine)?(e(),x(o.TaskExecutorIcon,{key:0,executor:a.engine,class:`agent-engine__icon`},null,8,[`executor`])):(e(),x(o.SvgIcon,{key:1,"icon-class":o.BUILTIN_ENGINE_ICON,class:`agent-engine__icon`},null,8,[`icon-class`])),d(`span`,U,S(o.engineName),1),s(o.ElIcon,{class:`agent-engine__caret`},{default:C(()=>[s(o.ArrowDown)]),_:1})],10,H)]),_:1}),s(o.ToolInstallDialog,{modelValue:o.installDialogVisible,"onUpdate:modelValue":i[0]||=e=>o.installDialogVisible=e,tool:o.installTool},null,8,[`modelValue`,`tool`])])],2112)}var de=E(B,[[`render`,ue],[`__scopeId`,`data-v-c67a4d14`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/AgentEngineSelector.vue`]]),fe=8192;function pe(e,t){return e.length>t?`…(前文已截断)\n${e.slice(-t)}`:e}function me(e,t){let n=e||`done`;return n!==`pending`&&n!==`running`||t===`running`||t===`pending`?n:t===`cancelled`||t===`error`?`error`:`done`}function K(e){let t=e?.toolCalls;if(!Array.isArray(t)||t.length===0)return[];let n=e?.status||`done`,r=[];for(let e=0;e<t.length;e++){let i=t[e];if(!i||typeof i!=`object`)continue;let a=me(i.status,n),o=typeof i.result==`string`?i.result:``;r.push({id:typeof i.id==`string`&&i.id?i.id:`tool-${e}`,name:typeof i.name==`string`?i.name:``,argsPreview:typeof i.argsPreview==`string`?i.argsPreview:``,arguments:typeof i.arguments==`string`?i.arguments:``,result:o?pe(o,fe):``,status:a,error:typeof i.error==`string`&&i.error?i.error:void 0})}return r}var q=`
|
|
3
|
+
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`,he=`[运行环境 ·`,ge=`## 跨会话记忆库`,_e=/\n\n---\n本任务包含 \d+ 个附件(请按文件路径读取[\s\S]*$/,ve=/\n\n续接 #\d+\s*$/;function J(e){let t=e.indexOf(q);return t===-1?0:t+7}function Y(e){let t=typeof e==`string`?e:``;return t?(t.startsWith(he)&&(t=t.slice(J(t))),t.startsWith(ge)&&(t=t.slice(J(t))),t=t.replace(_e,``).replace(ve,``),t.trim()):``}function X(e){switch(e){case`todo`:return T(`@WORKBENCH:待执行`);case`running`:return T(`@WORKBENCH:执行中`);case`done`:return T(`@WORKBENCH:已完成`);case`error`:return T(`@WORKBENCH:出错`);case`cancelled`:return T(`@WORKBENCH:已取消`);case`pending`:return T(`@WORKBENCH:排队中`);default:return e}}function ye(e){switch(e){case`running`:return`var(--color-primary)`;case`done`:return`#22c55e`;case`error`:return`#ef4444`;case`cancelled`:return`#9ca3af`;case`pending`:return`#f59e0b`;default:return`var(--text-tertiary)`}}function Z(e){let t=e?new Date(e):new Date;if(Number.isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}function be(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function xe(e){let t=(e.match(/`+/g)||[]).reduce((e,t)=>Math.max(e,t.length),0),n="`".repeat(Math.max(3,t+1));return`${n}\n${e}\n${n}`}function Q(e,t){return`### ${e}\n\n${t.trim()}`}function Se(e){let t=[];return e.forEach((e,n)=>{let r=e.name||T(`@WORKBENCH:工具`),i=be(e.argsPreview||``);t.push(`${n+1}. **${r}**${i?` — \`${i}\``:``}`);let a=(e.status===`error`?e.error:e.result)||e.result||e.error||``;a.trim()&&t.push(``,xe(a.trim()))}),t.join(`
|
|
7
|
+
`)}function Ce(e,t={},n={}){let r=Array.isArray(e)?e.filter(Boolean):[],i=n.scope===`brief`,a=[];if(r.forEach((e,t)=>{let n=[],r=Y(e.prompt);if(r&&n.push(Q(T(`@WORKBENCH:用户提示词`),r)),!i){let t=(e.thinking||``).trim();t&&n.push(Q(T(`@WORKBENCH:Claude 思考`),t));let r=Se(K(e));r&&n.push(Q(T(`@WORKBENCH:工具调用`),r))}let o=(e.output||``).trim();o&&n.push(Q(T(`@WORKBENCH:模型返回`),o));let s=(e.error||e.agentError||``).trim();if(s&&n.push(Q(T(`@WORKBENCH:出错`),s)),n.length===0)return;let c=[k(e.agent),X(e.status),Z(e.startedAt)].filter(Boolean);a.push(`## ${T(`@WORKBENCH:第 {n} 轮`,{n:t+1})}\n\n*${c.join(` · `)}*\n\n${n.join(`
|
|
8
|
+
|
|
9
|
+
`)}`)}),a.length===0)return``;let o=[`# ${(t.title||``).trim()||T(`@WORKBENCH:未命名任务`)}`],s=(t.projectName||``).trim();return s&&o.push(``,`- ${T(`@WORKBENCH:项目:{name}`,{name:s})}`),o.push(`- ${T(`@WORKBENCH:导出时间:{time}`,{time:Z((t.now||new Date).toISOString())})}`),`${o.join(`
|
|
10
|
+
`)}\n\n---\n\n${a.join(`
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
`)}\n`}function we(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n.length>t?`${n.slice(0,t-1)}…`:n}function Te(e){let t=(e.match(/`+/g)||[]).reduce((e,t)=>Math.max(e,t.length),0),n="`".repeat(Math.max(3,t+1));return`${n}\n${e}\n${n}`}function $(e,t){return`### ${e}\n\n${t.trim()}`}function Ee(e,t){return e===`user`?T(`@AGENT:我`):t}function De(e){if(!Array.isArray(e)||!e.length)return``;let t=[];return e.forEach((e,n)=>{let r=e.name||T(`@AGENT:工具`),i=we(e.argsPreview||``);t.push(`${n+1}. **${r}**${i?` — \`${i}\``:``}`);let a=(e.status===`error`?e.error:e.result)||e.result||e.error||``;a.trim()&&t.push(``,Te(a.trim()))}),t.join(`
|
|
15
|
+
`)}function Oe(e,t,n){if(e.role===`system`)return``;let r=[];if(t){let t=(e.reasoning||``).trim();t&&r.push($(T(`@AGENT:思考`),t));let n=De(e.toolCalls);n&&r.push($(T(`@AGENT:工具调用`),n))}let i=(e.content||``).trim();i&&r.push(i);let a=(e.attachments||[]).map(e=>e.name).filter(Boolean);a.length&&r.push(`${T(`@AGENT:附件`)}:${a.join(`、`)}`);let o=(e.error||``).trim();if(o&&r.push(`> ⚠️ ${o}`),r.length===0){if(e.role!==`assistant`)return``;r.push(`*${T(`@AGENT:本轮未输出正文`)}*`)}return`## ${Ee(e.role,n)}\n\n${r.join(`
|
|
16
|
+
|
|
17
|
+
`)}`}function ke(e,t={},n={}){let r=Array.isArray(e)?e.filter(Boolean):[],i=n.scope===`full`,a=(t.assistantName||``).trim()||`g ai`,o=[];for(let e of r){let t=Oe(e,i,a);t&&o.push(t)}if(o.length===0)return``;let s=[`${T(`@AGENT:导出时间`)}:${Z((t.now||new Date).toISOString())}`],c=(t.engine||``).trim();return c&&s.push(`${T(`@AGENT:引擎`)}:${c}`),s.push(T(`@AGENT:共 {n} 条消息`,{n:o.length})),`${`# ${(t.title||``).trim()||T(`@AGENT:无标题`)}\n\n- ${s.join(` · `)}`}\n\n---\n\n${o.join(`
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
`)}\n`}o(),y();var Ae=f({__name:`CopySessionButton`,props:{messages:{type:Array,required:!0},title:{type:String,required:!1},engine:{type:String,required:!1}},setup(e,{expose:t}){t();let n=e,r=m(!1),i=null;_(()=>{i&&clearTimeout(i)});async function a(e){try{if(navigator?.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function o(e){let t=ke(n.messages||[],{title:n.title,engine:n.engine,assistantName:M},{scope:e});if(!t){v.warning(T(`@AGENT:暂无会话内容可复制`));return}if(!await a(t)){v.error(T(`@AGENT:复制失败`));return}r.value=!0,v.success(T(`@AGENT:已复制会话`)),i&&clearTimeout(i),i=setTimeout(()=>{r.value=!1,i=null},1500)}function s(e){o(e===`full`?`full`:`brief`)}let c={props:n,flash:r,get timer(){return i},set timer(e){i=e},copyToClipboard:a,doCopy:o,onCommand:s,get $t(){return T}};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}});o(),u();var je={class:`csb`},Me=[`title`,`aria-label`],Ne={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Pe={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Fe=[`title`,`aria-label`];function Ie(t,r,i,o,c,l){let u=n,f=w,m=p;return e(),b(`div`,je,[d(`button`,{type:`button`,class:h([`csb__btn`,{"is-flash":o.flash}]),title:o.$t(`@AGENT:复制本会话的对话内容(默认精简:仅对话正文)`),"aria-label":o.$t(`@AGENT:复制会话`),onClick:r[0]||=e=>o.doCopy(`brief`)},[o.flash?(e(),b(`svg`,Ne,[...r[1]||=[d(`polyline`,{points:`20 6 9 17 4 12`},null,-1)]])):(e(),b(`svg`,Pe,[...r[2]||=[d(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`},null,-1),d(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`},null,-1)]]))],10,Me),s(m,{trigger:`click`,placement:`bottom-end`,onCommand:o.onCommand},{dropdown:C(()=>[s(f,null,{default:C(()=>[s(u,{command:`brief`},{default:C(()=>[a(S(o.$t(`@AGENT:精简:对话正文`)),1)]),_:1}),s(u,{command:`full`},{default:C(()=>[a(S(o.$t(`@AGENT:全量:对话正文 + 思考 + 工具调用`)),1)]),_:1})]),_:1})]),default:C(()=>[d(`button`,{type:`button`,class:`csb__btn csb__caret`,title:o.$t(`@AGENT:选择复制范围`),"aria-label":o.$t(`@AGENT:选择复制范围`)},[...r[3]||=[d(`svg`,{viewBox:`0 0 24 24`,width:`11`,height:`11`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[d(`polyline`,{points:`6 9 12 15 18 9`})],-1)]],8,Fe)]),_:1})])}var Le=E(Ae,[[`render`,Ie],[`__scopeId`,`data-v-76f63575`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/CopySessionButton.vue`]]);export{Y as a,z as c,X as i,R as l,Ce as n,K as o,ye as r,de as s,Le as t,P as u};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,An as t,Cn as n,Cr as r,Dn as i,Fn as a,Hn as o,In as s,Kn as c,Lr as ee,On as l,Pn as u,Qr as d,Rn as te,Sn as f,Sr as p,Tn as ne,W as re,Xr as m,Yn as ie,Zn as ae,a as h,bn as g,cr as _,dr as v,fn as y,hn as b,hr as x,i as oe,jn as S,kn as C,ni as w,tr as se,ur as T,xn as ce,yn as E}from"./element-plus-DgSY_Wt4.js";import{c as le,l as ue,t as de}from"./vendor-CZlKgriV.js";import{n as D,t as fe}from"./_plugin-vue_export-helper-bQQyMRS6.js";import{t as pe}from"./SvgIcon-DR_79iBR.js";import{t as me}from"./configStore-BeHB-gV4.js";import{a as he,c as ge,i as _e,n as ve,o as ye,r as be,s as xe}from"./monaco-CnWeufxc.js";import{n as Se,r as O}from"./flow-mindmap-BsTRkgat.js";import{B as Ce,F as we,I as Te,L as Ee,N as De,P as Oe,R as ke,V as Ae,a as je,f as Me,z as Ne}from"./index-BRQstBzy.js";import{a as k,c as A,i as Pe,l as Fe,m as Ie,n as Le,o as Re,r as j,s as ze,t as Be,u as Ve}from"./agentConversations-wYAksLq1.js";import{l as He,s as M,t as N,u as Ue}from"./CopySessionButton-CAxaqLQL.js";function P(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}o();var F=te({__name:`MindmapPreview`,props:{content:{type:String,required:!0}},setup(e,{expose:t}){t();let n=e,r={props:n,data:i(()=>O(n.content||``,`未命名文档`)),get MindMap(){return Se}};return Object.defineProperty(r,"__isScriptSetup",{enumerable:!1,value:!0}),r}});o();var I={class:`mindmap-preview`},L={class:`mindmap-preview-canvas`};function R(t,n,r,i,a,o){return e(),S(`div`,I,[n[0]||=l(`div`,{class:`mindmap-preview-header`},[l(`span`,{class:`mindmap-preview-title`},`整篇导图`),l(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),l(`div`,L,[s(i.MindMap,{data:i.data,"preview-mode":``},null,8,[`data`])])])}var We=fe(F,[[`render`,R],[`__scopeId`,`data-v-3969a8bf`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/MindmapPreview.vue`]]);o(),x();var z=te({__name:`EditorAgentPanel`,props:{activeFilePath:{type:[String,null],required:!1},activeFileName:{type:String,required:!1},active:{type:Boolean,required:!1}},emits:[`close`],setup(e,{expose:t,emit:n}){t();let r=e,a=n,{theme:o}=ke(),s=i(()=>o.value===`dark`?`dark`:`light`),{sessions:ee,sessionsLoading:l,currentSessionId:u,messages:d,displayMessages:te,isStreaming:f,questionPanel:ne,answeringQuestion:re,isSessionGenerating:m,currentEngine:h,pendingEngine:g,isEngineLocked:v,pickEngine:y,loadSessions:b,loadSession:x,deleteSession:oe,renameSession:S,newSession:C,sendMessage:w,retryTurn:se,answerQuestion:T,stop:ce,inputContextUsage:E,queuedMessages:fe,queuePaused:pe,removeQueuedMessage:me,flushQueued:he}=Ve(),ge=i(()=>v.value?h.value:g.value);function _e(e){v.value||y(e)}let ve=i(()=>A(ee.value,m)),ye=k(),be=Re(),xe=ze(),Se=i(()=>ve.value.find(e=>e.id===u.value)?.title||``),O=p(null),Ce=p(null),we=p(null),Te=p(null),Ee=p(null),{width:De,narrow:Oe}=Ue(Ee),Ae=p(`chat`),{convListCollapsed:je,setConvListCollapsed:Me}=He(),Ne=i(()=>!Oe.value&&je.value),P=p(null),F=p(!1),I=null,L=i(()=>!!r.activeFileName&&!F.value);function R(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function We(){let e=Ce.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!L.value){if(!t)return;P.value=null,c(()=>t.remove());return}let n=P.value&&e.contains(P.value)?P.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=R(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),P.value=n}function z(e=!0){O.value?.scrollToBottom(e)}async function Ge(e){let t=F.value?void 0:r.activeFilePath||void 0;await w(e.text,e.files,{openFilePath:t}),await c(),z()}function Ke(e){x(e),Ae.value=`chat`}function qe(){C(),Ae.value=`chat`}_(()=>d.value.length,()=>{c(()=>z(!1))});function B(){let e=Te.value;e&&typeof MutationObserver<`u`&&(I?.disconnect(),I=new MutationObserver(()=>We()),I.observe(e,{childList:!0,subtree:!0}))}_(()=>r.active,e=>{e&&(Ae.value=`chat`,b().catch(()=>{}),c(()=>{We(),z(!1)}))}),_(Oe,e=>{e||(Ae.value=`chat`)}),_(()=>r.activeFilePath,()=>{F.value=!1}),_(L,e=>{e&&c(We)}),ae(()=>{b().catch(()=>{}),c(()=>{We(),B()})}),ie(()=>{I?.disconnect(),I=null,P.value=null});let V={props:r,emit:a,theme:o,chatTheme:s,sessions:ee,sessionsLoading:l,currentSessionId:u,messages:d,displayMessages:te,isStreaming:f,questionPanel:ne,answeringQuestion:re,isSessionGenerating:m,currentEngine:h,pendingEngine:g,isEngineLocked:v,pickEngine:y,loadSessions:b,loadSession:x,deleteSession:oe,renameSession:S,newSession:C,sendMessage:w,retryTurn:se,answerQuestion:T,stop:ce,inputContextUsage:E,queuedMessages:fe,queuePaused:pe,removeQueuedMessage:me,flushQueued:he,displayEngine:ge,onEngineSelect:_e,conversationItems:ve,conversationLabels:ye,questionLabels:be,queueLabels:xe,currentSessionTitle:Se,chatRef:O,inputRef:Ce,chatHostRef:we,composerRef:Te,rootRef:Ee,width:De,narrow:Oe,page:Ae,convListCollapsed:je,setConvListCollapsed:Me,convsCollapsed:Ne,contextSlot:P,contextDismissed:F,get slotObserver(){return I},set slotObserver(e){I=e},showContextCard:L,findAttachmentsHost:R,syncContextSlot:We,scrollToBottom:z,onSend:Ge,onSelectSession:Ke,onNewSession:qe,watchChatDom:B,get $t(){return D},get ChatContainer(){return le},get ChatInput(){return ue},get ConversationList(){return de},get AGENT_UPLOAD_ACCEPT(){return Fe},get agentEngineName(){return Ie},get AGENT_ASSISTANT_NAME(){return Le},get AGENT_ASSISTANT_AVATAR(){return Be},get MESSAGE_RAIL_CONFIG(){return Pe},get MESSAGE_META_CONFIG(){return j},AgentEngineSelector:M,CopySessionButton:N};return Object.defineProperty(V,"__isScriptSetup",{enumerable:!1,value:!0}),V}});o(),ee(),y();var Ge={ref:`rootRef`,class:`editor-agent-panel`},Ke={class:`agent-panel-header`},qe=[`title`,`aria-label`],B={class:`agent-panel-title`},V={key:1,class:`agent-panel-title`},Je=[`title`,`aria-label`],Ye=[`title`],Xe={class:`agent-panel-convs`},H={ref:`chatHostRef`,class:`agent-panel-chat`},Ze=[`data-theme`],Qe=[`title`],$e={class:`agent-context-att-name`},U=[`title`,`aria-label`];function W(r,i,a,o,c,ee){return e(),S(n,null,[t(`
|
|
2
|
+
文件空间右侧的 g ai 对话面板。
|
|
3
|
+
- 够宽(≥680px,判据同「智能体」视图):左边一列会话历史 + 右边对话,历史**直接摆在那儿**,
|
|
4
|
+
不用先点按钮翻过去;不够宽就折成两页,头部按钮来回翻
|
|
5
|
+
- 输入框常驻底部:ChatContainer 传 show-input=false,输入框拆出来自己摆在面板最下方。
|
|
6
|
+
于是两种形态、两个页面都有输入框 —— 列表页也能直接开聊,翻页时草稿与附件都不丢
|
|
7
|
+
- 复用的都是组件库的独立导出:ConversationList(列表)+ ChatContainer(气泡区)+ ChatInput(输入框)
|
|
8
|
+
- "当前打开的文档"通过请求级注入告知模型(sendMessage 的 openFilePath 选项);
|
|
9
|
+
它修饰的是**这一条消息的上下文**,所以做成附件卡片、搬进输入框内部(见 contextSlot)
|
|
10
|
+
- 自己持有一个 useAgentChat 实例:runs/refs 与「对话」Tab 隔离,互不打断
|
|
11
|
+
`),l(`div`,Ge,[l(`div`,Ke,[t(` 窄屏的列表页:整条 header 让给「返回对话 + 标题」 `),o.narrow&&o.page===`list`?(e(),S(n,{key:0},[l(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:o.$t(`@EDITOR:返回对话`),"aria-label":o.$t(`@EDITOR:返回对话`),onClick:i[0]||=e=>o.page=`chat`},[...i[4]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),l(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,qe),l(`span`,B,w(o.$t(`@EDITOR:会话列表`)),1)],64)):(e(),S(`span`,V,w(o.$t(`@EDITOR:g ai 对话`)),1)),i[7]||=l(`div`,{class:`agent-panel-spacer`},null,-1),t(` 引擎切换:与「智能体」视图同一套(同一个 AgentEngineSelector)。
|
|
12
|
+
宽屏左边摆着历史,对话区一直在,所以常驻;窄屏只在对话页出现 ——
|
|
13
|
+
列表页没有正在跑的对话,摆这儿只会挤占标题。 `),!o.narrow||o.page===`chat`?(e(),C(o.AgentEngineSelector,{key:2,class:`agent-panel-engine`,engine:o.displayEngine,locked:o.isEngineLocked,onSelect:o.onEngineSelect},null,8,[`engine`,`locked`])):t(`v-if`,!0),t(` 复制整条会话:只有对话页才有"当前这条会话"可复制(列表页连引擎选择器都不摆) `),!o.narrow||o.page===`chat`?(e(),C(o.CopySessionButton,{key:3,class:`agent-panel-copy`,messages:o.messages,title:o.currentSessionTitle,engine:o.agentEngineName(o.displayEngine)},null,8,[`messages`,`title`,`engine`])):t(`v-if`,!0),t(` 会话列表按钮:只有"列表是独立一页"时才需要它(宽屏列表就在旁边) `),o.narrow&&o.page===`chat`?(e(),S(`button`,{key:4,class:`agent-panel-icon-btn agent-panel-list-btn`,title:o.$t(`@EDITOR:会话列表`),"aria-label":o.$t(`@EDITOR:会话列表`),onClick:i[1]||=e=>o.page=`list`},[...i[5]||=[u(`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-7cc12c51><line x1="8" y1="6" x2="21" y2="6" data-v-7cc12c51></line><line x1="8" y1="12" x2="21" y2="12" data-v-7cc12c51></line><line x1="8" y1="18" x2="21" y2="18" data-v-7cc12c51></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-7cc12c51></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-7cc12c51></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-7cc12c51></line></svg>`,1)]],8,Je)):t(`v-if`,!0),l(`button`,{class:`agent-panel-icon-btn`,title:o.$t(`@EDITOR:关闭对话`),onClick:i[2]||=e=>o.emit(`close`)},[...i[6]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ye)]),l(`div`,{class:m([`agent-panel-body`,{"is-wide":!o.narrow,"is-convs-collapsed":o.convsCollapsed}])},[t(` 会话历史:宽屏是常驻左列(可收起),窄屏是独享整页 `),v(l(`div`,Xe,[s(o.ConversationList,{"show-search":!0,items:o.conversationItems,"active-id":o.currentSessionId,loading:o.sessionsLoading,labels:o.conversationLabels,collapsible:!o.narrow,collapsed:o.convsCollapsed,"onUpdate:collapsed":o.setConvListCollapsed,onSelect:o.onSelectSession,onNew:o.onNewSession,onRename:o.renameSession,onDelete:o.deleteSession},null,8,[`items`,`active-id`,`loading`,`labels`,`collapsible`,`collapsed`,`onUpdate:collapsed`,`onRename`,`onDelete`])],512),[[g,!o.narrow||o.page===`list`]]),t(` 气泡区:输入框已经不在这里了(show-input=false),见下面常驻的那一条 `),v(l(`div`,H,[s(o.ChatContainer,{ref:`chatRef`,"show-input":!1,messages:o.displayMessages,"assistant-name":o.AGENT_ASSISTANT_NAME,"assistant-avatar":o.AGENT_ASSISTANT_AVATAR,theme:o.chatTheme,question:o.questionPanel,"question-submitting":o.answeringQuestion,"question-labels":o.questionLabels,"plan-config":{labels:{title:o.$t(`@AGENT:计划`),raw:o.$t(`@AGENT:原始参数`)}},"message-rail-config":o.MESSAGE_RAIL_CONFIG,"message-meta-config":o.MESSAGE_META_CONFIG,onAnswer:o.answerQuestion,onRetry:o.retryTurn},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`message-rail-config`,`message-meta-config`,`onAnswer`,`onRetry`])],512),[[g,!o.narrow||o.page===`chat`]]),t(`
|
|
14
|
+
输入框常驻:两种形态、两个页面都在最下方(与演示页同一套做法)。
|
|
15
|
+
它被拆到 ChatContainer 外面,所以 acu-root 与 data-theme 得自己套上:
|
|
16
|
+
库把盒模型重置限定在 .acu-root 子树里,而 ChatInput 根节点是 div(不是 button),
|
|
17
|
+
少了它就会退回 content-box、横着溢出面板。
|
|
18
|
+
|
|
19
|
+
v-if="width > 0":**等量到本面板的宽度再挂载输入框**。库的 ChatInput 只在
|
|
20
|
+
onMounted 里量一次 scrollHeight,量到的宽度不对就再也纠不回来 —— 实测首帧挂载时
|
|
21
|
+
容器还没宽度,占位文案被折成十几行,textarea 直接顶到 200px 上限并一直卡在那里。
|
|
22
|
+
宽度是 useNarrowPane 在 onMounted 里同步量到的,所以这里晚的只是一次重渲染。
|
|
23
|
+
`),o.width>0?(e(),S(`div`,{key:0,ref:`composerRef`,class:`agent-panel-composer acu-root`,"data-theme":o.chatTheme},[s(o.ChatInput,{ref:`inputRef`,generating:o.isStreaming,"allow-queue":!0,queued:o.queuedMessages,"queue-paused":o.queuePaused,"queue-labels":o.queueLabels,placeholder:o.isStreaming?o.$t(`@AGENT:生成中,发送后会排队,等本轮跑完自动接上…`):o.$t(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:o.AGENT_UPLOAD_ACCEPT},"context-usage":o.inputContextUsage,onSend:o.onSend,onStop:o.stop,onUnqueue:o.removeQueuedMessage,onFlushQueued:o.flushQueued},null,8,[`generating`,`queued`,`queue-paused`,`queue-labels`,`placeholder`,`upload-config`,`context-usage`,`onStop`,`onUnqueue`,`onFlushQueued`]),t(`
|
|
24
|
+
当前文档:**和添加的附件同处一行、同一副样子**。
|
|
25
|
+
组件库的 ChatContainer / ChatInput 没有任何插槽(dist 里 \`slots\` 出现 0 次),
|
|
26
|
+
没法声明式地往输入框里放东西,所以:
|
|
27
|
+
· 往 \`.acu-input-wrap\` 插一个锚点,再把卡片 Teleport 进去(节点仍是 Vue 渲染的);
|
|
28
|
+
· **有附件行(.acu-input-attachments)时锚点住进它内部** —— 卡片因此成为那一行的
|
|
29
|
+
flex item,与附件并排、共用同一套 gap/wrap。只插在输入框最前面是不行的:
|
|
30
|
+
Vue 更新输入框时会用自己的锚点 \`insertBefore\`,把外来节点挤到后面去。
|
|
31
|
+
`),o.contextSlot?(e(),C(ne,{key:0,to:o.contextSlot},[o.showContextCard?(e(),S(`div`,{key:0,class:`agent-context-att`,title:a.activeFilePath||``},[i[9]||=l(`svg`,{class:`agent-context-att-icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),l(`polyline`,{points:`14 3 14 8 19 8`})],-1),l(`span`,$e,w(a.activeFileName),1),l(`button`,{type:`button`,class:`agent-context-att-remove`,title:o.$t(`@EDITOR:不引用当前文档`),"aria-label":o.$t(`@EDITOR:不引用当前文档`),onClick:i[3]||=e=>o.contextDismissed=!0},[...i[8]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,U)],8,Qe)):t(`v-if`,!0)],8,[`to`])):t(`v-if`,!0)],8,Ze)):t(`v-if`,!0)],2)],512)],2112)}var et=fe(z,[[`render`,W],[`__scopeId`,`data-v-7cc12c51`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/EditorAgentPanel.vue`]]),G=1080,tt=6e5,nt=.86;function rt(e){if(!e||e.startsWith(`data:`))return!1;if(e.startsWith(`blob:`)||e.startsWith(`/`))return!0;try{return new URL(e,location.href).origin===location.origin}catch{return!1}}async function it(e){try{let t=await fetch(e);if(!t.ok)return null;let n=await t.blob();return await new Promise(e=>{let t=new FileReader;t.onload=()=>e(t.result||``),t.onerror=()=>e(``),t.readAsDataURL(n)})}catch{return null}}function at(e){return new Promise(t=>{let n=!1,r=e=>{n||(n=!0,t(e))};if(typeof Image>`u`){r(e);return}let i=new Image,a=setTimeout(()=>r(e),4e3);i.onload=()=>{if(clearTimeout(a),!(i.naturalWidth>G||e.length>tt)){r(e);return}try{let t=Math.min(1,G/i.naturalWidth),n=Math.max(1,Math.round(i.naturalWidth*t)),a=Math.max(1,Math.round(i.naturalHeight*t)),o=document.createElement(`canvas`);o.width=n,o.height=a;let s=o.getContext(`2d`);if(!s){r(e);return}s.fillStyle=`#ffffff`,s.fillRect(0,0,n,a),s.drawImage(i,0,0,n,a),r(o.toDataURL(`image/jpeg`,nt))}catch{r(e)}},i.onerror=()=>{clearTimeout(a),r(e)},i.src=e})}async function ot(e){let t=await it(e);return t?at(t):null}async function K(e){let t=Array.from(e.querySelectorAll(`img`)).filter(e=>rt(e.getAttribute(`src`)||``)),n=0;return await Promise.all(t.map(async e=>{let t=await ot(e.getAttribute(`src`)||``);t?e.setAttribute(`src`,t):n+=1})),n}function q(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}var st={h1:`font-size:26px;font-weight:700;line-height:1.35;margin:28px 0 16px;color:#111;`,h2:`font-size:22px;font-weight:700;line-height:1.4;margin:26px 0 14px;color:#111;`,h3:`font-size:19px;font-weight:700;line-height:1.45;margin:22px 0 12px;color:#222;`,h4:`font-size:17px;font-weight:600;line-height:1.5;margin:20px 0 10px;color:#333;`,h5:`font-size:16px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#333;`,h6:`font-size:15px;font-weight:600;line-height:1.5;margin:18px 0 8px;color:#555;`,p:`font-size:16px;line-height:1.8;margin:16px 0;color:#333;`,li:`font-size:16px;line-height:1.8;margin:0 0 6px;color:#333;`,ul:`margin:16px 0;padding-left:24px;`,ol:`margin:16px 0;padding-left:24px;`,blockquote:`margin:16px 0;padding:8px 16px;border-left:4px solid #e2e2e2;background:#f7f7f7;color:#666;font-size:15px;line-height:1.8;`,hr:`border:none;border-top:1px solid #e5e5e5;margin:26px 0;`,a:`color:#576b95;text-decoration:none;`,strong:`font-weight:700;color:#111;`,em:`font-style:italic;color:#555;`,code:`font-family:Menlo,Consolas,Monaco,monospace;font-size:0.92em;background:#f2f3f5;color:#c7254e;padding:1px 5px;border-radius:3px;`,pre:`font-family:Menlo,Consolas,Monaco,monospace;font-size:13px;line-height:1.6;background:#f6f8fa;color:#24292f;padding:12px 14px;border-radius:6px;overflow-x:auto;margin:16px 0;`,table:`border-collapse:collapse;width:100%;margin:16px 0;font-size:14px;`,th:`border:1px solid #e0e0e0;padding:8px 10px;background:#f6f8fa;font-weight:600;text-align:left;color:#333;`,td:`border:1px solid #e0e0e0;padding:8px 10px;color:#333;`,img:`max-width:100%;height:auto;display:block;margin:16px auto;border-radius:6px;`};function ct(e){e.querySelectorAll(`*`).forEach(e=>{let t=st[e.tagName.toLowerCase()];t&&e.setAttribute(`style`,t)}),e.querySelectorAll(`pre code`).forEach(e=>e.setAttribute(`style`,`background:none;padding:0;color:inherit;font-size:inherit;`))}async function lt(e,t){let n=e.cloneNode(!0),r=t?await K(n):0;return{html:n.innerHTML,leftover:r}}async function ut(e,t){let n=e.cloneNode(!0),r=t.inline?await K(n):0;ct(n);let i=(t.title||``).trim();return{html:`<section style="font-size:16px;line-height:1.8;color:#333;word-break:break-word;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI','PingFang SC','Hiragino Sans GB','Microsoft YaHei',sans-serif;">${i?`<h1 style="font-size:26px;font-weight:700;line-height:1.35;margin:0 0 22px;color:#111;">${q(i)}</h1>`:``}${n.innerHTML}</section>`,leftover:r}}o(),x();var dt=6e4,ft=3e4,pt=te({__name:`EditorView`,props:{pendingFilePath:{type:[String,null],required:!1}},setup(e,{expose:t}){t(),self.MonacoEnvironment={getWorker(e,t){return t===`json`?new xe:t===`css`||t===`scss`||t===`less`?new ye:t===`html`||t===`handlebars`||t===`razor`?new he:t===`typescript`||t===`javascript`?new _e:new ge}};let n=e,a=me(),o=Me(),s=p([]),ee=p(!1),l=p(``),u=p(``),d=null;function te(){l.value=``,u.value=``,d&&=(clearTimeout(d),null)}_(l,e=>{d&&clearTimeout(d),d=setTimeout(()=>{u.value=e,d=null},180)}),ie(()=>{d&&clearTimeout(d),m(),Xe()});let f=null;function ne(){m(),a.ui.fileTreeAutoRefresh&&(f=setInterval(()=>{document.hidden||a.currentDirectory&&(l.value.trim()||C())},dt))}function m(){f&&=(clearInterval(f),null)}_(()=>a.currentDirectory,async()=>{if(j=!1,ne(),await v(),O.value.some(e=>e.isDirty)){j=!0;return}O.value=[],k.value=null,F(),await Ve()}),_(()=>a.ui.fileTreeAutoRefresh,()=>{ne()});async function g(e,t=0){let n=await(await fetch(`/api/browse_directory?path=${encodeURIComponent(e)}`)).json();return n.success?n.items.map(e=>({...e,depth:t,expanded:!1,loading:!1,children:(e.type,void 0)})):[]}async function v(){let e=a.currentDirectory;if(e){ee.value=!0;try{s.value=await g(e,0)}finally{ee.value=!1}}}function y(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&y(n.children,t));return t}function b(e,t=0){return(e||[]).map(e=>{let n={name:e.name,path:e.path,type:e.type,depth:t,expanded:!1,loading:!1};return n.type===`directory`&&Array.isArray(e.children)&&(n.children=b(e.children,t+1),n.expanded=!0),n})}async function x(e){let t=a.currentDirectory;if(!t)return null;try{let n=await(await fetch(`/api/browse_directory_tree`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t,expand:e})})).json().catch(()=>null);return!n?.success||!Array.isArray(n.items)?null:b(n.items,0)}catch{return null}}function S(e,t){let n=new Map(e.map(e=>[e.path,e])),r=e.length!==t.length;if(!r){for(let n=0;n<t.length;n++)if(e[n].path!==t[n].path){r=!0;break}}for(let e=0;e<t.length;e++){let i=t[e],a=n.get(i.path);a&&(t[e]=a,a.name!==i.name&&(a.name=i.name,r=!0),a.type===`directory`&&a.expanded&&Array.isArray(i.children)&&(Array.isArray(a.children)?S(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function C(e={}){if(!a.currentDirectory)return;let t=await x([...y(s.value)]);if(!t){e.notifyOnError&&h.error(D(`@EDITOR:刷新失败`));return}if(s.value.length===0){s.value=t;return}S(s.value,t)&&(s.value=t)}async function w(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await g(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function se(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...se(n.children));return t}let T=i(()=>u.value.trim().toLowerCase());function ce(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?ce(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let E=i(()=>ce(s.value,T.value)),le=i(()=>T.value.length>0&&E.value.length===0);function ue(e){let t=u.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let de=p(null);function fe(){let e=de.value;e&&(e.focus(),e.select())}function Se(){l.value?(te(),de.value?.focus()):(de.value?.blur(),M.value?.focus())}let O=p([]),k=p(null),A=p(null);async function Pe(e){if(A.value=e,e.type!==`file`){w(e);return}let t=O.value.find(t=>t.path===e.path);if(console.log(`[debug-open-in-editor] EditorView openFile existing tab check:`,{path:e.path,found:!!t,tabsCount:O.value.length}),t){k.value=e.path,c(()=>L());return}let n=e.name.split(`.`).pop()||``;if(Lt.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};O.value.push(t),k.value=e.path,X.value=!0;return}if(Ne(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};O.value.push(t),k.value=e.path,Z.value=!1,X.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){h.error(`${D(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=P(n),a=N.get(e.path);a&&!a.isDisposed()&&a.setValue(r.content);let o={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i,diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),O.value.push(o),k.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,O.value.length,`activeTabPath=`,k.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),h.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}_(()=>n.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await c();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await Pe({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Fe(e,t){t.stopPropagation();let n=O.value.findIndex(t=>t.path===e);n!==-1&&(!O.value[n].isDirty||confirm(D(`@EDITOR:文件未保存,确认关闭?`)))&&(O.value.splice(n,1),k.value===e&&(k.value=O.value[Math.min(n,O.value.length-1)]?.path??null))}let Ie=()=>O.value.find(e=>e.path===k.value)??null,Le=i(()=>({expandedDirs:[...y(s.value)],tabs:O.value.map(e=>e.path),activeTab:k.value})),Re=!1,j=!1;function ze(){j&&!Re&&a.isUiLoaded&&a.saveEditorWorkspace(Le.value)}_(Le,()=>ze());async function Be(e){if(O.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(Lt.has(n)){O.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(Ne(t)){O.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null});return}try{let r=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();if(!r.success)return;let i=N.get(e);i&&!i.isDisposed()&&M.value?.getModel()!==i&&(i.dispose(),N.delete(e)),O.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:P(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function Ve(){try{for(let e=0;e<100&&!a.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!a.isUiLoaded)return;W.value=a.ui.editorSidebarWidth;let e=a.getEditorWorkspace();if(!e)return;Re=!0;try{if(e.expandedDirs.length>0){let t=await x(e.expandedDirs);t&&(s.value=t)}for(let t of e.tabs)await Be(t);if(!n.pendingFilePath&&e.activeTab&&O.value.some(t=>t.path===e.activeTab)){k.value=e.activeTab;let t=Ie(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(Lt.has(n)||Ne(t.name))&&(X.value=!0)}}finally{Re=!1}}finally{j=!0,ze()}}let He=p(null),M=r(null),N=new Map;function Ue(e){let t=N.get(e.path);return(!t||t.isDisposed())&&(t=be.createModel(e.content,e.language,ve.file(e.path)),N.set(e.path,t)),t}function F(){M.value?.setModel(null);for(let e of N.values())e.isDisposed()||e.dispose();N.clear()}function I(){if(!He.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;M.value=be.create(He.value,{theme:e?`vs-dark`:`vs`,fontSize:13,lineHeight:20,fontFamily:`'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace`,minimap:{enabled:!0},scrollBeyondLastLine:!1,renderWhitespace:`selection`,automaticLayout:!0,tabSize:2,wordWrap:`off`,smoothScrolling:!0,cursorBlinking:`smooth`,padding:{top:8,bottom:8},editContext:!1}),M.value.onDidChangeModelContent(()=>{let e=Ie();if(!e)return;let t=M.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),M.value.onDidBlurEditorText(()=>{a.ui.editorAutoSave&&Ie()?.isDirty&&Qe(!1),requestAnimationFrame(()=>{if(!U.value||U.value.offsetParent===null)return;let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||L()})})}_(k,e=>{if(!M.value||!e)return;let t=O.value.find(t=>t.path===e);if(!t)return;let n=Ue(t);M.value.setModel(n),c(()=>L()),B(e)});function L(){if(!M.value)return;M.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let R=0,z=new Map;async function Ge(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}&meta=1`)).json();return!t?.success||typeof t.mtimeMs!=`number`?null:{mtimeMs:t.mtimeMs}}catch{return null}}async function Ke(e){try{let t=await(await fetch(`/api/editor/file?path=${encodeURIComponent(e)}`)).json();return t?.success?{content:t.content,mtimeMs:typeof t.mtimeMs==`number`?t.mtimeMs:null}:null}catch{return null}}function qe(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=N.get(e.path);if(!r||r.isDisposed())return;let i=M.value;if(!i||i.getModel()!==r){r.setValue(t);return}let a=i.saveViewState();r.pushEditOperations([],[{range:r.getFullModelRange(),text:t}],()=>null),i.restoreViewState(a)}async function B(e){if(!e)return;let t=O.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++R,r=await Ge(e);if(n!==R||O.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(z.get(e)===r.mtimeMs)return;z.set(e,r.mtimeMs);try{await oe.confirm(D(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),D(`@EDITOR:文件已被外部改动`),{confirmButtonText:D(`@EDITOR:重新加载`),cancelButtonText:D(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await Ke(e);i&&O.value.find(t=>t.path===e)===t&&qe(t,i.content,i.mtimeMs)}function V(){document.hidden||B(k.value)}let Je=null;function Ye(){Xe(),Je=setInterval(()=>{document.hidden||B(k.value)},ft)}function Xe(){Je&&=(clearInterval(Je),null)}_(()=>O.value.filter(e=>e.isDirty).length,e=>{o.setDirtyCount(e)},{immediate:!0}),ie(()=>o.setDirtyCount(0)),ke(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;be.setTheme(e?`vs-dark`:`vs`)});let H=null;function Ze(){if(H||!U.value)return;let e=[U.value],t=U.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}H=new MutationObserver(()=>{U.value&&U.value.offsetParent!==null&&k.value&&M.value&&(B(k.value),requestAnimationFrame(()=>{let e=document.activeElement;e&&(e.tagName===`INPUT`||e.tagName===`TEXTAREA`||e.isContentEditable||e.classList?.contains(`native-edit-context`)||e.classList?.contains(`monaco-editor`))||L()}))});let n=H;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}ae(async()=>{I(),await v(),await Ve(),Ze(),ne(),window.addEventListener(`focus`,V),document.addEventListener(`visibilitychange`,V),Ye(),k.value&&c(()=>L())}),ie(()=>{H?.disconnect(),H=null,window.removeEventListener(`focus`,V),document.removeEventListener(`visibilitychange`,V),M.value?.dispose(),N.forEach(e=>e.dispose()),N.clear()});async function Qe(e=!1){let t=Ie();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){h.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||h.success(D(`@EDITOR:已保存`))}catch(e){h.error(`${D(`@EDITOR:保存失败: `)}${e.message}`)}}function $e(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),fe();return}t&&e.key===`s`&&(e.preventDefault(),Qe())}ae(()=>window.addEventListener(`keydown`,$e)),ie(()=>window.removeEventListener(`keydown`,$e));let U=p(null),W=p(a.ui.editorSidebarWidth),G=!1,tt=0,nt=0;function rt(e){G=!0,tt=e.clientX,nt=W.value,document.addEventListener(`mousemove`,it),document.addEventListener(`mouseup`,at),e.preventDefault()}function it(e){if(!G)return;let t=e.clientX-tt;W.value=Math.max(140,Math.min(400,nt+t))}function at(){G=!1,document.removeEventListener(`mousemove`,it),document.removeEventListener(`mouseup`,at),W.value!==a.ui.editorSidebarWidth&&a.setEditorSidebarWidth(W.value)}function ot(e){return e.type===`directory`?Ae(e.name):Ce(e.name)}let K=p(null),q=p(null),st=p(null),ct=p(null);function pt(){let e=A.value;return e?e.type===`directory`?{parentPath:e.path,afterNode:e,depth:e.depth+1}:{parentPath:e.path.includes(`/`)||e.path.includes(`\\`)?e.path.replace(/[\\/][^\\/]+$/,``):a.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:a.currentDirectory??``,afterNode:null,depth:0}}async function mt(){let e=pt();A.value?.type===`directory`&&!A.value.expanded&&await w(A.value),K.value={...e,kind:`file`,value:``},await c(),st.value?.focus()}async function ht(){let e=pt();A.value?.type===`directory`&&!A.value.expanded&&await w(A.value),K.value={...e,kind:`directory`,value:``},await c(),st.value?.focus()}function gt(){K.value=null}async function _t(){let e=K.value;if(!e||!e.value.trim()){K.value=null;return}let t=e.value.trim(),n=e.parentPath.replace(/[/\\]$/,``)+`/`+t;if(e.kind===`file`){let e=await(await fetch(`/api/editor/file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){h.error(e.error);return}h.success(D(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){h.error(e.error);return}h.success(D(`@EDITOR:创建成功`))}K.value=null,await C()}function vt(e){e.key===`Enter`&&(e.preventDefault(),_t()),e.key===`Escape`&&(e.preventDefault(),gt())}let J=p(null),yt=p(null);function bt(e,t){e.preventDefault(),J.value={x:e.clientX,y:e.clientY,node:t}}function Y(){J.value=null}async function xt(){let e=J.value?.node;Y(),e&&(A.value=e),e?.type===`directory`&&!e.expanded&&await w(e);let t=pt();K.value={...t,kind:`file`,value:``},await c(),st.value?.focus()}async function St(){let e=J.value?.node;Y(),e&&(A.value=e),e?.type===`directory`&&!e.expanded&&await w(e);let t=pt();K.value={...t,kind:`directory`,value:``},await c(),st.value?.focus()}async function Ct(){let e=J.value?.node;Y(),e&&(q.value={node:e,value:e.name},await c(),ct.value?.focus(),ct.value?.select())}async function wt(){let e=q.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){q.value=null;return}let t=e.value.trim(),n=e.node.path.replace(/[\\/][^\\/]+$/,``).replace(/[/\\]$/,``)+`/`+t,r=await(await fetch(`/api/editor/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({oldPath:e.node.path,newPath:n})})).json();if(!r.success){h.error(r.error);return}let i=O.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,k.value===e.node.path&&(k.value=n)),q.value=null,await C()}function Tt(e){e.key===`Enter`&&(e.preventDefault(),wt()),e.key===`Escape`&&(e.preventDefault(),q.value=null)}async function Et(){let e=J.value?.node;if(Y(),!e)return;let t=e.type===`directory`?D(`@EDITOR:文件夹`):D(`@EDITOR:文件`);if(!confirm(`${D(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){h.error(n.error);return}let r=O.value.findIndex(t=>t.path===e.path);r!==-1&&(O.value.splice(r,1),k.value===e.path&&(k.value=O.value[Math.max(0,r-1)]?.path??null)),h.success(D(`@EDITOR:已删除`)),await C()}async function Dt(){let e=J.value?.node;if(Y(),e)try{let t=await(await fetch(`/api/editor/reveal`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||h.error(t.error)}catch(e){h.error(e?.message||String(e))}}function Ot(e){let t=a.currentDirectory;if(!t)return e;let n=e=>e.replace(/\\/g,`/`).replace(/\/+$/,``),r=n(t),i=n(e);return i===r?`.`:i.startsWith(r+`/`)?i.slice(r.length+1):i}async function kt(e){try{if(navigator.clipboard&&window.isSecureContext)return await navigator.clipboard.writeText(e),!0}catch{}try{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();let n=document.execCommand(`copy`);return document.body.removeChild(t),n}catch{return!1}}async function At(){let e=J.value?.node;Y(),e&&(await kt(e.path)?h.success(D(`@EDITOR:已复制到剪贴板`)):h.error(D(`@EDITOR:复制失败`)))}async function jt(){let e=J.value?.node;Y(),e&&(await kt(Ot(e.path))?h.success(D(`@EDITOR:已复制到剪贴板`)):h.error(D(`@EDITOR:复制失败`)))}async function Mt(){let e=J.value?.node;if(Y(),e)try{let t=await(await fetch(`/api/editor/open-in-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||h.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){h.error(e?.message||String(e))}}let Nt=new Set([`html`,`htm`]),Pt=i(()=>{let e=J.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Nt.has(t)});async function Ft(){let e=J.value?.node;if(Y(),e)try{let t=await(await fetch(`/api/editor/open-in-browser`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e.path})})).json();t.success||h.error(t.error||D(`@EDITOR:浏览器打开失败`))}catch(e){h.error(e?.message||String(e))}}ae(()=>document.addEventListener(`click`,Y)),ie(()=>document.removeEventListener(`click`,Y));let It=new Set([`md`,`html`,`htm`,`svg`]),Lt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),X=p(!1),Z=p(!1),Rt=p(!1),zt=p(!1),Bt=p(0),Q=i(()=>O.value.find(e=>e.path===k.value)??null),Vt=i(()=>Q.value?.language===`plaintext`&&Q.value?.content===``),Ht=i(()=>Q.value?.language===`office`),$=i(()=>(Q.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Ut=i(()=>It.has($.value)||Lt.has($.value)||Ne($.value)),Wt=i(()=>((Q.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),Gt=i(()=>$.value===`md`&&Wt.value>0);_(k,()=>{X.value&&!Ut.value&&(X.value=!1),Z.value&&!Gt.value&&(Z.value=!1)});function Kt(){Ut.value&&(X.value||(Z.value=!1,Rt.value=!1),X.value=!X.value)}function qt(){Gt.value&&(Z.value||(X.value=!1,Rt.value=!1),Z.value=!Z.value)}function Jt(){Rt.value||(X.value=!1,Z.value=!1),Rt.value=!Rt.value,zt.value=!0}let Yt=p(null),Xt=p(!1),Zt=p(``),Qt=p(!0),$t=null,en=i(()=>!Z.value&&X.value&&$.value===`md`&&!!Q.value);function tn(){return Q.value?.content??``}function nn(){return tn().match(/^\s*#\s+(.+?)\s*(?:\r?\n|$)/)?.[1]?.trim()??``}function rn(e,t,n){if(!e){h.error(D(`@EDITOR:复制失败`));return}Zt.value=n,$t&&clearTimeout($t),$t=setTimeout(()=>{Zt.value=``},1800),t>0?h.warning(D(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):h.success(D(`@EDITOR:已复制`))}async function an(){rn(await kt(tn()),0,`md`)}async function on(){let e=Yt.value?.getRenderedElement();if(e){Xt.value=!0;try{let{html:t,leftover:n}=await lt(e,Qt.value);rn(await kt(t),n,`html`)}finally{Xt.value=!1}}}function sn(e){let t=document.createElement(`div`);t.style.cssText=`position:fixed;top:-9999px;left:-9999px;opacity:0;`,t.innerHTML=e,document.body.appendChild(t);try{let e=window.getSelection(),n=document.createRange();n.selectNodeContents(t),e?.removeAllRanges(),e?.addRange(n);let r=document.execCommand(`copy`);return e?.removeAllRanges(),r}catch{return!1}finally{document.body.removeChild(t)}}async function cn(){let e=Yt.value?.getRenderedElement();if(e){Xt.value=!0;try{let{html:t,leftover:n}=await ut(e,{inline:Qt.value,title:nn()}),r=tn(),i=!1;try{navigator.clipboard?.write&&typeof ClipboardItem<`u`&&(await navigator.clipboard.write([new ClipboardItem({"text/html":new Blob([t],{type:`text/html`}),"text/plain":new Blob([r],{type:`text/plain`})})]),i=!0)}catch{i=!1}i||=sn(t),rn(i,n,`rich`)}finally{Xt.value=!1}}}let ln=i(()=>{let e=Q.value;if(!e)return``;let t=$.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?Oe(e.content):t===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${n};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${e.content}</body></html>`:``}),un=!1,dn=0,fn=0;function pn(e){un=!0,dn=e.clientX,fn=Bt.value,document.addEventListener(`mousemove`,mn),document.addEventListener(`mouseup`,hn),e.preventDefault()}function mn(e){if(!un)return;let t=e.clientX-dn;Bt.value=Math.max(200,Math.min(900,fn+t))}function hn(){un=!1,document.removeEventListener(`mousemove`,mn),document.removeEventListener(`mouseup`,hn)}let gn={props:n,configStore:a,editorTabsStore:o,treeNodes:s,treeLoading:ee,searchQuery:l,debouncedSearchQuery:u,get searchDebounceTimer(){return d},set searchDebounceTimer(e){d=e},clearSearch:te,TREE_POLL_MS:dt,get treePollTimer(){return f},set treePollTimer(e){f=e},startTreePolling:ne,stopTreePolling:m,loadDir:g,initTree:v,collectExpandedPaths:y,toTreeNodes:b,fetchTreeSnapshot:x,reconcileTree:S,refreshTree:C,toggleDir:w,flattenTree:se,searchQueryLower:T,filterTree:ce,visibleTree:E,noSearchResults:le,highlightName:ue,searchInputRef:de,focusSearchInput:fe,onSearchEscape:Se,tabs:O,activeTabPath:k,selectedNode:A,openFile:Pe,closeTab:Fe,activeTab:Ie,workspaceSnapshot:Le,get workspaceRestoring(){return Re},set workspaceRestoring(e){Re=e},get workspaceHydrated(){return j},set workspaceHydrated(e){j=e},persistWorkspace:ze,restoreTab:Be,restoreWorkspace:Ve,editorContainerRef:He,editorInstance:M,modelCache:N,getOrCreateModel:Ue,disposeAllModels:F,mountEditor:I,focusEditor:L,get diskSyncSeq(){return R},set diskSyncSeq(e){R=e},diskConflictPromptedAt:z,fetchFileMeta:Ge,fetchFileContent:Ke,applyDiskContent:qe,syncActiveTabWithDisk:B,handleWindowFocus:V,DISK_SYNC_POLL_MS:ft,get diskSyncTimer(){return Je},set diskSyncTimer(e){Je=e},startDiskSyncPolling:Ye,stopDiskSyncPolling:Xe,get viewVisibilityObserver(){return H},set viewVisibilityObserver(e){H=e},setupViewVisibilityObserver:Ze,saveCurrentFile:Qe,handleKeydown:$e,containerRef:U,sidebarWidth:W,get isResizing(){return G},set isResizing(e){G=e},get resizeStartX(){return tt},set resizeStartX(e){tt=e},get resizeStartW(){return nt},set resizeStartW(e){nt=e},startSidebarResize:rt,onSidebarResize:it,stopSidebarResize:at,getNodeSpriteId:ot,inlineInput:K,renameInput:q,inlineInputRef:st,renameInputRef:ct,getTargetDir:pt,startNewFile:mt,startNewFolder:ht,cancelInlineInput:gt,confirmInlineInput:_t,handleInlineKeydown:vt,ctxMenu:J,ctxMenuRef:yt,openContextMenu:bt,closeContextMenu:Y,ctxNewFile:xt,ctxNewFolder:St,ctxRename:Ct,confirmRename:wt,handleRenameKeydown:Tt,ctxDelete:Et,ctxRevealInExplorer:Dt,toWorkspaceRelative:Ot,copyToClipboard:kt,ctxCopyAbsolutePath:At,ctxCopyRelativePath:jt,ctxOpenInVscode:Mt,BROWSER_OPEN_EXTS:Nt,ctxMenuCanOpenInBrowser:Pt,ctxOpenInBrowser:Ft,PREVIEW_TEXT_EXTS:It,IMAGE_EXTS:Lt,showPreview:X,showMindmap:Z,showAgentChat:Rt,agentOpened:zt,previewWidth:Bt,activeTabRef:Q,activeTabIsImage:Vt,activeTabIsOffice:Ht,activeExt:$,isPreviewable:Ut,mindmapTitleCount:Wt,isMindmapable:Gt,togglePreview:Kt,toggleMindmap:qt,toggleAgentChat:Jt,mdPreviewRef:Yt,mdCopyBusy:Xt,mdCopiedType:Zt,mdCopyInlineImages:Qt,get mdCopiedTimer(){return $t},set mdCopiedTimer(e){$t=e},mdCopyAvailable:en,mdSourceText:tn,mdDocTitle:nn,mdCopyFeedback:rn,copyMarkdownSource:an,copyRenderedHtml:on,copyRichTextBySelection:sn,copyRichTextToClipboard:cn,previewSrcdoc:ln,get isPreviewResizing(){return un},set isPreviewResizing(e){un=e},get previewResizeStartX(){return dn},set previewResizeStartX(e){dn=e},get previewResizeStartW(){return fn},set previewResizeStartW(e){fn=e},startPreviewResize:pn,onPreviewResize:mn,stopPreviewResize:hn,get $t(){return D},get ElTooltip(){return re},ImagePreview:Ee,OfficePreview:we,MarkdownPreview:Te,MindmapPreview:We,EditorAgentPanel:et,EmptyState:je,SvgIcon:pe,get PREVIEW_IFRAME_SANDBOX(){return De}};return Object.defineProperty(gn,"__isScriptSetup",{enumerable:!1,value:!0}),gn}});o(),ee(),y();var mt={class:`editor-view`,ref:`containerRef`},ht={class:`sidebar-header`},gt={class:`sidebar-title`},_t={class:`sidebar-actions`},vt={class:`sidebar-search`},J=[`placeholder`,`title`],yt=[`title`,`aria-label`],bt={key:0,class:`sidebar-tree`},Y={key:1,class:`tree-arrow-spacer`},xt={class:`tree-icon mit-icon`,"aria-hidden":`true`},St=[`xlink:href`],Ct=[`onClick`,`onContextmenu`],wt={key:1,class:`tree-arrow-spacer`},Tt={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},Et=[`xlink:href`],Dt={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},Ot=[`xlink:href`],kt=[`title`],At={key:0,class:`tree-name-hit`},jt={key:4,class:`tree-loading`},Mt={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},Nt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},Pt=[`placeholder`],Ft={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},It={key:0,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--color-warning-dark)`}},Lt={key:1,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"flex-shrink":`0`,color:`var(--text-meta)`}},X=[`placeholder`],Z={key:1,class:`tree-empty`},Rt={key:1,class:`sidebar-loading`},zt={class:`editor-main`},Bt={key:0,class:`editor-tabs`},Q=[`onClick`,`title`],Vt={class:`tab-name`},Ht={key:0,class:`tab-dirty-dot`},$=[`onClick`],Ut=[`title`],Wt=[`disabled`,`title`],Gt=[`title`],Kt={class:`editor-body`},qt={key:0,class:`image-tab-placeholder`},Jt={viewBox:`0 0 24 24`,width:`56`,height:`56`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.35`}},Yt={class:`image-tab-placeholder-title`},Xt={class:`image-tab-placeholder-hint`},Zt={class:`preview-header`},Qt={class:`preview-title`},$t={class:`preview-ext-badge`},en=[`title`],tn={class:`preview-body`},nn={key:0,class:`preview-copybar`},rn=[`disabled`,`title`],an=[`disabled`,`title`],on=[`disabled`,`title`],sn=[`title`],cn=[`sandbox`,`srcdoc`];function ln(r,i,o,c,ee,te){return e(),S(n,null,[l(`div`,mt,[t(` 左侧文件树 `),l(`div`,{class:`editor-sidebar`,style:d({width:c.sidebarWidth+`px`})},[l(`div`,ht,[l(`span`,gt,w(c.$t(`@EDITOR:资源管理器`)),1),l(`div`,_t,[s(c.ElTooltip,{content:c.$t(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:T(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:c.startNewFile},[t(` new-file icon `),i[12]||=l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),l(`polyline`,{points:`14 2 14 8 20 8`}),l(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),l(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)])]),_:1},8,[`content`]),s(c.ElTooltip,{content:c.$t(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:T(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:c.startNewFolder},[t(` new-folder icon `),i[13]||=l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),l(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),l(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)])]),_:1},8,[`content`]),s(c.ElTooltip,{content:c.$t(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:T(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:i[0]||=e=>c.refreshTree({notifyOnError:!0})},[...i[14]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`1 4 1 10 7 10`}),l(`polyline`,{points:`23 20 23 14 17 14`}),l(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),l(`div`,vt,[i[16]||=l(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`circle`,{cx:`11`,cy:`11`,r:`7`}),l(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),v(l(`input`,{ref:`searchInputRef`,"onUpdate:modelValue":i[1]||=e=>c.searchQuery=e,type:`text`,class:`sidebar-search-input`,placeholder:c.$t(`@EDITOR:搜索文件...`),title:c.$t(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ce(c.onSearchEscape,[`escape`])},null,40,J),[[E,c.searchQuery]]),c.searchQuery?(e(),S(`button`,{key:0,class:`sidebar-search-clear`,title:c.$t(`@EDITOR:清除搜索`),"aria-label":c.$t(`@EDITOR:清除搜索`),onClick:c.clearSearch},[...i[15]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,yt)):t(`v-if`,!0)]),c.treeLoading?(e(),S(`div`,Rt,[...i[25]||=[l(`span`,{class:`spin-icon`},null,-1)]])):(e(),S(`div`,bt,[(e(!0),S(n,null,se(c.flattenTree(c.visibleTree),r=>(e(),S(n,{key:r.path},[t(` 重命名时用输入框替换节点 `),c.renameInput&&c.renameInput.node.path===r.path?(e(),S(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:d({paddingLeft:12+r.depth*14+`px`})},[r.type===`directory`?(e(),S(`span`,{key:0,class:m([`tree-arrow`,{expanded:r.expanded}])},[...i[17]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(e(),S(`span`,Y)),(e(),S(`svg`,xt,[l(`use`,{"xlink:href":`#${c.getNodeSpriteId(r)}`},null,8,St)])),v(l(`input`,{ref_for:!0,ref:`renameInputRef`,"onUpdate:modelValue":i[2]||=e=>c.renameInput.value=e,onKeydown:c.handleRenameKeydown,onBlur:c.confirmRename,onClick:i[3]||=f(()=>{},[`stop`])},null,544),[[E,c.renameInput.value]])],4)):(e(),S(n,{key:1},[t(` 普通节点 `),l(`div`,{class:m([`tree-node`,{"tree-node--dir":r.type===`directory`,"tree-node--file":r.type===`file`,"tree-node--active":c.activeTabPath===r.path,"tree-node--selected":c.selectedNode?.path===r.path&&c.activeTabPath!==r.path}]),style:d({paddingLeft:12+r.depth*14+`px`}),onClick:e=>c.openFile(r),onContextmenu:e=>c.openContextMenu(e,r)},[t(` 展开箭头 `),r.type===`directory`?(e(),S(`span`,{key:0,class:m([`tree-arrow`,{expanded:r.expanded}])},[...i[18]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(e(),S(`span`,wt)),t(` 图标 `),r.type===`directory`?(e(),S(`svg`,Tt,[l(`use`,{"xlink:href":`#${c.getNodeSpriteId(r)}`},null,8,Et)])):(e(),S(`svg`,Dt,[l(`use`,{"xlink:href":`#${c.getNodeSpriteId(r)}`},null,8,Ot)])),t(` 名称(命中关键字高亮) `),l(`span`,{class:`tree-name`,title:r.path},[(e(!0),S(n,null,se(c.highlightName(r.name),(t,r)=>(e(),S(n,{key:r},[t.hit?(e(),S(`span`,At,w(t.text),1)):(e(),S(n,{key:1},[a(w(t.text),1)],64))],64))),128))],8,kt),r.loading?(e(),S(`span`,jt)):t(`v-if`,!0)],46,Ct)],2112)),t(` 内联新建输入框:紧跟在 afterNode 之后 `),c.inlineInput&&c.inlineInput.afterNode?.path===r.path?(e(),S(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:d({paddingLeft:12+c.inlineInput.depth*14+`px`})},[i[21]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),c.inlineInput.kind===`directory`?(e(),S(`svg`,Mt,[...i[19]||=[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(e(),S(`svg`,Nt,[...i[20]||=[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),v(l(`input`,{ref_for:!0,ref:`inlineInputRef`,class:`tree-inline-input`,"onUpdate:modelValue":i[4]||=e=>c.inlineInput.value=e,placeholder:c.inlineInput.kind===`file`?c.$t(`@EDITOR:输入文件名`):c.$t(`@EDITOR:输入文件夹名`),onKeydown:c.handleInlineKeydown,onBlur:c.cancelInlineInput,onClick:i[5]||=f(()=>{},[`stop`])},null,40,Pt),[[E,c.inlineInput.value]])],4)):t(`v-if`,!0)],64))),128)),t(` 根级输入框(无选中节点时出现在列表末尾) `),c.inlineInput&&c.inlineInput.afterNode===null?(e(),S(`div`,Ft,[i[24]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),c.inlineInput.kind===`directory`?(e(),S(`svg`,It,[...i[22]||=[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(e(),S(`svg`,Lt,[...i[23]||=[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),v(l(`input`,{ref:`inlineInputRef`,class:`tree-inline-input`,"onUpdate:modelValue":i[6]||=e=>c.inlineInput.value=e,placeholder:c.inlineInput.kind===`file`?c.$t(`@EDITOR:输入文件名`):c.$t(`@EDITOR:输入文件夹名`),onKeydown:c.handleInlineKeydown,onBlur:c.cancelInlineInput,onClick:i[7]||=f(()=>{},[`stop`])},null,40,X),[[E,c.inlineInput.value]])])):t(`v-if`,!0),!c.inlineInput&&(c.noSearchResults||c.treeNodes.length===0)?(e(),S(`div`,Z,w(c.noSearchResults?c.$t(`@EDITOR:未找到匹配文件`):c.$t(`@EDITOR:暂无文件`)),1)):t(`v-if`,!0)]))],4),t(` 拖拽分隔条 `),l(`div`,{class:`editor-resizer`,onMousedown:c.startSidebarResize},null,32),t(` 右侧编辑区 `),l(`div`,zt,[t(` 标签栏 `),c.tabs.length>0?(e(),S(`div`,Bt,[(e(!0),S(n,null,se(c.tabs,n=>(e(),S(`div`,{key:n.path,class:m([`editor-tab`,{active:c.activeTabPath===n.path,dirty:n.isDirty}]),onClick:e=>c.activeTabPath=n.path,title:n.path},[l(`span`,Vt,w(n.name),1),n.isDirty?(e(),S(`span`,Ht)):t(`v-if`,!0),l(`button`,{class:`tab-close`,onClick:e=>c.closeTab(n.path,e)},[...i[26]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$)],10,Q))),128)),i[30]||=l(`div`,{class:`editor-tabs-spacer`},null,-1),t(` 预览切换按钮 `),c.isPreviewable?(e(),S(`button`,{key:0,class:m([`preview-toggle-btn`,{active:c.showPreview}]),title:c.showPreview?c.$t(`@EDITOR:关闭预览`):c.$t(`@EDITOR:打开预览`),onClick:c.togglePreview},[i[27]||=l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),l(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),l(`span`,null,w(c.$t(`@EDITOR:预览`)),1)],10,Ut)):t(`v-if`,!0),t(` 思维导图:整篇 markdown 渲染为一张大导图 `),c.isMindmapable?(e(),S(`button`,{key:1,class:m([`preview-toggle-btn mindmap-toggle-btn`,{active:c.showMindmap,disabled:!c.isMindmapable}]),disabled:!c.isMindmapable,title:c.isMindmapable?c.showMindmap?c.$t(`@EDITOR:关闭思维导图`):c.$t(`@EDITOR:打开思维导图`):c.$t(`@EDITOR:需要至少一个 # 标题`),onClick:c.toggleMindmap},[i[28]||=u(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-fc2ebf13><circle cx="12" cy="12" r="2" data-v-fc2ebf13></circle><circle cx="5" cy="6" r="1.6" data-v-fc2ebf13></circle><circle cx="19" cy="6" r="1.6" data-v-fc2ebf13></circle><circle cx="5" cy="18" r="1.6" data-v-fc2ebf13></circle><circle cx="19" cy="18" r="1.6" data-v-fc2ebf13></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-fc2ebf13></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-fc2ebf13></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-fc2ebf13></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-fc2ebf13></line></svg>`,1),l(`span`,null,w(c.$t(`@EDITOR:思维导图`)),1)],10,Wt)):t(`v-if`,!0),t(` g ai 对话:文件空间右侧的智能体面板(与预览/思维导图互斥) `),l(`button`,{class:m([`preview-toggle-btn agent-toggle-btn`,{active:c.showAgentChat}]),title:c.showAgentChat?c.$t(`@EDITOR:关闭 g ai 对话`):c.$t(`@EDITOR:打开 g ai 对话`),onClick:c.toggleAgentChat},[i[29]||=l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),l(`path`,{d:`M18 16.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z`})],-1),l(`span`,null,w(c.$t(`@EDITOR:g ai 对话`)),1)],10,Gt)])):t(`v-if`,!0),t(` 无文件打开时的提示 `),c.tabs.length===0?(e(),C(c.EmptyState,{key:1,class:`editor-empty`,title:c.$t(`@EDITOR:从左侧选择文件打开`),hint:c.$t(`@EDITOR:Ctrl+S 保存`)},{icon:T(()=>[...i[31]||=[l(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),l(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):t(`v-if`,!0),t(` Monaco 容器(始终挂载,tab 为空或 image tab 时隐藏) `),l(`div`,Kt,[l(`div`,{class:m([`monaco-container`,{hidden:c.tabs.length===0||c.activeTabIsImage||c.activeTabIsOffice}]),ref:`editorContainerRef`},null,2),t(` 图片 tab 时的占位提示(主预览区在右侧 preview-panel) `),c.activeTabIsImage&&c.tabs.length>0&&!c.showPreview&&!c.showMindmap?(e(),S(`div`,qt,[(e(),S(`svg`,Jt,[...i[32]||=[l(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),l(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),l(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),l(`p`,Yt,w(c.activeTabRef?.name),1),l(`p`,Xt,w(c.$t(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):t(`v-if`,!0),t(` 预览分隔条(在面板右侧,拉动调整面板宽度) `),(c.showPreview||c.showMindmap||c.showAgentChat)&&c.tabs.length>0?(e(),S(`div`,{key:1,class:`preview-resizer`,onMousedown:c.startPreviewResize},null,32)):t(`v-if`,!0),t(` g ai 对话面板:v-if 懒挂载 + v-show 保状态(切到预览再切回来,进行中的流还在) `),c.agentOpened?v((e(),C(c.EditorAgentPanel,{key:2,active:c.showAgentChat&&c.tabs.length>0,"active-file-path":c.activeTabPath,"active-file-name":c.activeTabRef?.name??``,style:d({flexBasis:c.previewWidth+`px`}),onClose:i[8]||=e=>c.showAgentChat=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[g,c.showAgentChat&&c.tabs.length>0]]):t(`v-if`,!0),t(` 预览面板 `),(c.showPreview||c.showMindmap)&&c.tabs.length>0?(e(),S(`div`,{key:3,class:`preview-panel`,style:d({flexBasis:c.previewWidth+`px`})},[l(`div`,Zt,[l(`span`,Qt,w(c.showMindmap?c.$t(`@EDITOR:思维导图`):c.$t(`@EDITOR:预览`)),1),l(`span`,$t,w(c.activeExt.toUpperCase()),1),i[34]||=l(`div`,{class:`preview-header-spacer`},null,-1),l(`button`,{class:`preview-close-btn`,title:c.showMindmap?c.$t(`@EDITOR:关闭思维导图`):c.$t(`@EDITOR:关闭预览`),onClick:i[9]||=e=>c.showMindmap?c.showMindmap=!1:c.showPreview=!1},[...i[33]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,en)]),l(`div`,tn,[t(` 复制栏:Markdown 预览导出到公众号 / 其它富文本编辑器 `),c.mdCopyAvailable?(e(),S(`div`,nn,[l(`button`,{class:m([`preview-copy-btn`,{done:c.mdCopiedType===`md`}]),disabled:c.mdCopyBusy,title:c.$t(`@EDITOR:复制 Markdown 源码`),onClick:c.copyMarkdownSource},[i[35]||=l(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),l(`span`,null,w(c.mdCopiedType===`md`?c.$t(`@EDITOR:已复制`):`Markdown`),1)],10,rn),l(`button`,{class:m([`preview-copy-btn`,{done:c.mdCopiedType===`html`}]),disabled:c.mdCopyBusy,title:c.$t(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:c.copyRenderedHtml},[i[36]||=l(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),l(`span`,null,w(c.mdCopiedType===`html`?c.$t(`@EDITOR:已复制`):`HTML`),1)],10,an),l(`button`,{class:m([`preview-copy-btn preview-copy-btn--primary`,{done:c.mdCopiedType===`rich`}]),disabled:c.mdCopyBusy,title:c.$t(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:c.copyRichTextToClipboard},[i[37]||=l(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),l(`span`,null,w(c.mdCopyBusy?c.$t(`@EDITOR:转换图片中…`):c.mdCopiedType===`rich`?c.$t(`@EDITOR:已复制`):c.$t(`@EDITOR:复制富文本`)),1)],10,on),l(`label`,{class:`preview-copy-embed`,title:c.$t(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[v(l(`input`,{"onUpdate:modelValue":i[10]||=e=>c.mdCopyInlineImages=e,type:`checkbox`},null,512),[[b,c.mdCopyInlineImages]]),l(`span`,null,w(c.$t(`@EDITOR:图片转 Base64`)),1)],8,sn)])):t(`v-if`,!0),t(` 思维导图:整篇 markdown → 一张大导图 `),c.showMindmap&&c.activeExt===`md`&&c.activeTabRef?(e(),C(c.MindmapPreview,{key:1,content:c.activeTabRef.content,class:`preview-mindmap`},null,8,[`content`])):c.showPreview&&c.activeExt===`md`&&c.activeTabRef?(e(),S(n,{key:2},[t(` Markdown → in-app 渲染 `),t(` :key 按文件路径切 —— 预览的滚动容器就是这个组件自己的根节点
|
|
32
|
+
(.preview-markdown[overflow:auto]),不换 key 时切 tab 走的是同类型
|
|
33
|
+
组件 → Vue 复用同一个 DOM 节点、只把内容换掉,scrollTop 不在 patch
|
|
34
|
+
范围里,会从上一个文件原样带过来(表现为"新文件预览停在上一个文件的
|
|
35
|
+
滚动位置")。key 随路径变 → 重建节点,天然回到顶部。
|
|
36
|
+
注意 key 只取 path、不取 content:同一个文件里改字时预览是实时镜像,
|
|
37
|
+
那种情况下不该把用户踢回顶部。 `),(e(),C(c.MarkdownPreview,{ref:`mdPreviewRef`,key:c.activeTabRef.path,content:c.activeTabRef.content,"base-path":c.activeTabRef.path,class:`preview-markdown`},null,8,[`content`,`base-path`]))],2112)):c.showPreview&&[`html`,`htm`,`svg`].includes(c.activeExt)?(e(),S(n,{key:3},[t(` HTML / SVG → sandboxed iframe (JS 可执行,不透明 origin 隔离宿主) `),l(`iframe`,{class:`preview-iframe`,sandbox:c.PREVIEW_IFRAME_SANDBOX,srcdoc:c.previewSrcdoc},null,8,cn)],2112)):c.showPreview&&c.IMAGE_EXTS.has(c.activeExt)&&c.activeTabRef?(e(),S(n,{key:4},[t(` 图片预览(使用增强版 ImagePreview,支持缩放/拖拽) `),s(c.ImagePreview,{"file-path":c.activeTabRef.path,"file-name":c.activeTabRef.name},null,8,[`file-path`,`file-name`])],2112)):c.showPreview&&c.activeTabIsOffice&&c.activeTabRef?(e(),C(c.OfficePreview,{key:5,"file-path":c.activeTabRef.path},null,8,[`file-path`])):t(`v-if`,!0)])],4)):t(`v-if`,!0)])])],512),t(` 右键菜单 `),(e(),C(ne,{to:`body`},[c.ctxMenu?(e(),S(`div`,{key:0,ref:`ctxMenuRef`,class:`ctx-menu`,style:d({left:c.ctxMenu.x+`px`,top:c.ctxMenu.y+`px`}),onClick:i[11]||=f(()=>{},[`stop`])},[l(`button`,{class:`ctx-menu-item`,onClick:c.ctxNewFile},[i[38]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),l(`polyline`,{points:`14 2 14 8 20 8`}),l(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),l(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),a(` `+w(c.$t(`@EDITOR:新建文件`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:c.ctxNewFolder},[i[39]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`}),l(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),l(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),a(` `+w(c.$t(`@EDITOR:新建文件夹`)),1)]),i[46]||=l(`div`,{class:`ctx-menu-sep`},null,-1),l(`button`,{class:`ctx-menu-item`,onClick:c.ctxCopyAbsolutePath},[i[40]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),l(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),a(` `+w(c.$t(`@EDITOR:复制绝对路径`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:c.ctxCopyRelativePath},[i[41]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),l(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),a(` `+w(c.$t(`@EDITOR:复制相对路径`)),1)]),i[47]||=l(`div`,{class:`ctx-menu-sep`},null,-1),t(` 只有 HTML 才有"用浏览器打开":浏览器能直接渲染出结果 `),c.ctxMenuCanOpenInBrowser?(e(),S(`button`,{key:0,class:`ctx-menu-item`,onClick:c.ctxOpenInBrowser},[i[42]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`circle`,{cx:`12`,cy:`12`,r:`9`}),l(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),l(`path`,{d:`M12 3a13 13 0 0 1 3.5 9 13 13 0 0 1-3.5 9 13 13 0 0 1-3.5-9A13 13 0 0 1 12 3z`})],-1),a(` `+w(c.$t(`@EDITOR:在浏览器中打开`)),1)])):t(`v-if`,!0),l(`button`,{class:`ctx-menu-item`,onClick:c.ctxRevealInExplorer},[i[43]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),l(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),a(` `+w(c.$t(`@EDITOR:在资源管理器中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:c.ctxOpenInVscode},[s(c.SvgIcon,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),a(` `+w(c.$t(`@EDITOR:在 VSCode 中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:c.ctxRename},[i[44]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),l(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),a(` `+w(c.$t(`@EDITOR:重命名`)),1)]),l(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:c.ctxDelete},[i[45]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`3 6 5 6 21 6`}),l(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),l(`path`,{d:`M10 11v6`}),l(`path`,{d:`M14 11v6`}),l(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),a(` `+w(c.$t(`@EDITOR:删除`)),1)])],4)):t(`v-if`,!0)]))],64)}var un=fe(pt,[[`render`,ln],[`__scopeId`,`data-v-fc2ebf13`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/views/EditorView.vue`]]);export{un as default};
|
package/src/ui/public/assets/{FlowExecutionViewer-Ce4Q5ia6.js → FlowExecutionViewer-C5ylYV2C.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{$n as e,Bn as t,Dn as n,Hn as r,In as i,Kn as a,Qn as o,Rn as s,cr as c,hr as l,jn as u,ur as d,vr as f}from"./element-plus-DgSY_Wt4.js";import{n as p,t as m}from"./_plugin-vue_export-helper-bQQyMRS6.js";import{i as h,l as g,n as _,s as v}from"./vue-flow-DawpR_uk.js";import{a as y,c as b,i as x,n as S,o as C,r as w,s as T,t as E}from"./UserInputNode-DroKvDOa.js";r(),l();var D=`flow-execution-viewer`,O=s({__name:`FlowExecutionViewer`,props:{flowData:{type:Object,required:!0},currentNodeId:{type:String,default:void 0},executedNodeIds:{type:Array,default:()=>[]},failedNodeIds:{type:Array,default:()=>[]},executedEdgeIds:{type:Array,default:()=>[]}},setup(e,{expose:r}){r();function i(e){switch(e){case`command`:return`📋`;case`wait`:return`⏰`;case`version`:return`📦`;case`confirm`:return`✋`;case`code`:return`🧩`;case`start`:return`🚀`;case`condition`:return`🔀`;case`user_input`:return`⌨️`;default:return``}}let l=s({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>t(b,{id:e.id,nodeId:e.id,nodeType:`start`,title:p(`@FLOWNODE:开始`),icon:i(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function u(e){return s({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(r){let a=n(()=>{let e=r.data?.config,t=[...Array.isArray(e?.conditionBranches)?e.conditionBranches:[]].sort((e,t)=>{let n=e?.handleId==="default"||e?.isDefault,r=t?.handleId==="default"||t?.isDefault;return n&&!r?1:!n&&r?-1:Number(e?.priority??0)-Number(t?.priority??0)}).map(e=>String(e?.handleId||``).trim()).filter(e=>!!e);return t.includes(`default`)||t.push(`default`),t.length?t:[`default`]});return()=>t(b,{id:r.id,nodeId:r.id,nodeType:r.data?.type,title:r.data?.label,icon:i(r.data?.type),enabled:r.data?.enabled,selected:r.data?.selected,execStatus:r.data?.execStatus,sourceHandleIds:r.data?.type===`condition`?a.value:void 0,deletable:!1},{default:()=>t(e,{data:r.data,id:r.id})})}})}let d={start:f(l),command:f(u(T)),wait:f(u(C)),version:f(u(y)),confirm:f(u(x)),code:f(u(w)),condition:f(u(S)),user_input:f(u(E))},m=e,{onPaneReady:O}=g({id:D}),k=null,A=null;async function j(e){if(e){if(!k){A=e;return}for(let t=0;t<6;t+=1){if(await a(),await new Promise(e=>requestAnimationFrame(()=>e())),!(typeof k?.findNode==`function`&&k.findNode(e))){await new Promise(e=>window.setTimeout(()=>e(),60));continue}try{await k.fitView({nodes:[e],padding:.35,includeHiddenNodes:!0,minZoom:.35,maxZoom:1.2,duration:200})}catch{}break}}}O(e=>{k=e,console.log(`[FlowExecutionViewer] onPaneReady, flowId=`,D),console.log(`[FlowExecutionViewer] instance keys=`,Object.keys(e||{}));try{k.fitView({padding:.2,includeHiddenNodes:!0,duration:0})}catch{}let t=(m.currentNodeId||A||``).trim();t&&(A=null,j(t))});let M=null;c(()=>m.currentNodeId,async e=>{e&&(M&&=(window.clearTimeout(M),null),M=window.setTimeout(async()=>{if(console.log(`[FlowExecutionViewer] focus request, flowId=`,D,`nodeId=`,e),!k){A=e,console.log(`[FlowExecutionViewer] flowInstance not ready, pendingFocusNodeId=`,A);return}j(e)},150))}),o(()=>{M&&=(window.clearTimeout(M),null)});let N={getNodeIcon:i,StartNodeRenderer:l,createWrappedNode:u,nodeTypes:d,props:m,flowId:D,onPaneReady:O,get flowInstance(){return k},set flowInstance(e){k=e},get pendingFocusNodeId(){return A},set pendingFocusNodeId(e){A=e},focusNode:j,get focusTimer(){return M},set focusTimer(e){M=e},nodesForRender:n(()=>{let e=Array.isArray(m.flowData?.nodes)?m.flowData.nodes:[],t=new Set(m.executedNodeIds),n=new Set(m.failedNodeIds),r=m.currentNodeId;return e.map(e=>{let i;r&&e.id===r?i=`running`:n.has(e.id)?i=`failed`:t.has(e.id)&&(i=`success`);let a=[];return t.has(e.id)&&a.push(`exec-node-done`),{...e,data:{...e.data,execStatus:i},class:a.join(` `)}})}),edgesForRender:n(()=>{let e=Array.isArray(m.flowData?.edges)?m.flowData.edges:[],t=new Set(m.executedEdgeIds);return e.map(e=>{let n=[];return t.has(e.id)&&n.push(`exec-edge-done`),{...e,class:n.join(` `)}})}),get VueFlow(){return v},get Background(){return h},get Controls(){return _}};return Object.defineProperty(N,"__isScriptSetup",{enumerable:!1,value:!0}),N}});r();var k={class:`flow-exec-viewer`};function A(t,n,r,a,o,s){return e(),u(`div`,k,[i(a.VueFlow,{id:a.flowId,nodes:a.nodesForRender,edges:a.edgesForRender,"node-types":a.nodeTypes,"nodes-draggable":!1,"nodes-connectable":!1,"elements-selectable":!1,"zoom-on-scroll":!0,"zoom-on-double-click":!1,"pan-on-drag":!0,"min-zoom":.2,"max-zoom":1.5},{default:d(()=>[i(a.Background),i(a.Controls)]),_:1},8,[`nodes`,`edges`])])}var j=m(O,[[`render`,A],[`__scopeId`,`data-v-edba3f0b`],[`__file`,`C:/workspace/github_workspace/xz333221/zen-gitsync/src/ui/client/src/components/flow/FlowExecutionViewer.vue`]]);export{j as default};
|