zen-gitsync 2.18.23 → 2.18.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/package.json +5 -2
  2. package/src/cli/ai/tools.js +113 -0
  3. package/src/cli/ai/webSearch.js +260 -0
  4. package/src/config.js +71 -1
  5. package/src/ui/public/assets/{AgentView-DQOp7_6G.js → AgentView-CiWEJ_2v.js} +1 -1
  6. package/src/ui/public/assets/{AppVersionBadge-BBVS3HeA.js → AppVersionBadge-D3IEpIR2.js} +2 -2
  7. package/src/ui/public/assets/{BranchSelector-BwmMgaSS.js → BranchSelector-C0nB2LEE.js} +1 -1
  8. package/src/ui/public/assets/{ChatSilenceBadge-BnaLbCwp.js → ChatSilenceBadge-hb_fJMMg.js} +1 -1
  9. package/src/ui/public/assets/{CommitForm-BtRxJodG.js → CommitForm-CvOOlBZI.js} +1 -1
  10. package/src/ui/public/assets/{CommonDialog-Qg_owAyQ.js → CommonDialog-C0zTwqdL.js} +1 -1
  11. package/src/ui/public/assets/{EditorView-DL3Lj4ho.js → EditorView-BWVtGf7z.js} +1 -1
  12. package/src/ui/public/assets/{FlowExecutionViewer-BsxAtCqd.js → FlowExecutionViewer-ai4_NArk.js} +1 -1
  13. package/src/ui/public/assets/{FlowOrchestrationWorkspace-lcqnsQE-.js → FlowOrchestrationWorkspace-Lhxo8V4t.js} +1 -1
  14. package/src/ui/public/assets/{LogList-CW3-fShz.js → LogList-CX8R6MyZ.js} +1 -1
  15. package/src/ui/public/assets/{MindmapView-ymN6XI7n.js → MindmapView-Cp2j7oyO.js} +1 -1
  16. package/src/ui/public/assets/{MonitorView-C4fFNPb2.js → MonitorView-CdjqaM-T.js} +1 -1
  17. package/src/ui/public/assets/{ProjectManagerView-ph_imDtI.js → ProjectManagerView-wlBbHwVQ.js} +1 -1
  18. package/src/ui/public/assets/{ProjectStartupButton-C2dqnR-6.js → ProjectStartupButton-DlZSyZx4.js} +1 -1
  19. package/src/ui/public/assets/{RemoteManagerDialog-DFkRW2O4.js → RemoteManagerDialog-CcO2xc2Y.js} +1 -1
  20. package/src/ui/public/assets/{RemoteRepoCard-BBnMjldy.js → RemoteRepoCard-DB0iLLQa.js} +1 -1
  21. package/src/ui/public/assets/{SourceMapView-CQcK1acs.js → SourceMapView-DpS3HjJy.js} +1 -1
  22. package/src/ui/public/assets/{SvgIcon-XBkgNKCj.js → SvgIcon-Coxq3TGz.js} +1 -1
  23. package/src/ui/public/assets/{TaskExecutorPicker-B6p57RJY.js → TaskExecutorPicker-CJZD3YVi.js} +1 -1
  24. package/src/ui/public/assets/{UserInputNode-CkXLP8y4.js → UserInputNode-C_znv4Pn.js} +1 -1
  25. package/src/ui/public/assets/WorkbenchView-B0DU80Kl.js +6 -0
  26. package/src/ui/public/assets/{WorkbenchView-MUfM9DER.css → WorkbenchView-SonUoHZE.css} +1 -1
  27. package/src/ui/public/assets/{_plugin-vue_export-helper-B3dZvHQf.js → _plugin-vue_export-helper-PJOlbt_0.js} +4 -4
  28. package/src/ui/public/assets/configStore-ByUSd24J.js +1 -0
  29. package/src/ui/public/assets/index-BTEGKhWc.js +59 -0
  30. package/src/ui/public/assets/index-Q5dnmWKq.css +1 -0
  31. package/src/ui/public/assets/{relativeTime-Ce-gekf_.js → relativeTime-De2wWXk0.js} +1 -1
  32. package/src/ui/public/assets/{taskExecutionExport-Hfww5P9_.js → taskExecutionExport-Bb0HWZiH.js} +1 -1
  33. package/src/ui/public/assets/{toolsStore-oZEAoHnG.js → toolsStore-ChBM3BeQ.js} +1 -1
  34. package/src/ui/public/assets/{useWorkbenchProjects-BifctigH.js → useWorkbenchProjects-CrDCUDV3.js} +1 -1
  35. package/src/ui/public/index.html +7 -7
  36. package/src/ui/server/routes/config.js +14 -0
  37. package/src/ui/server/routes/workbench/dispatchInstruction.js +9 -0
  38. package/src/ui/server/routes/workbench/imageDescribe.js +183 -0
  39. package/src/ui/server/routes/workbench/imageDescribe.test.js +149 -0
  40. package/src/ui/server/routes/workbench/index.js +2 -1
  41. package/src/ui/server/routes/workbench/pdfText.js +22 -5
  42. package/src/ui/server/routes/workbench/taskRunner.js +30 -1
  43. package/src/ui/public/assets/WorkbenchView-cucUmAwl.js +0 -6
  44. package/src/ui/public/assets/configStore-HDlssep1.js +0 -1
  45. package/src/ui/public/assets/index-CAWXBaPa.js +0 -59
  46. package/src/ui/public/assets/index-CigPOqV6.css +0 -1
@@ -1 +1 @@
1
- import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,Cn as r,Gn as i,Gr as a,In as o,Jr as s,Mn as c,On as ee,Sn as l,Sr as u,Tn as d,Un as f,Ur as p,W as m,Yn as h,_n as g,_r as te,ar as _,gn as ne,gr as v,hn as re,i as y,ir as ie,kn as b,ln as ae,lr as x,nr as S,on as C,pn as oe,qn as w,r as se,wn as T,xn as E,yn as ce}from"./element-plus-CN9J6t-d.js";import{n as D,t as O}from"./_plugin-vue_export-helper-B3dZvHQf.js";import{t as le}from"./SvgIcon-XBkgNKCj.js";import{t as ue}from"./configStore-HDlssep1.js";import{a as de,c as fe,i as pe,n as me,o as he,r as ge,s as _e}from"./monaco-irXl5Eu9.js";import{r as k,t as A}from"./flow-mindmap-CyZrdnd4.js";import{_t as ve,c as ye,ct as be,dt as xe,ft as Se,gt as j,ht as Ce,lt as we,mt as Te,pt as Ee,st as De,ut as Oe,vt as ke,w as Ae}from"./index-CAWXBaPa.js";function je(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}o(),x(),t();var M=[`data-media-kind`,`data-media-path`],Me={class:`media-preview-stage`},Ne={key:0,class:`media-preview-error`},N={class:`media-preview-error-title`},Pe={class:`media-preview-error-path`},Fe=[`src`],P={key:1,class:`media-preview-audio`},Ie=[`title`],Le=[`src`],Re={key:2,class:`media-preview-loading`},ze={class:`media-preview-footer`},Be={class:`media-preview-meta`},Ve=[`title`],He=O(c({__name:`MediaPreview`,props:{filePath:{},fileName:{}},setup(e){let t=e,n=E(()=>Ce(t.filePath)??`audio`),r=E(()=>j(t.filePath)),i=E(()=>t.fileName||t.filePath.split(/[\\/]/).pop()||``),a=v(!0),o=v(!1),c=v(0),f=v(0),p=v(0),m=v(0);async function h(){try{let e=await(await fetch(`/api/editor/file?path=${encodeURIComponent(t.filePath)}&meta=1`)).json();e?.success&&typeof e.size==`number`&&(f.value=e.size)}catch{}}S(()=>t.filePath,()=>{a.value=!0,o.value=!1,c.value=0,f.value=0,p.value=0,m.value=0,h()},{immediate:!0});function te(e){let t=e.target;Number.isFinite(t.duration)&&t.duration>0&&(c.value=t.duration),t instanceof HTMLVideoElement&&(p.value=t.videoWidth,m.value=t.videoHeight),a.value=!1}function _(){a.value=!1}function ne(){a.value=!1,o.value=!0}function re(e){if(!Number.isFinite(e)||e<=0)return`--:--`;let t=Math.floor(e),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),a=String(r).padStart(2,`0`);return i>0?`${i}:${a}:${String(n).padStart(2,`0`)}`:`${r}:${String(n).padStart(2,`0`)}`}function y(e){return!e||e<0?``:e>=1073741824?`${(e/1024/1024/1024).toFixed(2)} GB`:e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}let ie=E(()=>{let e=[n.value===`video`?D(`@EDITOR:视频`):D(`@EDITOR:音频`)];c.value>0&&e.push(re(c.value)),p.value>0&&m.value>0&&e.push(`${p.value} × ${m.value}`);let t=y(f.value);return t&&e.push(t),e.join(` · `)});return(e,c)=>(w(),d(`div`,{class:`media-preview`,"data-media-kind":n.value,"data-media-path":t.filePath},[l(`div`,Me,[o.value?(w(),d(`div`,Ne,[c[0]||=l(`svg`,{viewBox:`0 0 24 24`,width:`40`,height:`40`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`circle`,{cx:`12`,cy:`12`,r:`9`}),l(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`13`}),l(`line`,{x1:`12`,y1:`16.5`,x2:`12`,y2:`16.6`})],-1),l(`p`,N,s(u(D)(`@EDITOR:无法播放该文件,可能是编码或格式不受支持`)),1),l(`p`,Pe,s(t.filePath),1)])):(w(),d(g,{key:1},[n.value===`video`?(w(),d(`video`,{key:t.filePath,class:`media-preview-video`,src:r.value,controls:``,playsinline:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Fe)):(w(),d(`div`,P,[c[1]||=ee(`<div class="media-preview-glyph" aria-hidden="true" data-v-f05d705f><svg viewBox="0 0 24 24" width="46" height="46" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-f05d705f><path d="M3 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" data-v-f05d705f></path><path d="M9 17v-13h10v13" data-v-f05d705f></path><path d="M9 8h10" data-v-f05d705f></path></svg></div>`,1),l(`p`,{class:`media-preview-title`,title:t.filePath},s(i.value),9,Ie),(w(),d(`audio`,{key:t.filePath,class:`media-preview-audio-el`,src:r.value,controls:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Le))])),a.value?(w(),d(`div`,Re,[c[2]||=l(`span`,{class:`media-preview-spinner`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在载入媒体文件…`)),1)])):T(``,!0)],64))]),l(`div`,ze,[l(`span`,Be,s(ie.value),1),n.value===`video`?(w(),d(`span`,{key:0,class:`media-preview-name`,title:t.filePath},s(i.value),9,Ve)):T(``,!0)])],8,M))}}),[[`__scopeId`,`data-v-f05d705f`]]);o(),x();var Ue={class:`mindmap-preview`},We={class:`mindmap-preview-canvas`},Ge=O(c({__name:`MindmapPreview`,props:{content:{}},setup(t){let n=t,r=E(()=>A(n.content||``,`未命名文档`));return(t,n)=>(w(),d(`div`,Ue,[n[0]||=l(`div`,{class:`mindmap-preview-header`},[l(`span`,{class:`mindmap-preview-title`},`整篇导图`),l(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),l(`div`,We,[e(u(k),{data:r.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]),Ke=1080,qe=6e5,Je=.86;function F(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 I(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 Ye(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>Ke||e.length>qe)){r(e);return}try{let t=Math.min(1,Ke/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`,Je))}catch{r(e)}},i.onerror=()=>{clearTimeout(a),r(e)},i.src=e})}async function Xe(e){let t=await I(e);return t?Ye(t):null}async function Ze(e){let t=Array.from(e.querySelectorAll(`img`)).filter(e=>F(e.getAttribute(`src`)||``)),n=0;return await Promise.all(t.map(async e=>{let t=await Xe(e.getAttribute(`src`)||``);t?e.setAttribute(`src`,t):n+=1})),n}function Qe(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}var $e={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 et(e){e.querySelectorAll(`*`).forEach(e=>{let t=$e[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 tt(e,t){let n=e.cloneNode(!0),r=t?await Ze(n):0;return{html:n.innerHTML,leftover:r}}async function nt(e,t){let n=e.cloneNode(!0),r=t.inline?await Ze(n):0;et(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;">${Qe(i)}</h1>`:``}${n.innerHTML}</section>`,leftover:r}}o(),x(),t(),C();var rt={class:`sidebar-header`},it={class:`sidebar-title`},at={class:`sidebar-actions`},ot={class:`sidebar-search`},st=[`placeholder`,`title`],ct=[`title`,`aria-label`],lt={key:0,class:`sidebar-tree`},ut={key:0,class:`search-section-head`},dt={key:1,class:`tree-arrow-spacer`},ft={class:`tree-icon mit-icon`,"aria-hidden":`true`},pt=[`xlink:href`],mt=[`onClick`,`onContextmenu`],ht={key:1,class:`tree-arrow-spacer`},gt={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},_t=[`xlink:href`],vt={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},yt=[`xlink:href`],bt=[`title`],xt={key:0,class:`tree-name-hit`},St={key:4,class:`tree-loading`},Ct={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)`}},wt={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)`}},Tt=[`placeholder`],Et={key:1,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Dt={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)`}},Ot={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)`}},kt=[`placeholder`],At=[`data-query`],jt={key:0,class:`content-results-status`},Mt={class:`search-section-head`},Nt={class:`search-section-count`},Pt={key:0,class:`search-section-note`},Ft=[`title`,`onClick`],It={class:`tree-icon mit-icon`,"aria-hidden":`true`},Lt=[`xlink:href`],Rt={class:`content-hit-name`},zt={class:`content-hit-dir`},Bt={class:`content-hit-total`},Vt=[`title`,`onClick`],Ht={class:`content-hit-ln`},Ut={class:`content-hit-text`},Wt={key:0,class:`content-hit-mark`},Gt={key:3,class:`tree-empty`},Kt={key:1,class:`sidebar-loading`},qt={class:`editor-main`},Jt={class:`editor-tabs`},Yt=[`onClick`,`title`],Xt={class:`tab-name`},Zt={key:0,class:`tab-dirty-dot`},Qt=[`onClick`],$t=[`title`],en=[`disabled`,`title`],tn={class:`editor-body`},nn={key:1,class:`image-tab-placeholder`},rn={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`}},an={class:`image-tab-placeholder-title`},on={class:`image-tab-placeholder-hint`},sn={class:`preview-header`},cn={class:`preview-title`},ln={class:`preview-ext-badge`},un=[`title`],dn={class:`preview-body`},fn={key:0,class:`preview-copybar`},pn=[`disabled`,`title`],mn=[`disabled`,`title`],hn=[`disabled`,`title`],gn=[`title`],_n=[`sandbox`,`srcdoc`],vn=2,yn=6e4,bn=3e4,xn=300,Sn=320,Cn=O(c({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new _e:t===`css`||t===`scss`||t===`less`?new he:t===`html`||t===`handlebars`||t===`razor`?new de:t===`typescript`||t===`javascript`?new pe:new fe}};let o=t,c=ue(),x=Ae(),C=v([]),O=v(!1),k=v(``),A=v(``),j=null;function Ce(){k.value=``,A.value=``,j&&=(clearTimeout(j),null)}S(k,e=>{j&&clearTimeout(j),j=setTimeout(()=>{A.value=e,j=null},180)});let M=v([]),Me=v(0),Ne=v(``),N=v(!1),Pe=v(!1),Fe=null,P=0;function Ie(){Fe?.abort(),Fe=null,P+=1,M.value=[],Me.value=0,Ne.value=``,N.value=!1,Pe.value=!1}async function Le(e){let t=e.trim(),n=c.currentDirectory;if(!n||t.length<vn){Ie();return}if(t===Ne.value&&N.value)return;Fe?.abort();let r=++P,i=new AbortController;Fe=i,N.value=!0,Ne.value=t;try{let e=await(await fetch(`/api/search_content`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n,query:t}),signal:i.signal})).json().catch(()=>null);if(r!==P)return;if(!e?.success){M.value=[],Me.value=0,Pe.value=!1;return}M.value=Array.isArray(e.files)?e.files:[],Me.value=typeof e.totalMatches==`number`?e.totalMatches:0,Pe.value=!!e.truncated}catch(e){if(e?.name===`AbortError`||r!==P)return;M.value=[],Me.value=0,Pe.value=!1}finally{r===P&&(N.value=!1)}}S(A,e=>{Le(e)}),f(()=>{j&&clearTimeout(j),Fe?.abort(),Be(),Qn()});let Re=null;function ze(){Be(),c.ui.fileTreeAutoRefresh&&(Re=setInterval(()=>{document.hidden||c.currentDirectory&&(k.value.trim()||F())},yn))}function Be(){Re&&=(clearInterval(Re),null)}S(()=>c.currentDirectory,async()=>{if(Pn=!1,Ie(),ze(),await Ue(),L.value.some(e=>e.isDirty)){Pn=!0;return}L.value=[],R.value=null,Bn(),await Ln()}),S(()=>c.ui.fileTreeAutoRefresh,()=>{ze()});async function Ve(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 Ue(){let e=c.currentDirectory;if(e){O.value=!0;try{C.value=await Ve(e,0)}finally{O.value=!1}}}function We(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&We(n.children,t));return t}function Ke(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=Ke(e.children,t+1),n.expanded=!0),n})}async function qe(e){let t=c.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:Ke(n.items,0)}catch{return null}}function Je(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)?Je(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function F(e={}){if(!c.currentDirectory)return;let t=await qe([...We(C.value)]);if(!t){e.notifyOnError&&y.error(D(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Je(C.value,t)&&(C.value=t)}async function I(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ve(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Ye(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Ye(n.children));return t}let Xe=E(()=>A.value.trim().toLowerCase());function Ze(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.name.toLowerCase().includes(t);if(r.type===`directory`){let i=r.children?Ze(r.children,t):[];if(!e&&i.length===0)continue;n.push({...r,expanded:!0,children:r.children===void 0?void 0:i})}else e&&n.push(r)}return n}function Qe(e,t){for(let n of e){if(n.path===t)return n;if(n.children){let e=Qe(n.children,t);if(e)return e}}return null}let $e=E(()=>Ze(C.value,Xe.value)),et=E(()=>Xe.value.length>0&&$e.value.length===0),Cn=E(()=>et.value&&M.value.length===0&&!N.value);function wn(e){let t=A.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}async function Tn(e,t){if(await kn({name:e.name,path:e.path,type:`file`,depth:0}),!t||t<1)return;await n();let r=B.value;r&&r.getModel()&&jn()?.path===e.path&&(r.revealLineInCenter(t,ge.ScrollType.Smooth),r.setPosition({lineNumber:t,column:1}),r.focus())}let En=v(null);function Dn(){let e=En.value;e&&(e.focus(),e.select())}function On(){k.value?(Ce(),En.value?.focus()):(En.value?.blur(),B.value?.focus())}let L=v([]),R=v(null),z=v(null);async function kn(e){if(z.value=e,e.type!==`file`){I(Qe(C.value,e.path)??e);return}let t=L.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:L.value.length}),t){R.value=e.path,n(()=>Hn());return}let r=e.name.split(`.`).pop()||``;if(Te.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null};L.value.push(t),R.value=e.path;return}if(Ir.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};L.value.push(t),R.value=e.path,J.value=!0;return}if(Ee(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};L.value.push(t),R.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),n=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:n}),!n.success){y.error(`${D(`@EDITOR:打开文件失败: `)}${n.error}`);return}let i=je(r),a=V.get(e.path);a&&!a.isDisposed()&&a.setValue(n.content);let o={path:e.path,name:e.name,content:n.content,originalContent:n.content,isDirty:!1,language:i,diskMtimeMs:typeof n.mtimeMs==`number`?n.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),L.value.push(o),R.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,L.value.length,`activeTabPath=`,R.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),y.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await n();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await kn({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function An(e,t){t.stopPropagation();let n=L.value.findIndex(t=>t.path===e);n!==-1&&(!L.value[n].isDirty||confirm(D(`@EDITOR:文件未保存,确认关闭?`)))&&(L.value.splice(n,1),R.value===e&&(R.value=L.value[Math.min(n,L.value.length-1)]?.path??null))}let jn=()=>L.value.find(e=>e.path===R.value)??null,Mn=E(()=>({expandedDirs:[...We(C.value)],tabs:L.value.map(e=>e.path),activeTab:R.value})),Nn=!1,Pn=!1;function Fn(){Pn&&!Nn&&c.isUiLoaded&&c.saveEditorWorkspace(Mn.value)}S(Mn,()=>Fn());async function In(e){if(L.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(Te.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null});return}if(Ir.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(Ee(t)){L.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=V.get(e);i&&!i.isDisposed()&&B.value?.getModel()!==i&&(i.dispose(),V.delete(e)),L.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:je(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function Ln(){try{for(let e=0;e<100&&!c.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!c.isUiLoaded)return;rr.value=c.ui.editorSidebarWidth;let e=c.getEditorWorkspace();if(!e)return;Nn=!0;try{if(e.expandedDirs.length>0){let t=await qe(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await In(t);if(!o.pendingFilePath&&e.activeTab&&L.value.some(t=>t.path===e.activeTab)){R.value=e.activeTab;let t=jn(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(Ir.has(n)||Ee(t.name))&&(J.value=!0)}}finally{Nn=!1}}finally{Pn=!0,Fn()}}let Rn=v(null),B=te(null),V=new Map;function zn(e){let t=V.get(e.path);return(!t||t.isDisposed())&&(t=ge.createModel(e.content,e.language,me.file(e.path)),V.set(e.path,t)),t}function Bn(){B.value?.setModel(null);for(let e of V.values())e.isDisposed()||e.dispose();V.clear()}function Vn(){if(!Rn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;B.value=ge.create(Rn.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}),B.value.onDidChangeModelContent(()=>{let e=jn();if(!e)return;let t=B.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),B.value.onDidBlurEditorText(()=>{c.ui.editorAutoSave&&jn()?.isDirty&&tr(!1),requestAnimationFrame(()=>{if(!H.value||H.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`))||Hn()})})}S(R,e=>{if(!B.value||!e)return;let t=L.value.find(t=>t.path===e);if(!t)return;let r=zn(t);B.value.setModel(r),n(()=>Hn()),Jn(e)});function Hn(){if(!B.value)return;B.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let Un=0,Wn=new Map;async function Gn(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 Kn(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 qn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=V.get(e.path);if(!r||r.isDisposed())return;let i=B.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 Jn(e){if(!e)return;let t=L.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++Un,r=await Gn(e);if(n!==Un||L.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(Wn.get(e)===r.mtimeMs)return;Wn.set(e,r.mtimeMs);try{await se.confirm(D(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),D(`@EDITOR:文件已被外部改动`),{confirmButtonText:D(`@EDITOR:重新加载`),cancelButtonText:D(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await Kn(e);i&&L.value.find(t=>t.path===e)===t&&qn(t,i.content,i.mtimeMs)}function Yn(){document.hidden||Jn(R.value)}let Xn=null;function Zn(){Qn(),Xn=setInterval(()=>{document.hidden||Jn(R.value)},bn)}function Qn(){Xn&&=(clearInterval(Xn),null)}S(()=>L.value.filter(e=>e.isDirty).length,e=>{x.setDirtyCount(e)},{immediate:!0}),S(R,e=>{let t=L.value.find(t=>t.path===e)??null;x.setActiveFile(t?.path??``,t?.name??``)},{immediate:!0}),f(()=>x.setDirtyCount(0)),Se(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;ge.setTheme(e?`vs-dark`:`vs`)});let $n=null;function er(){if($n||!H.value)return;let e=[H.value],t=H.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}$n=new MutationObserver(()=>{H.value&&H.value.offsetParent!==null&&R.value&&B.value&&(Jn(R.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`))||Hn()}))});let n=$n;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}i(async()=>{Vn(),await Ue(),await Ln(),er(),ze(),window.addEventListener(`focus`,Yn),document.addEventListener(`visibilitychange`,Yn),Zn(),R.value&&n(()=>Hn())}),f(()=>{$n?.disconnect(),$n=null,window.removeEventListener(`focus`,Yn),document.removeEventListener(`visibilitychange`,Yn),B.value?.dispose(),V.forEach(e=>e.dispose()),V.clear()});async function tr(e=!1){let t=jn();if(t&&!(Rr.value||zr.value||Br.value))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){y.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||y.success(D(`@EDITOR:已保存`))}catch(e){y.error(`${D(`@EDITOR:保存失败: `)}${e.message}`)}}function nr(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Dn();return}t&&e.key===`s`&&(e.preventDefault(),tr())}i(()=>window.addEventListener(`keydown`,nr)),f(()=>window.removeEventListener(`keydown`,nr));let H=v(null),rr=v(c.ui.editorSidebarWidth),ir=!1,ar=0,or=0;function sr(e){ir=!0,ar=e.clientX,or=rr.value,document.addEventListener(`mousemove`,cr),document.addEventListener(`mouseup`,lr),e.preventDefault()}function cr(e){if(!ir)return;let t=e.clientX-ar;rr.value=Math.max(140,Math.min(400,or+t))}function lr(){ir=!1,document.removeEventListener(`mousemove`,cr),document.removeEventListener(`mouseup`,lr),rr.value!==c.ui.editorSidebarWidth&&c.setEditorSidebarWidth(rr.value)}function ur(e){return e.type===`directory`?ke(e.name):ve(e.name)}let U=v(null),W=v(null),G=v(null),dr=v(null);function fr(){let e=z.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(/[\\/][^\\/]+$/,``):c.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:c.currentDirectory??``,afterNode:null,depth:0}}async function pr(){let e=fr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`file`,value:``},await n(),G.value?.focus()}async function mr(){let e=fr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`directory`,value:``},await n(),G.value?.focus()}function hr(){U.value=null}async function gr(){let e=U.value;if(!e||!e.value.trim()){U.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){y.error(e.error);return}y.success(D(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){y.error(e.error);return}y.success(D(`@EDITOR:创建成功`))}U.value=null,await F()}function _r(e){e.key===`Enter`&&(e.preventDefault(),gr()),e.key===`Escape`&&(e.preventDefault(),hr())}let K=v(null),vr=v(null);function yr(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function br(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=fr();U.value={...t,kind:`file`,value:``},await n(),G.value?.focus()}async function xr(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=fr();U.value={...t,kind:`directory`,value:``},await n(),G.value?.focus()}async function Sr(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await n(),dr.value?.focus(),dr.value?.select())}async function Cr(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.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){y.error(r.error);return}let i=L.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,R.value===e.node.path&&(R.value=n)),W.value=null,await F()}function wr(e){e.key===`Enter`&&(e.preventDefault(),Cr()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Tr(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?D(`@EDITOR:文件夹`):D(`@EDITOR:文件`);if(!confirm(`${D(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){y.error(n.error);return}let r=L.value.findIndex(t=>t.path===e.path);r!==-1&&(L.value.splice(r,1),R.value===e.path&&(R.value=L.value[Math.max(0,r-1)]?.path??null)),y.success(D(`@EDITOR:已删除`)),await F()}async function Er(){let e=K.value?.node;if(q(),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||y.error(t.error)}catch(e){y.error(e?.message||String(e))}}function Dr(e){let t=c.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 Or(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 kr(){let e=K.value?.node;q(),e&&(await Or(e.path)?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`)))}async function Ar(){let e=K.value?.node;q(),e&&(await Or(Dr(e.path))?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`)))}async function jr(){let e=K.value?.node;if(q(),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||y.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){y.error(e?.message||String(e))}}let Mr=new Set([`html`,`htm`]),Nr=E(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Mr.has(t)});async function Pr(){let e=K.value?.node;if(q(),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||y.error(t.error||D(`@EDITOR:浏览器打开失败`))}catch(e){y.error(e?.message||String(e))}}i(()=>{document.addEventListener(`click`,q)}),f(()=>{document.removeEventListener(`click`,q)});let Fr=new Set([`md`,`html`,`htm`,`svg`]),Ir=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),Lr=v(0),X=E(()=>L.value.find(e=>e.path===R.value)??null),Rr=E(()=>X.value?.language===`plaintext`&&X.value?.content===``),zr=E(()=>X.value?.language===`office`),Br=E(()=>X.value?.language===`media`),Z=E(()=>(X.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Vr=E(()=>Fr.has(Z.value)||Ir.has(Z.value)||Ee(Z.value)),Hr=E(()=>((X.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),Ur=E(()=>Z.value===`md`&&Hr.value>0);S(R,()=>{J.value&&!Vr.value&&(J.value=!1),Y.value&&!Ur.value&&(Y.value=!1)});function Wr(){Vr.value&&(J.value||(Y.value=!1),J.value=!J.value)}function Gr(){Ur.value&&(Y.value||(J.value=!1),Y.value=!Y.value)}let Kr=E(()=>Lr.value<=0||L.value.length===0?{flexBasis:`0px`}:{flex:`0 0 ${Lr.value}px`,maxWidth:`calc(100% - 320px)`}),qr=v(null),Q=v(!1),$=v(``),Jr=v(!0),Yr=null,Xr=E(()=>!Y.value&&J.value&&Z.value===`md`&&!!X.value);function Zr(){return X.value?.content??``}function Qr(){return Zr().match(/^\s*#\s+(.+?)\s*(?:\r?\n|$)/)?.[1]?.trim()??``}function $r(e,t,n){if(!e){y.error(D(`@EDITOR:复制失败`));return}$.value=n,Yr&&clearTimeout(Yr),Yr=setTimeout(()=>{$.value=``},1800),t>0?y.warning(D(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):y.success(D(`@EDITOR:已复制`))}async function ei(){$r(await Or(Zr()),0,`md`)}async function ti(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await tt(e,Jr.value);$r(await Or(t),n,`html`)}finally{Q.value=!1}}}function ni(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 ri(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await nt(e,{inline:Jr.value,title:Qr()}),r=Zr(),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||=ni(t),$r(i,n,`rich`)}finally{Q.value=!1}}}let ii=E(()=>{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`?be(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>`:``}),ai=!1,oi=0,si=0,ci=0;function li(e){let t=e.currentTarget,n=t.parentElement;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect();ai=!0,oi=e.clientX,si=r.right-i.right,ci=Math.max(xn,r.width-Sn),document.addEventListener(`mousemove`,ui),document.addEventListener(`mouseup`,di),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,e.preventDefault()}function ui(e){if(!ai)return;let t=oi-e.clientX;Lr.value=Math.round(Math.max(xn,Math.min(ci,si+t)))}function di(){ai=!1,document.removeEventListener(`mousemove`,ui),document.removeEventListener(`mouseup`,di),document.body.style.cursor=``,document.body.style.userSelect=``}return(t,n)=>(w(),d(g,null,[l(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:H},[l(`div`,{class:`editor-sidebar`,style:a({width:rr.value+`px`})},[l(`div`,rt,[l(`span`,it,s(u(D)(`@EDITOR:资源管理器`)),1),l(`div`,at,[e(u(m),{content:u(D)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:pr},[...n[11]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:mr},[...n[12]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:n[0]||=e=>F({notifyOnError:!0})},[...n[13]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M20 11a8.1 8.1 0 0 0-15.5-2m-.5-4v4h4`}),l(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})],-1)]])]),_:1},8,[`content`])])]),l(`div`,ot,[n[15]||=l(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`circle`,{cx:`11`,cy:`11`,r:`7`}),l(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),_(l(`input`,{ref_key:`searchInputRef`,ref:En,"onUpdate:modelValue":n[1]||=e=>k.value=e,type:`text`,class:`sidebar-search-input`,placeholder:u(D)(`@EDITOR:搜索文件名或内容...`),title:u(D)(`@EDITOR:搜索文件名或内容...`),spellcheck:`false`,autocomplete:`off`,onKeydown:re(On,[`escape`])},null,40,st),[[oe,k.value]]),k.value?(w(),d(`button`,{key:0,class:`sidebar-search-clear`,title:u(D)(`@EDITOR:清除搜索`),"aria-label":u(D)(`@EDITOR:清除搜索`),onClick:Ce},[...n[14]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,ct)):T(``,!0)]),O.value?(w(),d(`div`,Kt,[...n[25]||=[l(`span`,{class:`spin-icon`},null,-1)]])):(w(),d(`div`,lt,[Xe.value&&$e.value.length>0?(w(),d(`div`,ut,s(u(D)(`@EDITOR:名称匹配`)),1)):T(``,!0),(w(!0),d(g,null,h(Ye($e.value),e=>(w(),d(g,{key:e.path},[W.value&&W.value.node.path===e.path?(w(),d(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+e.depth*14+`px`})},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[16]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,dt)),(w(),d(`svg`,ft,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,pt)])),_(l(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:dr,"onUpdate:modelValue":n[2]||=e=>W.value.value=e,onKeydown:wr,onBlur:Cr,onClick:n[3]||=ne(()=>{},[`stop`])},null,544),[[oe,W.value.value]])],4)):(w(),d(`div`,{key:1,class:p([`tree-node`,{"tree-node--dir":e.type===`directory`,"tree-node--file":e.type===`file`,"tree-node--active":R.value===e.path,"tree-node--selected":z.value?.path===e.path&&R.value!==e.path}]),style:a({paddingLeft:12+e.depth*14+`px`}),onClick:t=>kn(e),onContextmenu:t=>yr(t,e)},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[17]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,ht)),e.type===`directory`?(w(),d(`svg`,gt,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,_t)])):(w(),d(`svg`,vt,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,yt)])),l(`span`,{class:`tree-name`,title:e.path},[(w(!0),d(g,null,h(wn(e.name),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,xt,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))],8,bt),e.loading?(w(),d(`span`,St)):T(``,!0)],46,mt)),U.value&&U.value.afterNode?.path===e.path?(w(),d(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+U.value.depth*14+`px`})},[n[20]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,Ct,[...n[18]||=[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(w(),d(`svg`,wt,[...n[19]||=[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:_r,onBlur:hr,onClick:n[5]||=ne(()=>{},[`stop`])},null,40,Tt),[[oe,U.value.value]])],4)):T(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(w(),d(`div`,Et,[n[23]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,Dt,[...n[21]||=[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(w(),d(`svg`,Ot,[...n[22]||=[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:_r,onBlur:hr,onClick:n[7]||=ne(()=>{},[`stop`])},null,40,kt),[[oe,U.value.value]])])):T(``,!0),Xe.value?(w(),d(`div`,{key:2,class:`content-results`,"data-query":Ne.value},[N.value?(w(),d(`div`,jt,[n[24]||=l(`span`,{class:`content-search-spin`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在搜索文件内容...`)),1)])):M.value.length>0?(w(),d(g,{key:1},[l(`div`,Mt,[l(`span`,null,s(u(D)(`@EDITOR:内容匹配`)),1),l(`span`,Nt,s(Me.value),1),Pe.value?(w(),d(`span`,Pt,s(u(D)(`@EDITOR:结果过多,已截断`)),1)):T(``,!0)]),(w(!0),d(g,null,h(M.value,e=>(w(),d(`div`,{key:e.path,class:`content-hit`},[l(`div`,{class:`content-hit-file`,title:e.relPath,onClick:t=>Tn(e,e.matches[0]?.line)},[(w(),d(`svg`,It,[l(`use`,{"xlink:href":`#${u(ve)(e.name)}`},null,8,Lt)])),l(`span`,Rt,s(e.name),1),l(`span`,zt,s(e.dir),1),l(`span`,Bt,s(e.total),1)],8,Ft),(w(!0),d(g,null,h(e.matches,t=>(w(),d(`div`,{key:`${e.path}:${t.line}`,class:`content-hit-line`,title:u(D)(`@EDITOR:点击跳到该行`),onClick:n=>Tn(e,t.line)},[l(`span`,Ht,s(t.line),1),l(`span`,Ut,[(w(!0),d(g,null,h(wn(t.text),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,Wt,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))])],8,Vt))),128))]))),128))],64)):T(``,!0)],8,At)):T(``,!0),!U.value&&(Cn.value||C.value.length===0)?(w(),d(`div`,Gt,s(Cn.value?u(D)(`@EDITOR:未找到匹配文件`):u(D)(`@EDITOR:暂无文件`)),1)):T(``,!0)]))],4),l(`div`,{class:`editor-resizer`,onMousedown:sr},null,32),l(`div`,qt,[l(`div`,Jt,[(w(!0),d(g,null,h(L.value,e=>(w(),d(`div`,{key:e.path,class:p([`editor-tab`,{active:R.value===e.path,dirty:e.isDirty}]),onClick:t=>R.value=e.path,title:e.path},[l(`span`,Xt,s(e.name),1),e.isDirty?(w(),d(`span`,Zt)):T(``,!0),l(`button`,{class:`tab-close`,onClick:t=>An(e.path,t)},[...n[26]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Qt)],10,Yt))),128)),n[29]||=l(`div`,{class:`editor-tabs-spacer`},null,-1),Vr.value?(w(),d(`button`,{key:0,class:p([`preview-toggle-btn`,{active:J.value}]),title:J.value?u(D)(`@EDITOR:关闭预览`):u(D)(`@EDITOR:打开预览`),onClick:Wr},[n[27]||=l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0`}),l(`path`,{d:`M21 12c-2.4 4-5.4 6-9 6c-3.6 0-6.6-2-9-6c2.4-4 5.4-6 9-6c3.6 0 6.6 2 9 6`})],-1),l(`span`,null,s(u(D)(`@EDITOR:预览`)),1)],10,$t)):T(``,!0),Ur.value?(w(),d(`button`,{key:1,class:p([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!Ur.value}]),disabled:!Ur.value,title:Ur.value?Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:打开思维导图`):u(D)(`@EDITOR:需要至少一个 # 标题`),onClick:Gr},[n[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" xmlns="http://www.w3.org/2000/svg" data-v-2b76e179><path d="M8 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M20 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M8 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M20 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M14 12a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M7.5 7.5l3 3" data-v-2b76e179></path><path d="M7.5 16.5l3-3" data-v-2b76e179></path><path d="M13.5 13.5l3 3" data-v-2b76e179></path><path d="M16.5 7.5l-3 3" data-v-2b76e179></path></svg>`,1),l(`span`,null,s(u(D)(`@EDITOR:思维导图`)),1)],10,en)):T(``,!0)]),L.value.length===0?(w(),r(ye,{key:0,class:`editor-empty`,title:u(D)(`@EDITOR:从左侧选择文件打开`),hint:u(D)(`@EDITOR:Ctrl+S 保存`)},{icon:ie(()=>[...n[30]||=[l(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),l(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):T(``,!0),l(`div`,tn,[l(`div`,{class:p([`monaco-container`,{hidden:L.value.length===0||Rr.value||zr.value||Br.value}]),ref_key:`editorContainerRef`,ref:Rn},null,2),Br.value&&X.value?(w(),r(He,{key:X.value.path,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):T(``,!0),Rr.value&&L.value.length>0&&!J.value&&!Y.value?(w(),d(`div`,nn,[(w(),d(`svg`,rn,[...n[31]||=[l(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),l(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),l(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),l(`p`,an,s(X.value?.name),1),l(`p`,on,s(u(D)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:2,class:`preview-resizer`,onMousedown:li},null,32)):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:3,class:`preview-panel`,style:a(Kr.value)},[l(`div`,sn,[l(`span`,cn,s(Y.value?u(D)(`@EDITOR:思维导图`):u(D)(`@EDITOR:预览`)),1),l(`span`,ln,s(Z.value.toUpperCase()),1),n[33]||=l(`div`,{class:`preview-header-spacer`},null,-1),l(`button`,{class:`preview-close-btn`,title:Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:关闭预览`),onClick:n[8]||=e=>Y.value?Y.value=!1:J.value=!1},[...n[32]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,un)]),l(`div`,dn,[Xr.value?(w(),d(`div`,fn,[l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`md`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制 Markdown 源码`),onClick:ei},[n[34]||=l(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),l(`span`,null,s($.value===`md`?u(D)(`@EDITOR:已复制`):`Markdown`),1)],10,pn),l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`html`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:ti},[n[35]||=l(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),l(`span`,null,s($.value===`html`?u(D)(`@EDITOR:已复制`):`HTML`),1)],10,mn),l(`button`,{class:p([`preview-copy-btn preview-copy-btn--primary`,{done:$.value===`rich`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:ri},[n[36]||=l(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),l(`span`,null,s(Q.value?u(D)(`@EDITOR:转换图片中…`):$.value===`rich`?u(D)(`@EDITOR:已复制`):u(D)(`@EDITOR:复制富文本`)),1)],10,hn),l(`label`,{class:`preview-copy-embed`,title:u(D)(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[_(l(`input`,{"onUpdate:modelValue":n[9]||=e=>Jr.value=e,type:`checkbox`},null,512),[[ae,Jr.value]]),l(`span`,null,s(u(D)(`@EDITOR:图片转 Base64`)),1)],8,gn)])):T(``,!0),Y.value&&Z.value===`md`&&X.value?(w(),r(Ge,{key:1,content:X.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Z.value===`md`&&X.value?(w(),r(Oe,{ref_key:`mdPreviewRef`,ref:qr,key:X.value.path,content:X.value.content,"base-path":X.value.path,class:`preview-markdown`},null,8,[`content`,`base-path`])):J.value&&[`html`,`htm`,`svg`].includes(Z.value)?(w(),d(`iframe`,{key:3,class:`preview-iframe`,sandbox:u(De),srcdoc:ii.value},null,8,_n)):J.value&&u(Ir).has(Z.value)&&X.value?(w(),r(xe,{key:4,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):J.value&&zr.value&&X.value?(w(),r(we,{key:5,"file-path":X.value.path},null,8,[`file-path`])):T(``,!0)])],4)):T(``,!0)])])],512),(w(),r(ce,{to:`body`},[K.value?(w(),d(`div`,{key:0,ref_key:`ctxMenuRef`,ref:vr,class:`ctx-menu`,style:a({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:n[10]||=ne(()=>{},[`stop`])},[l(`button`,{class:`ctx-menu-item`,onClick:br},[n[37]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:xr},[n[38]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件夹`)),1)]),n[45]||=l(`div`,{class:`ctx-menu-sep`},null,-1),l(`button`,{class:`ctx-menu-item`,onClick:kr},[n[39]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667-2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1-2.667 2.667h-8.666a2.667 2.667 0 0 1-2.667-2.667l0-8.666`}),l(`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1-1.012-1.737v-10c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1`})],-1),b(` `+s(u(D)(`@EDITOR:复制绝对路径`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Ar},[n[40]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M9 15l6-6`}),l(`path`,{d:`M11 6l.463-.536a5 5 0 0 1 7.071 7.072l-.534.464`}),l(`path`,{d:`M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0a4.972 4.972 0 0 1 0-7.071l.524-.463`})],-1),b(` `+s(u(D)(`@EDITOR:复制相对路径`)),1)]),n[46]||=l(`div`,{class:`ctx-menu-sep`},null,-1),Nr.value?(w(),d(`button`,{key:0,class:`ctx-menu-item`,onClick:Pr},[n[41]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0`}),l(`path`,{d:`M3.6 9h16.8`}),l(`path`,{d:`M3.6 15h16.8`}),l(`path`,{d:`M11.5 3a17 17 0 0 0 0 18`}),l(`path`,{d:`M12.5 3a17 17 0 0 1 0 18`})],-1),b(` `+s(u(D)(`@EDITOR:在浏览器中打开`)),1)])):T(``,!0),l(`button`,{class:`ctx-menu-item`,onClick:Er},[n[42]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M5 19l2.757-7.351a1 1 0 0 1 .936-.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1-1.964 1.625h-14.026a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2`})],-1),b(` `+s(u(D)(`@EDITOR:在资源管理器中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:jr},[e(le,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),b(` `+s(u(D)(`@EDITOR:在 VSCode 中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Sr},[n[43]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 7h-1a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1`}),l(`path`,{d:`M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97l-8.415 8.385v3h3l8.385-8.415`}),l(`path`,{d:`M16 5l3 3`})],-1),b(` `+s(u(D)(`@EDITOR:重命名`)),1)]),l(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Tr},[n[44]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M4 7l16 0`}),l(`path`,{d:`M10 11l0 6`}),l(`path`,{d:`M14 11l0 6`}),l(`path`,{d:`M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12`}),l(`path`,{d:`M9 7v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`})],-1),b(` `+s(u(D)(`@EDITOR:删除`)),1)])],4)):T(``,!0)]))],64))}}),[[`__scopeId`,`data-v-2b76e179`]]);export{Cn as default};
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,Cn as r,Gn as i,Gr as a,In as o,Jr as s,Mn as c,On as ee,Sn as l,Sr as u,Tn as d,Un as f,Ur as p,W as m,Yn as h,_n as g,_r as te,ar as _,gn as ne,gr as v,hn as re,i as y,ir as ie,kn as b,ln as ae,lr as x,nr as S,on as C,pn as oe,qn as w,r as se,wn as T,xn as E,yn as ce}from"./element-plus-CN9J6t-d.js";import{n as D,t as O}from"./_plugin-vue_export-helper-PJOlbt_0.js";import{t as le}from"./SvgIcon-Coxq3TGz.js";import{t as ue}from"./configStore-ByUSd24J.js";import{a as de,c as fe,i as pe,n as me,o as he,r as ge,s as _e}from"./monaco-irXl5Eu9.js";import{r as k,t as A}from"./flow-mindmap-CyZrdnd4.js";import{_t as ve,c as ye,ct as be,dt as xe,ft as Se,gt as j,ht as Ce,lt as we,mt as Te,pt as Ee,st as De,ut as Oe,vt as ke,w as Ae}from"./index-BTEGKhWc.js";function je(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,json:`json`,jsonc:`json`,md:`markdown`,markdown:`markdown`,yaml:`yaml`,yml:`yaml`,toml:`ini`,xml:`xml`,svg:`xml`,sh:`shell`,bash:`shell`,zsh:`shell`,fish:`shell`,ps1:`powershell`,py:`python`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,rb:`ruby`,php:`php`,c:`c`,cpp:`cpp`,h:`cpp`,cs:`csharp`,sql:`sql`,graphql:`graphql`,gql:`graphql`,txt:`plaintext`,log:`plaintext`,ini:`ini`,env:`ini`,gitignore:`ini`,dockerfile:`dockerfile`}[e.toLowerCase()]??`plaintext`}o(),x(),t();var M=[`data-media-kind`,`data-media-path`],Me={class:`media-preview-stage`},Ne={key:0,class:`media-preview-error`},N={class:`media-preview-error-title`},Pe={class:`media-preview-error-path`},Fe=[`src`],P={key:1,class:`media-preview-audio`},Ie=[`title`],Le=[`src`],Re={key:2,class:`media-preview-loading`},ze={class:`media-preview-footer`},Be={class:`media-preview-meta`},Ve=[`title`],He=O(c({__name:`MediaPreview`,props:{filePath:{},fileName:{}},setup(e){let t=e,n=E(()=>Ce(t.filePath)??`audio`),r=E(()=>j(t.filePath)),i=E(()=>t.fileName||t.filePath.split(/[\\/]/).pop()||``),a=v(!0),o=v(!1),c=v(0),f=v(0),p=v(0),m=v(0);async function h(){try{let e=await(await fetch(`/api/editor/file?path=${encodeURIComponent(t.filePath)}&meta=1`)).json();e?.success&&typeof e.size==`number`&&(f.value=e.size)}catch{}}S(()=>t.filePath,()=>{a.value=!0,o.value=!1,c.value=0,f.value=0,p.value=0,m.value=0,h()},{immediate:!0});function te(e){let t=e.target;Number.isFinite(t.duration)&&t.duration>0&&(c.value=t.duration),t instanceof HTMLVideoElement&&(p.value=t.videoWidth,m.value=t.videoHeight),a.value=!1}function _(){a.value=!1}function ne(){a.value=!1,o.value=!0}function re(e){if(!Number.isFinite(e)||e<=0)return`--:--`;let t=Math.floor(e),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),a=String(r).padStart(2,`0`);return i>0?`${i}:${a}:${String(n).padStart(2,`0`)}`:`${r}:${String(n).padStart(2,`0`)}`}function y(e){return!e||e<0?``:e>=1073741824?`${(e/1024/1024/1024).toFixed(2)} GB`:e>=1048576?`${(e/1024/1024).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} B`}let ie=E(()=>{let e=[n.value===`video`?D(`@EDITOR:视频`):D(`@EDITOR:音频`)];c.value>0&&e.push(re(c.value)),p.value>0&&m.value>0&&e.push(`${p.value} × ${m.value}`);let t=y(f.value);return t&&e.push(t),e.join(` · `)});return(e,c)=>(w(),d(`div`,{class:`media-preview`,"data-media-kind":n.value,"data-media-path":t.filePath},[l(`div`,Me,[o.value?(w(),d(`div`,Ne,[c[0]||=l(`svg`,{viewBox:`0 0 24 24`,width:`40`,height:`40`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.4`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`circle`,{cx:`12`,cy:`12`,r:`9`}),l(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`13`}),l(`line`,{x1:`12`,y1:`16.5`,x2:`12`,y2:`16.6`})],-1),l(`p`,N,s(u(D)(`@EDITOR:无法播放该文件,可能是编码或格式不受支持`)),1),l(`p`,Pe,s(t.filePath),1)])):(w(),d(g,{key:1},[n.value===`video`?(w(),d(`video`,{key:t.filePath,class:`media-preview-video`,src:r.value,controls:``,playsinline:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Fe)):(w(),d(`div`,P,[c[1]||=ee(`<div class="media-preview-glyph" aria-hidden="true" data-v-f05d705f><svg viewBox="0 0 24 24" width="46" height="46" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-f05d705f><path d="M3 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0" data-v-f05d705f></path><path d="M9 17v-13h10v13" data-v-f05d705f></path><path d="M9 8h10" data-v-f05d705f></path></svg></div>`,1),l(`p`,{class:`media-preview-title`,title:t.filePath},s(i.value),9,Ie),(w(),d(`audio`,{key:t.filePath,class:`media-preview-audio-el`,src:r.value,controls:``,preload:`metadata`,onLoadedmetadata:te,onCanplay:_,onError:ne},null,40,Le))])),a.value?(w(),d(`div`,Re,[c[2]||=l(`span`,{class:`media-preview-spinner`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在载入媒体文件…`)),1)])):T(``,!0)],64))]),l(`div`,ze,[l(`span`,Be,s(ie.value),1),n.value===`video`?(w(),d(`span`,{key:0,class:`media-preview-name`,title:t.filePath},s(i.value),9,Ve)):T(``,!0)])],8,M))}}),[[`__scopeId`,`data-v-f05d705f`]]);o(),x();var Ue={class:`mindmap-preview`},We={class:`mindmap-preview-canvas`},Ge=O(c({__name:`MindmapPreview`,props:{content:{}},setup(t){let n=t,r=E(()=>A(n.content||``,`未命名文档`));return(t,n)=>(w(),d(`div`,Ue,[n[0]||=l(`div`,{class:`mindmap-preview-header`},[l(`span`,{class:`mindmap-preview-title`},`整篇导图`),l(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),l(`div`,We,[e(u(k),{data:r.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]),Ke=1080,qe=6e5,Je=.86;function F(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 I(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 Ye(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>Ke||e.length>qe)){r(e);return}try{let t=Math.min(1,Ke/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`,Je))}catch{r(e)}},i.onerror=()=>{clearTimeout(a),r(e)},i.src=e})}async function Xe(e){let t=await I(e);return t?Ye(t):null}async function Ze(e){let t=Array.from(e.querySelectorAll(`img`)).filter(e=>F(e.getAttribute(`src`)||``)),n=0;return await Promise.all(t.map(async e=>{let t=await Xe(e.getAttribute(`src`)||``);t?e.setAttribute(`src`,t):n+=1})),n}function Qe(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}var $e={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 et(e){e.querySelectorAll(`*`).forEach(e=>{let t=$e[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 tt(e,t){let n=e.cloneNode(!0),r=t?await Ze(n):0;return{html:n.innerHTML,leftover:r}}async function nt(e,t){let n=e.cloneNode(!0),r=t.inline?await Ze(n):0;et(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;">${Qe(i)}</h1>`:``}${n.innerHTML}</section>`,leftover:r}}o(),x(),t(),C();var rt={class:`sidebar-header`},it={class:`sidebar-title`},at={class:`sidebar-actions`},ot={class:`sidebar-search`},st=[`placeholder`,`title`],ct=[`title`,`aria-label`],lt={key:0,class:`sidebar-tree`},ut={key:0,class:`search-section-head`},dt={key:1,class:`tree-arrow-spacer`},ft={class:`tree-icon mit-icon`,"aria-hidden":`true`},pt=[`xlink:href`],mt=[`onClick`,`onContextmenu`],ht={key:1,class:`tree-arrow-spacer`},gt={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},_t=[`xlink:href`],vt={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},yt=[`xlink:href`],bt=[`title`],xt={key:0,class:`tree-name-hit`},St={key:4,class:`tree-loading`},Ct={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)`}},wt={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)`}},Tt=[`placeholder`],Et={key:1,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},Dt={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)`}},Ot={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)`}},kt=[`placeholder`],At=[`data-query`],jt={key:0,class:`content-results-status`},Mt={class:`search-section-head`},Nt={class:`search-section-count`},Pt={key:0,class:`search-section-note`},Ft=[`title`,`onClick`],It={class:`tree-icon mit-icon`,"aria-hidden":`true`},Lt=[`xlink:href`],Rt={class:`content-hit-name`},zt={class:`content-hit-dir`},Bt={class:`content-hit-total`},Vt=[`title`,`onClick`],Ht={class:`content-hit-ln`},Ut={class:`content-hit-text`},Wt={key:0,class:`content-hit-mark`},Gt={key:3,class:`tree-empty`},Kt={key:1,class:`sidebar-loading`},qt={class:`editor-main`},Jt={class:`editor-tabs`},Yt=[`onClick`,`title`],Xt={class:`tab-name`},Zt={key:0,class:`tab-dirty-dot`},Qt=[`onClick`],$t=[`title`],en=[`disabled`,`title`],tn={class:`editor-body`},nn={key:1,class:`image-tab-placeholder`},rn={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`}},an={class:`image-tab-placeholder-title`},on={class:`image-tab-placeholder-hint`},sn={class:`preview-header`},cn={class:`preview-title`},ln={class:`preview-ext-badge`},un=[`title`],dn={class:`preview-body`},fn={key:0,class:`preview-copybar`},pn=[`disabled`,`title`],mn=[`disabled`,`title`],hn=[`disabled`,`title`],gn=[`title`],_n=[`sandbox`,`srcdoc`],vn=2,yn=6e4,bn=3e4,xn=300,Sn=320,Cn=O(c({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new _e:t===`css`||t===`scss`||t===`less`?new he:t===`html`||t===`handlebars`||t===`razor`?new de:t===`typescript`||t===`javascript`?new pe:new fe}};let o=t,c=ue(),x=Ae(),C=v([]),O=v(!1),k=v(``),A=v(``),j=null;function Ce(){k.value=``,A.value=``,j&&=(clearTimeout(j),null)}S(k,e=>{j&&clearTimeout(j),j=setTimeout(()=>{A.value=e,j=null},180)});let M=v([]),Me=v(0),Ne=v(``),N=v(!1),Pe=v(!1),Fe=null,P=0;function Ie(){Fe?.abort(),Fe=null,P+=1,M.value=[],Me.value=0,Ne.value=``,N.value=!1,Pe.value=!1}async function Le(e){let t=e.trim(),n=c.currentDirectory;if(!n||t.length<vn){Ie();return}if(t===Ne.value&&N.value)return;Fe?.abort();let r=++P,i=new AbortController;Fe=i,N.value=!0,Ne.value=t;try{let e=await(await fetch(`/api/search_content`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n,query:t}),signal:i.signal})).json().catch(()=>null);if(r!==P)return;if(!e?.success){M.value=[],Me.value=0,Pe.value=!1;return}M.value=Array.isArray(e.files)?e.files:[],Me.value=typeof e.totalMatches==`number`?e.totalMatches:0,Pe.value=!!e.truncated}catch(e){if(e?.name===`AbortError`||r!==P)return;M.value=[],Me.value=0,Pe.value=!1}finally{r===P&&(N.value=!1)}}S(A,e=>{Le(e)}),f(()=>{j&&clearTimeout(j),Fe?.abort(),Be(),Qn()});let Re=null;function ze(){Be(),c.ui.fileTreeAutoRefresh&&(Re=setInterval(()=>{document.hidden||c.currentDirectory&&(k.value.trim()||F())},yn))}function Be(){Re&&=(clearInterval(Re),null)}S(()=>c.currentDirectory,async()=>{if(Pn=!1,Ie(),ze(),await Ue(),L.value.some(e=>e.isDirty)){Pn=!0;return}L.value=[],R.value=null,Bn(),await Ln()}),S(()=>c.ui.fileTreeAutoRefresh,()=>{ze()});async function Ve(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 Ue(){let e=c.currentDirectory;if(e){O.value=!0;try{C.value=await Ve(e,0)}finally{O.value=!1}}}function We(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&We(n.children,t));return t}function Ke(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=Ke(e.children,t+1),n.expanded=!0),n})}async function qe(e){let t=c.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:Ke(n.items,0)}catch{return null}}function Je(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)?Je(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function F(e={}){if(!c.currentDirectory)return;let t=await qe([...We(C.value)]);if(!t){e.notifyOnError&&y.error(D(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Je(C.value,t)&&(C.value=t)}async function I(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ve(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function Ye(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...Ye(n.children));return t}let Xe=E(()=>A.value.trim().toLowerCase());function Ze(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.name.toLowerCase().includes(t);if(r.type===`directory`){let i=r.children?Ze(r.children,t):[];if(!e&&i.length===0)continue;n.push({...r,expanded:!0,children:r.children===void 0?void 0:i})}else e&&n.push(r)}return n}function Qe(e,t){for(let n of e){if(n.path===t)return n;if(n.children){let e=Qe(n.children,t);if(e)return e}}return null}let $e=E(()=>Ze(C.value,Xe.value)),et=E(()=>Xe.value.length>0&&$e.value.length===0),Cn=E(()=>et.value&&M.value.length===0&&!N.value);function wn(e){let t=A.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}async function Tn(e,t){if(await kn({name:e.name,path:e.path,type:`file`,depth:0}),!t||t<1)return;await n();let r=B.value;r&&r.getModel()&&jn()?.path===e.path&&(r.revealLineInCenter(t,ge.ScrollType.Smooth),r.setPosition({lineNumber:t,column:1}),r.focus())}let En=v(null);function Dn(){let e=En.value;e&&(e.focus(),e.select())}function On(){k.value?(Ce(),En.value?.focus()):(En.value?.blur(),B.value?.focus())}let L=v([]),R=v(null),z=v(null);async function kn(e){if(z.value=e,e.type!==`file`){I(Qe(C.value,e.path)??e);return}let t=L.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:L.value.length}),t){R.value=e.path,n(()=>Hn());return}let r=e.name.split(`.`).pop()||``;if(Te.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null};L.value.push(t),R.value=e.path;return}if(Ir.has(r.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};L.value.push(t),R.value=e.path,J.value=!0;return}if(Ee(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};L.value.push(t),R.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),n=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:n}),!n.success){y.error(`${D(`@EDITOR:打开文件失败: `)}${n.error}`);return}let i=je(r),a=V.get(e.path);a&&!a.isDisposed()&&a.setValue(n.content);let o={path:e.path,name:e.name,content:n.content,originalContent:n.content,isDirty:!1,language:i,diskMtimeMs:typeof n.mtimeMs==`number`?n.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),L.value.push(o),R.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,L.value.length,`activeTabPath=`,R.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),y.error(`${D(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await n();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await kn({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function An(e,t){t.stopPropagation();let n=L.value.findIndex(t=>t.path===e);n!==-1&&(!L.value[n].isDirty||confirm(D(`@EDITOR:文件未保存,确认关闭?`)))&&(L.value.splice(n,1),R.value===e&&(R.value=L.value[Math.min(n,L.value.length-1)]?.path??null))}let jn=()=>L.value.find(e=>e.path===R.value)??null,Mn=E(()=>({expandedDirs:[...We(C.value)],tabs:L.value.map(e=>e.path),activeTab:R.value})),Nn=!1,Pn=!1;function Fn(){Pn&&!Nn&&c.isUiLoaded&&c.saveEditorWorkspace(Mn.value)}S(Mn,()=>Fn());async function In(e){if(L.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(Te.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`media`,diskMtimeMs:null});return}if(Ir.has(n)){L.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(Ee(t)){L.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=V.get(e);i&&!i.isDisposed()&&B.value?.getModel()!==i&&(i.dispose(),V.delete(e)),L.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:je(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function Ln(){try{for(let e=0;e<100&&!c.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!c.isUiLoaded)return;rr.value=c.ui.editorSidebarWidth;let e=c.getEditorWorkspace();if(!e)return;Nn=!0;try{if(e.expandedDirs.length>0){let t=await qe(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await In(t);if(!o.pendingFilePath&&e.activeTab&&L.value.some(t=>t.path===e.activeTab)){R.value=e.activeTab;let t=jn(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(Ir.has(n)||Ee(t.name))&&(J.value=!0)}}finally{Nn=!1}}finally{Pn=!0,Fn()}}let Rn=v(null),B=te(null),V=new Map;function zn(e){let t=V.get(e.path);return(!t||t.isDisposed())&&(t=ge.createModel(e.content,e.language,me.file(e.path)),V.set(e.path,t)),t}function Bn(){B.value?.setModel(null);for(let e of V.values())e.isDisposed()||e.dispose();V.clear()}function Vn(){if(!Rn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;B.value=ge.create(Rn.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}),B.value.onDidChangeModelContent(()=>{let e=jn();if(!e)return;let t=B.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),B.value.onDidBlurEditorText(()=>{c.ui.editorAutoSave&&jn()?.isDirty&&tr(!1),requestAnimationFrame(()=>{if(!H.value||H.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`))||Hn()})})}S(R,e=>{if(!B.value||!e)return;let t=L.value.find(t=>t.path===e);if(!t)return;let r=zn(t);B.value.setModel(r),n(()=>Hn()),Jn(e)});function Hn(){if(!B.value)return;B.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let Un=0,Wn=new Map;async function Gn(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 Kn(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 qn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=V.get(e.path);if(!r||r.isDisposed())return;let i=B.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 Jn(e){if(!e)return;let t=L.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++Un,r=await Gn(e);if(n!==Un||L.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(Wn.get(e)===r.mtimeMs)return;Wn.set(e,r.mtimeMs);try{await se.confirm(D(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),D(`@EDITOR:文件已被外部改动`),{confirmButtonText:D(`@EDITOR:重新加载`),cancelButtonText:D(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await Kn(e);i&&L.value.find(t=>t.path===e)===t&&qn(t,i.content,i.mtimeMs)}function Yn(){document.hidden||Jn(R.value)}let Xn=null;function Zn(){Qn(),Xn=setInterval(()=>{document.hidden||Jn(R.value)},bn)}function Qn(){Xn&&=(clearInterval(Xn),null)}S(()=>L.value.filter(e=>e.isDirty).length,e=>{x.setDirtyCount(e)},{immediate:!0}),S(R,e=>{let t=L.value.find(t=>t.path===e)??null;x.setActiveFile(t?.path??``,t?.name??``)},{immediate:!0}),f(()=>x.setDirtyCount(0)),Se(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;ge.setTheme(e?`vs-dark`:`vs`)});let $n=null;function er(){if($n||!H.value)return;let e=[H.value],t=H.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}$n=new MutationObserver(()=>{H.value&&H.value.offsetParent!==null&&R.value&&B.value&&(Jn(R.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`))||Hn()}))});let n=$n;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}i(async()=>{Vn(),await Ue(),await Ln(),er(),ze(),window.addEventListener(`focus`,Yn),document.addEventListener(`visibilitychange`,Yn),Zn(),R.value&&n(()=>Hn())}),f(()=>{$n?.disconnect(),$n=null,window.removeEventListener(`focus`,Yn),document.removeEventListener(`visibilitychange`,Yn),B.value?.dispose(),V.forEach(e=>e.dispose()),V.clear()});async function tr(e=!1){let t=jn();if(t&&!(Rr.value||zr.value||Br.value))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){y.error(`${D(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||y.success(D(`@EDITOR:已保存`))}catch(e){y.error(`${D(`@EDITOR:保存失败: `)}${e.message}`)}}function nr(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Dn();return}t&&e.key===`s`&&(e.preventDefault(),tr())}i(()=>window.addEventListener(`keydown`,nr)),f(()=>window.removeEventListener(`keydown`,nr));let H=v(null),rr=v(c.ui.editorSidebarWidth),ir=!1,ar=0,or=0;function sr(e){ir=!0,ar=e.clientX,or=rr.value,document.addEventListener(`mousemove`,cr),document.addEventListener(`mouseup`,lr),e.preventDefault()}function cr(e){if(!ir)return;let t=e.clientX-ar;rr.value=Math.max(140,Math.min(400,or+t))}function lr(){ir=!1,document.removeEventListener(`mousemove`,cr),document.removeEventListener(`mouseup`,lr),rr.value!==c.ui.editorSidebarWidth&&c.setEditorSidebarWidth(rr.value)}function ur(e){return e.type===`directory`?ke(e.name):ve(e.name)}let U=v(null),W=v(null),G=v(null),dr=v(null);function fr(){let e=z.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(/[\\/][^\\/]+$/,``):c.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:c.currentDirectory??``,afterNode:null,depth:0}}async function pr(){let e=fr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`file`,value:``},await n(),G.value?.focus()}async function mr(){let e=fr();z.value?.type===`directory`&&!z.value.expanded&&await I(z.value),U.value={...e,kind:`directory`,value:``},await n(),G.value?.focus()}function hr(){U.value=null}async function gr(){let e=U.value;if(!e||!e.value.trim()){U.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){y.error(e.error);return}y.success(D(`@EDITOR:创建成功`))}else{let e=await(await fetch(`/api/editor/directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:n})})).json();if(!e.success){y.error(e.error);return}y.success(D(`@EDITOR:创建成功`))}U.value=null,await F()}function _r(e){e.key===`Enter`&&(e.preventDefault(),gr()),e.key===`Escape`&&(e.preventDefault(),hr())}let K=v(null),vr=v(null);function yr(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function br(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=fr();U.value={...t,kind:`file`,value:``},await n(),G.value?.focus()}async function xr(){let e=K.value?.node;q(),e&&(z.value=e),e?.type===`directory`&&!e.expanded&&await I(e);let t=fr();U.value={...t,kind:`directory`,value:``},await n(),G.value?.focus()}async function Sr(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await n(),dr.value?.focus(),dr.value?.select())}async function Cr(){let e=W.value;if(!e||!e.value.trim()||e.value.trim()===e.node.name){W.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){y.error(r.error);return}let i=L.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,R.value===e.node.path&&(R.value=n)),W.value=null,await F()}function wr(e){e.key===`Enter`&&(e.preventDefault(),Cr()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Tr(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?D(`@EDITOR:文件夹`):D(`@EDITOR:文件`);if(!confirm(`${D(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){y.error(n.error);return}let r=L.value.findIndex(t=>t.path===e.path);r!==-1&&(L.value.splice(r,1),R.value===e.path&&(R.value=L.value[Math.max(0,r-1)]?.path??null)),y.success(D(`@EDITOR:已删除`)),await F()}async function Er(){let e=K.value?.node;if(q(),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||y.error(t.error)}catch(e){y.error(e?.message||String(e))}}function Dr(e){let t=c.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 Or(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 kr(){let e=K.value?.node;q(),e&&(await Or(e.path)?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`)))}async function Ar(){let e=K.value?.node;q(),e&&(await Or(Dr(e.path))?y.success(D(`@EDITOR:已复制到剪贴板`)):y.error(D(`@EDITOR:复制失败`)))}async function jr(){let e=K.value?.node;if(q(),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||y.error(t.error||D(`@EDITOR:VSCode 未安装`))}catch(e){y.error(e?.message||String(e))}}let Mr=new Set([`html`,`htm`]),Nr=E(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Mr.has(t)});async function Pr(){let e=K.value?.node;if(q(),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||y.error(t.error||D(`@EDITOR:浏览器打开失败`))}catch(e){y.error(e?.message||String(e))}}i(()=>{document.addEventListener(`click`,q)}),f(()=>{document.removeEventListener(`click`,q)});let Fr=new Set([`md`,`html`,`htm`,`svg`]),Ir=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),Lr=v(0),X=E(()=>L.value.find(e=>e.path===R.value)??null),Rr=E(()=>X.value?.language===`plaintext`&&X.value?.content===``),zr=E(()=>X.value?.language===`office`),Br=E(()=>X.value?.language===`media`),Z=E(()=>(X.value?.name??``).split(`.`).pop()?.toLowerCase()??``),Vr=E(()=>Fr.has(Z.value)||Ir.has(Z.value)||Ee(Z.value)),Hr=E(()=>((X.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),Ur=E(()=>Z.value===`md`&&Hr.value>0);S(R,()=>{J.value&&!Vr.value&&(J.value=!1),Y.value&&!Ur.value&&(Y.value=!1)});function Wr(){Vr.value&&(J.value||(Y.value=!1),J.value=!J.value)}function Gr(){Ur.value&&(Y.value||(J.value=!1),Y.value=!Y.value)}let Kr=E(()=>Lr.value<=0||L.value.length===0?{flexBasis:`0px`}:{flex:`0 0 ${Lr.value}px`,maxWidth:`calc(100% - 320px)`}),qr=v(null),Q=v(!1),$=v(``),Jr=v(!0),Yr=null,Xr=E(()=>!Y.value&&J.value&&Z.value===`md`&&!!X.value);function Zr(){return X.value?.content??``}function Qr(){return Zr().match(/^\s*#\s+(.+?)\s*(?:\r?\n|$)/)?.[1]?.trim()??``}function $r(e,t,n){if(!e){y.error(D(`@EDITOR:复制失败`));return}$.value=n,Yr&&clearTimeout(Yr),Yr=setTimeout(()=>{$.value=``},1800),t>0?y.warning(D(`@EDITOR:{n} 张图片未能转成 Base64,已保留原地址`,{n:t})):y.success(D(`@EDITOR:已复制`))}async function ei(){$r(await Or(Zr()),0,`md`)}async function ti(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await tt(e,Jr.value);$r(await Or(t),n,`html`)}finally{Q.value=!1}}}function ni(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 ri(){let e=qr.value?.getRenderedElement();if(e){Q.value=!0;try{let{html:t,leftover:n}=await nt(e,{inline:Jr.value,title:Qr()}),r=Zr(),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||=ni(t),$r(i,n,`rich`)}finally{Q.value=!1}}}let ii=E(()=>{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`?be(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>`:``}),ai=!1,oi=0,si=0,ci=0;function li(e){let t=e.currentTarget,n=t.parentElement;if(!n)return;let r=n.getBoundingClientRect(),i=t.getBoundingClientRect();ai=!0,oi=e.clientX,si=r.right-i.right,ci=Math.max(xn,r.width-Sn),document.addEventListener(`mousemove`,ui),document.addEventListener(`mouseup`,di),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,e.preventDefault()}function ui(e){if(!ai)return;let t=oi-e.clientX;Lr.value=Math.round(Math.max(xn,Math.min(ci,si+t)))}function di(){ai=!1,document.removeEventListener(`mousemove`,ui),document.removeEventListener(`mouseup`,di),document.body.style.cursor=``,document.body.style.userSelect=``}return(t,n)=>(w(),d(g,null,[l(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:H},[l(`div`,{class:`editor-sidebar`,style:a({width:rr.value+`px`})},[l(`div`,rt,[l(`span`,it,s(u(D)(`@EDITOR:资源管理器`)),1),l(`div`,at,[e(u(m),{content:u(D)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:pr},[...n[11]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:mr},[...n[12]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1)]])]),_:1},8,[`content`]),e(u(m),{content:u(D)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:ie(()=>[l(`button`,{class:`sidebar-action-btn`,onClick:n[0]||=e=>F({notifyOnError:!0})},[...n[13]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M20 11a8.1 8.1 0 0 0-15.5-2m-.5-4v4h4`}),l(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})],-1)]])]),_:1},8,[`content`])])]),l(`div`,ot,[n[15]||=l(`svg`,{class:`sidebar-search-icon`,viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`circle`,{cx:`11`,cy:`11`,r:`7`}),l(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),_(l(`input`,{ref_key:`searchInputRef`,ref:En,"onUpdate:modelValue":n[1]||=e=>k.value=e,type:`text`,class:`sidebar-search-input`,placeholder:u(D)(`@EDITOR:搜索文件名或内容...`),title:u(D)(`@EDITOR:搜索文件名或内容...`),spellcheck:`false`,autocomplete:`off`,onKeydown:re(On,[`escape`])},null,40,st),[[oe,k.value]]),k.value?(w(),d(`button`,{key:0,class:`sidebar-search-clear`,title:u(D)(`@EDITOR:清除搜索`),"aria-label":u(D)(`@EDITOR:清除搜索`),onClick:Ce},[...n[14]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,ct)):T(``,!0)]),O.value?(w(),d(`div`,Kt,[...n[25]||=[l(`span`,{class:`spin-icon`},null,-1)]])):(w(),d(`div`,lt,[Xe.value&&$e.value.length>0?(w(),d(`div`,ut,s(u(D)(`@EDITOR:名称匹配`)),1)):T(``,!0),(w(!0),d(g,null,h(Ye($e.value),e=>(w(),d(g,{key:e.path},[W.value&&W.value.node.path===e.path?(w(),d(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+e.depth*14+`px`})},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[16]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,dt)),(w(),d(`svg`,ft,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,pt)])),_(l(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:dr,"onUpdate:modelValue":n[2]||=e=>W.value.value=e,onKeydown:wr,onBlur:Cr,onClick:n[3]||=ne(()=>{},[`stop`])},null,544),[[oe,W.value.value]])],4)):(w(),d(`div`,{key:1,class:p([`tree-node`,{"tree-node--dir":e.type===`directory`,"tree-node--file":e.type===`file`,"tree-node--active":R.value===e.path,"tree-node--selected":z.value?.path===e.path&&R.value!==e.path}]),style:a({paddingLeft:12+e.depth*14+`px`}),onClick:t=>kn(e),onContextmenu:t=>yr(t,e)},[e.type===`directory`?(w(),d(`span`,{key:0,class:p([`tree-arrow`,{expanded:e.expanded}])},[...n[17]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(w(),d(`span`,ht)),e.type===`directory`?(w(),d(`svg`,gt,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,_t)])):(w(),d(`svg`,vt,[l(`use`,{"xlink:href":`#${ur(e)}`},null,8,yt)])),l(`span`,{class:`tree-name`,title:e.path},[(w(!0),d(g,null,h(wn(e.name),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,xt,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))],8,bt),e.loading?(w(),d(`span`,St)):T(``,!0)],46,mt)),U.value&&U.value.afterNode?.path===e.path?(w(),d(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:a({paddingLeft:12+U.value.depth*14+`px`})},[n[20]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,Ct,[...n[18]||=[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(w(),d(`svg`,wt,[...n[19]||=[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:_r,onBlur:hr,onClick:n[5]||=ne(()=>{},[`stop`])},null,40,Tt),[[oe,U.value.value]])],4)):T(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(w(),d(`div`,Et,[n[23]||=l(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(w(),d(`svg`,Dt,[...n[21]||=[l(`path`,{d:`M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z`},null,-1)]])):(w(),d(`svg`,Ot,[...n[22]||=[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`},null,-1),l(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),_(l(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":n[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?u(D)(`@EDITOR:输入文件名`):u(D)(`@EDITOR:输入文件夹名`),onKeydown:_r,onBlur:hr,onClick:n[7]||=ne(()=>{},[`stop`])},null,40,kt),[[oe,U.value.value]])])):T(``,!0),Xe.value?(w(),d(`div`,{key:2,class:`content-results`,"data-query":Ne.value},[N.value?(w(),d(`div`,jt,[n[24]||=l(`span`,{class:`content-search-spin`},null,-1),l(`span`,null,s(u(D)(`@EDITOR:正在搜索文件内容...`)),1)])):M.value.length>0?(w(),d(g,{key:1},[l(`div`,Mt,[l(`span`,null,s(u(D)(`@EDITOR:内容匹配`)),1),l(`span`,Nt,s(Me.value),1),Pe.value?(w(),d(`span`,Pt,s(u(D)(`@EDITOR:结果过多,已截断`)),1)):T(``,!0)]),(w(!0),d(g,null,h(M.value,e=>(w(),d(`div`,{key:e.path,class:`content-hit`},[l(`div`,{class:`content-hit-file`,title:e.relPath,onClick:t=>Tn(e,e.matches[0]?.line)},[(w(),d(`svg`,It,[l(`use`,{"xlink:href":`#${u(ve)(e.name)}`},null,8,Lt)])),l(`span`,Rt,s(e.name),1),l(`span`,zt,s(e.dir),1),l(`span`,Bt,s(e.total),1)],8,Ft),(w(!0),d(g,null,h(e.matches,t=>(w(),d(`div`,{key:`${e.path}:${t.line}`,class:`content-hit-line`,title:u(D)(`@EDITOR:点击跳到该行`),onClick:n=>Tn(e,t.line)},[l(`span`,Ht,s(t.line),1),l(`span`,Ut,[(w(!0),d(g,null,h(wn(t.text),(e,t)=>(w(),d(g,{key:t},[e.hit?(w(),d(`span`,Wt,s(e.text),1)):(w(),d(g,{key:1},[b(s(e.text),1)],64))],64))),128))])],8,Vt))),128))]))),128))],64)):T(``,!0)],8,At)):T(``,!0),!U.value&&(Cn.value||C.value.length===0)?(w(),d(`div`,Gt,s(Cn.value?u(D)(`@EDITOR:未找到匹配文件`):u(D)(`@EDITOR:暂无文件`)),1)):T(``,!0)]))],4),l(`div`,{class:`editor-resizer`,onMousedown:sr},null,32),l(`div`,qt,[l(`div`,Jt,[(w(!0),d(g,null,h(L.value,e=>(w(),d(`div`,{key:e.path,class:p([`editor-tab`,{active:R.value===e.path,dirty:e.isDirty}]),onClick:t=>R.value=e.path,title:e.path},[l(`span`,Xt,s(e.name),1),e.isDirty?(w(),d(`span`,Zt)):T(``,!0),l(`button`,{class:`tab-close`,onClick:t=>An(e.path,t)},[...n[26]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Qt)],10,Yt))),128)),n[29]||=l(`div`,{class:`editor-tabs-spacer`},null,-1),Vr.value?(w(),d(`button`,{key:0,class:p([`preview-toggle-btn`,{active:J.value}]),title:J.value?u(D)(`@EDITOR:关闭预览`):u(D)(`@EDITOR:打开预览`),onClick:Wr},[n[27]||=l(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0-4 0`}),l(`path`,{d:`M21 12c-2.4 4-5.4 6-9 6c-3.6 0-6.6-2-9-6c2.4-4 5.4-6 9-6c3.6 0 6.6 2 9 6`})],-1),l(`span`,null,s(u(D)(`@EDITOR:预览`)),1)],10,$t)):T(``,!0),Ur.value?(w(),d(`button`,{key:1,class:p([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!Ur.value}]),disabled:!Ur.value,title:Ur.value?Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:打开思维导图`):u(D)(`@EDITOR:需要至少一个 # 标题`),onClick:Gr},[n[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" xmlns="http://www.w3.org/2000/svg" data-v-2b76e179><path d="M8 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M20 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M8 6a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M20 18a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M14 12a2 2 0 1 0-4 0a2 2 0 0 0 4 0" data-v-2b76e179></path><path d="M7.5 7.5l3 3" data-v-2b76e179></path><path d="M7.5 16.5l3-3" data-v-2b76e179></path><path d="M13.5 13.5l3 3" data-v-2b76e179></path><path d="M16.5 7.5l-3 3" data-v-2b76e179></path></svg>`,1),l(`span`,null,s(u(D)(`@EDITOR:思维导图`)),1)],10,en)):T(``,!0)]),L.value.length===0?(w(),r(ye,{key:0,class:`editor-empty`,title:u(D)(`@EDITOR:从左侧选择文件打开`),hint:u(D)(`@EDITOR:Ctrl+S 保存`)},{icon:ie(()=>[...n[30]||=[l(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[l(`path`,{d:`M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z`}),l(`polyline`,{points:`14 2 14 8 20 8`})],-1)]]),_:1},8,[`title`,`hint`])):T(``,!0),l(`div`,tn,[l(`div`,{class:p([`monaco-container`,{hidden:L.value.length===0||Rr.value||zr.value||Br.value}]),ref_key:`editorContainerRef`,ref:Rn},null,2),Br.value&&X.value?(w(),r(He,{key:X.value.path,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):T(``,!0),Rr.value&&L.value.length>0&&!J.value&&!Y.value?(w(),d(`div`,nn,[(w(),d(`svg`,rn,[...n[31]||=[l(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),l(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),l(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),l(`p`,an,s(X.value?.name),1),l(`p`,on,s(u(D)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:2,class:`preview-resizer`,onMousedown:li},null,32)):T(``,!0),(J.value||Y.value)&&L.value.length>0?(w(),d(`div`,{key:3,class:`preview-panel`,style:a(Kr.value)},[l(`div`,sn,[l(`span`,cn,s(Y.value?u(D)(`@EDITOR:思维导图`):u(D)(`@EDITOR:预览`)),1),l(`span`,ln,s(Z.value.toUpperCase()),1),n[33]||=l(`div`,{class:`preview-header-spacer`},null,-1),l(`button`,{class:`preview-close-btn`,title:Y.value?u(D)(`@EDITOR:关闭思维导图`):u(D)(`@EDITOR:关闭预览`),onClick:n[8]||=e=>Y.value?Y.value=!1:J.value=!1},[...n[32]||=[l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[l(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),l(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,un)]),l(`div`,dn,[Xr.value?(w(),d(`div`,fn,[l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`md`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制 Markdown 源码`),onClick:ei},[n[34]||=l(`span`,{class:`preview-copy-btn-icon`},`{ }`,-1),l(`span`,null,s($.value===`md`?u(D)(`@EDITOR:已复制`):`Markdown`),1)],10,pn),l(`button`,{class:p([`preview-copy-btn`,{done:$.value===`html`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制渲染后的 HTML(图片按开关内嵌)`),onClick:ti},[n[35]||=l(`span`,{class:`preview-copy-btn-icon`},`</>`,-1),l(`span`,null,s($.value===`html`?u(D)(`@EDITOR:已复制`):`HTML`),1)],10,mn),l(`button`,{class:p([`preview-copy-btn preview-copy-btn--primary`,{done:$.value===`rich`}]),disabled:Q.value,title:u(D)(`@EDITOR:复制为富文本,可直接粘贴到公众号编辑器`),onClick:ri},[n[36]||=l(`span`,{class:`preview-copy-btn-icon`},`⊞`,-1),l(`span`,null,s(Q.value?u(D)(`@EDITOR:转换图片中…`):$.value===`rich`?u(D)(`@EDITOR:已复制`):u(D)(`@EDITOR:复制富文本`)),1)],10,hn),l(`label`,{class:`preview-copy-embed`,title:u(D)(`@EDITOR:复制时把本地图片转成 Base64 内嵌,关闭后保留原图地址`)},[_(l(`input`,{"onUpdate:modelValue":n[9]||=e=>Jr.value=e,type:`checkbox`},null,512),[[ae,Jr.value]]),l(`span`,null,s(u(D)(`@EDITOR:图片转 Base64`)),1)],8,gn)])):T(``,!0),Y.value&&Z.value===`md`&&X.value?(w(),r(Ge,{key:1,content:X.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Z.value===`md`&&X.value?(w(),r(Oe,{ref_key:`mdPreviewRef`,ref:qr,key:X.value.path,content:X.value.content,"base-path":X.value.path,class:`preview-markdown`},null,8,[`content`,`base-path`])):J.value&&[`html`,`htm`,`svg`].includes(Z.value)?(w(),d(`iframe`,{key:3,class:`preview-iframe`,sandbox:u(De),srcdoc:ii.value},null,8,_n)):J.value&&u(Ir).has(Z.value)&&X.value?(w(),r(xe,{key:4,"file-path":X.value.path,"file-name":X.value.name},null,8,[`file-path`,`file-name`])):J.value&&zr.value&&X.value?(w(),r(we,{key:5,"file-path":X.value.path},null,8,[`file-path`])):T(``,!0)])],4)):T(``,!0)])])],512),(w(),r(ce,{to:`body`},[K.value?(w(),d(`div`,{key:0,ref_key:`ctxMenuRef`,ref:vr,class:`ctx-menu`,style:a({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:n[10]||=ne(()=>{},[`stop`])},[l(`button`,{class:`ctx-menu-item`,onClick:br},[n[37]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),l(`path`,{d:`M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2`}),l(`path`,{d:`M12 11l0 6`}),l(`path`,{d:`M9 14l6 0`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:xr},[n[38]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M12 19h-7a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v3.5`}),l(`path`,{d:`M16 19h6`}),l(`path`,{d:`M19 16v6`})],-1),b(` `+s(u(D)(`@EDITOR:新建文件夹`)),1)]),n[45]||=l(`div`,{class:`ctx-menu-sep`},null,-1),l(`button`,{class:`ctx-menu-item`,onClick:kr},[n[39]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667-2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1-2.667 2.667h-8.666a2.667 2.667 0 0 1-2.667-2.667l0-8.666`}),l(`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1-1.012-1.737v-10c0-1.1.9-2 2-2h10c.75 0 1.158.385 1.5 1`})],-1),b(` `+s(u(D)(`@EDITOR:复制绝对路径`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Ar},[n[40]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M9 15l6-6`}),l(`path`,{d:`M11 6l.463-.536a5 5 0 0 1 7.071 7.072l-.534.464`}),l(`path`,{d:`M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0a4.972 4.972 0 0 1 0-7.071l.524-.463`})],-1),b(` `+s(u(D)(`@EDITOR:复制相对路径`)),1)]),n[46]||=l(`div`,{class:`ctx-menu-sep`},null,-1),Nr.value?(w(),d(`button`,{key:0,class:`ctx-menu-item`,onClick:Pr},[n[41]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0`}),l(`path`,{d:`M3.6 9h16.8`}),l(`path`,{d:`M3.6 15h16.8`}),l(`path`,{d:`M11.5 3a17 17 0 0 0 0 18`}),l(`path`,{d:`M12.5 3a17 17 0 0 1 0 18`})],-1),b(` `+s(u(D)(`@EDITOR:在浏览器中打开`)),1)])):T(``,!0),l(`button`,{class:`ctx-menu-item`,onClick:Er},[n[42]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M5 19l2.757-7.351a1 1 0 0 1 .936-.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1-1.964 1.625h-14.026a2 2 0 0 1-2-2v-11a2 2 0 0 1 2-2h4l3 3h7a2 2 0 0 1 2 2v2`})],-1),b(` `+s(u(D)(`@EDITOR:在资源管理器中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:jr},[e(le,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),b(` `+s(u(D)(`@EDITOR:在 VSCode 中打开`)),1)]),l(`button`,{class:`ctx-menu-item`,onClick:Sr},[n[43]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M7 7h-1a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-1`}),l(`path`,{d:`M20.385 6.585a2.1 2.1 0 0 0-2.97-2.97l-8.415 8.385v3h3l8.385-8.415`}),l(`path`,{d:`M16 5l3 3`})],-1),b(` `+s(u(D)(`@EDITOR:重命名`)),1)]),l(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Tr},[n[44]||=l(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,xmlns:`http://www.w3.org/2000/svg`},[l(`path`,{d:`M4 7l16 0`}),l(`path`,{d:`M10 11l0 6`}),l(`path`,{d:`M14 11l0 6`}),l(`path`,{d:`M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12`}),l(`path`,{d:`M9 7v-3a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v3`})],-1),b(` `+s(u(D)(`@EDITOR:删除`)),1)])],4)):T(``,!0)]))],64))}}),[[`__scopeId`,`data-v-2b76e179`]]);export{Cn as default};
@@ -1 +1 @@
1
- import{An as e,Bn as t,In as n,Kn as r,Mn as i,Pn as a,Sr as o,Tn as s,fr as c,ir as l,lr as u,nr as d,qn as f,xn as p}from"./element-plus-CN9J6t-d.js";import{n as m,t as h}from"./_plugin-vue_export-helper-B3dZvHQf.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-NLvet82_.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-CkXLP8y4.js";n(),u();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(i({__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(n){function u(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=i({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>a(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:u(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(e){return i({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(t){let n=p(()=>{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()=>a(x,{id:t.id,nodeId:t.id,nodeType:t.data?.type,title:t.data?.label,icon:u(t.data?.type),enabled:t.data?.enabled,selected:t.data?.selected,execStatus:t.data?.execStatus,sourceHandleIds:t.data?.type===`condition`?n.value:void 0,deletable:!1},{default:()=>a(e,{data:t.data,id:t.id})})}})}let j={start:c(h),command:c(A(E)),wait:c(A(w)),version:c(A(b)),confirm:c(A(S)),code:c(A(T)),condition:c(A(C)),user_input:c(A(D))},M=n,{onPaneReady:N}=_({id:k}),P=null,F=null;async function I(e){if(e){if(!P){F=e;return}for(let n=0;n<6;n+=1){if(await t(),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;d(()=>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))}),r(()=>{L&&=(window.clearTimeout(L),null)});let R=p(()=>{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=p(()=>{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(t,n)=>(f(),s(`div`,O,[e(o(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:l(()=>[e(o(g)),e(o(v))]),_:1},8,[`nodes`,`edges`])]))}}),[[`__scopeId`,`data-v-d2ccb36e`]]);export{A as default};
1
+ import{An as e,Bn as t,In as n,Kn as r,Mn as i,Pn as a,Sr as o,Tn as s,fr as c,ir as l,lr as u,nr as d,qn as f,xn as p}from"./element-plus-CN9J6t-d.js";import{n as m,t as h}from"./_plugin-vue_export-helper-PJOlbt_0.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-NLvet82_.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-C_znv4Pn.js";n(),u();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(i({__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(n){function u(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=i({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>a(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:u(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(e){return i({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(t){let n=p(()=>{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()=>a(x,{id:t.id,nodeId:t.id,nodeType:t.data?.type,title:t.data?.label,icon:u(t.data?.type),enabled:t.data?.enabled,selected:t.data?.selected,execStatus:t.data?.execStatus,sourceHandleIds:t.data?.type===`condition`?n.value:void 0,deletable:!1},{default:()=>a(e,{data:t.data,id:t.id})})}})}let j={start:c(h),command:c(A(E)),wait:c(A(w)),version:c(A(b)),confirm:c(A(S)),code:c(A(T)),condition:c(A(C)),user_input:c(A(D))},M=n,{onPaneReady:N}=_({id:k}),P=null,F=null;async function I(e){if(e){if(!P){F=e;return}for(let n=0;n<6;n+=1){if(await t(),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;d(()=>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))}),r(()=>{L&&=(window.clearTimeout(L),null)});let R=p(()=>{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=p(()=>{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(t,n)=>(f(),s(`div`,O,[e(o(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:l(()=>[e(o(g)),e(o(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{A as t,An as n,Ar as r,Bn as i,C as a,Cn as o,Ct as s,Dt as c,Et as l,F as ee,Ft as u,G as d,Gn as f,Ht as p,I as m,In as h,J as te,Jn as g,Jr as _,K as v,Kn as ne,Ln as re,M as y,Mn as b,Mt as ie,N as ae,Pn as x,Qt as S,Rt as oe,S as C,Sn as w,Sr as T,Tn as E,U as se,Ur as ce,W as le,Xn as D,Yn as O,_n as k,bt as ue,c as de,ct as fe,fr as A,gn as j,gr as M,i as N,ir as P,it as F,kn as I,l as L,lr as R,m as z,nr as B,on as pe,qn as V,r as me,st as he,ut as ge,w as _e,wn as H,x as U,xn as W,y as ve,yt as G,z as ye}from"./element-plus-CN9J6t-d.js";import{b as be}from"./vendor-Bs5KA16r.js";import{n as K,t as q}from"./_plugin-vue_export-helper-B3dZvHQf.js";import{t as xe}from"./dagre-JTV5zPzI.js";import{t as Se}from"./SvgIcon-XBkgNKCj.js";import{t as J}from"./configStore-HDlssep1.js";import{t as Ce}from"./CommonDialog-Qg_owAyQ.js";import{i as we,l as Te,n as Ee,s as De}from"./vue-flow-NLvet82_.js";import{St as Y,l as Oe}from"./index-CAWXBaPa.js";import{a as ke,c as Ae,i as X,n as je,o as Me,r as Ne,s as Pe,t as Fe}from"./UserInputNode-CkXLP8y4.js";var Ie=e(xe(),1);h(),R();var Z=b({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let r=e,i=t,s=M(!1);function c(e){e===`executeFrom`?i(`execute-from-node`,r.nodeId):e===`executeSingle`&&i(`execute-single-node`,r.nodeId)}return(e,t)=>{let r=te,i=a,l=_e,ee=C;return V(),o(ee,{trigger:`contextmenu`,onCommand:c,onVisibleChange:t[0]||=e=>s.value=e,"popper-class":`flow-node-dropdown`},{dropdown:P(()=>[n(l,null,{default:P(()=>[n(i,{command:`executeFrom`},{default:P(()=>[n(r,null,{default:P(()=>[n(T(S))]),_:1}),t[1]||=I(` 从此处开始执行 `,-1)]),_:1}),n(i,{command:`executeSingle`},{default:P(()=>[n(r,null,{default:P(()=>[n(T(S))]),_:1}),t[2]||=I(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:P(()=>[D(e.$slots,`default`,{dropdownVisible:s.value})]),_:3})}}});h(),R(),r();var Le={class:`package-json-selector`},Re={class:`selector-container`},ze={class:`option-content`},Be={class:`option-main`},Ve={class:`package-name`},He={class:`option-path`},Q={key:0,class:`empty-hint`},Ue=q(b({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,i=t,a=M(!1),s=M([]),l=M(``),u=W({get:()=>r.modelValue,set:e=>{l.value=e,i(`update:modelValue`,e);let t=s.value.find(t=>t.fullPath===e);i(`change`,t||null)}}),d=W(()=>s.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function f(e){a.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){s.value=r.packages||[],u.value&&!s.value.some(e=>e.fullPath===u.value)&&(u.value=``);let t=e?`目录 ${e}`:`当前项目`;N.success(`扫描 ${t} 完成,找到 ${s.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),N.error(`扫描失败: ${e.message}`),s.value=[]}finally{a.value=!1}}async function p(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?h(e):e.error&&N.error(e.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}}function h(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){N.warning(`请输入目录路径`);return}g(e)};me.alert(x(`div`,{class:`directory-browser`},[x(`div`,{class:`current-path`},[x(`span`,{class:`path-label`},`当前路径:`),x(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),x(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),x(`div`,{class:`directory-list`},[e.parentPath?x(`div`,{class:`directory-item parent-dir`,onClick:()=>g(e.parentPath)},[x(`span`,{class:`dir-icon`},x(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[x(`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`})])),x(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>x(`div`,{class:`directory-item`,onClick:()=>g(e.path)},[x(`span`,{class:`dir-icon`},x(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[x(`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`})])),x(`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){N.warning(`请输入目录路径`);return}f(n)}}})}async function g(e){try{me.close(),setTimeout(async()=>{try{let t=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:e})})).json();t.success?h(t):t.error&&N.error(t.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){N.error(`处理目录选择时出错: ${e.message}`)}}return f(),B(()=>r.modelValue,e=>{l.value=e},{immediate:!0}),(t,r)=>{let i=te,l=ee,h=m,g=ye,v=L;return V(),E(`div`,Le,[w(`div`,Re,[n(h,{modelValue:u.value,"onUpdate:modelValue":r[0]||=e=>u.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||a.value,filterable:``,class:`package-select`},{default:P(()=>[(V(!0),E(k,null,O(d.value,e=>(V(),o(l,{key:e.value,label:e.label,value:e.value},{default:P(()=>[w(`div`,ze,[w(`div`,Be,[n(i,{class:`folder-icon`},{default:P(()=>[n(T(ue))]),_:1}),w(`span`,Ve,_(e.label),1)]),w(`div`,He,_(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),n(g,{icon:a.value?T(c):T(oe),loading:a.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>f(),class:`refresh-btn`,title:`刷新当前项目`},{default:P(()=>[I(_(a.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),n(g,{icon:T(G),disabled:e.disabled||a.value,size:`default`,onClick:p,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:P(()=>[...r[2]||=[I(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),s.value.length===0&&!a.value?(V(),E(`div`,Q,[n(v,{type:`info`,size:`small`},{default:P(()=>[...r[3]||=[I(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):H(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);h(),r(),R();var $={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=q(b({__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,i=t,a=W(()=>Array.isArray(r.modelValue)?r.modelValue:[]);function s(){if(!r.addable||r.disableAdd)return;let e=r.createItem;if(!e)return;let t=[...a.value,e()];i(`update:modelValue`,t),i(`add`)}function c(e){if(!r.removable)return;let t=typeof r.minItems==`number`?r.minItems:0;if(a.value.length<=t)return;let n=a.value[e];if(r.disableRemove&&r.disableRemove(n,e))return;let o=[...a.value];o.splice(e,1),i(`update:modelValue`,o),i(`remove`,e)}function l(e,t){return r.itemKey?r.itemKey(e,t):t}return(t,r)=>{let i=ye;return V(),E(`div`,$,[e.title!==void 0||e.addable?(V(),E(`div`,We,[e.title?(V(),E(`span`,Ge,_(e.title),1)):H(``,!0),w(`div`,Ke,[D(t.$slots,`title-actions`,{},void 0,!0),e.addable?(V(),o(i,{key:0,type:`primary`,plain:``,icon:T(u),disabled:e.disableAdd||!e.createItem,onClick:s},null,8,[`icon`,`disabled`])):H(``,!0)])])):H(``,!0),a.value.length===0?(V(),E(`div`,qe,[D(t.$slots,`empty`,{},void 0,!0)])):(V(),E(`div`,Je,[(V(!0),E(k,null,O(a.value,(r,o)=>(V(),E(`div`,{key:l(r,o),class:ce([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[w(`div`,Ye,[D(t.$slots,`row`,{item:r,index:o},void 0,!0)]),e.removable?(V(),E(`div`,Xe,[n(i,{type:`danger`,plain:``,icon:T(fe),disabled:typeof e.minItems==`number`&&a.value.length<=e.minItems||(e.disableRemove?e.disableRemove(r,o):!1),onClick:e=>c(o)},null,8,[`icon`,`disabled`,`onClick`])])):H(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);h(),R(),r();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=q(b({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=M([]);B(()=>r.modelValue,e=>{a.value=e?[...e]:[]},{immediate:!0,deep:!0}),B(()=>r.paramNames,e=>{if(!e||e.length===0){a.value=[],i(`update:modelValue`,[]);return}let t=new Map(a.value.map(e=>[e.paramName,e])),n=[];for(let r of e)t.has(r)?n.push(t.get(r)):n.push({paramName:r,inputType:`manual`,required:!1,manualValue:``});a.value=n,i(`update:modelValue`,n)},{immediate:!0});function s(e,t,n){if(!a.value[e])return;let r=[...a.value];r[e]={...r[e],[t]:n},t===`inputType`&&(n===`manual`?(r[e].referenceNodeId=void 0,r[e].referenceOutputKey=void 0):r[e].manualValue=void 0),a.value=r,i(`update:modelValue`,r)}function c(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@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 d=W(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:c(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(e,t){if(!t)return;let[n,r]=t.split(`::`),o=[...a.value];o[e]={...o[e],referenceNodeId:n,referenceOutputKey:r},a.value=o,i(`update:modelValue`,o)}function p(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,r)=>{let i=se,c=ee,u=m,h=te,g=de,v=z;return V(),E(`div`,Qe,[n(Ze,{"model-value":a.value,title:void 0,addable:!1,removable:!1},{empty:P(()=>[I(_(T(K)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:P(({item:t,index:r})=>[w(`div`,$e,[w(`div`,et,[w(`label`,tt,_(T(K)(`@NODEINPUT:参数名`)),1),n(i,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:T(K)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>s(r,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),w(`div`,nt,[w(`label`,rt,_(T(K)(`@NODEINPUT:类型`)),1),n(u,{"model-value":t.inputType,placeholder:T(K)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>s(r,`inputType`,e)},{default:P(()=>[n(c,{value:`manual`,label:T(K)(`@NODEINPUT:手动输入`)},null,8,[`label`]),n(c,{value:`reference`,label:T(K)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),w(`div`,it,[w(`label`,at,_(T(K)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(V(),o(i,{key:0,"model-value":t.manualValue,placeholder:T(K)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>s(r,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(V(),o(g,{key:1,"model-value":p(t),data:d.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>f(r,e)},{default:P(({data:e})=>[w(`span`,ot,[e.children?H(``,!0):(V(),o(h,{key:0},{default:P(()=>[n(T(l))]),_:1})),I(` `+_(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,st,[w(`label`,ct,_(T(K)(`@NODEINPUT:必填`)),1),n(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>s(r,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);h(),R(),r();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=q(b({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=M([]);B(()=>i.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function c(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function l(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@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 u=W(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:c(e),children:l(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function d(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function f(){let e=[...s.value,d()];s.value=e,a(`update:modelValue`,e)}t({addRow:f});function p(e,t){if(!s.value[e])return;let n=[...s.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`}))),s.value=n,a(`update:modelValue`,n)}function h(e,t){if(!t)return;let[n,r]=t.split(`::`);p(e,{ref:{nodeId:n,outputKey:r}})}function te(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let i=se,c=ee,l=m,f=de,g=z;return V(),E(`div`,ut,[n(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":d,"onUpdate:modelValue":r[0]||=e=>a(`update:modelValue`,e)},{empty:P(()=>[I(_(T(K)(`@NODECFG:暂无输入参数`)),1)]),row:P(({item:t,index:r})=>[w(`div`,dt,[w(`div`,ft,[w(`label`,pt,_(T(K)(`@NODECFG:参数名`)),1),n(i,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>p(r,{name:e})],placeholder:T(K)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),w(`div`,mt,[w(`label`,ht,_(T(K)(`@NODECFG:参数值`)),1),n(l,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>p(r,{source:e})],style:{width:`110px`}},{default:P(()=>[n(c,{label:T(K)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),n(c,{label:T(K)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),w(`div`,gt,[w(`label`,_t,_(T(K)(`@NODECFG:值`)),1),t.source===`manual`?(V(),o(i,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>p(r,{manualValue:e})],placeholder:T(K)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(V(),o(f,{key:1,"model-value":te(t),data:u.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>h(r,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,vt,[w(`label`,yt,_(T(K)(`@NODEINPUT:必填`)),1),n(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>p(r,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b16df1ae`]]);h(),R(),r();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=q(b({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=M([]);B(()=>i.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function c(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function u(){let e=[...s.value,c()];s.value=e,a(`update:modelValue`,e)}t({addRow:u});function d(e,t){if(!s.value[e])return;let n=[...s.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`}))),s.value=n,a(`update:modelValue`,n)}function f(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:用户输入`):e.data.label||e.id}function p(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@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=W(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:f(e),children:p(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(e,t){if(!t)return;let[n,r]=t.split(`::`);d(e,{ref:{nodeId:n,outputKey:r}})}function v(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let f=se,p=ee,ne=m,re=te,y=de,b=z,ie=ye;return V(),E(`div`,xt,[n(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":c,"onUpdate:modelValue":r[0]||=e=>a(`update:modelValue`,e)},{empty:P(()=>[I(_(T(K)(`@UINPUT:暂无输入参数`)),1)]),row:P(({item:e,index:t})=>[w(`div`,St,[w(`div`,Ct,[w(`label`,wt,_(T(K)(`@UINPUT:参数名`)),1),n(f,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>d(t,{name:e})],placeholder:T(K)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),w(`div`,Tt,[w(`label`,Et,_(T(K)(`@UINPUT:类型`)),1),n(ne,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>d(t,{source:e})],style:{width:`130px`}},{default:P(()=>[n(p,{label:T(K)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),n(p,{label:T(K)(`@UINPUT:引用`),value:`reference`,disabled:!i.predecessorNodes||i.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),w(`div`,Dt,[w(`label`,Ot,_(e.source===`manual`?T(K)(`@UINPUT:默认值`):T(K)(`@UINPUT:引用输出`)),1),e.source===`manual`?(V(),o(f,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>d(t,{defaultValue:e})],placeholder:T(K)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(V(),o(y,{key:1,"model-value":v(e),data:h.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:P(({data:e})=>[w(`span`,kt,[e.children?H(``,!0):(V(),o(re,{key:0},{default:P(()=>[n(T(l))]),_:1})),I(` `+_(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,At,[w(`label`,jt,_(T(K)(`@NODEINPUT:必填`)),1),n(b,{"model-value":!!e.required,"onUpdate:modelValue":e=>d(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:P(()=>[e.addable===!1?H(``,!0):(V(),o(ie,{key:0,type:`primary`,plain:``,size:`small`,onClick:u},{default:P(()=>[I(_(T(K)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);h(),R(),r();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{A as t,An as n,Ar as r,Bn as i,C as a,Cn as o,Ct as s,Dt as c,Et as l,F as ee,Ft as u,G as d,Gn as f,Ht as p,I as m,In as h,J as te,Jn as g,Jr as _,K as v,Kn as ne,Ln as re,M as y,Mn as b,Mt as ie,N as ae,Pn as x,Qt as S,Rt as oe,S as C,Sn as w,Sr as T,Tn as E,U as se,Ur as ce,W as le,Xn as D,Yn as O,_n as k,bt as ue,c as de,ct as fe,fr as A,gn as j,gr as M,i as N,ir as P,it as F,kn as I,l as L,lr as R,m as z,nr as B,on as pe,qn as V,r as me,st as he,ut as ge,w as _e,wn as H,x as U,xn as W,y as ve,yt as G,z as ye}from"./element-plus-CN9J6t-d.js";import{b as be}from"./vendor-Bs5KA16r.js";import{n as K,t as q}from"./_plugin-vue_export-helper-PJOlbt_0.js";import{t as xe}from"./dagre-JTV5zPzI.js";import{t as Se}from"./SvgIcon-Coxq3TGz.js";import{t as J}from"./configStore-ByUSd24J.js";import{t as Ce}from"./CommonDialog-C0zTwqdL.js";import{i as we,l as Te,n as Ee,s as De}from"./vue-flow-NLvet82_.js";import{St as Y,l as Oe}from"./index-BTEGKhWc.js";import{a as ke,c as Ae,i as X,n as je,o as Me,r as Ne,s as Pe,t as Fe}from"./UserInputNode-C_znv4Pn.js";var Ie=e(xe(),1);h(),R();var Z=b({__name:`NodeContextMenu`,props:{nodeId:{}},emits:[`execute-from-node`,`execute-single-node`],setup(e,{emit:t}){let r=e,i=t,s=M(!1);function c(e){e===`executeFrom`?i(`execute-from-node`,r.nodeId):e===`executeSingle`&&i(`execute-single-node`,r.nodeId)}return(e,t)=>{let r=te,i=a,l=_e,ee=C;return V(),o(ee,{trigger:`contextmenu`,onCommand:c,onVisibleChange:t[0]||=e=>s.value=e,"popper-class":`flow-node-dropdown`},{dropdown:P(()=>[n(l,null,{default:P(()=>[n(i,{command:`executeFrom`},{default:P(()=>[n(r,null,{default:P(()=>[n(T(S))]),_:1}),t[1]||=I(` 从此处开始执行 `,-1)]),_:1}),n(i,{command:`executeSingle`},{default:P(()=>[n(r,null,{default:P(()=>[n(T(S))]),_:1}),t[2]||=I(` 只执行此节点 `,-1)]),_:1})]),_:1})]),default:P(()=>[D(e.$slots,`default`,{dropdownVisible:s.value})]),_:3})}}});h(),R(),r();var Le={class:`package-json-selector`},Re={class:`selector-container`},ze={class:`option-content`},Be={class:`option-main`},Ve={class:`package-name`},He={class:`option-path`},Q={key:0,class:`empty-hint`},Ue=q(b({__name:`PackageJsonSelector`,props:{modelValue:{},placeholder:{},clearable:{type:Boolean},disabled:{type:Boolean}},emits:[`update:modelValue`,`change`],setup(e,{emit:t}){let r=e,i=t,a=M(!1),s=M([]),l=M(``),u=W({get:()=>r.modelValue,set:e=>{l.value=e,i(`update:modelValue`,e);let t=s.value.find(t=>t.fullPath===e);i(`change`,t||null)}}),d=W(()=>s.value.map(e=>({label:e.displayName,value:e.fullPath,relativePath:e.relativePath,version:e.version})));async function f(e){a.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){s.value=r.packages||[],u.value&&!s.value.some(e=>e.fullPath===u.value)&&(u.value=``);let t=e?`目录 ${e}`:`当前项目`;N.success(`扫描 ${t} 完成,找到 ${s.value.length} 个 package.json 文件`)}else throw Error(r.error||`扫描失败`)}catch(e){console.error(`扫描package.json文件失败:`,e),N.error(`扫描失败: ${e.message}`),s.value=[]}finally{a.value=!1}}async function p(){try{let e=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:``})})).json();e.success?h(e):e.error&&N.error(e.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}}function h(e){if(!e||!e.items)return;let t=String(e.path||``),n=()=>{let e=String(t||``).trim();if(!e){N.warning(`请输入目录路径`);return}g(e)};me.alert(x(`div`,{class:`directory-browser`},[x(`div`,{class:`current-path`},[x(`span`,{class:`path-label`},`当前路径:`),x(`input`,{class:`path-value`,value:t,onInput:e=>{t=e.target.value},onKeydown:e=>{e.key===`Enter`&&(e.preventDefault(),n())}}),x(`button`,{type:`button`,class:`path-jump-btn`,onClick:n},`跳转`)]),x(`div`,{class:`directory-list`},[e.parentPath?x(`div`,{class:`directory-item parent-dir`,onClick:()=>g(e.parentPath)},[x(`span`,{class:`dir-icon`},x(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-warning)`}},[x(`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`})])),x(`span`,{class:`dir-name`},`返回上级目录`)]):null,...e.items.map(e=>x(`div`,{class:`directory-item`,onClick:()=>g(e.path)},[x(`span`,{class:`dir-icon`},x(`svg`,{class:`folder-icon`,viewBox:`0 0 24 24`,width:`20`,height:`20`,style:{fill:`var(--color-primary)`}},[x(`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`})])),x(`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){N.warning(`请输入目录路径`);return}f(n)}}})}async function g(e){try{me.close(),setTimeout(async()=>{try{let t=await(await fetch(`/api/browse_directory`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentPath:e})})).json();t.success?h(t):t.error&&N.error(t.error)}catch(e){N.error(`浏览目录失败: ${e.message}`)}},100)}catch(e){N.error(`处理目录选择时出错: ${e.message}`)}}return f(),B(()=>r.modelValue,e=>{l.value=e},{immediate:!0}),(t,r)=>{let i=te,l=ee,h=m,g=ye,v=L;return V(),E(`div`,Le,[w(`div`,Re,[n(h,{modelValue:u.value,"onUpdate:modelValue":r[0]||=e=>u.value=e,placeholder:e.placeholder||`选择 package.json 文件`,clearable:e.clearable,disabled:e.disabled||a.value,filterable:``,class:`package-select`},{default:P(()=>[(V(!0),E(k,null,O(d.value,e=>(V(),o(l,{key:e.value,label:e.label,value:e.value},{default:P(()=>[w(`div`,ze,[w(`div`,Be,[n(i,{class:`folder-icon`},{default:P(()=>[n(T(ue))]),_:1}),w(`span`,Ve,_(e.label),1)]),w(`div`,He,_(e.relativePath),1)])]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`,`clearable`,`disabled`]),n(g,{icon:a.value?T(c):T(oe),loading:a.value,disabled:e.disabled,size:`default`,onClick:r[1]||=e=>f(),class:`refresh-btn`,title:`刷新当前项目`},{default:P(()=>[I(_(a.value?`扫描中...`:`刷新`),1)]),_:1},8,[`icon`,`loading`,`disabled`]),n(g,{icon:T(G),disabled:e.disabled||a.value,size:`default`,onClick:p,class:`custom-dir-btn`,title:`浏览并选择其他目录`},{default:P(()=>[...r[2]||=[I(` 其他目录 `,-1)]]),_:1},8,[`icon`,`disabled`])]),s.value.length===0&&!a.value?(V(),E(`div`,Q,[n(v,{type:`info`,size:`small`},{default:P(()=>[...r[3]||=[I(` 未找到 package.json 文件,请确保项目包含有效的 package.json `,-1)]]),_:1})])):H(``,!0)])}}}),[[`__scopeId`,`data-v-90913902`]]);h(),r(),R();var $={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=q(b({__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,i=t,a=W(()=>Array.isArray(r.modelValue)?r.modelValue:[]);function s(){if(!r.addable||r.disableAdd)return;let e=r.createItem;if(!e)return;let t=[...a.value,e()];i(`update:modelValue`,t),i(`add`)}function c(e){if(!r.removable)return;let t=typeof r.minItems==`number`?r.minItems:0;if(a.value.length<=t)return;let n=a.value[e];if(r.disableRemove&&r.disableRemove(n,e))return;let o=[...a.value];o.splice(e,1),i(`update:modelValue`,o),i(`remove`,e)}function l(e,t){return r.itemKey?r.itemKey(e,t):t}return(t,r)=>{let i=ye;return V(),E(`div`,$,[e.title!==void 0||e.addable?(V(),E(`div`,We,[e.title?(V(),E(`span`,Ge,_(e.title),1)):H(``,!0),w(`div`,Ke,[D(t.$slots,`title-actions`,{},void 0,!0),e.addable?(V(),o(i,{key:0,type:`primary`,plain:``,icon:T(u),disabled:e.disableAdd||!e.createItem,onClick:s},null,8,[`icon`,`disabled`])):H(``,!0)])])):H(``,!0),a.value.length===0?(V(),E(`div`,qe,[D(t.$slots,`empty`,{},void 0,!0)])):(V(),E(`div`,Je,[(V(!0),E(k,null,O(a.value,(r,o)=>(V(),E(`div`,{key:l(r,o),class:ce([`param-list__row`,{"param-list__row--no-actions":!e.removable}])},[w(`div`,Ye,[D(t.$slots,`row`,{item:r,index:o},void 0,!0)]),e.removable?(V(),E(`div`,Xe,[n(i,{type:`danger`,plain:``,icon:T(fe),disabled:typeof e.minItems==`number`&&a.value.length<=e.minItems||(e.disableRemove?e.disableRemove(r,o):!1),onClick:e=>c(o)},null,8,[`icon`,`disabled`,`onClick`])])):H(``,!0)],2))),128))]))])}}}),[[`__scopeId`,`data-v-8f9701ab`]]);h(),R(),r();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=q(b({__name:`NodeInputConfig`,props:{modelValue:{},paramNames:{},disableParamNameEdit:{type:Boolean},predecessorNodes:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=M([]);B(()=>r.modelValue,e=>{a.value=e?[...e]:[]},{immediate:!0,deep:!0}),B(()=>r.paramNames,e=>{if(!e||e.length===0){a.value=[],i(`update:modelValue`,[]);return}let t=new Map(a.value.map(e=>[e.paramName,e])),n=[];for(let r of e)t.has(r)?n.push(t.get(r)):n.push({paramName:r,inputType:`manual`,required:!1,manualValue:``});a.value=n,i(`update:modelValue`,n)},{immediate:!0});function s(e,t,n){if(!a.value[e])return;let r=[...a.value];r[e]={...r[e],[t]:n},t===`inputType`&&(n===`manual`?(r[e].referenceNodeId=void 0,r[e].referenceOutputKey=void 0):r[e].manualValue=void 0),a.value=r,i(`update:modelValue`,r)}function c(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function u(e){if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@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 d=W(()=>!r.predecessorNodes||r.predecessorNodes.length===0?[]:r.predecessorNodes.map(e=>({value:e.id,label:c(e),children:u(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function f(e,t){if(!t)return;let[n,r]=t.split(`::`),o=[...a.value];o[e]={...o[e],referenceNodeId:n,referenceOutputKey:r},a.value=o,i(`update:modelValue`,o)}function p(e){return e.referenceNodeId&&e.referenceOutputKey?`${e.referenceNodeId}::${e.referenceOutputKey}`:``}return(t,r)=>{let i=se,c=ee,u=m,h=te,g=de,v=z;return V(),E(`div`,Qe,[n(Ze,{"model-value":a.value,title:void 0,addable:!1,removable:!1},{empty:P(()=>[I(_(T(K)(`@NODEINPUT:命令中未检测到变量参数`)),1)]),row:P(({item:t,index:r})=>[w(`div`,$e,[w(`div`,et,[w(`label`,tt,_(T(K)(`@NODEINPUT:参数名`)),1),n(i,{"model-value":t.paramName,disabled:e.disableParamNameEdit,placeholder:T(K)(`@NODEINPUT:参数名`),size:`default`,"onUpdate:modelValue":e=>s(r,`paramName`,e)},null,8,[`model-value`,`disabled`,`placeholder`,`onUpdate:modelValue`])]),w(`div`,nt,[w(`label`,rt,_(T(K)(`@NODEINPUT:类型`)),1),n(u,{"model-value":t.inputType,placeholder:T(K)(`@NODEINPUT:选择类型`),size:`default`,"onUpdate:modelValue":e=>s(r,`inputType`,e)},{default:P(()=>[n(c,{value:`manual`,label:T(K)(`@NODEINPUT:手动输入`)},null,8,[`label`]),n(c,{value:`reference`,label:T(K)(`@NODEINPUT:引用节点`),disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`model-value`,`placeholder`,`onUpdate:modelValue`])]),w(`div`,it,[w(`label`,at,_(T(K)(`@NODEINPUT:值`)),1),t.inputType===`manual`?(V(),o(i,{key:0,"model-value":t.manualValue,placeholder:T(K)(`@NODEINPUT:输入参数值`),size:`default`,clearable:``,"onUpdate:modelValue":e=>s(r,`manualValue`,e)},null,8,[`model-value`,`placeholder`,`onUpdate:modelValue`])):(V(),o(g,{key:1,"model-value":p(t),data:d.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),size:`default`,clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>f(r,e)},{default:P(({data:e})=>[w(`span`,ot,[e.children?H(``,!0):(V(),o(h,{key:0},{default:P(()=>[n(T(l))]),_:1})),I(` `+_(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,st,[w(`label`,ct,_(T(K)(`@NODEINPUT:必填`)),1),n(v,{"model-value":!!t.required,"onUpdate:modelValue":e=>s(r,`required`,e)},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`])])}}}),[[`__scopeId`,`data-v-276799ad`]]);h(),R(),r();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=q(b({__name:`CodeNodeInputConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=M([]);B(()=>i.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function c(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.data.label||e.id}function l(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@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 u=W(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:c(e),children:l(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function d(){return{name:``,source:`reference`,required:!1,ref:{nodeId:``,outputKey:`stdout`}}}function f(){let e=[...s.value,d()];s.value=e,a(`update:modelValue`,e)}t({addRow:f});function p(e,t){if(!s.value[e])return;let n=[...s.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`}))),s.value=n,a(`update:modelValue`,n)}function h(e,t){if(!t)return;let[n,r]=t.split(`::`);p(e,{ref:{nodeId:n,outputKey:r}})}function te(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let i=se,c=ee,l=m,f=de,g=z;return V(),E(`div`,ut,[n(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":d,"onUpdate:modelValue":r[0]||=e=>a(`update:modelValue`,e)},{empty:P(()=>[I(_(T(K)(`@NODECFG:暂无输入参数`)),1)]),row:P(({item:t,index:r})=>[w(`div`,dt,[w(`div`,ft,[w(`label`,pt,_(T(K)(`@NODECFG:参数名`)),1),n(i,{modelValue:t.name,"onUpdate:modelValue":[e=>t.name=e,e=>p(r,{name:e})],placeholder:T(K)(`@NODECFG:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),w(`div`,mt,[w(`label`,ht,_(T(K)(`@NODECFG:参数值`)),1),n(l,{modelValue:t.source,"onUpdate:modelValue":[e=>t.source=e,e=>p(r,{source:e})],style:{width:`110px`}},{default:P(()=>[n(c,{label:T(K)(`@NODECFG:引用`),value:`reference`,disabled:!e.predecessorNodes||e.predecessorNodes.length===0},null,8,[`label`,`disabled`]),n(c,{label:T(K)(`@NODECFG:手动`),value:`manual`},null,8,[`label`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),w(`div`,gt,[w(`label`,_t,_(T(K)(`@NODECFG:值`)),1),t.source===`manual`?(V(),o(i,{key:0,modelValue:t.manualValue,"onUpdate:modelValue":[e=>t.manualValue=e,e=>p(r,{manualValue:e})],placeholder:T(K)(`@NODECFG:请输入`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(V(),o(f,{key:1,"model-value":te(t),data:u.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>h(r,e)},null,8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,vt,[w(`label`,yt,_(T(K)(`@NODEINPUT:必填`)),1),n(g,{"model-value":!!t.required,"onUpdate:modelValue":e=>p(r,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-b16df1ae`]]);h(),R(),r();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=q(b({__name:`UserInputParamConfig`,props:{modelValue:{},predecessorNodes:{},title:{},addable:{type:Boolean}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=M([]);B(()=>i.modelValue,e=>{s.value=Array.isArray(e)?[...e]:[]},{immediate:!0,deep:!0});function c(){return{name:``,source:`manual`,defaultValue:``,required:!1}}function u(){let e=[...s.value,c()];s.value=e,a(`update:modelValue`,e)}t({addRow:u});function d(e,t){if(!s.value[e])return;let n=[...s.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`}))),s.value=n,a(`update:modelValue`,n)}function f(e){return e.type===`command`?e.data.config?.displayName||e.data.config?.commandName||e.data.label||K(`@FLOWNODE:命令节点`):e.type===`code`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:代码节点`):e.type===`user_input`?e.data.config?.displayName||e.data.label||K(`@FLOWNODE:用户输入`):e.data.label||e.id}function p(e){if(!e)return[];if(e.type===`command`)return[{key:`stdout`,label:K(`@NODEINPUT:标准输出(stdout)`)},{key:`stderr`,label:K(`@NODEINPUT:标准错误(stderr)`)},{key:`error`,label:K(`@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=W(()=>!i.predecessorNodes||i.predecessorNodes.length===0?[]:i.predecessorNodes.map(e=>({value:e.id,label:f(e),children:p(e).map(t=>({value:`${e.id}::${t.key}`,label:t.label}))})));function g(e,t){if(!t)return;let[n,r]=t.split(`::`);d(e,{ref:{nodeId:n,outputKey:r}})}function v(e){return e.ref?.nodeId&&e.ref?.outputKey?`${e.ref.nodeId}::${e.ref.outputKey}`:``}return(t,r)=>{let f=se,p=ee,ne=m,re=te,y=de,b=z,ie=ye;return V(),E(`div`,xt,[n(Ze,{"model-value":s.value,title:e.title,addable:e.addable!==!1,removable:!0,"min-items":0,"create-item":c,"onUpdate:modelValue":r[0]||=e=>a(`update:modelValue`,e)},{empty:P(()=>[I(_(T(K)(`@UINPUT:暂无输入参数`)),1)]),row:P(({item:e,index:t})=>[w(`div`,St,[w(`div`,Ct,[w(`label`,wt,_(T(K)(`@UINPUT:参数名`)),1),n(f,{modelValue:e.name,"onUpdate:modelValue":[t=>e.name=t,e=>d(t,{name:e})],placeholder:T(K)(`@UINPUT:参数名`)},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])]),w(`div`,Tt,[w(`label`,Et,_(T(K)(`@UINPUT:类型`)),1),n(ne,{modelValue:e.source,"onUpdate:modelValue":[t=>e.source=t,e=>d(t,{source:e})],style:{width:`130px`}},{default:P(()=>[n(p,{label:T(K)(`@UINPUT:手动输入`),value:`manual`},null,8,[`label`]),n(p,{label:T(K)(`@UINPUT:引用`),value:`reference`,disabled:!i.predecessorNodes||i.predecessorNodes.length===0},null,8,[`label`,`disabled`])]),_:1},8,[`modelValue`,`onUpdate:modelValue`])]),w(`div`,Dt,[w(`label`,Ot,_(e.source===`manual`?T(K)(`@UINPUT:默认值`):T(K)(`@UINPUT:引用输出`)),1),e.source===`manual`?(V(),o(f,{key:0,modelValue:e.defaultValue,"onUpdate:modelValue":[t=>e.defaultValue=t,e=>d(t,{defaultValue:e})],placeholder:T(K)(`@UINPUT:默认值`),clearable:``},null,8,[`modelValue`,`onUpdate:modelValue`,`placeholder`])):(V(),o(y,{key:1,"model-value":v(e),data:h.value,placeholder:T(K)(`@NODEINPUT:选择节点输出`),clearable:``,filterable:``,"check-strictly":``,"render-after-expand":!1,"onUpdate:modelValue":e=>g(t,e)},{default:P(({data:e})=>[w(`span`,kt,[e.children?H(``,!0):(V(),o(re,{key:0},{default:P(()=>[n(T(l))]),_:1})),I(` `+_(e.label),1)])]),_:1},8,[`model-value`,`data`,`placeholder`,`onUpdate:modelValue`]))]),w(`div`,At,[w(`label`,jt,_(T(K)(`@NODEINPUT:必填`)),1),n(b,{"model-value":!!e.required,"onUpdate:modelValue":e=>d(t,{required:e})},null,8,[`model-value`,`onUpdate:modelValue`])])])]),actions:P(()=>[e.addable===!1?H(``,!0):(V(),o(ie,{key:0,type:`primary`,plain:``,size:`small`,onClick:u},{default:P(()=>[I(_(T(K)(`@UINPUT:添加参数`)),1)]),_:1}))]),_:1},8,[`model-value`,`title`,`addable`])])}}}),[[`__scopeId`,`data-v-dd543a6a`]]);h(),R(),r();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{An as e,Ar as t,Bn as n,Bt as r,Cn as i,D as a,F as o,Gn as s,Gr as c,I as l,In as u,J as d,Jr as f,L as ee,Mn as p,Sn as m,Sr as h,St as te,Tn as g,U as ne,Un as re,Ur as ie,W as ae,Yn as _,_n as v,_t as oe,a as se,ar as ce,f as le,ft as ue,gn as y,gr as b,hn as x,i as S,ir as C,kn as w,lr as de,mn as fe,nr as T,on as E,p as pe,qn as D,r as me,st as he,wn as O,xn as k,z as A}from"./element-plus-CN9J6t-d.js";import{n as j,t as M}from"./_plugin-vue_export-helper-B3dZvHQf.js";import{t as ge}from"./toolsStore-oZEAoHnG.js";import{t as _e}from"./CommonDialog-Qg_owAyQ.js";import{St as ve,ot as ye,xt as be,yt as xe}from"./index-CAWXBaPa.js";var N=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function P(e){return 10+e*14}function F(e){return N[e%N.length]}function I(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim();if(!e||e===`HEAD`||e.startsWith(`tag:`))continue;let r=e.match(/^HEAD\s*->\s*(.+)$/);t.push((r?r[1]:e).trim())}return t}function Se(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.hash)??new Set;for(let t of I(r.branch))e.add(t);n.set(r.hash,Array.from(e));for(let n of r.parents??[]){let r=t.get(n)??new Set;for(let t of e)r.add(t);t.set(n,r)}}return n}function Ce(e){let t=[],n=[],r=0,i=0,a=new Set(e.map(e=>e.hash)),o=e=>t.findIndex(t=>t!==null&&t.hash===e),s=()=>{let e=t.findIndex(e=>e===null);return e===-1?(t.push(null),t.length-1):e};for(let c of e){let e=Array.isArray(c.parents)?c.parents:[],l=t.slice(),u=o(c.hash),d,f=!1;u===-1?(f=!0,u=s(),d=r++):d=t[u].colorIdx,t[u]=null;let ee=[],p=new Set;for(let e=0;e<t.length;e++){let n=t[e];n!==null&&n.hash===c.hash&&(ee.push({fromLane:e,color:F(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,p.add(e))}let m=[],h=F(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:F(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let te=t.slice();i=Math.max(i,t.length);let g=[];for(let e=0;e<l.length;e++){let t=l[e];t!==null&&(e===u||p.has(e)||e<te.length&&te[e]!==null&&te[e].hash===t.hash&&g.push({lane:e,color:F(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:h,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:g,topCurves:ee,bottomEdges:m,branches:[]})}let c=Se(e),l=e=>c.get(e)??[];for(let e of n){e.branches=l(e.hash);for(let t of e.passes)t.branches=l(t._hash),delete t._hash;for(let t of e.topCurves)t.branches=l(t._hash),delete t._hash;for(let t of e.bottomEdges)t.branches=l(t._hash),delete t._hash}let u=i>0?20+(i-1)*14:0;return{rows:n,maxLanes:i,width:u}}u(),de(),t();var we={class:`graph-wrap`},Te=[`viewBox`],Ee=[`x1`,`x2`,`stroke`],De=[`x1`,`x2`],L=[`d`,`stroke`],Oe=[`d`],ke=[`x1`,`x2`,`stroke`],R=[`d`,`stroke`],z=[`d`],B={class:`graph-layer graph-nodes`,"aria-hidden":`true`},V=[`cx`,`stroke`],H=[`cx`,`fill`],U=[`cx`,`stroke`],W=[`cx`],G=-1,Ae=M(p({__name:`CommitGraphCell`,props:{layout:{},width:{}},setup(e){let t=e,n=k(()=>P(t.layout.commitLane)),r=j(`@A1833:暂不属于任何分支`);function i(e){return e.length>0?e.join(`, `):r}let a=k(()=>`${t.layout.hash.slice(0,7)} · ${i(t.layout.branches)}`),o=k(()=>t.layout.passes.map(e=>({x:P(e.lane),color:e.color,title:i(e.branches)}))),s=k(()=>t.layout.topCurves.map(e=>{let t=P(e.fromLane),r=n.value;return{d:`M ${t} ${G} C ${t} ${15/2}, ${r} ${15/2}, ${r} 15`,color:e.color,title:i(e.branches)}})),c=k(()=>t.layout.bottomEdges.map(e=>{let t=n.value,r=P(e.toLane);return{d:e.kind===`straight`||t===r?`M ${t} 15 L ${r} 31`:`M ${t} 15 C ${t} 23, ${r} 23, ${r} 31`,color:e.color,title:i(e.branches)}}));return(t,r)=>(D(),g(`div`,we,[(D(),g(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${e.width} ${h(30)}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[(D(!0),g(v,null,_(o.value,(e,t)=>(D(),g(`line`,{key:`p`+t,x1:e.x,y1:G,x2:e.x,y2:31,stroke:e.color,"stroke-width":`2`},[m(`title`,null,f(e.title),1)],8,Ee))),128)),(D(!0),g(v,null,_(o.value,(e,t)=>(D(),g(`line`,{key:`ph`+t,x1:e.x,y1:G,x2:e.x,y2:31,stroke:`transparent`,"stroke-width":`8`},[m(`title`,null,f(e.title),1)],8,De))),128)),(D(!0),g(v,null,_(s.value,(e,t)=>(D(),g(`path`,{key:`t`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[m(`title`,null,f(e.title),1)],8,L))),128)),(D(!0),g(v,null,_(s.value,(e,t)=>(D(),g(`path`,{key:`th`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[m(`title`,null,f(e.title),1)],8,Oe))),128)),e.layout.hasTopLine?(D(),g(`line`,{key:0,x1:n.value,y1:G,x2:n.value,y2:15,stroke:e.layout.color,"stroke-width":`2`},[m(`title`,null,f(i(e.layout.branches)),1)],8,ke)):O(``,!0),(D(!0),g(v,null,_(c.value,(e,t)=>(D(),g(`path`,{key:`b`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[m(`title`,null,f(e.title),1)],8,R))),128)),(D(!0),g(v,null,_(c.value,(e,t)=>(D(),g(`path`,{key:`bh`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[m(`title`,null,f(e.title),1)],8,z))),128))],8,Te)),(D(),g(`svg`,B,[m(`g`,null,[m(`title`,null,f(a.value),1),e.layout.isMerge?(D(),g(`circle`,{key:0,cx:n.value,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:e.layout.color,"stroke-width":`2`},null,8,V)):(D(),g(`circle`,{key:1,cx:n.value,cy:`50%`,r:`4`,fill:e.layout.color},null,8,H)),e.layout.isHead?(D(),g(`circle`,{key:2,cx:n.value,cy:`50%`,r:`7`,fill:`none`,stroke:e.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,U)):O(``,!0),m(`circle`,{cx:n.value,cy:`50%`,r:`9`,fill:`transparent`},null,8,W)])]))]))}}),[[`__scopeId`,`data-v-1288d6a2`]]);u(),de(),t(),E();var je={class:`log-header`},Me={class:`header-left`},Ne={class:`log-actions`},Pe={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},Fe={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},Ie={key:0,class:`filter-panel-header`},Le={class:`filter-form`},Re={class:`filter-item`},ze={class:`compact-label`},Be={class:`filter-item`},Ve={class:`compact-label`},He={class:`filter-item`},Ue={class:`compact-label`},We={class:`filter-item`},Ge={class:`compact-label`},Ke={class:`filter-actions`},qe={key:0,role:`alert`,class:`log-error`},Je={key:1,class:`log-empty-state`},Ye={class:`log-empty-text`},Xe={key:2,class:`content-area-content`},Ze={class:`table-view-container`},Qe={class:`commit-message-cell`},$e={class:`message-content`},et={key:0,class:`branch-container`},tt={class:`message-text`},nt={class:`author-name`},rt=[`title`,`aria-label`,`onClick`],it={class:`commit-detail-container`},at={key:0,class:`commit-info`},ot={class:`commit-info-row`},st={class:`info-item date-item`},ct={class:`info-label`},lt={class:`info-value`},ut={class:`info-item branch-item`},dt={class:`info-label`},ft={key:0,class:`branch-container`},pt={key:1,class:`info-value info-value-muted`},mt={class:`info-item message-item`},ht={class:`info-label`},gt={class:`info-message-wrapper`},_t={class:`info-message-title`},vt=[`innerHTML`],yt=[`aria-label`,`onKeydown`],bt=`zen-gitsync:log-show-graph`,xt=M(p({__name:`LogList`,setup(t,{expose:u}){let p=be(),de=ge(),E=b([]),M=b(``),N=b(!1),P=k(()=>p.isLoadingLog||N.value),F=b(!1),I=b(localStorage.getItem(bt)!==`false`);T(I,e=>{localStorage.setItem(bt,String(e))});let we=k(()=>I.value&&E.value.length>0?Ce(E.value):null),Te=k(()=>{let e=new Map;if(we.value)for(let t of we.value.rows)e.set(t.hash,t);return e}),Ee=k(()=>Math.max(we.value?.width??0,28)),De=k(()=>Se(E.value)),L=b(!1),Oe=b(null),ke=b(!1),R=b(null),z=b([]),B=b(``),V=b(!1),H=b(``),U=b(`full-new`),W=b(``),G=b(``),xt=k(()=>R.value?De.value.get(R.value.hash)??[]:[]),K=b(!1),St=k(()=>R.value?.message?R.value.message.split(`
1
+ import"./rolldown-runtime-C0FnF6B9.js";import{An as e,Ar as t,Bn as n,Bt as r,Cn as i,D as a,F as o,Gn as s,Gr as c,I as l,In as u,J as d,Jr as f,L as ee,Mn as p,Sn as m,Sr as h,St as te,Tn as g,U as ne,Un as re,Ur as ie,W as ae,Yn as _,_n as v,_t as oe,a as se,ar as ce,f as le,ft as ue,gn as y,gr as b,hn as x,i as S,ir as C,kn as w,lr as de,mn as fe,nr as T,on as E,p as pe,qn as D,r as me,st as he,wn as O,xn as k,z as A}from"./element-plus-CN9J6t-d.js";import{n as j,t as M}from"./_plugin-vue_export-helper-PJOlbt_0.js";import{t as ge}from"./toolsStore-ChBM3BeQ.js";import{t as _e}from"./CommonDialog-C0zTwqdL.js";import{St as ve,ot as ye,xt as be,yt as xe}from"./index-BTEGKhWc.js";var N=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function P(e){return 10+e*14}function F(e){return N[e%N.length]}function I(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim();if(!e||e===`HEAD`||e.startsWith(`tag:`))continue;let r=e.match(/^HEAD\s*->\s*(.+)$/);t.push((r?r[1]:e).trim())}return t}function Se(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.hash)??new Set;for(let t of I(r.branch))e.add(t);n.set(r.hash,Array.from(e));for(let n of r.parents??[]){let r=t.get(n)??new Set;for(let t of e)r.add(t);t.set(n,r)}}return n}function Ce(e){let t=[],n=[],r=0,i=0,a=new Set(e.map(e=>e.hash)),o=e=>t.findIndex(t=>t!==null&&t.hash===e),s=()=>{let e=t.findIndex(e=>e===null);return e===-1?(t.push(null),t.length-1):e};for(let c of e){let e=Array.isArray(c.parents)?c.parents:[],l=t.slice(),u=o(c.hash),d,f=!1;u===-1?(f=!0,u=s(),d=r++):d=t[u].colorIdx,t[u]=null;let ee=[],p=new Set;for(let e=0;e<t.length;e++){let n=t[e];n!==null&&n.hash===c.hash&&(ee.push({fromLane:e,color:F(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,p.add(e))}let m=[],h=F(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:F(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let te=t.slice();i=Math.max(i,t.length);let g=[];for(let e=0;e<l.length;e++){let t=l[e];t!==null&&(e===u||p.has(e)||e<te.length&&te[e]!==null&&te[e].hash===t.hash&&g.push({lane:e,color:F(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:h,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:g,topCurves:ee,bottomEdges:m,branches:[]})}let c=Se(e),l=e=>c.get(e)??[];for(let e of n){e.branches=l(e.hash);for(let t of e.passes)t.branches=l(t._hash),delete t._hash;for(let t of e.topCurves)t.branches=l(t._hash),delete t._hash;for(let t of e.bottomEdges)t.branches=l(t._hash),delete t._hash}let u=i>0?20+(i-1)*14:0;return{rows:n,maxLanes:i,width:u}}u(),de(),t();var we={class:`graph-wrap`},Te=[`viewBox`],Ee=[`x1`,`x2`,`stroke`],De=[`x1`,`x2`],L=[`d`,`stroke`],Oe=[`d`],ke=[`x1`,`x2`,`stroke`],R=[`d`,`stroke`],z=[`d`],B={class:`graph-layer graph-nodes`,"aria-hidden":`true`},V=[`cx`,`stroke`],H=[`cx`,`fill`],U=[`cx`,`stroke`],W=[`cx`],G=-1,Ae=M(p({__name:`CommitGraphCell`,props:{layout:{},width:{}},setup(e){let t=e,n=k(()=>P(t.layout.commitLane)),r=j(`@A1833:暂不属于任何分支`);function i(e){return e.length>0?e.join(`, `):r}let a=k(()=>`${t.layout.hash.slice(0,7)} · ${i(t.layout.branches)}`),o=k(()=>t.layout.passes.map(e=>({x:P(e.lane),color:e.color,title:i(e.branches)}))),s=k(()=>t.layout.topCurves.map(e=>{let t=P(e.fromLane),r=n.value;return{d:`M ${t} ${G} C ${t} ${15/2}, ${r} ${15/2}, ${r} 15`,color:e.color,title:i(e.branches)}})),c=k(()=>t.layout.bottomEdges.map(e=>{let t=n.value,r=P(e.toLane);return{d:e.kind===`straight`||t===r?`M ${t} 15 L ${r} 31`:`M ${t} 15 C ${t} 23, ${r} 23, ${r} 31`,color:e.color,title:i(e.branches)}}));return(t,r)=>(D(),g(`div`,we,[(D(),g(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${e.width} ${h(30)}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[(D(!0),g(v,null,_(o.value,(e,t)=>(D(),g(`line`,{key:`p`+t,x1:e.x,y1:G,x2:e.x,y2:31,stroke:e.color,"stroke-width":`2`},[m(`title`,null,f(e.title),1)],8,Ee))),128)),(D(!0),g(v,null,_(o.value,(e,t)=>(D(),g(`line`,{key:`ph`+t,x1:e.x,y1:G,x2:e.x,y2:31,stroke:`transparent`,"stroke-width":`8`},[m(`title`,null,f(e.title),1)],8,De))),128)),(D(!0),g(v,null,_(s.value,(e,t)=>(D(),g(`path`,{key:`t`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[m(`title`,null,f(e.title),1)],8,L))),128)),(D(!0),g(v,null,_(s.value,(e,t)=>(D(),g(`path`,{key:`th`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[m(`title`,null,f(e.title),1)],8,Oe))),128)),e.layout.hasTopLine?(D(),g(`line`,{key:0,x1:n.value,y1:G,x2:n.value,y2:15,stroke:e.layout.color,"stroke-width":`2`},[m(`title`,null,f(i(e.layout.branches)),1)],8,ke)):O(``,!0),(D(!0),g(v,null,_(c.value,(e,t)=>(D(),g(`path`,{key:`b`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[m(`title`,null,f(e.title),1)],8,R))),128)),(D(!0),g(v,null,_(c.value,(e,t)=>(D(),g(`path`,{key:`bh`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[m(`title`,null,f(e.title),1)],8,z))),128))],8,Te)),(D(),g(`svg`,B,[m(`g`,null,[m(`title`,null,f(a.value),1),e.layout.isMerge?(D(),g(`circle`,{key:0,cx:n.value,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:e.layout.color,"stroke-width":`2`},null,8,V)):(D(),g(`circle`,{key:1,cx:n.value,cy:`50%`,r:`4`,fill:e.layout.color},null,8,H)),e.layout.isHead?(D(),g(`circle`,{key:2,cx:n.value,cy:`50%`,r:`7`,fill:`none`,stroke:e.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,U)):O(``,!0),m(`circle`,{cx:n.value,cy:`50%`,r:`9`,fill:`transparent`},null,8,W)])]))]))}}),[[`__scopeId`,`data-v-1288d6a2`]]);u(),de(),t(),E();var je={class:`log-header`},Me={class:`header-left`},Ne={class:`log-actions`},Pe={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},Fe={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},Ie={key:0,class:`filter-panel-header`},Le={class:`filter-form`},Re={class:`filter-item`},ze={class:`compact-label`},Be={class:`filter-item`},Ve={class:`compact-label`},He={class:`filter-item`},Ue={class:`compact-label`},We={class:`filter-item`},Ge={class:`compact-label`},Ke={class:`filter-actions`},qe={key:0,role:`alert`,class:`log-error`},Je={key:1,class:`log-empty-state`},Ye={class:`log-empty-text`},Xe={key:2,class:`content-area-content`},Ze={class:`table-view-container`},Qe={class:`commit-message-cell`},$e={class:`message-content`},et={key:0,class:`branch-container`},tt={class:`message-text`},nt={class:`author-name`},rt=[`title`,`aria-label`,`onClick`],it={class:`commit-detail-container`},at={key:0,class:`commit-info`},ot={class:`commit-info-row`},st={class:`info-item date-item`},ct={class:`info-label`},lt={class:`info-value`},ut={class:`info-item branch-item`},dt={class:`info-label`},ft={key:0,class:`branch-container`},pt={key:1,class:`info-value info-value-muted`},mt={class:`info-item message-item`},ht={class:`info-label`},gt={class:`info-message-wrapper`},_t={class:`info-message-title`},vt=[`innerHTML`],yt=[`aria-label`,`onKeydown`],bt=`zen-gitsync:log-show-graph`,xt=M(p({__name:`LogList`,setup(t,{expose:u}){let p=be(),de=ge(),E=b([]),M=b(``),N=b(!1),P=k(()=>p.isLoadingLog||N.value),F=b(!1),I=b(localStorage.getItem(bt)!==`false`);T(I,e=>{localStorage.setItem(bt,String(e))});let we=k(()=>I.value&&E.value.length>0?Ce(E.value):null),Te=k(()=>{let e=new Map;if(we.value)for(let t of we.value.rows)e.set(t.hash,t);return e}),Ee=k(()=>Math.max(we.value?.width??0,28)),De=k(()=>Se(E.value)),L=b(!1),Oe=b(null),ke=b(!1),R=b(null),z=b([]),B=b(``),V=b(!1),H=b(``),U=b(`full-new`),W=b(``),G=b(``),xt=k(()=>R.value?De.value.get(R.value.hash)??[]:[]),K=b(!1),St=k(()=>R.value?.message?R.value.message.split(`
2
2
  `)[0].trim():``),Ct=k(()=>R.value?.message?R.value.message.split(`
3
3
  `).slice(1).join(`
4
4
  `).trim():``),wt=k(()=>Ct.value.length>0),Tt=k(()=>Ct.value.replace(/\n/g,`<br>`)),q=b(!1),Et=b([]),Dt=b(``),J=b(null),Ot=b([]),kt=b([]),At=b([]),jt=b(!1),Mt=b(0),Nt=b(0),Y=b(null),Pt=b(null),Ft=k(()=>E.value),It=k(()=>z.value.map(e=>({path:e,name:e.split(`/`).pop()||e})));async function X(e=!1,t=1){let r=be();if(!r.isGitRepo){M.value=`当前目录不是Git仓库`;return}try{t>1?L.value=!0:N.value=!0;let i=new URLSearchParams;i.append(`page`,t.toString()),i.append(`all`,e.toString()),i.append(`with_parents`,`true`),Et.value.length>0&&i.append(`author`,Et.value.join(`,`)),kt.value.length>0&&i.append(`branch`,kt.value.join(`,`)),Dt.value&&i.append(`message`,Dt.value),J.value&&Array.isArray(J.value)&&J.value.length===2&&(i.append(`dateFrom`,J.value[0]),i.append(`dateTo`,J.value[1])),i.append(`_t`,Date.now().toString());let a=await(await fetch(`/api/log?${i.toString()}`)).json();if(!a||!a.data||!Array.isArray(a.data)){M.value=`加载提交历史失败: 服务器返回数据格式不正确`;return}let o=t>1;o&&Array.isArray(a.data)?E.value=E.value.concat(a.data):Array.isArray(a.data)&&(E.value=a.data),r.currentPage=t,r.totalCommits=a.total??E.value.length,r.hasMoreData=a.hasMore===!0,!o&&!e&&n(()=>{Ut(),setTimeout(Sn,200)}),M.value=``}catch(e){M.value=`加载提交历史失败: `+(e instanceof Error?e.message:String(e)),t>1&&(r.hasMoreData=!1)}finally{t>1?L.value=!1:N.value=!1}}function Lt(e){return e.includes(`HEAD -> `)?e.replace(`HEAD -> `,``):e.includes(`origin/`)?e:e.trim()}function Rt(e){return e.includes(`HEAD`)?`success`:e.includes(`origin/`)?`warning`:`info`}function zt(e){return e?e.length>60||e.includes(`