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.
Files changed (79) hide show
  1. package/package.json +1 -1
  2. package/src/cli/ai/agent.js +1385 -1385
  3. package/src/cli/ai/context.js +431 -431
  4. package/src/cli/ai/context.test.js +376 -376
  5. package/src/cli/ai/turn.js +190 -190
  6. package/src/ui/public/assets/AgentView-CuEM6xzC.js +11 -0
  7. package/src/ui/public/assets/AppVersionBadge-BK1Fiv3b.js +2 -0
  8. package/src/ui/public/assets/BranchSelector-avxY_m05.js +1 -0
  9. package/src/ui/public/assets/CommitForm-hThTnoNt.js +14 -0
  10. package/src/ui/public/assets/CommonDialog-zaBdFGFH.js +1 -0
  11. package/src/ui/public/assets/CopySessionButton-CAxaqLQL.js +21 -0
  12. package/src/ui/public/assets/EditorView-iSA2SXJR.js +37 -0
  13. package/src/ui/public/assets/{FlowExecutionViewer-Ce4Q5ia6.js → FlowExecutionViewer-C5ylYV2C.js} +1 -1
  14. package/src/ui/public/assets/FlowOrchestrationWorkspace-CiQ07ZQv.js +21 -0
  15. package/src/ui/public/assets/LogList-Sjb8vmvq.js +7 -0
  16. package/src/ui/public/assets/MindmapView-B5rChFMP.js +2 -0
  17. package/src/ui/public/assets/MonitorView-Dcc-i2Fo.js +3 -0
  18. package/src/ui/public/assets/ProjectStartupButton-fz6eLCZU.js +1 -0
  19. package/src/ui/public/assets/RecentDirectoriesChat-BDnNp9jh.js +3 -0
  20. package/src/ui/public/assets/RemoteManagerDialog-NA1jRC7O.js +4 -0
  21. package/src/ui/public/assets/RemoteRepoCard-CKm4KqHs.js +7 -0
  22. package/src/ui/public/assets/SourceMapView-Drfato_u.js +3 -0
  23. package/src/ui/public/assets/SvgIcon-DR_79iBR.js +1 -0
  24. package/src/ui/public/assets/UserInputNode-DroKvDOa.js +1 -0
  25. package/src/ui/public/assets/WorkbenchView-CW7OACCU.js +326 -0
  26. package/src/ui/public/assets/{WorkbenchView-DzBtCzay.css → WorkbenchView-C_u6BptZ.css} +1 -1
  27. package/src/ui/public/assets/{_plugin-vue_export-helper-BY0jlMBE.js → _plugin-vue_export-helper-bQQyMRS6.js} +5 -5
  28. package/src/ui/public/assets/{agentConversations-CC01a7SP.js → agentConversations-wYAksLq1.js} +8 -8
  29. package/src/ui/public/assets/{configStore-EvRYufor.js → configStore-BeHB-gV4.js} +1 -1
  30. package/src/ui/public/assets/{css.worker-BDCmgL4U.js → css.worker-DFdt6_zu.js} +9 -9
  31. package/src/ui/public/assets/{dagre-Ct-SQ-7k.js → dagre-CXi8gaG9.js} +4 -4
  32. package/src/ui/public/assets/editor.worker-O-CH8JUO.js +26 -0
  33. package/src/ui/public/assets/{element-plus-D-6gla1z.css → element-plus-DJ3ZQa98.css} +1 -1
  34. package/src/ui/public/assets/element-plus-DgSY_Wt4.js +48 -0
  35. package/src/ui/public/assets/{flow-mindmap-C8x6ucsA.js → flow-mindmap-BsTRkgat.js} +56 -56
  36. package/src/ui/public/assets/{html.worker-DG8hnSJR.js → html.worker-JUzsMP-j.js} +8 -8
  37. package/src/ui/public/assets/index-BRQstBzy.js +211 -0
  38. package/src/ui/public/assets/json.worker-B4dEhy0e.js +58 -0
  39. package/src/ui/public/assets/{monaco-BV4P06MT.js → monaco-CnWeufxc.js} +6 -6
  40. package/src/ui/public/assets/{office-docx-B8BoOvth.js → office-docx-EUfAIM4w.js} +6 -6
  41. package/src/ui/public/assets/{office-excel-CFRkxKv8.js → office-excel-BZW0bXQo.js} +1 -1
  42. package/src/ui/public/assets/{office-pptx-DXdbDvLM.js → office-pptx-CBvDNZ4m.js} +3 -3
  43. package/src/ui/public/assets/{ts.worker-DgFMIcEs.js → ts.worker-CmEKzkmF.js} +49 -49
  44. package/src/ui/public/assets/{useOrchestrator-C8BD2JSO.js → useOrchestrator-Bhl7DGKW.js} +1 -1
  45. package/src/ui/public/assets/{vendor-DYtaPSUU.js → vendor-CZlKgriV.js} +43 -43
  46. package/src/ui/public/assets/vue-flow-DawpR_uk.js +39 -0
  47. package/src/ui/public/index.html +12 -12
  48. package/src/ui/server/routes/config.js +1348 -1348
  49. package/src/ui/server/routes/workbench/agentChat.js +752 -752
  50. package/src/ui/server/routes/workbench/agentChatShared.test.js +496 -496
  51. package/src/ui/server/routes/workbench/agentRoutes.js +13 -1
  52. package/src/ui/server/routes/workbench/agentRoutes.test.js +75 -0
  53. package/src/ui/server/routes/workbench/index.js +2 -1
  54. package/src/ui/server/routes/workbench/scheduleRoutes.js +2 -2
  55. package/src/ui/server/routes/workbench/shared.js +17 -0
  56. package/src/ui/public/assets/AgentView-CVbcrngz.js +0 -11
  57. package/src/ui/public/assets/AppVersionBadge-7gFB6t_t.js +0 -2
  58. package/src/ui/public/assets/BranchSelector-BIRNxA6U.js +0 -1
  59. package/src/ui/public/assets/CommitForm-CWpaazi7.js +0 -14
  60. package/src/ui/public/assets/CommonDialog-DrxsmpDL.js +0 -1
  61. package/src/ui/public/assets/CopySessionButton-C_01fcd3.js +0 -21
  62. package/src/ui/public/assets/EditorView-D80wG480.js +0 -37
  63. package/src/ui/public/assets/FlowOrchestrationWorkspace-Cq1zEt5K.js +0 -21
  64. package/src/ui/public/assets/LogList-DtmJG27U.js +0 -7
  65. package/src/ui/public/assets/MindmapView-BR2_C4Du.js +0 -2
  66. package/src/ui/public/assets/MonitorView-Cs_kwPBu.js +0 -3
  67. package/src/ui/public/assets/ProjectStartupButton-BfQJ0i5X.js +0 -1
  68. package/src/ui/public/assets/RecentDirectoriesChat-_gNQGqkM.js +0 -3
  69. package/src/ui/public/assets/RemoteManagerDialog-KY5I3Ftv.js +0 -4
  70. package/src/ui/public/assets/RemoteRepoCard-BUgdGtwC.js +0 -7
  71. package/src/ui/public/assets/SourceMapView-RkGgdvnN.js +0 -3
  72. package/src/ui/public/assets/SvgIcon-CP7WAT4C.js +0 -1
  73. package/src/ui/public/assets/UserInputNode-CwSqPh4O.js +0 -1
  74. package/src/ui/public/assets/WorkbenchView-CBfccRIP.js +0 -320
  75. package/src/ui/public/assets/editor.worker-GCPm6rMv.js +0 -26
  76. package/src/ui/public/assets/element-plus-CDrtgG55.js +0 -48
  77. package/src/ui/public/assets/index-CyEcaEC9.js +0 -211
  78. package/src/ui/public/assets/json.worker-CxwlJRnL.js +0 -58
  79. package/src/ui/public/assets/vue-flow-B7Hdmt-y.js +0 -39
@@ -1,37 +0,0 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Dn as t,En as n,Fn as r,Gn as i,Ir as a,Jn as o,Ln as s,Nn as c,On as l,Pn as u,Qn as d,Sn as f,Sr as ee,Vn as p,W as te,Xn as ne,Yr as m,Zr as h,bn as re,dn as g,er as _,i as v,kn as y,lr as b,mn as ie,mr as ae,r as oe,sr as x,ti as S,ur as C,vn as w,wn as se,xn as T,xr as E,yn as ce}from"./element-plus-CDrtgG55.js";import{c as le,l as ue,t as de}from"./vendor-DYtaPSUU.js";import{n as D,t as fe}from"./_plugin-vue_export-helper-BY0jlMBE.js";import{t as pe}from"./SvgIcon-CP7WAT4C.js";import{t as me}from"./configStore-EvRYufor.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-BV4P06MT.js";import{n as Se,r as O}from"./flow-mindmap-C8x6ucsA.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-CyEcaEC9.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-CC01a7SP.js";import{l as He,s as M,t as N,u as Ue}from"./CopySessionButton-C_01fcd3.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`}p();var F=s({__name:`MindmapPreview`,props:{content:{type:String,required:!0}},setup(e,{expose:t}){t();let r=e,i={props:r,data:n(()=>O(r.content||``,`未命名文档`)),get MindMap(){return Se}};return Object.defineProperty(i,"__isScriptSetup",{enumerable:!1,value:!0}),i}});p();var I={class:`mindmap-preview`},L={class:`mindmap-preview-canvas`};function R(n,i,a,o,s,c){return d(),e(`div`,I,[i[0]||=t(`div`,{class:`mindmap-preview-header`},[t(`span`,{class:`mindmap-preview-title`},`整篇导图`),t(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),t(`div`,L,[r(o.MindMap,{data:o.data,"preview-mode":``},null,8,[`data`])])])}var We=fe(F,[[`render`,R],[`__scopeId`,`data-v-3969a8bf`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/MindmapPreview.vue`]]);p(),ae();var z=s({__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:r}){t();let a=e,s=r,{theme:c}=ke(),l=n(()=>c.value===`dark`?`dark`:`light`),{sessions:u,sessionsLoading:d,currentSessionId:f,messages:ee,displayMessages:p,isStreaming:te,questionPanel:m,answeringQuestion:h,isSessionGenerating:re,currentEngine:g,pendingEngine:_,isEngineLocked:v,pickEngine:y,loadSessions:b,loadSession:ie,deleteSession:ae,renameSession:oe,newSession:S,sendMessage:C,retryTurn:w,answerQuestion:se,stop:T,inputContextUsage:ce,queuedMessages:fe,queuePaused:pe,removeQueuedMessage:me,flushQueued:he}=Ve(),ge=n(()=>v.value?g.value:_.value);function _e(e){v.value||y(e)}let ve=n(()=>A(u.value,re)),ye=k(),be=Re(),xe=ze(),Se=n(()=>ve.value.find(e=>e.id===f.value)?.title||``),O=E(null),Ce=E(null),we=E(null),Te=E(null),Ee=E(null),{width:De,narrow:Oe}=Ue(Ee),Ae=E(`chat`),{convListCollapsed:je,setConvListCollapsed:Me}=He(),Ne=n(()=>!Oe.value&&je.value),P=E(null),F=E(!1),I=null,L=n(()=>!!a.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,i(()=>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),a=r??e;n.parentElement!==a&&a.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:a.activeFilePath||void 0;await C(e.text,e.files,{openFilePath:t}),await i(),z()}function Ke(e){ie(e),Ae.value=`chat`}function qe(){S(),Ae.value=`chat`}x(()=>ee.value.length,()=>{i(()=>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}))}x(()=>a.active,e=>{e&&(Ae.value=`chat`,b().catch(()=>{}),i(()=>{We(),z(!1)}))}),x(Oe,e=>{e||(Ae.value=`chat`)}),x(()=>a.activeFilePath,()=>{F.value=!1}),x(L,e=>{e&&i(We)}),ne(()=>{b().catch(()=>{}),i(()=>{We(),B()})}),o(()=>{I?.disconnect(),I=null,P.value=null});let V={props:a,emit:s,theme:c,chatTheme:l,sessions:u,sessionsLoading:d,currentSessionId:f,messages:ee,displayMessages:p,isStreaming:te,questionPanel:m,answeringQuestion:h,isSessionGenerating:re,currentEngine:g,pendingEngine:_,isEngineLocked:v,pickEngine:y,loadSessions:b,loadSession:ie,deleteSession:ae,renameSession:oe,newSession:S,sendMessage:C,retryTurn:w,answerQuestion:se,stop:T,inputContextUsage:ce,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}});p(),a(),g();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(n,i,a,o,s,u){return d(),e(f,null,[y(`
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
- `),t(`div`,Ge,[t(`div`,Ke,[y(` 窄屏的列表页:整条 header 让给「返回对话 + 标题」 `),o.narrow&&o.page===`list`?(d(),e(f,{key:0},[t(`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]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),t(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,qe),t(`span`,B,S(o.$t(`@EDITOR:会话列表`)),1)],64)):(d(),e(`span`,V,S(o.$t(`@EDITOR:g ai 对话`)),1)),i[7]||=t(`div`,{class:`agent-panel-spacer`},null,-1),y(` 引擎切换:与「智能体」视图同一套(同一个 AgentEngineSelector)。
12
- 宽屏左边摆着历史,对话区一直在,所以常驻;窄屏只在对话页出现 ——
13
- 列表页没有正在跑的对话,摆这儿只会挤占标题。 `),!o.narrow||o.page===`chat`?(d(),l(o.AgentEngineSelector,{key:2,class:`agent-panel-engine`,engine:o.displayEngine,locked:o.isEngineLocked,onSelect:o.onEngineSelect},null,8,[`engine`,`locked`])):y(`v-if`,!0),y(` 复制整条会话:只有对话页才有"当前这条会话"可复制(列表页连引擎选择器都不摆) `),!o.narrow||o.page===`chat`?(d(),l(o.CopySessionButton,{key:3,class:`agent-panel-copy`,messages:o.messages,title:o.currentSessionTitle,engine:o.agentEngineName(o.displayEngine)},null,8,[`messages`,`title`,`engine`])):y(`v-if`,!0),y(` 会话列表按钮:只有"列表是独立一页"时才需要它(宽屏列表就在旁边) `),o.narrow&&o.page===`chat`?(d(),e(`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]||=[c(`<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)):y(`v-if`,!0),t(`button`,{class:`agent-panel-icon-btn`,title:o.$t(`@EDITOR:关闭对话`),onClick:i[2]||=e=>o.emit(`close`)},[...i[6]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ye)]),t(`div`,{class:m([`agent-panel-body`,{"is-wide":!o.narrow,"is-convs-collapsed":o.convsCollapsed}])},[y(` 会话历史:宽屏是常驻左列(可收起),窄屏是独享整页 `),C(t(`div`,Xe,[r(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),[[ce,!o.narrow||o.page===`list`]]),y(` 气泡区:输入框已经不在这里了(show-input=false),见下面常驻的那一条 `),C(t(`div`,H,[r(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),[[ce,!o.narrow||o.page===`chat`]]),y(`
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?(d(),e(`div`,{key:0,ref:`composerRef`,class:`agent-panel-composer acu-root`,"data-theme":o.chatTheme},[r(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`]),y(`
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?(d(),l(se,{key:0,to:o.contextSlot},[o.showContextCard?(d(),e(`div`,{key:0,class:`agent-context-att`,title:a.activeFilePath||``},[i[9]||=t(`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`},[t(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),t(`polyline`,{points:`14 3 14 8 19 8`})],-1),t(`span`,$e,S(a.activeFileName),1),t(`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]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,U)],8,Qe)):y(`v-if`,!0)],8,[`to`])):y(`v-if`,!0)],8,Ze)):y(`v-if`,!0)],2)],512)],2112)}var et=fe(z,[[`render`,W],[`__scopeId`,`data-v-7cc12c51`],[`__file`,`D:/workspace/github_workspace/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,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}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}}p(),ae();var dt=6e4,ft=3e4,pt=s({__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 r=e,a=me(),s=Me(),c=E([]),l=E(!1),u=E(``),d=E(``),f=null;function p(){u.value=``,d.value=``,f&&=(clearTimeout(f),null)}x(u,e=>{f&&clearTimeout(f),f=setTimeout(()=>{d.value=e,f=null},180)}),o(()=>{f&&clearTimeout(f),re(),Xe()});let m=null;function h(){re(),a.ui.fileTreeAutoRefresh&&(m=setInterval(()=>{document.hidden||a.currentDirectory&&(u.value.trim()||S())},dt))}function re(){m&&=(clearInterval(m),null)}x(()=>a.currentDirectory,async()=>{if(j=!1,h(),await _(),O.value.some(e=>e.isDirty)){j=!0;return}O.value=[],k.value=null,F(),await Ve()}),x(()=>a.ui.fileTreeAutoRefresh,()=>{h()});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 _(){let e=a.currentDirectory;if(e){l.value=!0;try{c.value=await g(e,0)}finally{l.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 ie(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 ae(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)?ae(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function S(e={}){if(!a.currentDirectory)return;let t=await ie([...y(c.value)]);if(!t){e.notifyOnError&&v.error(D(`@EDITOR:刷新失败`));return}if(c.value.length===0){c.value=t;return}ae(c.value,t)&&(c.value=t)}async function C(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 w(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...w(n.children));return t}let se=n(()=>d.value.trim().toLowerCase());function T(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?T(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 ce=n(()=>T(c.value,se.value)),le=n(()=>se.value.length>0&&ce.value.length===0);function ue(e){let t=d.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=E(null);function fe(){let e=de.value;e&&(e.focus(),e.select())}function Se(){u.value?(p(),de.value?.focus()):(de.value?.blur(),M.value?.focus())}let O=E([]),k=E(null),A=E(null);async function Pe(e){if(A.value=e,e.type!==`file`){C(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,i(()=>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){v.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),v.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}x(()=>r.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await i();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=n(()=>({expandedDirs:[...y(c.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)}x(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 ie(e.expandedDirs);t&&(c.value=t)}for(let t of e.tabs)await Be(t);if(!r.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=E(null),M=ee(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()})})}x(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),i(()=>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)}x(()=>O.value.filter(e=>e.isDirty).length,e=>{s.setDirtyCount(e)},{immediate:!0}),o(()=>s.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`]}))}ne(async()=>{I(),await _(),await Ve(),Ze(),h(),window.addEventListener(`focus`,V),document.addEventListener(`visibilitychange`,V),Ye(),k.value&&i(()=>L())}),o(()=>{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){v.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||v.success(D(`@EDITOR:已保存`))}catch(e){v.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())}ne(()=>window.addEventListener(`keydown`,$e)),o(()=>window.removeEventListener(`keydown`,$e));let U=E(null),W=E(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=E(null),q=E(null),st=E(null),ct=E(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 C(A.value),K.value={...e,kind:`file`,value:``},await i(),st.value?.focus()}async function ht(){let e=pt();A.value?.type===`directory`&&!A.value.expanded&&await C(A.value),K.value={...e,kind:`directory`,value:``},await i(),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){v.error(e.error);return}v.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){v.error(e.error);return}v.success(D(`@EDITOR:创建成功`))}K.value=null,await S()}function vt(e){e.key===`Enter`&&(e.preventDefault(),_t()),e.key===`Escape`&&(e.preventDefault(),gt())}let J=E(null),yt=E(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 C(e);let t=pt();K.value={...t,kind:`file`,value:``},await i(),st.value?.focus()}async function St(){let e=J.value?.node;Y(),e&&(A.value=e),e?.type===`directory`&&!e.expanded&&await C(e);let t=pt();K.value={...t,kind:`directory`,value:``},await i(),st.value?.focus()}async function Ct(){let e=J.value?.node;Y(),e&&(q.value={node:e,value:e.name},await i(),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){v.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 S()}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){v.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)),v.success(D(`@EDITOR:已删除`)),await S()}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||v.error(t.error)}catch(e){v.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)?v.success(D(`@EDITOR:已复制到剪贴板`)):v.error(D(`@EDITOR:复制失败`)))}async function jt(){let e=J.value?.node;Y(),e&&(await kt(Ot(e.path))?v.success(D(`@EDITOR:已复制到剪贴板`)):v.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||v.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){v.error(e?.message||String(e))}}let Nt=new Set([`html`,`htm`]),Pt=n(()=>{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||v.error(t.error||D(`@EDITOR:浏览器打开失败`))}catch(e){v.error(e?.message||String(e))}}ne(()=>document.addEventListener(`click`,Y)),o(()=>document.removeEventListener(`click`,Y));let It=new Set([`md`,`html`,`htm`,`svg`]),Lt=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),X=E(!1),Z=E(!1),Rt=E(!1),zt=E(!1),Bt=E(0),Q=n(()=>O.value.find(e=>e.path===k.value)??null),Vt=n(()=>Q.value?.language===`plaintext`&&Q.value?.content===``),Ht=n(()=>Q.value?.language===`office`),$=n(()=>(Q.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Ut=n(()=>It.has($.value)||Lt.has($.value)||Ne($.value)),Wt=n(()=>((Q.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),Gt=n(()=>$.value===`md`&&Wt.value>0);x(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=E(null),Xt=E(!1),Zt=E(``),Qt=E(!0),$t=null,en=n(()=>!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){v.error(D(`@EDITOR:复制失败`));return}Zt.value=n,$t&&clearTimeout($t),$t=setTimeout(()=>{Zt.value=``},1800),t>0?v.warning(D(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):v.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=n(()=>{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:r,configStore:a,editorTabsStore:s,treeNodes:c,treeLoading:l,searchQuery:u,debouncedSearchQuery:d,get searchDebounceTimer(){return f},set searchDebounceTimer(e){f=e},clearSearch:p,TREE_POLL_MS:dt,get treePollTimer(){return m},set treePollTimer(e){m=e},startTreePolling:h,stopTreePolling:re,loadDir:g,initTree:_,collectExpandedPaths:y,toTreeNodes:b,fetchTreeSnapshot:ie,reconcileTree:ae,refreshTree:S,toggleDir:C,flattenTree:w,searchQueryLower:se,filterTree:T,visibleTree:ce,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 te},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}});p(),a(),g();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(n,i,a,o,s,ee){return d(),e(f,null,[t(`div`,mt,[y(` 左侧文件树 `),t(`div`,{class:`editor-sidebar`,style:h({width:o.sidebarWidth+`px`})},[t(`div`,ht,[t(`span`,gt,S(o.$t(`@EDITOR:资源管理器`)),1),t(`div`,_t,[r(o.ElTooltip,{content:o.$t(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:b(()=>[t(`button`,{class:`sidebar-action-btn`,onClick:o.startNewFile},[y(` new-file icon `),i[12]||=t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`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`}),t(`polyline`,{points:`14 2 14 8 20 8`}),t(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),t(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)])]),_:1},8,[`content`]),r(o.ElTooltip,{content:o.$t(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:b(()=>[t(`button`,{class:`sidebar-action-btn`,onClick:o.startNewFolder},[y(` new-folder icon `),i[13]||=t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`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`}),t(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),t(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)])]),_:1},8,[`content`]),r(o.ElTooltip,{content:o.$t(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:b(()=>[t(`button`,{class:`sidebar-action-btn`,onClick:i[0]||=e=>o.refreshTree({notifyOnError:!0})},[...i[14]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`polyline`,{points:`1 4 1 10 7 10`}),t(`polyline`,{points:`23 20 23 14 17 14`}),t(`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`])])]),t(`div`,vt,[i[16]||=t(`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`},[t(`circle`,{cx:`11`,cy:`11`,r:`7`}),t(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),C(t(`input`,{ref:`searchInputRef`,"onUpdate:modelValue":i[1]||=e=>o.searchQuery=e,type:`text`,class:`sidebar-search-input`,placeholder:o.$t(`@EDITOR:搜索文件...`),title:o.$t(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:re(o.onSearchEscape,[`escape`])},null,40,J),[[w,o.searchQuery]]),o.searchQuery?(d(),e(`button`,{key:0,class:`sidebar-search-clear`,title:o.$t(`@EDITOR:清除搜索`),"aria-label":o.$t(`@EDITOR:清除搜索`),onClick:o.clearSearch},[...i[15]||=[t(`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`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,yt)):y(`v-if`,!0)]),o.treeLoading?(d(),e(`div`,Rt,[...i[25]||=[t(`span`,{class:`spin-icon`},null,-1)]])):(d(),e(`div`,bt,[(d(!0),e(f,null,_(o.flattenTree(o.visibleTree),n=>(d(),e(f,{key:n.path},[y(` 重命名时用输入框替换节点 `),o.renameInput&&o.renameInput.node.path===n.path?(d(),e(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+n.depth*14+`px`})},[n.type===`directory`?(d(),e(`span`,{key:0,class:m([`tree-arrow`,{expanded:n.expanded}])},[...i[17]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(d(),e(`span`,Y)),(d(),e(`svg`,xt,[t(`use`,{"xlink:href":`#${o.getNodeSpriteId(n)}`},null,8,St)])),C(t(`input`,{ref_for:!0,ref:`renameInputRef`,"onUpdate:modelValue":i[2]||=e=>o.renameInput.value=e,onKeydown:o.handleRenameKeydown,onBlur:o.confirmRename,onClick:i[3]||=T(()=>{},[`stop`])},null,544),[[w,o.renameInput.value]])],4)):(d(),e(f,{key:1},[y(` 普通节点 `),t(`div`,{class:m([`tree-node`,{"tree-node--dir":n.type===`directory`,"tree-node--file":n.type===`file`,"tree-node--active":o.activeTabPath===n.path,"tree-node--selected":o.selectedNode?.path===n.path&&o.activeTabPath!==n.path}]),style:h({paddingLeft:12+n.depth*14+`px`}),onClick:e=>o.openFile(n),onContextmenu:e=>o.openContextMenu(e,n)},[y(` 展开箭头 `),n.type===`directory`?(d(),e(`span`,{key:0,class:m([`tree-arrow`,{expanded:n.expanded}])},[...i[18]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(d(),e(`span`,wt)),y(` 图标 `),n.type===`directory`?(d(),e(`svg`,Tt,[t(`use`,{"xlink:href":`#${o.getNodeSpriteId(n)}`},null,8,Et)])):(d(),e(`svg`,Dt,[t(`use`,{"xlink:href":`#${o.getNodeSpriteId(n)}`},null,8,Ot)])),y(` 名称(命中关键字高亮) `),t(`span`,{class:`tree-name`,title:n.path},[(d(!0),e(f,null,_(o.highlightName(n.name),(t,n)=>(d(),e(f,{key:n},[t.hit?(d(),e(`span`,At,S(t.text),1)):(d(),e(f,{key:1},[u(S(t.text),1)],64))],64))),128))],8,kt),n.loading?(d(),e(`span`,jt)):y(`v-if`,!0)],46,Ct)],2112)),y(` 内联新建输入框:紧跟在 afterNode 之后 `),o.inlineInput&&o.inlineInput.afterNode?.path===n.path?(d(),e(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:h({paddingLeft:12+o.inlineInput.depth*14+`px`})},[i[21]||=t(`span`,{class:`tree-arrow-spacer`},null,-1),o.inlineInput.kind===`directory`?(d(),e(`svg`,Mt,[...i[19]||=[t(`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)]])):(d(),e(`svg`,Nt,[...i[20]||=[t(`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),t(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),C(t(`input`,{ref_for:!0,ref:`inlineInputRef`,class:`tree-inline-input`,"onUpdate:modelValue":i[4]||=e=>o.inlineInput.value=e,placeholder:o.inlineInput.kind===`file`?o.$t(`@EDITOR:输入文件名`):o.$t(`@EDITOR:输入文件夹名`),onKeydown:o.handleInlineKeydown,onBlur:o.cancelInlineInput,onClick:i[5]||=T(()=>{},[`stop`])},null,40,Pt),[[w,o.inlineInput.value]])],4)):y(`v-if`,!0)],64))),128)),y(` 根级输入框(无选中节点时出现在列表末尾) `),o.inlineInput&&o.inlineInput.afterNode===null?(d(),e(`div`,Ft,[i[24]||=t(`span`,{class:`tree-arrow-spacer`},null,-1),o.inlineInput.kind===`directory`?(d(),e(`svg`,It,[...i[22]||=[t(`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)]])):(d(),e(`svg`,Lt,[...i[23]||=[t(`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),t(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),C(t(`input`,{ref:`inlineInputRef`,class:`tree-inline-input`,"onUpdate:modelValue":i[6]||=e=>o.inlineInput.value=e,placeholder:o.inlineInput.kind===`file`?o.$t(`@EDITOR:输入文件名`):o.$t(`@EDITOR:输入文件夹名`),onKeydown:o.handleInlineKeydown,onBlur:o.cancelInlineInput,onClick:i[7]||=T(()=>{},[`stop`])},null,40,X),[[w,o.inlineInput.value]])])):y(`v-if`,!0),!o.inlineInput&&(o.noSearchResults||o.treeNodes.length===0)?(d(),e(`div`,Z,S(o.noSearchResults?o.$t(`@EDITOR:未找到匹配文件`):o.$t(`@EDITOR:暂无文件`)),1)):y(`v-if`,!0)]))],4),y(` 拖拽分隔条 `),t(`div`,{class:`editor-resizer`,onMousedown:o.startSidebarResize},null,32),y(` 右侧编辑区 `),t(`div`,zt,[y(` 标签栏 `),o.tabs.length>0?(d(),e(`div`,Bt,[(d(!0),e(f,null,_(o.tabs,n=>(d(),e(`div`,{key:n.path,class:m([`editor-tab`,{active:o.activeTabPath===n.path,dirty:n.isDirty}]),onClick:e=>o.activeTabPath=n.path,title:n.path},[t(`span`,Vt,S(n.name),1),n.isDirty?(d(),e(`span`,Ht)):y(`v-if`,!0),t(`button`,{class:`tab-close`,onClick:e=>o.closeTab(n.path,e)},[...i[26]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$)],10,Q))),128)),i[30]||=t(`div`,{class:`editor-tabs-spacer`},null,-1),y(` 预览切换按钮 `),o.isPreviewable?(d(),e(`button`,{key:0,class:m([`preview-toggle-btn`,{active:o.showPreview}]),title:o.showPreview?o.$t(`@EDITOR:关闭预览`):o.$t(`@EDITOR:打开预览`),onClick:o.togglePreview},[i[27]||=t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),t(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),t(`span`,null,S(o.$t(`@EDITOR:预览`)),1)],10,Ut)):y(`v-if`,!0),y(` 思维导图:整篇 markdown 渲染为一张大导图 `),o.isMindmapable?(d(),e(`button`,{key:1,class:m([`preview-toggle-btn mindmap-toggle-btn`,{active:o.showMindmap,disabled:!o.isMindmapable}]),disabled:!o.isMindmapable,title:o.isMindmapable?o.showMindmap?o.$t(`@EDITOR:关闭思维导图`):o.$t(`@EDITOR:打开思维导图`):o.$t(`@EDITOR:需要至少一个 # 标题`),onClick:o.toggleMindmap},[i[28]||=c(`<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),t(`span`,null,S(o.$t(`@EDITOR:思维导图`)),1)],10,Wt)):y(`v-if`,!0),y(` g ai 对话:文件空间右侧的智能体面板(与预览/思维导图互斥) `),t(`button`,{class:m([`preview-toggle-btn agent-toggle-btn`,{active:o.showAgentChat}]),title:o.showAgentChat?o.$t(`@EDITOR:关闭 g ai 对话`):o.$t(`@EDITOR:打开 g ai 对话`),onClick:o.toggleAgentChat},[i[29]||=t(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`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`}),t(`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),t(`span`,null,S(o.$t(`@EDITOR:g ai 对话`)),1)],10,Gt)])):y(`v-if`,!0),y(` 无文件打开时的提示 `),o.tabs.length===0?(d(),l(o.EmptyState,{key:1,class:`editor-empty`,title:o.$t(`@EDITOR:从左侧选择文件打开`),hint:o.$t(`@EDITOR:Ctrl+S 保存`)},{icon:b(()=>[...i[31]||=[t(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`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`}),t(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):y(`v-if`,!0),y(` Monaco 容器(始终挂载,tab 为空或 image tab 时隐藏) `),t(`div`,Kt,[t(`div`,{class:m([`monaco-container`,{hidden:o.tabs.length===0||o.activeTabIsImage||o.activeTabIsOffice}]),ref:`editorContainerRef`},null,2),y(` 图片 tab 时的占位提示(主预览区在右侧 preview-panel) `),o.activeTabIsImage&&o.tabs.length>0&&!o.showPreview&&!o.showMindmap?(d(),e(`div`,qt,[(d(),e(`svg`,Jt,[...i[32]||=[t(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),t(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),t(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),t(`p`,Yt,S(o.activeTabRef?.name),1),t(`p`,Xt,S(o.$t(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):y(`v-if`,!0),y(` 预览分隔条(在面板右侧,拉动调整面板宽度) `),(o.showPreview||o.showMindmap||o.showAgentChat)&&o.tabs.length>0?(d(),e(`div`,{key:1,class:`preview-resizer`,onMousedown:o.startPreviewResize},null,32)):y(`v-if`,!0),y(` g ai 对话面板:v-if 懒挂载 + v-show 保状态(切到预览再切回来,进行中的流还在) `),o.agentOpened?C((d(),l(o.EditorAgentPanel,{key:2,active:o.showAgentChat&&o.tabs.length>0,"active-file-path":o.activeTabPath,"active-file-name":o.activeTabRef?.name??``,style:h({flexBasis:o.previewWidth+`px`}),onClose:i[8]||=e=>o.showAgentChat=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[ce,o.showAgentChat&&o.tabs.length>0]]):y(`v-if`,!0),y(` 预览面板 `),(o.showPreview||o.showMindmap)&&o.tabs.length>0?(d(),e(`div`,{key:3,class:`preview-panel`,style:h({flexBasis:o.previewWidth+`px`})},[t(`div`,Zt,[t(`span`,Qt,S(o.showMindmap?o.$t(`@EDITOR:思维导图`):o.$t(`@EDITOR:预览`)),1),t(`span`,$t,S(o.activeExt.toUpperCase()),1),i[34]||=t(`div`,{class:`preview-header-spacer`},null,-1),t(`button`,{class:`preview-close-btn`,title:o.showMindmap?o.$t(`@EDITOR:关闭思维导图`):o.$t(`@EDITOR:关闭预览`),onClick:i[9]||=e=>o.showMindmap?o.showMindmap=!1:o.showPreview=!1},[...i[33]||=[t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[t(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),t(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,en)]),t(`div`,tn,[y(` 复制栏:Markdown 预览导出到公众号 / 其它富文本编辑器 `),o.mdCopyAvailable?(d(),e(`div`,nn,[t(`button`,{class:m([`preview-copy-btn`,{done:o.mdCopiedType===`md`}]),disabled:o.mdCopyBusy,title:o.$t(`@EDITOR:复制 Markdown 源码`),onClick:o.copyMarkdownSource},[i[35]||=t(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),t(`span`,null,S(o.mdCopiedType===`md`?o.$t(`@EDITOR:已复制`):`Markdown`),1)],10,rn),t(`button`,{class:m([`preview-copy-btn`,{done:o.mdCopiedType===`html`}]),disabled:o.mdCopyBusy,title:o.$t(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:o.copyRenderedHtml},[i[36]||=t(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),t(`span`,null,S(o.mdCopiedType===`html`?o.$t(`@EDITOR:已复制`):`HTML`),1)],10,an),t(`button`,{class:m([`preview-copy-btn preview-copy-btn--primary`,{done:o.mdCopiedType===`rich`}]),disabled:o.mdCopyBusy,title:o.$t(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:o.copyRichTextToClipboard},[i[37]||=t(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),t(`span`,null,S(o.mdCopyBusy?o.$t(`@EDITOR:转换图片中…`):o.mdCopiedType===`rich`?o.$t(`@EDITOR:已复制`):o.$t(`@EDITOR:复制富文本`)),1)],10,on),t(`label`,{class:`preview-copy-embed`,title:o.$t(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[C(t(`input`,{"onUpdate:modelValue":i[10]||=e=>o.mdCopyInlineImages=e,type:`checkbox`},null,512),[[ie,o.mdCopyInlineImages]]),t(`span`,null,S(o.$t(`@EDITOR:图片转 Base64`)),1)],8,sn)])):y(`v-if`,!0),y(` 思维导图:整篇 markdown → 一张大导图 `),o.showMindmap&&o.activeExt===`md`&&o.activeTabRef?(d(),l(o.MindmapPreview,{key:1,content:o.activeTabRef.content,class:`preview-mindmap`},null,8,[`content`])):o.showPreview&&o.activeExt===`md`&&o.activeTabRef?(d(),e(f,{key:2},[y(` Markdown → in-app 渲染 `),y(` :key 按文件路径切 —— 预览的滚动容器就是这个组件自己的根节点
32
- (.preview-markdown[overflow:auto]),不换 key 时切 tab 走的是同类型
33
- 组件 → Vue 复用同一个 DOM 节点、只把内容换掉,scrollTop 不在 patch
34
- 范围里,会从上一个文件原样带过来(表现为"新文件预览停在上一个文件的
35
- 滚动位置")。key 随路径变 → 重建节点,天然回到顶部。
36
- 注意 key 只取 path、不取 content:同一个文件里改字时预览是实时镜像,
37
- 那种情况下不该把用户踢回顶部。 `),(d(),l(o.MarkdownPreview,{ref:`mdPreviewRef`,key:o.activeTabRef.path,content:o.activeTabRef.content,"base-path":o.activeTabRef.path,class:`preview-markdown`},null,8,[`content`,`base-path`]))],2112)):o.showPreview&&[`html`,`htm`,`svg`].includes(o.activeExt)?(d(),e(f,{key:3},[y(` HTML / SVG → sandboxed iframe (JS 可执行,不透明 origin 隔离宿主) `),t(`iframe`,{class:`preview-iframe`,sandbox:o.PREVIEW_IFRAME_SANDBOX,srcdoc:o.previewSrcdoc},null,8,cn)],2112)):o.showPreview&&o.IMAGE_EXTS.has(o.activeExt)&&o.activeTabRef?(d(),e(f,{key:4},[y(` 图片预览(使用增强版 ImagePreview,支持缩放/拖拽) `),r(o.ImagePreview,{"file-path":o.activeTabRef.path,"file-name":o.activeTabRef.name},null,8,[`file-path`,`file-name`])],2112)):o.showPreview&&o.activeTabIsOffice&&o.activeTabRef?(d(),l(o.OfficePreview,{key:5,"file-path":o.activeTabRef.path},null,8,[`file-path`])):y(`v-if`,!0)])],4)):y(`v-if`,!0)])])],512),y(` 右键菜单 `),(d(),l(se,{to:`body`},[o.ctxMenu?(d(),e(`div`,{key:0,ref:`ctxMenuRef`,class:`ctx-menu`,style:h({left:o.ctxMenu.x+`px`,top:o.ctxMenu.y+`px`}),onClick:i[11]||=T(()=>{},[`stop`])},[t(`button`,{class:`ctx-menu-item`,onClick:o.ctxNewFile},[i[38]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`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`}),t(`polyline`,{points:`14 2 14 8 20 8`}),t(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),t(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),u(` `+S(o.$t(`@EDITOR:新建文件`)),1)]),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxNewFolder},[i[39]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`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`}),t(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),t(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),u(` `+S(o.$t(`@EDITOR:新建文件夹`)),1)]),i[46]||=t(`div`,{class:`ctx-menu-sep`},null,-1),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxCopyAbsolutePath},[i[40]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),t(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),u(` `+S(o.$t(`@EDITOR:复制绝对路径`)),1)]),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxCopyRelativePath},[i[41]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),t(`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),u(` `+S(o.$t(`@EDITOR:复制相对路径`)),1)]),i[47]||=t(`div`,{class:`ctx-menu-sep`},null,-1),y(` 只有 HTML 才有"用浏览器打开":浏览器能直接渲染出结果 `),o.ctxMenuCanOpenInBrowser?(d(),e(`button`,{key:0,class:`ctx-menu-item`,onClick:o.ctxOpenInBrowser},[i[42]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`circle`,{cx:`12`,cy:`12`,r:`9`}),t(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),t(`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),u(` `+S(o.$t(`@EDITOR:在浏览器中打开`)),1)])):y(`v-if`,!0),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxRevealInExplorer},[i[43]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`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`}),t(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),u(` `+S(o.$t(`@EDITOR:在资源管理器中打开`)),1)]),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxOpenInVscode},[r(o.SvgIcon,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),u(` `+S(o.$t(`@EDITOR:在 VSCode 中打开`)),1)]),t(`button`,{class:`ctx-menu-item`,onClick:o.ctxRename},[i[44]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),t(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),u(` `+S(o.$t(`@EDITOR:重命名`)),1)]),t(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:o.ctxDelete},[i[45]||=t(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[t(`polyline`,{points:`3 6 5 6 21 6`}),t(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),t(`path`,{d:`M10 11v6`}),t(`path`,{d:`M14 11v6`}),t(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),u(` `+S(o.$t(`@EDITOR:删除`)),1)])],4)):y(`v-if`,!0)]))],64)}var un=fe(pt,[[`render`,ln],[`__scopeId`,`data-v-fc2ebf13`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/views/EditorView.vue`]]);export{un as default};
@@ -1,21 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$n as t,A as n,An as r,At as i,C as a,Dn as o,En as s,Et as c,F as l,Fn as u,G as d,Gn as f,Hn as p,Ht as m,I as h,Ir as g,J as _,K as v,Kt as y,Ln as b,M as ee,N as x,On as S,Pn as C,Pt as te,Qn as w,S as T,Sn as E,St as D,U as O,Vn as k,W as A,Xn as j,Yr as M,Zn as ne,_r as N,at as P,bt as F,c as I,ct as re,dn as L,dt as ie,er as R,i as z,kn as B,kt as ae,l as oe,lr as V,lt as se,m as H,mr as U,r as ce,rn as le,sr as W,ti as G,tr as K,w as q,x as J,xn as Y,xr as X,y as ue,z as de,zn as Z,zt as fe}from"./element-plus-CDrtgG55.js";import{b as pe}from"./vendor-DYtaPSUU.js";import{n as Q,t as $}from"./_plugin-vue_export-helper-BY0jlMBE.js";import{t as me}from"./dagre-Ct-SQ-7k.js";import{t as he}from"./SvgIcon-CP7WAT4C.js";import{t as ge}from"./configStore-EvRYufor.js";import{t as _e}from"./CommonDialog-DrxsmpDL.js";import{i as ve,l as ye,n as be,s as xe}from"./vue-flow-B7Hdmt-y.js";import{K as Se,o as Ce}from"./index-CyEcaEC9.js";import{a as we,c as Te,i as Ee,n as De,o as Oe,r as ke,s as Ae,t as je}from"./UserInputNode-CwSqPh4O.js";var Me=e(me(),1);k(),U();var Ne=b({__name:`NodeContextMenu`,props:{nodeId:{type:String,required:!0}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,a=X(!1);function o(e){e===`executeFrom`?i(`execute-from-node`,r.nodeId):e===`executeSingle`&&i(`execute-single-node`,r.nodeId)}let s={props:r,emit:i,dropdownVisible:a,handleCommand:o,get VideoPlay(){return le}};return Object.defineProperty(s,"__isScriptSetup",{enumerable:!1,value:!0}),s}});k();function Pe(e,t,n,r,i,o){let s=_,c=a,l=q,d=T;return w(),S(d,{trigger:`contextmenu`,onCommand:r.handleCommand,onVisibleChange:t[0]||=e=>r.dropdownVisible=e,"popper-class":`flow-node-dropdown`},{dropdown:V(()=>[u(l,null,{default:V(()=>[u(c,{command:`executeFrom`},{default:V(()=>[u(s,null,{default:V(()=>[u(r.VideoPlay)]),_:1}),t[1]||=C(` 从此处开始执行 `,-1)]),_:1}),u(c,{command:`executeSingle`},{default:V(()=>[u(s,null,{default:V(()=>[u(r.VideoPlay)]),_:1}),t[2]||=C(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:V(()=>[K(e.$slots,`default`,{dropdownVisible:r.dropdownVisible})]),_:3})}var Fe=$(Ne,[[`render`,Pe],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/flow/nodes/NodeContextMenu.vue`]]);k(),U();var Ie=b({__name:`PackageJsonSelector`,props:{modelValue:{type:String,required:!0},placeholder:{type:String,required:!1},clearable:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1}},emits:[`update:modelValue`,`change`],setup(e,{expose:t,emit:n}){t();let r=e,a=n,o=X(!1),c=X([]),l=X(``),u=s({get:()=>r.modelValue,set:e=>{l.value=e,a(`update:modelValue`,e);let t=c.value.find(t=>t.fullPath===e);a(`change`,t||null)}}),d=s(()=>c.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function f(e){o.value=!0;try{let t=e?`/api/scan-package-files?directory=${encodeURIComponent(e)}`:`/api/scan-package-files`,n=await fetch(t);if(!n.ok)throw Error(`HTTP ${n.status}: ${n.statusText}`);let r=await n.json();if(r.success){c.value=r.packages||[],u.value&&!c.value.some(e=>e.fullPath===u.value)&&(u.value=``);let t=e?`目录 ${e}`:`当前项目`;z.success(`扫描 ${t} 完成,找到 ${c.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),z.error(`扫描失败: ${e.message}`),c.value=[]}finally{o.value=!1}}async function p(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?h(e):e.error&&z.error(e.error)}catch(e){z.error(`浏览目录失败: ${e.message}`)}}function h(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){z.warning(`请输入目录路径`);return}g(e)};ce.alert(Z(`div`,{class:`directory-browser`},[Z(`div`,{class:`current-path`},[Z(`span`,{class:`path-label`},`当前路径:`),Z(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),Z(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),Z(`div`,{class:`directory-list`},[e.parentPath?Z(`div`,{class:`directory-item parent-dir`,onClick:()=>g(e.parentPath)},[Z(`span`,{class:`dir-icon`},Z(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[Z(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),Z(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>Z(`div`,{class:`directory-item`,onClick:()=>g(e.path)},[Z(`span`,{class:`dir-icon`},Z(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[Z(`path`,{d:`M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z`})])),Z(`span`,{class:`dir-name`},e.name)]))])]),`浏览并选择目录`,{confirmButtonText:`确定`,cancelButtonText:`取消`,showCancelButton:!0,customClass:`directory-browser-dialog`,callback:n=>{if(n===`confirm`){let n=String(t||e.path||``).trim();if(!n){z.warning(`请输入目录路径`);return}f(n)}}})}async function g(e){try{ce.close(),setTimeout(async()=>{try{let t=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:e})})).json();t.success?h(t):t.error&&z.error(t.error)}catch(e){z.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){z.error(`处理目录选择时出错: ${e.message}`)}}f(),W(()=>r.modelValue,e=>{l.value=e},{immediate:!0});let _={props:r,emit:a,loading:o,packageFiles:c,selectedValue:l,computedValue:u,options:d,scanPackageFiles:f,browseDirectory:p,selectDirectoryDialog:h,selectDirectory:g,get Folder(){return D},get Refresh(){return m},get Loading(){return i},get FolderAdd(){return F}};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}});k(),g();var Le={class:`package-json-selector`},Re={class:`selector-container`},ze={class:`option-content`},Be={class:`option-main`},Ve={class:`package-name`},He={class:`option-path`},Ue={key:0,class:`empty-hint`};function We(e,t,n,i,a,s){let c=_,d=l,f=h,p=de,m=oe;return w(),r(`div`,Le,[o(`div`,Re,[u(f,{modelValue:i.computedValue,"onUpdate:modelValue":t[0]||=e=>i.computedValue=e,placeholder:n.placeholder||`选择 package.json 文件`,clearable:n.clearable,disabled:n.disabled||i.loading,filterable:``,class:`package-select`},{default:V(()=>[(w(!0),r(E,null,R(i.options,e=>(w(),S(d,{key:e.value,label:e.label,value:e.value},{default:V(()=>[o(`div`,ze,[o(`div`,Be,[u(c,{class:`folder-icon`},{default:V(()=>[u(i.Folder)]),_:1}),o(`span`,Ve,G(e.label),1)]),o(`div`,He,G(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),u(p,{icon:i.loading?i.Loading:i.Refresh,loading:i.loading,disabled:n.disabled,size:`default`,onClick:t[1]||=e=>i.scanPackageFiles(),class:`refresh-btn`,title:`刷新当前项目`},{default:V(()=>[C(G(i.loading?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),u(p,{icon:i.FolderAdd,disabled:n.disabled||i.loading,size:`default`,onClick:i.browseDirectory,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:V(()=>[...t[2]||=[C(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),i.packageFiles.length===0&&!i.loading?(w(),r(`div`,Ue,[u(m,{type:`info`,size:`small`},{default:V(()=>[...t[3]||=[C(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):B(`v-if`,!0)])}var Ge=$(Ie,[[`render`,We],[`__scopeId`,`data-v-597798fd`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/PackageJsonSelector.vue`]]);k();var Ke=b({__name:`ParamListContainer`,props:{modelValue:{type:Array,required:!0},title:{type:String,required:!1},addable:{type:Boolean,required:!1},removable:{type:Boolean,required:!1},minItems:{type:Number,required:!1},createItem:{type:Function,required:!1},itemKey:{type:Function,required:!1},disableAdd:{type:Boolean,required:!1},disableRemove:{type:Function,required:!1}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,a=s(()=>Array.isArray(r.modelValue)?r.modelValue:[]);function o(){if(!r.addable||r.disableAdd)return;let e=r.createItem;if(!e)return;let t=[...a.value,e()];i(`update:modelValue`,t),i(`add`)}function c(e){if(!r.removable)return;let t=typeof r.minItems==`number`?r.minItems:0;if(a.value.length<=t)return;let n=a.value[e];if(r.disableRemove&&r.disableRemove(n,e))return;let o=[...a.value];o.splice(e,1),i(`update:modelValue`,o),i(`remove`,e)}function l(e,t){return r.itemKey?r.itemKey(e,t):t}let u={props:r,emit:i,items:a,doAdd:o,doRemove:c,getKey:l,get Plus(){return fe},get Delete(){return se}};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}});g(),k();var qe={class:`param-list`},Je={key:0,class:`param-list__title`},Ye={key:0,class:`param-list__title-text`},Xe={class:`param-list__title-actions`},Ze={key:1,class:`param-list__empty`},Qe={key:2,class:`param-list__body`},$e={class:`param-list__row-content`},et={key:0,class:`param-list__row-actions`};function tt(e,t,n,i,a,s){let c=de;return w(),r(`div`,qe,[n.title!==void 0||n.addable?(w(),r(`div`,Je,[n.title?(w(),r(`span`,Ye,G(n.title),1)):B(`v-if`,!0),o(`div`,Xe,[K(e.$slots,`title-actions`,{},void 0,!0),n.addable?(w(),S(c,{key:0,type:`primary`,plain:``,icon:i.Plus,disabled:n.disableAdd||!n.createItem,onClick:i.doAdd},null,8,[`icon`,`disabled`])):B(`v-if`,!0)])])):B(`v-if`,!0),i.items.length===0?(w(),r(`div`,Ze,[K(e.$slots,`empty`,{},void 0,!0)])):(w(),r(`div`,Qe,[(w(!0),r(E,null,R(i.items,(t,a)=>(w(),r(`div`,{key:i.getKey(t,a),class:M([`param-list__row`,{"param-list__row--no-actions":!n.removable}])},[o(`div`,$e,[K(e.$slots,`row`,{item:t,index:a},void 0,!0)]),n.removable?(w(),r(`div`,et,[u(c,{type:`danger`,plain:``,icon:i.Delete,disabled:typeof n.minItems==`number`&&i.items.length<=n.minItems||(n.disableRemove?n.disableRemove(t,a):!1),onClick:e=>i.doRemove(a)},null,8,[`icon`,`disabled`,`onClick`])])):B(`v-if`,!0)],2))),128))]))])}var nt=$(Ke,[[`render`,tt],[`__scopeId`,`data-v-27c87a51`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/flow/ParamListContainer.vue`]]);k(),U();var rt=b({__name:`NodeInputConfig`,props:{modelValue:{type:Array,required:!0},paramNames:{type:Array,required:!0},disableParamNameEdit:{type:Boolean,required:!1},predecessorNodes:{type:Array,required:!1}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){t();let r=e,i=n,a=X([]);W(()=>r.modelValue,e=>{a.value=e?[...e]:[]},{immediate:!0,deep:!0}),W(()=>r.paramNames,e=>{if(!e||e.length===0){a.value=[],i(`update:modelValue`,[]);return}let t=new Map(a.value.map(e=>[e.paramName,e])),n=[];for(let r of e)t.has(r)?n.push(t.get(r)):n.push({paramName:r,inputType:`manual`,required:!1,manualValue:``});a.value=n,i(`update:modelValue`,n)},{immediate:!0});function o(e,t,n){if(!a.value[e])return;let r=[...a.value];r[e]={...r[e],[t]:n},t===`inputType`&&(n===`manual`?(r[e].referenceNodeId=void 0,r[e].referenceOutputKey=void 0):r[e].manualValue=void 0),a.value=r,i(`update:modelValue`,r)}function c(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||Q(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||Q(`@FLOWNODE:代码节点`):e.data.label||e.id}function l(e){if(e.type===`command`)return[{key:`stdout`,label:Q(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:Q(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:Q(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config,n=Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[];if(n.length>0)return n.map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}));let r=t?.codeOutputKeys;return(Array.isArray(r)?r:[]).map(e=>String(e||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let u=s(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:c(e),children:l(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function d(e,t){if(!t)return;let[n,r]=t.split(`::`),o=[...a.value];o[e]={...o[e],referenceNodeId:n,referenceOutputKey:r},a.value=o,i(`update:modelValue`,o)}function f(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}let p={props:r,emit:i,inputs:a,updateInput:o,getNodeDisplayName:c,getNodeOutputOptions:l,treeSelectOptions:u,handleReferenceSelect:d,getCurrentReferenceValue:f,get Link(){return ae},ParamListContainer:nt,get $t(){return Q}};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}});g(),k();var it={class:`node-input-config`},at={class:`input-row`},ot={class:`input-field param-name-field`},st={class:`field-label`},ct={class:`input-field type-field`},lt={class:`field-label`},ut={class:`input-field value-field`},dt={class:`field-label`},ft={class:`tree-node-label`},pt={class:`input-field required-field`},mt={class:`field-label`};function ht(e,t,n,i,a,s){let c=O,d=l,f=h,p=_,m=I,g=H;return w(),r(`div`,it,[u(i.ParamListContainer,{"model-value":i.inputs,title:void 0,addable:!1,removable:!1},{empty:V(()=>[C(G(i.$t(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:V(({item:e,index:t})=>[o(`div`,at,[o(`div`,ot,[o(`label`,st,G(i.$t(`@NODEINPUT:参数名`)),1),u(c,{"model-value":e.paramName,disabled:n.disableParamNameEdit,placeholder:i.$t(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>i.updateInput(t,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),o(`div`,ct,[o(`label`,lt,G(i.$t(`@NODEINPUT:类型`)),1),u(f,{"model-value":e.inputType,placeholder:i.$t(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>i.updateInput(t,`inputType`,e)},{default:V(()=>[u(d,{value:`manual`,label:i.$t(`@NODEINPUT:手动输入`)},null,8,[`label`]),u(d,{value:`reference`,label:i.$t(`@NODEINPUT:引用节点`),disabled:!n.predecessorNodes||n.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),o(`div`,ut,[o(`label`,dt,G(i.$t(`@NODEINPUT:值`)),1),e.inputType===`manual`?(w(),S(c,{key:0,"model-value":e.manualValue,placeholder:i.$t(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>i.updateInput(t,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(w(),S(m,{key:1,"model-value":i.getCurrentReferenceValue(e),data:i.treeSelectOptions,placeholder:i.$t(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>i.handleReferenceSelect(t,e)},{default:V(({data:e})=>[o(`span`,ft,[e.children?B(`v-if`,!0):(w(),S(p,{key:0},{default:V(()=>[u(i.Link)]),_:1})),C(` `+G(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),o(`div`,pt,[o(`label`,mt,G(i.$t(`@NODEINPUT:必填`)),1),u(g,{"model-value":!!e.required,"onUpdate:modelValue":e=>i.updateInput(t,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}var gt=$(rt,[[`render`,ht],[`__scopeId`,`data-v-9c9154d7`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/flow/NodeInputConfig.vue`]]);k(),U();var _t=b({__name:`CodeNodeInputConfig`,props:{modelValue:{type:Array,required:!0},predecessorNodes:{type:Array,required:!1},title:{type:null,required:!1},addable:{type:Boolean,required:!1}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=X([]);W(()=>r.modelValue,e=>{a.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function o(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||Q(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||Q(`@FLOWNODE:代码节点`):e.data.label||e.id}function c(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:Q(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:Q(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:Q(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let l=s(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:o(e),children:c(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function u(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function d(){let e=[...a.value,u()];a.value=e,i(`update:modelValue`,e)}t({addRow:d});function f(e,t){if(!a.value[e])return;let n=[...a.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].manualValue===void 0&&(n[e].manualValue=``)):(n[e].manualValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),a.value=n,i(`update:modelValue`,n)}function p(e,t){if(!t)return;let[n,r]=t.split(`::`);f(e,{ref:{nodeId:n,outputKey:r}})}function m(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}let h={props:r,emit:i,inputs:a,getNodeDisplayName:o,getNodeOutputOptions:c,treeSelectOptions:l,createDefaultRow:u,addRow:d,updateRow:f,handleReferenceSelect:p,getCurrentReferenceValue:m,ParamListContainer:nt,get $t(){return Q}};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}});g(),k();var vt={class:`code-node-input-config`},yt={class:`input-row`},bt={class:`input-field name-field`},xt={class:`field-label`},St={class:`input-field type-field`},Ct={class:`field-label`},wt={class:`input-field value-field`},Tt={class:`field-label`},Et={class:`input-field action-field`},Dt={class:`field-label`};function Ot(e,t,n,i,a,s){let c=O,d=l,f=h,p=I,m=H;return w(),r(`div`,vt,[u(i.ParamListContainer,{"model-value":i.inputs,title:n.title,addable:n.addable!==!1,removable:!0,"min-items":0,"create-item":i.createDefaultRow,"onUpdate:modelValue":t[0]||=e=>i.emit(`update:modelValue`,e)},{empty:V(()=>[C(G(i.$t(`@NODECFG:暂无输入参数`)),1)]),row:V(({item:e,index:t})=>[o(`div`,yt,[o(`div`,bt,[o(`label`,xt,G(i.$t(`@NODECFG:参数名`)),1),u(c,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>i.updateRow(t,{name:e})],placeholder:i.$t(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),o(`div`,St,[o(`label`,Ct,G(i.$t(`@NODECFG:参数值`)),1),u(f,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>i.updateRow(t,{source:e})],style:{width:`110px`}},{default:V(()=>[u(d,{label:i.$t(`@NODECFG:引用`),value:`reference`,disabled:!n.predecessorNodes||n.predecessorNodes.length===0},null,8,[`label`,`disabled`]),u(d,{label:i.$t(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),o(`div`,wt,[o(`label`,Tt,G(i.$t(`@NODECFG:值`)),1),e.source===`manual`?(w(),S(c,{key:0,modelValue:e.manualValue,"onUpdate:modelValue":[t=>e.manualValue=t,e=>i.updateRow(t,{manualValue:e})],placeholder:i.$t(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(w(),S(p,{key:1,"model-value":i.getCurrentReferenceValue(e),data:i.treeSelectOptions,placeholder:i.$t(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>i.handleReferenceSelect(t,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),o(`div`,Et,[o(`label`,Dt,G(i.$t(`@NODEINPUT:必填`)),1),u(m,{"model-value":!!e.required,"onUpdate:modelValue":e=>i.updateRow(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}var kt=$(_t,[[`render`,Ot],[`__scopeId`,`data-v-3064cd00`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/flow/CodeNodeInputConfig.vue`]]);k(),U();var At=b({__name:`UserInputParamConfig`,props:{modelValue:{type:Array,required:!0},predecessorNodes:{type:Array,required:!1},title:{type:null,required:!1},addable:{type:Boolean,required:!1}},emits:[`update:modelValue`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=X([]);W(()=>r.modelValue,e=>{a.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function o(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function c(){let e=[...a.value,o()];a.value=e,i(`update:modelValue`,e)}t({addRow:c});function l(e,t){if(!a.value[e])return;let n=[...a.value];n[e]={...n[e],...t},t.source&&(t.source===`manual`?(n[e].ref=void 0,n[e].defaultValue===void 0&&(n[e].defaultValue=``)):(n[e].defaultValue=void 0,n[e].ref||(n[e].ref={nodeId:``,outputKey:`stdout`}))),a.value=n,i(`update:modelValue`,n)}function u(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||Q(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||Q(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||Q(`@FLOWNODE:用户输入`):e.data.label||e.id}function d(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:Q(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:Q(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:Q(`@NODEINPUT:错误(error)`)}];if(e.type===`code`){let t=e.data?.config;return(Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[]).map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}let f=s(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:u(e),children:d(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function p(e,t){if(!t)return;let[n,r]=t.split(`::`);l(e,{ref:{nodeId:n,outputKey:r}})}function m(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}let h={props:r,emit:i,params:a,createDefaultRow:o,addRow:c,updateRow:l,getNodeDisplayName:u,getNodeOutputOptions:d,treeSelectOptions:f,handleReferenceSelect:p,getCurrentReferenceValue:m,get Link(){return ae},ParamListContainer:nt,get $t(){return Q}};return Object.defineProperty(h,"__isScriptSetup",{enumerable:!1,value:!0}),h}});g(),k();var jt={class:`user-input-param-config`},Mt={class:`input-row`},Nt={class:`input-field name-field`},Pt={class:`field-label`},Ft={class:`input-field type-field`},It={class:`field-label`},Lt={class:`input-field value-field`},Rt={class:`field-label`},zt={class:`tree-node-label`},Bt={class:`input-field action-field`},Vt={class:`field-label`};function Ht(e,t,n,i,a,s){let c=O,d=l,f=h,p=_,m=I,g=H,v=de;return w(),r(`div`,jt,[u(i.ParamListContainer,{"model-value":i.params,title:n.title,addable:n.addable!==!1,removable:!0,"min-items":0,"create-item":i.createDefaultRow,"onUpdate:modelValue":t[0]||=e=>i.emit(`update:modelValue`,e)},{empty:V(()=>[C(G(i.$t(`@UINPUT:暂无输入参数`)),1)]),row:V(({item:e,index:t})=>[o(`div`,Mt,[o(`div`,Nt,[o(`label`,Pt,G(i.$t(`@UINPUT:参数名`)),1),u(c,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>i.updateRow(t,{name:e})],placeholder:i.$t(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),o(`div`,Ft,[o(`label`,It,G(i.$t(`@UINPUT:类型`)),1),u(f,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>i.updateRow(t,{source:e})],style:{width:`130px`}},{default:V(()=>[u(d,{label:i.$t(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),u(d,{label:i.$t(`@UINPUT:引用`),value:`reference`,disabled:!i.props.predecessorNodes||i.props.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),o(`div`,Lt,[o(`label`,Rt,G(e.source===`manual`?i.$t(`@UINPUT:默认值`):i.$t(`@UINPUT:引用输出`)),1),e.source===`manual`?(w(),S(c,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>i.updateRow(t,{defaultValue:e})],placeholder:i.$t(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(w(),S(m,{key:1,"model-value":i.getCurrentReferenceValue(e),data:i.treeSelectOptions,placeholder:i.$t(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>i.handleReferenceSelect(t,e)},{default:V(({data:e})=>[o(`span`,zt,[e.children?B(`v-if`,!0):(w(),S(p,{key:0},{default:V(()=>[u(i.Link)]),_:1})),C(` `+G(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),o(`div`,Bt,[o(`label`,Vt,G(i.$t(`@NODEINPUT:必填`)),1),u(g,{"model-value":!!e.required,"onUpdate:modelValue":e=>i.updateRow(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:V(()=>[n.addable===!1?B(`v-if`,!0):(w(),S(v,{key:0,type:`primary`,plain:``,size:`small`,onClick:i.addRow},{default:V(()=>[C(G(i.$t(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}var Ut=$(At,[[`render`,Ht],[`__scopeId`,`data-v-2a315a18`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/flow/UserInputParamConfig.vue`]]);k(),U();var Wt=`function main(param) {
2
- const out = new Object()
3
- out.key0 = param.input
4
- return out
5
- }`,Gt=b({__name:`NodeConfigPanel`,props:{modelValue:{type:Boolean,required:!0},node:{type:[Object,null],required:!0},allNodes:{type:Array,required:!1},edges:{type:Array,required:!1}},emits:[`update:modelValue`,`update-config`,`open-command-manager`],setup(e,{expose:t,emit:n}){t();let r=[{key:`extractVersion`,title:Q(`@NODECFG:提取版本号`),script:`function main(param) {
6
- const text = String((param && param.input) ?? "")
7
- // 匹配形如 2.10.73 / v2.10.73 的版本号
8
- const m = text.match(/\\bv?(\\d+\\.\\d+\\.\\d+)\\b/)
9
- const out = new Object()
10
- out.version = m ? m[1] : ""
11
- return out
12
- }`},{key:`commitMessage`,title:Q(`@NODECFG:生成提交信息`),script:`function main(param) {
13
- const text = String((param && param.input) ?? "")
14
- // 兼容:@scope/workflow@2.10.73 或 workflow@2.10.73 或 workflow 2.10.73
15
- const m = text.match(/(?:@[^\\/\\s]+\\/)?([A-Za-z0-9._-]+)(?:@|\\s+)(v?\\d+\\.\\d+\\.\\d+)/)
16
- const name = m ? m[1] : ""
17
- const ver = m ? m[2].replace(/^v/, "") : ""
18
- const out = new Object()
19
- out.message = (name && ver) ? \`【\${name}】更新版本到\${ver}\` : ""
20
- return out
21
- }`}];function i(e){h.value.codeScript=e,z.success(Q(`@NODECFG:已应用示例`))}let a=e,o=n;function c(){o(`open-command-manager`)}let l=ge(),u=s(()=>{let e=Q(`@NODECFG:节点配置`);return a.node?`${e} - ${{command:Q(`@FLOWNODE:命令节点`),wait:Q(`@FLOWNODE:等待节点`),version:Q(`@FLOWNODE:版本管理`),confirm:Q(`@FLOWNODE:用户确认`),code:Q(`@FLOWNODE:代码节点`),condition:Q(`@FLOWNODE:条件`),user_input:Q(`@FLOWNODE:用户输入`)}[a.node.type]||a.node.type}`:e}),d=s({get:()=>a.modelValue,set:e=>o(`update:modelValue`,e)}),f=X(null),p=X(null),m=X(null),h=X({}),g=s(()=>{let e=(Array.isArray(h.value.userInputParams)?h.value.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e);return Array.from(new Set(e)).map(e=>({key:e}))}),_=s(()=>{let e=(Array.isArray(h.value.versionInputs)?h.value.versionInputs:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e);return Array.from(new Set(e))});function v(){let e=_.value;if(e.length===0){h.value.versionInputKey=``;return}let t=String(h.value.versionInputKey||``).trim();t&&e.includes(t)||(h.value.versionInputKey=e.includes(`version`)?`version`:e[0])}function b(){let e=_.value;if(e.length===0){h.value.dependencyVersionInputKey=``;return}let t=String(h.value.dependencyVersionInputKey||``).trim();if(!(t&&e.includes(t))){if(e.includes(`dependencyVersion`)){h.value.dependencyVersionInputKey=`dependencyVersion`;return}h.value.dependencyVersionInputKey=e.includes(`version`)?`version`:e[0]}}function ee(){return{id:`branch-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,name:Q(`@COND:默认分支`),handleId:`default`,priority:999,combine:`all`,rules:[],isDefault:!0}}function x(e){let t=(Array.isArray(e)?e:[]).map(e=>({id:String(e?.id||`branch-${Date.now()}-${Math.random().toString(36).slice(2,6)}`),name:String(e?.name||``).trim()||Q(`@COND:分支名称`),handleId:String(e?.handleId||``).trim()||`branch`,priority:Number.isFinite(Number(e?.priority))?Number(e?.priority):0,combine:e?.combine===`any`?`any`:`all`,rules:Array.isArray(e?.rules)?e.rules:[],isDefault:!!e?.isDefault}));t.some(e=>e.handleId==="default"||e.isDefault)||t.push(ee());for(let e of t)e.handleId==="default"&&(e.isDefault=!0,e.name||=Q(`@COND:默认分支`));return t}function S(){return{left:{nodeId:``,outputKey:`stdout`},op:`contains`,right:``}}function C(){let e=x(h.value.conditionBranches);e.push({id:`branch-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,name:Q(`@COND:分支名称`),handleId:`branch-${e.length}`,priority:e.length,combine:`all`,rules:[S()],isDefault:!1}),h.value.conditionBranches=e}function w(e){let t=x(h.value.conditionBranches),n=t.find(t=>t.id===e);if(n?.handleId==="default"||n?.isDefault){z.warning(Q(`@COND:请至少保留一个默认分支`));return}h.value.conditionBranches=t.filter(t=>t.id!==e)}function T(e){let t=x(h.value.conditionBranches),n=t.find(t=>t.id===e);n&&(n.rules=Array.isArray(n.rules)?[...n.rules,S()]:[S()],h.value.conditionBranches=t)}function E(e,t){let n=x(h.value.conditionBranches),r=n.find(t=>t.id===e);r&&(r.rules=(Array.isArray(r.rules)?r.rules:[]).filter((e,n)=>n!==t),h.value.conditionBranches=n)}function O(e){let t=(Array.isArray(e)?e:[]).map(e=>({name:String(e?.name||``).trim(),source:e?.source===`manual`?`manual`:`reference`,manualValue:e?.manualValue===void 0||e?.manualValue===null?``:String(e.manualValue),ref:e?.ref?{nodeId:String(e.ref.nodeId||``),outputKey:String(e.ref.outputKey||`stdout`)}:void 0})).filter(e=>!!e.name||!!e.manualValue||!!e.ref?.nodeId),n=new Set,r=[];for(let e of t)n.has(e.name)||(n.add(e.name),r.push(e));return r.slice(0,30)}function k(e){return(Array.isArray(e)?e:[]).find(e=>String(e?.name||``).trim()===`version`)}function A(e){let t=Array.isArray(h.value.versionInputs)?[...h.value.versionInputs]:[],n=t.findIndex(e=>String(e?.name||``).trim()===`version`),r={...n>=0?t[n]:{name:`version`,source:`manual`,manualValue:``,ref:{nodeId:``,outputKey:`stdout`}},...e,name:`version`};e.source&&(e.source===`manual`?(r.ref=void 0,r.manualValue===void 0&&(r.manualValue=``)):(r.manualValue=void 0,r.ref||={nodeId:``,outputKey:`stdout`})),n>=0?t[n]=r:t.push(r),h.value.versionInputs=O(t)}function j(){let e=Array.isArray(h.value.versionInputs)?h.value.versionInputs:[];h.value.versionInputs=e.filter(e=>String(e?.name||``).trim()!==`version`)}function M(e){return!e?.ref?.nodeId||!e?.ref?.outputKey?``:`${e.ref.nodeId}::${e.ref.outputKey}`}function ne(e){if(!e)return;let[t,n]=e.split(`::`);A({source:`reference`,ref:{nodeId:t,outputKey:n}})}function N(e){let t=(Array.isArray(e)?e:[]).map(e=>({key:String(e?.key||``).trim(),type:e?.type||`String`,desc:String(e?.desc||``).trim()})).filter(e=>!!e.key),n=new Set,r=[];for(let e of t)n.has(e.key)||(n.add(e.key),r.push(e));return r.slice(0,30)}function F(){return{key:``,type:`String`}}function I(){let e=Array.isArray(h.value.codeOutputParams)?[...h.value.codeOutputParams]:[];e.push(F()),h.value.codeOutputParams=e}let re=X([]),L=s(()=>l.customCommands||[]),R=s(()=>{if(!h.value.commandId)return[];let e=L.value.find(e=>e.id===h.value.commandId);return e?Ce(e.command):[]}),B=s(()=>{if(!a.node||!a.allNodes||!a.edges)return[];let e=a.node.id,t=a.edges,n=a.allNodes,r=[],i=new Set,o=[e];function s(e){return t.filter(t=>t.target===e).map(e=>e.source)}for(;o.length>0;){let e=s(o.shift());for(let t of e)if(!i.has(t)){i.add(t),o.push(t);let e=n.find(e=>e.id===t);if(e&&(e.type===`command`||e.type===`code`||e.type===`user_input`)&&e.data.config){if(e.type===`command`&&e.data.config?.useTerminal===!0)continue;r.push(e)}}}return r});function oe(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:Q(`@NODECFG:标准输出(stdout)`)},{key:`stderr`,label:Q(`@NODECFG:标准错误(stderr)`)},{key:`error`,label:Q(`@NODECFG:错误(error)`)}];if(e.type===`code`){let t=e.data?.config,n=Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[];if(n.length>0)return n.map(e=>String(e?.key||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}));let r=t?.codeOutputKeys;return(Array.isArray(r)?r:[]).map(e=>String(e||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}if(e.type===`user_input`){let t=e.data?.config;return(Array.isArray(t?.userInputParams)?t.userInputParams:[]).map(e=>String(e?.name||``).trim()).filter(e=>!!e).map(e=>({key:e,label:e}))}return[]}function V(e){return e.type===`command`?e.data.config?.commandName||e.data.label||Q(`@NODECFG:命令节点`):e.type===`code`?e.data.label||Q(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.label||Q(`@FLOWNODE:用户输入`):e.data.label||e.id}function H(e){let t=new Map;for(let n of Array.isArray(e)?e:[]){let e=String(n?.key||``).trim();e&&t.set(e,String(n?.desc||``).trim())}return[{key:`stdout`,desc:t.get(`stdout`)||``},{key:`stderr`,desc:t.get(`stderr`)||``},{key:`error`,desc:t.get(`error`)||``}]}W(()=>a.node,e=>{if(!e)return;let t=e.data.config;if(e.type===`command`)h.value={commandId:t?.commandId,commandName:t?.commandName,useTerminal:t?.useTerminal||!1,restartExistingTerminal:t?.restartExistingTerminal||!1,inputs:Array.isArray(t?.inputs)?t.inputs:[],commandOutputParams:H(t?.commandOutputParams),nodeName:t?.displayName||e.data.label||``,enabled:e.data.enabled??!0};else if(e.type===`wait`)h.value={waitSeconds:t?.waitSeconds||5,nodeName:t?.displayName||e.data.label||``,enabled:e.data.enabled??!0};else if(e.type===`version`){let n=`bump`;t?.versionSource===`input`&&(n=`input`);let r=k(t?.versionInputs);n!==`input`&&(t?.versionTarget!==`dependency`&&r?n=r.source===`manual`?`manual`:`reference`:t?.inputRef?n=`reference`:t?.dependencyVersion||t?.versionTarget!==`dependency`&&!t?.versionBump?n=`manual`:(t?.dependencyVersionBump||t?.versionBump)&&(n=`bump`)),h.value={versionTarget:t?.versionTarget||`version`,versionBump:t?.versionBump||`patch`,packageJsonPath:t?.packageJsonPath||``,dependencyName:t?.dependencyName||``,dependencyVersion:t?.dependencyVersion||``,dependencyType:t?.dependencyType||`dependencies`,dependencyVersionMode:t?.dependencyVersionBump?`bump`:`manual`,dependencyVersionBump:t?.dependencyVersionBump||`patch`,versionInputs:O(t?.versionInputs),versionSource:n,inputRef:t?.inputRef,extractVersionFromRefOutput:t?.extractVersionFromRefOutput??!0,versionInputKey:String(t?.versionInputKey||``).trim()||void 0,dependencyVersionInputKey:String(t?.dependencyVersionInputKey||``).trim()||void 0,nodeName:t?.displayName||e.data.label||``,enabled:e.data.enabled??!0},n===`input`&&(h.value.versionTarget===`dependency`?b():v()),t?.packageJsonPath&&U(t.packageJsonPath)}else if(e.type===`code`){let n=Array.isArray(t?.codeInputs)?t.codeInputs:[],r=Array.isArray(t?.codeOutputParams)?t.codeOutputParams:[];h.value={codeScript:t?.codeScript||``,codeInputs:n,codeOutputParams:r,nodeName:t?.displayName||e.data.label||``,enabled:e.data.enabled??!0}}else if(e.type===`confirm`)h.value={nodeName:t?.displayName||e.data.label||``,enabled:e.data.enabled??!0};else if(e.type===`condition`){let n=x(t?.conditionBranches);h.value={conditionBranches:n,nodeName:t?.displayName||e.data.label||``,enabled:e.data.enabled??!0}}else e.type===`user_input`&&(h.value={userInputParams:Array.isArray(t?.userInputParams)?t.userInputParams:[],nodeName:t?.displayName||e.data.label||``,enabled:e.data.enabled??!0})},{immediate:!0});async function U(e){try{let t=await fetch(`/api/read-package-json`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({packageJsonPath:e})});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();if(n.success){let e=[],t=h.value.dependencyType||`dependencies`;if(t===`dependencies`&&n.dependencies)e.push(...Object.keys(n.dependencies));else if(t===`devDependencies`&&n.devDependencies)e.push(...Object.keys(n.devDependencies));else if(t===`peerDependencies`){let t=n.peerDependencies&&Object.keys(n.peerDependencies).length>0?n.peerDependencies:n.peerDependenciesMeta;t&&e.push(...Object.keys(t))}re.value=e.sort()}}catch(e){console.error(Q(`@NODECFG:读取依赖列表失败`),e),re.value=[]}}W(()=>h.value.dependencyType,()=>{h.value.packageJsonPath&&U(h.value.packageJsonPath)});function ce(e){h.value.selectedPackageFile=e,e?(h.value.packageJsonPath=e.fullPath,U(e.fullPath)):re.value=[]}function le(e){h.value.commandId=e.id,h.value.commandName=e.name}function G(){return`step-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function K(){if(!a.node)return;let e=null;if(a.node.type===`command`){if(!h.value.commandId){z.warning(Q(`@NODECFG:请选择要执行的命令`));return}let t=Array.isArray(h.value.inputs)?h.value.inputs:[];for(let e of t){if(!e||!e.required)continue;let t=String(e.paramName||``).trim()||Q(`@NODEINPUT:参数名`);if(e.inputType===`reference`){let n=String(e.referenceNodeId||``).trim(),r=String(e.referenceOutputKey||``).trim();if(!n||!r){z.warning(Q(`@NODECFG:必填参数未选择引用输出`,{name:t}));return}}else{let n=e.manualValue;if(n==null||String(n).trim()===``){z.warning(Q(`@NODECFG:请输入必填参数的值`,{name:t}));return}}}e={id:a.node.data.config?.id||G(),nodeId:a.node.id,type:`command`,displayName:h.value.nodeName?.trim()||void 0,commandId:h.value.commandId,commandName:h.value.commandName||``,useTerminal:h.value.useTerminal||!1,restartExistingTerminal:h.value.useTerminal&&h.value.restartExistingTerminal||!1,inputs:h.value.inputs||[],commandOutputParams:H(h.value.commandOutputParams),enabled:h.value.enabled??!0}}else if(a.node.type===`wait`){if(!h.value.waitSeconds||h.value.waitSeconds<=0){z.warning(Q(`@NODECFG:等待时间必须大于0秒`));return}e={id:a.node.data.config?.id||G(),nodeId:a.node.id,type:`wait`,displayName:h.value.nodeName?.trim()||void 0,waitSeconds:h.value.waitSeconds,enabled:h.value.enabled??!0}}else if(a.node.type===`version`){if(h.value.versionTarget===`dependency`){if(!h.value.dependencyName?.trim()){z.warning(Q(`@NODECFG:请选择依赖包名称`));return}if(h.value.versionSource===`manual`&&!h.value.dependencyVersion?.trim()){z.warning(Q(`@NODECFG:请输入依赖包版本号`));return}if(h.value.versionSource===`reference`&&!h.value.inputRef){z.warning(Q(`@NODECFG:请选择要引用的节点输出`));return}if(h.value.versionSource===`input`&&!String(h.value.dependencyVersionInputKey||``).trim()){z.warning(Q(`@NODECFG:请选择要引用的输入字段`));return}}else if(h.value.versionSource===`input`&&!String(h.value.versionInputKey||``).trim()){z.warning(Q(`@NODECFG:请选择要引用的输入字段`));return}e={id:a.node.data.config?.id||G(),nodeId:a.node.id,type:`version`,displayName:h.value.nodeName?.trim()||void 0,versionTarget:h.value.versionTarget||`version`,versionBump:h.value.versionSource===`bump`?h.value.versionBump||`patch`:void 0,packageJsonPath:h.value.packageJsonPath?.trim()||void 0,dependencyName:h.value.versionTarget===`dependency`?h.value.dependencyName?.trim():void 0,dependencyVersion:h.value.versionTarget===`dependency`&&h.value.versionSource===`manual`?h.value.dependencyVersion?.trim():void 0,dependencyVersionBump:h.value.versionTarget===`dependency`&&h.value.versionSource===`bump`?h.value.dependencyVersionBump:void 0,dependencyType:h.value.versionTarget===`dependency`?h.value.dependencyType:void 0,versionInputs:O(h.value.versionInputs),versionSource:h.value.versionSource,inputRef:h.value.versionSource===`reference`?h.value.inputRef:void 0,extractVersionFromRefOutput:h.value.versionSource===`reference`?h.value.extractVersionFromRefOutput??!0:void 0,versionInputKey:h.value.versionSource===`input`&&h.value.versionTarget!==`dependency`&&String(h.value.versionInputKey||``).trim()||void 0,dependencyVersionInputKey:h.value.versionSource===`input`&&h.value.versionTarget===`dependency`&&String(h.value.dependencyVersionInputKey||``).trim()||void 0,enabled:h.value.enabled??!0}}else if(a.node.type===`code`){if(!h.value.codeScript||!String(h.value.codeScript).trim()){z.warning(Q(`@NODECFG:请输入脚本`));return}let t=O(h.value.codeInputs);for(let e of Array.isArray(t)?t:[]){if(!e||!e.required)continue;let t=String(e.name||``).trim()||Q(`@NODECFG:参数名`);if(e.source===`reference`){let n=String(e.ref?.nodeId||``).trim(),r=String(e.ref?.outputKey||``).trim();if(!n||!r){z.warning(Q(`@NODECFG:必填参数未选择引用输出`,{name:t}));return}}else{let n=e.manualValue;if(n==null||String(n).trim()===``){z.warning(Q(`@NODECFG:请输入必填参数的值`,{name:t}));return}}}let n=N(h.value.codeOutputParams);if(n.length===0){z.warning(Q(`@NODECFG:请配置输出键`));return}let r=n.map(e=>e.key);e={id:a.node.data.config?.id||G(),nodeId:a.node.id,type:`code`,displayName:h.value.nodeName?.trim()||void 0,codeScript:h.value.codeScript,codeInputs:t,codeOutputParams:n,codeOutputKeys:r,enabled:h.value.enabled??!0}}else if(a.node.type===`confirm`)e={id:a.node.data.config?.id||G(),nodeId:a.node.id,type:`confirm`,displayName:h.value.nodeName?.trim()||void 0,enabled:h.value.enabled??!0};else if(a.node.type===`condition`){let t=x(h.value.conditionBranches);if(!t.some(e=>e.handleId==="default"||e.isDefault)){z.warning(Q(`@COND:请至少保留一个默认分支`));return}for(let e of t)if(e.isDefault&&e.handleId!=="default"){z.warning(Q(`@COND:默认分支必须使用handleId=default`));return}e={id:a.node.data.config?.id||G(),nodeId:a.node.id,type:`condition`,displayName:h.value.nodeName?.trim()||void 0,conditionBranches:t,enabled:h.value.enabled??!0}}else if(a.node.type===`user_input`){let t=(Array.isArray(h.value.userInputParams)?h.value.userInputParams:[]).map(e=>({name:String(e?.name||``).trim(),source:e?.source===`reference`?`reference`:`manual`,required:!!e?.required,defaultValue:e?.defaultValue===void 0||e?.defaultValue===null?``:String(e.defaultValue),ref:e?.ref?{nodeId:String(e.ref.nodeId||``),outputKey:String(e.ref.outputKey||`stdout`)}:void 0})).filter(e=>!!e.name),n=new Set,r=[];for(let e of t)e.name&&(n.has(e.name)||(n.add(e.name),r.push(e)));for(let e of r)if(e.required&&e.source===`reference`){let t=String(e?.ref?.nodeId||``).trim(),n=String(e?.ref?.outputKey||``).trim();if(!t||!n){z.warning(Q(`@NODECFG:必填参数未选择引用输出`,{name:e.name}));return}}e={id:a.node.data.config?.id||G(),nodeId:a.node.id,type:`user_input`,displayName:h.value.nodeName?.trim()||void 0,userInputParams:r,enabled:h.value.enabled??!0}}e&&(o(`update-config`,a.node.id,e),z.success(Q(`@NODECFG:节点配置已保存`)),d.value=!1)}let q={codeScriptExample:Wt,codeScriptExamples:r,applyCodeExample:i,props:a,emit:o,openCommandManager:c,configStore:l,dialogTitle:u,visible:d,codeInputRef:f,versionInputRef:p,userInputRef:m,formData:h,userInputOutputParams:g,availableVersionInputKeys:_,ensureDefaultVersionInputKey:v,ensureDefaultDependencyVersionInputKey:b,createDefaultBranch:ee,normalizeBranches:x,createRule:S,addBranch:C,removeBranch:w,addRuleRow:T,removeRuleRow:E,normalizeCodeInputs:O,getVersionFieldInput:k,upsertVersionFieldInput:A,removeVersionFieldInput:j,getVersionFieldRefValue:M,handleVersionFieldRefSelect:ne,normalizeCodeOutputs:N,createCodeOutputParam:F,addCodeOutputRow:I,availableDependencies:re,availableCommands:L,currentCommandVariables:R,predecessorNodes:B,getNodeOutputOptions:oe,getNodeDisplayName:V,ensureCommandOutputParams:H,loadDependenciesFromPackageJson:U,handlePackageFileChange:ce,selectCommand:le,generateId:G,saveConfig:K,get Clock(){return P},get DocumentAdd(){return ie},get Link(){return ae},get Folder(){return D},get Select(){return y},get Plus(){return fe},get Delete(){return se},get Minus(){return te},CommonDialog:_e,PackageJsonSelector:Ge,NodeInputConfig:gt,CodeNodeInputConfig:kt,UserInputParamConfig:Ut,ParamListContainer:nt,SvgIcon:he,get $t(){return Q}};return Object.defineProperty(q,"__isScriptSetup",{enumerable:!1,value:!0}),q}});k(),g();var Kt={key:0,class:`config-content`},qt={class:`config-section`},Jt={class:`section-title`},Yt={key:0,class:`config-section`},Xt={class:`section-title`},Zt={key:1,class:`config-section`},Qt={class:`section-title`},$t={class:`sub-section`},en={class:`sub-title`},tn={key:0,class:`empty-tip`},nn={key:1,class:`condition-branch-list`},rn={class:`branch-main`},an={class:`branch-header`},on={class:`branch-title`},sn={key:0,class:`branch-badge`},cn={class:`branch-meta`},ln={key:0,class:`branch-rules`},un={class:`rules-header`},dn={class:`rule-col`},fn={class:`field-label`},pn={class:`rule-col`},mn={class:`field-label`},hn={class:`rule-col`},gn={class:`field-label`},_n={class:`rule-col`,style:{"align-self":`flex-end`}},vn={key:1,class:`branch-default-tip`},yn={key:0,class:`branch-actions`},bn={key:2,class:`config-section`},xn={class:`section-title`},Sn={key:3,class:`config-section`},Cn={class:`section-title`},wn={key:4,class:`config-section`},Tn={class:`section-title`},En={key:5,class:`config-section`},Dn={class:`section-title`},On={key:6,class:`config-section`},kn={class:`section-title`},An={class:`output-param-row`},jn={class:`output-param-field`},Mn={class:`field-label`},Nn={key:7,class:`config-section`},Pn={class:`section-title`},Fn={key:0,class:`empty-tip`},In={key:1,class:`command-list`},Ln=[`onClick`],Rn={class:`command-info`},zn={class:`command-header`},Bn={class:`command-name`},Vn={key:0,class:`command-desc`},Hn={class:`command-code`},Un={class:`command-dir`},Wn={key:8,class:`config-section`},Gn={class:`section-title`},Kn={style:{"margin-left":`var(--spacing-md)`}},qn={key:9,class:`config-section`},Jn={class:`section-title`},Yn={class:`sub-section`},Xn={class:`sub-title`},Zn={class:`code-examples`},Qn={class:`examples-title`},$n={class:`examples-actions`},er={key:10,class:`config-section`},tr={class:`section-title`},nr={class:`reference-tip`},rr={class:`reference-tip`},ir={class:`node-option`},ar={class:`node-name`},or={class:`node-id`},sr={class:`reference-tip`},cr={class:`reference-tip`},lr={key:11,class:`config-section`},ur={class:`section-title`},dr={class:`output-param-row`},fr={class:`output-param-field`},pr={class:`field-label`},mr={class:`output-param-field`},hr={class:`field-label`},gr={key:12,class:`config-section`},_r={class:`section-title`},vr={class:`output-param-row`},yr={class:`output-param-field`},br={class:`field-label`},xr={class:`output-param-field`},Sr={class:`field-label`},Cr={class:`dialog-footer`},wr={class:`footer-actions`};function Tr(e,t,i,a,s,c){let f=_,p=O,m=v,g=H,y=d,b=de,te=ue,T=n,D=ee,k=l,j=h,ne=x,N=A,P=I;return w(),S(a.CommonDialog,{modelValue:a.visible,"onUpdate:modelValue":t[35]||=e=>a.visible=e,title:a.dialogTitle,size:`extra-large`,"append-to-body":!0,"z-index":8e5,"custom-class":`node-config-dialog`},{footer:V(()=>[o(`div`,Cr,[o(`div`,wr,[o(`button`,{type:`button`,class:`dialog-cancel-btn`,onClick:t[34]||=e=>a.visible=!1},G(a.$t(`@NODECFG:取消`)),1),o(`button`,{type:`button`,class:`dialog-confirm-btn`,onClick:a.saveConfig},[u(f,null,{default:V(()=>[u(a.Select)]),_:1}),o(`span`,null,G(a.$t(`@NODECFG:保存配置`)),1)])])])]),default:V(()=>[i.node?(w(),r(`div`,Kt,[B(` 通用配置 `),o(`div`,qt,[o(`div`,Jt,[u(f,null,{default:V(()=>[u(a.Select)]),_:1}),C(` `+G(a.$t(`@NODECFG:通用设置`)),1)]),u(y,{"label-width":`120px`},{default:V(()=>[u(m,{label:a.$t(`@NODECFG:节点名称`)},{default:V(()=>[u(p,{modelValue:a.formData.nodeName,"onUpdate:modelValue":t[0]||=e=>a.formData.nodeName=e,placeholder:a.$t(`@NODECFG:请输入节点名称`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),u(m,{label:a.$t(`@NODECFG:启用节点`)},{default:V(()=>[u(g,{modelValue:a.formData.enabled,"onUpdate:modelValue":t[1]||=e=>a.formData.enabled=e},null,8,[`modelValue`])]),_:1},8,[`label`])]),_:1})]),B(` 版本节点输入参数配置(同代码节点) `),i.node?.type===`version`?(w(),r(`div`,Yt,[o(`div`,Xt,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),C(` `+G(a.$t(`@NODECFG:输入配置`))+` `,1),u(b,{type:`primary`,plain:``,icon:a.Plus,style:{"margin-left":`auto`},onClick:t[2]||=e=>a.versionInputRef?.addRow()},null,8,[`icon`])]),u(a.CodeNodeInputConfig,{ref:`versionInputRef`,"model-value":a.formData.versionInputs||[],"onUpdate:modelValue":t[3]||=e=>a.formData.versionInputs=e,"predecessor-nodes":a.predecessorNodes,title:void 0,addable:!1},null,8,[`model-value`,`predecessor-nodes`])])):B(`v-if`,!0),B(` 条件节点配置 `),i.node?.type===`condition`?(w(),r(`div`,Zt,[o(`div`,Qt,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),C(` `+G(a.$t(`@COND:条件配置`))+` `,1),u(b,{class:`icon-btn`,type:`primary`,plain:``,circle:``,icon:a.Plus,style:{"margin-left":`auto`},title:a.$t(`@COND:添加分支`),onClick:a.addBranch},null,8,[`icon`,`title`])]),o(`div`,$t,[o(`div`,en,[o(`span`,null,G(a.$t(`@COND:分支列表`)),1)]),!a.formData.conditionBranches||a.formData.conditionBranches.length===0?(w(),r(`div`,tn,G(a.$t(`@COND:请至少保留一个默认分支`)),1)):(w(),r(`div`,nn,[(w(!0),r(E,null,R(a.formData.conditionBranches,e=>(w(),r(`div`,{key:e.id,class:`condition-branch-card`},[o(`div`,rn,[o(`div`,an,[o(`div`,on,[e.handleId==="default"||e.isDefault?(w(),r(`span`,sn,G(a.$t(`@COND:默认分支`)),1)):B(`v-if`,!0),u(p,{modelValue:e.name,"onUpdate:modelValue":t=>e.name=t,size:`small`,disabled:e.handleId==="default"||e.isDefault,placeholder:a.$t(`@COND:分支名称`)},null,8,[`modelValue`,`onUpdate:modelValue`,`disabled`,`placeholder`])])]),o(`div`,cn,[u(y,{"label-width":`80px`},{default:V(()=>[u(m,{label:a.$t(`@COND:优先级`)},{default:V(()=>[u(te,{modelValue:e.priority,"onUpdate:modelValue":t=>e.priority=t,min:0,max:9999,size:`small`},null,8,[`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`label`]),u(m,{label:a.$t(`@COND:规则组合`)},{default:V(()=>[u(D,{modelValue:e.combine,"onUpdate:modelValue":t=>e.combine=t,size:`small`},{default:V(()=>[u(T,{value:`all`},{default:V(()=>[C(G(a.$t(`@COND:且(ALL)`)),1)]),_:1}),u(T,{value:`any`},{default:V(()=>[C(G(a.$t(`@COND:或(ANY)`)),1)]),_:1})]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),_:2},1032,[`label`])]),_:2},1024)]),e.handleId!=="default"&&!e.isDefault?(w(),r(`div`,ln,[o(`div`,un,[o(`span`,null,G(a.$t(`@COND:规则`)),1),u(b,{class:`icon-btn`,type:`primary`,plain:``,circle:``,icon:a.Plus,title:a.$t(`@COND:添加规则`),onClick:t=>a.addRuleRow(e.id)},null,8,[`icon`,`title`,`onClick`])]),(w(!0),r(E,null,R(e.rules,(t,n)=>(w(),r(`div`,{key:n,class:`rule-row`},[o(`div`,dn,[o(`div`,fn,G(a.$t(`@COND:左值(引用输出)`)),1),u(j,{modelValue:t.left.nodeId,"onUpdate:modelValue":e=>t.left.nodeId=e,filterable:``,clearable:``,size:`small`,style:{width:`100%`},placeholder:a.$t(`@NODECFG:引用节点`)},{default:V(()=>[(w(!0),r(E,null,R(a.predecessorNodes,e=>(w(),S(k,{key:e.id,label:a.getNodeDisplayName(e),value:e.id},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`onUpdate:modelValue`,`placeholder`]),u(j,{modelValue:t.left.outputKey,"onUpdate:modelValue":e=>t.left.outputKey=e,filterable:``,size:`small`,style:{width:`100%`,"margin-top":`6px`},placeholder:a.$t(`@NODECFG:输出`)},{default:V(()=>[(w(!0),r(E,null,R(a.getNodeOutputOptions(a.predecessorNodes.find(e=>e.id===t.left.nodeId)),e=>(w(),S(k,{key:e.key,label:e.label,value:e.key},null,8,[`label`,`value`]))),128))]),_:2},1032,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),o(`div`,pn,[o(`div`,mn,G(a.$t(`@COND:操作符`)),1),u(j,{modelValue:t.op,"onUpdate:modelValue":e=>t.op=e,size:`small`,style:{width:`100%`}},{default:V(()=>[u(k,{label:`==`,value:`==`}),u(k,{label:`!=`,value:`!=`}),u(k,{label:`>`,value:`>`}),u(k,{label:`>=`,value:`>=`}),u(k,{label:`<`,value:`<`}),u(k,{label:`<=`,value:`<=`}),u(k,{label:`contains`,value:`contains`}),u(k,{label:`not_contains`,value:`not_contains`}),u(k,{label:`isEmpty`,value:`isEmpty`}),u(k,{label:`isNotEmpty`,value:`isNotEmpty`})]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),o(`div`,hn,[o(`div`,gn,G(a.$t(`@COND:右值`)),1),u(p,{modelValue:t.right,"onUpdate:modelValue":e=>t.right=e,size:`small`,disabled:t.op===`isEmpty`||t.op===`isNotEmpty`},null,8,[`modelValue`,`onUpdate:modelValue`,`disabled`])]),o(`div`,_n,[u(b,{class:`icon-btn`,type:`danger`,plain:``,circle:``,icon:a.Minus,title:a.$t(`@COND:删除规则`),onClick:t=>a.removeRuleRow(e.id,n)},null,8,[`icon`,`title`,`onClick`])])]))),128))])):(w(),r(`div`,vn,G(a.$t(`@COND:默认分支`))+`:不配置规则,未命中其它分支时走这里 `,1))]),e.handleId==="default"||e.isDefault?B(`v-if`,!0):(w(),r(`div`,yn,[u(b,{class:`icon-btn`,type:`danger`,plain:``,circle:``,icon:a.Delete,title:a.$t(`@COND:删除分支`),onClick:t=>a.removeBranch(e.id)},null,8,[`icon`,`title`,`onClick`])]))]))),128))]))])])):B(`v-if`,!0),i.node?.type===`command`?(w(),r(`div`,bn,[o(`div`,xn,[u(f,null,{default:V(()=>[u(a.Select)]),_:1}),C(` `+G(a.$t(`@NODECFG:执行方式`)),1)]),u(y,{"label-width":`120px`},{default:V(()=>[u(m,{label:a.$t(`@NODECFG:执行方式`)},{default:V(()=>[u(D,{modelValue:a.formData.useTerminal,"onUpdate:modelValue":t[4]||=e=>a.formData.useTerminal=e},{default:V(()=>[u(T,{value:!1},{default:V(()=>[C(G(a.$t(`@NODECFG:普通执行`)),1)]),_:1}),u(T,{value:!0},{default:V(()=>[C(G(a.$t(`@NODECFG:终端执行`)),1)]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),a.formData.useTerminal?(w(),S(m,{key:0,label:a.$t(`@NODECFG:终端选项`)},{default:V(()=>[u(ne,{modelValue:a.formData.restartExistingTerminal,"onUpdate:modelValue":t[5]||=e=>a.formData.restartExistingTerminal=e},{default:V(()=>[C(G(a.$t(`@NODECFG:重启现存终端命令`)),1)]),_:1},8,[`modelValue`])]),_:1},8,[`label`])):B(`v-if`,!0)]),_:1})])):B(`v-if`,!0),B(` 命令输入参数配置(独立版块) `),i.node?.type===`command`&&a.formData.commandId&&a.formData.inputs?(w(),r(`div`,Sn,[o(`div`,Cn,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),C(` `+G(a.$t(`@NODECFG:输入配置`)),1)]),u(a.NodeInputConfig,{modelValue:a.formData.inputs,"onUpdate:modelValue":t[6]||=e=>a.formData.inputs=e,"param-names":a.currentCommandVariables,"disable-param-name-edit":!0,"predecessor-nodes":a.predecessorNodes},null,8,[`modelValue`,`param-names`,`predecessor-nodes`])])):B(`v-if`,!0),B(` 代码节点输入参数配置(节点级独立版块) `),i.node?.type===`code`?(w(),r(`div`,wn,[o(`div`,Tn,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),C(` `+G(a.$t(`@NODECFG:输入配置`))+` `,1),u(b,{type:`primary`,plain:``,icon:a.Plus,style:{"margin-left":`auto`},onClick:t[7]||=e=>a.codeInputRef?.addRow()},null,8,[`icon`])]),u(a.CodeNodeInputConfig,{ref:`codeInputRef`,"model-value":a.formData.codeInputs||[],"onUpdate:modelValue":t[8]||=e=>a.formData.codeInputs=e,"predecessor-nodes":a.predecessorNodes,title:void 0,addable:!1},null,8,[`model-value`,`predecessor-nodes`])])):B(`v-if`,!0),B(` 用户输入节点参数配置(节点级独立版块) `),i.node?.type===`user_input`?(w(),r(`div`,En,[o(`div`,Dn,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),C(` `+G(a.$t(`@NODECFG:输入配置`))+` `,1),u(b,{type:`primary`,plain:``,icon:a.Plus,style:{"margin-left":`auto`},onClick:t[9]||=e=>a.userInputRef?.addRow()},null,8,[`icon`])]),u(a.UserInputParamConfig,{ref:`userInputRef`,"model-value":a.formData.userInputParams||[],"onUpdate:modelValue":t[10]||=e=>a.formData.userInputParams=e,"predecessor-nodes":a.predecessorNodes,title:void 0,addable:!1},null,8,[`model-value`,`predecessor-nodes`])])):B(`v-if`,!0),B(` 用户输入节点输出配置(字段与输入一致,禁用) `),i.node?.type===`user_input`?(w(),r(`div`,On,[o(`div`,kn,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),C(` `+G(a.$t(`@NODECFG:输出配置`)),1)]),u(a.ParamListContainer,{"model-value":a.userInputOutputParams,title:void 0,addable:!1,removable:!1},{empty:V(()=>[C(G(a.$t(`@NODECFG:暂无输出参数`)||``),1)]),row:V(({item:e})=>[o(`div`,An,[o(`div`,jn,[o(`label`,Mn,G(a.$t(`@NODECFG:参数名`)),1),u(p,{"model-value":e.key,disabled:``},null,8,[`model-value`])])])]),_:1},8,[`model-value`])])):B(`v-if`,!0),B(` 命令节点配置 `),i.node?.type===`command`?(w(),r(`div`,Nn,[o(`div`,Pn,[u(f,null,{default:V(()=>[u(a.SvgIcon,{"icon-class":`custom-cmd`})]),_:1}),C(` `+G(a.$t(`@NODECFG:命令配置`))+` `,1),u(b,{type:`primary`,plain:``,size:`small`,style:{"margin-left":`auto`},onClick:a.openCommandManager},{default:V(()=>[C(G(a.$t(`@NODECFG:管理命令`)),1)]),_:1})]),u(y,{"label-width":`100px`},{default:V(()=>[u(m,{label:a.$t(`@NODECFG:选择命令`),required:``},{default:V(()=>[a.availableCommands.length===0?(w(),r(`div`,Fn,G(a.$t(`@NODECFG:暂无可用命令请先创建命令`)),1)):(w(),r(`div`,In,[(w(!0),r(E,null,R(a.availableCommands,e=>(w(),r(`div`,{key:e.id,class:M([`command-item`,{selected:a.formData.commandId===e.id}]),onClick:t=>a.selectCommand(e)},[o(`div`,Rn,[o(`div`,zn,[o(`span`,Bn,G(e.name),1),e.description?(w(),r(`span`,Vn,G(e.description),1)):B(`v-if`,!0)]),o(`code`,Hn,G(e.command),1),o(`div`,Un,[u(f,null,{default:V(()=>[u(a.Folder)]),_:1}),o(`span`,null,G(e.directory?e.directory.replace(/\\/g,`/`):a.$t(`@NODECFG:当前目录`)),1)])]),a.formData.commandId===e.id?(w(),S(f,{key:0,class:`check-icon`},{default:V(()=>[u(a.Select)]),_:1})):B(`v-if`,!0)],10,Ln))),128))]))]),_:1},8,[`label`])]),_:1})])):B(`v-if`,!0),B(` 等待节点配置 `),i.node?.type===`wait`?(w(),r(`div`,Wn,[o(`div`,Gn,[u(f,null,{default:V(()=>[u(a.Clock)]),_:1}),C(` `+G(a.$t(`@NODECFG:等待配置`)),1)]),u(y,{"label-width":`100px`},{default:V(()=>[u(m,{label:a.$t(`@NODECFG:等待时间`),required:``},{default:V(()=>[u(te,{modelValue:a.formData.waitSeconds,"onUpdate:modelValue":t[11]||=e=>a.formData.waitSeconds=e,min:1,max:3600,step:1},null,8,[`modelValue`]),o(`span`,Kn,G(a.$t(`@NODECFG:秒`)),1)]),_:1},8,[`label`])]),_:1})])):B(`v-if`,!0),i.node?.type===`code`?(w(),r(`div`,qn,[o(`div`,Jn,[u(f,null,{default:V(()=>[u(a.DocumentAdd)]),_:1}),C(` `+G(a.$t(`@NODECFG:代码配置`)),1)]),o(`div`,Yn,[o(`div`,Xn,[o(`span`,null,G(a.$t(`@NODECFG:代码`)),1)]),u(p,{modelValue:a.formData.codeScript,"onUpdate:modelValue":t[12]||=e=>a.formData.codeScript=e,type:`textarea`,rows:10,placeholder:a.codeScriptExample},null,8,[`modelValue`]),o(`div`,Zn,[o(`div`,Qn,G(a.$t(`@NODECFG:示例代码`)),1),o(`div`,$n,[(w(),r(E,null,R(a.codeScriptExamples,e=>u(b,{key:e.key,type:`primary`,plain:``,onClick:t=>a.applyCodeExample(e.script)},{default:V(()=>[C(G(e.title),1)]),_:2},1032,[`onClick`])),64))])])])])):B(`v-if`,!0),B(` 版本节点配置 `),i.node?.type===`version`?(w(),r(`div`,er,[o(`div`,tr,[u(f,null,{default:V(()=>[u(a.DocumentAdd)]),_:1}),C(` `+G(a.$t(`@NODECFG:版本配置`)),1)]),u(y,{"label-width":`120px`},{default:V(()=>[u(m,{label:a.$t(`@NODECFG:package.json`)},{default:V(()=>[u(a.PackageJsonSelector,{modelValue:a.formData.packageJsonPath,"onUpdate:modelValue":t[13]||=e=>a.formData.packageJsonPath=e,placeholder:a.$t(`@NODECFG:留空则使用当前目录的package.json`),clearable:``,onChange:a.handlePackageFileChange},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),u(m,{label:a.$t(`@NODECFG:修改目标`),required:``},{default:V(()=>[u(D,{modelValue:a.formData.versionTarget,"onUpdate:modelValue":t[14]||=e=>a.formData.versionTarget=e},{default:V(()=>[u(T,{value:`version`},{default:V(()=>[C(G(a.$t(`@NODECFG:version字段`)),1)]),_:1}),u(T,{value:`dependency`},{default:V(()=>[C(G(a.$t(`@NODECFG:dependencies中的依赖`)),1)]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),B(` version 字段配置 `),a.formData.versionTarget===`version`?(w(),r(E,{key:0},[u(m,{label:a.$t(`@NODECFG:版本号来源`),required:``},{default:V(()=>[u(D,{modelValue:a.formData.versionSource,"onUpdate:modelValue":t[15]||=e=>a.formData.versionSource=e,onChange:t[16]||=e=>{e===`bump`?a.removeVersionFieldInput():e===`manual`?a.upsertVersionFieldInput({source:`manual`,manualValue:a.getVersionFieldInput(a.formData.versionInputs)?.manualValue??``}):e===`reference`?a.upsertVersionFieldInput({source:`reference`,ref:a.getVersionFieldInput(a.formData.versionInputs)?.ref||{nodeId:``,outputKey:`stdout`}}):e===`input`&&a.ensureDefaultVersionInputKey()}},{default:V(()=>[u(T,{value:`bump`},{default:V(()=>[C(G(a.$t(`@NODECFG:自动递增`)),1)]),_:1}),u(T,{value:`manual`},{default:V(()=>[C(G(a.$t(`@NODECFG:手动输入`)),1)]),_:1}),u(T,{value:`reference`,disabled:a.predecessorNodes.length===0},{default:V(()=>[C(G(a.$t(`@NODECFG:引用输出`))+` `,1),a.predecessorNodes.length===0?(w(),S(N,{key:0,content:a.$t(`@NODECFG:无可用的前置命令节点`),placement:`top`},{default:V(()=>[u(f,{style:{"margin-left":`4px`}},{default:V(()=>[u(a.Link)]),_:1})]),_:1},8,[`content`])):B(`v-if`,!0)]),_:1},8,[`disabled`]),u(T,{value:`input`,disabled:a.availableVersionInputKeys.length===0},{default:V(()=>[C(G(a.$t(`@NODECFG:引用输入`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),a.formData.versionSource===`bump`?(w(),S(m,{key:0,label:a.$t(`@NODECFG:版本增量类型`),required:``},{default:V(()=>[u(D,{modelValue:a.formData.versionBump,"onUpdate:modelValue":t[17]||=e=>a.formData.versionBump=e},{default:V(()=>[u(T,{value:`patch`},{default:V(()=>[C(G(a.$t(`@NODECFG:补丁版本x.x.+1`)),1)]),_:1}),u(T,{value:`minor`},{default:V(()=>[C(G(a.$t(`@NODECFG:次版本x.+1.0`)),1)]),_:1}),u(T,{value:`major`},{default:V(()=>[C(G(a.$t(`@NODECFG:主版本+1.0.0`)),1)]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`])):B(`v-if`,!0),a.formData.versionSource===`manual`?(w(),S(m,{key:1,label:a.$t(`@NODECFG:版本号`),required:``},{default:V(()=>[u(p,{"model-value":a.getVersionFieldInput(a.formData.versionInputs)?.manualValue,placeholder:a.$t(`@NODECFG:例如1.2.3`),"onUpdate:modelValue":t[18]||=e=>a.upsertVersionFieldInput({source:`manual`,manualValue:e})},null,8,[`model-value`,`placeholder`])]),_:1},8,[`label`])):B(`v-if`,!0),a.formData.versionSource===`reference`?(w(),r(E,{key:2},[u(m,{label:a.$t(`@NODECFG:引用节点`),required:``},{default:V(()=>[u(P,{"model-value":a.getVersionFieldRefValue(a.getVersionFieldInput(a.formData.versionInputs)),data:a.predecessorNodes.map(e=>({value:e.id,label:a.getNodeDisplayName(e),children:a.getNodeOutputOptions(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})),placeholder:a.$t(`@NODECFG:选择要引用的前置节点`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":t[19]||=e=>a.handleVersionFieldRefSelect(e)},null,8,[`model-value`,`data`,`placeholder`])]),_:1},8,[`label`]),u(m,{label:a.$t(`@NODECFG:提取版本号`)},{default:V(()=>[u(g,{modelValue:a.formData.extractVersionFromRefOutput,"onUpdate:modelValue":t[20]||=e=>a.formData.extractVersionFromRefOutput=e},null,8,[`modelValue`])]),_:1},8,[`label`]),o(`div`,nr,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),o(`span`,null,G(a.$t(`@NODECFG:版本号将使用所选节点的输出结果`)),1)])],64)):B(`v-if`,!0),a.formData.versionSource===`input`?(w(),r(E,{key:3},[u(m,{label:a.$t(`@NODECFG:引用输入`),required:``},{default:V(()=>[u(j,{modelValue:a.formData.versionInputKey,"onUpdate:modelValue":t[21]||=e=>a.formData.versionInputKey=e,filterable:``,clearable:``,style:{width:`100%`},placeholder:a.$t(`@NODECFG:选择要引用的输入字段`),onChange:a.ensureDefaultVersionInputKey},{default:V(()=>[(w(!0),r(E,null,R(a.availableVersionInputKeys,e=>(w(),S(k,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),o(`div`,rr,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),o(`span`,null,G(a.$t(`@NODECFG:版本号将使用本节点输入参数的值`)),1)])],64)):B(`v-if`,!0)],64)):B(`v-if`,!0),B(` dependency 配置 `),a.formData.versionTarget===`dependency`?(w(),r(E,{key:1},[u(m,{label:a.$t(`@NODECFG:依赖类型`),required:``},{default:V(()=>[u(D,{modelValue:a.formData.dependencyType,"onUpdate:modelValue":t[22]||=e=>a.formData.dependencyType=e},{default:V(()=>[u(T,{value:`dependencies`},{default:V(()=>[...t[36]||=[C(`dependencies`,-1)]]),_:1}),u(T,{value:`devDependencies`},{default:V(()=>[...t[37]||=[C(`devDependencies`,-1)]]),_:1}),u(T,{value:`peerDependencies`},{default:V(()=>[...t[38]||=[C(`peerDependencies`,-1)]]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),u(m,{label:a.$t(`@NODECFG:依赖包名称`),required:``},{default:V(()=>[u(j,{modelValue:a.formData.dependencyName,"onUpdate:modelValue":t[23]||=e=>a.formData.dependencyName=e,placeholder:a.$t(`@NODECFG:请先选择package.json`),clearable:``,filterable:``,"allow-create":``,style:{width:`100%`}},{default:V(()=>[(w(!0),r(E,null,R(a.availableDependencies,e=>(w(),S(k,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),u(m,{label:a.$t(`@NODECFG:版本号来源`),required:``},{default:V(()=>[u(D,{modelValue:a.formData.versionSource,"onUpdate:modelValue":t[24]||=e=>a.formData.versionSource=e,onChange:t[25]||=e=>{e===`input`&&a.ensureDefaultDependencyVersionInputKey()}},{default:V(()=>[u(T,{value:`bump`},{default:V(()=>[C(G(a.$t(`@NODECFG:自动递增`)),1)]),_:1}),u(T,{value:`manual`},{default:V(()=>[C(G(a.$t(`@NODECFG:手动输入`)),1)]),_:1}),u(T,{value:`reference`,disabled:a.predecessorNodes.length===0},{default:V(()=>[C(G(a.$t(`@NODECFG:引用输出`))+` `,1),a.predecessorNodes.length===0?(w(),S(N,{key:0,content:a.$t(`@NODECFG:无可用的前置命令节点`),placement:`top`},{default:V(()=>[u(f,{style:{"margin-left":`4px`}},{default:V(()=>[u(a.Link)]),_:1})]),_:1},8,[`content`])):B(`v-if`,!0)]),_:1},8,[`disabled`]),u(T,{value:`input`,disabled:a.availableVersionInputKeys.length===0},{default:V(()=>[C(G(a.$t(`@NODECFG:引用输入`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`modelValue`])]),_:1},8,[`label`]),a.formData.versionSource===`bump`?(w(),S(m,{key:0,label:a.$t(`@NODECFG:递增类型`),required:``},{default:V(()=>[u(D,{modelValue:a.formData.dependencyVersionBump,"onUpdate:modelValue":t[26]||=e=>a.formData.dependencyVersionBump=e},{default:V(()=>[u(T,{value:`patch`},{default:V(()=>[C(G(a.$t(`@NODECFG:补丁版本`)),1)]),_:1}),u(T,{value:`minor`},{default:V(()=>[C(G(a.$t(`@NODECFG:次版本`)),1)]),_:1}),u(T,{value:`major`},{default:V(()=>[C(G(a.$t(`@NODECFG:主版本`)),1)]),_:1})]),_:1},8,[`modelValue`])]),_:1},8,[`label`])):B(`v-if`,!0),a.formData.versionSource===`manual`?(w(),S(m,{key:1,label:a.$t(`@NODECFG:版本号`),required:``},{default:V(()=>[u(p,{modelValue:a.formData.dependencyVersion,"onUpdate:modelValue":t[27]||=e=>a.formData.dependencyVersion=e,placeholder:a.$t(`@NODECFG:例如1.2.3`)},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):B(`v-if`,!0),B(` 引用输出配置 `),a.formData.versionSource===`reference`?(w(),r(E,{key:2},[u(m,{label:a.$t(`@NODECFG:引用节点`),required:``},{default:V(()=>[u(j,{modelValue:a.formData.inputRef,"onUpdate:modelValue":t[28]||=e=>a.formData.inputRef=e,"value-key":`nodeId`,placeholder:a.$t(`@NODECFG:选择要引用的前置节点`),style:{width:`100%`}},{default:V(()=>[(w(!0),r(E,null,R(a.predecessorNodes,e=>(w(),S(k,{key:e.id,label:a.getNodeDisplayName(e),value:{nodeId:e.id,outputKey:`stdout`}},{default:V(()=>[o(`div`,ir,[o(`span`,ar,G(a.getNodeDisplayName(e)),1),o(`span`,or,G(a.$t(`@NODECFG:ID`))+`: `+G(e.id.substring(0,15))+`...`,1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),a.formData.inputRef?(w(),S(m,{key:0,label:a.$t(`@NODECFG:输出字段`),required:``},{default:V(()=>[u(j,{modelValue:a.formData.inputRef.outputKey,"onUpdate:modelValue":t[29]||=e=>a.formData.inputRef.outputKey=e,placeholder:a.$t(`@NODECFG:选择要引用的输出字段`),style:{width:`100%`}},{default:V(()=>[(w(!0),r(E,null,R(a.getNodeOutputOptions(a.predecessorNodes.find(e=>e.id===a.formData.inputRef?.nodeId)),e=>(w(),S(k,{key:e.key,label:e.label,value:e.key},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),_:1},8,[`label`])):B(`v-if`,!0),a.formData.inputRef?(w(),S(m,{key:1,label:a.$t(`@NODECFG:提取版本号`)},{default:V(()=>[u(g,{modelValue:a.formData.extractVersionFromRefOutput,"onUpdate:modelValue":t[30]||=e=>a.formData.extractVersionFromRefOutput=e},null,8,[`modelValue`])]),_:1},8,[`label`])):B(`v-if`,!0),o(`div`,sr,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),o(`span`,null,G(a.$t(`@NODECFG:版本号将使用所选节点的输出结果`)),1)])],64)):B(`v-if`,!0),a.formData.versionSource===`input`?(w(),r(E,{key:3},[u(m,{label:a.$t(`@NODECFG:引用输入`),required:``},{default:V(()=>[u(j,{modelValue:a.formData.dependencyVersionInputKey,"onUpdate:modelValue":t[31]||=e=>a.formData.dependencyVersionInputKey=e,filterable:``,clearable:``,style:{width:`100%`},placeholder:a.$t(`@NODECFG:选择要引用的输入字段`),onChange:a.ensureDefaultDependencyVersionInputKey},{default:V(()=>[(w(!0),r(E,null,R(a.availableVersionInputKeys,e=>(w(),S(k,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`])]),_:1},8,[`label`]),o(`div`,cr,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),o(`span`,null,G(a.$t(`@NODECFG:版本号将使用本节点输入参数的值`)),1)])],64)):B(`v-if`,!0)],64)):B(`v-if`,!0)]),_:1})])):B(`v-if`,!0),i.node?.type===`code`?(w(),r(`div`,lr,[o(`div`,ur,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),C(` `+G(a.$t(`@NODECFG:输出`))+` `,1),u(b,{type:`primary`,plain:``,icon:a.Plus,style:{"margin-left":`auto`},onClick:a.addCodeOutputRow},null,8,[`icon`])]),u(a.ParamListContainer,{"model-value":a.formData.codeOutputParams||[],title:void 0,addable:!1,removable:!0,"min-items":0,"create-item":a.createCodeOutputParam,"onUpdate:modelValue":t[32]||=e=>a.formData.codeOutputParams=e},{empty:V(()=>[C(G(a.$t(`@NODECFG:暂无输出参数`)||``),1)]),row:V(({item:e})=>[o(`div`,dr,[o(`div`,fr,[o(`label`,pr,G(a.$t(`@NODECFG:参数名`)),1),u(p,{modelValue:e.key,"onUpdate:modelValue":t=>e.key=t,placeholder:a.$t(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),o(`div`,mr,[o(`label`,hr,G(a.$t(`@NODECFG:参数类型`)),1),u(j,{modelValue:e.type,"onUpdate:modelValue":t=>e.type=t,style:{width:`180px`}},{default:V(()=>[u(k,{label:`String`,value:`String`}),u(k,{label:`Number`,value:`Number`}),u(k,{label:`Boolean`,value:`Boolean`}),u(k,{label:`JSON`,value:`JSON`})]),_:1},8,[`modelValue`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])):B(`v-if`,!0),i.node?.type===`command`?(w(),r(`div`,gr,[o(`div`,_r,[u(f,null,{default:V(()=>[u(a.Link)]),_:1}),C(` `+G(a.$t(`@NODECFG:输出配置`)),1)]),u(a.ParamListContainer,{"model-value":a.formData.commandOutputParams||[],title:void 0,addable:!1,removable:!1,"onUpdate:modelValue":t[33]||=e=>a.formData.commandOutputParams=e},{empty:V(()=>[C(G(a.$t(`@NODECFG:暂无输出参数`)||``),1)]),row:V(({item:e})=>[o(`div`,vr,[o(`div`,yr,[o(`label`,br,G(a.$t(`@NODECFG:参数名`)),1),u(p,{modelValue:e.key,"onUpdate:modelValue":t=>e.key=t,disabled:``},null,8,[`modelValue`,`onUpdate:modelValue`])]),o(`div`,xr,[o(`label`,Sr,G(a.$t(`@NODECFG:参数描述`)),1),u(p,{modelValue:e.desc,"onUpdate:modelValue":t=>e.desc=t,placeholder:a.$t(`@NODECFG:参数描述`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])])])]),_:1},8,[`model-value`])])):B(`v-if`,!0)])):B(`v-if`,!0)]),_:1},8,[`modelValue`,`title`])}var Er=$(Gt,[[`render`,Tr],[`__scopeId`,`data-v-e230c70f`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/flow/NodeConfigPanel.vue`]]);k(),U();var Dr=b({__name:`FlowOrchestrationWorkspace`,props:{visible:{type:Boolean,required:!0}},emits:[`update:visible`,`execute-flow`,`open-command-manager`],setup(e,{expose:n,emit:r}){n();let i=Symbol(`FLOW_NODE_ACTIONS`);function a(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``}}function o(e){return b({name:`FlowWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(t){let n=p(i,null),r=s(()=>{let e=t.data?.config,n=[...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 n.includes(`default`)||n.push(`default`),n.length?n:[`default`]});return()=>Z(Fe,{nodeId:t.id,onExecuteFromNode:e=>n?.executeFromNode(e),onExecuteSingleNode:e=>n?.executeSingleNode(e)},{default:()=>Z(Te,{id:t.id,nodeId:t.id,nodeType:t.data?.type,title:t.data?.label,icon:a(t.data?.type),enabled:t.data?.enabled??!0,selected:t.data?.selected??!1,sourceHandleIds:t.data?.type===`condition`?r.value:void 0,onDelete:e=>n?.deleteNode(e)},{default:()=>Z(e,{data:t.data,id:t.id})})})}})}let l=b({name:`FlowStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>Z(Te,{id:e.id,nodeId:e.id,nodeType:`start`,title:Q(`@FLOWNODE:开始`),icon:a(`start`),enabled:e.data?.enabled,selected:e.data?.selected,deletable:!1},{})}}),u={start:N(l),command:N(o(Ae)),wait:N(o(Oe)),version:N(o(we)),confirm:N(o(Ee)),code:N(o(ke)),condition:N(o(De)),user_input:N(o(je))},d=e,m=r,{t:h}=pe(),g=ge(),_=s({get:()=>d.visible,set:e=>m(`update:visible`,e)}),{onConnect:v,addEdges:ee,getViewport:x,setViewport:S,onNodeDragStart:C,onNodeDragStop:te,getSelectedEdges:w,updateNodeInternals:T}=ye(),E=X([]),D=X([]),O=X(``),k=X(``),A=X(null),M=X(!1),P=X(null),F=null,I=s(()=>g.orchestrations||[]),L=X(null),ie=1;function R(e){return`${e}-${Date.now()}-${ie++}`}function B(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ae(e){let t=String(e||``).trim()||h(`@ORCH:未命名`),n=new Set((Array.isArray(I.value)?I.value:[]).map(e=>String(e?.name||``).trim())),r=`${t}(复制)`;if(!n.has(r))return r;let i=2;for(;i<1e3;){let e=`${t}(复制${i})`;if(!n.has(e))return e;i+=1}return`${t}(复制${Date.now()})`}async function oe(e){try{let t={name:ae(e?.name),description:e?.description||``,flowData:e?.flowData?JSON.parse(JSON.stringify(e.flowData)):null},n=await g.saveOrchestration(t);n&&typeof n==`object`&&`id`in n&&(L.value=n.id,A.value=n.id,He(n),z.success(h(`@ORCH:已复制`)))}catch(e){z.error(`${h(`@ORCH:错误`)}: ${e?.message||e}`)}}function V(){return E.value.filter(e=>e.type!==`start`&&e.data?.config)}function H(e){return e===`version`?{w:250,h:120}:e===`wait`||e===`confirm`||e===`user_input`?{w:200,h:120}:e===`condition`?{w:260,h:160}:{w:220,h:120}}function U(e){let t=x(),n=document.querySelector(`.vue-flow-container`)?.getBoundingClientRect(),r=n?n.width/2:500,i=n?n.height/2:300,a=t.zoom||1,o=(r-t.x)/a,s=(i-t.y)/a,{w:c,h:l}=H(e);return{x:o-c/2,y:s-l/2}}function W(e,t){let n=E.value.filter(t=>t.type===e).map(e=>String(e?.data?.label||``).trim()).filter(e=>!!e),r=String(t||``).trim();if(!r)return r;let i=RegExp(`^${B(r)}(\\d+)?$`),a=-1;for(let e of n){let t=e.match(i);if(!t)continue;let n=t[1]?Number(t[1]):0;Number.isFinite(n)&&(a=Math.max(a,n))}return a<0?r:`${r}${a+1}`}function G(e){return e.map(e=>({id:e.id,type:e.type,position:e.position,data:e.data}))}function K(e){return e.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle}))}async function q(e){await f();let t=e&&e.length?e:E.value.map(e=>e.id);requestAnimationFrame(()=>{T(t)})}function J(){A.value&&O.value.trim()&&(F&&clearTimeout(F),F=window.setTimeout(()=>{Re()},1e3))}function Y(){E.value=[{id:`start-node`,type:`start`,position:{x:50,y:200},data:{id:`start-node`,type:`start`,label:h(`@FLOWNODE:开始`),enabled:!0}}],D.value=[],ie=1}function ue(e){let t=R(e),n={command:h(`@FLOWNODE:命令节点`),wait:h(`@FLOWNODE:等待节点`),version:h(`@FLOWNODE:版本管理`),confirm:h(`@FLOWNODE:用户确认`),code:h(`@FLOWNODE:代码节点`),condition:h(`@FLOWNODE:条件`),user_input:h(`@FLOWNODE:用户输入`)}[e],r=W(e,n),i=U(e),a={id:t,type:e,position:{x:i.x,y:i.y},data:{id:t,type:e,label:r,enabled:!0,config:e===`confirm`?{id:t,type:`confirm`}:e===`condition`?{id:t,type:`condition`,conditionBranches:[{id:`branch-${Date.now()}`,name:Q(`@COND:默认分支`),handleId:`default`,priority:999,combine:`all`,rules:[],isDefault:!0}]}:e===`user_input`?{id:t,type:`user_input`,userInputParams:[]}:void 0}};E.value.push(a),E.value.forEach(e=>{e.data&&(e.data.selected=!1)}),a.data&&(a.data.selected=!0),P.value=a,M.value=!1,z.success(`${h(`@FLOWNODE:已添加`)}${a.data.label}`),J()}v(e=>{ee([e]),J()}),C(e=>{E.value.forEach(e=>{e.data&&(e.data.selected=!1)});let t=E.value.find(t=>t.id===e.node.id);t&&t.data&&(t.data.selected=!0)}),te(()=>{J()});function de(e){E.value.forEach(e=>{e.data&&(e.data.selected=!1)});let t=E.value.find(t=>t.id===e.node.id);t&&(t.data.selected=!0,t.type!==`start`&&(P.value=t,M.value=!0)),q([e.node.id])}function $(){E.value.forEach(e=>{e.data&&(e.data.selected=!1)}),q()}function me(e,t){let n=E.value.find(t=>t.id===e);n&&(n.data.config=t,n.data.label=he(t),J())}function he(e){return e.displayName&&String(e.displayName).trim()?String(e.displayName).trim():e.type===`command`?e.commandName||h(`@FLOWNODE:未知命令`):e.type===`wait`?h(`@FLOWNODE:等待 {seconds} 秒`,{seconds:e.waitSeconds}):e.type===`version`?e.versionTarget===`dependency`?h(`@FLOWNODE:修改依赖: {name}`,{name:e.dependencyName}):h(`@FLOWNODE:版本号 +1 ({bump})`,{bump:e.versionBump}):e.type===`confirm`?h(`@FLOWNODE:用户确认`):e.type===`user_input`?h(`@FLOWNODE:用户输入`):e.type===`code`?h(`@FLOWNODE:代码节点`):h(`@FLOWNODE:未配置`)}function Ce(e){if(console.log(`nodeId ==>`,e),e===`start-node`){z.warning(h(`@FLOWNODE:不能删除起始节点`));return}console.log(`nodes ==>`,E),E.value=E.value.filter(t=>t.id!==e),D.value=D.value.filter(t=>t.source!==e&&t.target!==e),P.value?.id===e&&(P.value=null,M.value=!1),z.success(h(`@FLOWNODE:节点已删除`)),J()}function Ne(e){for(let t of e)t.type===`remove`&&(D.value=D.value.filter(e=>e.id!==t.id));J()}function Pe(e){if(e.key===`Delete`||e.key===`Backspace`){let t=w.value;if(t&&t.length>0){let n=t.map(e=>e.id);D.value=D.value.filter(e=>!n.includes(e.id)),J(),e.preventDefault()}}}function Ie(){ce.confirm(`确定要清空整个流程吗?`,`确认清空`,{confirmButtonText:`清空`,cancelButtonText:`取消`,type:`warning`}).then(()=>{Y(),z.success(`流程已清空`),J()}).catch(()=>{})}async function Le(){if(E.value.length<=1){z.info(`节点太少,无需优化布局`);return}await q(),await new Promise(e=>requestAnimationFrame(()=>e()));let e=new Me.default.graphlib.Graph;e.setDefaultEdgeLabel(()=>({})),e.setGraph({rankdir:`LR`,nodesep:80,ranksep:80,marginx:50,marginy:50}),E.value.forEach(t=>{let n=220,r=100;t.type===`start`?(n=100,r=100):t.type===`wait`||t.type===`confirm`?(n=200,r=120):t.type===`version`&&(n=250,r=120);let i=document.querySelector(`.vue-flow__node[data-id="${t.id}"]`);if(i){let e=i.offsetWidth,t=i.offsetHeight;e>0&&t>0&&(n=e,r=t)}e.setNode(t.id,{width:n,height:r})}),D.value.forEach(t=>{e.setEdge(t.source,t.target)}),Me.default.layout(e),E.value.forEach(t=>{let n=e.node(t.id);n&&(t.position={x:n.x-n.width/2,y:n.y-n.height/2})}),z.success(`布局优化完成(dagre)`),J()}async function Re(){if(!O.value.trim()){z.warning(`请输入编排名称`);return}let e=E.value.filter(e=>e.type!==`start`&&!e.data.config);if(e.length>0){let t=e.map(e=>e.data.label).join(`、`);z.warning(`以下节点还未配置:${t}。未配置的节点不会被保存。`)}if(V().length===0){z.warning(`请至少添加一个执行步骤`);return}let t=x(),n={name:O.value.trim(),description:k.value.trim(),flowData:{nodes:G(E.value),edges:K(D.value),viewport:{x:t.x,y:t.y,zoom:t.zoom}}};if(A.value)await g.updateOrchestration(A.value,n);else{let e=await g.saveOrchestration(n);z.success(`编排已保存`),e&&typeof e==`object`&&`id`in e&&(L.value=e.id,A.value=e.id)}}function ze(){if(V().length===0){z.warning(`请至少添加一个执行步骤`);return}_.value=!1;let e=x(),t=E.value.find(e=>e.type===`start`);m(`execute-flow`,{flowData:{nodes:JSON.parse(JSON.stringify(E.value)),edges:JSON.parse(JSON.stringify(D.value)),viewport:{x:e.x,y:e.y,zoom:e.zoom}},startNodeId:t?.id,isSingleExecution:!1,orchestrationMeta:{id:A.value||void 0,name:O.value||void 0}})}function Be(e){let t=E.value.find(t=>t.id===e);if(!t||t.type===`start`||!t.data.config){z.warning(`该节点无法执行`);return}_.value=!1;let n=x();m(`execute-flow`,{flowData:{nodes:JSON.parse(JSON.stringify(E.value)),edges:JSON.parse(JSON.stringify(D.value)),viewport:{x:n.x,y:n.y,zoom:n.zoom}},startNodeId:e,isSingleExecution:!1,orchestrationMeta:{id:A.value||void 0,name:O.value||void 0}})}function Ve(e){let t=E.value.find(t=>t.id===e);if(!t||t.type===`start`||!t.data.config){z.warning(`该节点无法执行`);return}_.value=!1;let n=x();m(`execute-flow`,{flowData:{nodes:JSON.parse(JSON.stringify(E.value)),edges:JSON.parse(JSON.stringify(D.value)),viewport:{x:n.x,y:n.y,zoom:n.zoom}},startNodeId:e,isSingleExecution:!0,orchestrationMeta:{id:A.value||void 0,name:O.value||void 0}})}t(i,{deleteNode:Ce,executeFromNode:Be,executeSingleNode:Ve});function He(e){L.value=e.id,A.value=e.id,O.value=e.name,k.value=e.description||``,e.flowData?(E.value=JSON.parse(JSON.stringify(e.flowData.nodes)),D.value=JSON.parse(JSON.stringify(e.flowData.edges)),q(),e.flowData.viewport&&setTimeout(()=>{S(e.flowData.viewport)},100)):Y()}function Ue(){L.value=null,A.value=null,O.value=``,k.value=``,Y()}async function We(e){try{await ce.confirm(`确定要删除编排 "${e.name}" 吗?`,`确认删除`,{confirmButtonText:`删除`,cancelButtonText:`取消`,type:`warning`}),await g.deleteOrchestration(e.id),A.value===e.id&&Ue()}catch(e){e!==`cancel`&&z.error(`删除编排失败: ${e.message||e}`)}}function Ge(e){if(_.value=!1,e?.flowData){let t=Array.isArray(e.flowData.nodes)?e.flowData.nodes.find(e=>e?.type===`start`):void 0;m(`execute-flow`,{flowData:e.flowData,startNodeId:t?.id,isSingleExecution:!1,orchestrationMeta:{id:e?.id,name:e?.name}});return}z.warning(`该编排缺少流程数据,无法执行`)}j(()=>{Y(),window.addEventListener(`keydown`,Pe),q()}),ne(()=>{window.removeEventListener(`keydown`,Pe)});let Ke={FLOW_NODE_ACTIONS_KEY:i,getNodeIcon:a,createWrappedNode:o,StartNodeRenderer:l,nodeTypes:u,props:d,emit:m,t:h,configStore:g,dialogVisible:_,onConnect:v,addEdges:ee,getViewport:x,setViewport:S,onNodeDragStart:C,onNodeDragStop:te,getSelectedEdges:w,updateNodeInternals:T,nodes:E,edges:D,orchestrationName:O,orchestrationDescription:k,editingOrchestrationId:A,showConfigPanel:M,selectedNode:P,get autoSaveTimer(){return F},set autoSaveTimer(e){F=e},orchestrations:I,selectedOrchestrationId:L,get nodeIdCounter(){return ie},set nodeIdCounter(e){ie=e},generateNodeId:R,escapeRegExp:B,generateCopyName:ae,duplicateOrchestration:oe,getExecutableNodes:V,estimateNodeSize:H,getViewportCenterPosition:U,generateUniqueNodeLabel:W,sanitizeNodesForSave:G,sanitizeEdgesForSave:K,refreshNodeInternals:q,scheduleAutoSave:J,initializeFlow:Y,addNode:ue,onNodeClick:de,onPaneClick:$,updateNodeConfig:me,getNodeLabel:he,handleNodeDelete:Ce,onEdgesChange:Ne,handleKeyDown:Pe,clearFlow:Ie,optimizeLayout:Le,saveOrchestration:Re,executeCurrentFlow:ze,executeFromNode:Be,executeSingleNode:Ve,loadOrchestration:He,createNewOrchestration:Ue,deleteOrchestration:We,executeOrchestration:Ge,get VueFlow(){return xe},get Background(){return ve},get Controls(){return be},get Delete(){return se},get VideoPlay(){return le},get Plus(){return fe},get Select(){return y},get Grid(){return c},get CopyDocument(){return re},CommonDialog:_e,IconButton:Se,NodeConfigPanel:Er};return Object.defineProperty(Ke,"__isScriptSetup",{enumerable:!1,value:!0}),Ke}});k(),g(),L();var Or={class:`flow-workspace-container`},kr={class:`left-sidebar`},Ar={class:`sidebar-header`},jr={class:`orchestration-list`},Mr=[`onClick`],Nr={class:`item-content`},Pr={key:0,class:`description`},Fr={class:`item-actions`},Ir={class:`flow-canvas`},Lr={class:`canvas-header`},Rr={class:`flow-header-info`},zr={class:`header-actions`},Br={class:`right-sidebar`},Vr={class:`sidebar-header`},Hr={class:`node-toolbox`},Ur={class:`tool-label`},Wr={class:`tool-desc`},Gr={class:`tool-label`},Kr={class:`tool-desc`},qr={class:`tool-label`},Jr={class:`tool-desc`},Yr={class:`tool-label`},Xr={class:`tool-desc`},Zr={class:`tool-label`},Qr={class:`tool-desc`},$r={class:`tool-label`},ei={class:`tool-desc`},ti={class:`tool-label`},ni={class:`tool-desc`};function ri(e,t,n,i,a,s){let c=_,l=J,d=O;return w(),S(i.CommonDialog,{modelValue:i.dialogVisible,"onUpdate:modelValue":t[13]||=e=>i.dialogVisible=e,title:i.t(`@ORCH:可视化编排工作台`),"close-on-click-modal":!1,"append-to-body":!0,size:`fullscreen`,type:`flex`,heightMode:`fixed`,"custom-class":`flow-orchestration-dialog`},{default:V(()=>[o(`div`,Or,[B(` 左侧:编排列表 `),o(`div`,kr,[o(`div`,Ar,[o(`h3`,null,G(i.t(`@ORCH:已保存的编排`)),1),u(i.IconButton,{tooltip:i.t(`@ORCH:新建编排`),size:`small`,"hover-color":`var(--color-primary)`,onClick:i.createNewOrchestration},{default:V(()=>[u(c,null,{default:V(()=>[u(i.Plus)]),_:1})]),_:1},8,[`tooltip`])]),o(`div`,jr,[i.orchestrations.length===0?(w(),S(l,{key:0,description:i.t(`@ORCH:暂无编排`),"image-size":80},null,8,[`description`])):B(`v-if`,!0),(w(!0),r(E,null,R(i.orchestrations,e=>(w(),r(`div`,{key:e.id,class:M([`orchestration-item`,{active:i.selectedOrchestrationId===e.id}]),onClick:t=>i.loadOrchestration(e)},[o(`div`,Nr,[o(`h4`,null,G(e.name),1),e.description?(w(),r(`p`,Pr,G(e.description),1)):B(`v-if`,!0),o(`div`,Fr,[u(i.IconButton,{tooltip:i.t(`@ORCH:执行`),size:`small`,"hover-color":`var(--color-primary)`,onClick:Y(t=>i.executeOrchestration(e),[`stop`])},{default:V(()=>[u(c,null,{default:V(()=>[u(i.VideoPlay)]),_:1})]),_:1},8,[`tooltip`,`onClick`]),u(i.IconButton,{tooltip:i.t(`@ORCH:复制`),size:`small`,"hover-color":`var(--color-primary)`,onClick:Y(t=>i.duplicateOrchestration(e),[`stop`])},{default:V(()=>[u(c,null,{default:V(()=>[u(i.CopyDocument)]),_:1})]),_:1},8,[`tooltip`,`onClick`]),u(i.IconButton,{tooltip:i.t(`@ORCH:删除`),size:`small`,"hover-color":`var(--color-danger)`,onClick:Y(t=>i.deleteOrchestration(e),[`stop`])},{default:V(()=>[u(c,null,{default:V(()=>[u(i.Delete)]),_:1})]),_:1},8,[`tooltip`,`onClick`])])])],10,Mr))),128))])]),B(` 中间:流程画布 `),o(`div`,Ir,[o(`div`,Lr,[o(`div`,Rr,[u(d,{modelValue:i.orchestrationName,"onUpdate:modelValue":t[0]||=e=>i.orchestrationName=e,placeholder:i.t(`@ORCH:编排名称(必填)`),size:`large`,style:{width:`300px`,"margin-right":`10px`}},null,8,[`modelValue`,`placeholder`]),u(d,{modelValue:i.orchestrationDescription,"onUpdate:modelValue":t[1]||=e=>i.orchestrationDescription=e,placeholder:i.t(`@ORCH:编排描述(选填)`),size:`large`,style:{width:`400px`}},null,8,[`modelValue`,`placeholder`])]),o(`div`,zr,[u(i.IconButton,{tooltip:i.t(`@ORCH:保存编排`),size:`large`,"hover-color":`var(--color-success)`,onClick:i.saveOrchestration},{default:V(()=>[u(c,null,{default:V(()=>[u(i.Select)]),_:1})]),_:1},8,[`tooltip`]),u(i.IconButton,{tooltip:`执行流程`,size:`large`,"hover-color":`var(--color-primary)`,onClick:i.executeCurrentFlow},{default:V(()=>[u(c,null,{default:V(()=>[u(i.VideoPlay)]),_:1})]),_:1}),u(i.IconButton,{tooltip:`清空流程`,size:`large`,"hover-color":`var(--color-danger)`,onClick:i.clearFlow},{default:V(()=>[u(c,null,{default:V(()=>[u(i.Delete)]),_:1})]),_:1})])]),u(i.VueFlow,{nodes:i.nodes,"onUpdate:nodes":t[2]||=e=>i.nodes=e,edges:i.edges,"onUpdate:edges":t[3]||=e=>i.edges=e,class:`vue-flow-container`,"default-zoom":1,"min-zoom":.2,"max-zoom":4,"node-types":i.nodeTypes,onNodeClick:i.onNodeClick,onPaneClick:i.onPaneClick,onEdgesChange:i.onEdgesChange},{default:V(()=>[u(i.Background,{"pattern-color":`#aaa`,gap:16}),u(i.Controls,{showInteractive:!1},{default:V(()=>[o(`button`,{class:`vue-flow__controls-button`,onClick:i.optimizeLayout,title:`优化布局`},[u(c,null,{default:V(()=>[u(i.Grid)]),_:1})])]),_:1})]),_:1},8,[`nodes`,`edges`])]),B(` 右侧:节点工具栏 `),o(`div`,Br,[o(`div`,Vr,[o(`h3`,null,G(i.t(`@ORCH:节点工具箱`)),1)]),o(`div`,Hr,[o(`div`,{class:`tool-item`,onClick:t[4]||=e=>i.addNode(`command`)},[t[14]||=o(`div`,{class:`tool-icon command`},`📋`,-1),o(`div`,Ur,G(i.t(`@ORCH:命令节点`)),1),o(`div`,Wr,G(i.t(`@ORCH:执行自定义命令`)),1)]),o(`div`,{class:`tool-item`,onClick:t[5]||=e=>i.addNode(`wait`)},[t[15]||=o(`div`,{class:`tool-icon wait`},`⏰`,-1),o(`div`,Gr,G(i.t(`@ORCH:等待节点`)),1),o(`div`,Kr,G(i.t(`@ORCH:暂停指定时间`)),1)]),o(`div`,{class:`tool-item`,onClick:t[6]||=e=>i.addNode(`version`)},[t[16]||=o(`div`,{class:`tool-icon version`},`📦`,-1),o(`div`,qr,G(i.t(`@ORCH:版本管理`)),1),o(`div`,Jr,G(i.t(`@ORCH:修改版本号或依赖`)),1)]),o(`div`,{class:`tool-item`,onClick:t[7]||=e=>i.addNode(`condition`)},[t[17]||=o(`div`,{class:`tool-icon condition`},`🔀`,-1),o(`div`,Yr,G(i.t(`@FLOWNODE:条件`)),1),o(`div`,Xr,G(i.t(`@ORCH:条件分支`)),1)]),o(`div`,{class:`tool-item`,onClick:t[8]||=e=>i.addNode(`code`)},[t[18]||=o(`div`,{class:`tool-icon code`},`🧩`,-1),o(`div`,Zr,G(i.t(`@FLOWNODE:代码节点`)),1),o(`div`,Qr,G(i.t(`@ORCH:执行自定义代码`)),1)]),o(`div`,{class:`tool-item`,onClick:t[9]||=e=>i.addNode(`confirm`)},[t[19]||=o(`div`,{class:`tool-icon confirm`},`✋`,-1),o(`div`,$r,G(i.t(`@ORCH:用户确认`)),1),o(`div`,ei,G(i.t(`@ORCH:等待用户确认后继续`)),1)]),o(`div`,{class:`tool-item`,onClick:t[10]||=e=>i.addNode(`user_input`)},[t[20]||=o(`div`,{class:`tool-icon confirm`},`⌨️`,-1),o(`div`,ti,G(i.t(`@FLOWNODE:用户输入`)),1),o(`div`,ni,G(i.t(`@UINPUT:执行到该节点暂停并等待输入`)),1)])])])]),B(` 节点配置面板 `),u(i.NodeConfigPanel,{modelValue:i.showConfigPanel,"onUpdate:modelValue":t[11]||=e=>i.showConfigPanel=e,node:i.selectedNode,"all-nodes":i.nodes,edges:i.edges,onUpdateConfig:i.updateNodeConfig,onOpenCommandManager:t[12]||=()=>i.emit(`open-command-manager`)},null,8,[`modelValue`,`node`,`all-nodes`,`edges`])]),_:1},8,[`modelValue`,`title`])}var ii=$(Dr,[[`render`,ri],[`__scopeId`,`data-v-94a84301`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/components/flow/FlowOrchestrationWorkspace.vue`]]);export{ii as default};
@@ -1,7 +0,0 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,D as t,Dn as n,En as r,F as i,Fn as a,Gn as o,I as s,Ir as c,J as l,Jn as u,L as d,Ln as f,On as p,Pn as m,Qn as h,Sn as g,U as ee,Vn as _,W as te,Wt as ne,Xn as re,Yr as v,Zr as ie,a as y,bn as b,ct as ae,dn as oe,er as x,f as se,i as S,kn as C,lr as w,mr as T,p as ce,pt as le,r as ue,sr as E,ti as D,ur as O,vt as de,wt as fe,xn as k,xr as A,yn as j,z as pe}from"./element-plus-CDrtgG55.js";import{n as M,t as me}from"./_plugin-vue_export-helper-BY0jlMBE.js";import{t as he}from"./CommonDialog-DrxsmpDL.js";import{G as ge,H as _e,K as ve,M as ye,W as be}from"./index-CyEcaEC9.js";var N=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function P(e){return 10+e*14}function F(e){return N[e%N.length]}function xe(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim();if(!e||e===`HEAD`||e.startsWith(`tag:`))continue;let r=e.match(/^HEAD\s*->\s*(.+)$/);t.push((r?r[1]:e).trim())}return t}function Se(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.hash)??new Set;for(let t of xe(r.branch))e.add(t);n.set(r.hash,Array.from(e));for(let n of r.parents??[]){let r=t.get(n)??new Set;for(let t of e)r.add(t);t.set(n,r)}}return n}function Ce(e){let t=[],n=[],r=0,i=0,a=new Set(e.map(e=>e.hash)),o=e=>t.findIndex(t=>t!==null&&t.hash===e),s=()=>{let e=t.findIndex(e=>e===null);return e===-1?(t.push(null),t.length-1):e};for(let c of e){let e=Array.isArray(c.parents)?c.parents:[],l=t.slice(),u=o(c.hash),d,f=!1;u===-1?(f=!0,u=s(),d=r++):d=t[u].colorIdx,t[u]=null;let p=[],m=new Set;for(let e=0;e<t.length;e++){let n=t[e];n!==null&&n.hash===c.hash&&(p.push({fromLane:e,color:F(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,m.add(e))}let h=[],g=F(d);if(e.length>0){let n=e[0],i=o(n);i===-1?a.has(n)&&(t[u]={hash:n,colorIdx:d},h.push({toLane:u,color:g,kind:`straight`,branches:[],_hash:n})):(h.push({toLane:i,color:g,kind:i===u?`straight`:`curve`,branches:[],_hash:n}),i===u&&(t[u]={hash:n,colorIdx:d}));for(let n of e.slice(1)){let e=o(n);if(e!==-1)h.push({toLane:e,color:g,kind:e===u?`straight`:`curve`,branches:[],_hash:n});else if(a.has(n)){let e=s(),i=r++;t[e]={hash:n,colorIdx:i},h.push({toLane:e,color:F(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let ee=t.slice();i=Math.max(i,t.length);let _=[];for(let e=0;e<l.length;e++){let t=l[e];t!==null&&(e===u||m.has(e)||e<ee.length&&ee[e]!==null&&ee[e].hash===t.hash&&_.push({lane:e,color:F(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:g,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:_,topCurves:p,bottomEdges:h,branches:[]})}let c=Se(e),l=e=>c.get(e)??[];for(let e of n){e.branches=l(e.hash);for(let t of e.passes)t.branches=l(t._hash),delete t._hash;for(let t of e.topCurves)t.branches=l(t._hash),delete t._hash;for(let t of e.bottomEdges)t.branches=l(t._hash),delete t._hash}let u=i>0?20+(i-1)*14:0;return{rows:n,maxLanes:i,width:u}}_();var we=-1,Te=f({__name:`CommitGraphCell`,props:{layout:{type:Object,required:!0},width:{type:Number,required:!0}},setup(e,{expose:t}){t();let n=e,i=r(()=>P(n.layout.commitLane)),a=M(`@A1833:暂不属于任何分支`);function o(e){return e.length>0?e.join(`, `):a}let s={props:n,VH:30,cy:15,TOP:we,BOTTOM:31,nodeX:i,noBranchText:a,branchText:o,nodeTitle:r(()=>`${n.layout.hash.slice(0,7)} · ${o(n.layout.branches)}`),passLines:r(()=>n.layout.passes.map(e=>({x:P(e.lane),color:e.color,title:o(e.branches)}))),topCurvePaths:r(()=>n.layout.topCurves.map(e=>{let t=P(e.fromLane),n=i.value;return{d:`M ${t} ${we} C ${t} ${15/2}, ${n} ${15/2}, ${n} 15`,color:e.color,title:o(e.branches)}})),bottomEdgePaths:r(()=>n.layout.bottomEdges.map(e=>{let t=i.value,n=P(e.toLane);return{d:e.kind===`straight`||t===n?`M ${t} 15 L ${n} 31`:`M ${t} 15 C ${t} 23, ${n} 23, ${n} 31`,color:e.color,title:o(e.branches)}}))};return Object.defineProperty(s,"__isScriptSetup",{enumerable:!1,value:!0}),s}});_(),c();var I={class:`graph-wrap`},L=[`viewBox`],R=[`x1`,`x2`,`stroke`],z=[`x1`,`x2`],B=[`d`,`stroke`],Ee=[`d`],V=[`x1`,`x2`,`stroke`],De=[`d`,`stroke`],Oe=[`d`],ke={class:`graph-layer graph-nodes`,"aria-hidden":`true`},H=[`cx`,`stroke`],Ae=[`cx`,`fill`],je=[`cx`,`stroke`],U=[`cx`];function Me(t,r,i,a,o,s){return h(),e(`div`,I,[C(` 线条层: viewBox + preserveAspectRatio="none" 纵向拉伸填满单元格, 任意行高不断线 `),(h(),e(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${i.width} ${a.VH}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[C(` 贯穿线(悬停显示分支名, 加粗透明描边扩大热区) `),(h(!0),e(g,null,x(a.passLines,(t,r)=>(h(),e(`line`,{key:`p`+r,x1:t.x,y1:a.TOP,x2:t.x,y2:a.BOTTOM,stroke:t.color,"stroke-width":`2`},[n(`title`,null,D(t.title),1)],8,R))),128)),(h(!0),e(g,null,x(a.passLines,(t,r)=>(h(),e(`line`,{key:`ph`+r,x1:t.x,y1:a.TOP,x2:t.x,y2:a.BOTTOM,stroke:`transparent`,"stroke-width":`8`},[n(`title`,null,D(t.title),1)],8,z))),128)),C(` 顶部收拢曲线 `),(h(!0),e(g,null,x(a.topCurvePaths,(t,r)=>(h(),e(`path`,{key:`t`+r,d:t.d,stroke:t.color,"stroke-width":`2`,fill:`none`},[n(`title`,null,D(t.title),1)],8,B))),128)),(h(!0),e(g,null,x(a.topCurvePaths,(t,r)=>(h(),e(`path`,{key:`th`+r,d:t.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[n(`title`,null,D(t.title),1)],8,Ee))),128)),C(` 顶部垂线入节点 `),i.layout.hasTopLine?(h(),e(`line`,{key:0,x1:a.nodeX,y1:a.TOP,x2:a.nodeX,y2:a.cy,stroke:i.layout.color,"stroke-width":`2`},[n(`title`,null,D(a.branchText(i.layout.branches)),1)],8,V)):C(`v-if`,!0),C(` 底部出边 `),(h(!0),e(g,null,x(a.bottomEdgePaths,(t,r)=>(h(),e(`path`,{key:`b`+r,d:t.d,stroke:t.color,"stroke-width":`2`,fill:`none`},[n(`title`,null,D(t.title),1)],8,De))),128)),(h(!0),e(g,null,x(a.bottomEdgePaths,(t,r)=>(h(),e(`path`,{key:`bh`+r,d:t.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[n(`title`,null,D(t.title),1)],8,Oe))),128))],8,L)),C(` 节点层: 不用 viewBox, cy=50% + 固定半径, 任意行高都是正圆 `),(h(),e(`svg`,ke,[n(`g`,null,[n(`title`,null,D(a.nodeTitle),1),C(` merge 提交空心圆环, 普通提交实心 `),i.layout.isMerge?(h(),e(`circle`,{key:0,cx:a.nodeX,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:i.layout.color,"stroke-width":`2`},null,8,H)):(h(),e(`circle`,{key:1,cx:a.nodeX,cy:`50%`,r:`4`,fill:i.layout.color},null,8,Ae)),C(` 分支头加一圈描边, 更醒目 `),i.layout.isHead?(h(),e(`circle`,{key:2,cx:a.nodeX,cy:`50%`,r:`7`,fill:`none`,stroke:i.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,je)):C(`v-if`,!0),C(` 扩大节点悬停热区 `),n(`circle`,{cx:a.nodeX,cy:`50%`,r:`9`,fill:`transparent`},null,8,U)])]))])}var Ne=me(Te,[[`render`,Me],[`__scopeId`,`data-v-d502a2df`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/views/components/CommitGraphCell.vue`]]);_(),T();var Pe=`zen-gitsync:log-show-graph`,Fe=f({__name:`LogList`,setup(e,{expose:n}){let a=ge(),c=be(),l=A([]),f=A(``),p=A(!1),m=r(()=>a.isLoadingLog||p.value),h=A(!1),g=A(localStorage.getItem(Pe)!==`false`);E(g,e=>{localStorage.setItem(Pe,String(e))});let _=r(()=>g.value&&l.value.length>0?Ce(l.value):null),te=r(()=>{let e=new Map;if(_.value)for(let t of _.value.rows)e.set(t.hash,t);return e}),v=r(()=>Math.max(_.value?.width??0,28)),ie=r(()=>Se(l.value)),y=A(!1),b=A(null),oe=A(!1),x=A(null),C=A([]),w=A(``),T=A(!1),D=A(``),O=A(`full-new`),k=A(``),j=A(``),me=r(()=>x.value?ie.value.get(x.value.hash)??[]:[]),N=A(!1),P=r(()=>x.value?.message?x.value.message.split(`
2
- `)[0].trim():``),F=r(()=>x.value?.message?x.value.message.split(`
3
- `).slice(1).join(`
4
- `).trim():``),xe=r(()=>F.value.length>0),we=r(()=>F.value.replace(/\n/g,`<br>`)),Te=A(!1),I=A([]),L=A(``),R=A(null),z=A([]),B=A([]),Ee=A([]),V=A(!1),De=A(0),Oe=A(0),ke=A(null),H=A(null),Ae=r(()=>l.value),je=r(()=>C.value.map(e=>({path:e,name:e.split(`/`).pop()||e})));async function U(e=!1,t=1){let n=ge();if(!n.isGitRepo){f.value=`当前目录不是Git仓库`;return}try{t>1?y.value=!0:p.value=!0;let r=new URLSearchParams;r.append(`page`,t.toString()),r.append(`all`,e.toString()),r.append(`with_parents`,`true`),I.value.length>0&&r.append(`author`,I.value.join(`,`)),B.value.length>0&&r.append(`branch`,B.value.join(`,`)),L.value&&r.append(`message`,L.value),R.value&&Array.isArray(R.value)&&R.value.length===2&&(r.append(`dateFrom`,R.value[0]),r.append(`dateTo`,R.value[1])),r.append(`_t`,Date.now().toString());let i=await(await fetch(`/api/log?${r.toString()}`)).json();if(!i||!i.data||!Array.isArray(i.data)){f.value=`加载提交历史失败: 服务器返回数据格式不正确`;return}let a=t>1;a&&Array.isArray(i.data)?l.value=l.value.concat(i.data):Array.isArray(i.data)&&(l.value=i.data),n.currentPage=t,n.totalCommits=i.total??l.value.length,n.hasMoreData=i.hasMore===!0,!a&&!e&&o(()=>{J(),setTimeout(dt,200)}),f.value=``}catch(e){f.value=`加载提交历史失败: `+(e instanceof Error?e.message:String(e)),t>1&&(n.hasMoreData=!1)}finally{t>1?y.value=!1:p.value=!1}}function Me(e){return e.includes(`HEAD -> `)?e.replace(`HEAD -> `,``):e.includes(`origin/`)?e:e.trim()}function Fe(e){return e.includes(`HEAD`)?`success`:e.includes(`origin/`)?`warning`:`info`}function Ie(e){return e?e.length>60||e.includes(`
5
- `):!1}let W=A(null),G=A(null),K=null;function q(e){K===null&&(K=requestAnimationFrame(()=>{K=null,Le(e)}))}function Le(e){if(!a.hasMoreData||y.value||m.value)return;let{scrollTop:t,scrollHeight:n,clientHeight:r}=e.target;n-t-r<=20&&Z()}function J(){if(!W.value)return;let e=W.value.$el.querySelector(`.el-table__body-wrapper`);e&&(G.value=e,G.value&&(G.value.removeEventListener(`scroll`,q,!0),G.value.addEventListener(`scroll`,q,!0)))}function Re(){G.value&&=(G.value.removeEventListener(`scroll`,q,!0),null),K!==null&&(cancelAnimationFrame(K),K=null)}function ze(e){e.key===`Escape`&&$.value&&($.value=!1)}let Be=()=>{a.isGitRepo&&(p.value||y.value||Y())};re(()=>{window.addEventListener(`git-log-auto-refresh`,Be),a.isGitRepo?(a.log.length>0?(l.value=a.log,a.totalCommits=a.log.length):U(),nt()):f.value=`当前目录不是Git仓库`,o(()=>{setTimeout(()=>{J()},500)}),E(()=>W.value,e=>{e&&!h.value&&o(()=>{J()})}),window.addEventListener(`keydown`,ze)}),E(()=>a.allBranches,e=>{e&&e.length>0?Ee.value=[...e].sort():Ee.value=[]},{immediate:!0}),u(()=>{Re(),b.value!==null&&(window.clearInterval(b.value),b.value=null),window.removeEventListener(`keydown`,ze),window.removeEventListener(`git-log-auto-refresh`,Be)});async function Y(){a.currentPage=1,a.hasMoreData=!0,await U(h.value,1),o(()=>{if(W.value){let e=W.value.$el.querySelector(`.el-scrollbar__wrap`);e&&(e.scrollTop=0)}})}E(()=>a.isGitRepo,e=>{e?(f.value=``,U(h.value,1),nt()):(f.value=`当前目录不是Git仓库`,l.value=[])}),E(()=>a.log,e=>{try{Array.isArray(e)&&(l.value=e),a.totalCommits=l.value.length,a.currentPage=1}catch{}},{immediate:!0}),n({refreshLog:Y});async function Ve(e){if(e){x.value=e,oe.value=!0,T.value=!0,C.value=[],w.value=``,D.value=``,O.value=`full-new`,k.value=``,j.value=``,N.value=!1;try{if(!e.hash||e.hash.length<7){w.value=`无效的提交哈希值`,T.value=!1;return}let t=await(await fetch(`/api/commit-files?hash=${e.hash}`)).json();t.success&&Array.isArray(t.files)?(C.value=t.files,C.value.length>0?await X(e.hash,C.value[0]):w.value=`该提交没有变更文件`):w.value=`${M(`@A1833:获取文件列表失败: `)}${t.error||`未知错误`}`}catch(e){w.value=`${M(`@A1833:获取提交详情失败: `)}${e.message}`}finally{T.value=!1}}}async function He(e,t,n){T.value=!0,D.value=t;try{let r=await(await fetch(`/api/commit-file-content?hash=${e}&file=${encodeURIComponent(t)}&version=${n}`)).json();r.success?w.value=r.content||``:w.value=`${M(`@A1833:获取文件内容失败: `)}${r.error||`未知错误`}`}catch(e){w.value=`${M(`@A1833:获取文件内容失败: `)}${e.message}`}finally{T.value=!1}}async function Ue(e,t){T.value=!0,D.value=t;try{let[n,r]=await Promise.all([fetch(`/api/commit-file-content?hash=${e}&file=${encodeURIComponent(t)}&version=old`),fetch(`/api/commit-file-content?hash=${e}&file=${encodeURIComponent(t)}&version=new`)]),[i,a]=await Promise.all([n.json(),r.json()]);k.value=i?.success?i.content||``:`${M(`@A1833:获取文件内容失败: `)}${i?.error||`未知错误`}`,j.value=a?.success?a.content||``:`${M(`@A1833:获取文件内容失败: `)}${a?.error||`未知错误`}`,w.value=``}catch(e){let t=`${M(`@A1833:获取文件内容失败: `)}${e.message}`;k.value=t,j.value=t,w.value=``}finally{T.value=!1}}async function We(e,t,n){O.value=n,n===`diff`?(k.value=``,j.value=``,await Ge(e,t)):n===`full-old`?(k.value=``,j.value=``,await He(e,t,`old`)):(k.value=``,j.value=``,await He(e,t,`new`))}async function X(e,t){O.value=`full-new`,await Ue(e,t)}async function Ge(e,t){T.value=!0,D.value=t;try{let n=await(await fetch(`/api/commit-file-diff?hash=${e}&file=${encodeURIComponent(t)}`)).json();n.success?w.value=n.diff||`没有变更内容`:w.value=`${M(`@A1833:获取差异失败: `)}${n.error||`未知错误`}`}catch(e){w.value=`${M(`@A1833:获取差异失败: `)}${e.message}`}finally{T.value=!1}}function Ke(e){x.value&&(O.value===`diff`?We(x.value.hash,e,`diff`):X(x.value.hash,e))}function qe(){if(!x.value||!D.value){O.value=`diff`;return}We(x.value.hash,D.value,`diff`)}function Je(){if(!x.value||!D.value){O.value=`full-new`;return}X(x.value.hash,D.value)}async function Ye(){if(!x.value||!D.value)return;let e=w.value;if(!e)try{e=(await(await fetch(`/api/commit-file-diff?hash=${x.value.hash}&file=${encodeURIComponent(D.value)}`)).json()).diff||``}catch{}e&&navigator.clipboard.writeText(e).then(()=>{S.success(M(`@A1833:差异已复制到剪贴板`))}).catch(()=>{S.error(M(`@A1833:复制失败`))})}async function Xe(e,t){try{let n=await(await fetch(`/api/open-file`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:e,context:t})})).json();n.success?S.success(n.message):S.error(n.error||M(`@A1833:打开文件失败`))}catch(e){S.error(`${M(`@A1833:打开文件失败: `)}${e.message}`)}}async function Ze(e,t){try{let n=await(await fetch(`/api/open-with-vscode`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({filePath:e,context:t})})).json();n.success?S.success(n.message):S.error(n.error||M(`@A1833:用VSCode打开文件失败`))}catch(e){S.error(`${M(`@A1833:用VSCode打开文件失败: `)}${e.message}`)}}function Qe(e,t){oe.value=!1,window.dispatchEvent(new CustomEvent(`zen-gitsync:open-file-in-editor`,{detail:{filePath:e}}))}async function $e(e){try{let t=_e(e);await navigator.clipboard.writeText(t),S.success(M(`@A1833:提交信息已复制到剪贴板`))}catch{S.error(M(`@A1833:复制失败`))}}function Z(){!a.hasMoreData||y.value||m.value||U(h.value,a.currentPage+1)}function et(){I.value=[],B.value=[],L.value=``,R.value=null,a.currentPage=1,U(h.value,1)}function tt(){a.currentPage=1,U(h.value,1)}async function nt(){try{let e=await(await fetch(`/api/authors`)).json();e.success&&Array.isArray(e.authors)?z.value=e.authors.sort():Q()}catch{Q()}}function Q(){let e=new Set;l.value.forEach(t=>{t.author&&e.add(t.author)}),z.value=Array.from(e).sort()}E(()=>l.value,()=>{},{deep:!0});function rt(e,t,n){n.preventDefault(),De.value=n.clientY,Oe.value=n.clientX,ke.value=e,V.value=!0,o(()=>{let e=H.value;if(e){let t=e.getBoundingClientRect(),r=window.innerWidth,i=window.innerHeight,a=n.clientX,o=n.clientY;a+t.width>r&&(a=Math.max(8,n.clientX-t.width)),o+t.height>i&&(o=Math.max(8,n.clientY-t.height)),Oe.value=a,De.value=o}});let r=()=>{V.value=!1,document.removeEventListener(`click`,r)};setTimeout(()=>{document.addEventListener(`click`,r)},0),o(()=>{let e=H.value?.querySelectorAll(`[role="menuitem"]`);e&&e.length>0&&e[0].focus()})}function it(){V.value=!1,document.removeEventListener(`click`,()=>{})}function at(e){let t=H.value?.querySelectorAll(`[role="menuitem"]`);if(!t||t.length===0)return;let n=document.activeElement;t[((n?Array.from(t).indexOf(n):-1)+e+t.length)%t.length].focus()}async function ot(e){if(e)try{await ue.confirm(`${M(`@A1833:确定要撤销提交 `)}${e.hash.substring(0,7)}${M(`@A1833: 吗?这将创建一个新的提交来撤销这次提交的更改。`)}`,`撤销提交确认`,{confirmButtonText:`确认`,cancelButtonText:`取消`,type:`warning`});let t=await(await fetch(`/api/revert-commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:e.hash})})).json();t.success?(S.success(t.message||`已成功撤销提交`),Y(),a.fetchStatus(),a.getBranchStatus()):S.error(t.error||`撤销提交失败`)}catch(e){e!==`cancel`&&S.error(`撤销提交失败: `+(e.message||e))}}async function st(e){if(e)try{await ue.confirm(`${M(`@A1833:确定要将提交 `)}${e.hash.substring(0,7)}${M(`@A1833: Cherry-Pick 到当前分支吗?`)}`,`Cherry-Pick确认`,{confirmButtonText:`确认`,cancelButtonText:`取消`,type:`warning`});let t=await(await fetch(`/api/cherry-pick-commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:e.hash})})).json();t.success?(S.success(t.message||`已成功Cherry-Pick提交`),Y(),a.fetchStatus(),a.getBranchStatus()):S.error(t.error||`Cherry-Pick提交失败`)}catch(e){e!==`cancel`&&S.error(`Cherry-Pick提交失败: `+(e.message||e))}}async function ct(e){if(e)try{let t=await(await fetch(`/api/commit-diff-full?hash=${encodeURIComponent(e.hash)}`)).json();if(!t.success){S.error(`${M(`@A1833:复制提交内容失败: `)}${t.error}`);return}await navigator.clipboard.writeText(t.content),S.success(`${M(`@A1833:已复制提交内容: `)}${e.hash.substring(0,7)}`)}catch(e){S.error(`${M(`@A1833:复制提交内容失败: `)}${e.message}`)}}async function lt(e){if(e)try{await navigator.clipboard.writeText(e.hash),S.success(`${M(`@A1833:已复制提交哈希: `)}${e.hash.substring(0,7)}`)}catch(e){S.error(`${M(`@A1833:复制提交哈希失败: `)}${e.message}`)}}async function ut(e){if(e)try{await ue.confirm(`${M(`@A1833:确定要将当前分支重置(hard)到提交 `)}${e.hash.substring(0,7)} 吗?
6
-
7
- 警告:这将丢失该提交之后的所有更改!`,`重置确认`,{confirmButtonText:`确认重置`,cancelButtonText:`取消`,type:`warning`,dangerouslyUseHTMLString:!0});let t=await(await fetch(`/api/reset-to-commit`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({hash:e.hash})})).json();t.success?(S.success(t.message||`已成功重置到指定提交`),Y(),a.fetchStatus(),a.getBranchStatus()):S.error(t.error||`重置到指定提交失败`)}catch(e){e!==`cancel`&&S.error(`重置到指定提交失败: `+(e.message||e))}}function dt(){if(!a.hasMoreData||y.value||m.value||h.value)return;if(!G.value){J();return}let{scrollTop:e,scrollHeight:t,clientHeight:n}=G.value;t-e-n<=50&&Z()}let $=A(!1);function ft(){$.value=!$.value}let pt={gitStore:a,toolsStore:c,logs:l,errorMessage:f,localLoading:p,isLoading:m,showAllCommits:h,GRAPH_STORAGE_KEY:Pe,showGraph:g,graphResult:_,graphRowMap:te,graphColumnWidth:v,commitBranchesMap:ie,isLoadingMore:y,loadTimerInterval:b,commitDetailVisible:oe,selectedCommit:x,commitFiles:C,commitDiff:w,isLoadingCommitDetail:T,selectedCommitFile:D,commitFileViewMode:O,commitCompareOriginal:k,commitCompareModified:j,selectedCommitBranches:me,commitMessageExpanded:N,commitMessageTitle:P,commitMessageBody:F,hasCommitMessageBody:xe,commitMessageBodyHtml:we,filterVisible:Te,authorFilter:I,messageFilter:L,dateRangeFilter:R,availableAuthors:z,branchFilter:B,availableBranches:Ee,contextMenuVisible:V,contextMenuTop:De,contextMenuLeft:Oe,selectedContextCommit:ke,contextMenuRef:H,filteredLogs:Ae,commitFilesForViewer:je,loadLog:U,formatBranchName:Me,getBranchTagType:Fe,isMessageTruncated:Ie,tableRef:W,tableBodyWrapper:G,get scrollRafId(){return K},set scrollRafId(e){K=e},scheduleScrollCheck:q,handleTableScroll:Le,setupTableScrollListener:J,removeTableScrollListener:Re,handleKeyDown:ze,handleAutoRefresh:Be,refreshLog:Y,viewCommitDetail:Ve,getCommitFileContent:He,getCommitCompareContent:Ue,loadCommitFileView:We,loadCommitFileCompare:X,getCommitFileDiff:Ge,handleCommitFileSelect:Ke,handleCommitDiffOnly:qe,handleCommitFullCompare:Je,copyCommitFileDiff:Ye,handleOpenFile:Xe,handleOpenWithVSCode:Ze,handleOpenInEditor:Qe,copyPureMessage:$e,loadMoreLogs:Z,resetFilters:et,applyFilters:tt,fetchAllAuthors:nt,extractAuthorsFromLogs:Q,handleContextMenu:rt,closeContextMenu:it,moveContextMenuFocus:at,revertCommit:ot,cherryPickCommit:st,copyCommitContent:ct,copyCommitHash:lt,resetToCommit:ut,checkAndLoadMore:dt,isFullscreen:$,toggleFullscreen:ft,get $t(){return M},ref:A,get ElTable(){return se},get ElTableColumn(){return ce},get ElTag(){return d},get ElButton(){return pe},get ElSelect(){return s},get ElOption(){return i},get ElDatePicker(){return t},get ElInput(){return ee},get RefreshRight(){return ne},get Filter(){return de},get FullScreen(){return fe},get CopyDocument(){return ae},get Document(){return le},FileDiffViewer:ye,CommonDialog:he,IconButton:ve,CommitGraphCell:Ne};return Object.defineProperty(pt,"__isScriptSetup",{enumerable:!1,value:!0}),pt}});_(),c(),oe();var Ie={class:`log-header`},W={class:`header-left`},G={class:`log-actions`},K={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},q={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},Le={key:0,class:`filter-panel-header`},J={class:`filter-form`},Re={class:`filter-item`},ze={class:`compact-label`},Be={class:`filter-item`},Y={class:`compact-label`},Ve={class:`filter-item`},He={class:`compact-label`},Ue={class:`filter-item`},We={class:`compact-label`},X={class:`filter-actions`},Ge={key:0,role:`alert`,class:`log-error`},Ke={key:1,class:`log-empty-state`},qe={class:`log-empty-text`},Je={key:2,class:`content-area-content`},Ye={class:`table-view-container`},Xe={class:`commit-message-cell`},Ze={class:`message-content`},Qe={key:0,class:`branch-container`},$e={class:`message-text`},Z={class:`author-name`},et=[`title`,`aria-label`,`onClick`],tt={class:`commit-detail-container`},nt={key:0,class:`commit-info`},Q={class:`commit-info-row`},rt={class:`info-item date-item`},it={class:`info-label`},at={class:`info-value`},ot={class:`info-item branch-item`},st={class:`info-label`},ct={key:0,class:`branch-container`},lt={key:1,class:`info-value info-value-muted`},ut={class:`info-item message-item`},dt={class:`info-label`},$={class:`info-message-wrapper`},ft={class:`info-message-title`},pt=[`innerHTML`],mt=[`aria-label`,`onKeydown`];function ht(t,r,i,o,s,c){let u=l,d=te,f=y;return h(),e(g,null,[n(`div`,{class:v([`card`,{"fullscreen-mode":o.isFullscreen}])},[C(` 固定头部区域 `),n(`div`,Ie,[n(`div`,W,[n(`h2`,null,D(o.$t(`@A1833:提交历史`)),1)]),n(`div`,G,[C(` 分支图开关 `),a(o.IconButton,{tooltip:o.showGraph?o.$t(`@A1833:隐藏分支图`):o.$t(`@A1833:显示分支图`),active:o.showGraph,"custom-class":`graph-toggle-button`,onClick:r[0]||=e=>o.showGraph=!o.showGraph},{default:w(()=>[(h(),e(`svg`,K,[...r[30]||=[n(`circle`,{cx:`6`,cy:`5`,r:`2.2`},null,-1),n(`circle`,{cx:`6`,cy:`19`,r:`2.2`},null,-1),n(`circle`,{cx:`18`,cy:`9`,r:`2.2`},null,-1),n(`path`,{d:`M6 7.2v9.6`},null,-1),n(`path`,{d:`M18 11.2c0 4-4 4.8-9.2 5.6`},null,-1)]]))]),_:1},8,[`tooltip`,`active`]),C(` 筛选按钮 `),a(o.IconButton,{tooltip:o.filterVisible?o.$t(`@A1833:隐藏筛选`):o.$t(`@A1833:显示筛选`),active:o.filterVisible,"custom-class":`filter-button`,onClick:r[1]||=e=>o.filterVisible=!o.filterVisible},{default:w(()=>[a(u,null,{default:w(()=>[a(o.Filter)]),_:1})]),_:1},8,[`tooltip`,`active`]),C(` 全屏按钮 `),a(o.IconButton,{tooltip:o.isFullscreen?o.$t(`@A1833:退出全屏`):o.$t(`@A1833:全屏显示`),active:o.isFullscreen,"custom-class":`fullscreen-button`,onClick:o.toggleFullscreen},{default:w(()=>[o.isFullscreen?(h(),e(`svg`,q,[...r[31]||=[n(`path`,{d:`M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z`},null,-1)]])):(h(),p(u,{key:0},{default:w(()=>[a(o.FullScreen)]),_:1}))]),_:1},8,[`tooltip`,`active`]),C(` 刷新按钮 `),a(o.IconButton,{tooltip:o.$t(`@A1833:刷新日志`),"custom-class":`refresh-button`,onClick:r[2]||=e=>o.refreshLog()},{default:w(()=>[a(u,null,{default:w(()=>[a(o.RefreshRight)]),_:1})]),_:1},8,[`tooltip`])])]),C(` 筛选面板放在头部下方,但在内容区域之前 `),o.filterVisible?(h(),e(`div`,Le,[n(`div`,J,[n(`div`,Re,[a(o.ElSelect,{modelValue:o.authorFilter,"onUpdate:modelValue":r[3]||=e=>o.authorFilter=e,placeholder:o.$t(`@A1833:选择作者`),"aria-label":o.$t(`@A1833:作者`),multiple:``,clearable:``,filterable:``,class:`filter-input`,size:`small`},{prefix:w(()=>[n(`span`,ze,D(o.$t(`@A1833:作者`)),1)]),default:w(()=>[(h(!0),e(g,null,x(o.availableAuthors,e=>(h(),p(o.ElOption,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`aria-label`])]),n(`div`,Be,[a(o.ElSelect,{modelValue:o.branchFilter,"onUpdate:modelValue":r[4]||=e=>o.branchFilter=e,placeholder:o.$t(`@A1833:选择分支`),"aria-label":o.$t(`@A1833:分支`),multiple:``,clearable:``,filterable:``,class:`filter-input`,size:`small`},{prefix:w(()=>[n(`span`,Y,D(o.$t(`@A1833:分支`)),1)]),default:w(()=>[(h(!0),e(g,null,x(o.availableBranches,e=>(h(),p(o.ElOption,{key:e,label:e,value:e},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`aria-label`])]),n(`div`,Ve,[a(o.ElInput,{modelValue:o.messageFilter,"onUpdate:modelValue":r[5]||=e=>o.messageFilter=e,placeholder:o.$t(`@A1833:提交信息关键词`),"aria-label":o.$t(`@A1833:提交信息关键词`),clearable:``,class:`filter-input`,size:`small`,onKeyup:b(o.applyFilters,[`enter`])},{prefix:w(()=>[n(`span`,He,D(o.$t(`@A1833:信息`)),1)]),_:1},8,[`modelValue`,`placeholder`,`aria-label`])]),n(`div`,Ue,[a(o.ElDatePicker,{modelValue:o.dateRangeFilter,"onUpdate:modelValue":r[6]||=e=>o.dateRangeFilter=e,type:`daterange`,"range-separator":o.$t(`@A1833:至`),"start-placeholder":o.$t(`@A1833:开始日期`),"end-placeholder":o.$t(`@A1833:结束日期`),"aria-label":o.$t(`@A1833:日期`),format:`YYYY-MM-DD`,"value-format":`YYYY-MM-DD`,class:`filter-input date-range`,size:`small`},{prefix:w(()=>[n(`span`,We,D(o.$t(`@A1833:日期`)),1)]),_:1},8,[`modelValue`,`range-separator`,`start-placeholder`,`end-placeholder`,`aria-label`])]),n(`div`,X,[a(o.ElButton,{type:`primary`,size:`small`,onClick:o.applyFilters,class:`filter-action-button`},{default:w(()=>[m(D(o.$t(`@A1833:应用`)),1)]),_:1}),a(o.ElButton,{type:`info`,size:`small`,onClick:o.resetFilters,class:`filter-action-button`},{default:w(()=>[m(D(o.$t(`@A1833:重置`)),1)]),_:1})])])])):C(`v-if`,!0),C(` 内容区域,添加上边距以避免被固定头部遮挡 `),n(`div`,{class:v([`content-area`,{"with-filter":o.filterVisible}])},[o.errorMessage&&o.gitStore.isGitRepo?(h(),e(`div`,Ge,D(o.errorMessage),1)):o.gitStore.isGitRepo?(h(),e(`div`,Je,[C(` 表格视图 `),n(`div`,Ye,[O((h(),p(o.ElTable,{ref:`tableRef`,data:o.filteredLogs,stripe:``,border:``,size:`small`,class:`log-table compact-table`,"empty-text":o.isLoading?o.$t(`@A1833:加载中…`):o.$t(`@A1833:没有匹配的提交记录`),height:`450`,onRowContextmenu:o.handleContextMenu,onRowClick:r[7]||=e=>o.viewCommitDetail(e)},{default:w(()=>[C(` Git 分支图列(最左侧) `),o.showGraph?(h(),p(o.ElTableColumn,{key:0,width:o.graphColumnWidth,"class-name":`graph-column`,align:`center`},{default:w(e=>[o.graphRowMap.get(e.row.hash)?(h(),p(o.CommitGraphCell,{key:0,layout:o.graphRowMap.get(e.row.hash),width:o.graphColumnWidth},null,8,[`layout`,`width`])):C(`v-if`,!0)]),_:1},8,[`width`])):C(`v-if`,!0),a(o.ElTableColumn,{label:o.$t(`@A1833:提交信息`),"min-width":`300`},{default:w(t=>[n(`div`,Xe,[C(` 分支信息和提交信息水平排列 `),n(`div`,Ze,[C(` 分支信息 `),t.row.branch?(h(),e(`div`,Qe,[(h(!0),e(g,null,x(t.row.branch.split(`,`),(e,t)=>(h(),p(o.ElTag,{key:t,size:`small`,type:o.getBranchTagType(e),class:`branch-tag`},{default:w(()=>[m(D(o.formatBranchName(e)),1)]),_:2},1032,[`type`]))),128))])):C(`v-if`,!0),C(` 提交信息(hover 显示完整内容预览) `),t.row.message?(h(),p(d,{key:1,content:t.row.message,placement:`top`,"show-after":350,disabled:!o.isMessageTruncated(t.row.message),"popper-class":`commit-message-tooltip`},{default:w(()=>[n(`span`,$e,D(t.row.message),1)]),_:2},1032,[`content`,`disabled`])):C(`v-if`,!0),a(o.ElButton,{icon:o.CopyDocument,size:`small`,onClick:k(e=>o.copyPureMessage(t.row.message),[`stop`]),class:`copy-message-btn`,title:o.$t(`@A1833:复制纯净提交信息(不含类型前缀)`),"aria-label":o.$t(`@A1833:复制纯净提交信息(不含类型前缀)`)},null,8,[`icon`,`onClick`,`title`,`aria-label`])])])]),_:1},8,[`label`]),a(o.ElTableColumn,{prop:`date`,"class-name":`commit-date-cell`,label:o.$t(`@A1833:日期`),"min-width":`130`,width:`150`,resizable:``},null,8,[`label`]),a(o.ElTableColumn,{label:o.$t(`@A1833:作者`),"min-width":`90`,width:`120`,resizable:``},{default:w(e=>[a(d,{content:e.row.email,placement:`top`,"show-after":200},{default:w(()=>[n(`span`,Z,D(e.row.author),1)]),_:2},1032,[`content`])]),_:1},8,[`label`]),a(o.ElTableColumn,{label:o.$t(`@A1833:哈希`),"min-width":`78`,width:`78`,align:`center`,resizable:``},{default:w(e=>[a(d,{content:e.row.hash,placement:`top`,"show-after":300},{default:w(()=>[n(`button`,{type:`button`,class:`commit-hash`,title:o.$t(`@A1833:点击复制完整哈希`),"aria-label":o.$t(`@A1833:复制提交哈希 {hash}`,{hash:e.row.hash.substring(0,7)}),onClick:k(t=>o.copyCommitHash(e.row),[`stop`])},D(e.row.hash.substring(0,7)),9,et)]),_:2},1032,[`content`])]),_:1},8,[`label`])]),_:1},8,[`data`,`empty-text`])),[[f,o.isLoading]])])])):(h(),e(`div`,Ke,[a(u,{class:`log-empty-icon`},{default:w(()=>[a(o.Document)]),_:1}),n(`span`,qe,D(o.$t(`@A1833:暂无提交记录`)),1)]))],2),C(` 提交详情弹窗 `),a(o.CommonDialog,{modelValue:o.commitDetailVisible,"onUpdate:modelValue":r[9]||=e=>o.commitDetailVisible=e,title:`${o.$t(`@A1833:提交详情: `)}${o.selectedCommit?.hash?o.selectedCommit.hash:o.$t(`@A1833:未知`)}`,size:`fullscreen`,type:`flex`,heightMode:`fixed`,"destroy-on-close":``,"custom-class":`commit-detail-dialog`},{default:w(()=>[O((h(),e(`div`,tt,[C(` 提交基本信息 `),o.selectedCommit?(h(),e(`div`,nt,[n(`div`,Q,[n(`div`,rt,[n(`span`,it,D(o.$t(`@A1833:日期`)),1),n(`span`,at,D(o.selectedCommit.date),1)]),n(`div`,ot,[n(`span`,st,D(o.$t(`@A1833:所在分支`)),1),o.selectedCommitBranches.length>0?(h(),e(`div`,ct,[(h(!0),e(g,null,x(o.selectedCommitBranches,e=>(h(),p(o.ElTag,{key:e,size:`small`,type:o.getBranchTagType(e),class:`branch-tag`},{default:w(()=>[m(D(o.formatBranchName(e)),1)]),_:2},1032,[`type`]))),128))])):(h(),e(`span`,lt,D(o.$t(`@A1833:暂不属于任何分支`)),1))]),n(`div`,ut,[n(`span`,dt,D(o.$t(`@A1833:提交信息`)),1),n(`div`,$,[n(`div`,ft,D(o.commitMessageTitle),1),o.commitMessageExpanded&&o.hasCommitMessageBody?(h(),e(`div`,{key:0,class:`info-message-body`,innerHTML:o.commitMessageBodyHtml},null,8,pt)):C(`v-if`,!0)]),o.hasCommitMessageBody?(h(),e(`button`,{key:0,class:`info-message-toggle`,onClick:r[8]||=e=>o.commitMessageExpanded=!o.commitMessageExpanded},[m(D(o.commitMessageExpanded?o.$t(`@A1833:收起`):o.$t(`@A1833:展开`))+` `,1),n(`span`,{class:v([`info-message-toggle-icon`,{"is-expanded":o.commitMessageExpanded}])},`▾`,2)])):C(`v-if`,!0)])])])):C(`v-if`,!0),C(` 变更文件列表和差异 `),a(o.FileDiffViewer,{files:o.commitFilesForViewer,loading:o.isLoadingCommitDetail,diffContent:o.commitDiff,selectedFile:o.selectedCommitFile,plainText:!1,compareMode:o.commitFileViewMode!==`diff`,compareOriginal:o.commitCompareOriginal,compareModified:o.commitCompareModified,context:`commit-detail`,"commit-hash":o.selectedCommit?.hash,emptyText:o.$t(`@A1833:没有找到变更文件`),"show-vscode-button":o.toolsStore.vscodeAvailable,onFileSelect:o.handleCommitFileSelect,onOpenFile:o.handleOpenFile,onOpenWithVscode:o.handleOpenWithVSCode,onOpenInEditor:o.handleOpenInEditor},{"header-extra":w(()=>[a(o.ElButton,{size:`small`,type:o.commitFileViewMode===`diff`?`primary`:`default`,onClick:o.handleCommitDiffOnly},{default:w(()=>[m(D(o.$t(`@A1833:仅显示差异`)),1)]),_:1},8,[`type`]),a(o.ElButton,{size:`small`,type:o.commitFileViewMode===`diff`?`default`:`primary`,onClick:o.handleCommitFullCompare},{default:w(()=>[m(D(o.$t(`@A1833:显示完整对比`)),1)]),_:1},8,[`type`]),a(o.ElButton,{size:`small`,disabled:!o.selectedCommitFile,onClick:o.copyCommitFileDiff},{default:w(()=>[m(D(o.$t(`@A1833:复制差异`)),1)]),_:1},8,[`disabled`])]),_:1},8,[`files`,`loading`,`diffContent`,`selectedFile`,`compareMode`,`compareOriginal`,`compareModified`,`commit-hash`,`emptyText`,`show-vscode-button`])])),[[f,o.isLoadingCommitDetail]])]),_:1},8,[`modelValue`,`title`])],2),C(` 添加右键菜单 `),O(n(`ul`,{class:v([`context-menu`,{"fullscreen-context-menu":o.isFullscreen}]),style:ie({top:o.contextMenuTop+`px`,left:o.contextMenuLeft+`px`}),ref:`contextMenuRef`,role:`menu`,"aria-label":o.$t(`@A1833:提交操作菜单`),onKeydown:[b(k(o.closeContextMenu,[`prevent`]),[`esc`]),r[28]||=b(k(e=>o.moveContextMenuFocus(1),[`prevent`]),[`down`]),r[29]||=b(k(e=>o.moveContextMenuFocus(-1),[`prevent`]),[`up`])]},[n(`li`,{class:`context-menu-item`,role:`menuitem`,tabindex:`-1`,onClick:r[10]||=e=>o.viewCommitDetail(o.selectedContextCommit),onKeydown:[r[11]||=b(k(e=>o.viewCommitDetail(o.selectedContextCommit),[`prevent`]),[`enter`]),r[12]||=b(k(e=>o.viewCommitDetail(o.selectedContextCommit),[`prevent`]),[`space`])]},[r[32]||=n(`i`,{class:`el-icon-view`,"aria-hidden":`true`},null,-1),m(` `+D(o.$t(`@A1833:查看详情`)),1)],32),n(`li`,{class:`context-menu-item`,role:`menuitem`,tabindex:`-1`,onClick:r[13]||=e=>o.copyCommitHash(o.selectedContextCommit),onKeydown:[r[14]||=b(k(e=>o.copyCommitHash(o.selectedContextCommit),[`prevent`]),[`enter`]),r[15]||=b(k(e=>o.copyCommitHash(o.selectedContextCommit),[`prevent`]),[`space`])]},[r[33]||=n(`i`,{class:`el-icon-document-copy`,"aria-hidden":`true`},null,-1),m(` `+D(o.$t(`@A1833:复制提交哈希`)),1)],32),n(`li`,{class:`context-menu-item`,role:`menuitem`,tabindex:`-1`,onClick:r[16]||=e=>o.copyCommitContent(o.selectedContextCommit),onKeydown:[r[17]||=b(k(e=>o.copyCommitContent(o.selectedContextCommit),[`prevent`]),[`enter`]),r[18]||=b(k(e=>o.copyCommitContent(o.selectedContextCommit),[`prevent`]),[`space`])]},[r[34]||=n(`i`,{class:`el-icon-document`,"aria-hidden":`true`},null,-1),m(` `+D(o.$t(`@A1833:复制提交内容`)),1)],32),n(`li`,{class:`context-menu-item`,role:`menuitem`,tabindex:`-1`,onClick:r[19]||=e=>o.resetToCommit(o.selectedContextCommit),onKeydown:[r[20]||=b(k(e=>o.resetToCommit(o.selectedContextCommit),[`prevent`]),[`enter`]),r[21]||=b(k(e=>o.resetToCommit(o.selectedContextCommit),[`prevent`]),[`space`])]},[r[35]||=n(`i`,{class:`el-icon-refresh-right`,"aria-hidden":`true`},null,-1),m(` `+D(o.$t(`@A1833:重置到该提交(hard)`)),1)],32),n(`li`,{class:`context-menu-item`,role:`menuitem`,tabindex:`-1`,onClick:r[22]||=e=>o.revertCommit(o.selectedContextCommit),onKeydown:[r[23]||=b(k(e=>o.revertCommit(o.selectedContextCommit),[`prevent`]),[`enter`]),r[24]||=b(k(e=>o.revertCommit(o.selectedContextCommit),[`prevent`]),[`space`])]},[r[36]||=n(`i`,{class:`el-icon-delete`,"aria-hidden":`true`},null,-1),m(` `+D(o.$t(`@A1833:撤销提交 (Revert)`)),1)],32),n(`li`,{class:`context-menu-item`,role:`menuitem`,tabindex:`-1`,onClick:r[25]||=e=>o.cherryPickCommit(o.selectedContextCommit),onKeydown:[r[26]||=b(k(e=>o.cherryPickCommit(o.selectedContextCommit),[`prevent`]),[`enter`]),r[27]||=b(k(e=>o.cherryPickCommit(o.selectedContextCommit),[`prevent`]),[`space`])]},[r[37]||=n(`i`,{class:`el-icon-edit`,"aria-hidden":`true`},null,-1),m(` Cherry`+D(o.$t(`@A1833:-Pick 到当前分支`)),1)],32)],46,mt),[[j,o.contextMenuVisible]])],64)}var gt=me(Fe,[[`render`,ht],[`__scopeId`,`data-v-aeb72cea`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/views/components/LogList.vue`]]);export{gt as default};
@@ -1,2 +0,0 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ct as t,Dn as n,En as r,Fn as i,Ht as a,Ir as o,J as s,Jn as c,L as l,Ln as u,On as d,Pn as f,Qn as p,Sn as m,Vn as h,W as g,Xn as _,Y as v,Yr as y,Zr as b,a as x,dn as S,er as C,ht as w,i as T,kn as E,lr as D,lt as O,mr as k,pt as ee,r as A,sr as te,ti as j,ur as M,wn as N,xn as P,xr as F,xt as ne,yn as I,z as L,zt as re}from"./element-plus-CDrtgG55.js";import{C as ie,S as R,m as ae}from"./vendor-DYtaPSUU.js";import{n as z,t as B}from"./_plugin-vue_export-helper-BY0jlMBE.js";import{o as oe,t as V}from"./configStore-EvRYufor.js";import{n as se,t as ce}from"./flow-mindmap-C8x6ucsA.js";import{T as le,a as ue}from"./index-CyEcaEC9.js";k(),h();function H(e){let t=(e||``).trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);return n?/^[a-z]:$/i.test(n)?`${n}\\`:n:t}function U(e){return H(e).replace(/\//g,`\\`).replace(/\\+$/,``).toLowerCase()}function W(e,t){let n=U(e),r=U(t);return!n||!r?!1:n===r||n.startsWith(r.endsWith(`\\`)?r:`${r}\\`)}function G(e){let t=Math.max(e.lastIndexOf(`\\`),e.lastIndexOf(`/`));return t>0?e.slice(0,t):e}var de=R(`mindmap`,()=>{let e=V(),t=F([]),n=F([]),i=F(null),a=F(!1),o=F(!1),s=F(null),c=F(``),l=F(``),u=r(()=>i.value!==null),d=r(()=>n.value.reduce((e,t)=>e+t.files.length,0)),f=r(()=>n.value.some(e=>e.loading));function p(){e.ui.mindmapDirs=[...t.value]}function m(e){return n.value.find(t=>U(t.dir)===U(e))}function h(e){let t=m(e);if(t)return t;let r={dir:e,files:[],error:null,loading:!1};return n.value.push(r),r}function g(e){let n=H(e);return!n||t.value.some(e=>U(e)===U(n))?!1:(t.value.push(n),h(n),!0)}let _=new Map;async function v(e){let n=m(e);if(!n)return;let r=U(n.dir),i=(_.get(r)||0)+1;_.set(r,i),n.loading=!0,n.error=null;try{let e=await(await fetch(`/api/mindmap/list?dir=${encodeURIComponent(n.dir)}`)).json();if(_.get(r)!==i)return;if(e.success){let r=typeof e.dir==`string`&&e.dir?e.dir:n.dir;if(r!==n.dir){let e=t.value.findIndex(e=>U(e)===U(n.dir));e>=0&&(t.value[e]=r),n.dir=r,p()}n.files=e.files||[]}else n.error=e.error||`读取目录失败`,n.files=[]}catch(e){if(_.get(r)!==i)return;n.error=e?.message||String(e),n.files=[]}finally{_.get(r)===i&&(n.loading=!1)}}async function y(){await Promise.all(t.value.map(e=>v(e)))}async function b(){let n=Array.isArray(e.ui.mindmapDirs)?e.ui.mindmapDirs:[];for(let e of n)g(e);c.value&&!t.value.some(e=>U(e)===U(c.value))&&(c.value=``),await y()}async function x(e){let t=[];for(let n of e||[]){let e=H(n);e&&g(e)&&t.push(e)}return t.length===0?0:(p(),c.value||=t[0],await Promise.all(t.map(e=>v(e))),t.length)}function S(e){let r=U(e);t.value=t.value.filter(e=>U(e)!==r),n.value=n.value.filter(e=>U(e.dir)!==r),_.delete(r),c.value&&U(c.value)===r&&(c.value=``),p()}function C(){if(t.value.length===0)return{dir:null,ambiguous:!1};let e=t.value.find(e=>U(e)===U(c.value));if(e)return{dir:e,ambiguous:!1};let n=i.value?.path;if(n){let e=t.value.find(e=>W(n,e));if(e)return{dir:e,ambiguous:!1}}return t.value.length===1?{dir:t.value[0],ambiguous:!1}:{dir:null,ambiguous:!0}}async function w(e,n=!1){if(!n&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let n=await(await fetch(`/api/mindmap/read?path=${encodeURIComponent(e)}`)).json();if(n.success){i.value={path:n.path,title:n.title,content:n.content,mtime:n.mtime},l.value=n.content,a.value=!1;let e=t.value.find(e=>W(n.path,e));c.value=e||G(n.path)}else s.value=n.error||`读取文件失败`}catch(e){s.value=e?.message||String(e)}finally{o.value=!1}}async function T(e,t=!1,n){let r=n?H(n):C().dir;if(!r)throw Error(`未选择目录`);if(!t&&a.value&&i.value)throw Error(`UNSAVED_CHANGES`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/create`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dir:r,name:e})})).json();if(t.success)i.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,a.value=!1,c.value=r,await v(r);else throw s.value=t.error||`新建失败`,Error(t.error||`新建失败`)}catch(e){throw e.message===`UNSAVED_CHANGES`||(s.value=e?.message||String(e)),e}finally{o.value=!1}}async function E(e){if(!i.value)throw Error(`没有打开的文件`);o.value=!0,s.value=null;try{let t=await(await fetch(`/api/mindmap/save`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i.value.path,content:e})})).json();if(t.success){let n=i.value.path;return i.value&&(i.value.content=e,i.value.mtime=t.mtime),l.value=e,a.value=!1,await D(n),t}throw s.value=t.error||`保存失败`,Error(t.error||`保存失败`)}catch(e){throw s.value=e?.message||String(e),e}finally{o.value=!1}}async function D(e){let t=n.value.find(t=>W(e,t.dir));t&&await v(t.dir)}async function O(e){let t=await(await fetch(`/api/mindmap/delete`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})})).json();if(!t.success)throw Error(t.error||`删除失败`);return i.value&&i.value.path===e&&(i.value=null,a.value=!1,l.value=``),await D(e),t}async function k(e,t){let n=await(await fetch(`/api/mindmap/rename`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,newName:t})})).json();if(!n.success)throw Error(n.error||`重命名失败`);return i.value&&e===i.value.path&&(i.value={...i.value,path:n.path,title:t}),await D(n.path||e),n}function ee(){i.value&&(a.value=!0)}function A(){i.value=null,a.value=!1,l.value=``}return{dirs:t,groups:n,current:i,dirty:a,loading:o,refreshing:f,error:s,activeDir:c,hasCurrent:u,filesCount:d,init:b,addDirs:x,removeDir:S,refresh:y,refreshDir:v,resolveTargetDir:C,openFile:w,createFile:T,saveCurrent:E,deleteFile:O,renameFile:k,markDirty:ee,closeCurrent:A}});h(),k();var K=1500,q=u({__name:`MindmapView`,setup(e,{expose:n}){n();let i=de(),o=V(),{currentLocale:s}=ie(oe()),l=r(()=>{let e=o.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),u=F(null),d=F(!1);function f(){d.value=!0}async function p(e){d.value=!1;let t=(e||[]).filter(Boolean);if(t.length!==0)try{let e=await i.addDirs(t);e>0?T.success(z(`@MINDMAP:已添加目录`,{n:e})):T.info(z(`@MINDMAP:重复目录已忽略`))}catch(e){T.error(e?.message||z(`@MINDMAP:读取目录失败`))}}let m=F({});function h(e){m.value={...m.value,[e]:!m.value[e]},i.activeDir=e}function g(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}function y(e){return!!i.activeDir&&i.activeDir.toLowerCase()===e.toLowerCase()}function b(){let{dir:e,ambiguous:t}=i.resolveTargetDir();return e||(T.warning(z(t?`@MINDMAP:请选择目标目录`:`@MINDMAP:请先添加目录`)),null)}async function x(e){let t=e||b();if(!t||(e&&(i.activeDir=e),!await k()))return;let n=``;try{n=(await A.prompt(z(`@MINDMAP:输入文件名提示`),z(`@MINDMAP:新建思维导图`),{confirmButtonText:z(`@MINDMAP:新建`),cancelButtonText:z(`@MINDMAP:取消`),inputPlaceholder:z(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?z(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||z(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await i.createFile(n,!0,t),T.success(z(`@MINDMAP:已新建并打开`))}catch(e){T.error(e?.message||z(`@MINDMAP:新建失败`))}}async function S(e=!1){if(i.current)try{let t=u.value?.exportData();if(!t){e||T.warning(z(`@MINDMAP:无法获取数据`));return}await i.saveCurrent(t),e||T.success(z(`@MINDMAP:已保存`))}catch(e){T.error(e?.message||z(`@MINDMAP:保存失败`))}}let C=null;function E(){i.current&&i.dirty&&(C&&clearTimeout(C),C=setTimeout(()=>{C=null,i.current&&i.dirty&&S(!0)},K))}function D(){C&&=(clearTimeout(C),null)}async function k(){if(!i.dirty||!i.current)return!0;try{await A.confirm(z(`@MINDMAP:未保存提示`,{title:i.current.title}),z(`@MINDMAP:未保存的改动`),{confirmButtonText:z(`@MINDMAP:保存`),cancelButtonText:z(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),D();let e=u.value?.exportData();return e&&(await i.saveCurrent(e),T.success(z(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(D(),!0)}}async function j(e){if(!(i.current&&i.current.path===e)&&await k())try{await i.openFile(e,!0)}catch(e){T.error(e?.message||z(`@MINDMAP:打开失败`))}}async function M(e){let t=!!i.current&&W(i.current.path,e),n=z(`@MINDMAP:确认移除目录提示`,{dir:e});t&&(n=`${n} ${z(`@MINDMAP:当前文件将保持打开`)}`);try{await A.confirm(n,z(`@MINDMAP:移除目录`),{confirmButtonText:z(`@MINDMAP:移除目录`),cancelButtonText:z(`@MINDMAP:取消`),type:`warning`})}catch{return}i.removeDir(e),T.success(z(`@MINDMAP:已移除目录`))}let N=F(null);function P(e,t){e.preventDefault(),N.value={x:e.clientX,y:e.clientY,dir:t}}function I(){N.value=null}async function L(){let e=N.value?.dir;if(I(),!e)return;let t=await le(e);t.success?T.success(t.message||z(`@MINDMAP:已在文件管理器中打开`)):T.error(t.error||z(`@MINDMAP:打开目录失败`))}function R(){let e=N.value?.dir;I(),e&&x(e)}function B(){let e=N.value?.dir;I(),e&&M(e)}async function H(e){try{await A.confirm(z(`@MINDMAP:确认删除提示`,{title:e.title}),z(`@MINDMAP:删除`),{confirmButtonText:z(`@MINDMAP:删除`),cancelButtonText:z(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await i.deleteFile(e.path),T.success(z(`@MINDMAP:已删除`))}catch(e){T.error(e?.message||z(`@MINDMAP:删除失败`))}}async function U(e){let t=``;try{t=(await A.prompt(z(`@MINDMAP:输入新名称提示`),z(`@MINDMAP:重命名`),{confirmButtonText:z(`@MINDMAP:确定`),cancelButtonText:z(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?z(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||z(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await i.renameFile(e.path,t),T.success(z(`@MINDMAP:已重命名`))}catch(e){T.error(e?.message||z(`@MINDMAP:重命名失败`))}}function G(e){i.markDirty(),E()}function q(e){}async function J(e){let t=e||b();if(!t)return;let n=``,r=``;try{n=(await A.prompt(z(`@MINDMAP:粘贴Markdown提示`),z(`@MINDMAP:从Markdown导入`),{confirmButtonText:z(`@MINDMAP:导入`),cancelButtonText:z(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:z(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?z(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{r=(await A.prompt(z(`@MINDMAP:输入文件名提示`),z(`@MINDMAP:文件名`),{confirmButtonText:z(`@MINDMAP:新建`),cancelButtonText:z(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?z(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||z(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await i.createFile(r,!0,t);let e=ce(n,r),a=JSON.stringify(e,null,2);await i.saveCurrent(a),T.success(z(`@MINDMAP:已导入`))}catch(e){T.error(e?.message||z(`@MINDMAP:导入失败`))}}async function Y(){if(u.value)try{let e=u.value.getMarkdown();await navigator.clipboard.writeText(e),T.success(z(`@MINDMAP:已复制Markdown`))}catch(e){T.error(e?.message||z(`@MINDMAP:复制失败`))}}function X(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),i.current&&i.dirty&&(D(),S()))}let Z=F(0);te(()=>i.current?.path,()=>{Z.value++});let Q=F(!1);function fe(){Q.value=!Q.value}let pe=r(()=>{let e=i.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});_(async()=>{window.addEventListener(`keydown`,X),document.addEventListener(`click`,I),await i.init()}),c(()=>{window.removeEventListener(`keydown`,X),document.removeEventListener(`click`,I),D()});function me(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?z(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${z(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${z(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function he(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}let $={store:i,configStore:o,currentLocale:s,isDark:l,mmRef:u,filePickerVisible:d,openDirPicker:f,onPickerConfirm:p,collapsedGroups:m,toggleGroup:h,baseName:g,isActiveDir:y,pickTargetDir:b,handleNewFile:x,handleSave:S,AUTOSAVE_DELAY:K,get autosaveTimer(){return C},set autosaveTimer(e){C=e},scheduleAutosave:E,cancelAutosave:D,confirmDiscardIfDirty:k,handleOpenFile:j,handleRemoveDir:M,ctxMenu:N,openDirContextMenu:P,closeCtxMenu:I,ctxOpenDir:L,ctxNewFile:R,ctxRemoveDir:B,handleDelete:H,handleRename:U,onMindMapChange:G,onMindMapSelect:q,handleImportMarkdown:J,handleExportMarkdown:Y,onKeydown:X,mmKey:Z,previewMode:Q,onCanvasTogglePreview:fe,mmData:pe,formatTime:me,formatSize:he,get $t(){return z},get FolderOpened(){return t},get Plus(){return re},get FolderChecked(){return ne},get Delete(){return O},get Edit(){return w},get Refresh(){return a},get Document(){return ee},get ArrowDown(){return v},get FilePicker(){return ae},get MindMap(){return se},EmptyState:ue};return Object.defineProperty($,"__isScriptSetup",{enumerable:!1,value:!0}),$}});h(),o(),S();var J={class:`mindmap-view`},Y={class:`mm-toolbar`},X={class:`mm-toolbar-left`},Z={class:`mm-dir-tooltip`},Q={key:1,class:`mm-dir-empty`},fe={class:`mm-toolbar-right`},pe={key:0,class:`mm-status`},me=[`title`],he={key:0,class:`mm-status-dirty`},$={class:`mm-body`},ge={class:`mm-sidebar`},_e={class:`mm-sidebar-header`},ve={class:`mm-sidebar-title`},ye={class:`mm-sidebar-list`},be={key:0,class:`mm-sidebar-error`},xe=[`title`,`onClick`,`onContextmenu`],Se={class:`mm-group-info`},Ce={class:`mm-group-name`},we={class:`mm-group-title`},Te={class:`mm-group-count`},Ee={class:`mm-group-path`},De={class:`mm-group-body`},Oe=[`title`],ke=[`onClick`],Ae={class:`mm-file-info`},je=[`title`],Me={class:`mm-file-meta`},Ne={class:`mm-editor`};function Pe(t,r,a,o,c,u){let h=L,_=l,v=g,S=s,w=x;return p(),e(`div`,J,[E(` 顶部工具栏 `),n(`div`,Y,[n(`div`,X,[i(h,{size:`small`,icon:o.FolderOpened,onClick:o.openDirPicker},{default:D(()=>[f(j(o.$t(`@MINDMAP:添加目录`)),1)]),_:1},8,[`icon`]),o.store.dirs.length>0?(p(),d(v,{key:0,placement:`bottom-start`,"show-after":200},{content:D(()=>[n(`div`,Z,[(p(!0),e(m,null,C(o.store.dirs,t=>(p(),e(`div`,{key:t},j(t),1))),128))])]),default:D(()=>[i(_,{size:`small`,type:`info`,class:`mm-dir-tag`},{default:D(()=>[f(j(o.$t(`@MINDMAP:个目录`,{n:o.store.dirs.length})),1)]),_:1})]),_:1})):(p(),e(`span`,Q,j(o.$t(`@MINDMAP:请先添加目录`)),1))]),n(`div`,fe,[i(h,{size:`small`,icon:o.Plus,disabled:o.store.dirs.length===0,onClick:r[0]||=e=>o.handleNewFile()},{default:D(()=>[f(j(o.$t(`@MINDMAP:新建`)),1)]),_:1},8,[`icon`,`disabled`]),i(h,{size:`small`,icon:o.Document,disabled:o.store.dirs.length===0,onClick:r[1]||=e=>o.handleImportMarkdown()},{default:D(()=>[f(j(o.$t(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`icon`,`disabled`]),i(h,{size:`small`,icon:o.Edit,disabled:!o.store.current,onClick:o.handleExportMarkdown},{default:D(()=>[f(j(o.$t(`@MINDMAP:复制MD`)),1)]),_:1},8,[`icon`,`disabled`]),i(h,{size:`small`,type:`primary`,icon:o.FolderChecked,disabled:!o.store.current||!o.store.dirty,loading:o.store.loading,onClick:r[2]||=()=>{o.cancelAutosave(),o.handleSave()}},{default:D(()=>[f(j(o.$t(`@MINDMAP:保存`)),1)]),_:1},8,[`icon`,`disabled`,`loading`]),o.store.current?(p(),e(`span`,pe,[n(`span`,{class:`mm-status-title`,title:o.store.current.title},j(o.store.current.title),9,me),o.store.dirty?(p(),e(`span`,he,`●`)):E(`v-if`,!0)])):E(`v-if`,!0)])]),n(`div`,$,[E(` 左侧:按目录分组的文件列表 `),n(`div`,ge,[n(`div`,_e,[n(`span`,ve,j(o.$t(`@MINDMAP:文件列表`)),1),i(h,{size:`small`,text:``,icon:o.Refresh,loading:o.store.refreshing,onClick:r[3]||=e=>o.store.refresh(),disabled:o.store.dirs.length===0},null,8,[`icon`,`loading`,`disabled`])]),M((p(),e(`div`,ye,[o.store.error?(p(),e(`div`,be,j(o.store.error),1)):E(`v-if`,!0),o.store.dirs.length===0?(p(),d(o.EmptyState,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:o.$t(`@MINDMAP:请先添加目录`)},null,8,[`title`])):(p(!0),e(m,{key:2},C(o.store.groups,t=>(p(),e(`div`,{key:t.dir,class:`mm-group`},[n(`div`,{class:y([`mm-group-header`,{active:o.isActiveDir(t.dir)}]),title:t.dir,onClick:e=>o.toggleGroup(t.dir),onContextmenu:e=>o.openDirContextMenu(e,t.dir)},[i(S,{class:y([`mm-group-caret`,{collapsed:o.collapsedGroups[t.dir]}])},{default:D(()=>[i(o.ArrowDown)]),_:1},8,[`class`]),n(`div`,Se,[n(`div`,Ce,[n(`span`,we,j(o.baseName(t.dir)),1),n(`span`,Te,j(t.files.length),1)]),n(`div`,Ee,j(t.dir),1)])],42,xe),M(n(`div`,De,[t.error?(p(),e(`div`,{key:0,class:`mm-group-error`,title:t.error},[n(`span`,null,j(o.$t(`@MINDMAP:目录不存在或已删除`)),1),i(h,{size:`small`,text:``,type:`danger`,onClick:e=>o.handleRemoveDir(t.dir)},{default:D(()=>[f(j(o.$t(`@MINDMAP:移除目录`)),1)]),_:1},8,[`onClick`])],8,Oe)):t.files.length===0?(p(),d(o.EmptyState,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:o.$t(`@MINDMAP:该目录暂无思维导图`)},null,8,[`title`])):(p(!0),e(m,{key:2},C(t.files,t=>(p(),e(`div`,{key:t.path,class:y([`mm-file-item`,{active:o.store.current?.path===t.path}]),onClick:e=>o.handleOpenFile(t.path)},[n(`div`,Ae,[n(`div`,{class:`mm-file-title`,title:t.title},j(t.title),9,je),n(`div`,Me,j(o.formatTime(t.mtime))+` · `+j(o.formatSize(t.size)),1)]),n(`div`,{class:`mm-file-actions`,onClick:r[4]||=P(()=>{},[`stop`])},[i(h,{size:`small`,text:``,icon:o.Edit,onClick:e=>o.handleRename(t),title:o.$t(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),i(h,{size:`small`,text:``,type:`danger`,icon:o.Delete,onClick:e=>o.handleDelete(t),title:o.$t(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,ke))),128))],512),[[I,!o.collapsedGroups[t.dir]]])]))),128))])),[[w,o.store.refreshing]])]),E(` 右侧编辑区 `),n(`div`,Ne,[o.store.current?(p(),d(o.MindMap,{key:o.mmKey,ref:`mmRef`,data:o.mmData,"preview-mode":o.previewMode,onChange:o.onMindMapChange,onSelect:o.onMindMapSelect,onCanvasTogglePreview:o.onCanvasTogglePreview},null,8,[`data`,`preview-mode`])):(p(),d(o.EmptyState,{key:0,class:`mm-editor-empty`,title:o.$t(`@MINDMAP:思维导图编辑器`),hint:o.store.dirs.length>0?o.$t(`@MINDMAP:从左侧选择或新建`):o.$t(`@MINDMAP:先选择目录提示`)},{icon:D(()=>[...r[7]||=[n(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`circle`,{cx:`12`,cy:`12`,r:`2`}),n(`circle`,{cx:`5`,cy:`5`,r:`2`}),n(`circle`,{cx:`19`,cy:`5`,r:`2`}),n(`circle`,{cx:`5`,cy:`19`,r:`2`}),n(`circle`,{cx:`19`,cy:`19`,r:`2`}),n(`line`,{x1:`10.5`,y1:`10.5`,x2:`6.5`,y2:`6.5`}),n(`line`,{x1:`13.5`,y1:`10.5`,x2:`17.5`,y2:`6.5`}),n(`line`,{x1:`10.5`,y1:`13.5`,x2:`6.5`,y2:`17.5`}),n(`line`,{x1:`13.5`,y1:`13.5`,x2:`17.5`,y2:`17.5`})],-1)]]),_:1},8,[`title`,`hint`]))])]),E(` 目录选择(local-file-picker,支持多选目录) `),E(` 传入当前目标目录作为 defaultPath:用户添加目录时不用每次都从根目录找,
2
- 已选过的话直接定位到上次的位置;无效时 picker 自动回落到用户目录 `),i(o.FilePicker,{visible:o.filePickerVisible,mode:`directory`,multiple:!0,theme:o.isDark?`dark`:`light`,locale:o.currentLocale,"default-path":o.store.activeDir||o.store.dirs[0]||``,onClose:r[5]||=e=>o.filePickerVisible=!1,onConfirm:o.onPickerConfirm},null,8,[`visible`,`theme`,`locale`,`default-path`]),E(` 目录右键菜单:打开目录 / 在此新建 / 移除目录 `),(p(),d(N,{to:`body`},[o.ctxMenu?(p(),e(`div`,{key:0,class:`ctx-menu`,style:b({left:o.ctxMenu.x+`px`,top:o.ctxMenu.y+`px`}),onClick:r[6]||=P(()=>{},[`stop`])},[n(`button`,{class:`ctx-menu-item`,onClick:o.ctxOpenDir},[E(` folder icon `),r[8]||=n(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`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`}),n(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),f(` `+j(o.$t(`@MINDMAP:打开目录`)),1)]),n(`button`,{class:`ctx-menu-item`,onClick:o.ctxNewFile},[E(` new-file icon `),r[9]||=n(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`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`}),n(`polyline`,{points:`14 2 14 8 20 8`}),n(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),n(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),f(` `+j(o.$t(`@MINDMAP:在此新建`)),1)]),r[11]||=n(`div`,{class:`ctx-menu-sep`},null,-1),n(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:o.ctxRemoveDir},[E(` trash icon `),r[10]||=n(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`polyline`,{points:`3 6 5 6 21 6`}),n(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),n(`path`,{d:`M10 11v6`}),n(`path`,{d:`M14 11v6`}),n(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),f(` `+j(o.$t(`@MINDMAP:移除目录`)),1)])],4)):E(`v-if`,!0)]))])}var Fe=B(q,[[`render`,Pe],[`__scopeId`,`data-v-b157fbd3`],[`__file`,`D:/workspace/github_workspace/zen-gitsync/src/ui/client/src/views/MindmapView.vue`]]);export{Fe as default};