zen-gitsync 2.18.6 → 2.18.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -1
- package/src/ui/public/assets/{AgentView-D-k_LYiJ.js → AgentView-BlG0PdkI.js} +1 -1
- package/src/ui/public/assets/{AppVersionBadge-D4YCHNS8.js → AppVersionBadge-D7X53Bf1.js} +1 -1
- package/src/ui/public/assets/{BranchSelector-CpYCgEuj.js → BranchSelector-yXxfIs57.js} +1 -1
- package/src/ui/public/assets/{CommitForm-CwOF_1gO.js → CommitForm-C8Ez91_c.js} +1 -1
- package/src/ui/public/assets/{CopySessionButton-SgJr0xOC.js → CopySessionButton-Do4vHJm6.js} +1 -1
- package/src/ui/public/assets/{EditorView-DwbVdSmS.js → EditorView-DK2dYRVb.js} +1 -1
- package/src/ui/public/assets/{FlowExecutionViewer-CKHp0Hfi.js → FlowExecutionViewer-BuU5kQG8.js} +1 -1
- package/src/ui/public/assets/{FlowOrchestrationWorkspace-RgXtsQ7y.js → FlowOrchestrationWorkspace-CTBEooj5.js} +1 -1
- package/src/ui/public/assets/{LogList-DdbyFS8j.js → LogList-Bq5aLoA-.js} +1 -1
- package/src/ui/public/assets/{MindmapView-ep2o8uXg.js → MindmapView-CSysrruz.js} +1 -1
- package/src/ui/public/assets/{MonitorView-BTNWi4QG.js → MonitorView-Cgf5zRxT.js} +1 -1
- package/src/ui/public/assets/{ProjectStartupButton-DWTFof63.js → ProjectStartupButton-CrLWTK20.js} +1 -1
- package/src/ui/public/assets/{RecentDirectoriesChat-Do1spWVH.js → RecentDirectoriesChat-BlIG_9G4.js} +1 -1
- package/src/ui/public/assets/{RemoteManagerDialog-DjLVltnm.js → RemoteManagerDialog-CJZFzQPc.js} +1 -1
- package/src/ui/public/assets/{RemoteRepoCard-DpcEDqyo.js → RemoteRepoCard-aSx1ikZ8.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-Djj6QLgu.js → SourceMapView-DEljf14g.js} +1 -1
- package/src/ui/public/assets/{UserInputNode-CQWY6Jwx.js → UserInputNode-oOQwaadU.js} +1 -1
- package/src/ui/public/assets/WorkbenchView-DXzxg5_z.js +8 -0
- package/src/ui/public/assets/{agentConversations-BvuyjfgF.js → agentConversations-BKjyYn-u.js} +1 -1
- package/src/ui/public/assets/configStore-D0oycG71.js +1 -0
- package/src/ui/public/assets/index-DjaZpz97.js +57 -0
- package/src/ui/public/assets/index-DwJWiCiN.css +1 -0
- package/src/ui/public/index.html +3 -3
- package/src/ui/server/utils/directoryFetch.js +14 -1
- package/src/ui/server/utils/directoryFetch.test.js +5 -0
- package/src/ui/public/assets/WorkbenchView-CQ8qLTMM.js +0 -8
- package/src/ui/public/assets/configStore-DojhW1P7.js +0 -1
- package/src/ui/public/assets/index-BuFKNHju.css +0 -1
- package/src/ui/public/assets/index-Z7rlN9LU.js +0 -57
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$r as e,An as t,Dn as n,Dr as r,En as i,Fn as a,Fr as o,Gn as s,Jn as c,Jr as l,Ln as u,Nn as ee,On as d,Pn as f,Qn as p,Sn as m,Sr as te,Vn as h,W as ne,Xn as re,Xr as g,bn as ie,dn as ae,er as oe,i as _,kn as v,lr as se,mn as ce,mr as y,r as le,sr as b,ur as x,vn as ue,wn as de,xn as S,xr as C,yn as fe}from"./element-plus-J45pKUrE.js";import{a as pe,n as w,r as me}from"./vendor-B3NyhlYR.js";import{n as T,t as E}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{t as he}from"./SvgIcon-Du5MOe8A.js";import{t as ge}from"./configStore-DojhW1P7.js";import{a as _e,c as ve,i as ye,n as be,o as xe,r as Se,s as Ce}from"./monaco-ChZ0d0qB.js";import{n as we,r as Te}from"./flow-mindmap-DvB74LE1.js";import{A as Ee,F as De,I as Oe,L as ke,M as Ae,N as je,P as Me,R as Ne,a as Pe,f as Fe,j as Ie}from"./index-Z7rlN9LU.js";import{a as Le,c as Re,i as ze,l as Be,n as Ve,o as He,p as Ue,r as We,s as D,t as Ge,u as Ke}from"./agentConversations-BvuyjfgF.js";import{c as qe,s as Je,t as Ye}from"./CopySessionButton-SgJr0xOC.js";function Xe(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`}h(),y();var Ze={class:`mindmap-preview`},Qe={class:`mindmap-preview-canvas`},$e=E(u({__name:`MindmapPreview`,props:{content:{}},setup(e){let o=e,s=i(()=>Te(o.content||``,`未命名文档`));return(e,i)=>(p(),t(`div`,Ze,[i[0]||=n(`div`,{class:`mindmap-preview-header`},[n(`span`,{class:`mindmap-preview-title`},`整篇导图`),n(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),n(`div`,Qe,[a(r(we),{data:s.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);h(),y(),o(),ae();var et={class:`agent-panel-header`},tt=[`title`,`aria-label`],nt={class:`agent-panel-title`},O={key:1,class:`agent-panel-title`},k=[`title`,`aria-label`],A=[`title`],rt={class:`agent-panel-convs`},it=[`data-theme`],at=[`title`],ot={class:`agent-context-att-name`},st=[`title`,`aria-label`],ct=E(u({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(o,{emit:u}){let f=o,te=u,{theme:h}=De(),ne=i(()=>h.value===`dark`?`dark`:`light`),{sessions:g,sessionsLoading:ie,currentSessionId:ae,messages:oe,isStreaming:_,questionPanel:se,answeringQuestion:ce,isSessionGenerating:y,currentEngine:le,pendingEngine:ue,isEngineLocked:S,pickEngine:E,loadSessions:he,loadSession:ge,deleteSession:_e,renameSession:ve,newSession:ye,sendMessage:be,retryTurn:xe,answerQuestion:Se,stop:Ce,inputContextUsage:we,queuedMessages:Te,queuePaused:Ee,removeQueuedMessage:Oe,flushQueued:ke}=Ke(),Ae=i(()=>S.value?le.value:ue.value);function je(e){S.value||E(e)}let Me=i(()=>Re(g.value,y)),Ne=Le(),Pe=He(),Fe=D(),Ie=i(()=>Me.value.find(e=>e.id===ae.value)?.title||``),Xe=C(null),Ze=C(null),Qe=C(null),$e=C(null),ct=C(null),{width:j,narrow:M}=qe(ct),N=C(`chat`),P=C(null),F=C(!1),I=null,L=i(()=>!!f.activeFileName&&!F.value);function lt(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function R(){let e=Ze.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!L.value){if(!t)return;P.value=null,s(()=>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=lt(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),P.value=n}function ut(e=!0){Xe.value?.scrollToBottom(e)}async function z(e){let t=F.value?void 0:f.activeFilePath||void 0;await be(e.text,e.files,{openFilePath:t}),await s(),ut()}function dt(e){ge(e),N.value=`chat`}function ft(){ye(),N.value=`chat`}b(()=>oe.value.length,()=>{s(()=>ut(!1))});function pt(){let e=$e.value;!e||typeof MutationObserver>`u`||(I?.disconnect(),I=new MutationObserver(()=>R()),I.observe(e,{childList:!0,subtree:!0}))}return b(()=>f.active,e=>{e&&(N.value=`chat`,he().catch(()=>{}),s(()=>{R(),ut(!1)}))}),b(M,e=>{e||(N.value=`chat`)}),b(()=>f.activeFilePath,()=>{F.value=!1}),b(L,e=>{e&&s(R)}),re(()=>{he().catch(()=>{}),s(()=>{R(),pt()})}),c(()=>{I?.disconnect(),I=null,P.value=null}),(i,s)=>(p(),t(`div`,{ref_key:`rootRef`,ref:ct,class:`editor-agent-panel`},[n(`div`,et,[r(M)&&N.value===`list`?(p(),t(m,{key:0},[n(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:r(T)(`@EDITOR:返回对话`),"aria-label":r(T)(`@EDITOR:返回对话`),onClick:s[0]||=e=>N.value=`chat`},[...s[4]||=[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(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),n(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,tt),n(`span`,nt,e(r(T)(`@EDITOR:会话列表`)),1)],64)):(p(),t(`span`,O,e(r(T)(`@EDITOR:g ai 对话`)),1)),s[7]||=n(`div`,{class:`agent-panel-spacer`},null,-1),!r(M)||N.value===`chat`?(p(),d(Je,{key:2,class:`agent-panel-engine`,engine:Ae.value,locked:r(S),onSelect:je},null,8,[`engine`,`locked`])):v(``,!0),!r(M)||N.value===`chat`?(p(),d(Ye,{key:3,class:`agent-panel-copy`,messages:r(oe),title:Ie.value,engine:r(Ue)(Ae.value)},null,8,[`messages`,`title`,`engine`])):v(``,!0),r(M)&&N.value===`chat`?(p(),t(`button`,{key:4,class:`agent-panel-icon-btn agent-panel-list-btn`,title:r(T)(`@EDITOR:会话列表`),"aria-label":r(T)(`@EDITOR:会话列表`),onClick:s[1]||=e=>N.value=`list`},[...s[5]||=[ee(`<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-15f906cd><line x1="8" y1="6" x2="21" y2="6" data-v-15f906cd></line><line x1="8" y1="12" x2="21" y2="12" data-v-15f906cd></line><line x1="8" y1="18" x2="21" y2="18" data-v-15f906cd></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-15f906cd></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-15f906cd></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-15f906cd></line></svg>`,1)]],8,k)):v(``,!0),n(`button`,{class:`agent-panel-icon-btn`,title:r(T)(`@EDITOR:关闭对话`),onClick:s[2]||=e=>te(`close`)},[...s[6]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,A)]),n(`div`,{class:l([`agent-panel-body`,{"is-wide":!r(M)}])},[x(n(`div`,rt,[a(r(me),{"show-search":!0,items:Me.value,"active-id":r(ae),loading:r(ie),labels:r(Ne),onSelect:dt,onNew:ft,onRename:r(ve),onDelete:r(_e)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[fe,!r(M)||N.value===`list`]]),x(n(`div`,{ref_key:`chatHostRef`,ref:Qe,class:`agent-panel-chat`},[a(r(pe),{ref_key:`chatRef`,ref:Xe,"show-input":!1,messages:r(oe),"assistant-name":r(Ve),"assistant-avatar":r(Ge),theme:ne.value,question:r(se),"question-submitting":r(ce),"question-labels":r(Pe),"plan-config":{labels:{title:r(T)(`@AGENT:计划`),raw:r(T)(`@AGENT:原始参数`)}},"message-rail-config":r(ze),"message-meta-config":r(We),onAnswer:r(Se),onRetry:r(xe)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`message-rail-config`,`message-meta-config`,`onAnswer`,`onRetry`])],512),[[fe,!r(M)||N.value===`chat`]]),r(j)>0?(p(),t(`div`,{key:0,ref_key:`composerRef`,ref:$e,class:`agent-panel-composer acu-root`,"data-theme":ne.value},[a(r(w),{ref_key:`inputRef`,ref:Ze,generating:r(_),"allow-queue":!0,queued:r(Te),"queue-paused":r(Ee),"queue-labels":r(Fe),placeholder:r(_)?r(T)(`@AGENT:生成中,发送后会排队,等本轮跑完自动接上…`):r(T)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:r(Be)},"context-usage":r(we),onSend:z,onStop:r(Ce),onUnqueue:r(Oe),onFlushQueued:r(ke)},null,8,[`generating`,`queued`,`queue-paused`,`queue-labels`,`placeholder`,`upload-config`,`context-usage`,`onStop`,`onUnqueue`,`onFlushQueued`]),P.value?(p(),d(de,{key:0,to:P.value},[L.value?(p(),t(`div`,{key:0,class:`agent-context-att`,title:o.activeFilePath||``},[s[9]||=n(`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`},[n(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),n(`polyline`,{points:`14 3 14 8 19 8`})],-1),n(`span`,ot,e(o.activeFileName),1),n(`button`,{type:`button`,class:`agent-context-att-remove`,title:r(T)(`@EDITOR:不引用当前文档`),"aria-label":r(T)(`@EDITOR:不引用当前文档`),onClick:s[3]||=e=>F.value=!0},[...s[8]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,st)],8,at)):v(``,!0)],8,[`to`])):v(``,!0)],8,it)):v(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-15f906cd`]]),j=1080,M=6e5,N=.86;function P(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 F(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 I(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>j||e.length>M)){r(e);return}try{let t=Math.min(1,j/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`,N))}catch{r(e)}},i.onerror=()=>{clearTimeout(a),r(e)},i.src=e})}async function L(e){let t=await F(e);return t?I(t):null}async function lt(e){let t=Array.from(e.querySelectorAll(`img`)).filter(e=>P(e.getAttribute(`src`)||``)),n=0;return await Promise.all(t.map(async e=>{let t=await L(e.getAttribute(`src`)||``);t?e.setAttribute(`src`,t):n+=1})),n}function R(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}var ut={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 z(e){e.querySelectorAll(`*`).forEach(e=>{let t=ut[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 dt(e,t){let n=e.cloneNode(!0),r=t?await lt(n):0;return{html:n.innerHTML,leftover:r}}async function ft(e,t){let n=e.cloneNode(!0),r=t.inline?await lt(n):0;z(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;">${R(i)}</h1>`:``}${n.innerHTML}</section>`,leftover:r}}h(),y(),o(),ae();var pt={class:`sidebar-header`},mt={class:`sidebar-title`},ht={class:`sidebar-actions`},gt={class:`sidebar-search`},_t=[`placeholder`,`title`],vt=[`title`,`aria-label`],yt={key:0,class:`sidebar-tree`},bt={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)`}},Rt=[`placeholder`],zt={key:1,class:`tree-empty`},Bt={key:1,class:`sidebar-loading`},Vt={class:`editor-main`},Ht={key:0,class:`editor-tabs`},Ut=[`onClick`,`title`],Wt={class:`tab-name`},Gt={key:0,class:`tab-dirty-dot`},Kt=[`onClick`],qt=[`title`],Jt=[`disabled`,`title`],Yt=[`title`],Xt={class:`editor-body`},Zt={key:0,class:`image-tab-placeholder`},Qt={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`}},$t={class:`image-tab-placeholder-title`},en={class:`image-tab-placeholder-hint`},tn={class:`preview-header`},nn={class:`preview-title`},rn={class:`preview-ext-badge`},an=[`title`],on={class:`preview-body`},sn={key:0,class:`preview-copybar`},cn=[`disabled`,`title`],ln=[`disabled`,`title`],un=[`disabled`,`title`],dn=[`title`],fn=[`sandbox`,`srcdoc`],pn=6e4,mn=3e4,hn=E(u({__name:`EditorView`,props:{pendingFilePath:{}},setup(o){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new Ce:t===`css`||t===`scss`||t===`less`?new xe:t===`html`||t===`handlebars`||t===`razor`?new _e:t===`typescript`||t===`javascript`?new ye:new ve}};let u=o,h=ge(),ae=Fe(),y=C([]),pe=C(!1),w=C(``),me=C(``),E=null;function we(){w.value=``,me.value=``,E&&=(clearTimeout(E),null)}b(w,e=>{E&&clearTimeout(E),E=setTimeout(()=>{me.value=e,E=null},180)}),c(()=>{E&&clearTimeout(E),Re(),wn()});let Te=null;function Le(){Re(),h.ui.fileTreeAutoRefresh&&(Te=setInterval(()=>{document.hidden||h.currentDirectory&&(w.value.trim()||D())},pn))}function Re(){Te&&=(clearInterval(Te),null)}b(()=>h.currentDirectory,async()=>{if(j=!1,Le(),await Be(),O.value.some(e=>e.isDirty)){j=!0;return}O.value=[],k.value=null,R(),await P()}),b(()=>h.ui.fileTreeAutoRefresh,()=>{Le()});async function ze(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 Be(){let e=h.currentDirectory;if(e){pe.value=!0;try{y.value=await ze(e,0)}finally{pe.value=!1}}}function Ve(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Ve(n.children,t));return t}function He(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=He(e.children,t+1),n.expanded=!0),n})}async function Ue(e){let t=h.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:He(n.items,0)}catch{return null}}function We(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)?We(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function D(e={}){if(!h.currentDirectory)return;let t=await Ue([...Ve(y.value)]);if(!t){e.notifyOnError&&_.error(T(`@EDITOR:刷新失败`));return}if(y.value.length===0){y.value=t;return}We(y.value,t)&&(y.value=t)}async function Ge(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await ze(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Ke(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Ke(n.children));return t}let qe=i(()=>me.value.trim().toLowerCase());function Je(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Je(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 Ye=i(()=>Je(y.value,qe.value)),Ze=i(()=>qe.value.length>0&&Ye.value.length===0);function Qe(e){let t=me.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 et=C(null);function tt(){let e=et.value;e&&(e.focus(),e.select())}function nt(){w.value?(we(),et.value?.focus()):(et.value?.blur(),I.value?.focus())}let O=C([]),k=C(null),A=C(null);async function rt(e){if(A.value=e,e.type!==`file`){Ge(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,s(()=>z());return}let n=e.name.split(`.`).pop()||``;if(sr.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,q.value=!0;return}if(Oe(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,J.value=!1,q.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){_.error(`${T(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=Xe(n),a=L.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),_.error(`${T(`@EDITOR:打开文件失败: `)}${e.message}`)}}b(()=>u.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await s();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await rt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function it(e,t){t.stopPropagation();let n=O.value.findIndex(t=>t.path===e);n!==-1&&(!O.value[n].isDirty||confirm(T(`@EDITOR:文件未保存,确认关闭?`)))&&(O.value.splice(n,1),k.value===e&&(k.value=O.value[Math.min(n,O.value.length-1)]?.path??null))}let at=()=>O.value.find(e=>e.path===k.value)??null,ot=i(()=>({expandedDirs:[...Ve(y.value)],tabs:O.value.map(e=>e.path),activeTab:k.value})),st=!1,j=!1;function M(){j&&!st&&h.isUiLoaded&&h.saveEditorWorkspace(ot.value)}b(ot,()=>M());async function N(e){if(O.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(sr.has(n)){O.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(Oe(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=L.get(e);i&&!i.isDisposed()&&I.value?.getModel()!==i&&(i.dispose(),L.delete(e)),O.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:Xe(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function P(){try{for(let e=0;e<100&&!h.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!h.isUiLoaded)return;V.value=h.ui.editorSidebarWidth;let e=h.getEditorWorkspace();if(!e)return;st=!0;try{if(e.expandedDirs.length>0){let t=await Ue(e.expandedDirs);t&&(y.value=t)}for(let t of e.tabs)await N(t);if(!u.pendingFilePath&&e.activeTab&&O.value.some(t=>t.path===e.activeTab)){k.value=e.activeTab;let t=at(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(sr.has(n)||Oe(t.name))&&(q.value=!0)}}finally{st=!1}}finally{j=!0,M()}}let F=C(null),I=te(null),L=new Map;function lt(e){let t=L.get(e.path);return(!t||t.isDisposed())&&(t=Se.createModel(e.content,e.language,be.file(e.path)),L.set(e.path,t)),t}function R(){I.value?.setModel(null);for(let e of L.values())e.isDisposed()||e.dispose();L.clear()}function ut(){if(!F.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;I.value=Se.create(F.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}),I.value.onDidChangeModelContent(()=>{let e=at();if(!e)return;let t=I.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),I.value.onDidBlurEditorText(()=>{h.ui.editorAutoSave&&at()?.isDirty&&Dn(!1),requestAnimationFrame(()=>{if(!B.value||B.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`))||z()})})}b(k,e=>{if(!I.value||!e)return;let t=O.value.find(t=>t.path===e);if(!t)return;let n=lt(t);I.value.setModel(n),s(()=>z()),bn(e)});function z(){if(!I.value)return;I.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let hn=0,gn=new Map;async function _n(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 vn(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 yn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=L.get(e.path);if(!r||r.isDisposed())return;let i=I.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 bn(e){if(!e)return;let t=O.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++hn,r=await _n(e);if(n!==hn||O.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(gn.get(e)===r.mtimeMs)return;gn.set(e,r.mtimeMs);try{await le.confirm(T(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),T(`@EDITOR:文件已被外部改动`),{confirmButtonText:T(`@EDITOR:重新加载`),cancelButtonText:T(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await vn(e);i&&O.value.find(t=>t.path===e)===t&&yn(t,i.content,i.mtimeMs)}function xn(){document.hidden||bn(k.value)}let Sn=null;function Cn(){wn(),Sn=setInterval(()=>{document.hidden||bn(k.value)},mn)}function wn(){Sn&&=(clearInterval(Sn),null)}b(()=>O.value.filter(e=>e.isDirty).length,e=>{ae.setDirtyCount(e)},{immediate:!0}),c(()=>ae.setDirtyCount(0)),De(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Se.setTheme(e?`vs-dark`:`vs`)});let Tn=null;function En(){if(Tn||!B.value)return;let e=[B.value],t=B.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}Tn=new MutationObserver(()=>{B.value&&B.value.offsetParent!==null&&k.value&&I.value&&(bn(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`))||z()}))});let n=Tn;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}re(async()=>{ut(),await Be(),await P(),En(),Le(),window.addEventListener(`focus`,xn),document.addEventListener(`visibilitychange`,xn),Cn(),k.value&&s(()=>z())}),c(()=>{Tn?.disconnect(),Tn=null,window.removeEventListener(`focus`,xn),document.removeEventListener(`visibilitychange`,xn),I.value?.dispose(),L.forEach(e=>e.dispose()),L.clear()});async function Dn(e=!1){let t=at();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){_.error(`${T(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||_.success(T(`@EDITOR:已保存`))}catch(e){_.error(`${T(`@EDITOR:保存失败: `)}${e.message}`)}}function On(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),tt();return}t&&e.key===`s`&&(e.preventDefault(),Dn())}re(()=>window.addEventListener(`keydown`,On)),c(()=>window.removeEventListener(`keydown`,On));let B=C(null),V=C(h.ui.editorSidebarWidth),kn=!1,An=0,jn=0;function Mn(e){kn=!0,An=e.clientX,jn=V.value,document.addEventListener(`mousemove`,Nn),document.addEventListener(`mouseup`,Pn),e.preventDefault()}function Nn(e){if(!kn)return;let t=e.clientX-An;V.value=Math.max(140,Math.min(400,jn+t))}function Pn(){kn=!1,document.removeEventListener(`mousemove`,Nn),document.removeEventListener(`mouseup`,Pn),V.value!==h.ui.editorSidebarWidth&&h.setEditorSidebarWidth(V.value)}function Fn(e){return e.type===`directory`?Ne(e.name):ke(e.name)}let H=C(null),U=C(null),W=C(null),In=C(null);function Ln(){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(/[\\/][^\\/]+$/,``):h.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:h.currentDirectory??``,afterNode:null,depth:0}}async function Rn(){let e=Ln();A.value?.type===`directory`&&!A.value.expanded&&await Ge(A.value),H.value={...e,kind:`file`,value:``},await s(),W.value?.focus()}async function zn(){let e=Ln();A.value?.type===`directory`&&!A.value.expanded&&await Ge(A.value),H.value={...e,kind:`directory`,value:``},await s(),W.value?.focus()}function Bn(){H.value=null}async function Vn(){let e=H.value;if(!e||!e.value.trim()){H.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){_.error(e.error);return}_.success(T(`@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){_.error(e.error);return}_.success(T(`@EDITOR:创建成功`))}H.value=null,await D()}function Hn(e){e.key===`Enter`&&(e.preventDefault(),Vn()),e.key===`Escape`&&(e.preventDefault(),Bn())}let G=C(null),Un=C(null);function Wn(e,t){e.preventDefault(),G.value={x:e.clientX,y:e.clientY,node:t}}function K(){G.value=null}async function Gn(){let e=G.value?.node;K(),e&&(A.value=e),e?.type===`directory`&&!e.expanded&&await Ge(e);let t=Ln();H.value={...t,kind:`file`,value:``},await s(),W.value?.focus()}async function Kn(){let e=G.value?.node;K(),e&&(A.value=e),e?.type===`directory`&&!e.expanded&&await Ge(e);let t=Ln();H.value={...t,kind:`directory`,value:``},await s(),W.value?.focus()}async function qn(){let e=G.value?.node;K(),e&&(U.value={node:e,value:e.name},await s(),In.value?.focus(),In.value?.select())}async function Jn(){let e=U.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){U.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){_.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)),U.value=null,await D()}function Yn(e){e.key===`Enter`&&(e.preventDefault(),Jn()),e.key===`Escape`&&(e.preventDefault(),U.value=null)}async function Xn(){let e=G.value?.node;if(K(),!e)return;let t=e.type===`directory`?T(`@EDITOR:文件夹`):T(`@EDITOR:文件`);if(!confirm(`${T(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){_.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)),_.success(T(`@EDITOR:已删除`)),await D()}async function Zn(){let e=G.value?.node;if(K(),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||_.error(t.error)}catch(e){_.error(e?.message||String(e))}}function Qn(e){let t=h.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 $n(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 er(){let e=G.value?.node;K(),e&&(await $n(e.path)?_.success(T(`@EDITOR:已复制到剪贴板`)):_.error(T(`@EDITOR:复制失败`)))}async function tr(){let e=G.value?.node;K(),e&&(await $n(Qn(e.path))?_.success(T(`@EDITOR:已复制到剪贴板`)):_.error(T(`@EDITOR:复制失败`)))}async function nr(){let e=G.value?.node;if(K(),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||_.error(t.error||T(`@EDITOR:VSCode 未安装`))}catch(e){_.error(e?.message||String(e))}}let rr=new Set([`html`,`htm`]),ir=i(()=>{let e=G.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return rr.has(t)});async function ar(){let e=G.value?.node;if(K(),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||_.error(t.error||T(`@EDITOR:浏览器打开失败`))}catch(e){_.error(e?.message||String(e))}}re(()=>document.addEventListener(`click`,K)),c(()=>document.removeEventListener(`click`,K));let or=new Set([`md`,`html`,`htm`,`svg`]),sr=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),q=C(!1),J=C(!1),Y=C(!1),cr=C(!1),lr=C(0),X=i(()=>O.value.find(e=>e.path===k.value)??null),ur=i(()=>X.value?.language===`plaintext`&&X.value?.content===``),dr=i(()=>X.value?.language===`office`),Z=i(()=>(X.value?.name??``).split(`.`).pop()?.toLowerCase()??``),fr=i(()=>or.has(Z.value)||sr.has(Z.value)||Oe(Z.value)),pr=i(()=>((X.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),mr=i(()=>Z.value===`md`&&pr.value>0);b(k,()=>{q.value&&!fr.value&&(q.value=!1),J.value&&!mr.value&&(J.value=!1)});function hr(){fr.value&&(q.value||(J.value=!1,Y.value=!1),q.value=!q.value)}function gr(){mr.value&&(J.value||(q.value=!1,Y.value=!1),J.value=!J.value)}function _r(){Y.value||(q.value=!1,J.value=!1),Y.value=!Y.value,cr.value=!0}let vr=C(null),Q=C(!1),$=C(``),yr=C(!0),br=null,xr=i(()=>!J.value&&q.value&&Z.value===`md`&&!!X.value);function Sr(){return X.value?.content??``}function Cr(){return Sr().match(/^\s*#\s+(.+?)\s*(?:\r?\n|$)/)?.[1]?.trim()??``}function wr(e,t,n){if(!e){_.error(T(`@EDITOR:复制失败`));return}$.value=n,br&&clearTimeout(br),br=setTimeout(()=>{$.value=``},1800),t>0?_.warning(T(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):_.success(T(`@EDITOR:已复制`))}async function Tr(){wr(await $n(Sr()),0,`md`)}async function Er(){let e=vr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await dt(e,yr.value);wr(await $n(t),n,`html`)}finally{Q.value=!1}}}function Dr(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 Or(){let e=vr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await ft(e,{inline:yr.value,title:Cr()}),r=Sr(),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||=Dr(t),wr(i,n,`rich`)}finally{Q.value=!1}}}let kr=i(()=>{let e=X.value;if(!e)return``;let t=Z.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?Ie(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>`:``}),Ar=!1,jr=0,Mr=0;function Nr(e){Ar=!0,jr=e.clientX,Mr=lr.value,document.addEventListener(`mousemove`,Pr),document.addEventListener(`mouseup`,Fr),e.preventDefault()}function Pr(e){if(!Ar)return;let t=e.clientX-jr;lr.value=Math.max(200,Math.min(900,Mr+t))}function Fr(){Ar=!1,document.removeEventListener(`mousemove`,Pr),document.removeEventListener(`mouseup`,Fr)}return(i,o)=>(p(),t(m,null,[n(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:B},[n(`div`,{class:`editor-sidebar`,style:g({width:V.value+`px`})},[n(`div`,pt,[n(`span`,mt,e(r(T)(`@EDITOR:资源管理器`)),1),n(`div`,ht,[a(r(ne),{content:r(T)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:se(()=>[n(`button`,{class:`sidebar-action-btn`,onClick:Rn},[...o[12]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,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)]])]),_:1},8,[`content`]),a(r(ne),{content:r(T)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:se(()=>[n(`button`,{class:`sidebar-action-btn`,onClick:zn},[...o[13]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`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`}),n(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),n(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),a(r(ne),{content:r(T)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:se(()=>[n(`button`,{class:`sidebar-action-btn`,onClick:o[0]||=e=>D({notifyOnError:!0})},[...o[14]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`polyline`,{points:`1 4 1 10 7 10`}),n(`polyline`,{points:`23 20 23 14 17 14`}),n(`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`])])]),n(`div`,gt,[o[16]||=n(`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`},[n(`circle`,{cx:`11`,cy:`11`,r:`7`}),n(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(n(`input`,{ref_key:`searchInputRef`,ref:et,"onUpdate:modelValue":o[1]||=e=>w.value=e,type:`text`,class:`sidebar-search-input`,placeholder:r(T)(`@EDITOR:搜索文件...`),title:r(T)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ie(nt,[`escape`])},null,40,_t),[[ue,w.value]]),w.value?(p(),t(`button`,{key:0,class:`sidebar-search-clear`,title:r(T)(`@EDITOR:清除搜索`),"aria-label":r(T)(`@EDITOR:清除搜索`),onClick:we},[...o[15]||=[n(`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`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,vt)):v(``,!0)]),pe.value?(p(),t(`div`,Bt,[...o[25]||=[n(`span`,{class:`spin-icon`},null,-1)]])):(p(),t(`div`,yt,[(p(!0),t(m,null,oe(Ke(Ye.value),i=>(p(),t(m,{key:i.path},[U.value&&U.value.node.path===i.path?(p(),t(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:g({paddingLeft:12+i.depth*14+`px`})},[i.type===`directory`?(p(),t(`span`,{key:0,class:l([`tree-arrow`,{expanded:i.expanded}])},[...o[17]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),t(`span`,bt)),(p(),t(`svg`,xt,[n(`use`,{"xlink:href":`#${Fn(i)}`},null,8,St)])),x(n(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:In,"onUpdate:modelValue":o[2]||=e=>U.value.value=e,onKeydown:Yn,onBlur:Jn,onClick:o[3]||=S(()=>{},[`stop`])},null,544),[[ue,U.value.value]])],4)):(p(),t(`div`,{key:1,class:l([`tree-node`,{"tree-node--dir":i.type===`directory`,"tree-node--file":i.type===`file`,"tree-node--active":k.value===i.path,"tree-node--selected":A.value?.path===i.path&&k.value!==i.path}]),style:g({paddingLeft:12+i.depth*14+`px`}),onClick:e=>rt(i),onContextmenu:e=>Wn(e,i)},[i.type===`directory`?(p(),t(`span`,{key:0,class:l([`tree-arrow`,{expanded:i.expanded}])},[...o[18]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),t(`span`,wt)),i.type===`directory`?(p(),t(`svg`,Tt,[n(`use`,{"xlink:href":`#${Fn(i)}`},null,8,Et)])):(p(),t(`svg`,Dt,[n(`use`,{"xlink:href":`#${Fn(i)}`},null,8,Ot)])),n(`span`,{class:`tree-name`,title:i.path},[(p(!0),t(m,null,oe(Qe(i.name),(n,r)=>(p(),t(m,{key:r},[n.hit?(p(),t(`span`,At,e(n.text),1)):(p(),t(m,{key:1},[f(e(n.text),1)],64))],64))),128))],8,kt),i.loading?(p(),t(`span`,jt)):v(``,!0)],46,Ct)),H.value&&H.value.afterNode?.path===i.path?(p(),t(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:g({paddingLeft:12+H.value.depth*14+`px`})},[o[21]||=n(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),t(`svg`,Mt,[...o[19]||=[n(`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)]])):(p(),t(`svg`,Nt,[...o[20]||=[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`},null,-1),n(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(n(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":o[4]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?r(T)(`@EDITOR:输入文件名`):r(T)(`@EDITOR:输入文件夹名`),onKeydown:Hn,onBlur:Bn,onClick:o[5]||=S(()=>{},[`stop`])},null,40,Pt),[[ue,H.value.value]])],4)):v(``,!0)],64))),128)),H.value&&H.value.afterNode===null?(p(),t(`div`,Ft,[o[24]||=n(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),t(`svg`,It,[...o[22]||=[n(`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)]])):(p(),t(`svg`,Lt,[...o[23]||=[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`},null,-1),n(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(n(`input`,{ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":o[6]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?r(T)(`@EDITOR:输入文件名`):r(T)(`@EDITOR:输入文件夹名`),onKeydown:Hn,onBlur:Bn,onClick:o[7]||=S(()=>{},[`stop`])},null,40,Rt),[[ue,H.value.value]])])):v(``,!0),!H.value&&(Ze.value||y.value.length===0)?(p(),t(`div`,zt,e(Ze.value?r(T)(`@EDITOR:未找到匹配文件`):r(T)(`@EDITOR:暂无文件`)),1)):v(``,!0)]))],4),n(`div`,{class:`editor-resizer`,onMousedown:Mn},null,32),n(`div`,Vt,[O.value.length>0?(p(),t(`div`,Ht,[(p(!0),t(m,null,oe(O.value,r=>(p(),t(`div`,{key:r.path,class:l([`editor-tab`,{active:k.value===r.path,dirty:r.isDirty}]),onClick:e=>k.value=r.path,title:r.path},[n(`span`,Wt,e(r.name),1),r.isDirty?(p(),t(`span`,Gt)):v(``,!0),n(`button`,{class:`tab-close`,onClick:e=>it(r.path,e)},[...o[26]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Kt)],10,Ut))),128)),o[30]||=n(`div`,{class:`editor-tabs-spacer`},null,-1),fr.value?(p(),t(`button`,{key:0,class:l([`preview-toggle-btn`,{active:q.value}]),title:q.value?r(T)(`@EDITOR:关闭预览`):r(T)(`@EDITOR:打开预览`),onClick:hr},[o[27]||=n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),n(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),n(`span`,null,e(r(T)(`@EDITOR:预览`)),1)],10,qt)):v(``,!0),mr.value?(p(),t(`button`,{key:1,class:l([`preview-toggle-btn mindmap-toggle-btn`,{active:J.value,disabled:!mr.value}]),disabled:!mr.value,title:mr.value?J.value?r(T)(`@EDITOR:关闭思维导图`):r(T)(`@EDITOR:打开思维导图`):r(T)(`@EDITOR:需要至少一个 # 标题`),onClick:gr},[o[28]||=ee(`<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-843a938c><circle cx="12" cy="12" r="2" data-v-843a938c></circle><circle cx="5" cy="6" r="1.6" data-v-843a938c></circle><circle cx="19" cy="6" r="1.6" data-v-843a938c></circle><circle cx="5" cy="18" r="1.6" data-v-843a938c></circle><circle cx="19" cy="18" r="1.6" data-v-843a938c></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-843a938c></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-843a938c></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-843a938c></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-843a938c></line></svg>`,1),n(`span`,null,e(r(T)(`@EDITOR:思维导图`)),1)],10,Jt)):v(``,!0),n(`button`,{class:l([`preview-toggle-btn agent-toggle-btn`,{active:Y.value}]),title:Y.value?r(T)(`@EDITOR:关闭 g ai 对话`):r(T)(`@EDITOR:打开 g ai 对话`),onClick:_r},[o[29]||=n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`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`}),n(`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),n(`span`,null,e(r(T)(`@EDITOR:g ai 对话`)),1)],10,Yt)])):v(``,!0),O.value.length===0?(p(),d(Pe,{key:1,class:`editor-empty`,title:r(T)(`@EDITOR:从左侧选择文件打开`),hint:r(T)(`@EDITOR:Ctrl+S 保存`)},{icon:se(()=>[...o[31]||=[n(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.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`})],-1)]]),_:1},8,[`title`,`hint`])):v(``,!0),n(`div`,Xt,[n(`div`,{class:l([`monaco-container`,{hidden:O.value.length===0||ur.value||dr.value}]),ref_key:`editorContainerRef`,ref:F},null,2),ur.value&&O.value.length>0&&!q.value&&!J.value?(p(),t(`div`,Zt,[(p(),t(`svg`,Qt,[...o[32]||=[n(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),n(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),n(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),n(`p`,$t,e(X.value?.name),1),n(`p`,en,e(r(T)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):v(``,!0),(q.value||J.value||Y.value)&&O.value.length>0?(p(),t(`div`,{key:1,class:`preview-resizer`,onMousedown:Nr},null,32)):v(``,!0),cr.value?x((p(),d(ct,{key:2,active:Y.value&&O.value.length>0,"active-file-path":k.value,"active-file-name":X.value?.name??``,style:g({flexBasis:lr.value+`px`}),onClose:o[8]||=e=>Y.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[fe,Y.value&&O.value.length>0]]):v(``,!0),(q.value||J.value)&&O.value.length>0?(p(),t(`div`,{key:3,class:`preview-panel`,style:g({flexBasis:lr.value+`px`})},[n(`div`,tn,[n(`span`,nn,e(J.value?r(T)(`@EDITOR:思维导图`):r(T)(`@EDITOR:预览`)),1),n(`span`,rn,e(Z.value.toUpperCase()),1),o[34]||=n(`div`,{class:`preview-header-spacer`},null,-1),n(`button`,{class:`preview-close-btn`,title:J.value?r(T)(`@EDITOR:关闭思维导图`):r(T)(`@EDITOR:关闭预览`),onClick:o[9]||=e=>J.value?J.value=!1:q.value=!1},[...o[33]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,an)]),n(`div`,on,[xr.value?(p(),t(`div`,sn,[n(`button`,{class:l([`preview-copy-btn`,{done:$.value===`md`}]),disabled:Q.value,title:r(T)(`@EDITOR:复制 Markdown 源码`),onClick:Tr},[o[35]||=n(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),n(`span`,null,e($.value===`md`?r(T)(`@EDITOR:已复制`):`Markdown`),1)],10,cn),n(`button`,{class:l([`preview-copy-btn`,{done:$.value===`html`}]),disabled:Q.value,title:r(T)(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:Er},[o[36]||=n(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),n(`span`,null,e($.value===`html`?r(T)(`@EDITOR:已复制`):`HTML`),1)],10,ln),n(`button`,{class:l([`preview-copy-btn preview-copy-btn--primary`,{done:$.value===`rich`}]),disabled:Q.value,title:r(T)(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:Or},[o[37]||=n(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),n(`span`,null,e(Q.value?r(T)(`@EDITOR:转换图片中…`):$.value===`rich`?r(T)(`@EDITOR:已复制`):r(T)(`@EDITOR:复制富文本`)),1)],10,un),n(`label`,{class:`preview-copy-embed`,title:r(T)(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[x(n(`input`,{"onUpdate:modelValue":o[10]||=e=>yr.value=e,type:`checkbox`},null,512),[[ce,yr.value]]),n(`span`,null,e(r(T)(`@EDITOR:图片转 Base64`)),1)],8,dn)])):v(``,!0),J.value&&Z.value===`md`&&X.value?(p(),d($e,{key:1,content:X.value.content,class:`preview-mindmap`},null,8,[`content`])):q.value&&Z.value===`md`&&X.value?(p(),d(je,{ref_key:`mdPreviewRef`,ref:vr,key:X.value.path,content:X.value.content,"base-path":X.value.path,class:`preview-markdown`},null,8,[`content`,`base-path`])):q.value&&[`html`,`htm`,`svg`].includes(Z.value)?(p(),t(`iframe`,{key:3,class:`preview-iframe`,sandbox:r(Ee),srcdoc:kr.value},null,8,fn)):q.value&&r(sr).has(Z.value)&&X.value?(p(),d(Me,{key:4,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):q.value&&dr.value&&X.value?(p(),d(Ae,{key:5,"file-path":X.value.path},null,8,[`file-path`])):v(``,!0)])],4)):v(``,!0)])])],512),(p(),d(de,{to:`body`},[G.value?(p(),t(`div`,{key:0,ref_key:`ctxMenuRef`,ref:Un,class:`ctx-menu`,style:g({left:G.value.x+`px`,top:G.value.y+`px`}),onClick:o[11]||=S(()=>{},[`stop`])},[n(`button`,{class:`ctx-menu-item`,onClick:Gn},[o[38]||=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(` `+e(r(T)(`@EDITOR:新建文件`)),1)]),n(`button`,{class:`ctx-menu-item`,onClick:Kn},[o[39]||=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:`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`}),n(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),n(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),f(` `+e(r(T)(`@EDITOR:新建文件夹`)),1)]),o[46]||=n(`div`,{class:`ctx-menu-sep`},null,-1),n(`button`,{class:`ctx-menu-item`,onClick:er},[o[40]||=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(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),n(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),f(` `+e(r(T)(`@EDITOR:复制绝对路径`)),1)]),n(`button`,{class:`ctx-menu-item`,onClick:tr},[o[41]||=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:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),n(`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),f(` `+e(r(T)(`@EDITOR:复制相对路径`)),1)]),o[47]||=n(`div`,{class:`ctx-menu-sep`},null,-1),ir.value?(p(),t(`button`,{key:0,class:`ctx-menu-item`,onClick:ar},[o[42]||=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(`circle`,{cx:`12`,cy:`12`,r:`9`}),n(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),n(`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),f(` `+e(r(T)(`@EDITOR:在浏览器中打开`)),1)])):v(``,!0),n(`button`,{class:`ctx-menu-item`,onClick:Zn},[o[43]||=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(` `+e(r(T)(`@EDITOR:在资源管理器中打开`)),1)]),n(`button`,{class:`ctx-menu-item`,onClick:nr},[a(he,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),f(` `+e(r(T)(`@EDITOR:在 VSCode 中打开`)),1)]),n(`button`,{class:`ctx-menu-item`,onClick:qn},[o[44]||=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:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),n(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),f(` `+e(r(T)(`@EDITOR:重命名`)),1)]),n(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Xn},[o[45]||=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(` `+e(r(T)(`@EDITOR:删除`)),1)])],4)):v(``,!0)]))],64))}}),[[`__scopeId`,`data-v-843a938c`]]);export{hn as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$r as e,An as t,Dn as n,Dr as r,En as i,Fn as a,Fr as o,Gn as s,Jn as c,Jr as l,Ln as u,Nn as ee,On as d,Pn as f,Qn as p,Sn as m,Sr as te,Vn as h,W as ne,Xn as re,Xr as g,bn as ie,dn as ae,er as oe,i as _,kn as v,lr as se,mn as ce,mr as y,r as le,sr as b,ur as x,vn as ue,wn as de,xn as S,xr as C,yn as fe}from"./element-plus-J45pKUrE.js";import{a as pe,n as w,r as me}from"./vendor-B3NyhlYR.js";import{n as T,t as E}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{t as he}from"./SvgIcon-Du5MOe8A.js";import{t as ge}from"./configStore-D0oycG71.js";import{a as _e,c as ve,i as ye,n as be,o as xe,r as Se,s as Ce}from"./monaco-ChZ0d0qB.js";import{n as we,r as Te}from"./flow-mindmap-DvB74LE1.js";import{A as Ee,F as De,I as Oe,L as ke,M as Ae,N as je,P as Me,R as Ne,a as Pe,f as Fe,j as Ie}from"./index-DjaZpz97.js";import{a as Le,c as Re,i as ze,l as Be,n as Ve,o as He,p as Ue,r as We,s as D,t as Ge,u as Ke}from"./agentConversations-BKjyYn-u.js";import{c as qe,s as Je,t as Ye}from"./CopySessionButton-Do4vHJm6.js";function Xe(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`}h(),y();var Ze={class:`mindmap-preview`},Qe={class:`mindmap-preview-canvas`},$e=E(u({__name:`MindmapPreview`,props:{content:{}},setup(e){let o=e,s=i(()=>Te(o.content||``,`未命名文档`));return(e,i)=>(p(),t(`div`,Ze,[i[0]||=n(`div`,{class:`mindmap-preview-header`},[n(`span`,{class:`mindmap-preview-title`},`整篇导图`),n(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),n(`div`,Qe,[a(r(we),{data:s.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);h(),y(),o(),ae();var et={class:`agent-panel-header`},tt=[`title`,`aria-label`],nt={class:`agent-panel-title`},O={key:1,class:`agent-panel-title`},k=[`title`,`aria-label`],A=[`title`],rt={class:`agent-panel-convs`},it=[`data-theme`],at=[`title`],ot={class:`agent-context-att-name`},st=[`title`,`aria-label`],ct=E(u({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(o,{emit:u}){let f=o,te=u,{theme:h}=De(),ne=i(()=>h.value===`dark`?`dark`:`light`),{sessions:g,sessionsLoading:ie,currentSessionId:ae,messages:oe,isStreaming:_,questionPanel:se,answeringQuestion:ce,isSessionGenerating:y,currentEngine:le,pendingEngine:ue,isEngineLocked:S,pickEngine:E,loadSessions:he,loadSession:ge,deleteSession:_e,renameSession:ve,newSession:ye,sendMessage:be,retryTurn:xe,answerQuestion:Se,stop:Ce,inputContextUsage:we,queuedMessages:Te,queuePaused:Ee,removeQueuedMessage:Oe,flushQueued:ke}=Ke(),Ae=i(()=>S.value?le.value:ue.value);function je(e){S.value||E(e)}let Me=i(()=>Re(g.value,y)),Ne=Le(),Pe=He(),Fe=D(),Ie=i(()=>Me.value.find(e=>e.id===ae.value)?.title||``),Xe=C(null),Ze=C(null),Qe=C(null),$e=C(null),ct=C(null),{width:j,narrow:M}=qe(ct),N=C(`chat`),P=C(null),F=C(!1),I=null,L=i(()=>!!f.activeFileName&&!F.value);function lt(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function R(){let e=Ze.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!L.value){if(!t)return;P.value=null,s(()=>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=lt(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),P.value=n}function ut(e=!0){Xe.value?.scrollToBottom(e)}async function z(e){let t=F.value?void 0:f.activeFilePath||void 0;await be(e.text,e.files,{openFilePath:t}),await s(),ut()}function dt(e){ge(e),N.value=`chat`}function ft(){ye(),N.value=`chat`}b(()=>oe.value.length,()=>{s(()=>ut(!1))});function pt(){let e=$e.value;!e||typeof MutationObserver>`u`||(I?.disconnect(),I=new MutationObserver(()=>R()),I.observe(e,{childList:!0,subtree:!0}))}return b(()=>f.active,e=>{e&&(N.value=`chat`,he().catch(()=>{}),s(()=>{R(),ut(!1)}))}),b(M,e=>{e||(N.value=`chat`)}),b(()=>f.activeFilePath,()=>{F.value=!1}),b(L,e=>{e&&s(R)}),re(()=>{he().catch(()=>{}),s(()=>{R(),pt()})}),c(()=>{I?.disconnect(),I=null,P.value=null}),(i,s)=>(p(),t(`div`,{ref_key:`rootRef`,ref:ct,class:`editor-agent-panel`},[n(`div`,et,[r(M)&&N.value===`list`?(p(),t(m,{key:0},[n(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:r(T)(`@EDITOR:返回对话`),"aria-label":r(T)(`@EDITOR:返回对话`),onClick:s[0]||=e=>N.value=`chat`},[...s[4]||=[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(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),n(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,tt),n(`span`,nt,e(r(T)(`@EDITOR:会话列表`)),1)],64)):(p(),t(`span`,O,e(r(T)(`@EDITOR:g ai 对话`)),1)),s[7]||=n(`div`,{class:`agent-panel-spacer`},null,-1),!r(M)||N.value===`chat`?(p(),d(Je,{key:2,class:`agent-panel-engine`,engine:Ae.value,locked:r(S),onSelect:je},null,8,[`engine`,`locked`])):v(``,!0),!r(M)||N.value===`chat`?(p(),d(Ye,{key:3,class:`agent-panel-copy`,messages:r(oe),title:Ie.value,engine:r(Ue)(Ae.value)},null,8,[`messages`,`title`,`engine`])):v(``,!0),r(M)&&N.value===`chat`?(p(),t(`button`,{key:4,class:`agent-panel-icon-btn agent-panel-list-btn`,title:r(T)(`@EDITOR:会话列表`),"aria-label":r(T)(`@EDITOR:会话列表`),onClick:s[1]||=e=>N.value=`list`},[...s[5]||=[ee(`<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-15f906cd><line x1="8" y1="6" x2="21" y2="6" data-v-15f906cd></line><line x1="8" y1="12" x2="21" y2="12" data-v-15f906cd></line><line x1="8" y1="18" x2="21" y2="18" data-v-15f906cd></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-15f906cd></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-15f906cd></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-15f906cd></line></svg>`,1)]],8,k)):v(``,!0),n(`button`,{class:`agent-panel-icon-btn`,title:r(T)(`@EDITOR:关闭对话`),onClick:s[2]||=e=>te(`close`)},[...s[6]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,A)]),n(`div`,{class:l([`agent-panel-body`,{"is-wide":!r(M)}])},[x(n(`div`,rt,[a(r(me),{"show-search":!0,items:Me.value,"active-id":r(ae),loading:r(ie),labels:r(Ne),onSelect:dt,onNew:ft,onRename:r(ve),onDelete:r(_e)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[fe,!r(M)||N.value===`list`]]),x(n(`div`,{ref_key:`chatHostRef`,ref:Qe,class:`agent-panel-chat`},[a(r(pe),{ref_key:`chatRef`,ref:Xe,"show-input":!1,messages:r(oe),"assistant-name":r(Ve),"assistant-avatar":r(Ge),theme:ne.value,question:r(se),"question-submitting":r(ce),"question-labels":r(Pe),"plan-config":{labels:{title:r(T)(`@AGENT:计划`),raw:r(T)(`@AGENT:原始参数`)}},"message-rail-config":r(ze),"message-meta-config":r(We),onAnswer:r(Se),onRetry:r(xe)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`message-rail-config`,`message-meta-config`,`onAnswer`,`onRetry`])],512),[[fe,!r(M)||N.value===`chat`]]),r(j)>0?(p(),t(`div`,{key:0,ref_key:`composerRef`,ref:$e,class:`agent-panel-composer acu-root`,"data-theme":ne.value},[a(r(w),{ref_key:`inputRef`,ref:Ze,generating:r(_),"allow-queue":!0,queued:r(Te),"queue-paused":r(Ee),"queue-labels":r(Fe),placeholder:r(_)?r(T)(`@AGENT:生成中,发送后会排队,等本轮跑完自动接上…`):r(T)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:r(Be)},"context-usage":r(we),onSend:z,onStop:r(Ce),onUnqueue:r(Oe),onFlushQueued:r(ke)},null,8,[`generating`,`queued`,`queue-paused`,`queue-labels`,`placeholder`,`upload-config`,`context-usage`,`onStop`,`onUnqueue`,`onFlushQueued`]),P.value?(p(),d(de,{key:0,to:P.value},[L.value?(p(),t(`div`,{key:0,class:`agent-context-att`,title:o.activeFilePath||``},[s[9]||=n(`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`},[n(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),n(`polyline`,{points:`14 3 14 8 19 8`})],-1),n(`span`,ot,e(o.activeFileName),1),n(`button`,{type:`button`,class:`agent-context-att-remove`,title:r(T)(`@EDITOR:不引用当前文档`),"aria-label":r(T)(`@EDITOR:不引用当前文档`),onClick:s[3]||=e=>F.value=!0},[...s[8]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,st)],8,at)):v(``,!0)],8,[`to`])):v(``,!0)],8,it)):v(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-15f906cd`]]),j=1080,M=6e5,N=.86;function P(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 F(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 I(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>j||e.length>M)){r(e);return}try{let t=Math.min(1,j/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`,N))}catch{r(e)}},i.onerror=()=>{clearTimeout(a),r(e)},i.src=e})}async function L(e){let t=await F(e);return t?I(t):null}async function lt(e){let t=Array.from(e.querySelectorAll(`img`)).filter(e=>P(e.getAttribute(`src`)||``)),n=0;return await Promise.all(t.map(async e=>{let t=await L(e.getAttribute(`src`)||``);t?e.setAttribute(`src`,t):n+=1})),n}function R(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}var ut={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 z(e){e.querySelectorAll(`*`).forEach(e=>{let t=ut[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 dt(e,t){let n=e.cloneNode(!0),r=t?await lt(n):0;return{html:n.innerHTML,leftover:r}}async function ft(e,t){let n=e.cloneNode(!0),r=t.inline?await lt(n):0;z(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;">${R(i)}</h1>`:``}${n.innerHTML}</section>`,leftover:r}}h(),y(),o(),ae();var pt={class:`sidebar-header`},mt={class:`sidebar-title`},ht={class:`sidebar-actions`},gt={class:`sidebar-search`},_t=[`placeholder`,`title`],vt=[`title`,`aria-label`],yt={key:0,class:`sidebar-tree`},bt={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)`}},Rt=[`placeholder`],zt={key:1,class:`tree-empty`},Bt={key:1,class:`sidebar-loading`},Vt={class:`editor-main`},Ht={key:0,class:`editor-tabs`},Ut=[`onClick`,`title`],Wt={class:`tab-name`},Gt={key:0,class:`tab-dirty-dot`},Kt=[`onClick`],qt=[`title`],Jt=[`disabled`,`title`],Yt=[`title`],Xt={class:`editor-body`},Zt={key:0,class:`image-tab-placeholder`},Qt={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`}},$t={class:`image-tab-placeholder-title`},en={class:`image-tab-placeholder-hint`},tn={class:`preview-header`},nn={class:`preview-title`},rn={class:`preview-ext-badge`},an=[`title`],on={class:`preview-body`},sn={key:0,class:`preview-copybar`},cn=[`disabled`,`title`],ln=[`disabled`,`title`],un=[`disabled`,`title`],dn=[`title`],fn=[`sandbox`,`srcdoc`],pn=6e4,mn=3e4,hn=E(u({__name:`EditorView`,props:{pendingFilePath:{}},setup(o){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new Ce:t===`css`||t===`scss`||t===`less`?new xe:t===`html`||t===`handlebars`||t===`razor`?new _e:t===`typescript`||t===`javascript`?new ye:new ve}};let u=o,h=ge(),ae=Fe(),y=C([]),pe=C(!1),w=C(``),me=C(``),E=null;function we(){w.value=``,me.value=``,E&&=(clearTimeout(E),null)}b(w,e=>{E&&clearTimeout(E),E=setTimeout(()=>{me.value=e,E=null},180)}),c(()=>{E&&clearTimeout(E),Re(),wn()});let Te=null;function Le(){Re(),h.ui.fileTreeAutoRefresh&&(Te=setInterval(()=>{document.hidden||h.currentDirectory&&(w.value.trim()||D())},pn))}function Re(){Te&&=(clearInterval(Te),null)}b(()=>h.currentDirectory,async()=>{if(j=!1,Le(),await Be(),O.value.some(e=>e.isDirty)){j=!0;return}O.value=[],k.value=null,R(),await P()}),b(()=>h.ui.fileTreeAutoRefresh,()=>{Le()});async function ze(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 Be(){let e=h.currentDirectory;if(e){pe.value=!0;try{y.value=await ze(e,0)}finally{pe.value=!1}}}function Ve(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Ve(n.children,t));return t}function He(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=He(e.children,t+1),n.expanded=!0),n})}async function Ue(e){let t=h.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:He(n.items,0)}catch{return null}}function We(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)?We(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function D(e={}){if(!h.currentDirectory)return;let t=await Ue([...Ve(y.value)]);if(!t){e.notifyOnError&&_.error(T(`@EDITOR:刷新失败`));return}if(y.value.length===0){y.value=t;return}We(y.value,t)&&(y.value=t)}async function Ge(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await ze(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Ke(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Ke(n.children));return t}let qe=i(()=>me.value.trim().toLowerCase());function Je(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Je(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 Ye=i(()=>Je(y.value,qe.value)),Ze=i(()=>qe.value.length>0&&Ye.value.length===0);function Qe(e){let t=me.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 et=C(null);function tt(){let e=et.value;e&&(e.focus(),e.select())}function nt(){w.value?(we(),et.value?.focus()):(et.value?.blur(),I.value?.focus())}let O=C([]),k=C(null),A=C(null);async function rt(e){if(A.value=e,e.type!==`file`){Ge(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,s(()=>z());return}let n=e.name.split(`.`).pop()||``;if(sr.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,q.value=!0;return}if(Oe(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,J.value=!1,q.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){_.error(`${T(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=Xe(n),a=L.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),_.error(`${T(`@EDITOR:打开文件失败: `)}${e.message}`)}}b(()=>u.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await s();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await rt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function it(e,t){t.stopPropagation();let n=O.value.findIndex(t=>t.path===e);n!==-1&&(!O.value[n].isDirty||confirm(T(`@EDITOR:文件未保存,确认关闭?`)))&&(O.value.splice(n,1),k.value===e&&(k.value=O.value[Math.min(n,O.value.length-1)]?.path??null))}let at=()=>O.value.find(e=>e.path===k.value)??null,ot=i(()=>({expandedDirs:[...Ve(y.value)],tabs:O.value.map(e=>e.path),activeTab:k.value})),st=!1,j=!1;function M(){j&&!st&&h.isUiLoaded&&h.saveEditorWorkspace(ot.value)}b(ot,()=>M());async function N(e){if(O.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(sr.has(n)){O.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(Oe(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=L.get(e);i&&!i.isDisposed()&&I.value?.getModel()!==i&&(i.dispose(),L.delete(e)),O.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:Xe(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function P(){try{for(let e=0;e<100&&!h.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!h.isUiLoaded)return;V.value=h.ui.editorSidebarWidth;let e=h.getEditorWorkspace();if(!e)return;st=!0;try{if(e.expandedDirs.length>0){let t=await Ue(e.expandedDirs);t&&(y.value=t)}for(let t of e.tabs)await N(t);if(!u.pendingFilePath&&e.activeTab&&O.value.some(t=>t.path===e.activeTab)){k.value=e.activeTab;let t=at(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(sr.has(n)||Oe(t.name))&&(q.value=!0)}}finally{st=!1}}finally{j=!0,M()}}let F=C(null),I=te(null),L=new Map;function lt(e){let t=L.get(e.path);return(!t||t.isDisposed())&&(t=Se.createModel(e.content,e.language,be.file(e.path)),L.set(e.path,t)),t}function R(){I.value?.setModel(null);for(let e of L.values())e.isDisposed()||e.dispose();L.clear()}function ut(){if(!F.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;I.value=Se.create(F.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}),I.value.onDidChangeModelContent(()=>{let e=at();if(!e)return;let t=I.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),I.value.onDidBlurEditorText(()=>{h.ui.editorAutoSave&&at()?.isDirty&&Dn(!1),requestAnimationFrame(()=>{if(!B.value||B.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`))||z()})})}b(k,e=>{if(!I.value||!e)return;let t=O.value.find(t=>t.path===e);if(!t)return;let n=lt(t);I.value.setModel(n),s(()=>z()),bn(e)});function z(){if(!I.value)return;I.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let hn=0,gn=new Map;async function _n(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 vn(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 yn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=L.get(e.path);if(!r||r.isDisposed())return;let i=I.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 bn(e){if(!e)return;let t=O.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++hn,r=await _n(e);if(n!==hn||O.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(gn.get(e)===r.mtimeMs)return;gn.set(e,r.mtimeMs);try{await le.confirm(T(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),T(`@EDITOR:文件已被外部改动`),{confirmButtonText:T(`@EDITOR:重新加载`),cancelButtonText:T(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await vn(e);i&&O.value.find(t=>t.path===e)===t&&yn(t,i.content,i.mtimeMs)}function xn(){document.hidden||bn(k.value)}let Sn=null;function Cn(){wn(),Sn=setInterval(()=>{document.hidden||bn(k.value)},mn)}function wn(){Sn&&=(clearInterval(Sn),null)}b(()=>O.value.filter(e=>e.isDirty).length,e=>{ae.setDirtyCount(e)},{immediate:!0}),c(()=>ae.setDirtyCount(0)),De(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Se.setTheme(e?`vs-dark`:`vs`)});let Tn=null;function En(){if(Tn||!B.value)return;let e=[B.value],t=B.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}Tn=new MutationObserver(()=>{B.value&&B.value.offsetParent!==null&&k.value&&I.value&&(bn(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`))||z()}))});let n=Tn;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}re(async()=>{ut(),await Be(),await P(),En(),Le(),window.addEventListener(`focus`,xn),document.addEventListener(`visibilitychange`,xn),Cn(),k.value&&s(()=>z())}),c(()=>{Tn?.disconnect(),Tn=null,window.removeEventListener(`focus`,xn),document.removeEventListener(`visibilitychange`,xn),I.value?.dispose(),L.forEach(e=>e.dispose()),L.clear()});async function Dn(e=!1){let t=at();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){_.error(`${T(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||_.success(T(`@EDITOR:已保存`))}catch(e){_.error(`${T(`@EDITOR:保存失败: `)}${e.message}`)}}function On(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),tt();return}t&&e.key===`s`&&(e.preventDefault(),Dn())}re(()=>window.addEventListener(`keydown`,On)),c(()=>window.removeEventListener(`keydown`,On));let B=C(null),V=C(h.ui.editorSidebarWidth),kn=!1,An=0,jn=0;function Mn(e){kn=!0,An=e.clientX,jn=V.value,document.addEventListener(`mousemove`,Nn),document.addEventListener(`mouseup`,Pn),e.preventDefault()}function Nn(e){if(!kn)return;let t=e.clientX-An;V.value=Math.max(140,Math.min(400,jn+t))}function Pn(){kn=!1,document.removeEventListener(`mousemove`,Nn),document.removeEventListener(`mouseup`,Pn),V.value!==h.ui.editorSidebarWidth&&h.setEditorSidebarWidth(V.value)}function Fn(e){return e.type===`directory`?Ne(e.name):ke(e.name)}let H=C(null),U=C(null),W=C(null),In=C(null);function Ln(){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(/[\\/][^\\/]+$/,``):h.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:h.currentDirectory??``,afterNode:null,depth:0}}async function Rn(){let e=Ln();A.value?.type===`directory`&&!A.value.expanded&&await Ge(A.value),H.value={...e,kind:`file`,value:``},await s(),W.value?.focus()}async function zn(){let e=Ln();A.value?.type===`directory`&&!A.value.expanded&&await Ge(A.value),H.value={...e,kind:`directory`,value:``},await s(),W.value?.focus()}function Bn(){H.value=null}async function Vn(){let e=H.value;if(!e||!e.value.trim()){H.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){_.error(e.error);return}_.success(T(`@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){_.error(e.error);return}_.success(T(`@EDITOR:创建成功`))}H.value=null,await D()}function Hn(e){e.key===`Enter`&&(e.preventDefault(),Vn()),e.key===`Escape`&&(e.preventDefault(),Bn())}let G=C(null),Un=C(null);function Wn(e,t){e.preventDefault(),G.value={x:e.clientX,y:e.clientY,node:t}}function K(){G.value=null}async function Gn(){let e=G.value?.node;K(),e&&(A.value=e),e?.type===`directory`&&!e.expanded&&await Ge(e);let t=Ln();H.value={...t,kind:`file`,value:``},await s(),W.value?.focus()}async function Kn(){let e=G.value?.node;K(),e&&(A.value=e),e?.type===`directory`&&!e.expanded&&await Ge(e);let t=Ln();H.value={...t,kind:`directory`,value:``},await s(),W.value?.focus()}async function qn(){let e=G.value?.node;K(),e&&(U.value={node:e,value:e.name},await s(),In.value?.focus(),In.value?.select())}async function Jn(){let e=U.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){U.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){_.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)),U.value=null,await D()}function Yn(e){e.key===`Enter`&&(e.preventDefault(),Jn()),e.key===`Escape`&&(e.preventDefault(),U.value=null)}async function Xn(){let e=G.value?.node;if(K(),!e)return;let t=e.type===`directory`?T(`@EDITOR:文件夹`):T(`@EDITOR:文件`);if(!confirm(`${T(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){_.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)),_.success(T(`@EDITOR:已删除`)),await D()}async function Zn(){let e=G.value?.node;if(K(),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||_.error(t.error)}catch(e){_.error(e?.message||String(e))}}function Qn(e){let t=h.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 $n(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 er(){let e=G.value?.node;K(),e&&(await $n(e.path)?_.success(T(`@EDITOR:已复制到剪贴板`)):_.error(T(`@EDITOR:复制失败`)))}async function tr(){let e=G.value?.node;K(),e&&(await $n(Qn(e.path))?_.success(T(`@EDITOR:已复制到剪贴板`)):_.error(T(`@EDITOR:复制失败`)))}async function nr(){let e=G.value?.node;if(K(),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||_.error(t.error||T(`@EDITOR:VSCode 未安装`))}catch(e){_.error(e?.message||String(e))}}let rr=new Set([`html`,`htm`]),ir=i(()=>{let e=G.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return rr.has(t)});async function ar(){let e=G.value?.node;if(K(),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||_.error(t.error||T(`@EDITOR:浏览器打开失败`))}catch(e){_.error(e?.message||String(e))}}re(()=>document.addEventListener(`click`,K)),c(()=>document.removeEventListener(`click`,K));let or=new Set([`md`,`html`,`htm`,`svg`]),sr=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),q=C(!1),J=C(!1),Y=C(!1),cr=C(!1),lr=C(0),X=i(()=>O.value.find(e=>e.path===k.value)??null),ur=i(()=>X.value?.language===`plaintext`&&X.value?.content===``),dr=i(()=>X.value?.language===`office`),Z=i(()=>(X.value?.name??``).split(`.`).pop()?.toLowerCase()??``),fr=i(()=>or.has(Z.value)||sr.has(Z.value)||Oe(Z.value)),pr=i(()=>((X.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),mr=i(()=>Z.value===`md`&&pr.value>0);b(k,()=>{q.value&&!fr.value&&(q.value=!1),J.value&&!mr.value&&(J.value=!1)});function hr(){fr.value&&(q.value||(J.value=!1,Y.value=!1),q.value=!q.value)}function gr(){mr.value&&(J.value||(q.value=!1,Y.value=!1),J.value=!J.value)}function _r(){Y.value||(q.value=!1,J.value=!1),Y.value=!Y.value,cr.value=!0}let vr=C(null),Q=C(!1),$=C(``),yr=C(!0),br=null,xr=i(()=>!J.value&&q.value&&Z.value===`md`&&!!X.value);function Sr(){return X.value?.content??``}function Cr(){return Sr().match(/^\s*#\s+(.+?)\s*(?:\r?\n|$)/)?.[1]?.trim()??``}function wr(e,t,n){if(!e){_.error(T(`@EDITOR:复制失败`));return}$.value=n,br&&clearTimeout(br),br=setTimeout(()=>{$.value=``},1800),t>0?_.warning(T(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):_.success(T(`@EDITOR:已复制`))}async function Tr(){wr(await $n(Sr()),0,`md`)}async function Er(){let e=vr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await dt(e,yr.value);wr(await $n(t),n,`html`)}finally{Q.value=!1}}}function Dr(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 Or(){let e=vr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await ft(e,{inline:yr.value,title:Cr()}),r=Sr(),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||=Dr(t),wr(i,n,`rich`)}finally{Q.value=!1}}}let kr=i(()=>{let e=X.value;if(!e)return``;let t=Z.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?Ie(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>`:``}),Ar=!1,jr=0,Mr=0;function Nr(e){Ar=!0,jr=e.clientX,Mr=lr.value,document.addEventListener(`mousemove`,Pr),document.addEventListener(`mouseup`,Fr),e.preventDefault()}function Pr(e){if(!Ar)return;let t=e.clientX-jr;lr.value=Math.max(200,Math.min(900,Mr+t))}function Fr(){Ar=!1,document.removeEventListener(`mousemove`,Pr),document.removeEventListener(`mouseup`,Fr)}return(i,o)=>(p(),t(m,null,[n(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:B},[n(`div`,{class:`editor-sidebar`,style:g({width:V.value+`px`})},[n(`div`,pt,[n(`span`,mt,e(r(T)(`@EDITOR:资源管理器`)),1),n(`div`,ht,[a(r(ne),{content:r(T)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:se(()=>[n(`button`,{class:`sidebar-action-btn`,onClick:Rn},[...o[12]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,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)]])]),_:1},8,[`content`]),a(r(ne),{content:r(T)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:se(()=>[n(`button`,{class:`sidebar-action-btn`,onClick:zn},[...o[13]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`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`}),n(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),n(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),a(r(ne),{content:r(T)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:se(()=>[n(`button`,{class:`sidebar-action-btn`,onClick:o[0]||=e=>D({notifyOnError:!0})},[...o[14]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`polyline`,{points:`1 4 1 10 7 10`}),n(`polyline`,{points:`23 20 23 14 17 14`}),n(`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`])])]),n(`div`,gt,[o[16]||=n(`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`},[n(`circle`,{cx:`11`,cy:`11`,r:`7`}),n(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(n(`input`,{ref_key:`searchInputRef`,ref:et,"onUpdate:modelValue":o[1]||=e=>w.value=e,type:`text`,class:`sidebar-search-input`,placeholder:r(T)(`@EDITOR:搜索文件...`),title:r(T)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ie(nt,[`escape`])},null,40,_t),[[ue,w.value]]),w.value?(p(),t(`button`,{key:0,class:`sidebar-search-clear`,title:r(T)(`@EDITOR:清除搜索`),"aria-label":r(T)(`@EDITOR:清除搜索`),onClick:we},[...o[15]||=[n(`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`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,vt)):v(``,!0)]),pe.value?(p(),t(`div`,Bt,[...o[25]||=[n(`span`,{class:`spin-icon`},null,-1)]])):(p(),t(`div`,yt,[(p(!0),t(m,null,oe(Ke(Ye.value),i=>(p(),t(m,{key:i.path},[U.value&&U.value.node.path===i.path?(p(),t(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:g({paddingLeft:12+i.depth*14+`px`})},[i.type===`directory`?(p(),t(`span`,{key:0,class:l([`tree-arrow`,{expanded:i.expanded}])},[...o[17]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),t(`span`,bt)),(p(),t(`svg`,xt,[n(`use`,{"xlink:href":`#${Fn(i)}`},null,8,St)])),x(n(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:In,"onUpdate:modelValue":o[2]||=e=>U.value.value=e,onKeydown:Yn,onBlur:Jn,onClick:o[3]||=S(()=>{},[`stop`])},null,544),[[ue,U.value.value]])],4)):(p(),t(`div`,{key:1,class:l([`tree-node`,{"tree-node--dir":i.type===`directory`,"tree-node--file":i.type===`file`,"tree-node--active":k.value===i.path,"tree-node--selected":A.value?.path===i.path&&k.value!==i.path}]),style:g({paddingLeft:12+i.depth*14+`px`}),onClick:e=>rt(i),onContextmenu:e=>Wn(e,i)},[i.type===`directory`?(p(),t(`span`,{key:0,class:l([`tree-arrow`,{expanded:i.expanded}])},[...o[18]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(p(),t(`span`,wt)),i.type===`directory`?(p(),t(`svg`,Tt,[n(`use`,{"xlink:href":`#${Fn(i)}`},null,8,Et)])):(p(),t(`svg`,Dt,[n(`use`,{"xlink:href":`#${Fn(i)}`},null,8,Ot)])),n(`span`,{class:`tree-name`,title:i.path},[(p(!0),t(m,null,oe(Qe(i.name),(n,r)=>(p(),t(m,{key:r},[n.hit?(p(),t(`span`,At,e(n.text),1)):(p(),t(m,{key:1},[f(e(n.text),1)],64))],64))),128))],8,kt),i.loading?(p(),t(`span`,jt)):v(``,!0)],46,Ct)),H.value&&H.value.afterNode?.path===i.path?(p(),t(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:g({paddingLeft:12+H.value.depth*14+`px`})},[o[21]||=n(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),t(`svg`,Mt,[...o[19]||=[n(`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)]])):(p(),t(`svg`,Nt,[...o[20]||=[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`},null,-1),n(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(n(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":o[4]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?r(T)(`@EDITOR:输入文件名`):r(T)(`@EDITOR:输入文件夹名`),onKeydown:Hn,onBlur:Bn,onClick:o[5]||=S(()=>{},[`stop`])},null,40,Pt),[[ue,H.value.value]])],4)):v(``,!0)],64))),128)),H.value&&H.value.afterNode===null?(p(),t(`div`,Ft,[o[24]||=n(`span`,{class:`tree-arrow-spacer`},null,-1),H.value.kind===`directory`?(p(),t(`svg`,It,[...o[22]||=[n(`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)]])):(p(),t(`svg`,Lt,[...o[23]||=[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`},null,-1),n(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(n(`input`,{ref_key:`inlineInputRef`,ref:W,class:`tree-inline-input`,"onUpdate:modelValue":o[6]||=e=>H.value.value=e,placeholder:H.value.kind===`file`?r(T)(`@EDITOR:输入文件名`):r(T)(`@EDITOR:输入文件夹名`),onKeydown:Hn,onBlur:Bn,onClick:o[7]||=S(()=>{},[`stop`])},null,40,Rt),[[ue,H.value.value]])])):v(``,!0),!H.value&&(Ze.value||y.value.length===0)?(p(),t(`div`,zt,e(Ze.value?r(T)(`@EDITOR:未找到匹配文件`):r(T)(`@EDITOR:暂无文件`)),1)):v(``,!0)]))],4),n(`div`,{class:`editor-resizer`,onMousedown:Mn},null,32),n(`div`,Vt,[O.value.length>0?(p(),t(`div`,Ht,[(p(!0),t(m,null,oe(O.value,r=>(p(),t(`div`,{key:r.path,class:l([`editor-tab`,{active:k.value===r.path,dirty:r.isDirty}]),onClick:e=>k.value=r.path,title:r.path},[n(`span`,Wt,e(r.name),1),r.isDirty?(p(),t(`span`,Gt)):v(``,!0),n(`button`,{class:`tab-close`,onClick:e=>it(r.path,e)},[...o[26]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Kt)],10,Ut))),128)),o[30]||=n(`div`,{class:`editor-tabs-spacer`},null,-1),fr.value?(p(),t(`button`,{key:0,class:l([`preview-toggle-btn`,{active:q.value}]),title:q.value?r(T)(`@EDITOR:关闭预览`):r(T)(`@EDITOR:打开预览`),onClick:hr},[o[27]||=n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),n(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),n(`span`,null,e(r(T)(`@EDITOR:预览`)),1)],10,qt)):v(``,!0),mr.value?(p(),t(`button`,{key:1,class:l([`preview-toggle-btn mindmap-toggle-btn`,{active:J.value,disabled:!mr.value}]),disabled:!mr.value,title:mr.value?J.value?r(T)(`@EDITOR:关闭思维导图`):r(T)(`@EDITOR:打开思维导图`):r(T)(`@EDITOR:需要至少一个 # 标题`),onClick:gr},[o[28]||=ee(`<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-843a938c><circle cx="12" cy="12" r="2" data-v-843a938c></circle><circle cx="5" cy="6" r="1.6" data-v-843a938c></circle><circle cx="19" cy="6" r="1.6" data-v-843a938c></circle><circle cx="5" cy="18" r="1.6" data-v-843a938c></circle><circle cx="19" cy="18" r="1.6" data-v-843a938c></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-843a938c></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-843a938c></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-843a938c></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-843a938c></line></svg>`,1),n(`span`,null,e(r(T)(`@EDITOR:思维导图`)),1)],10,Jt)):v(``,!0),n(`button`,{class:l([`preview-toggle-btn agent-toggle-btn`,{active:Y.value}]),title:Y.value?r(T)(`@EDITOR:关闭 g ai 对话`):r(T)(`@EDITOR:打开 g ai 对话`),onClick:_r},[o[29]||=n(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[n(`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`}),n(`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),n(`span`,null,e(r(T)(`@EDITOR:g ai 对话`)),1)],10,Yt)])):v(``,!0),O.value.length===0?(p(),d(Pe,{key:1,class:`editor-empty`,title:r(T)(`@EDITOR:从左侧选择文件打开`),hint:r(T)(`@EDITOR:Ctrl+S 保存`)},{icon:se(()=>[...o[31]||=[n(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.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`})],-1)]]),_:1},8,[`title`,`hint`])):v(``,!0),n(`div`,Xt,[n(`div`,{class:l([`monaco-container`,{hidden:O.value.length===0||ur.value||dr.value}]),ref_key:`editorContainerRef`,ref:F},null,2),ur.value&&O.value.length>0&&!q.value&&!J.value?(p(),t(`div`,Zt,[(p(),t(`svg`,Qt,[...o[32]||=[n(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),n(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),n(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),n(`p`,$t,e(X.value?.name),1),n(`p`,en,e(r(T)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):v(``,!0),(q.value||J.value||Y.value)&&O.value.length>0?(p(),t(`div`,{key:1,class:`preview-resizer`,onMousedown:Nr},null,32)):v(``,!0),cr.value?x((p(),d(ct,{key:2,active:Y.value&&O.value.length>0,"active-file-path":k.value,"active-file-name":X.value?.name??``,style:g({flexBasis:lr.value+`px`}),onClose:o[8]||=e=>Y.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[fe,Y.value&&O.value.length>0]]):v(``,!0),(q.value||J.value)&&O.value.length>0?(p(),t(`div`,{key:3,class:`preview-panel`,style:g({flexBasis:lr.value+`px`})},[n(`div`,tn,[n(`span`,nn,e(J.value?r(T)(`@EDITOR:思维导图`):r(T)(`@EDITOR:预览`)),1),n(`span`,rn,e(Z.value.toUpperCase()),1),o[34]||=n(`div`,{class:`preview-header-spacer`},null,-1),n(`button`,{class:`preview-close-btn`,title:J.value?r(T)(`@EDITOR:关闭思维导图`):r(T)(`@EDITOR:关闭预览`),onClick:o[9]||=e=>J.value?J.value=!1:q.value=!1},[...o[33]||=[n(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[n(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),n(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,an)]),n(`div`,on,[xr.value?(p(),t(`div`,sn,[n(`button`,{class:l([`preview-copy-btn`,{done:$.value===`md`}]),disabled:Q.value,title:r(T)(`@EDITOR:复制 Markdown 源码`),onClick:Tr},[o[35]||=n(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),n(`span`,null,e($.value===`md`?r(T)(`@EDITOR:已复制`):`Markdown`),1)],10,cn),n(`button`,{class:l([`preview-copy-btn`,{done:$.value===`html`}]),disabled:Q.value,title:r(T)(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:Er},[o[36]||=n(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),n(`span`,null,e($.value===`html`?r(T)(`@EDITOR:已复制`):`HTML`),1)],10,ln),n(`button`,{class:l([`preview-copy-btn preview-copy-btn--primary`,{done:$.value===`rich`}]),disabled:Q.value,title:r(T)(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:Or},[o[37]||=n(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),n(`span`,null,e(Q.value?r(T)(`@EDITOR:转换图片中…`):$.value===`rich`?r(T)(`@EDITOR:已复制`):r(T)(`@EDITOR:复制富文本`)),1)],10,un),n(`label`,{class:`preview-copy-embed`,title:r(T)(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[x(n(`input`,{"onUpdate:modelValue":o[10]||=e=>yr.value=e,type:`checkbox`},null,512),[[ce,yr.value]]),n(`span`,null,e(r(T)(`@EDITOR:图片转 Base64`)),1)],8,dn)])):v(``,!0),J.value&&Z.value===`md`&&X.value?(p(),d($e,{key:1,content:X.value.content,class:`preview-mindmap`},null,8,[`content`])):q.value&&Z.value===`md`&&X.value?(p(),d(je,{ref_key:`mdPreviewRef`,ref:vr,key:X.value.path,content:X.value.content,"base-path":X.value.path,class:`preview-markdown`},null,8,[`content`,`base-path`])):q.value&&[`html`,`htm`,`svg`].includes(Z.value)?(p(),t(`iframe`,{key:3,class:`preview-iframe`,sandbox:r(Ee),srcdoc:kr.value},null,8,fn)):q.value&&r(sr).has(Z.value)&&X.value?(p(),d(Me,{key:4,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):q.value&&dr.value&&X.value?(p(),d(Ae,{key:5,"file-path":X.value.path},null,8,[`file-path`])):v(``,!0)])],4)):v(``,!0)])])],512),(p(),d(de,{to:`body`},[G.value?(p(),t(`div`,{key:0,ref_key:`ctxMenuRef`,ref:Un,class:`ctx-menu`,style:g({left:G.value.x+`px`,top:G.value.y+`px`}),onClick:o[11]||=S(()=>{},[`stop`])},[n(`button`,{class:`ctx-menu-item`,onClick:Gn},[o[38]||=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(` `+e(r(T)(`@EDITOR:新建文件`)),1)]),n(`button`,{class:`ctx-menu-item`,onClick:Kn},[o[39]||=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:`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`}),n(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),n(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),f(` `+e(r(T)(`@EDITOR:新建文件夹`)),1)]),o[46]||=n(`div`,{class:`ctx-menu-sep`},null,-1),n(`button`,{class:`ctx-menu-item`,onClick:er},[o[40]||=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(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),n(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),f(` `+e(r(T)(`@EDITOR:复制绝对路径`)),1)]),n(`button`,{class:`ctx-menu-item`,onClick:tr},[o[41]||=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:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),n(`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),f(` `+e(r(T)(`@EDITOR:复制相对路径`)),1)]),o[47]||=n(`div`,{class:`ctx-menu-sep`},null,-1),ir.value?(p(),t(`button`,{key:0,class:`ctx-menu-item`,onClick:ar},[o[42]||=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(`circle`,{cx:`12`,cy:`12`,r:`9`}),n(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),n(`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),f(` `+e(r(T)(`@EDITOR:在浏览器中打开`)),1)])):v(``,!0),n(`button`,{class:`ctx-menu-item`,onClick:Zn},[o[43]||=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(` `+e(r(T)(`@EDITOR:在资源管理器中打开`)),1)]),n(`button`,{class:`ctx-menu-item`,onClick:nr},[a(he,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),f(` `+e(r(T)(`@EDITOR:在 VSCode 中打开`)),1)]),n(`button`,{class:`ctx-menu-item`,onClick:qn},[o[44]||=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:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),n(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),f(` `+e(r(T)(`@EDITOR:重命名`)),1)]),n(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Xn},[o[45]||=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(` `+e(r(T)(`@EDITOR:删除`)),1)])],4)):v(``,!0)]))],64))}}),[[`__scopeId`,`data-v-843a938c`]]);export{hn as default};
|
package/src/ui/public/assets/{FlowExecutionViewer-CKHp0Hfi.js → FlowExecutionViewer-BuU5kQG8.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{An as e,Dr as t,En as n,Fn as r,Gn as i,Ln as a,Qn as o,Vn as s,Zn as c,_r as l,lr as u,mr as d,sr as f,zn as p}from"./element-plus-J45pKUrE.js";import{n as m,t as h}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-8aIpM5CU.js";import{a as b,c as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./UserInputNode-
|
|
1
|
+
import{An as e,Dr as t,En as n,Fn as r,Gn as i,Ln as a,Qn as o,Vn as s,Zn as c,_r as l,lr as u,mr as d,sr as f,zn as p}from"./element-plus-J45pKUrE.js";import{n as m,t as h}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-8aIpM5CU.js";import{a as b,c as x,i as S,n as C,o as w,r as T,s as E,t as D}from"./UserInputNode-oOQwaadU.js";s(),d();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(a({__name:`FlowExecutionViewer`,props:{flowData:{type:Object,required:!0},currentNodeId:{type:String,default:void 0},executedNodeIds:{type:Array,default:()=>[]},failedNodeIds:{type:Array,default:()=>[]},executedEdgeIds:{type:Array,default:()=>[]}},setup(s){function d(e){switch(e){case`command`:return`📋`;case`wait`:return`⏰`;case`version`:return`📦`;case`confirm`:return`✋`;case`code`:return`🧩`;case`start`:return`🚀`;case`condition`:return`🔀`;case`user_input`:return`⌨️`;default:return``}}let h=a({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>p(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:d(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(e){return a({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(t){let r=n(()=>{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()=>p(x,{id:t.id,nodeId:t.id,nodeType:t.data?.type,title:t.data?.label,icon:d(t.data?.type),enabled:t.data?.enabled,selected:t.data?.selected,execStatus:t.data?.execStatus,sourceHandleIds:t.data?.type===`condition`?r.value:void 0,deletable:!1},{default:()=>p(e,{data:t.data,id:t.id})})}})}let j={start:l(h),command:l(A(E)),wait:l(A(w)),version:l(A(b)),confirm:l(A(S)),code:l(A(T)),condition:l(A(C)),user_input:l(A(D))},M=s,{onPaneReady:N}=_({id:k}),P=null,F=null;async function I(e){if(e){if(!P){F=e;return}for(let t=0;t<6;t+=1){if(await i(),await new Promise(e=>requestAnimationFrame(()=>e())),!(typeof P?.findNode==`function`&&P.findNode(e))){await new Promise(e=>window.setTimeout(()=>e(),60));continue}try{await P.fitView({nodes:[e],padding:.35,includeHiddenNodes:!0,minZoom:.35,maxZoom:1.2,duration:200})}catch{}break}}}N(e=>{P=e,console.log(`[FlowExecutionViewer] onPaneReady, flowId=`,k),console.log(`[FlowExecutionViewer] instance keys=`,Object.keys(e||{}));try{P.fitView({padding:.2,includeHiddenNodes:!0,duration:0})}catch{}let t=(M.currentNodeId||F||``).trim();t&&(F=null,I(t))});let L=null;f(()=>M.currentNodeId,async e=>{e&&(L&&=(window.clearTimeout(L),null),L=window.setTimeout(async()=>{if(console.log(`[FlowExecutionViewer] focus request, flowId=`,k,`nodeId=`,e),!P){F=e,console.log(`[FlowExecutionViewer] flowInstance not ready, pendingFocusNodeId=`,F);return}I(e)},150))}),c(()=>{L&&=(window.clearTimeout(L),null)});let R=n(()=>{let e=Array.isArray(M.flowData?.nodes)?M.flowData.nodes:[],t=new Set(M.executedNodeIds),n=new Set(M.failedNodeIds),r=M.currentNodeId;return e.map(e=>{let i;r&&e.id===r?i=`running`:n.has(e.id)?i=`failed`:t.has(e.id)&&(i=`success`);let a=[];return t.has(e.id)&&a.push(`exec-node-done`),{...e,data:{...e.data,execStatus:i},class:a.join(` `)}})}),z=n(()=>{let e=Array.isArray(M.flowData?.edges)?M.flowData.edges:[],t=new Set(M.executedEdgeIds);return e.map(e=>{let n=[];return t.has(e.id)&&n.push(`exec-edge-done`),{...e,class:n.join(` `)}})});return(n,i)=>(o(),e(`div`,O,[r(t(y),{id:k,nodes:R.value,edges:z.value,"node-types":j,"nodes-draggable":!1,"nodes-connectable":!1,"elements-selectable":!1,"zoom-on-scroll":!0,"zoom-on-double-click":!1,"pan-on-drag":!0,"min-zoom":.2,"max-zoom":1.5},{default:u(()=>[r(t(g)),r(t(v))]),_:1},8,[`nodes`,`edges`])]))}}),[[`__scopeId`,`data-v-d2ccb36e`]]);export{A as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$n as t,$r as n,A as r,An as i,At as a,C as o,Dn as s,Dr as c,En as l,Et as u,F as d,Fn as f,Fr as p,G as m,Gn as h,Hn as g,Ht as ee,I as _,J as v,Jr as y,K as b,Kt as x,Ln as S,M as te,N as ne,On as C,Pn as w,Pt as re,Qn as T,S as ie,Sn as E,St as ae,U as oe,Vn as D,W as se,Xn as ce,Zn as O,_r as k,at as le,bt as A,c as j,ct as ue,dn as M,dt as N,er as P,i as F,kn as I,kt as L,l as R,lr as z,lt as de,m as B,mr as V,r as H,rn as fe,sr as U,tr as W,w as pe,x as me,xn as G,xr as K,y as he,z as ge,zn as q,zt as _e}from"./element-plus-J45pKUrE.js";import{b as ve}from"./vendor-B3NyhlYR.js";import{n as J,t as Y}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{t as ye}from"./dagre-DPkLmI0C.js";import{t as be}from"./SvgIcon-Du5MOe8A.js";import{t as X}from"./configStore-DojhW1P7.js";import{t as xe}from"./CommonDialog-BUuLsgNS.js";import{i as Se,l as Ce,n as we,s as Te}from"./vue-flow-8aIpM5CU.js";import{U as Z,o as Ee}from"./index-Z7rlN9LU.js";import{a as De,c as Oe,i as Q,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./UserInputNode-CQWY6Jwx.js";var Pe=e(ye(),1);D(),V();var Fe=S({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,r=t,i=K(!1);function a(e){e===`executeFrom`?r(`execute-from-node`,n.nodeId):e===`executeSingle`&&r(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=v,r=o,s=pe,l=ie;return T(),C(l,{trigger:`contextmenu`,onCommand:a,onVisibleChange:t[0]||=e=>i.value=e,"popper-class":`flow-node-dropdown`},{dropdown:z(()=>[f(s,null,{default:z(()=>[f(r,{command:`executeFrom`},{default:z(()=>[f(n,null,{default:z(()=>[f(c(fe))]),_:1}),t[1]||=w(` 从此处开始执行 `,-1)]),_:1}),f(r,{command:`executeSingle`},{default:z(()=>[f(n,null,{default:z(()=>[f(c(fe))]),_:1}),t[2]||=w(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:z(()=>[W(e.$slots,`default`,{dropdownVisible:i.value})]),_:3})}}});D(),V(),p();var Ie={class:`package-json-selector`},Le={class:`selector-container`},Re={class:`option-content`},ze={class:`option-main`},Be={class:`package-name`},Ve={class:`option-path`},$={key:0,class:`empty-hint`},He=Y(S({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,o=t,u=K(!1),p=K([]),m=K(``),h=l({get:()=>r.modelValue,set:e=>{m.value=e,o(`update:modelValue`,e);let t=p.value.find(t=>t.fullPath===e);o(`change`,t||null)}}),g=l(()=>p.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function y(e){u.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){p.value=r.packages||[],h.value&&!p.value.some(e=>e.fullPath===h.value)&&(h.value=``);let t=e?`目录 ${e}`:`当前项目`;F.success(`扫描 ${t} 完成,找到 ${p.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),F.error(`扫描失败: ${e.message}`),p.value=[]}finally{u.value=!1}}async function b(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?x(e):e.error&&F.error(e.error)}catch(e){F.error(`浏览目录失败: ${e.message}`)}}function x(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){F.warning(`请输入目录路径`);return}S(e)};H.alert(q(`div`,{class:`directory-browser`},[q(`div`,{class:`current-path`},[q(`span`,{class:`path-label`},`当前路径:`),q(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),q(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),q(`div`,{class:`directory-list`},[e.parentPath?q(`div`,{class:`directory-item parent-dir`,onClick:()=>S(e.parentPath)},[q(`span`,{class:`dir-icon`},q(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[q(`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`})])),q(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>q(`div`,{class:`directory-item`,onClick:()=>S(e.path)},[q(`span`,{class:`dir-icon`},q(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[q(`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`})])),q(`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){F.warning(`请输入目录路径`);return}y(n)}}})}async function S(e){try{H.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?x(t):t.error&&F.error(t.error)}catch(e){F.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){F.error(`处理目录选择时出错: ${e.message}`)}}return y(),U(()=>r.modelValue,e=>{m.value=e},{immediate:!0}),(t,r)=>{let o=v,l=d,m=_,x=ge,S=R;return T(),i(`div`,Ie,[s(`div`,Le,[f(m,{modelValue:h.value,"onUpdate:modelValue":r[0]||=e=>h.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||u.value,filterable:``,class:`package-select`},{default:z(()=>[(T(!0),i(E,null,P(g.value,e=>(T(),C(l,{key:e.value,label:e.label,value:e.value},{default:z(()=>[s(`div`,Re,[s(`div`,ze,[f(o,{class:`folder-icon`},{default:z(()=>[f(c(ae))]),_:1}),s(`span`,Be,n(e.label),1)]),s(`div`,Ve,n(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),f(x,{icon:u.value?c(a):c(ee),loading:u.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>y(),class:`refresh-btn`,title:`刷新当前项目`},{default:z(()=>[w(n(u.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),f(x,{icon:c(A),disabled:e.disabled||u.value,size:`default`,onClick:b,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:z(()=>[...r[2]||=[w(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),p.value.length===0&&!u.value?(T(),i(`div`,$,[f(S,{type:`info`,size:`small`},{default:z(()=>[...r[3]||=[w(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):I(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);D(),p(),V();var Ue={class:`param-list`},We={key:0,class:`param-list__title`},Ge={key:0,class:`param-list__title-text`},Ke={class:`param-list__title-actions`},qe={key:1,class:`param-list__empty`},Je={key:2,class:`param-list__body`},Ye={class:`param-list__row-content`},Xe={key:0,class:`param-list__row-actions`},Ze=Y(S({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:t}){let r=e,a=t,o=l(()=>Array.isArray(r.modelValue)?r.modelValue:[]);function u(){if(!r.addable||r.disableAdd)return;let e=r.createItem;if(!e)return;let t=[...o.value,e()];a(`update:modelValue`,t),a(`add`)}function d(e){if(!r.removable)return;let t=typeof r.minItems==`number`?r.minItems:0;if(o.value.length<=t)return;let n=o.value[e];if(r.disableRemove&&r.disableRemove(n,e))return;let i=[...o.value];i.splice(e,1),a(`update:modelValue`,i),a(`remove`,e)}function p(e,t){return r.itemKey?r.itemKey(e,t):t}return(t,r)=>{let a=ge;return T(),i(`div`,Ue,[e.title!==void 0||e.addable?(T(),i(`div`,We,[e.title?(T(),i(`span`,Ge,n(e.title),1)):I(``,!0),s(`div`,Ke,[W(t.$slots,`title-actions`,{},void 0,!0),e.addable?(T(),C(a,{key:0,type:`primary`,plain:``,icon:c(_e),disabled:e.disableAdd||!e.createItem,onClick:u},null,8,[`icon`,`disabled`])):I(``,!0)])])):I(``,!0),o.value.length===0?(T(),i(`div`,qe,[W(t.$slots,`empty`,{},void 0,!0)])):(T(),i(`div`,Je,[(T(!0),i(E,null,P(o.value,(n,r)=>(T(),i(`div`,{key:p(n,r),class:y([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[s(`div`,Ye,[W(t.$slots,`row`,{item:n,index:r},void 0,!0)]),e.removable?(T(),i(`div`,Xe,[f(a,{type:`danger`,plain:``,icon:c(de),disabled:typeof e.minItems==`number`&&o.value.length<=e.minItems||(e.disableRemove?e.disableRemove(n,r):!1),onClick:e=>d(r)},null,8,[`icon`,`disabled`,`onClick`])])):I(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);D(),V(),p();var Qe={class:`node-input-config`},$e={class:`input-row`},et={class:`input-field param-name-field`},tt={class:`field-label`},nt={class:`input-field type-field`},rt={class:`field-label`},it={class:`input-field value-field`},at={class:`field-label`},ot={class:`tree-node-label`},st={class:`input-field required-field`},ct={class:`field-label`},lt=Y(S({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,a=t,o=K([]);U(()=>r.modelValue,e=>{o.value=e?[...e]:[]},{immediate:!0,deep:!0}),U(()=>r.paramNames,e=>{if(!e||e.length===0){o.value=[],a(`update:modelValue`,[]);return}let t=new Map(o.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:``});o.value=n,a(`update:modelValue`,n)},{immediate:!0});function u(e,t,n){if(!o.value[e])return;let r=[...o.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),o.value=r,a(`update:modelValue`,r)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function m(e){if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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 h=l(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:p(e),children:m(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(e,t){if(!t)return;let[n,r]=t.split(`::`),i=[...o.value];i[e]={...i[e],referenceNodeId:n,referenceOutputKey:r},o.value=i,a(`update:modelValue`,i)}function ee(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,r)=>{let a=oe,l=d,p=_,m=v,y=j,b=B;return T(),i(`div`,Qe,[f(Ze,{"model-value":o.value,title:void 0,addable:!1,removable:!1},{empty:z(()=>[w(n(c(J)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:z(({item:t,index:r})=>[s(`div`,$e,[s(`div`,et,[s(`label`,tt,n(c(J)(`@NODEINPUT:参数名`)),1),f(a,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:c(J)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>u(r,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),s(`div`,nt,[s(`label`,rt,n(c(J)(`@NODEINPUT:类型`)),1),f(p,{"model-value":t.inputType,placeholder:c(J)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>u(r,`inputType`,e)},{default:z(()=>[f(l,{value:`manual`,label:c(J)(`@NODEINPUT:手动输入`)},null,8,[`label`]),f(l,{value:`reference`,label:c(J)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),s(`div`,it,[s(`label`,at,n(c(J)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(T(),C(a,{key:0,"model-value":t.manualValue,placeholder:c(J)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>u(r,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(T(),C(y,{key:1,"model-value":ee(t),data:h.value,placeholder:c(J)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(r,e)},{default:z(({data:e})=>[s(`span`,ot,[e.children?I(``,!0):(T(),C(m,{key:0},{default:z(()=>[f(c(L))]),_:1})),w(` `+n(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,st,[s(`label`,ct,n(c(J)(`@NODEINPUT:必填`)),1),f(b,{"model-value":!!t.required,"onUpdate:modelValue":e=>u(r,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);D(),V(),p();var ut={class:`code-node-input-config`},dt={class:`input-row`},ft={class:`input-field name-field`},pt={class:`field-label`},mt={class:`input-field type-field`},ht={class:`field-label`},gt={class:`input-field value-field`},_t={class:`field-label`},vt={class:`input-field action-field`},yt={class:`field-label`},bt=Y(S({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let a=e,o=r,u=K([]);U(()=>a.modelValue,e=>{u.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function m(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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 h=l(()=>!a.predecessorNodes||a.predecessorNodes.length===0?[]:a.predecessorNodes.map(e=>({value:e.id,label:p(e),children:m(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function ee(){let e=[...u.value,g()];u.value=e,o(`update:modelValue`,e)}t({addRow:ee});function v(e,t){if(!u.value[e])return;let n=[...u.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`}))),u.value=n,o(`update:modelValue`,n)}function y(e,t){if(!t)return;let[n,r]=t.split(`::`);v(e,{ref:{nodeId:n,outputKey:r}})}function b(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let a=oe,l=d,p=_,m=j,ee=B;return T(),i(`div`,ut,[f(Ze,{"model-value":u.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":g,"onUpdate:modelValue":r[0]||=e=>o(`update:modelValue`,e)},{empty:z(()=>[w(n(c(J)(`@NODECFG:暂无输入参数`)),1)]),row:z(({item:t,index:r})=>[s(`div`,dt,[s(`div`,ft,[s(`label`,pt,n(c(J)(`@NODECFG:参数名`)),1),f(a,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>v(r,{name:e})],placeholder:c(J)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),s(`div`,mt,[s(`label`,ht,n(c(J)(`@NODECFG:参数值`)),1),f(p,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>v(r,{source:e})],style:{width:`110px`}},{default:z(()=>[f(l,{label:c(J)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),f(l,{label:c(J)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),s(`div`,gt,[s(`label`,_t,n(c(J)(`@NODECFG:值`)),1),t.source===`manual`?(T(),C(a,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>v(r,{manualValue:e})],placeholder:c(J)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(T(),C(m,{key:1,"model-value":b(t),data:h.value,placeholder:c(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>y(r,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,vt,[s(`label`,yt,n(c(J)(`@NODEINPUT:必填`)),1),f(ee,{"model-value":!!t.required,"onUpdate:modelValue":e=>v(r,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b16df1ae`]]);D(),V(),p();var xt={class:`user-input-param-config`},St={class:`input-row`},Ct={class:`input-field name-field`},wt={class:`field-label`},Tt={class:`input-field type-field`},Et={class:`field-label`},Dt={class:`input-field value-field`},Ot={class:`field-label`},kt={class:`tree-node-label`},At={class:`input-field action-field`},jt={class:`field-label`},Mt=Y(S({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let a=e,o=r,u=K([]);U(()=>a.modelValue,e=>{u.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function p(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function m(){let e=[...u.value,p()];u.value=e,o(`update:modelValue`,e)}t({addRow:m});function h(e,t){if(!u.value[e])return;let n=[...u.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`}))),u.value=n,o(`update:modelValue`,n)}function g(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:用户输入`):e.data.label||e.id}function ee(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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 y=l(()=>!a.predecessorNodes||a.predecessorNodes.length===0?[]:a.predecessorNodes.map(e=>({value:e.id,label:g(e),children:ee(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function b(e,t){if(!t)return;let[n,r]=t.split(`::`);h(e,{ref:{nodeId:n,outputKey:r}})}function x(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let l=oe,g=d,ee=_,S=v,te=j,ne=B,re=ge;return T(),i(`div`,xt,[f(Ze,{"model-value":u.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":p,"onUpdate:modelValue":r[0]||=e=>o(`update:modelValue`,e)},{empty:z(()=>[w(n(c(J)(`@UINPUT:暂无输入参数`)),1)]),row:z(({item:e,index:t})=>[s(`div`,St,[s(`div`,Ct,[s(`label`,wt,n(c(J)(`@UINPUT:参数名`)),1),f(l,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>h(t,{name:e})],placeholder:c(J)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),s(`div`,Tt,[s(`label`,Et,n(c(J)(`@UINPUT:类型`)),1),f(ee,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>h(t,{source:e})],style:{width:`130px`}},{default:z(()=>[f(g,{label:c(J)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),f(g,{label:c(J)(`@UINPUT:引用`),value:`reference`,disabled:!a.predecessorNodes||a.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),s(`div`,Dt,[s(`label`,Ot,n(e.source===`manual`?c(J)(`@UINPUT:默认值`):c(J)(`@UINPUT:引用输出`)),1),e.source===`manual`?(T(),C(l,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>h(t,{defaultValue:e})],placeholder:c(J)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(T(),C(te,{key:1,"model-value":x(e),data:y.value,placeholder:c(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>b(t,e)},{default:z(({data:e})=>[s(`span`,kt,[e.children?I(``,!0):(T(),C(S,{key:0},{default:z(()=>[f(c(L))]),_:1})),w(` `+n(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,At,[s(`label`,jt,n(c(J)(`@NODEINPUT:必填`)),1),f(ne,{"model-value":!!e.required,"onUpdate:modelValue":e=>h(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:z(()=>[e.addable===!1?I(``,!0):(T(),C(re,{key:0,type:`primary`,plain:``,size:`small`,onClick:m},{default:z(()=>[w(n(c(J)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);D(),V(),p();var Nt={key:0,class:`config-content`},Pt={class:`config-section`},Ft={class:`section-title`},It={key:0,class:`config-section`},Lt={class:`section-title`},Rt={key:1,class:`config-section`},zt={class:`section-title`},Bt={class:`sub-section`},Vt={class:`sub-title`},Ht={key:0,class:`empty-tip`},Ut={key:1,class:`condition-branch-list`},Wt={class:`branch-main`},Gt={class:`branch-header`},Kt={class:`branch-title`},qt={key:0,class:`branch-badge`},Jt={class:`branch-meta`},Yt={key:0,class:`branch-rules`},Xt={class:`rules-header`},Zt={class:`rule-col`},Qt={class:`field-label`},$t={class:`rule-col`},en={class:`field-label`},tn={class:`rule-col`},nn={class:`field-label`},rn={class:`rule-col`,style:{"align-self":`flex-end`}},an={key:1,class:`branch-default-tip`},on={key:0,class:`branch-actions`},sn={key:2,class:`config-section`},cn={class:`section-title`},ln={key:3,class:`config-section`},un={class:`section-title`},dn={key:4,class:`config-section`},fn={class:`section-title`},pn={key:5,class:`config-section`},mn={class:`section-title`},hn={key:6,class:`config-section`},gn={class:`section-title`},_n={class:`output-param-row`},vn={class:`output-param-field`},yn={class:`field-label`},bn={key:7,class:`config-section`},xn={class:`section-title`},Sn={key:0,class:`empty-tip`},Cn={key:1,class:`command-list`},wn=[`onClick`],Tn={class:`command-info`},En={class:`command-header`},Dn={class:`command-name`},On={key:0,class:`command-desc`},kn={class:`command-code`},An={class:`command-dir`},jn={key:8,class:`config-section`},Mn={class:`section-title`},Nn={style:{"margin-left":`var(--spacing-md)`}},Pn={key:9,class:`config-section`},Fn={class:`section-title`},In={class:`sub-section`},Ln={class:`sub-title`},Rn={class:`code-examples`},zn={class:`examples-title`},Bn={class:`examples-actions`},Vn={key:10,class:`config-section`},Hn={class:`section-title`},Un={class:`reference-tip`},Wn={class:`reference-tip`},Gn={class:`node-option`},Kn={class:`node-name`},qn={class:`node-id`},Jn={class:`reference-tip`},Yn={class:`reference-tip`},Xn={key:11,class:`config-section`},Zn={class:`section-title`},Qn={class:`output-param-row`},$n={class:`output-param-field`},er={class:`field-label`},tr={class:`output-param-field`},nr={class:`field-label`},rr={key:12,class:`config-section`},ir={class:`section-title`},ar={class:`output-param-row`},or={class:`output-param-field`},sr={class:`field-label`},cr={class:`output-param-field`},lr={class:`field-label`},ur={class:`dialog-footer`},dr={class:`footer-actions`},fr=`function main(param) {
|
|
1
|
+
import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{$n as t,$r as n,A as r,An as i,At as a,C as o,Dn as s,Dr as c,En as l,Et as u,F as d,Fn as f,Fr as p,G as m,Gn as h,Hn as g,Ht as ee,I as _,J as v,Jr as y,K as b,Kt as x,Ln as S,M as te,N as ne,On as C,Pn as w,Pt as re,Qn as T,S as ie,Sn as E,St as ae,U as oe,Vn as D,W as se,Xn as ce,Zn as O,_r as k,at as le,bt as A,c as j,ct as ue,dn as M,dt as N,er as P,i as F,kn as I,kt as L,l as R,lr as z,lt as de,m as B,mr as V,r as H,rn as fe,sr as U,tr as W,w as pe,x as me,xn as G,xr as K,y as he,z as ge,zn as q,zt as _e}from"./element-plus-J45pKUrE.js";import{b as ve}from"./vendor-B3NyhlYR.js";import{n as J,t as Y}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{t as ye}from"./dagre-DPkLmI0C.js";import{t as be}from"./SvgIcon-Du5MOe8A.js";import{t as X}from"./configStore-D0oycG71.js";import{t as xe}from"./CommonDialog-BUuLsgNS.js";import{i as Se,l as Ce,n as we,s as Te}from"./vue-flow-8aIpM5CU.js";import{U as Z,o as Ee}from"./index-DjaZpz97.js";import{a as De,c as Oe,i as Q,n as ke,o as Ae,r as je,s as Me,t as Ne}from"./UserInputNode-oOQwaadU.js";var Pe=e(ye(),1);D(),V();var Fe=S({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let n=e,r=t,i=K(!1);function a(e){e===`executeFrom`?r(`execute-from-node`,n.nodeId):e===`executeSingle`&&r(`execute-single-node`,n.nodeId)}return(e,t)=>{let n=v,r=o,s=pe,l=ie;return T(),C(l,{trigger:`contextmenu`,onCommand:a,onVisibleChange:t[0]||=e=>i.value=e,"popper-class":`flow-node-dropdown`},{dropdown:z(()=>[f(s,null,{default:z(()=>[f(r,{command:`executeFrom`},{default:z(()=>[f(n,null,{default:z(()=>[f(c(fe))]),_:1}),t[1]||=w(` 从此处开始执行 `,-1)]),_:1}),f(r,{command:`executeSingle`},{default:z(()=>[f(n,null,{default:z(()=>[f(c(fe))]),_:1}),t[2]||=w(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:z(()=>[W(e.$slots,`default`,{dropdownVisible:i.value})]),_:3})}}});D(),V(),p();var Ie={class:`package-json-selector`},Le={class:`selector-container`},Re={class:`option-content`},ze={class:`option-main`},Be={class:`package-name`},Ve={class:`option-path`},$={key:0,class:`empty-hint`},He=Y(S({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,o=t,u=K(!1),p=K([]),m=K(``),h=l({get:()=>r.modelValue,set:e=>{m.value=e,o(`update:modelValue`,e);let t=p.value.find(t=>t.fullPath===e);o(`change`,t||null)}}),g=l(()=>p.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function y(e){u.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){p.value=r.packages||[],h.value&&!p.value.some(e=>e.fullPath===h.value)&&(h.value=``);let t=e?`目录 ${e}`:`当前项目`;F.success(`扫描 ${t} 完成,找到 ${p.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),F.error(`扫描失败: ${e.message}`),p.value=[]}finally{u.value=!1}}async function b(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?x(e):e.error&&F.error(e.error)}catch(e){F.error(`浏览目录失败: ${e.message}`)}}function x(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){F.warning(`请输入目录路径`);return}S(e)};H.alert(q(`div`,{class:`directory-browser`},[q(`div`,{class:`current-path`},[q(`span`,{class:`path-label`},`当前路径:`),q(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),q(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),q(`div`,{class:`directory-list`},[e.parentPath?q(`div`,{class:`directory-item parent-dir`,onClick:()=>S(e.parentPath)},[q(`span`,{class:`dir-icon`},q(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[q(`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`})])),q(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>q(`div`,{class:`directory-item`,onClick:()=>S(e.path)},[q(`span`,{class:`dir-icon`},q(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[q(`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`})])),q(`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){F.warning(`请输入目录路径`);return}y(n)}}})}async function S(e){try{H.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?x(t):t.error&&F.error(t.error)}catch(e){F.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){F.error(`处理目录选择时出错: ${e.message}`)}}return y(),U(()=>r.modelValue,e=>{m.value=e},{immediate:!0}),(t,r)=>{let o=v,l=d,m=_,x=ge,S=R;return T(),i(`div`,Ie,[s(`div`,Le,[f(m,{modelValue:h.value,"onUpdate:modelValue":r[0]||=e=>h.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||u.value,filterable:``,class:`package-select`},{default:z(()=>[(T(!0),i(E,null,P(g.value,e=>(T(),C(l,{key:e.value,label:e.label,value:e.value},{default:z(()=>[s(`div`,Re,[s(`div`,ze,[f(o,{class:`folder-icon`},{default:z(()=>[f(c(ae))]),_:1}),s(`span`,Be,n(e.label),1)]),s(`div`,Ve,n(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),f(x,{icon:u.value?c(a):c(ee),loading:u.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>y(),class:`refresh-btn`,title:`刷新当前项目`},{default:z(()=>[w(n(u.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),f(x,{icon:c(A),disabled:e.disabled||u.value,size:`default`,onClick:b,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:z(()=>[...r[2]||=[w(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),p.value.length===0&&!u.value?(T(),i(`div`,$,[f(S,{type:`info`,size:`small`},{default:z(()=>[...r[3]||=[w(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):I(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);D(),p(),V();var Ue={class:`param-list`},We={key:0,class:`param-list__title`},Ge={key:0,class:`param-list__title-text`},Ke={class:`param-list__title-actions`},qe={key:1,class:`param-list__empty`},Je={key:2,class:`param-list__body`},Ye={class:`param-list__row-content`},Xe={key:0,class:`param-list__row-actions`},Ze=Y(S({__name:`ParamListContainer`,props:{modelValue:{},title:{},addable:{type:Boolean},removable:{type:Boolean},minItems:{},createItem:{type:Function},itemKey:{type:Function},disableAdd:{type:Boolean},disableRemove:{type:Function}},emits:[`update:modelValue`,`add`,`remove`],setup(e,{emit:t}){let r=e,a=t,o=l(()=>Array.isArray(r.modelValue)?r.modelValue:[]);function u(){if(!r.addable||r.disableAdd)return;let e=r.createItem;if(!e)return;let t=[...o.value,e()];a(`update:modelValue`,t),a(`add`)}function d(e){if(!r.removable)return;let t=typeof r.minItems==`number`?r.minItems:0;if(o.value.length<=t)return;let n=o.value[e];if(r.disableRemove&&r.disableRemove(n,e))return;let i=[...o.value];i.splice(e,1),a(`update:modelValue`,i),a(`remove`,e)}function p(e,t){return r.itemKey?r.itemKey(e,t):t}return(t,r)=>{let a=ge;return T(),i(`div`,Ue,[e.title!==void 0||e.addable?(T(),i(`div`,We,[e.title?(T(),i(`span`,Ge,n(e.title),1)):I(``,!0),s(`div`,Ke,[W(t.$slots,`title-actions`,{},void 0,!0),e.addable?(T(),C(a,{key:0,type:`primary`,plain:``,icon:c(_e),disabled:e.disableAdd||!e.createItem,onClick:u},null,8,[`icon`,`disabled`])):I(``,!0)])])):I(``,!0),o.value.length===0?(T(),i(`div`,qe,[W(t.$slots,`empty`,{},void 0,!0)])):(T(),i(`div`,Je,[(T(!0),i(E,null,P(o.value,(n,r)=>(T(),i(`div`,{key:p(n,r),class:y([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[s(`div`,Ye,[W(t.$slots,`row`,{item:n,index:r},void 0,!0)]),e.removable?(T(),i(`div`,Xe,[f(a,{type:`danger`,plain:``,icon:c(de),disabled:typeof e.minItems==`number`&&o.value.length<=e.minItems||(e.disableRemove?e.disableRemove(n,r):!1),onClick:e=>d(r)},null,8,[`icon`,`disabled`,`onClick`])])):I(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);D(),V(),p();var Qe={class:`node-input-config`},$e={class:`input-row`},et={class:`input-field param-name-field`},tt={class:`field-label`},nt={class:`input-field type-field`},rt={class:`field-label`},it={class:`input-field value-field`},at={class:`field-label`},ot={class:`tree-node-label`},st={class:`input-field required-field`},ct={class:`field-label`},lt=Y(S({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,a=t,o=K([]);U(()=>r.modelValue,e=>{o.value=e?[...e]:[]},{immediate:!0,deep:!0}),U(()=>r.paramNames,e=>{if(!e||e.length===0){o.value=[],a(`update:modelValue`,[]);return}let t=new Map(o.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:``});o.value=n,a(`update:modelValue`,n)},{immediate:!0});function u(e,t,n){if(!o.value[e])return;let r=[...o.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),o.value=r,a(`update:modelValue`,r)}function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function m(e){if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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 h=l(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:p(e),children:m(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(e,t){if(!t)return;let[n,r]=t.split(`::`),i=[...o.value];i[e]={...i[e],referenceNodeId:n,referenceOutputKey:r},o.value=i,a(`update:modelValue`,i)}function ee(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,r)=>{let a=oe,l=d,p=_,m=v,y=j,b=B;return T(),i(`div`,Qe,[f(Ze,{"model-value":o.value,title:void 0,addable:!1,removable:!1},{empty:z(()=>[w(n(c(J)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:z(({item:t,index:r})=>[s(`div`,$e,[s(`div`,et,[s(`label`,tt,n(c(J)(`@NODEINPUT:参数名`)),1),f(a,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:c(J)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>u(r,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),s(`div`,nt,[s(`label`,rt,n(c(J)(`@NODEINPUT:类型`)),1),f(p,{"model-value":t.inputType,placeholder:c(J)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>u(r,`inputType`,e)},{default:z(()=>[f(l,{value:`manual`,label:c(J)(`@NODEINPUT:手动输入`)},null,8,[`label`]),f(l,{value:`reference`,label:c(J)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),s(`div`,it,[s(`label`,at,n(c(J)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(T(),C(a,{key:0,"model-value":t.manualValue,placeholder:c(J)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>u(r,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(T(),C(y,{key:1,"model-value":ee(t),data:h.value,placeholder:c(J)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(r,e)},{default:z(({data:e})=>[s(`span`,ot,[e.children?I(``,!0):(T(),C(m,{key:0},{default:z(()=>[f(c(L))]),_:1})),w(` `+n(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,st,[s(`label`,ct,n(c(J)(`@NODEINPUT:必填`)),1),f(b,{"model-value":!!t.required,"onUpdate:modelValue":e=>u(r,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);D(),V(),p();var ut={class:`code-node-input-config`},dt={class:`input-row`},ft={class:`input-field name-field`},pt={class:`field-label`},mt={class:`input-field type-field`},ht={class:`field-label`},gt={class:`input-field value-field`},_t={class:`field-label`},vt={class:`input-field action-field`},yt={class:`field-label`},bt=Y(S({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let a=e,o=r,u=K([]);U(()=>a.modelValue,e=>{u.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function p(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.data.label||e.id}function m(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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 h=l(()=>!a.predecessorNodes||a.predecessorNodes.length===0?[]:a.predecessorNodes.map(e=>({value:e.id,label:p(e),children:m(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function ee(){let e=[...u.value,g()];u.value=e,o(`update:modelValue`,e)}t({addRow:ee});function v(e,t){if(!u.value[e])return;let n=[...u.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`}))),u.value=n,o(`update:modelValue`,n)}function y(e,t){if(!t)return;let[n,r]=t.split(`::`);v(e,{ref:{nodeId:n,outputKey:r}})}function b(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let a=oe,l=d,p=_,m=j,ee=B;return T(),i(`div`,ut,[f(Ze,{"model-value":u.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":g,"onUpdate:modelValue":r[0]||=e=>o(`update:modelValue`,e)},{empty:z(()=>[w(n(c(J)(`@NODECFG:暂无输入参数`)),1)]),row:z(({item:t,index:r})=>[s(`div`,dt,[s(`div`,ft,[s(`label`,pt,n(c(J)(`@NODECFG:参数名`)),1),f(a,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>v(r,{name:e})],placeholder:c(J)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),s(`div`,mt,[s(`label`,ht,n(c(J)(`@NODECFG:参数值`)),1),f(p,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>v(r,{source:e})],style:{width:`110px`}},{default:z(()=>[f(l,{label:c(J)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),f(l,{label:c(J)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),s(`div`,gt,[s(`label`,_t,n(c(J)(`@NODECFG:值`)),1),t.source===`manual`?(T(),C(a,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>v(r,{manualValue:e})],placeholder:c(J)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(T(),C(m,{key:1,"model-value":b(t),data:h.value,placeholder:c(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>y(r,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,vt,[s(`label`,yt,n(c(J)(`@NODEINPUT:必填`)),1),f(ee,{"model-value":!!t.required,"onUpdate:modelValue":e=>v(r,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b16df1ae`]]);D(),V(),p();var xt={class:`user-input-param-config`},St={class:`input-row`},Ct={class:`input-field name-field`},wt={class:`field-label`},Tt={class:`input-field type-field`},Et={class:`field-label`},Dt={class:`input-field value-field`},Ot={class:`field-label`},kt={class:`tree-node-label`},At={class:`input-field action-field`},jt={class:`field-label`},Mt=Y(S({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let a=e,o=r,u=K([]);U(()=>a.modelValue,e=>{u.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function p(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function m(){let e=[...u.value,p()];u.value=e,o(`update:modelValue`,e)}t({addRow:m});function h(e,t){if(!u.value[e])return;let n=[...u.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`}))),u.value=n,o(`update:modelValue`,n)}function g(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||J(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||J(`@FLOWNODE:用户输入`):e.data.label||e.id}function ee(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:J(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:J(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:J(`@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 y=l(()=>!a.predecessorNodes||a.predecessorNodes.length===0?[]:a.predecessorNodes.map(e=>({value:e.id,label:g(e),children:ee(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function b(e,t){if(!t)return;let[n,r]=t.split(`::`);h(e,{ref:{nodeId:n,outputKey:r}})}function x(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let l=oe,g=d,ee=_,S=v,te=j,ne=B,re=ge;return T(),i(`div`,xt,[f(Ze,{"model-value":u.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":p,"onUpdate:modelValue":r[0]||=e=>o(`update:modelValue`,e)},{empty:z(()=>[w(n(c(J)(`@UINPUT:暂无输入参数`)),1)]),row:z(({item:e,index:t})=>[s(`div`,St,[s(`div`,Ct,[s(`label`,wt,n(c(J)(`@UINPUT:参数名`)),1),f(l,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>h(t,{name:e})],placeholder:c(J)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),s(`div`,Tt,[s(`label`,Et,n(c(J)(`@UINPUT:类型`)),1),f(ee,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>h(t,{source:e})],style:{width:`130px`}},{default:z(()=>[f(g,{label:c(J)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),f(g,{label:c(J)(`@UINPUT:引用`),value:`reference`,disabled:!a.predecessorNodes||a.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),s(`div`,Dt,[s(`label`,Ot,n(e.source===`manual`?c(J)(`@UINPUT:默认值`):c(J)(`@UINPUT:引用输出`)),1),e.source===`manual`?(T(),C(l,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>h(t,{defaultValue:e})],placeholder:c(J)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(T(),C(te,{key:1,"model-value":x(e),data:y.value,placeholder:c(J)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>b(t,e)},{default:z(({data:e})=>[s(`span`,kt,[e.children?I(``,!0):(T(),C(S,{key:0},{default:z(()=>[f(c(L))]),_:1})),w(` `+n(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),s(`div`,At,[s(`label`,jt,n(c(J)(`@NODEINPUT:必填`)),1),f(ne,{"model-value":!!e.required,"onUpdate:modelValue":e=>h(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:z(()=>[e.addable===!1?I(``,!0):(T(),C(re,{key:0,type:`primary`,plain:``,size:`small`,onClick:m},{default:z(()=>[w(n(c(J)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);D(),V(),p();var Nt={key:0,class:`config-content`},Pt={class:`config-section`},Ft={class:`section-title`},It={key:0,class:`config-section`},Lt={class:`section-title`},Rt={key:1,class:`config-section`},zt={class:`section-title`},Bt={class:`sub-section`},Vt={class:`sub-title`},Ht={key:0,class:`empty-tip`},Ut={key:1,class:`condition-branch-list`},Wt={class:`branch-main`},Gt={class:`branch-header`},Kt={class:`branch-title`},qt={key:0,class:`branch-badge`},Jt={class:`branch-meta`},Yt={key:0,class:`branch-rules`},Xt={class:`rules-header`},Zt={class:`rule-col`},Qt={class:`field-label`},$t={class:`rule-col`},en={class:`field-label`},tn={class:`rule-col`},nn={class:`field-label`},rn={class:`rule-col`,style:{"align-self":`flex-end`}},an={key:1,class:`branch-default-tip`},on={key:0,class:`branch-actions`},sn={key:2,class:`config-section`},cn={class:`section-title`},ln={key:3,class:`config-section`},un={class:`section-title`},dn={key:4,class:`config-section`},fn={class:`section-title`},pn={key:5,class:`config-section`},mn={class:`section-title`},hn={key:6,class:`config-section`},gn={class:`section-title`},_n={class:`output-param-row`},vn={class:`output-param-field`},yn={class:`field-label`},bn={key:7,class:`config-section`},xn={class:`section-title`},Sn={key:0,class:`empty-tip`},Cn={key:1,class:`command-list`},wn=[`onClick`],Tn={class:`command-info`},En={class:`command-header`},Dn={class:`command-name`},On={key:0,class:`command-desc`},kn={class:`command-code`},An={class:`command-dir`},jn={key:8,class:`config-section`},Mn={class:`section-title`},Nn={style:{"margin-left":`var(--spacing-md)`}},Pn={key:9,class:`config-section`},Fn={class:`section-title`},In={class:`sub-section`},Ln={class:`sub-title`},Rn={class:`code-examples`},zn={class:`examples-title`},Bn={class:`examples-actions`},Vn={key:10,class:`config-section`},Hn={class:`section-title`},Un={class:`reference-tip`},Wn={class:`reference-tip`},Gn={class:`node-option`},Kn={class:`node-name`},qn={class:`node-id`},Jn={class:`reference-tip`},Yn={class:`reference-tip`},Xn={key:11,class:`config-section`},Zn={class:`section-title`},Qn={class:`output-param-row`},$n={class:`output-param-field`},er={class:`field-label`},tr={class:`output-param-field`},nr={class:`field-label`},rr={key:12,class:`config-section`},ir={class:`section-title`},ar={class:`output-param-row`},or={class:`output-param-field`},sr={class:`field-label`},cr={class:`output-param-field`},lr={class:`field-label`},ur={class:`dialog-footer`},dr={class:`footer-actions`},fr=`function main(param) {
|
|
2
2
|
const out = new Object()
|
|
3
3
|
out.key0 = param.input
|
|
4
4
|
return out
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$r as e,An as t,D as n,Dn as r,Dr as i,En as a,F as o,Fn as s,Fr as c,Gn as l,I as u,J as d,Jn as f,Jr as p,L as ee,Ln as m,On as h,Pn as g,Qn as _,Sn as v,U as te,Vn as y,W as ne,Wt as re,Xn as ie,Xr as ae,a as oe,bn as b,ct as se,dn as ce,er as x,f as le,i as S,kn as C,lr as w,mr as T,p as ue,pt as de,r as fe,sr as E,ur as pe,vt as me,wt as he,xn as D,xr as O,yn as ge,z as k}from"./element-plus-J45pKUrE.js";import{n as A,t as j}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{t as _e}from"./CommonDialog-BUuLsgNS.js";import{H as ve,U as ye,V as be,k as xe,z as Se}from"./index-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$r as e,An as t,D as n,Dn as r,Dr as i,En as a,F as o,Fn as s,Fr as c,Gn as l,I as u,J as d,Jn as f,Jr as p,L as ee,Ln as m,On as h,Pn as g,Qn as _,Sn as v,U as te,Vn as y,W as ne,Wt as re,Xn as ie,Xr as ae,a as oe,bn as b,ct as se,dn as ce,er as x,f as le,i as S,kn as C,lr as w,mr as T,p as ue,pt as de,r as fe,sr as E,ur as pe,vt as me,wt as he,xn as D,xr as O,yn as ge,z as k}from"./element-plus-J45pKUrE.js";import{n as A,t as j}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{t as _e}from"./CommonDialog-BUuLsgNS.js";import{H as ve,U as ye,V as be,k as xe,z as Se}from"./index-DjaZpz97.js";var M=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function N(e){return 10+e*14}function P(e){return M[e%M.length]}function F(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 Ce(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 F(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 we(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=[],ee=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:P(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,ee.add(e))}let m=[],h=P(d);if(e.length>0){let n=e[0],i=o(n);i===-1?a.has(n)&&(t[u]={hash:n,colorIdx:d},m.push({toLane:u,color:h,kind:`straight`,branches:[],_hash:n})):(m.push({toLane:i,color:h,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)m.push({toLane:e,color:h,kind:e===u?`straight`:`curve`,branches:[],_hash:n});else if(a.has(n)){let e=s(),i=r++;t[e]={hash:n,colorIdx:i},m.push({toLane:e,color:P(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let g=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||ee.has(e)||e<g.length&&g[e]!==null&&g[e].hash===t.hash&&_.push({lane:e,color:P(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:h,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:_,topCurves:p,bottomEdges:m,branches:[]})}let c=Ce(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}}y(),T(),c();var Te={class:`graph-wrap`},Ee=[`viewBox`],De=[`x1`,`x2`,`stroke`],Oe=[`x1`,`x2`],I=[`d`,`stroke`],ke=[`d`],Ae=[`x1`,`x2`,`stroke`],L=[`d`,`stroke`],R=[`d`],z={class:`graph-layer graph-nodes`,"aria-hidden":`true`},B=[`cx`,`stroke`],V=[`cx`,`fill`],H=[`cx`,`stroke`],U=[`cx`],W=-1,je=j(m({__name:`CommitGraphCell`,props:{layout:{},width:{}},setup(n){let o=n,s=a(()=>N(o.layout.commitLane)),c=A(`@A1833:暂不属于任何分支`);function l(e){return e.length>0?e.join(`, `):c}let u=a(()=>`${o.layout.hash.slice(0,7)} · ${l(o.layout.branches)}`),d=a(()=>o.layout.passes.map(e=>({x:N(e.lane),color:e.color,title:l(e.branches)}))),f=a(()=>o.layout.topCurves.map(e=>{let t=N(e.fromLane),n=s.value;return{d:`M ${t} ${W} C ${t} ${15/2}, ${n} ${15/2}, ${n} 15`,color:e.color,title:l(e.branches)}})),p=a(()=>o.layout.bottomEdges.map(e=>{let t=s.value,n=N(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:l(e.branches)}}));return(a,o)=>(_(),t(`div`,Te,[(_(),t(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${n.width} ${i(30)}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[(_(!0),t(v,null,x(d.value,(n,i)=>(_(),t(`line`,{key:`p`+i,x1:n.x,y1:W,x2:n.x,y2:31,stroke:n.color,"stroke-width":`2`},[r(`title`,null,e(n.title),1)],8,De))),128)),(_(!0),t(v,null,x(d.value,(n,i)=>(_(),t(`line`,{key:`ph`+i,x1:n.x,y1:W,x2:n.x,y2:31,stroke:`transparent`,"stroke-width":`8`},[r(`title`,null,e(n.title),1)],8,Oe))),128)),(_(!0),t(v,null,x(f.value,(n,i)=>(_(),t(`path`,{key:`t`+i,d:n.d,stroke:n.color,"stroke-width":`2`,fill:`none`},[r(`title`,null,e(n.title),1)],8,I))),128)),(_(!0),t(v,null,x(f.value,(n,i)=>(_(),t(`path`,{key:`th`+i,d:n.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[r(`title`,null,e(n.title),1)],8,ke))),128)),n.layout.hasTopLine?(_(),t(`line`,{key:0,x1:s.value,y1:W,x2:s.value,y2:15,stroke:n.layout.color,"stroke-width":`2`},[r(`title`,null,e(l(n.layout.branches)),1)],8,Ae)):C(``,!0),(_(!0),t(v,null,x(p.value,(n,i)=>(_(),t(`path`,{key:`b`+i,d:n.d,stroke:n.color,"stroke-width":`2`,fill:`none`},[r(`title`,null,e(n.title),1)],8,L))),128)),(_(!0),t(v,null,x(p.value,(n,i)=>(_(),t(`path`,{key:`bh`+i,d:n.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[r(`title`,null,e(n.title),1)],8,R))),128))],8,Ee)),(_(),t(`svg`,z,[r(`g`,null,[r(`title`,null,e(u.value),1),n.layout.isMerge?(_(),t(`circle`,{key:0,cx:s.value,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:n.layout.color,"stroke-width":`2`},null,8,B)):(_(),t(`circle`,{key:1,cx:s.value,cy:`50%`,r:`4`,fill:n.layout.color},null,8,V)),n.layout.isHead?(_(),t(`circle`,{key:2,cx:s.value,cy:`50%`,r:`7`,fill:`none`,stroke:n.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,H)):C(``,!0),r(`circle`,{cx:s.value,cy:`50%`,r:`9`,fill:`transparent`},null,8,U)])]))]))}}),[[`__scopeId`,`data-v-1288d6a2`]]);y(),T(),c(),ce();var Me={class:`log-header`},Ne={class:`header-left`},Pe={class:`log-actions`},Fe={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},Ie={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},Le={key:0,class:`filter-panel-header`},Re={class:`filter-form`},ze={class:`filter-item`},Be={class:`compact-label`},Ve={class:`filter-item`},He={class:`compact-label`},Ue={class:`filter-item`},We={class:`compact-label`},Ge={class:`filter-item`},Ke={class:`compact-label`},qe={class:`filter-actions`},Je={key:0,role:`alert`,class:`log-error`},Ye={key:1,class:`log-empty-state`},Xe={class:`log-empty-text`},Ze={key:2,class:`content-area-content`},Qe={class:`table-view-container`},$e={class:`commit-message-cell`},et={class:`message-content`},tt={key:0,class:`branch-container`},nt={class:`message-text`},rt={class:`author-name`},it=[`title`,`aria-label`,`onClick`],at={class:`commit-detail-container`},ot={key:0,class:`commit-info`},st={class:`commit-info-row`},ct={class:`info-item date-item`},lt={class:`info-label`},ut={class:`info-value`},dt={class:`info-item branch-item`},ft={class:`info-label`},pt={key:0,class:`branch-container`},mt={key:1,class:`info-value info-value-muted`},ht={class:`info-item message-item`},gt={class:`info-label`},_t={class:`info-message-wrapper`},vt={class:`info-message-title`},yt=[`innerHTML`],bt=[`aria-label`,`onKeydown`],xt=`zen-gitsync:log-show-graph`,St=j(m({__name:`LogList`,setup(c,{expose:m}){let y=ve(),ce=be(),T=O([]),j=O(``),M=O(!1),N=a(()=>y.isLoadingLog||M.value),P=O(!1),F=O(localStorage.getItem(xt)!==`false`);E(F,e=>{localStorage.setItem(xt,String(e))});let Te=a(()=>F.value&&T.value.length>0?we(T.value):null),Ee=a(()=>{let e=new Map;if(Te.value)for(let t of Te.value.rows)e.set(t.hash,t);return e}),De=a(()=>Math.max(Te.value?.width??0,28)),Oe=a(()=>Ce(T.value)),I=O(!1),ke=O(null),Ae=O(!1),L=O(null),R=O([]),z=O(``),B=O(!1),V=O(``),H=O(`full-new`),U=O(``),W=O(``),St=a(()=>L.value?Oe.value.get(L.value.hash)??[]:[]),G=O(!1),Ct=a(()=>L.value?.message?L.value.message.split(`
|
|
2
2
|
`)[0].trim():``),wt=a(()=>L.value?.message?L.value.message.split(`
|
|
3
3
|
`).slice(1).join(`
|
|
4
4
|
`).trim():``),Tt=a(()=>wt.value.length>0),Et=a(()=>wt.value.replace(/\n/g,`<br>`)),K=O(!1),Dt=O([]),Ot=O(``),q=O(null),kt=O([]),At=O([]),jt=O([]),Mt=O(!1),Nt=O(0),Pt=O(0),J=O(null),Ft=O(null),It=a(()=>T.value),Lt=a(()=>R.value.map(e=>({path:e,name:e.split(`/`).pop()||e})));async function Y(e=!1,t=1){let n=ve();if(!n.isGitRepo){j.value=`当前目录不是Git仓库`;return}try{t>1?I.value=!0:M.value=!0;let r=new URLSearchParams;r.append(`page`,t.toString()),r.append(`all`,e.toString()),r.append(`with_parents`,`true`),Dt.value.length>0&&r.append(`author`,Dt.value.join(`,`)),At.value.length>0&&r.append(`branch`,At.value.join(`,`)),Ot.value&&r.append(`message`,Ot.value),q.value&&Array.isArray(q.value)&&q.value.length===2&&(r.append(`dateFrom`,q.value[0]),r.append(`dateTo`,q.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)){j.value=`加载提交历史失败: 服务器返回数据格式不正确`;return}let a=t>1;a&&Array.isArray(i.data)?T.value=T.value.concat(i.data):Array.isArray(i.data)&&(T.value=i.data),n.currentPage=t,n.totalCommits=i.total??T.value.length,n.hasMoreData=i.hasMore===!0,!a&&!e&&l(()=>{Ut(),setTimeout(Sn,200)}),j.value=``}catch(e){j.value=`加载提交历史失败: `+(e instanceof Error?e.message:String(e)),t>1&&(n.hasMoreData=!1)}finally{t>1?I.value=!1:M.value=!1}}function Rt(e){return e.includes(`HEAD -> `)?e.replace(`HEAD -> `,``):e.includes(`origin/`)?e:e.trim()}function zt(e){return e.includes(`HEAD`)?`success`:e.includes(`origin/`)?`warning`:`info`}function Bt(e){return e?e.length>60||e.includes(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$r as e,An as t,Ct as n,Dn as r,Dr as i,En as a,Fn as o,Fr as s,Ht as c,J as l,Jn as u,Jr as d,L as f,Ln as p,On as m,Pn as h,Qn as g,Sn as _,Vn as v,W as y,Xn as b,Xr as x,Y as S,a as C,dn as w,er as T,ht as E,i as D,kn as O,lr as k,lt as A,mr as j,pt as ee,r as M,sr as te,ur as N,wn as ne,xn as P,xr as F,xt as re,yn as ie,z as ae,zt as oe}from"./element-plus-J45pKUrE.js";import{C as se,S as I,m as ce}from"./vendor-B3NyhlYR.js";import{n as L,t as R}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{r as le,t as z}from"./configStore-DojhW1P7.js";import{n as ue,t as de}from"./flow-mindmap-DvB74LE1.js";import{C as fe,a as B}from"./index-Z7rlN9LU.js";j(),v();function V(e){let t=(e||``).trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);return n?/^[a-z]:$/i.test(n)?`${n}\\`:n:t}function H(e){return V(e).replace(/\//g,`\\`).replace(/\\+$/,``).toLowerCase()}function U(e,t){let n=H(e),r=H(t);return!n||!r?!1:n===r||n.startsWith(r.endsWith(`\\`)?r:`${r}\\`)}function W(e){let t=Math.max(e.lastIndexOf(`\\`),e.lastIndexOf(`/`));return t>0?e.slice(0,t):e}var pe=I(`mindmap`,()=>{let e=z(),t=F([]),n=F([]),r=F(null),i=F(!1),o=F(!1),s=F(null),c=F(``),l=F(``),u=a(()=>r.value!==null),d=a(()=>n.value.reduce((e,t)=>e+t.files.length,0)),f=a(()=>n.value.some(e=>e.loading));function p(){e.ui.mindmapDirs=[...t.value]}function m(e){return n.value.find(t=>H(t.dir)===H(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=V(e);return!n||t.value.some(e=>H(e)===H(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=H(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=>H(e)===H(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=>H(e)===H(c.value))&&(c.value=``),await y()}async function x(e){let t=[];for(let n of e||[]){let e=V(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=H(e);t.value=t.value.filter(e=>H(e)!==r),n.value=n.value.filter(e=>H(e.dir)!==r),_.delete(r),c.value&&H(c.value)===r&&(c.value=``),p()}function C(){if(t.value.length===0)return{dir:null,ambiguous:!1};let e=t.value.find(e=>H(e)===H(c.value));if(e)return{dir:e,ambiguous:!1};let n=r.value?.path;if(n){let e=t.value.find(e=>U(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&&i.value&&r.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){r.value={path:n.path,title:n.title,content:n.content,mtime:n.mtime},l.value=n.content,i.value=!1;let e=t.value.find(e=>U(n.path,e));c.value=e||W(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 a=n?V(n):C().dir;if(!a)throw Error(`未选择目录`);if(!t&&i.value&&r.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:a,name:e})})).json();if(t.success)r.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,i.value=!1,c.value=a,await v(a);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(!r.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:r.value.path,content:e})})).json();if(t.success){let n=r.value.path;return r.value&&(r.value.content=e,r.value.mtime=t.mtime),l.value=e,i.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=>U(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 r.value&&r.value.path===e&&(r.value=null,i.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 r.value&&e===r.value.path&&(r.value={...r.value,path:n.path,title:t}),await D(n.path||e),n}function A(){r.value&&(i.value=!0)}function j(){r.value=null,i.value=!1,l.value=``}return{dirs:t,groups:n,current:r,dirty:i,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:A,closeCurrent:j}});v(),j(),s(),w();var me={class:`mindmap-view`},he={class:`mm-toolbar`},ge={class:`mm-toolbar-left`},_e={class:`mm-dir-tooltip`},ve={key:1,class:`mm-dir-empty`},ye={class:`mm-toolbar-right`},be={key:0,class:`mm-status`},xe=[`title`],Se={key:0,class:`mm-status-dirty`},Ce={class:`mm-body`},we={class:`mm-sidebar`},Te={class:`mm-sidebar-header`},Ee={class:`mm-sidebar-title`},De={class:`mm-sidebar-list`},Oe={key:0,class:`mm-sidebar-error`},ke=[`title`,`onClick`,`onContextmenu`],Ae={class:`mm-group-info`},je={class:`mm-group-name`},Me={class:`mm-group-title`},Ne={class:`mm-group-count`},Pe={class:`mm-group-path`},Fe={class:`mm-group-body`},Ie=[`title`],Le=[`onClick`],Re={class:`mm-file-info`},ze=[`title`],Be={class:`mm-file-meta`},Ve={class:`mm-editor`},He=1500,G=R(p({__name:`MindmapView`,setup(s){let p=pe(),v=z(),{currentLocale:w}=se(le()),j=a(()=>{let e=v.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),I=F(null),R=F(!1);function V(){R.value=!0}async function H(e){R.value=!1;let t=(e||[]).filter(Boolean);if(t.length!==0)try{let e=await p.addDirs(t);e>0?D.success(L(`@MINDMAP:已添加目录`,{n:e})):D.info(L(`@MINDMAP:重复目录已忽略`))}catch(e){D.error(e?.message||L(`@MINDMAP:读取目录失败`))}}let W=F({});function G(e){W.value={...W.value,[e]:!W.value[e]},p.activeDir=e}function Ue(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}function We(e){return!!p.activeDir&&p.activeDir.toLowerCase()===e.toLowerCase()}function K(){let{dir:e,ambiguous:t}=p.resolveTargetDir();return e||(D.warning(L(t?`@MINDMAP:请选择目标目录`:`@MINDMAP:请先添加目录`)),null)}async function q(e){let t=e||K();if(!t||(e&&(p.activeDir=e),!await Ke()))return;let n=``;try{n=(await M.prompt(L(`@MINDMAP:输入文件名提示`),L(`@MINDMAP:新建思维导图`),{confirmButtonText:L(`@MINDMAP:新建`),cancelButtonText:L(`@MINDMAP:取消`),inputPlaceholder:L(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?L(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||L(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await p.createFile(n,!0,t),D.success(L(`@MINDMAP:已新建并打开`))}catch(e){D.error(e?.message||L(`@MINDMAP:新建失败`))}}async function J(e=!1){if(p.current)try{let t=I.value?.exportData();if(!t){e||D.warning(L(`@MINDMAP:无法获取数据`));return}await p.saveCurrent(t),e||D.success(L(`@MINDMAP:已保存`))}catch(e){D.error(e?.message||L(`@MINDMAP:保存失败`))}}let Y=null;function Ge(){p.current&&p.dirty&&(Y&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,p.current&&p.dirty&&J(!0)},He))}function X(){Y&&=(clearTimeout(Y),null)}async function Ke(){if(!p.dirty||!p.current)return!0;try{await M.confirm(L(`@MINDMAP:未保存提示`,{title:p.current.title}),L(`@MINDMAP:未保存的改动`),{confirmButtonText:L(`@MINDMAP:保存`),cancelButtonText:L(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),X();let e=I.value?.exportData();return e&&(await p.saveCurrent(e),D.success(L(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(X(),!0)}}async function qe(e){if(!(p.current&&p.current.path===e)&&await Ke())try{await p.openFile(e,!0)}catch(e){D.error(e?.message||L(`@MINDMAP:打开失败`))}}async function Je(e){let t=!!p.current&&U(p.current.path,e),n=L(`@MINDMAP:确认移除目录提示`,{dir:e});t&&(n=`${n} ${L(`@MINDMAP:当前文件将保持打开`)}`);try{await M.confirm(n,L(`@MINDMAP:移除目录`),{confirmButtonText:L(`@MINDMAP:移除目录`),cancelButtonText:L(`@MINDMAP:取消`),type:`warning`})}catch{return}p.removeDir(e),D.success(L(`@MINDMAP:已移除目录`))}let Z=F(null);function Ye(e,t){e.preventDefault(),Z.value={x:e.clientX,y:e.clientY,dir:t}}function Q(){Z.value=null}async function Xe(){let e=Z.value?.dir;if(Q(),!e)return;let t=await fe(e);t.success?D.success(t.message||L(`@MINDMAP:已在文件管理器中打开`)):D.error(t.error||L(`@MINDMAP:打开目录失败`))}function Ze(){let e=Z.value?.dir;Q(),e&&q(e)}function Qe(){let e=Z.value?.dir;Q(),e&&Je(e)}async function $e(e){try{await M.confirm(L(`@MINDMAP:确认删除提示`,{title:e.title}),L(`@MINDMAP:删除`),{confirmButtonText:L(`@MINDMAP:删除`),cancelButtonText:L(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await p.deleteFile(e.path),D.success(L(`@MINDMAP:已删除`))}catch(e){D.error(e?.message||L(`@MINDMAP:删除失败`))}}async function et(e){let t=``;try{t=(await M.prompt(L(`@MINDMAP:输入新名称提示`),L(`@MINDMAP:重命名`),{confirmButtonText:L(`@MINDMAP:确定`),cancelButtonText:L(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?L(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||L(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await p.renameFile(e.path,t),D.success(L(`@MINDMAP:已重命名`))}catch(e){D.error(e?.message||L(`@MINDMAP:重命名失败`))}}function tt(e){p.markDirty(),Ge()}function nt(e){}async function rt(e){let t=e||K();if(!t)return;let n=``,r=``;try{n=(await M.prompt(L(`@MINDMAP:粘贴Markdown提示`),L(`@MINDMAP:从Markdown导入`),{confirmButtonText:L(`@MINDMAP:导入`),cancelButtonText:L(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:L(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?L(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{r=(await M.prompt(L(`@MINDMAP:输入文件名提示`),L(`@MINDMAP:文件名`),{confirmButtonText:L(`@MINDMAP:新建`),cancelButtonText:L(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?L(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||L(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await p.createFile(r,!0,t);let e=de(n,r),i=JSON.stringify(e,null,2);await p.saveCurrent(i),D.success(L(`@MINDMAP:已导入`))}catch(e){D.error(e?.message||L(`@MINDMAP:导入失败`))}}async function it(){if(I.value)try{let e=I.value.getMarkdown();await navigator.clipboard.writeText(e),D.success(L(`@MINDMAP:已复制Markdown`))}catch(e){D.error(e?.message||L(`@MINDMAP:复制失败`))}}function at(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),p.current&&p.dirty&&(X(),J()))}let ot=F(0);te(()=>p.current?.path,()=>{ot.value++});let $=F(!1);function st(){$.value=!$.value}let ct=a(()=>{let e=p.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});b(async()=>{window.addEventListener(`keydown`,at),document.addEventListener(`click`,Q),await p.init()}),u(()=>{window.removeEventListener(`keydown`,at),document.removeEventListener(`click`,Q),X()});function lt(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?L(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${L(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${L(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function ut(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}return(a,s)=>{let u=ae,v=f,b=y,D=l,M=C;return g(),t(`div`,me,[r(`div`,he,[r(`div`,ge,[o(u,{size:`small`,icon:i(n),onClick:V},{default:k(()=>[h(e(i(L)(`@MINDMAP:添加目录`)),1)]),_:1},8,[`icon`]),i(p).dirs.length>0?(g(),m(b,{key:0,placement:`bottom-start`,"show-after":200},{content:k(()=>[r(`div`,_e,[(g(!0),t(_,null,T(i(p).dirs,n=>(g(),t(`div`,{key:n},e(n),1))),128))])]),default:k(()=>[o(v,{size:`small`,type:`info`,class:`mm-dir-tag`},{default:k(()=>[h(e(i(L)(`@MINDMAP:个目录`,{n:i(p).dirs.length})),1)]),_:1})]),_:1})):(g(),t(`span`,ve,e(i(L)(`@MINDMAP:请先添加目录`)),1))]),r(`div`,ye,[o(u,{size:`small`,icon:i(oe),disabled:i(p).dirs.length===0,onClick:s[0]||=e=>q()},{default:k(()=>[h(e(i(L)(`@MINDMAP:新建`)),1)]),_:1},8,[`icon`,`disabled`]),o(u,{size:`small`,icon:i(ee),disabled:i(p).dirs.length===0,onClick:s[1]||=e=>rt()},{default:k(()=>[h(e(i(L)(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`icon`,`disabled`]),o(u,{size:`small`,icon:i(E),disabled:!i(p).current,onClick:it},{default:k(()=>[h(e(i(L)(`@MINDMAP:复制MD`)),1)]),_:1},8,[`icon`,`disabled`]),o(u,{size:`small`,type:`primary`,icon:i(re),disabled:!i(p).current||!i(p).dirty,loading:i(p).loading,onClick:s[2]||=()=>{X(),J()}},{default:k(()=>[h(e(i(L)(`@MINDMAP:保存`)),1)]),_:1},8,[`icon`,`disabled`,`loading`]),i(p).current?(g(),t(`span`,be,[r(`span`,{class:`mm-status-title`,title:i(p).current.title},e(i(p).current.title),9,xe),i(p).dirty?(g(),t(`span`,Se,`●`)):O(``,!0)])):O(``,!0)])]),r(`div`,Ce,[r(`div`,we,[r(`div`,Te,[r(`span`,Ee,e(i(L)(`@MINDMAP:文件列表`)),1),o(u,{size:`small`,text:``,icon:i(c),loading:i(p).refreshing,onClick:s[3]||=e=>i(p).refresh(),disabled:i(p).dirs.length===0},null,8,[`icon`,`loading`,`disabled`])]),N((g(),t(`div`,De,[i(p).error?(g(),t(`div`,Oe,e(i(p).error),1)):O(``,!0),i(p).dirs.length===0?(g(),m(B,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:i(L)(`@MINDMAP:请先添加目录`)},null,8,[`title`])):(g(!0),t(_,{key:2},T(i(p).groups,n=>(g(),t(`div`,{key:n.dir,class:`mm-group`},[r(`div`,{class:d([`mm-group-header`,{active:We(n.dir)}]),title:n.dir,onClick:e=>G(n.dir),onContextmenu:e=>Ye(e,n.dir)},[o(D,{class:d([`mm-group-caret`,{collapsed:W.value[n.dir]}])},{default:k(()=>[o(i(S))]),_:1},8,[`class`]),r(`div`,Ae,[r(`div`,je,[r(`span`,Me,e(Ue(n.dir)),1),r(`span`,Ne,e(n.files.length),1)]),r(`div`,Pe,e(n.dir),1)])],42,ke),N(r(`div`,Fe,[n.error?(g(),t(`div`,{key:0,class:`mm-group-error`,title:n.error},[r(`span`,null,e(i(L)(`@MINDMAP:目录不存在或已删除`)),1),o(u,{size:`small`,text:``,type:`danger`,onClick:e=>Je(n.dir)},{default:k(()=>[h(e(i(L)(`@MINDMAP:移除目录`)),1)]),_:1},8,[`onClick`])],8,Ie)):n.files.length===0?(g(),m(B,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:i(L)(`@MINDMAP:该目录暂无思维导图`)},null,8,[`title`])):(g(!0),t(_,{key:2},T(n.files,n=>(g(),t(`div`,{key:n.path,class:d([`mm-file-item`,{active:i(p).current?.path===n.path}]),onClick:e=>qe(n.path)},[r(`div`,Re,[r(`div`,{class:`mm-file-title`,title:n.title},e(n.title),9,ze),r(`div`,Be,e(lt(n.mtime))+` · `+e(ut(n.size)),1)]),r(`div`,{class:`mm-file-actions`,onClick:s[4]||=P(()=>{},[`stop`])},[o(u,{size:`small`,text:``,icon:i(E),onClick:e=>et(n),title:i(L)(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),o(u,{size:`small`,text:``,type:`danger`,icon:i(A),onClick:e=>$e(n),title:i(L)(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,Le))),128))],512),[[ie,!W.value[n.dir]]])]))),128))])),[[M,i(p).refreshing]])]),r(`div`,Ve,[i(p).current?(g(),m(i(ue),{key:ot.value,ref_key:`mmRef`,ref:I,data:ct.value,"preview-mode":$.value,onChange:tt,onSelect:nt,onCanvasTogglePreview:st},null,8,[`data`,`preview-mode`])):(g(),m(B,{key:0,class:`mm-editor-empty`,title:i(L)(`@MINDMAP:思维导图编辑器`),hint:i(p).dirs.length>0?i(L)(`@MINDMAP:从左侧选择或新建`):i(L)(`@MINDMAP:先选择目录提示`)},{icon:k(()=>[...s[7]||=[r(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[r(`circle`,{cx:`12`,cy:`12`,r:`2`}),r(`circle`,{cx:`5`,cy:`5`,r:`2`}),r(`circle`,{cx:`19`,cy:`5`,r:`2`}),r(`circle`,{cx:`5`,cy:`19`,r:`2`}),r(`circle`,{cx:`19`,cy:`19`,r:`2`}),r(`line`,{x1:`10.5`,y1:`10.5`,x2:`6.5`,y2:`6.5`}),r(`line`,{x1:`13.5`,y1:`10.5`,x2:`17.5`,y2:`6.5`}),r(`line`,{x1:`10.5`,y1:`13.5`,x2:`6.5`,y2:`17.5`}),r(`line`,{x1:`13.5`,y1:`13.5`,x2:`17.5`,y2:`17.5`})],-1)]]),_:1},8,[`title`,`hint`]))])]),o(i(ce),{visible:R.value,mode:`directory`,multiple:!0,theme:j.value?`dark`:`light`,locale:i(w),"default-path":i(p).activeDir||i(p).dirs[0]||``,onClose:s[5]||=e=>R.value=!1,onConfirm:H},null,8,[`visible`,`theme`,`locale`,`default-path`]),(g(),m(ne,{to:`body`},[Z.value?(g(),t(`div`,{key:0,class:`ctx-menu`,style:x({left:Z.value.x+`px`,top:Z.value.y+`px`}),onClick:s[6]||=P(()=>{},[`stop`])},[r(`button`,{class:`ctx-menu-item`,onClick:Xe},[s[8]||=r(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[r(`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`}),r(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),h(` `+e(i(L)(`@MINDMAP:打开目录`)),1)]),r(`button`,{class:`ctx-menu-item`,onClick:Ze},[s[9]||=r(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[r(`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`}),r(`polyline`,{points:`14 2 14 8 20 8`}),r(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),r(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),h(` `+e(i(L)(`@MINDMAP:在此新建`)),1)]),s[11]||=r(`div`,{class:`ctx-menu-sep`},null,-1),r(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Qe},[s[10]||=r(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[r(`polyline`,{points:`3 6 5 6 21 6`}),r(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),r(`path`,{d:`M10 11v6`}),r(`path`,{d:`M14 11v6`}),r(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),h(` `+e(i(L)(`@MINDMAP:移除目录`)),1)])],4)):O(``,!0)]))])}}}),[[`__scopeId`,`data-v-6567b053`]]);export{G as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$r as e,An as t,Ct as n,Dn as r,Dr as i,En as a,Fn as o,Fr as s,Ht as c,J as l,Jn as u,Jr as d,L as f,Ln as p,On as m,Pn as h,Qn as g,Sn as _,Vn as v,W as y,Xn as b,Xr as x,Y as S,a as C,dn as w,er as T,ht as E,i as D,kn as O,lr as k,lt as A,mr as j,pt as ee,r as M,sr as te,ur as N,wn as ne,xn as P,xr as F,xt as re,yn as ie,z as ae,zt as oe}from"./element-plus-J45pKUrE.js";import{C as se,S as I,m as ce}from"./vendor-B3NyhlYR.js";import{n as L,t as R}from"./_plugin-vue_export-helper-CDrhhAKC.js";import{o as le,t as z}from"./configStore-D0oycG71.js";import{n as ue,t as de}from"./flow-mindmap-DvB74LE1.js";import{C as fe,a as B}from"./index-DjaZpz97.js";j(),v();function V(e){let t=(e||``).trim();if(!t)return``;let n=t.replace(/[\\/]+$/,``);return n?/^[a-z]:$/i.test(n)?`${n}\\`:n:t}function H(e){return V(e).replace(/\//g,`\\`).replace(/\\+$/,``).toLowerCase()}function U(e,t){let n=H(e),r=H(t);return!n||!r?!1:n===r||n.startsWith(r.endsWith(`\\`)?r:`${r}\\`)}function W(e){let t=Math.max(e.lastIndexOf(`\\`),e.lastIndexOf(`/`));return t>0?e.slice(0,t):e}var pe=I(`mindmap`,()=>{let e=z(),t=F([]),n=F([]),r=F(null),i=F(!1),o=F(!1),s=F(null),c=F(``),l=F(``),u=a(()=>r.value!==null),d=a(()=>n.value.reduce((e,t)=>e+t.files.length,0)),f=a(()=>n.value.some(e=>e.loading));function p(){e.ui.mindmapDirs=[...t.value]}function m(e){return n.value.find(t=>H(t.dir)===H(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=V(e);return!n||t.value.some(e=>H(e)===H(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=H(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=>H(e)===H(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=>H(e)===H(c.value))&&(c.value=``),await y()}async function x(e){let t=[];for(let n of e||[]){let e=V(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=H(e);t.value=t.value.filter(e=>H(e)!==r),n.value=n.value.filter(e=>H(e.dir)!==r),_.delete(r),c.value&&H(c.value)===r&&(c.value=``),p()}function C(){if(t.value.length===0)return{dir:null,ambiguous:!1};let e=t.value.find(e=>H(e)===H(c.value));if(e)return{dir:e,ambiguous:!1};let n=r.value?.path;if(n){let e=t.value.find(e=>U(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&&i.value&&r.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){r.value={path:n.path,title:n.title,content:n.content,mtime:n.mtime},l.value=n.content,i.value=!1;let e=t.value.find(e=>U(n.path,e));c.value=e||W(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 a=n?V(n):C().dir;if(!a)throw Error(`未选择目录`);if(!t&&i.value&&r.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:a,name:e})})).json();if(t.success)r.value={path:t.path,title:t.title,content:t.content,mtime:t.mtime},l.value=t.content,i.value=!1,c.value=a,await v(a);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(!r.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:r.value.path,content:e})})).json();if(t.success){let n=r.value.path;return r.value&&(r.value.content=e,r.value.mtime=t.mtime),l.value=e,i.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=>U(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 r.value&&r.value.path===e&&(r.value=null,i.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 r.value&&e===r.value.path&&(r.value={...r.value,path:n.path,title:t}),await D(n.path||e),n}function A(){r.value&&(i.value=!0)}function j(){r.value=null,i.value=!1,l.value=``}return{dirs:t,groups:n,current:r,dirty:i,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:A,closeCurrent:j}});v(),j(),s(),w();var me={class:`mindmap-view`},he={class:`mm-toolbar`},ge={class:`mm-toolbar-left`},_e={class:`mm-dir-tooltip`},ve={key:1,class:`mm-dir-empty`},ye={class:`mm-toolbar-right`},be={key:0,class:`mm-status`},xe=[`title`],Se={key:0,class:`mm-status-dirty`},Ce={class:`mm-body`},we={class:`mm-sidebar`},Te={class:`mm-sidebar-header`},Ee={class:`mm-sidebar-title`},De={class:`mm-sidebar-list`},Oe={key:0,class:`mm-sidebar-error`},ke=[`title`,`onClick`,`onContextmenu`],Ae={class:`mm-group-info`},je={class:`mm-group-name`},Me={class:`mm-group-title`},Ne={class:`mm-group-count`},Pe={class:`mm-group-path`},Fe={class:`mm-group-body`},Ie=[`title`],Le=[`onClick`],Re={class:`mm-file-info`},ze=[`title`],Be={class:`mm-file-meta`},Ve={class:`mm-editor`},He=1500,G=R(p({__name:`MindmapView`,setup(s){let p=pe(),v=z(),{currentLocale:w}=se(le()),j=a(()=>{let e=v.theme;return e===`dark`?!0:e===`light`?!1:window.matchMedia?.(`(prefers-color-scheme: dark)`).matches??!1}),I=F(null),R=F(!1);function V(){R.value=!0}async function H(e){R.value=!1;let t=(e||[]).filter(Boolean);if(t.length!==0)try{let e=await p.addDirs(t);e>0?D.success(L(`@MINDMAP:已添加目录`,{n:e})):D.info(L(`@MINDMAP:重复目录已忽略`))}catch(e){D.error(e?.message||L(`@MINDMAP:读取目录失败`))}}let W=F({});function G(e){W.value={...W.value,[e]:!W.value[e]},p.activeDir=e}function Ue(e){let t=e.replace(/[\\/]+$/,``).split(/[\\/]/);return t[t.length-1]||e}function We(e){return!!p.activeDir&&p.activeDir.toLowerCase()===e.toLowerCase()}function K(){let{dir:e,ambiguous:t}=p.resolveTargetDir();return e||(D.warning(L(t?`@MINDMAP:请选择目标目录`:`@MINDMAP:请先添加目录`)),null)}async function q(e){let t=e||K();if(!t||(e&&(p.activeDir=e),!await Ke()))return;let n=``;try{n=(await M.prompt(L(`@MINDMAP:输入文件名提示`),L(`@MINDMAP:新建思维导图`),{confirmButtonText:L(`@MINDMAP:新建`),cancelButtonText:L(`@MINDMAP:取消`),inputPlaceholder:L(`@MINDMAP:文件名占位`),inputValidator:e=>!e||!e.trim()?L(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||L(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await p.createFile(n,!0,t),D.success(L(`@MINDMAP:已新建并打开`))}catch(e){D.error(e?.message||L(`@MINDMAP:新建失败`))}}async function J(e=!1){if(p.current)try{let t=I.value?.exportData();if(!t){e||D.warning(L(`@MINDMAP:无法获取数据`));return}await p.saveCurrent(t),e||D.success(L(`@MINDMAP:已保存`))}catch(e){D.error(e?.message||L(`@MINDMAP:保存失败`))}}let Y=null;function Ge(){p.current&&p.dirty&&(Y&&clearTimeout(Y),Y=setTimeout(()=>{Y=null,p.current&&p.dirty&&J(!0)},He))}function X(){Y&&=(clearTimeout(Y),null)}async function Ke(){if(!p.dirty||!p.current)return!0;try{await M.confirm(L(`@MINDMAP:未保存提示`,{title:p.current.title}),L(`@MINDMAP:未保存的改动`),{confirmButtonText:L(`@MINDMAP:保存`),cancelButtonText:L(`@MINDMAP:丢弃`),distinguishCancelAndClose:!0,type:`warning`}),X();let e=I.value?.exportData();return e&&(await p.saveCurrent(e),D.success(L(`@MINDMAP:已保存`))),!0}catch(e){return e===`cancel`&&(X(),!0)}}async function qe(e){if(!(p.current&&p.current.path===e)&&await Ke())try{await p.openFile(e,!0)}catch(e){D.error(e?.message||L(`@MINDMAP:打开失败`))}}async function Je(e){let t=!!p.current&&U(p.current.path,e),n=L(`@MINDMAP:确认移除目录提示`,{dir:e});t&&(n=`${n} ${L(`@MINDMAP:当前文件将保持打开`)}`);try{await M.confirm(n,L(`@MINDMAP:移除目录`),{confirmButtonText:L(`@MINDMAP:移除目录`),cancelButtonText:L(`@MINDMAP:取消`),type:`warning`})}catch{return}p.removeDir(e),D.success(L(`@MINDMAP:已移除目录`))}let Z=F(null);function Ye(e,t){e.preventDefault(),Z.value={x:e.clientX,y:e.clientY,dir:t}}function Q(){Z.value=null}async function Xe(){let e=Z.value?.dir;if(Q(),!e)return;let t=await fe(e);t.success?D.success(t.message||L(`@MINDMAP:已在文件管理器中打开`)):D.error(t.error||L(`@MINDMAP:打开目录失败`))}function Ze(){let e=Z.value?.dir;Q(),e&&q(e)}function Qe(){let e=Z.value?.dir;Q(),e&&Je(e)}async function $e(e){try{await M.confirm(L(`@MINDMAP:确认删除提示`,{title:e.title}),L(`@MINDMAP:删除`),{confirmButtonText:L(`@MINDMAP:删除`),cancelButtonText:L(`@MINDMAP:取消`),type:`warning`})}catch{return}try{await p.deleteFile(e.path),D.success(L(`@MINDMAP:已删除`))}catch(e){D.error(e?.message||L(`@MINDMAP:删除失败`))}}async function et(e){let t=``;try{t=(await M.prompt(L(`@MINDMAP:输入新名称提示`),L(`@MINDMAP:重命名`),{confirmButtonText:L(`@MINDMAP:确定`),cancelButtonText:L(`@MINDMAP:取消`),inputValue:e.title,inputValidator:e=>!e||!e.trim()?L(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||L(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await p.renameFile(e.path,t),D.success(L(`@MINDMAP:已重命名`))}catch(e){D.error(e?.message||L(`@MINDMAP:重命名失败`))}}function tt(e){p.markDirty(),Ge()}function nt(e){}async function rt(e){let t=e||K();if(!t)return;let n=``,r=``;try{n=(await M.prompt(L(`@MINDMAP:粘贴Markdown提示`),L(`@MINDMAP:从Markdown导入`),{confirmButtonText:L(`@MINDMAP:导入`),cancelButtonText:L(`@MINDMAP:取消`),inputType:`textarea`,inputPlaceholder:L(`@MINDMAP:Markdown占位`),inputValidator:e=>!e||!e.trim()?L(`@MINDMAP:内容不能为空`):!0})).value}catch{return}try{r=(await M.prompt(L(`@MINDMAP:输入文件名提示`),L(`@MINDMAP:文件名`),{confirmButtonText:L(`@MINDMAP:新建`),cancelButtonText:L(`@MINDMAP:取消`),inputValidator:e=>!e||!e.trim()?L(`@MINDMAP:名称不能为空`):!/[\\/:*?"<>|]/.test(e)||L(`@MINDMAP:名称含非法字符`)})).value.trim()}catch{return}try{await p.createFile(r,!0,t);let e=de(n,r),i=JSON.stringify(e,null,2);await p.saveCurrent(i),D.success(L(`@MINDMAP:已导入`))}catch(e){D.error(e?.message||L(`@MINDMAP:导入失败`))}}async function it(){if(I.value)try{let e=I.value.getMarkdown();await navigator.clipboard.writeText(e),D.success(L(`@MINDMAP:已复制Markdown`))}catch(e){D.error(e?.message||L(`@MINDMAP:复制失败`))}}function at(e){(e.ctrlKey||e.metaKey)&&e.key===`s`&&(e.preventDefault(),p.current&&p.dirty&&(X(),J()))}let ot=F(0);te(()=>p.current?.path,()=>{ot.value++});let $=F(!1);function st(){$.value=!$.value}let ct=a(()=>{let e=p.current?.content;if(!e)return null;try{return JSON.parse(e)}catch{return null}});b(async()=>{window.addEventListener(`keydown`,at),document.addEventListener(`click`,Q),await p.init()}),u(()=>{window.removeEventListener(`keydown`,at),document.removeEventListener(`click`,Q),X()});function lt(e){if(!e)return`-`;let t=new Date(e),n=Date.now()-e;return n<6e4?L(`@MINDMAP:刚刚`):n<36e5?`${Math.floor(n/6e4)}${L(`@MINDMAP:分钟前`)}`:n<864e5?`${Math.floor(n/36e5)}${L(`@MINDMAP:小时前`)}`:`${t.getMonth()+1}/${t.getDate()} ${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}`}function ut(e){return e?e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`:`0 B`}return(a,s)=>{let u=ae,v=f,b=y,D=l,M=C;return g(),t(`div`,me,[r(`div`,he,[r(`div`,ge,[o(u,{size:`small`,icon:i(n),onClick:V},{default:k(()=>[h(e(i(L)(`@MINDMAP:添加目录`)),1)]),_:1},8,[`icon`]),i(p).dirs.length>0?(g(),m(b,{key:0,placement:`bottom-start`,"show-after":200},{content:k(()=>[r(`div`,_e,[(g(!0),t(_,null,T(i(p).dirs,n=>(g(),t(`div`,{key:n},e(n),1))),128))])]),default:k(()=>[o(v,{size:`small`,type:`info`,class:`mm-dir-tag`},{default:k(()=>[h(e(i(L)(`@MINDMAP:个目录`,{n:i(p).dirs.length})),1)]),_:1})]),_:1})):(g(),t(`span`,ve,e(i(L)(`@MINDMAP:请先添加目录`)),1))]),r(`div`,ye,[o(u,{size:`small`,icon:i(oe),disabled:i(p).dirs.length===0,onClick:s[0]||=e=>q()},{default:k(()=>[h(e(i(L)(`@MINDMAP:新建`)),1)]),_:1},8,[`icon`,`disabled`]),o(u,{size:`small`,icon:i(ee),disabled:i(p).dirs.length===0,onClick:s[1]||=e=>rt()},{default:k(()=>[h(e(i(L)(`@MINDMAP:从MD导入`)),1)]),_:1},8,[`icon`,`disabled`]),o(u,{size:`small`,icon:i(E),disabled:!i(p).current,onClick:it},{default:k(()=>[h(e(i(L)(`@MINDMAP:复制MD`)),1)]),_:1},8,[`icon`,`disabled`]),o(u,{size:`small`,type:`primary`,icon:i(re),disabled:!i(p).current||!i(p).dirty,loading:i(p).loading,onClick:s[2]||=()=>{X(),J()}},{default:k(()=>[h(e(i(L)(`@MINDMAP:保存`)),1)]),_:1},8,[`icon`,`disabled`,`loading`]),i(p).current?(g(),t(`span`,be,[r(`span`,{class:`mm-status-title`,title:i(p).current.title},e(i(p).current.title),9,xe),i(p).dirty?(g(),t(`span`,Se,`●`)):O(``,!0)])):O(``,!0)])]),r(`div`,Ce,[r(`div`,we,[r(`div`,Te,[r(`span`,Ee,e(i(L)(`@MINDMAP:文件列表`)),1),o(u,{size:`small`,text:``,icon:i(c),loading:i(p).refreshing,onClick:s[3]||=e=>i(p).refresh(),disabled:i(p).dirs.length===0},null,8,[`icon`,`loading`,`disabled`])]),N((g(),t(`div`,De,[i(p).error?(g(),t(`div`,Oe,e(i(p).error),1)):O(``,!0),i(p).dirs.length===0?(g(),m(B,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:i(L)(`@MINDMAP:请先添加目录`)},null,8,[`title`])):(g(!0),t(_,{key:2},T(i(p).groups,n=>(g(),t(`div`,{key:n.dir,class:`mm-group`},[r(`div`,{class:d([`mm-group-header`,{active:We(n.dir)}]),title:n.dir,onClick:e=>G(n.dir),onContextmenu:e=>Ye(e,n.dir)},[o(D,{class:d([`mm-group-caret`,{collapsed:W.value[n.dir]}])},{default:k(()=>[o(i(S))]),_:1},8,[`class`]),r(`div`,Ae,[r(`div`,je,[r(`span`,Me,e(Ue(n.dir)),1),r(`span`,Ne,e(n.files.length),1)]),r(`div`,Pe,e(n.dir),1)])],42,ke),N(r(`div`,Fe,[n.error?(g(),t(`div`,{key:0,class:`mm-group-error`,title:n.error},[r(`span`,null,e(i(L)(`@MINDMAP:目录不存在或已删除`)),1),o(u,{size:`small`,text:``,type:`danger`,onClick:e=>Je(n.dir)},{default:k(()=>[h(e(i(L)(`@MINDMAP:移除目录`)),1)]),_:1},8,[`onClick`])],8,Ie)):n.files.length===0?(g(),m(B,{key:1,class:`mm-sidebar-empty`,size:`inline`,title:i(L)(`@MINDMAP:该目录暂无思维导图`)},null,8,[`title`])):(g(!0),t(_,{key:2},T(n.files,n=>(g(),t(`div`,{key:n.path,class:d([`mm-file-item`,{active:i(p).current?.path===n.path}]),onClick:e=>qe(n.path)},[r(`div`,Re,[r(`div`,{class:`mm-file-title`,title:n.title},e(n.title),9,ze),r(`div`,Be,e(lt(n.mtime))+` · `+e(ut(n.size)),1)]),r(`div`,{class:`mm-file-actions`,onClick:s[4]||=P(()=>{},[`stop`])},[o(u,{size:`small`,text:``,icon:i(E),onClick:e=>et(n),title:i(L)(`@MINDMAP:重命名`)},null,8,[`icon`,`onClick`,`title`]),o(u,{size:`small`,text:``,type:`danger`,icon:i(A),onClick:e=>$e(n),title:i(L)(`@MINDMAP:删除`)},null,8,[`icon`,`onClick`,`title`])])],10,Le))),128))],512),[[ie,!W.value[n.dir]]])]))),128))])),[[M,i(p).refreshing]])]),r(`div`,Ve,[i(p).current?(g(),m(i(ue),{key:ot.value,ref_key:`mmRef`,ref:I,data:ct.value,"preview-mode":$.value,onChange:tt,onSelect:nt,onCanvasTogglePreview:st},null,8,[`data`,`preview-mode`])):(g(),m(B,{key:0,class:`mm-editor-empty`,title:i(L)(`@MINDMAP:思维导图编辑器`),hint:i(p).dirs.length>0?i(L)(`@MINDMAP:从左侧选择或新建`):i(L)(`@MINDMAP:先选择目录提示`)},{icon:k(()=>[...s[7]||=[r(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[r(`circle`,{cx:`12`,cy:`12`,r:`2`}),r(`circle`,{cx:`5`,cy:`5`,r:`2`}),r(`circle`,{cx:`19`,cy:`5`,r:`2`}),r(`circle`,{cx:`5`,cy:`19`,r:`2`}),r(`circle`,{cx:`19`,cy:`19`,r:`2`}),r(`line`,{x1:`10.5`,y1:`10.5`,x2:`6.5`,y2:`6.5`}),r(`line`,{x1:`13.5`,y1:`10.5`,x2:`17.5`,y2:`6.5`}),r(`line`,{x1:`10.5`,y1:`13.5`,x2:`6.5`,y2:`17.5`}),r(`line`,{x1:`13.5`,y1:`13.5`,x2:`17.5`,y2:`17.5`})],-1)]]),_:1},8,[`title`,`hint`]))])]),o(i(ce),{visible:R.value,mode:`directory`,multiple:!0,theme:j.value?`dark`:`light`,locale:i(w),"default-path":i(p).activeDir||i(p).dirs[0]||``,onClose:s[5]||=e=>R.value=!1,onConfirm:H},null,8,[`visible`,`theme`,`locale`,`default-path`]),(g(),m(ne,{to:`body`},[Z.value?(g(),t(`div`,{key:0,class:`ctx-menu`,style:x({left:Z.value.x+`px`,top:Z.value.y+`px`}),onClick:s[6]||=P(()=>{},[`stop`])},[r(`button`,{class:`ctx-menu-item`,onClick:Xe},[s[8]||=r(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[r(`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`}),r(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),h(` `+e(i(L)(`@MINDMAP:打开目录`)),1)]),r(`button`,{class:`ctx-menu-item`,onClick:Ze},[s[9]||=r(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[r(`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`}),r(`polyline`,{points:`14 2 14 8 20 8`}),r(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),r(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),h(` `+e(i(L)(`@MINDMAP:在此新建`)),1)]),s[11]||=r(`div`,{class:`ctx-menu-sep`},null,-1),r(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Qe},[s[10]||=r(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[r(`polyline`,{points:`3 6 5 6 21 6`}),r(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),r(`path`,{d:`M10 11v6`}),r(`path`,{d:`M14 11v6`}),r(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),h(` `+e(i(L)(`@MINDMAP:移除目录`)),1)])],4)):O(``,!0)]))])}}}),[[`__scopeId`,`data-v-6567b053`]]);export{G as default};
|