zen-gitsync 2.17.32 → 2.17.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/package.json +8 -1
- package/src/ui/public/assets/{AgentEngineSelector-CPS9WawU.js → AgentEngineSelector-CGrUh2kD.js} +1 -1
- package/src/ui/public/assets/{AgentView-CHj8Esf5.js → AgentView-BRC3kn-3.js} +1 -1
- package/src/ui/public/assets/{AppVersionBadge-CbYQ0KFm.js → AppVersionBadge-BR_ZX6Oq.js} +2 -2
- package/src/ui/public/assets/{BranchSelector-i_DZoGr4.js → BranchSelector-C77-aizC.js} +1 -1
- package/src/ui/public/assets/{CommitForm-C-cL8_vz.css → CommitForm-BbgIoF4h.css} +1 -1
- package/src/ui/public/assets/CommitForm-C6qTIW0T.js +6 -0
- package/src/ui/public/assets/{CommonDialog-Nwwi4-_9.js → CommonDialog-kDck8ITZ.js} +1 -1
- package/src/ui/public/assets/{EditorView-Cj7r5oIY.js → EditorView-DNZXnJnc.js} +1 -1
- package/src/ui/public/assets/{FileDiffViewer-2vvvRZ_R.js → FileDiffViewer-BxFkqvIA.js} +1 -1
- package/src/ui/public/assets/{FlowExecutionViewer-STZphigj.js → FlowExecutionViewer-DDkb05TW.js} +1 -1
- package/src/ui/public/assets/{FlowOrchestrationWorkspace-BdW1MijZ.js → FlowOrchestrationWorkspace-BiHGQE0o.js} +1 -1
- package/src/ui/public/assets/{IconButton-BuiJBsJ3.js → IconButton-BflzboUD.js} +1 -1
- package/src/ui/public/assets/{LogList-C14b7EUJ.js → LogList-DHfr-rPz.js} +1 -1
- package/src/ui/public/assets/{MindmapView-dcm1kcrO.js → MindmapView-7u02tj5n.js} +1 -1
- package/src/ui/public/assets/{MonitorView-7SOXc-I2.js → MonitorView-cdUkh4VE.js} +1 -1
- package/src/ui/public/assets/{ProjectStartupButton-BM2RrBbL.js → ProjectStartupButton-B9KAavAO.js} +1 -1
- package/src/ui/public/assets/{RecentDirectoriesChat-CXxGKkqI.js → RecentDirectoriesChat-DQ9phSSJ.js} +1 -1
- package/src/ui/public/assets/{RemoteManagerDialog-BTtVeges.js → RemoteManagerDialog-CgnM1ndZ.js} +1 -1
- package/src/ui/public/assets/{RemoteRepoCard-B0n8k5Go.js → RemoteRepoCard-BDAvJcFk.js} +1 -1
- package/src/ui/public/assets/{SourceMapView-CT2C3tAc.js → SourceMapView-BEAC-dHC.js} +1 -1
- package/src/ui/public/assets/{SvgIcon-U-AI95UV.js → SvgIcon-B-2iTLW-.js} +1 -1
- package/src/ui/public/assets/{TemplateManager-BIMeoTp0.js → TemplateManager-CYy3G7rH.js} +1 -1
- package/src/ui/public/assets/{UserInputNode-D_V8dhh9.js → UserInputNode-DIX4shBD.js} +1 -1
- package/src/ui/public/assets/WorkbenchView-BAko4SjJ.js +20 -0
- package/src/ui/public/assets/WorkbenchView-DWQChnqF.css +1 -0
- package/src/ui/public/assets/{_plugin-vue_export-helper-DkeTtFKF.js → _plugin-vue_export-helper-D8rwCQpe.js} +6 -6
- package/src/ui/public/assets/{agentConversations-B2aTliJe.js → agentConversations-C0WoSH0y.js} +1 -1
- package/src/ui/public/assets/{configStore-Y1biBqmb.js → configStore-BFGSfIBp.js} +1 -1
- package/src/ui/public/assets/{gitStore-CiBz68_Z.js → gitStore-BcrFZogC.js} +1 -1
- package/src/ui/public/assets/index-BCTkDpQv.css +1 -0
- package/src/ui/public/assets/{index-BoZNUwmd.js → index-aNSr4k87.js} +10 -10
- package/src/ui/public/assets/{previewSandbox-D7HcNin7.js → previewSandbox-C_ZzCEpS.js} +1 -1
- package/src/ui/public/assets/{toolsStore-Dhfr-VDL.js → toolsStore-B3LQrSEp.js} +1 -1
- package/src/ui/public/index.html +12 -12
- package/src/ui/server/routes/workbench/index.js +182 -18
- package/src/ui/server/routes/workbench/jobActivity.js +18 -6
- package/src/ui/server/routes/workbench/liveJobs.js +7 -1
- package/src/ui/server/routes/workbench/llmClient.js +20 -4
- package/src/ui/server/routes/workbench/progressReport.js +6 -0
- package/src/ui/server/routes/workbench/projectRegistry.js +58 -2
- package/src/ui/server/routes/workbench/projectRegistry.test.js +51 -0
- package/src/ui/server/routes/workbench/stallWatchdog.js +330 -0
- package/src/ui/server/routes/workbench/stallWatchdog.test.js +356 -0
- package/src/ui/server/utils/directoryGitState.js +41 -1
- package/src/ui/server/utils/directoryGitState.test.js +91 -0
- package/src/ui/public/assets/CommitForm-DrAhqXPt.js +0 -6
- package/src/ui/public/assets/WorkbenchView-BeC5sg_V.css +0 -1
- package/src/ui/public/assets/WorkbenchView-C74ciC03.js +0 -20
- package/src/ui/public/assets/index-BrIl1iaG.css +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,At as t,Bn as n,Bt as r,C as i,Cn as a,Dn as o,Dt as s,En as c,Er as l,F as u,G as d,Gt as f,Ht as p,I as m,In as h,J as g,K as _,L as v,M as y,Nn as b,Nt as x,On as S,Pn as C,Pr as w,Q as T,Qr as E,S as D,T as O,Tn as k,U as A,V as j,W as M,Wn as N,Wt as P,Xn as F,Y as ee,Yn as te,Yr as I,Zn as L,_ as ne,a as R,at as re,bn as ie,br as z,cr as B,ct as ae,dn as V,ht as oe,i as H,j as se,kn as U,ln as ce,lr as le,lt as ue,mt as de,nn as fe,nt as pe,o as W,or as me,ot as he,pr as G,q as ge,qr as K,qt as q,st as _e,tt as ve,vn as ye,vr as be,w as xe,x as Se,xn as J,z as Y,zt as Ce}from"./element-plus-CgEuJBlB.js";import{b as we}from"./vendor-CDZ64WVU.js";import{n as X,t as Z}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{t as Te}from"./SvgIcon-B-2iTLW-.js";import{t as Ee}from"./IconButton-BflzboUD.js";import{r as De,t as Oe}from"./configStore-BFGSfIBp.js";import{i as ke,r as Q}from"./gitStore-BcrFZogC.js";import{t as Ae}from"./CommonDialog-kDck8ITZ.js";import{t as je}from"./TemplateManager-CYy3G7rH.js";import{C as Me,S as Ne,T as Pe,b as Fe,w as Ie,x as Le,y as Re}from"./index-aNSr4k87.js";n(),G(),w();var ze={key:0},Be={key:1},Ve=Z(h({__name:`StageButton`,props:{from:{default:`form`}},emits:[`click`],setup(e,{emit:t}){let n=t,r=Q(),i=Oe();function a(e){let t=e.replace(/\\/g,`/`);return i.lockedFiles.some(e=>{let n=e.replace(/\\/g,`/`);return t===n})}function s(){return i.lockedFiles.length!==0&&r.fileList.some(e=>[`modified`,`deleted`,`untracked`].includes(e.type)?a(e.path):!1)}let c=k(()=>r.fileList.filter(e=>[`modified`,`deleted`,`untracked`].includes(e.type)&&!a(e.path)).length),u=k(()=>r.fileList.some(e=>[`modified`,`deleted`,`untracked`].includes(e.type)&&!a(e.path))),d=k(()=>r.isSelectionMode&&r.hasSelectableFiles),f=k(()=>r.selectedUnstagedPaths.length),p=k(()=>r.isSelectionMode?f.value===0:!u.value),m=k(()=>d.value?`${X(`@29974:暂存所选 `)}${f.value}${X(`@29974: 个文件`)}`:u.value?s()?`${X(`@29974:暂存`)}${c.value}${X(`@29974:个未暂存文件(逐个添加)`)}`:`${X(`@29974:暂存所有更改(git add .)`)}`:X(`@29974:没有需要暂存的更改`));async function h(){n(`click`);try{if(d.value){await r.stageFiles(r.selectedUnstagedPaths);return}if(r.isSelectionMode)return;s()?await r.addToStage():await r.addAllToStage()}catch(e){console.error(`添加文件失败:`,e)}}return(t,n)=>{let i=Y,a=M;return L(),o(a,{content:m.value,placement:`top`},{default:B(()=>[C(i,{type:`primary`,icon:l(Ce),onClick:h,loading:l(r).isAddingFiles,disabled:p.value,class:K([`stage-button`,`from-${e.from}`,{"is-selective":d.value}])},{default:B(()=>[b(E(d.value?l(X)(`@29974:暂存所选`):l(X)(`@29974:暂存`))+` `,1),d.value?(L(),U(`span`,ze,`(`+E(f.value)+`)`,1)):c.value>0?(L(),U(`span`,Be,`(`+E(c.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`class`])]),_:1},8,[`content`])}}}),[[`__scopeId`,`data-v-7c59a857`]]);n(),G(),w();var He={key:0},Ue=Z(h({__name:`CommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`click`,`beforeCommit`,`afterCommit`],setup(e,{emit:n}){let r=e,i=n,a=Q(),s=Oe(),c=k(()=>a.fileList.filter(e=>e.type===`added`&&!Pe(e.path,s.lockedFiles)).length),u=k(()=>c.value>0),d=k(()=>a.hasConflictedFiles||a.isCommiting?!0:a.isMergeInProgress?!r.hasUserCommitMessage:!u.value||!r.hasUserCommitMessage),f=k(()=>a.isCommiting?X(`@76A11:正在提交中…`):a.hasConflictedFiles?X(`@76A11:存在冲突文件,请先解决冲突`):a.isMergeInProgress?r.hasUserCommitMessage?X(`@76A11:提交并完成合并`):X(`@76A11:请输入提交信息`):u.value?r.hasUserCommitMessage?`${X(`@76A11:提交`)}${c.value}${X(`@76A11:个已暂存文件`)}`:X(`@76A11:请输入提交信息`):X(`@76A11:没有已暂存的更改`)),p=k(()=>a.isCommiting?X(`@76A11:提交中…`):X(`@76A11:提交`));async function m(){if(r.finalCommitMessage.trim()){i(`beforeCommit`),i(`click`);try{let e=await a.commitChanges(r.finalCommitMessage,r.skipHooks);i(`afterCommit`,e)}catch(e){console.error(`提交失败:`,e),i(`afterCommit`,!1)}}}return(n,r)=>{let i=Y,s=M;return L(),o(s,{content:f.value,placement:`top`,disabled:l(a).isCommiting},{default:B(()=>[C(i,{type:`primary`,onClick:m,icon:l(a).isCommiting?l(t):l(ve),loading:l(a).isCommiting,disabled:d.value,"aria-busy":l(a).isCommiting?`true`:void 0,"aria-label":l(a).isCommiting?l(X)(`@76A11:正在提交中…`):void 0,class:K([`commit-button`,`from-${e.from}`,{"is-committing":l(a).isCommiting}])},{default:B(()=>[b(E(p.value)+` `,1),c.value>0&&!l(a).isCommiting?(L(),U(`span`,He,`(`+E(c.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`aria-busy`,`aria-label`,`class`])]),_:1},8,[`content`,`disabled`])}}}),[[`__scopeId`,`data-v-056f6f5d`]]);n(),G(),w();var We={class:`push-progress-container`},Ge={key:0,class:`pulling-section`},Ke={class:`pulling-text-wrap`},qe={class:`pulling-title`},Je={class:`pulling-sub`},Ye={class:`stage-header`},Xe={class:`stage-icon`},Ze={class:`stage-info`},Qe={class:`stage-label`},$e={key:0,class:`stage-percent`},et={key:0,class:`stage-progress`},tt={key:2,class:`error-section`},nt={class:`error-header`},rt={class:`error-title`},it={class:`error-content`},at={key:0,class:`error-suggestion`},ot={key:3,class:`messages-section`},st={class:`messages-title`},ct=Z(h({__name:`PushProgressModal`,props:{modelValue:{type:Boolean}},emits:[`update:modelValue`,`complete`,`pull-requested`],setup(n,{expose:r,emit:i}){let{t:a}=we(),s=n,u=i,d=Oe(),f=Q(),p=z(`progress`),m=z([]),h=z(``),_=z(!1),v=k(()=>h.value.includes(`non-fast-forward`)||h.value.includes(`rejected`)&&h.value.includes(`fetch first`)),y=z(!1);async function x(){y.value=!0;try{(await f.gitPull()).success&&(O.value=!1,u(`pull-requested`))}finally{y.value=!1}}let w=be([{name:`counting`,label:a(`@PUSH:计数对象`),status:`wait`,percent:0},{name:`compressing`,label:a(`@PUSH:压缩对象`),status:`wait`,percent:0},{name:`writing`,label:a(`@PUSH:写入对象`),status:`wait`,percent:0},{name:`resolving`,label:a(`@PUSH:解析增量`),status:`wait`,percent:0}]),T=z(0),D=z(null),O=k({get:()=>s.modelValue,set:e=>u(`update:modelValue`,e)}),A=k(()=>{if(_.value)return a(`@PUSH:正在拉取远程更新`);switch(p.value){case`progress`:return a(`@PUSH:正在推送`);case`success`:return a(`@PUSH:推送成功`);case`error`:return a(`@PUSH:推送失败`);default:return``}});function j(e){switch(e.type){case`progress`:e.message&&(m.value.push(e.message),setTimeout(()=>{D.value&&(D.value.scrollTop=D.value.scrollHeight)},0));break;case`stage-progress`:if(e.stage&&typeof e.percent==`number`){let t=w.findIndex(t=>t.name===e.stage);t!==-1&&(w[t].percent=e.percent,w[t].status=e.percent===100?`finish`:`process`,T.value=t,e.percent===100&&t<w.length-1&&(w[t+1].status=`wait`))}break;case`complete`:e.success?(p.value=`success`,w.forEach(e=>{(e.status===`process`||e.status===`wait`)&&(e.status=`finish`,e.percent=100)}),T.value=-1,d.autoClosePushModal?setTimeout(()=>{O.value=!1,u(`complete`,!0)},2e3):u(`complete`,!0)):(p.value=`error`,h.value=ke(e),T.value<w.length&&(w[T.value].status=`error`),T.value=-1,u(`complete`,!1))}}function M(){p.value=`progress`,m.value=[],h.value=``,T.value=0,_.value=!1,w.forEach(e=>{e.status=`wait`,e.percent=0})}function N(e){_.value=e}return r({handleProgress:j,reset:M,setPulling:N}),(n,r)=>{let i=Y;return L(),o(Ae,{modelValue:O.value,"onUpdate:modelValue":r[0]||=e=>O.value=e,title:A.value,width:`650px`,type:`flex`,"close-on-click-modal":!1,"close-on-press-escape":!1,"show-close":p.value!==`progress`,"append-to-body":!0,"lock-scroll":!1,"destroy-on-close":``,"custom-class":`push-progress-dialog status-${p.value}`},{default:B(()=>[c(`div`,We,[_.value?(L(),U(`div`,Ge,[r[1]||=c(`div`,{class:`pulling-icon-wrap`},[c(`svg`,{class:`pulling-spinner`,viewBox:`0 0 50 50`},[c(`circle`,{class:`pulling-spinner-track`,cx:`25`,cy:`25`,r:`20`,fill:`none`,"stroke-width":`4`}),c(`circle`,{class:`pulling-spinner-arc`,cx:`25`,cy:`25`,r:`20`,fill:`none`,"stroke-width":`4`})])],-1),c(`div`,Ke,[c(`div`,qe,E(l(a)(`@PUSH:正在拉取远程更新`)),1),c(`div`,Je,E(l(a)(`@PUSH:拉取完成后自动继续推送`)),1)])])):(L(),U(`div`,{key:1,class:K([`stages-section`,{"is-loading":p.value===`progress`,"is-success":p.value===`success`}])},[(L(!0),U(J,null,e(w,(e,n)=>(L(),U(`div`,{key:e.name,class:K([`stage-item`,{active:T.value===n,finished:e.status===`finish`,error:e.status===`error`}])},[c(`div`,Ye,[c(`div`,Xe,[e.status===`finish`?(L(),o(l(g),{key:0,class:`icon-finish`},{default:B(()=>[C(l(pe))]),_:1})):e.status===`error`?(L(),o(l(g),{key:1,class:`icon-error`},{default:B(()=>[C(l(he))]),_:1})):e.status===`process`?(L(),o(l(g),{key:2,class:`icon-process rotating`},{default:B(()=>[C(l(t))]),_:1})):(L(),o(l(g),{key:3,class:`icon-wait`},{default:B(()=>[C(l(t))]),_:1}))]),c(`div`,Ze,[c(`div`,Qe,E(e.label),1),e.status===`process`||e.status===`finish`?(L(),U(`div`,$e,E(e.percent)+`% `,1)):S(``,!0)])]),e.status===`process`||e.status===`finish`?(L(),U(`div`,et,[C(l(ne),{percentage:e.percent,"stroke-width":6,"show-text":!1,color:e.status===`finish`?`var(--color-success)`:`var(--color-primary)`},null,8,[`percentage`,`color`])])):S(``,!0)],2))),128))],2)),p.value===`error`&&h.value?(L(),U(`div`,tt,[c(`div`,nt,[c(`div`,rt,E(l(a)(`@PUSH:错误详情`))+`:`,1),v.value?(L(),o(i,{key:0,type:`primary`,size:`small`,loading:y.value,onClick:x,class:`pull-button`},{default:B(()=>[C(l(g),null,{default:B(()=>[C(l(de))]),_:1}),b(` `+E(l(a)(`@PUSH:先拉取更新`)),1)]),_:1},8,[`loading`])):S(``,!0)]),c(`div`,it,E(h.value),1),v.value?(L(),U(`div`,at,E(l(a)(`@PUSH:检测到远程有新提交,请先拉取更新后再推送。`)),1)):S(``,!0)])):S(``,!0),m.value.length>0?(L(),U(`div`,ot,[c(`div`,st,E(l(a)(`@PUSH:详细信息`))+`:`,1),c(`div`,{ref_key:`messagesContainerRef`,ref:D,class:`progress-messages`},[(L(!0),U(J,null,e(m.value,(e,t)=>(L(),U(`div`,{key:t,class:`message-item`},E(e),1))),128))],512)])):S(``,!0)])]),_:1},8,[`modelValue`,`title`,`show-close`,`custom-class`])}}}),[[`__scopeId`,`data-v-3d7c968a`]]);n(),G(),w();var lt={class:`push-button-group`},ut={key:0},dt={class:`push-remote-item`},ft=Z(h({__name:`PushButton`,props:{from:{default:`form`}},emits:[`click`,`beforePush`,`afterPush`],setup(t,{emit:n}){let r=n,a=Q(),s=z(!1),u=z(null),d=k(()=>a.branchAhead>0),f=k(()=>a.fileList.some(e=>e.type===`added`)),p=k(()=>!a.hasConflictedFiles&&a.hasUpstream&&d.value&&!f.value),m=k(()=>!p.value),h=k(()=>a.hasConflictedFiles?X(`@F4137:存在冲突文件,请先解决冲突`):a.hasUpstream?d.value?f.value?X(`@F4137:有未提交的暂存更改,请先提交`):`${X(`@F4137:推送`)}${a.branchAhead}${X(`@F4137:个本地提交`)}`:X(`@F4137:没有需要推送的提交`):X(`@F4137:当前分支没有上游分支`)),g=k(()=>p.value?{backgroundColor:`var(--tint-success-14)`,borderColor:`var(--color-success)`,color:`var(--text-primary)`}:{});async function _(){r(`beforePush`),r(`click`);try{s.value=!0,u.value&&u.value.reset();let e=await a.pushToRemoteWithProgress(e=>{u.value&&u.value.handleProgress(e)});e&&await new Promise(e=>setTimeout(e,200)),r(`afterPush`,e)}catch(e){console.error(`推送失败:`,e),r(`afterPush`,!1)}}function y(e){}let x=k(()=>[...a.remotes].sort((e,t)=>e.isUpstream===t.isUpstream?e.name.localeCompare(t.name):e.isUpstream?-1:1));async function w(e){if(e===`manage`){a.isRemoteManagerVisible=!0;return}if(e===`push-all`){await a.pushAllRemotes();return}if(!e.startsWith(`push:`))return;let t=e.slice(5);r(`beforePush`);try{s.value=!0,u.value?.reset();let e=await a.pushToRemoteWithProgress(e=>{u.value?.handleProgress(e)},t);r(`afterPush`,e)}catch(e){console.error(`推送失败:`,e),r(`afterPush`,!1)}}return(n,r)=>{let f=Y,p=M,T=v,O=i,k=xe,A=D;return L(),U(`div`,null,[c(`div`,lt,[C(p,{content:h.value,placement:`top`},{default:B(()=>[C(f,{type:`primary`,icon:l(fe),onClick:_,loading:l(a).isPushing,disabled:m.value,style:I(g.value),class:K([`push-button`,`from-${t.from}`])},{default:B(()=>[b(E(l(X)(`@F4137:推送`))+` `,1),d.value?(L(),U(`span`,ut,`(`+E(l(a).branchAhead)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`style`,`class`])]),_:1},8,[`content`]),l(a).hasMultipleRemotes?(L(),o(A,{key:0,trigger:`click`,placement:`top-end`,onCommand:w},{dropdown:B(()=>[C(k,null,{default:B(()=>[(L(!0),U(J,null,e(x.value,e=>(L(),o(O,{key:e.name,command:`push:${e.name}`},{default:B(()=>[c(`span`,dt,[c(`span`,null,E(l(X)(`@F4137:推送到`))+` `+E(e.name),1),e.isUpstream?(L(),o(T,{key:0,size:`small`,type:`success`,effect:`plain`},{default:B(()=>[b(E(l(X)(`@F4137:上游`)),1)]),_:1})):S(``,!0)])]),_:2},1032,[`command`]))),128)),C(O,{divided:``,command:`push-all`},{default:B(()=>[b(E(l(X)(`@F4137:推送到全部远程`)),1)]),_:1}),C(O,{divided:``,command:`manage`},{default:B(()=>[b(E(l(X)(`@F4137:管理远程…`)),1)]),_:1})]),_:1})]),default:B(()=>[C(f,{type:`primary`,icon:l(ee),style:I(g.value),class:K([`push-button__caret`,`from-${t.from}`]),"aria-label":l(X)(`@F4137:更多推送选项`)},null,8,[`icon`,`style`,`class`,`aria-label`])]),_:1})):S(``,!0)]),C(ct,{ref_key:`progressModalRef`,ref:u,modelValue:s.value,"onUpdate:modelValue":r[0]||=e=>s.value=e,onComplete:y},null,8,[`modelValue`])])}}}),[[`__scopeId`,`data-v-ed54022f`]]);n(),G(),w();var pt={class:`one-push-content`},mt={class:`one-push-text`},ht={class:`one-push-title`},gt={key:0,class:`one-push-desc`},_t=Z(h({__name:`QuickPushButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforePush`,`pushStart`,`afterPush`,`clearFields`],setup(e,{expose:t,emit:n}){let i=Q(),a=Oe(),o=z(!1),s=z(null),u=e,d=n,f=k(()=>i.fileList.some(e=>!Pe(e.path,a.lockedFiles))),p=k(()=>i.isSelectionMode&&i.selectedFiles.size>0&&i.selectedUnstagedPaths.length>0),m=k(()=>i.hasConflictedFiles?!0:i.isSelectionMode?!p.value||!u.hasUserCommitMessage||!i.hasUpstream:!f.value&&i.branchAhead===0||!u.hasUserCommitMessage||!i.hasUpstream),h=k(()=>i.isAddingFiles||i.isCommiting||i.isPushing),_=k(()=>{if(i.hasConflictedFiles)return X(`@2E184:存在冲突文件,请先解决冲突`);if(i.isSelectionMode)return i.selectedFiles.size===0?X(`@2E184:请先勾选要推送的文件`):i.selectedUnstagedPaths.length===0?X(`@2E184:所选文件无需暂存或被锁定`):u.hasUserCommitMessage?i.hasUpstream?X(`@2E184:一键完成:仅暂存所选文件 → 提交 → 推送到远程仓库`):X(`@2E184:当前分支没有上游分支`):X(`@2E184:请输入提交信息`);let e=i.branchAhead>0;return!f.value&&!e?X(`@2E184:没有需要提交或推送的更改`):u.hasUserCommitMessage?i.hasUpstream?f.value?X(`@2E184:一键完成:暂存所有更改 → 提交 → 推送到远程仓库`):X(`@2E184:本地已提交,一键推送到远程仓库`):X(`@2E184:当前分支没有上游分支`):X(`@2E184:请输入提交信息`)}),v=k(()=>i.isSelectionMode&&p.value?X(`@2E184:一键推送所选`):X(`@2E184:一键推送所有`)),y=k(()=>u.from===`form`?i.isSelectionMode&&p.value?X(`@2E184:暂存所选 + 提交 + 推送`):X(`@2E184:暂存 + 提交 + 推送`):``);async function b(){d(`beforePush`);try{let e=i.isSelectionMode&&p.value;if((e||f.value)&&!(e?await i.stageSelectedAndCommit(u.finalCommitMessage,u.skipHooks):await i.addAndCommit(u.finalCommitMessage,u.skipHooks))){d(`afterPush`,!1);return}if(d(`pushStart`),o.value=!0,a.pullBeforePush){s.value?.setPulling(!0);let e=await i.gitPull();if(s.value?.setPulling(!1),!e.success){R.error(X(`@2E184:拉取远程更新失败,已停止推送`)),o.value=!1,i.fetchStatus(),i.getBranchStatus(!0),d(`afterPush`,!1);return}}s.value&&s.value.reset();let t=await i.pushToRemoteWithProgress(e=>{s.value&&s.value.handleProgress(e)});if(t){try{window.dispatchEvent(new CustomEvent(`zen-gitsync:after-quick-push-success`))}catch{}d(`clearFields`)}d(`afterPush`,t)}catch(e){console.error(`一键推送失败:`,e),d(`afterPush`,!1)}}t({triggerQuickPush:b});function x(e){}return(t,n)=>{let i=g,a=Y;return L(),U(`div`,null,[C(l(M),{content:_.value,placement:`top`,"show-after":200},{default:B(()=>[C(a,{type:`primary`,onClick:b,loading:h.value,disabled:m.value,class:K([e.from,`one-push-button`])},{default:B(()=>[c(`div`,pt,[C(i,{class:`one-push-icon`},{default:B(()=>[C(l(r))]),_:1}),c(`div`,mt,[c(`span`,ht,E(v.value),1),e.from===`form`?(L(),U(`span`,gt,E(y.value),1)):S(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`]),C(ct,{ref_key:`progressModalRef`,ref:s,modelValue:o.value,"onUpdate:modelValue":n[0]||=e=>o.value=e,onComplete:x,onPullRequested:b},null,8,[`modelValue`])])}}}),[[`__scopeId`,`data-v-c8c92c10`]]);n(),G(),w();var vt={class:`create-tag-button`},yt={class:`tag-dialog-content`},bt={class:`tag-info-card`},xt={class:`info-icon`},St={class:`info-content`},Ct={class:`form-tip`},wt={class:`form-tip`},Tt={class:`form-tip`},Et=Z(h({__name:`CreateTagButton`,props:{variant:{default:`icon`}},setup(e){let t=e,n=Q(),r=z(!1),i=z(``),a=z(``),u=z(`lightweight`),f=z(``),p=z(!1);function m(){i.value=``,a.value=``,u.value=`lightweight`,f.value=``,r.value=!0}async function h(){if(!i.value.trim()){R.warning(X(`@TAG01:请输入标签名称`));return}if(!/^[a-zA-Z0-9._\/-]+$/.test(i.value)){R.warning(X(`@TAG01:标签名称只能包含字母、数字、点、下划线、斜杠和连字符`));return}try{p.value=!0;let e=await(await fetch(`/api/create-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:i.value.trim(),message:a.value.trim(),type:u.value,commit:f.value.trim()})})).json();e.success?(R.success(X(`@TAG01:标签创建成功`)),r.value=!1):R.error(e.error||X(`@TAG01:创建标签失败`))}catch(e){console.error(`创建标签失败:`,e),R.error(X(`@TAG01:创建标签失败`))}finally{p.value=!1}}let v=k(()=>u.value===`lightweight`?X(`@TAG01:轻量标签是指向提交对象的引用,不包含额外信息`):X(`@TAG01:附注标签是完整的Git对象,包含标签信息、日期、标签者和可选的签名`));return(e,x)=>{let w=g,T=Y,D=M,O=A,k=_,j=se,N=y,P=d;return L(),U(`div`,vt,[C(D,{content:l(X)(`@TAG01:为当前提交创建标签`),placement:`top`,"show-after":200,disabled:t.variant===`text`},{default:B(()=>[C(T,{type:`success`,onClick:m,disabled:!l(n).isGitRepo,circle:t.variant===`icon`,size:t.variant===`icon`?`small`:`default`,class:K(t.variant===`text`?`action-button`:``)},{default:B(()=>[t.variant===`icon`?(L(),o(w,{key:0},{default:B(()=>[C(l(q))]),_:1})):(L(),U(J,{key:1},[b(E(l(X)(`@TAG01:创建标签`)),1)],64))]),_:1},8,[`disabled`,`circle`,`size`,`class`])]),_:1},8,[`content`,`disabled`]),C(Ae,{modelValue:r.value,"onUpdate:modelValue":x[4]||=e=>r.value=e,title:l(X)(`@TAG01:创建 Git 标签`),size:`medium`,"close-on-click-modal":!1,"show-footer":``,"confirm-text":l(X)(`@TAG01:创建`),"cancel-text":l(X)(`@TAG01:取消`),"confirm-loading":p.value,"custom-class":`tag-dialog`,onConfirm:h},{default:B(()=>[c(`div`,yt,[c(`div`,bt,[c(`div`,xt,[C(w,null,{default:B(()=>[C(l(q))]),_:1})]),c(`div`,St,[c(`h4`,null,E(l(X)(`@TAG01:Git 标签`)),1),c(`p`,null,E(l(X)(`@TAG01:标签用于标记项目的重要版本点,如发布版本 v1.0.0`)),1)])]),C(P,{"label-position":`top`,class:`tag-form`},{default:B(()=>[C(k,{label:l(X)(`@TAG01:标签名称`),required:``},{default:B(()=>[C(O,{modelValue:i.value,"onUpdate:modelValue":x[0]||=e=>i.value=e,placeholder:l(X)(`@TAG01:例如: v1.0.0 或 release-2024`),clearable:``,maxlength:`100`},{prefix:B(()=>[C(w,null,{default:B(()=>[C(l(q))]),_:1})]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,Ct,[C(w,null,{default:B(()=>[C(l(s))]),_:1}),c(`span`,null,E(l(X)(`@TAG01:建议使用语义化版本号,如 v1.0.0`)),1)])]),_:1},8,[`label`]),C(k,{label:l(X)(`@TAG01:标签类型`)},{default:B(()=>[C(N,{modelValue:u.value,"onUpdate:modelValue":x[1]||=e=>u.value=e,size:`default`},{default:B(()=>[C(j,{value:`lightweight`},{default:B(()=>[b(E(l(X)(`@TAG01:轻量标签`)),1)]),_:1}),C(j,{value:`annotated`},{default:B(()=>[b(E(l(X)(`@TAG01:附注标签`)),1)]),_:1})]),_:1},8,[`modelValue`]),c(`div`,wt,[C(w,null,{default:B(()=>[C(l(s))]),_:1}),c(`span`,null,E(v.value),1)])]),_:1},8,[`label`]),u.value===`annotated`?(L(),o(k,{key:0,label:l(X)(`@TAG01:标签说明`),required:u.value===`annotated`},{default:B(()=>[C(O,{modelValue:a.value,"onUpdate:modelValue":x[2]||=e=>a.value=e,placeholder:l(X)(`@TAG01:为此标签添加说明信息`),clearable:``,rows:3,type:`textarea`,resize:`none`,maxlength:`500`,"show-word-limit":``},null,8,[`modelValue`,`placeholder`])]),_:1},8,[`label`,`required`])):S(``,!0),C(k,{label:l(X)(`@TAG01:目标提交(可选)`)},{default:B(()=>[C(O,{modelValue:f.value,"onUpdate:modelValue":x[3]||=e=>f.value=e,placeholder:l(X)(`@TAG01:留空则为当前HEAD,或输入commit SHA`),clearable:``,maxlength:`40`},{prefix:B(()=>[...x[5]||=[c(`span`,{class:`commit-prefix`},`commit:`,-1)]]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,Tt,[C(w,null,{default:B(()=>[C(l(s))]),_:1}),c(`span`,null,E(l(X)(`@TAG01:默认为当前HEAD提交,也可以指定历史提交`)),1)])]),_:1},8,[`label`])]),_:1})])]),_:1},8,[`modelValue`,`title`,`confirm-text`,`cancel-text`,`confirm-loading`])])}}}),[[`__scopeId`,`data-v-871521cb`]]);n(),G(),w();var Dt={class:`tag-list-button`},Ot={class:`tag-list-content`},kt={key:0,class:`tag-header`},At={class:`tag-stats`},jt={class:`stat-item`},Mt={class:`stat-number`},Nt={class:`stat-label`},Pt={class:`tag-actions-header`},Ft={class:`tag-list-container`},It={key:0,class:`empty-state`},Lt={class:`empty-text`},Rt={class:`empty-hint`},zt={key:1,class:`tag-cards`},Bt={class:`tag-card-content`},Vt={class:`tag-info`},Ht={class:`tag-main-info`},Ut={class:`tag-name-badge`},Wt={class:`tag-name-text`},Gt={class:`tag-meta`},Kt={class:`tag-commit`},qt={class:`tag-date`},Jt={key:0,class:`tag-message`},Yt={class:`tag-card-actions`},Xt={key:0,class:`tag-detail-content`},Zt={class:`detail-row`},Qt={class:`detail-label`},$t={class:`detail-value`},en={class:`detail-row`},tn={class:`detail-label`},nn={class:`detail-value`},rn={class:`detail-row`},an={class:`detail-label`},on={class:`detail-value`},sn={class:`detail-row`},cn={class:`detail-label`},ln={key:0,class:`detail-row detail-message`},un={class:`detail-label`},dn={class:`message-content`},fn=Z(h({__name:`TagListButton`,props:{variant:{default:`icon`}},setup(t){let n=t,r=Q(),i=z(!1),a=z([]),u=z(!1),d=z(!1),f=z(!1),m=z(!1),h=z(null);async function _(){i.value=!0,await y()}async function y(){try{u.value=!0;let e=await(await fetch(`/api/list-tags`)).json();e.success?a.value=e.tags||[]:R.error(e.error||X(`@TAG01:获取标签列表失败`))}catch(e){console.error(`获取标签列表失败:`,e),R.error(X(`@TAG01:获取标签列表失败`))}finally{u.value=!1}}function x(e){h.value=e,m.value=!0}async function w(e){H.confirm(X(`@TAG01:确定要推送此标签到远程仓库吗?`),X(`@TAG01:推送标签`),{confirmButtonText:X(`@TAG01:推送`),cancelButtonText:X(`@TAG01:取消`),type:`info`}).then(async()=>{try{f.value=!0;let t=await(await fetch(`/api/push-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:e})})).json();t.success?R.success(X(`@TAG01:标签推送成功`)):R.error(t.error||X(`@TAG01:推送标签失败`))}catch(e){console.error(`推送标签失败:`,e),R.error(X(`@TAG01:推送标签失败`))}finally{f.value=!1}}).catch(()=>{})}async function T(){H.confirm(X(`@TAG01:确定要推送所有标签到远程仓库吗?`),X(`@TAG01:推送所有标签`),{confirmButtonText:X(`@TAG01:推送`),cancelButtonText:X(`@TAG01:取消`),type:`info`}).then(async()=>{try{f.value=!0;let e=await(await fetch(`/api/push-all-tags`,{method:`POST`})).json();e.success?R.success(X(`@TAG01:所有标签推送成功`)):R.error(e.error||X(`@TAG01:推送标签失败`))}catch(e){console.error(`推送标签失败:`,e),R.error(X(`@TAG01:推送标签失败`))}finally{f.value=!1}}).catch(()=>{})}async function D(e){H.confirm(X(`@TAG01:确定要删除此标签吗?此操作不可恢复。`),X(`@TAG01:删除标签`),{confirmButtonText:X(`@TAG01:删除`),cancelButtonText:X(`@TAG01:取消`),type:`warning`}).then(async()=>{await O(e)}).catch(()=>{})}async function O(e){try{d.value=!0;let t=await(await fetch(`/api/delete-tag`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tagName:e})})).json();t.success?(R.success(X(`@TAG01:标签删除成功`)),await y()):R.error(t.error||X(`@TAG01:删除标签失败`))}catch(e){console.error(`删除标签失败:`,e),R.error(X(`@TAG01:删除标签失败`))}finally{d.value=!1}}function k(e){if(!e)return`-`;try{return new Date(e).toLocaleString(`zh-CN`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`})}catch{return e}}return(t,O)=>{let A=g,j=Y,N=M,P=Se,F=v,ee=W;return L(),U(`div`,Dt,[C(N,{content:l(X)(`@TAG01:查看和管理所有标签`),placement:`top`,"show-after":200,disabled:n.variant===`text`},{default:B(()=>[C(j,{type:`info`,onClick:_,disabled:!l(r).isGitRepo,circle:n.variant===`icon`,size:n.variant===`icon`?`small`:`default`,class:K(n.variant===`text`?`action-button`:``)},{default:B(()=>[n.variant===`icon`?(L(),o(A,{key:0},{default:B(()=>[C(l(q))]),_:1})):(L(),U(J,{key:1},[b(E(l(X)(`@TAG01:标签列表`)),1)],64))]),_:1},8,[`disabled`,`circle`,`size`,`class`])]),_:1},8,[`content`,`disabled`]),C(Ae,{modelValue:i.value,"onUpdate:modelValue":O[0]||=e=>i.value=e,title:l(X)(`@TAG01:Git 标签列表`),size:`large`,"show-footer":!1,"custom-class":`tag-list-dialog`},{default:B(()=>[c(`div`,Ot,[u.value?S(``,!0):(L(),U(`div`,kt,[c(`div`,At,[c(`div`,jt,[C(A,{class:`stat-icon`},{default:B(()=>[C(l(q))]),_:1}),c(`span`,Mt,E(a.value.length),1),c(`span`,Nt,E(l(X)(`@TAG01:个标签`)),1)])]),c(`div`,Pt,[C(j,{type:`primary`,size:`small`,icon:l(p),onClick:y,loading:u.value,class:`refresh-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:刷新`)),1)]),_:1},8,[`icon`,`loading`]),a.value.length>0?(L(),o(j,{key:0,type:`success`,size:`small`,icon:l(fe),onClick:T,loading:f.value,class:`push-all-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:推送所有标签`)),1)]),_:1},8,[`icon`,`loading`])):S(``,!0)])])),le((L(),U(`div`,Ft,[a.value.length===0&&!u.value?(L(),U(`div`,It,[C(P,{description:l(X)(`@TAG01:暂无标签`),"image-size":120},{image:B(()=>[C(A,{class:`empty-icon`},{default:B(()=>[C(l(q))]),_:1})]),description:B(()=>[c(`p`,Lt,E(l(X)(`@TAG01:还没有创建任何标签`)),1),c(`p`,Rt,E(l(X)(`@TAG01:使用创建标签功能为项目添加版本标记`)),1)]),_:1},8,[`description`])])):(L(),U(`div`,zt,[(L(!0),U(J,null,e(a.value,e=>(L(),U(`div`,{key:e.name,class:`tag-card`},[c(`div`,Bt,[c(`div`,Vt,[c(`div`,Ht,[c(`div`,Ut,[C(A,{class:`badge-icon`},{default:B(()=>[C(l(q))]),_:1}),c(`span`,Wt,E(e.name),1),C(F,{size:`small`,type:e.type===`annotated`?`warning`:`info`,class:`type-tag`},{default:B(()=>[b(E(e.type===`annotated`?l(X)(`@TAG01:附注`):l(X)(`@TAG01:轻量`)),1)]),_:2},1032,[`type`])]),c(`div`,Gt,[c(`span`,Kt,[C(A,null,{default:B(()=>[C(l(s))]),_:1}),b(` `+E(e.commit.substring(0,8)),1)]),c(`span`,qt,E(k(e.date)),1)]),e.message?(L(),U(`div`,Jt,E(e.message),1)):S(``,!0)])]),c(`div`,Yt,[e.message?(L(),o(j,{key:0,size:`small`,type:`info`,onClick:t=>x(e),class:`action-btn view-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:查看`)),1)]),_:1},8,[`onClick`])):S(``,!0),C(j,{size:`small`,type:`success`,icon:l(fe),onClick:t=>w(e.name),loading:f.value,class:`action-btn push-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:推送`)),1)]),_:1},8,[`icon`,`onClick`,`loading`]),C(j,{size:`small`,type:`danger`,icon:l(ue),onClick:t=>D(e.name),loading:d.value,class:`action-btn delete-btn`},{default:B(()=>[b(E(l(X)(`@TAG01:删除`)),1)]),_:1},8,[`icon`,`onClick`,`loading`])])])]))),128))]))])),[[ee,u.value]])])]),_:1},8,[`modelValue`,`title`]),C(Ae,{modelValue:m.value,"onUpdate:modelValue":O[1]||=e=>m.value=e,title:l(X)(`@TAG01:标签详情`),size:`medium`,"show-footer":!1,"custom-class":`tag-detail-dialog`},{default:B(()=>[h.value?(L(),U(`div`,Xt,[c(`div`,Zt,[c(`span`,Qt,E(l(X)(`@TAG01:标签名称:`)),1),c(`code`,$t,E(h.value.name),1)]),c(`div`,en,[c(`span`,tn,E(l(X)(`@TAG01:提交SHA:`)),1),c(`code`,nn,E(h.value.commit),1)]),c(`div`,rn,[c(`span`,an,E(l(X)(`@TAG01:创建时间:`)),1),c(`span`,on,E(k(h.value.date)),1)]),c(`div`,sn,[c(`span`,cn,E(l(X)(`@TAG01:类型:`)),1),C(F,{type:h.value.type===`annotated`?`warning`:`info`,size:`small`},{default:B(()=>[b(E(h.value.type===`annotated`?l(X)(`@TAG01:附注标签`):l(X)(`@TAG01:轻量标签`)),1)]),_:1},8,[`type`])]),h.value.message?(L(),U(`div`,ln,[c(`span`,un,E(l(X)(`@TAG01:标签说明:`)),1),c(`div`,dn,E(h.value.message),1)])):S(``,!0)])):S(``,!0)]),_:1},8,[`modelValue`,`title`])])}}}),[[`__scopeId`,`data-v-366ce062`]]);n(),G(),w();var pn={class:`git-operations-button`},mn={class:`actions-section`},hn={class:`action-groups`},gn={class:`action-group`},_n={class:`group-title`},vn={class:`group-buttons`},yn={key:0},bn={class:`action-group`},xn={class:`group-title`},Sn={class:`group-buttons`},Cn={class:`action-group`},wn={class:`group-title`},Tn={class:`group-buttons`},En={key:0},Dn={class:`action-group`},On={class:`group-title`},kn={class:`group-buttons`},An={class:`action-group`},jn={class:`group-title`},Mn={class:`group-buttons`},Nn={class:`action-group`},Pn={class:`group-title`},Fn={class:`group-buttons`},In={class:`pull-error-content`},Ln={key:0},Rn={key:1},zn={class:`pull-error-detail`},Bn={class:`pull-error-label`},Vn={class:`pull-error-pre`},Hn=Z(h({__name:`GitOperationsButton`,props:{variant:{default:`icon`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`afterCommit`,`afterPush`,`beforePush`,`clearFields`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=Q(),u=z(!1),d=z(!1),f=z({needsMerge:!1,error:``,fullError:``,pullOutput:``});function p(){u.value=!0}let m=k(()=>a.fileList.filter(e=>e.type===`added`).length),h=k(()=>a.branchBehind>0),_=k(()=>a.fileList.some(e=>[`modified`,`deleted`,`untracked`,`intent-to-add`].includes(e.type)));async function v(){try{let e=await a.gitPull();e.success?(await a.fetchStatus(),await a.fetchLog(!1)):(f.value={needsMerge:e.needsMerge,error:e.error,fullError:e.fullError,pullOutput:e.pullOutput},d.value=!0)}catch(e){console.error(`拉取失败:`,e)}}async function y(){try{await a.gitFetchAll(),await a.fetchStatus(),await a.fetchLog(!1)}catch(e){console.error(`获取远程分支失败:`,e)}}async function w(){if(r.hasUserCommitMessage)try{await a.addAndCommit(r.finalCommitMessage,r.skipHooks),a.fetchStatus(),a.fetchLog(),i(`afterCommit`,!0),i(`clearFields`)}catch(e){console.error(`暂存并提交失败:`,e)}}function T(){i(`beforePush`)}function D(e){i(`afterPush`,e)}function A(){i(`clearFields`)}return t({openGitOperationsDrawer:p}),(t,n)=>{let k=g,j=Y,N=M,F=O;return L(),U(`div`,pn,[r.variant===`icon`?(L(),o(Ee,{key:0,tooltip:l(X)(`@F13B4:Git 操作`),size:`large`,"custom-class":`btn-rotate-on-hover`,onClick:p},{default:B(()=>[C(k,null,{default:B(()=>[C(l(x))]),_:1})]),_:1},8,[`tooltip`])):(L(),o(j,{key:1,type:`primary`,class:`action-button`,onClick:p},{default:B(()=>[b(E(l(X)(`@F13B4:Git 操作`)),1)]),_:1})),C(F,{modelValue:u.value,"onUpdate:modelValue":n[2]||=e=>u.value=e,title:l(X)(`@76872:Git 操作`),direction:`rtl`,size:`362px`,"with-header":!0,"show-close":!0,"destroy-on-close":!1,"append-to-body":!0,class:`git-operations-drawer`},{default:B(()=>[c(`div`,mn,[c(`div`,hn,[c(`div`,gn,[c(`div`,_n,E(l(X)(`@76872:基础操作`)),1),c(`div`,vn,[C(Ve,{onClick:()=>{},from:`drawer`}),C(Fe,{onClick:()=>{},from:`drawer`}),C(Ue,{"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforeCommit:()=>{},onAfterCommit:n[0]||=e=>i(`afterCommit`,e),onClick:()=>{},from:`drawer`},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),C(ft,{onBeforePush:()=>{},onAfterPush:n[1]||=e=>i(`afterPush`,e),onClick:()=>{},from:`drawer`}),C(N,{content:l(a).hasConflictedFiles?l(X)(`@76872:存在冲突文件,请先解决冲突`):h.value?`${l(X)(`@76872:拉取`)}${l(a).branchBehind}${l(X)(`@76872:个远程提交`)}`:`git pull`,placement:`top`},{default:B(()=>[C(j,{type:`primary`,icon:l(de),onClick:v,loading:l(a).isGitPulling,disabled:!l(a).hasUpstream||l(a).hasConflictedFiles,class:`action-button`,style:I(l(a).hasUpstream&&!l(a).hasConflictedFiles?{color:`white`,backgroundColor:`var(--color-primary)`,borderColor:`var(--color-primary)`}:{})},{default:B(()=>[b(E(l(X)(`@76872:拉取`))+` `,1),h.value?(L(),U(`span`,yn,`(`+E(l(a).branchBehind)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`loading`,`disabled`,`style`])]),_:1},8,[`content`]),C(N,{content:`git fetch --all`,placement:`top`},{default:B(()=>[C(j,{type:`info`,icon:l(_e),onClick:y,loading:l(a).isGitFetching,class:`action-button`,style:{color:`white`,"background-color":`var(--color-primary)`,"border-color":`var(--color-primary)`}},{default:B(()=>[b(E(l(X)(`@76872:获取所有远程分支`)),1)]),_:1},8,[`icon`,`loading`])]),_:1})])]),c(`div`,bn,[c(`div`,xn,E(l(X)(`@76872:组合操作`)),1),c(`div`,Sn,[C(N,{content:l(a).hasConflictedFiles?l(X)(`@76872:存在冲突文件,请先解决冲突`):`git add + git commit`,placement:`top`},{default:B(()=>[C(j,{type:`primary`,icon:l(oe),onClick:w,loading:l(a).isAddingFiles||l(a).isCommiting,disabled:!_.value||!e.hasUserCommitMessage||l(a).hasConflictedFiles,class:`action-button`},{default:B(()=>[b(E(l(X)(`@76872:暂存并提交`)),1)]),_:1},8,[`icon`,`loading`,`disabled`])]),_:1},8,[`content`]),C(_t,{from:`drawer`,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforePush:T,onAfterPush:D,onClearFields:A},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`])])]),c(`div`,Cn,[c(`div`,wn,E(l(X)(`@76872:重置操作`)),1),c(`div`,Tn,[C(N,{content:m.value>0?`${l(X)(`@76872:撤销`)}${m.value}${l(X)(`@76872:个已暂存文件`)}`:`git reset HEAD`,placement:`top`},{default:B(()=>[C(j,{type:`warning`,icon:l(P),onClick:l(a).resetHead,loading:l(a).isResetting,disabled:m.value===0||l(a).hasConflictedFiles,class:`action-button reset-button`},{default:B(()=>[b(E(l(X)(`@76872:重置暂存区`))+` `,1),m.value>0?(L(),U(`span`,En,`(`+E(m.value)+`)`,1)):S(``,!0)]),_:1},8,[`icon`,`onClick`,`loading`,`disabled`])]),_:1},8,[`content`]),C(Re,{variant:`text`})])]),c(`div`,Dn,[c(`div`,On,E(l(X)(`@76872:分支操作`)),1),c(`div`,kn,[C(Le,{variant:`text`})])]),c(`div`,An,[c(`div`,jn,E(l(X)(`@76872:储藏操作`)),1),c(`div`,Mn,[C(Ie,{variant:`text`}),C(Me,{variant:`text`})])]),c(`div`,Nn,[c(`div`,Pn,E(l(X)(`@TAG01:标签操作`)),1),c(`div`,Fn,[C(Et,{variant:`text`}),C(fn,{variant:`text`})])])])])]),_:1},8,[`modelValue`,`title`]),C(Ae,{modelValue:d.value,"onUpdate:modelValue":n[3]||=e=>d.value=e,title:f.value.needsMerge?l(X)(`@76872:需要合并更改`):l(X)(`@76872:拉取失败`),size:`medium`,"show-footer":!0,"show-cancel":!1,"confirm-text":l(X)(`@76872:我知道了`),"append-to-body":!0,onConfirm:n[4]||=e=>d.value=!1},{default:B(()=>[c(`div`,In,[c(`div`,{class:K([`pull-error-type`,f.value.needsMerge?`is-warning`:`is-error`])},[C(k,{class:`pull-error-icon`},{default:B(()=>[C(l(s))]),_:1}),f.value.needsMerge?(L(),U(`span`,Ln,E(l(X)(`@76872:本地存在未提交的更改,与远程内容冲突,请先处理本地更改后再拉取。`)),1)):(L(),U(`span`,Rn,E(l(X)(`@76872:执行 git pull 时发生错误,请查看详细信息。`)),1))],2),c(`div`,zn,[c(`div`,Bn,E(l(X)(`@76872:错误详情`))+`:`,1),c(`pre`,Vn,E(f.value.fullError||f.value.error),1)])])]),_:1},8,[`modelValue`,`title`,`confirm-text`])])}}}),[[`__scopeId`,`data-v-feb8c688`]]);n(),w(),V();var Un={class:`loading-container`},Wn={class:`loading-text`},Gn={key:0,class:`loading-progress`},Kn=h({__name:`GlobalLoading`,props:{visible:{type:Boolean,default:!1},text:{default:X(`@2AEBA:加载中...`)},showProgress:{type:Boolean,default:!1},progress:{default:0},mock:{type:Boolean,default:!1}},setup(e){return(t,n)=>(L(),o(a,{to:`body`},[C(ce,{name:`loading-fade`},{default:B(()=>[e.visible||e.mock?(L(),U(`div`,{key:0,class:`global-loading-overlay`,onClick:n[0]||=ie(()=>{},[`stop`])},[c(`div`,Un,[n[1]||=c(`div`,{class:`loading-spinner`},[c(`div`,{class:`spinner-ring`}),c(`div`,{class:`spinner-ring`}),c(`div`,{class:`spinner-ring`})],-1),c(`div`,Wn,E(e.text),1),e.showProgress||e.mock?(L(),U(`div`,Gn,[c(`div`,{class:K([`progress-bar`,{"is-mock":e.mock&&!e.showProgress}]),style:I(e.showProgress?{width:e.progress+`%`}:void 0)},null,6)])):S(``,!0)])])):S(``,!0)]),_:1})]))}}),qn=Z(Kn,[[`__scopeId`,`data-v-691919d3`]]);n(),w(),V();var Jn={class:`success-container`},Yn={class:`success-text`},Xn={key:0,class:`success-description`},Zn=h({__name:`SuccessModal`,props:{visible:{type:Boolean,default:!1},text:{default:X(`@71545:操作成功!`)},description:{default:``}},setup(e){return(t,n)=>(L(),o(a,{to:`body`},[C(ce,{name:`success-fade`},{default:B(()=>[e.visible?(L(),U(`div`,{key:0,class:`success-overlay`,onClick:n[0]||=ie(()=>{},[`stop`])},[c(`div`,Jn,[n[1]||=c(`div`,{class:`success-icon`},[c(`svg`,{viewBox:`0 0 52 52`,class:`success-svg`},[c(`circle`,{class:`success-circle`,cx:`26`,cy:`26`,r:`25`,fill:`none`}),c(`path`,{class:`success-check`,fill:`none`,d:`m14.1 27.2l7.1 7.2 16.7-16.8`})])],-1),c(`div`,Yn,E(e.text),1),e.description?(L(),U(`div`,Xn,E(e.description),1)):S(``,!0)])])):S(``,!0)]),_:1})]))}}),Qn=Z(Zn,[[`__scopeId`,`data-v-c3fad05d`]]);G();var $=be({visible:!1,text:X(`@F2A3A:加载中...`),showProgress:!1,progress:0});function $n(){return{loadingState:$,show:e=>{$.visible=!0,$.text=e?.text||X(`@F2A3A:加载中...`),$.showProgress=e?.showProgress||!1,$.progress=e?.progress||0},hide:()=>{$.visible=!1},updateProgress:e=>{$.progress=Math.max(0,Math.min(100,e))},updateText:e=>{$.text=e},setText:e=>{$.visible&&($.text=e)}}}G();var er=be({visible:!1,text:X(`@B8591:操作成功!`),description:``});function tr(){let e=e=>{er.visible=!0,er.text=e?.text||X(`@B8591:操作成功!`),er.description=e?.description||``;let n=e?.duration||2e3;setTimeout(()=>{t()},n)},t=()=>{er.visible=!1};return{successState:er,show:e,hide:t}}n(),G(),w();var nr={class:`one-commit-content`},rr={class:`one-commit-text`},ir={class:`one-commit-title`},ar={key:0,class:`one-commit-desc`},or=Z(h({__name:`QuickCommitButton`,props:{from:{default:`form`},hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1}},emits:[`beforeCommit`,`afterCommit`,`clearFields`],setup(e,{expose:t,emit:n}){let r=Q(),i=Oe(),a=e,o=n,s=k(()=>r.fileList.some(e=>!Pe(e.path,i.lockedFiles))),u=k(()=>r.isSelectionMode&&r.selectedFiles.size>0&&r.selectedUnstagedPaths.length>0),d=k(()=>r.hasConflictedFiles?!0:r.isSelectionMode?!u.value||!a.hasUserCommitMessage:!s.value||!a.hasUserCommitMessage),f=k(()=>r.isAddingFiles||r.isCommiting),p=k(()=>r.hasConflictedFiles?X(`@2E184:存在冲突文件,请先解决冲突`):r.isSelectionMode?r.selectedFiles.size===0?X(`@2E184:请先勾选要提交的文件`):r.selectedUnstagedPaths.length===0?X(`@2E184:所选文件无需暂存或被锁定`):a.hasUserCommitMessage?X(`@2E184:一键完成:仅暂存所选文件 → 提交`):X(`@2E184:请输入提交信息`):s.value?a.hasUserCommitMessage?X(`@2E184:一键完成:暂存所有更改 → 提交`):X(`@2E184:请输入提交信息`):X(`@2E184:没有需要提交的更改`)),m=k(()=>r.isSelectionMode&&u.value?X(`@2E184:一键提交所选`):X(`@2E184:一键提交`)),h=k(()=>a.from===`form`?r.isSelectionMode&&u.value?X(`@2E184:暂存所选 + 提交`):X(`@2E184:暂存 + 提交`):``);async function _(){o(`beforeCommit`);try{let e=await r.stageSelectedAndCommit(a.finalCommitMessage,a.skipHooks);e&&o(`clearFields`),o(`afterCommit`,e)}catch(e){console.error(`一键提交失败:`,e),o(`afterCommit`,!1)}}return t({triggerQuickCommit:_}),(t,n)=>{let r=g,i=Y;return L(),U(`div`,null,[C(l(M),{content:p.value,placement:`top`,"show-after":200},{default:B(()=>[C(i,{type:`primary`,onClick:_,loading:f.value,disabled:d.value,class:K([e.from,`one-commit-button`])},{default:B(()=>[c(`div`,nr,[C(r,{class:`one-commit-icon`},{default:B(()=>[C(l(oe))]),_:1}),c(`div`,rr,[c(`span`,ir,E(m.value),1),e.from===`form`?(L(),U(`span`,ar,E(h.value),1)):S(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}}}),[[`__scopeId`,`data-v-91c441c2`]]);n(),w(),G();var sr={class:`one-ai-push`},cr={class:`one-ai-push-content`},lr={class:`one-ai-push-text`},ur={class:`one-ai-push-title`},dr={key:0,class:`one-ai-push-desc`},fr=Z(h({__name:`AiQuickPushButton`,props:{from:{default:`form`},generating:{type:Boolean,default:!1}},emits:[`trigger`],setup(e,{emit:t}){let n=Q(),r=Oe(),i=e,a=t,o=k(()=>n.fileList.some(e=>!Pe(e.path,r.lockedFiles))),s=k(()=>n.isSelectionMode&&n.selectedFiles.size>0&&n.selectedUnstagedPaths.length>0),u=k(()=>n.hasConflictedFiles||!n.hasUpstream?!0:n.isSelectionMode?!s.value:!o.value&&n.branchAhead===0),d=k(()=>i.generating||n.isAddingFiles||n.isCommiting||n.isPushing),f=k(()=>n.hasConflictedFiles?X(`@2E184:存在冲突文件,请先解决冲突`):n.hasUpstream?i.generating?X(`@2E184:AI 正在生成提交信息…`):n.isSelectionMode?s.value?X(`@2E184:一键完成:AI 生成提交信息 → 仅暂存所选文件 → 提交 → 推送`):X(`@2E184:请先勾选要推送的文件`):!o.value&&n.branchAhead===0?X(`@2E184:没有需要提交或推送的更改`):o.value?X(`@2E184:一键完成:AI 生成提交信息 → 暂存所有更改 → 提交 → 推送`):X(`@2E184:本地已提交,AI 将直接推送到远程仓库`):X(`@2E184:当前分支没有上游分支`)),p=k(()=>n.isSelectionMode&&s.value?X(`@2E184:AI 提交并推送所选`):X(`@2E184:AI 提交并推送`)),m=k(()=>i.from===`form`?X(`@2E184:AI 生成信息 + 推送`):``);function h(){u.value||d.value||a(`trigger`)}return(t,n)=>{let r=Y;return L(),U(`div`,sr,[C(l(M),{content:f.value,placement:`top`,"show-after":200},{default:B(()=>[C(r,{type:`primary`,onClick:h,loading:d.value,disabled:u.value,class:K([e.from,`one-ai-push-button`])},{default:B(()=>[c(`div`,cr,[C(Te,{class:`one-ai-push-icon`,"icon-class":`ai-commit`,style:{color:`#fff`}}),c(`div`,lr,[c(`span`,ur,E(p.value),1),e.from===`form`?(L(),U(`span`,dr,E(m.value),1)):S(``,!0)])])]),_:1},8,[`loading`,`disabled`,`class`])]),_:1},8,[`content`])])}}}),[[`__scopeId`,`data-v-7c1fd6f9`]]);n(),G();var pr={class:`form-bottom-actions`},mr={class:`actions-flex-container`},hr={class:`left-actions`},gr={class:`button-grid`},_r={class:`right-actions`},vr=Z(h({__name:`GitActionButtons`,props:{hasUserCommitMessage:{type:Boolean,default:!1},finalCommitMessage:{default:``},skipHooks:{type:Boolean,default:!1},from:{default:`form`},aiGenerating:{type:Boolean,default:!1}},emits:[`afterCommit`,`afterPush`,`beforePush`,`pushStart`,`clearFields`,`aiQuickPush`],setup(e,{expose:t,emit:n}){let r=n,i=z(null);function a(e){r(`afterCommit`,e)}function o(e){r(`afterPush`,e)}function s(){r(`beforePush`)}function l(){r(`pushStart`)}function u(){r(`clearFields`)}function d(){r(`aiQuickPush`)}async function f(){return i.value?.triggerQuickPush()}return t({triggerQuickPush:f}),(t,n)=>(L(),U(`div`,pr,[c(`div`,mr,[c(`div`,hr,[c(`div`,gr,[C(Ve,{onClick:()=>{},from:e.from},null,8,[`from`]),C(Ue,{"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforeCommit:()=>{},onAfterCommit:a,onClick:()=>{},from:e.from},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`from`]),C(ft,{onBeforePush:()=>{},onAfterPush:o,onClick:()=>{},from:e.from},null,8,[`from`])])]),c(`div`,_r,[C(or,{from:e.from,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onAfterCommit:a,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),C(_t,{ref_key:`quickPushRef`,ref:i,from:e.from,"has-user-commit-message":e.hasUserCommitMessage,"final-commit-message":e.finalCommitMessage,"skip-hooks":e.skipHooks,onBeforePush:s,onPushStart:l,onAfterPush:o,onClearFields:u},null,8,[`from`,`has-user-commit-message`,`final-commit-message`,`skip-hooks`]),C(fr,{from:e.from,generating:e.aiGenerating,onTrigger:d},null,8,[`from`,`generating`])])])]))}}),[[`__scopeId`,`data-v-32a611a8`]]);n(),G(),w(),V();var yr={class:`dialog-toolbar`},br={class:`filter-controls`},xr={class:`toolbar-actions`},Sr=[`disabled`],Cr={class:`btn-text`},wr=[`disabled`],Tr={class:`btn-text`},Er=[`disabled`],Dr={class:`btn-text`},Or={class:`history-scroll`},kr={key:0,class:`loading-state`},Ar={class:`loading-text`},jr={key:3,class:`history-list`},Mr=[`onClick`],Nr={class:`command-info`},Pr={class:`command-text`},Fr={class:`command-meta`},Ir={class:`timestamp`},Lr={class:`duration`},Rr={class:`item-actions`},zr={key:0,class:`item-details`},Br={key:0,class:`output-section`},Vr={class:`output-header`},Hr=[`onClick`],Ur={class:`output-content`},Wr={key:0,class:`truncation-notice`},Gr={class:`output-header`},Kr={class:`output-content`},qr={key:0,class:`truncation-notice`},Jr={key:2,class:`output-section error`},Yr={class:`output-header`},Xr={class:`output-content`},Zr=Z(h({__name:`CommandHistory`,setup(n){let r=Q(),i=z([]),a=z(!1);function s(e){return Array.isArray(e)?e.join(` `):e==null?``:String(e)}let d=z(!1),p=z(!1),h=z(!1),_=z(new Set),y=z(!1),x=z(!1),w=z(`all`),D=z(`all`),O=z(``),j=k(()=>{let e=i.value;if(w.value!==`all`&&(e=e.filter(e=>w.value===`success`?e.success:!e.success)),D.value!==`all`&&(e=e.filter(e=>{let t=s(e.command).startsWith(`git `);return D.value===`git`?t:!t})),O.value.trim()){let t=O.value.toLowerCase();e=e.filter(e=>s(e.command).toLowerCase().includes(t)||e.stdout&&e.stdout.toLowerCase().includes(t)||e.stderr&&e.stderr.toLowerCase().includes(t)||e.error&&e.error.toLowerCase().includes(t))}return e}),N=k(()=>i.value.filter(e=>e.success).length),P=k(()=>i.value.filter(e=>!e.success).length),I=k(()=>i.value.filter(e=>s(e.command).startsWith(`git `)).length),ne=k(()=>i.value.filter(e=>!s(e.command).startsWith(`git `)).length);function V(){x.value=!0,i.value.length===0&&oe()}async function oe(){try{if(a.value=!0,r.socket&&r.socket.connected)r.socket.emit(`request_full_history`);else{let e=await(await fetch(`/api/command-history`)).json();e.success?i.value=e.history:R.error(`${X(`@81F0F:加载命令历史失败: `)}${e.error}`)}}catch(e){R.error(`${X(`@81F0F:加载命令历史失败: `)}${e.message}`)}finally{a.value=!1}}async function se(){if(j.value.length===0){R.warning(X(`@81F0F:没有可复制的命令历史`));return}try{p.value=!0;let e=j.value.map(e=>{let t=`# ${de(e.timestamp)}${X(`@81F0F: (耗时: `)}${fe(e.executionTime)}) - ${e.success?X(`@81F0F:成功`):X(`@81F0F:失败`)}\n`;if(t+=`${s(e.command)}\n`,e.stdout&&(t+=`\n# 输出:\n${e.stdout}\n`),e.stderr){let n=G(e.command)?X(`@81F0F:输出信息`):X(`@81F0F:错误输出`);t+=`\n# ${n}:\n${e.stderr}\n`}return e.error&&(t+=`\n# 错误信息:\n${e.error}\n`),t}).join(`
|
|
2
|
+
---
|
|
3
|
+
|
|
4
|
+
`);await navigator.clipboard.writeText(e),R({message:X(`@81F0F:命令历史已复制到剪贴板`),type:`success`,zIndex:1e5})}catch(e){R.error(`${X(`@81F0F:复制失败: `)}${e.message}`)}finally{p.value=!1}}async function ce(){if(j.value.length===0){R.warning(X(`@81F0F:没有可复制的命令`));return}try{y.value=!0;let e=j.value.map(e=>s(e.command)).join(`
|
|
5
|
+
`);await navigator.clipboard.writeText(e),R({message:X(`@81F0F:命令列表已复制到剪贴板`),type:`success`,zIndex:1e5})}catch(e){R.error(`${X(`@81F0F:复制失败: `)}${e.message}`)}finally{y.value=!1}}async function le(){try{if(await H.confirm(X(`@81F0F:确定要清空所有命令历史记录吗?此操作不可恢复。`),X(`@81F0F:清空命令历史`),{confirmButtonText:X(`@81F0F:确定`),cancelButtonText:X(`@81F0F:取消`),type:`warning`}),d.value=!0,r.socket&&r.socket.connected)r.socket.emit(`clear_command_history`);else{let e=await(await fetch(`/api/clear-command-history`,{method:`POST`,headers:{"Content-Type":`application/json`}})).json();e.success?(i.value=[],R.success(X(`@81F0F:命令历史已清空`))):R.error(`${X(`@81F0F:清空命令历史失败: `)}${e.error}`)}}catch(e){e!==`cancel`&&e.toString()!==`Error: cancel`&&R.error(`${X(`@81F0F:清空命令历史失败: `)}${e.message}`)}finally{d.value=!1}}function de(e){return new Date(e).toLocaleString()}function fe(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}function pe(e){_.value.has(e)?_.value.delete(e):_.value.add(e)}function W(e){return _.value.has(e)}async function me(e){try{await navigator.clipboard.writeText(e),R({message:X(`@81F0F:命令已复制到剪贴板`),type:`success`,zIndex:1e5})}catch(e){R.error(`${X(`@81F0F:复制失败: `)}${e.message}`)}}function he(e){return e.includes(`git push`)||e.includes(`git-push`)}function G(e){return!!he(s(e))}async function q(e){try{let t=``;if(e.stdout&&(t+=`标准输出:\n${e.stdout}\n\n`),e.stderr){let n=G(e.command)?X(`@81F0F:输出信息`):X(`@81F0F:错误输出`);t+=`${n}:\n${e.stderr}\n\n`}e.error&&(t+=`错误信息:\n${e.error}`),await navigator.clipboard.writeText(t.trim()),R({message:X(`@81F0F:输出已复制到剪贴板`),type:`success`,zIndex:1e5})}catch(e){R.error(`${X(`@81F0F:复制失败: `)}${e.message}`)}}function _e(){if(!r.socket){console.error(X(`@81F0F:Socket实例不可用`));return}r.socket.on(`initial_command_history`,e=>{i.value=e.history,h.value=!0}),r.socket.on(`command_history_update`,e=>{i.value.unshift(e.newCommand),i.value.length>100&&i.value.pop(),h.value=!0}),r.socket.on(`full_command_history`,e=>{i.value=e.history,a.value=!1,h.value=!0}),r.socket.on(`command_history_cleared`,e=>{e.success&&(i.value=[],R.success(X(`@81F0F:命令历史已清空`))),d.value=!1}),r.socket.on(`connect`,()=>{h.value=!0,R.success(X(`@81F0F:已连接到实时命令历史`))}),r.socket.on(`disconnect`,()=>{h.value=!1,R.warning(X(`@81F0F:实时命令历史连接已断开`))})}function ve(){r.socket&&(r.socket.off(`initial_command_history`),r.socket.off(`command_history_update`),r.socket.off(`full_command_history`),r.socket.off(`command_history_cleared`))}return te(()=>{_e(),r.socket||(console.log(X(`@81F0F:尝试初始化Socket连接`)),r.initSocketConnection())}),F(()=>{ve()}),(n,r)=>{let _=g,k=v,F=u,te=m,R=A,z=M,oe=Se,H=ge;return L(),U(J,null,[C(Ee,{tooltip:l(X)(`@81F0F:查看Git命令历史`),size:`large`,onClick:V},{default:B(()=>[C(_,null,{default:B(()=>[C(l(re))]),_:1})]),_:1},8,[`tooltip`]),C(Ae,{modelValue:x.value,"onUpdate:modelValue":r[3]||=e=>x.value=e,title:l(X)(`@81F0F:Git 命令历史`),"destroy-on-close":``,"custom-class":`command-history-dialog`,"append-to-body":!0},{default:B(()=>[c(`div`,yr,[C(k,{type:h.value?`success`:`danger`,size:`small`,effect:`dark`,class:`socket-status`},{default:B(()=>[b(E(h.value?l(X)(`@81F0F:实时更新`):l(X)(`@81F0F:未连接`)),1)]),_:1},8,[`type`]),c(`div`,br,[C(te,{modelValue:w.value,"onUpdate:modelValue":r[0]||=e=>w.value=e,size:`small`,class:`filter-select`},{default:B(()=>[C(F,{label:`全部状态`,value:`all`}),C(F,{label:`成功 (${N.value})`,value:`success`},null,8,[`label`]),C(F,{label:`失败 (${P.value})`,value:`error`},null,8,[`label`])]),_:1},8,[`modelValue`]),C(te,{modelValue:D.value,"onUpdate:modelValue":r[1]||=e=>D.value=e,size:`small`,class:`filter-select`},{default:B(()=>[C(F,{label:`全部命令`,value:`all`}),C(F,{label:`Git 命令 (${I.value})`,value:`git`},null,8,[`label`]),C(F,{label:`其他命令 (${ne.value})`,value:`other`},null,8,[`label`])]),_:1},8,[`modelValue`]),C(R,{modelValue:O.value,"onUpdate:modelValue":r[2]||=e=>O.value=e,size:`small`,placeholder:`搜索命令或输出...`,clearable:``,class:`search-input`},{prefix:B(()=>[C(_,null,{default:B(()=>[C(l(f))]),_:1})]),_:1},8,[`modelValue`])]),c(`div`,xr,[C(z,{content:l(X)(`@81F0F:只复制命令列表(不含输出)`),placement:`bottom`,effect:`dark`,"show-after":200},{default:B(()=>[c(`button`,{class:`modern-btn copy-commands-button enhanced-btn`,onClick:ce,disabled:j.value.length===0||y.value},[y.value?(L(),o(_,{key:1,class:`btn-icon is-loading`},{default:B(()=>[C(l(t))]),_:1})):(L(),o(_,{key:0,class:`btn-icon`},{default:B(()=>[C(l(ae))]),_:1})),c(`span`,Cr,E(l(X)(`@81F0F:命令`)),1)],8,Sr)]),_:1},8,[`content`]),C(z,{content:l(X)(`@81F0F:复制完整命令历史(含输出)`),placement:`bottom`,effect:`dark`,"show-after":200},{default:B(()=>[c(`button`,{class:`modern-btn copy-all-button enhanced-btn`,onClick:se,disabled:j.value.length===0||p.value},[p.value?(L(),o(_,{key:1,class:`btn-icon is-loading`},{default:B(()=>[C(l(t))]),_:1})):(L(),o(_,{key:0,class:`btn-icon`},{default:B(()=>[C(l(ae))]),_:1})),c(`span`,Tr,E(l(X)(`@81F0F:全部`)),1)],8,wr)]),_:1},8,[`content`]),C(z,{content:l(X)(`@81F0F:清空命令历史`),placement:`bottom`,effect:`dark`,"show-after":200},{default:B(()=>[c(`button`,{class:`modern-btn clear-button enhanced-btn danger-btn`,onClick:le,disabled:i.value.length===0||d.value},[d.value?(L(),o(_,{key:1,class:`btn-icon is-loading`},{default:B(()=>[C(l(t))]),_:1})):(L(),o(_,{key:0,class:`btn-icon`},{default:B(()=>[C(l(ue))]),_:1})),c(`span`,Dr,E(l(X)(`@81F0F:清空`)),1)],8,Er)]),_:1},8,[`content`])])]),c(`div`,Or,[a.value&&i.value.length===0?(L(),U(`div`,kr,[C(_,{class:`loading-icon is-loading`},{default:B(()=>[C(l(t))]),_:1}),c(`div`,Ar,E(l(X)(`@81F0F:加载命令历史...`)),1)])):i.value.length===0?(L(),o(oe,{key:1,description:l(X)(`@81F0F:暂无命令历史`)},null,8,[`description`])):j.value.length===0?(L(),o(oe,{key:2,description:l(X)(`@81F0F:没有匹配的命令`)},null,8,[`description`])):(L(),U(`div`,jr,[(L(!0),U(J,null,e(j.value,(e,t)=>(L(),U(`div`,{key:t,class:K([`history-item`,{"is-error":!e.success}])},[c(`div`,{class:`item-header`,onClick:e=>pe(t)},[c(`div`,Nr,[c(`div`,Pr,[C(k,{size:`small`,type:e.success?`success`:`danger`,effect:`dark`,class:`status-tag`},{default:B(()=>[b(E(e.success?l(X)(`@81F0F:成功`):l(X)(`@81F0F:失败`)),1)]),_:2},1032,[`type`]),c(`code`,null,E(s(e.command)),1)]),c(`div`,Fr,[c(`span`,Ir,E(de(e.timestamp)),1),c(`span`,Lr,E(l(X)(`@81F0F:耗时: `))+E(fe(e.executionTime)),1)])]),c(`div`,Rr,[C(Ee,{tooltip:l(X)(`@81F0F:复制命令`),"custom-class":`item-copy-button`,onClick:ie(t=>me(s(e.command)),[`stop`])},{default:B(()=>[C(_,null,{default:B(()=>[C(l(ae))]),_:1})]),_:1},8,[`tooltip`,`onClick`]),c(`div`,{class:K([`expand-button`,{"is-expanded":W(t)}])},[C(_,{class:`btn-icon`},{default:B(()=>[W(t)?(L(),o(l(T),{key:0})):(L(),o(l(ee),{key:1}))]),_:2},1024)],2)])],8,Mr),W(t)?(L(),U(`div`,zr,[e.stdout?(L(),U(`div`,Br,[c(`div`,Vr,[c(`h4`,null,E(l(X)(`@81F0F:标准输出`)),1),C(z,{content:l(X)(`@81F0F:复制输出`),placement:`bottom`,effect:`dark`,"show-after":200},{default:B(()=>[c(`button`,{class:`modern-btn output-copy-button enhanced-btn`,onClick:t=>q(e)},[C(_,{class:`btn-icon`},{default:B(()=>[C(l(ae))]),_:1})],8,Hr)]),_:2},1032,[`content`])]),c(`pre`,Ur,E(e.stdout),1),e.isStdoutTruncated?(L(),U(`div`,Wr,[C(H,{type:`info`,closable:!1,"show-icon":``},{default:B(()=>[b(E(l(X)(`@81F0F:输出内容过长已被截断,请直接执行命令查看完整输出`)),1)]),_:1})])):S(``,!0)])):S(``,!0),e.stderr?(L(),U(`div`,{key:1,class:K([`output-section`,G(e.command)?``:`error`])},[c(`div`,Gr,[c(`h4`,null,E(G(e.command)?l(X)(`@81F0F:输出信息`):l(X)(`@81F0F:错误输出`)),1)]),c(`pre`,Kr,E(e.stderr),1),e.isStderrTruncated?(L(),U(`div`,qr,[C(H,{type:`info`,closable:!1,"show-icon":``},{default:B(()=>[b(E(G(e.command)?l(X)(`@81F0F:输出信息`):l(X)(`@81F0F:错误输出`))+E(l(X)(`@81F0F:内容过长已被截断,请直接执行命令查看完整输出`)),1)]),_:2},1024)])):S(``,!0)],2)):S(``,!0),e.error?(L(),U(`div`,Jr,[c(`div`,Yr,[c(`h4`,null,E(l(X)(`@81F0F:错误信息`)),1)]),c(`pre`,Xr,E(e.error),1)])):S(``,!0)])):S(``,!0)],2))),128))]))])]),_:1},8,[`modelValue`,`title`])],64)}}}),[[`__scopeId`,`data-v-6ba10e2c`]]);n(),G(),w(),V();var Qr={class:`card-header app-card-header`},$r={class:`header-left`},ei={class:`header-right`},ti={class:`card-content app-card-content`},ni={class:`layout-container`},ri={key:0,class:`git-config-warning`},ii={key:0,class:`merge-in-progress-banner`},ai={class:`commit-section`},oi={key:0,class:`commit-form`},si={class:`description-container`},ci={key:1,class:`standard-commit-form`},li={class:`standard-commit-header`},ui={class:`type-scope-container`},di={class:`scope-wrapper`},fi={class:`description-container description-inline`},pi=[`aria-expanded`],mi={class:`advanced-fields`},hi={key:0,class:`status-updating-indicator`},gi={key:0,class:`status-updating-indicator`},_i=Z(h({__name:`CommitForm`,setup(n){let r=z(!1),i=z(!1);async function a(){let e=f.isSelectionMode&&f.selectedFiles.size>0?[...f.selectedFiles]:[],t=De(),n=await(await fetch(`/api/config/generate-commit-message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selectedPaths:e,locale:t.currentLocale})})).json();if(!n.success){let e=n.code,t=n.error||X(`@76872:AI生成失败`),r=e?{TIMEOUT:`@76872:AI生成超时,请重试或检查模型响应速度`,NO_MODEL:`@76872:未配置AI模型,请先在通用设置中添加模型`,NO_JSON:`@76872:AI未返回有效结果,请重试`,PARSE_FAILED:`@76872:AI返回格式无法解析,请重试`,GENERATE_FAILED:`@76872:AI生成失败`,HTTP_ERR:`@76872:AI生成失败`}[e]:null;return R.error(r?X(r):t),!1}let r=[`feat`,`fix`,`docs`,`style`,`refactor`,`test`,`chore`];if(D.value)n.type&&r.includes(n.type)&&(O.value=n.type),n.scope!==void 0&&(M.value=n.scope),n.description&&(P.value=n.description);else{let e=n.type&&n.description?n.scope?`${n.type}(${n.scope}): ${n.description}`:`${n.type}: ${n.description}`:n.description||``;e&&(h.value=e)}return!0}async function s(){if(!r.value){r.value=!0;try{if(!await a())return;R.success(X(`@76872:AI已生成提交信息`))}catch(e){R.error(`${X(`@76872:AI生成失败`)}: ${e.message}`)}finally{r.value=!1}}}async function d(){if(!i.value){i.value=!0;try{let e=f.isSelectionMode&&f.selectedFiles.size>0,t=f.fileList.some(e=>!Pe(e.path,p.lockedFiles));if(e||t){v({text:X(`@76872:AI 正在生成提交信息…`),showProgress:!1});let e=!1;try{e=await a()}finally{y()}if(!e)return;if(await N(),!W.value){R.error(X(`@76872:AI生成失败`));return}}await se.value?.triggerQuickPush?.()}catch(e){console.error(`AI 提交并推送失败:`,e),R.error(`${X(`@76872:AI生成失败`)}: ${e.message}`)}finally{i.value=!1}}}let f=Q(),p=Oe(),h=z(``),{loadingState:_,show:v,hide:y,setText:b}=$n(),{successState:x}=tr(),w=z(!1),T=z(``),D=k({get:()=>p.isStandardCommit,set:e=>{p.isStandardCommit=e}}),O=z(`feat`),M=z(``),P=z(``),F=z(``),I=z(``),ne=z([]),re=z(!1),ie=z([]),ae=z(!1),V=z(!1),oe=k({get:()=>p.skipHooks,set:e=>{p.skipHooks=e}}),H=k({get:()=>p.autoQuickPushOnEnter,set:e=>{p.autoQuickPushOnEnter=e}}),se=z(null),ue=z(!1),de=k(()=>[{value:`feat`,label:`feat: ${X(`@76872:新功能`)}`},{value:`fix`,label:`fix: ${X(`@76872:修复bug`)}`},{value:`docs`,label:`docs: ${X(`@76872:文档修改`)}`},{value:`style`,label:`style: ${X(`@76872:样式修改`)}`},{value:`refactor`,label:`refactor: ${X(`@76872:代码重构`)}`},{value:`test`,label:`test: ${X(`@76872:测试代码`)}`},{value:`chore`,label:`chore: ${X(`@76872:构建/工具修改`)}`}]),fe=z([]),pe=k(()=>{if(!D.value)return h.value||T.value;let e=`${O.value||``}`;return M.value&&(e+=`(${M.value})`),e+=`: ${P.value}`,F.value&&(e+=`\n\n${F.value}`),I.value&&(e+=`\n\n${I.value}`),e}),W=k(()=>D.value?(f.isMergeInProgress||(O.value||``).trim()!==``)&&(P.value||``).trim()!==``:h.value.trim()!==``),he=k(()=>f.hasConflictedFiles?!0:f.isMergeInProgress?!W.value:!f.fileList.some(e=>!Pe(e.path,p.lockedFiles))||!W.value),G=k(()=>{let e=`${X(`@76872:输入提交信息 (默认: `)}${T.value})`;return H.value?`${e}${X(`@76872:(按回车一键推送)`)}`:e}),q=k(()=>{let e=X(`@76872:简短描述(必填)`);return H.value?X(`@76872:简短描述(必填,按回车一键推送)`):e}),_e=k(()=>{let e=`git commit -m "${pe.value}"`;return oe.value&&(e+=` --no-verify`),e});function ve(){let e=p.config;e&&(T.value=e.defaultCommitMessage||``,e.descriptionTemplates&&Array.isArray(e.descriptionTemplates)&&(ne.value=e.descriptionTemplates),e.scopeTemplates&&Array.isArray(e.scopeTemplates)&&(ie.value=e.scopeTemplates),e.messageTemplates&&Array.isArray(e.messageTemplates)&&(fe.value=e.messageTemplates))}function be(e){P.value=e,re.value=!1}function xe(e){M.value=e,ae.value=!1}function Se(){re.value=!0}function Y(){ae.value=!0}function Ce(){h.value=``,P.value=``,F.value=``,I.value=``,O.value=`feat`,p.autoSetDefaultMessage&&p.defaultCommitMessage&&(D.value?P.value=p.defaultCommitMessage:h.value=p.defaultCommitMessage)}function we(){v({text:X(`@76872:正在暂存文件…`),showProgress:!1})}function Z(){y()}function Te(e){if(y(),e){w.value=!0;try{setTimeout(async()=>{try{console.log(X(`@76872:推送成功,状态已更新`))}catch(e){console.error(`一键推送后处理失败:`,e)}finally{w.value=!1}},1e3)}catch(e){console.error(`一键推送后处理失败:`,e),w.value=!1}}}function ke(e){h.value=e,V.value=!1}async function Ae(e){if(!H.value||!W.value)return;let t=f.fileList.some(e=>!Pe(e.path,p.lockedFiles)),n=f.hasConflictedFiles;if(t&&W.value&&f.hasUpstream&&!n&&e.key===`Enter`&&!e.shiftKey){e.preventDefault();try{await se.value?.triggerQuickPush()}catch(e){console.error(`回车自动一键提交失败:`,e)}}}async function Me(e){try{await p.saveDefaultMessage(e)&&R.success(X(`@76872:默认提交信息设置成功`))}catch(e){R.error(`${X(`@76872:设置默认提交信息失败: `)}${e.message}`)}}me(()=>f.pendingMergeMessage,e=>{e&&(D.value?(O.value=``,P.value=e):h.value=e,f.pendingMergeMessage=``,R.info(X(`@76872:已自动填充合并提交信息`)))}),me(()=>f.isAddingFiles,e=>{e&&_.visible&&b(X(`@76872:正在暂存文件…`))}),me(()=>f.isCommiting,e=>{e&&_.visible&&b(X(`@76872:正在提交更改...`))}),me(()=>f.isPushing,e=>{e&&_.visible&&y()}),te(async()=>{me(()=>p.config,ve,{immediate:!0}),p.config||await p.loadConfig(),p.autoSetDefaultMessage&&p.defaultCommitMessage&&(D.value?P.value||=p.defaultCommitMessage:h.value||=p.defaultCommitMessage),f.pendingMergeMessage&&(D.value?(O.value=``,P.value=f.pendingMergeMessage):h.value=f.pendingMergeMessage,f.pendingMergeMessage=``,R.info(X(`@76872:已自动填充合并提交信息`)))});function Fe(e,t){t([...e?ne.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):ne.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function Ie(e,t){t([...e?ie.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):ie.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function Le(e){e.isSettings?(Se(),P.value=``):P.value=e.value}function Re(e){e.isSettings?(Y(),M.value=``):M.value=e.value}function ze(e,t){t([...e?fe.value.filter(t=>t.toLowerCase().includes(e.toLowerCase())).map(e=>({value:e})):fe.value.map(e=>({value:e})),{value:`⚙️ 管理模板…`,isSettings:!0}])}function Be(e){e.isSettings?(V.value=!0,h.value=``):h.value=e.value}return(n,a)=>{let p=g,v=Hn,y=ge,b=j,T=u,k=m,N=A;return L(),U(J,null,[c(`div`,{class:K([`card app-card`,{"is-pushing":l(f).isPushing}])},[c(`div`,Qr,[c(`div`,$r,[l(f).userName!==``&&l(f).userEmail!==``?(L(),o(vr,{key:0,ref_key:`gitActionButtonsRef`,ref:se,"has-user-commit-message":W.value,"final-commit-message":pe.value,"skip-hooks":oe.value,"ai-generating":i.value,onAfterCommit:a[0]||=e=>{e&&Ce()},onAfterPush:Te,onBeforePush:we,onPushStart:Z,onClearFields:Ce,onAiQuickPush:d},null,8,[`has-user-commit-message`,`final-commit-message`,`skip-hooks`,`ai-generating`])):S(``,!0)]),c(`div`,ei,[C(Ee,{tooltip:l(X)(`@76872:AI生成提交信息`),"icon-class":r.value?``:`ai-commit`,size:`medium`,disabled:r.value,onClick:s},{default:B(()=>[r.value?(L(),o(p,{key:0,class:`is-loading`},{default:B(()=>[C(l(t))]),_:1})):S(``,!0)]),_:1},8,[`tooltip`,`icon-class`,`disabled`]),C(Zr),C(v,{class:`ml-auto`,variant:`icon`})])]),c(`div`,ti,[c(`div`,ni,[l(f).userName===``||l(f).userEmail===``?(L(),U(`div`,ri,[C(y,{title:l(X)(`@76872:Git用户信息未配置`),type:`warning`,closable:!1,"show-icon":``},{default:B(()=>[c(`p`,null,E(l(X)(`@76872:您需要配置Git用户名和邮箱才能提交代码。请使用以下命令配置:`)),1),a[11]||=c(`pre`,{class:`config-command`},`git config --global user.name "Your Name"
|
|
6
|
+
git config --global user.email "your.email@example.com"`,-1)]),_:1},8,[`title`])])):(L(),U(J,{key:1},[l(f).isMergeInProgress?(L(),U(`div`,ii,[C(y,{title:l(X)(`@76872:合并进行中`),type:`warning`,closable:!1,"show-icon":``},{default:B(()=>[c(`span`,null,E(l(X)(`@76872:分支合并尚未完成,请输入提交信息后点击「提交」按钮完成合并。`)),1)]),_:1},8,[`title`])])):S(``,!0),c(`div`,ai,[D.value?(L(),U(`div`,ci,[c(`div`,li,[c(`div`,ui,[C(k,{modelValue:O.value,"onUpdate:modelValue":a[2]||=e=>O.value=e,placeholder:l(X)(`@76872:提交类型`),class:`type-select`,clearable:``},{default:B(()=>[(L(!0),U(J,null,e(de.value,e=>(L(),o(T,{key:e.value,label:e.label,value:e.value},null,8,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`placeholder`]),c(`div`,di,[C(b,{modelValue:M.value,"onUpdate:modelValue":a[3]||=e=>M.value=e,"fetch-suggestions":Ie,placeholder:l(X)(`@76872:作用域(可选)`),class:`scope-input`,clearable:``,onSelect:Re},null,8,[`modelValue`,`placeholder`])]),c(`div`,fi,[C(b,{modelValue:P.value,"onUpdate:modelValue":a[4]||=e=>P.value=e,"fetch-suggestions":Fe,placeholder:q.value,class:`description-input`,clearable:``,onSelect:Le,onKeydown:Ae},null,8,[`modelValue`,`placeholder`])])])]),c(`button`,{type:`button`,class:`advanced-options-toggle`,"aria-expanded":ue.value,onClick:a[5]||=e=>ue.value=!ue.value},[c(`span`,null,E(ue.value?l(X)(`@76872:收起`):l(X)(`@76872:正文及页脚`)),1),C(p,{class:K([`toggle-icon`,{"is-active":ue.value}])},{default:B(()=>[C(l(ee))]),_:1},8,[`class`])],8,pi),le(c(`div`,mi,[C(N,{modelValue:F.value,"onUpdate:modelValue":a[6]||=e=>F.value=e,type:`textarea`,rows:4,placeholder:l(X)(`@76872:正文(可选):详细描述本次提交的内容和原因`),class:`body-input`,clearable:``},null,8,[`modelValue`,`placeholder`]),C(N,{modelValue:I.value,"onUpdate:modelValue":a[7]||=e=>I.value=e,placeholder:l(X)(`@76872:页脚(可选):如 Closes #123`),class:`footer-input`,clearable:``},null,8,[`modelValue`,`placeholder`])],512),[[ye,ue.value]])])):(L(),U(`div`,oi,[c(`div`,si,[C(b,{modelValue:h.value,"onUpdate:modelValue":a[1]||=e=>h.value=e,"fetch-suggestions":ze,placeholder:G.value,type:`textarea`,rows:3,resize:`none`,class:`commit-message-input`,onSelect:Be,onKeydown:Ae},null,8,[`modelValue`,`placeholder`])])])),he.value?S(``,!0):(L(),o(Ne,{key:2,command:_e.value,title:l(X)(`@76872:提交命令预览:`),placeholder:`git commit -m "<提交信息>"`},null,8,[`command`,`title`]))])],64))])])],2),C(je,{visible:re.value,"onUpdate:visible":a[8]||=e=>re.value=e,type:`description`,title:l(X)(`@76872:简短描述模板设置`),placeholder:l(X)(`@76872:输入新模板内容`),"edit-placeholder":l(X)(`@76872:编辑模板内容`),"empty-description":l(X)(`@76872:暂无保存的模板`),onUseTemplate:be},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),C(je,{visible:ae.value,"onUpdate:visible":a[9]||=e=>ae.value=e,type:`scope`,title:l(X)(`@76872:作用域模板设置`),placeholder:l(X)(`@76872:输入新作用域模板`),"edit-placeholder":l(X)(`@76872:编辑作用域模板内容`),"empty-description":l(X)(`@76872:暂无保存的作用域`),onUseTemplate:xe},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),C(je,{visible:V.value,"onUpdate:visible":a[10]||=e=>V.value=e,type:`message`,title:l(X)(`@76872:默认提交信息设置`),placeholder:l(X)(`@76872:输入新模板内容`),"edit-placeholder":l(X)(`@76872:编辑模板内容`),"empty-description":l(X)(`@76872:暂无保存的模板`),"show-default-section":!0,"show-help-text":!0,onUseTemplate:ke,onSetDefault:Me},null,8,[`visible`,`title`,`placeholder`,`edit-placeholder`,`empty-description`]),C(ce,{name:`el-fade-in-linear`},{default:B(()=>[w.value?(L(),U(`div`,hi,[C(p,{class:`is-loading`},{default:B(()=>[C(l(t))]),_:1}),c(`span`,null,E(l(X)(`@76872:更新状态中...`)),1)])):S(``,!0)]),_:1}),C(qn,{visible:l(_).visible,text:l(_).text,"show-progress":l(_).showProgress,progress:l(_).progress},null,8,[`visible`,`text`,`show-progress`,`progress`]),C(Qn,{visible:l(x).visible,text:l(x).text,description:l(x).description},null,8,[`visible`,`text`,`description`]),C(ce,{name:`el-fade-in-linear`},{default:B(()=>[w.value?(L(),U(`div`,gi,[C(p,{class:`is-loading`},{default:B(()=>[C(l(t))]),_:1}),c(`span`,null,E(l(X)(`@76872:更新状态中...`)),1)])):S(``,!0)]),_:1})],64)}}}),[[`__scopeId`,`data-v-e7d03318`]]);export{_i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,E as n,En as r,Er as i,In as a,Nn as o,On as s,Pn as c,Pr as l,Qr as u,Tn as d,Wn as f,Yr as p,Zn as m,cr as h,er as g,ir as _,jn as v,pr as y,qr as b,z as x}from"./element-plus-CgEuJBlB.js";import{n as S,t as C}from"./_plugin-vue_export-helper-
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{Bn as e,Dn as t,E as n,En as r,Er as i,In as a,Nn as o,On as s,Pn as c,Pr as l,Qr as u,Tn as d,Wn as f,Yr as p,Zn as m,cr as h,er as g,ir as _,jn as v,pr as y,qr as b,z as x}from"./element-plus-CgEuJBlB.js";import{n as S,t as C}from"./_plugin-vue_export-helper-D8rwCQpe.js";e(),y(),l();var w=[`id`],T={class:`common-dialog__footer`},E=a({__name:`CommonDialog`,props:{modelValue:{type:Boolean},title:{},size:{default:`medium`},type:{default:`default`},width:{},height:{},top:{default:`50px`},closeOnClickModal:{type:Boolean,default:!1},closeOnPressEscape:{type:Boolean,default:!0},destroyOnClose:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},customClass:{},modalClass:{},appendToBody:{type:Boolean,default:!0},lockScroll:{type:Boolean,default:!0},zIndex:{},showClose:{type:Boolean,default:!0},heightMode:{default:`max`},heightOffset:{default:`100px`},showFooter:{type:Boolean,default:!1},confirmText:{default:S(`@803A9:确定`)},cancelText:{default:S(`@803A9:取消`)},showCancel:{type:Boolean,default:!0},confirmLoading:{type:Boolean,default:!1}},emits:[`update:modelValue`,`confirm`,`cancel`,`close`,`opened`,`closed`],setup(e,{emit:a}){let l=e,y=a,S=d(()=>{if(l.width)return l.width;switch(l.size){case`small`:return`30%`;case`medium`:return`50%`;case`large`:return`80%`;case`extra-large`:return`90%`;case`fullscreen`:return`100vw`;default:return`50%`}}),C=_(),E=null;function D(){y(`opened`),f(()=>{let e=document.querySelector(`.el-dialog__wrapper:not([style*="display: none"]) .el-dialog`);e&&(e.querySelector(`button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`)||e).focus?.()})}function O(){y(`closed`),E&&typeof E.focus==`function`&&(f(()=>E?.focus()),E=null)}function k(e){e&&!l.modelValue&&(E=document.activeElement),y(`update:modelValue`,e)}let A=d(()=>l.size===`fullscreen`?`0`:l.top),j=d(()=>{let e=[];return l.customClass&&e.push(l.customClass),l.type===`flex`&&e.push(`common-dialog--flex`),l.type===`full-height`&&e.push(`common-dialog--full-height`),l.size===`fullscreen`&&e.push(`common-dialog--fullscreen`),e.join(` `)}),M=d(()=>{if(l.size===`fullscreen`)return{height:`100vh`,maxHeight:`100vh`};let e=`calc(100% - ${l.heightOffset})`;return l.heightMode===`fixed`?{height:e}:{maxHeight:e}});function N(){y(`update:modelValue`,!1),y(`close`)}function P(){y(`confirm`)}function F(){y(`cancel`),N()}return(a,l)=>{let d=x;return m(),t(i(n),{"model-value":e.modelValue,title:e.title,width:S.value,top:A.value,style:p(M.value),"z-index":e.zIndex,fullscreen:e.size===`fullscreen`,"close-on-click-modal":e.closeOnClickModal,"close-on-press-escape":e.closeOnPressEscape,"destroy-on-close":e.destroyOnClose,draggable:e.draggable,class:b(j.value),"show-close":e.showClose,"modal-class":e.modalClass,"data-dialog-shell":`common`,"append-to-body":e.appendToBody,"lock-scroll":e.lockScroll,"aria-modal":!0,"aria-labelledby":i(C),role:`dialog`,onClose:N,"onUpdate:modelValue":k,onOpened:D,onClosed:O},v({header:h(({titleClass:t})=>[r(`span`,{id:i(C),class:b([`el-dialog__title`,t]),role:`heading`,"aria-level":`2`},u(e.title),11,w)]),default:h(()=>[g(a.$slots,`default`,{},void 0,!0)]),_:2},[e.showFooter||a.$slots.footer?{name:`footer`,fn:h(()=>[g(a.$slots,`footer`,{},()=>[r(`div`,T,[e.showCancel?(m(),t(d,{key:0,type:`button`,onClick:F},{default:h(()=>[o(u(e.cancelText),1)]),_:1})):s(``,!0),c(d,{type:`primary`,loading:e.confirmLoading,onClick:P},{default:h(()=>[o(u(e.confirmText),1)]),_:1},8,[`loading`])])],!0)]),key:`0`}:void 0]),1032,[`model-value`,`title`,`width`,`top`,`style`,`z-index`,`fullscreen`,`close-on-click-modal`,`close-on-press-escape`,`destroy-on-close`,`draggable`,`class`,`show-close`,`modal-class`,`append-to-body`,`lock-scroll`,`aria-labelledby`])}}}),D=C(E,[[`__scopeId`,`data-v-6969f391`]]);export{D as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Cn as n,Dn as r,En as i,Er as a,In as o,Mn as ee,Nn as s,On as c,Pn as l,Pr as u,Qr as d,Tn as f,W as te,Wn as p,Yn as ne,Yr as m,Zn as h,_n as re,a as g,bn as _,br as v,cr as y,dn as ie,i as ae,kn as b,lr as x,or as S,pr as C,qn as w,qr as T,vn as oe,xn as E,xr as se,yn as ce}from"./element-plus-CgEuJBlB.js";import{a as le,r as D,t as ue}from"./vendor-CDZ64WVU.js";import{n as O,t as k}from"./_plugin-vue_export-helper-DkeTtFKF.js";import{t as de}from"./SvgIcon-U-AI95UV.js";import{t as fe}from"./configStore-Y1biBqmb.js";import{n as pe,t as me}from"./fileIcon-B5p5pGN9.js";import{a as he,i as ge,n as _e,r as ve,s as ye,t as be}from"./previewSandbox-D7HcNin7.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De}from"./monaco-DF5LNTW7.js";import{t as Oe}from"./useThemeObserver-DAyxqy9l.js";import{r as ke,t as A}from"./flow-mindmap-CzytSMsF.js";import{i as Ae}from"./index-BoZNUwmd.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./agentConversations-B2aTliJe.js";import{n as Re,t as j}from"./AgentEngineSelector-CPS9WawU.js";function M(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`}t(),C();var N={class:`mindmap-preview`},P={class:`mindmap-preview-canvas`},ze=k(o({__name:`MindmapPreview`,props:{content:{}},setup(e){let t=e,n=f(()=>A(t.content||``,`未命名文档`));return(e,t)=>(h(),b(`div`,N,[t[0]||=i(`div`,{class:`mindmap-preview-header`},[i(`span`,{class:`mindmap-preview-title`},`整篇导图`),i(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),i(`div`,P,[l(a(ke),{data:n.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);t(),C(),u(),ie();var Be={class:`agent-panel-header`},Ve=[`title`,`aria-label`],He={class:`agent-panel-title`},Ue={key:1,class:`agent-panel-title`},We=[`title`,`aria-label`],Ge=[`title`],Ke={class:`agent-panel-convs`},qe=[`data-theme`],F=[`title`],I={class:`agent-context-att-name`},L=[`title`,`aria-label`],R=k(o({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let o=e,s=t,{theme:u}=Oe(),te=f(()=>u.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:re,currentSessionId:g,messages:_,isStreaming:y,pendingQuestion:ie,answeringQuestion:ae,isSessionGenerating:C,currentEngine:se,pendingEngine:ce,isEngineLocked:k,pickEngine:de,loadSessions:fe,loadSession:pe,deleteSession:me,renameSession:he,newSession:ge,sendMessage:_e,answerQuestion:ve,stop:ye}=Ie(),be=f(()=>k.value?se.value:ce.value);function xe(e){k.value||de(e)}let Se=f(()=>je(m.value,C)),Ce=Fe(),we=Me(),Te=v(null),Ee=v(null),De=v(null),ke=v(null),A=v(null),{width:Ae,narrow:M}=Re(A),N=v(`chat`),P=v(null),ze=v(!1),R=null,Je=f(()=>!!o.activeFileName&&!ze.value);function Ye(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function Xe(){let e=Ee.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!Je.value){if(!t)return;P.value=null,p(()=>t.remove());return}let n=P.value&&e.contains(P.value)?P.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Ye(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),P.value=n}function Ze(e=!0){Te.value?.scrollToBottom(e)}async function Qe(e){let t=ze.value?void 0:o.activeFilePath||void 0;await _e(e.text,e.files,{openFilePath:t}),await p(),Ze()}function $e(e){pe(e),N.value=`chat`}function et(){ge(),N.value=`chat`}S(()=>_.value.length,()=>{p(()=>Ze(!1))});function tt(){let e=ke.value;e&&typeof MutationObserver<`u`&&(R?.disconnect(),R=new MutationObserver(()=>Xe()),R.observe(e,{childList:!0,subtree:!0}))}return S(()=>o.active,e=>{e&&(N.value=`chat`,fe().catch(()=>{}),p(()=>{Xe(),Ze(!1)}))}),S(M,e=>{e||(N.value=`chat`)}),S(()=>o.activeFilePath,()=>{ze.value=!1}),S(Je,e=>{e&&p(Xe)}),ne(()=>{fe().catch(()=>{}),p(()=>{Xe(),tt()})}),w(()=>{R?.disconnect(),R=null,P.value=null}),(t,o)=>(h(),b(`div`,{ref_key:`rootRef`,ref:A,class:`editor-agent-panel`},[i(`div`,Be,[a(M)&&N.value===`list`?(h(),b(E,{key:0},[i(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:a(O)(`@EDITOR:返回对话`),"aria-label":a(O)(`@EDITOR:返回对话`),onClick:o[0]||=e=>N.value=`chat`},[...o[4]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),i(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,Ve),i(`span`,He,d(a(O)(`@EDITOR:会话列表`)),1)],64)):(h(),b(`span`,Ue,d(a(O)(`@EDITOR:g ai 对话`)),1)),o[7]||=i(`div`,{class:`agent-panel-spacer`},null,-1),!a(M)||N.value===`chat`?(h(),r(j,{key:2,class:`agent-panel-engine`,engine:be.value,locked:a(k),onSelect:xe},null,8,[`engine`,`locked`])):c(``,!0),a(M)&&N.value===`chat`?(h(),b(`button`,{key:3,class:`agent-panel-icon-btn agent-panel-list-btn`,title:a(O)(`@EDITOR:会话列表`),"aria-label":a(O)(`@EDITOR:会话列表`),onClick:o[1]||=e=>N.value=`list`},[...o[5]||=[ee(`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-bbf532ae><line x1="8" y1="6" x2="21" y2="6" data-v-bbf532ae></line><line x1="8" y1="12" x2="21" y2="12" data-v-bbf532ae></line><line x1="8" y1="18" x2="21" y2="18" data-v-bbf532ae></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-bbf532ae></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-bbf532ae></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-bbf532ae></line></svg>`,1)]],8,We)):c(``,!0),i(`button`,{class:`agent-panel-icon-btn`,title:a(O)(`@EDITOR:关闭对话`),onClick:o[2]||=e=>s(`close`)},[...o[6]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ge)]),i(`div`,{class:T([`agent-panel-body`,{"is-wide":!a(M)}])},[x(i(`div`,Ke,[l(a(ue),{"show-search":!0,items:Se.value,"active-id":a(g),loading:a(re),labels:a(Ce),onSelect:$e,onNew:et,onRename:a(he),onDelete:a(me)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[oe,!a(M)||N.value===`list`]]),x(i(`div`,{ref_key:`chatHostRef`,ref:De,class:`agent-panel-chat`},[l(a(le),{ref_key:`chatRef`,ref:Te,"show-input":!1,messages:a(_),"assistant-name":a(Ne),"assistant-avatar":a(Le),theme:te.value,question:a(ie),"question-submitting":a(ae),"question-labels":a(we),"plan-config":{labels:{title:a(O)(`@AGENT:计划`),raw:a(O)(`@AGENT:原始参数`)}},onAnswer:a(ve)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onAnswer`])],512),[[oe,!a(M)||N.value===`chat`]]),a(Ae)>0?(h(),b(`div`,{key:0,ref_key:`composerRef`,ref:ke,class:`agent-panel-composer acu-root`,"data-theme":te.value},[l(a(D),{ref_key:`inputRef`,ref:Ee,disabled:a(y),generating:a(y),placeholder:a(y)?a(O)(`@AGENT:正在生成中...`):a(O)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:a(Pe)},onSend:Qe,onStop:a(ye)},null,8,[`disabled`,`generating`,`placeholder`,`upload-config`,`onStop`]),P.value?(h(),r(n,{key:0,to:P.value},[Je.value?(h(),b(`div`,{key:0,class:`agent-context-att`,title:e.activeFilePath||``},[o[9]||=i(`svg`,{class:`agent-context-att-icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),i(`polyline`,{points:`14 3 14 8 19 8`})],-1),i(`span`,I,d(e.activeFileName),1),i(`button`,{type:`button`,class:`agent-context-att-remove`,title:a(O)(`@EDITOR:不引用当前文档`),"aria-label":a(O)(`@EDITOR:不引用当前文档`),onClick:o[3]||=e=>ze.value=!0},[...o[8]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,L)],8,F)):c(``,!0)],8,[`to`])):c(``,!0)],8,qe)):c(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-bbf532ae`]]);t(),C(),u(),ie();var Je={class:`sidebar-header`},Ye={class:`sidebar-title`},Xe={class:`sidebar-actions`},Ze={class:`sidebar-search`},Qe=[`placeholder`,`title`],$e=[`title`,`aria-label`],et={key:0,class:`sidebar-tree`},tt={key:1,class:`tree-arrow-spacer`},nt={class:`tree-icon mit-icon`,"aria-hidden":`true`},rt=[`xlink:href`],it=[`onClick`,`onContextmenu`],at={key:1,class:`tree-arrow-spacer`},ot={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},st=[`xlink:href`],ct={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},lt=[`xlink:href`],ut=[`title`],dt={key:0,class:`tree-name-hit`},ft={key:4,class:`tree-loading`},pt={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)`}},mt={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-tertiary)`}},ht=[`placeholder`],gt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},_t={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)`}},vt={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-tertiary)`}},yt=[`placeholder`],bt={key:1,class:`tree-empty`},xt={key:1,class:`sidebar-loading`},St={class:`editor-main`},Ct={key:0,class:`editor-tabs`},wt=[`onClick`,`title`],Tt={class:`tab-name`},Et={key:0,class:`tab-dirty-dot`},Dt=[`onClick`],Ot=[`title`],kt=[`disabled`,`title`],At=[`title`],jt={key:1,class:`editor-empty`},Mt={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.3`}},Nt={class:`editor-empty-hint`},Pt={class:`editor-body`},Ft={key:0,class:`image-tab-placeholder`},It={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`}},Lt={class:`image-tab-placeholder-title`},Rt={class:`image-tab-placeholder-hint`},zt={class:`preview-header`},Bt={class:`preview-title`},Vt={class:`preview-ext-badge`},Ht=[`title`],Ut={class:`preview-body`},Wt=[`sandbox`,`srcdoc`],Gt=6e4,Kt=3e4,qt=k(o({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new De:t===`css`||t===`scss`||t===`less`?new Te:t===`html`||t===`handlebars`||t===`razor`?new xe:t===`typescript`||t===`javascript`?new Ce:new Se}};let o=t,u=fe(),ie=Ae(),C=v([]),le=v(!1),D=v(``),ue=v(``),k=null;function ke(){D.value=``,ue.value=``,k&&=(clearTimeout(k),null)}S(D,e=>{k&&clearTimeout(k),k=setTimeout(()=>{ue.value=e,k=null},180)}),w(()=>{k&&clearTimeout(k),Me(),_n()});let A=null;function je(){Me(),u.ui.fileTreeAutoRefresh&&(A=setInterval(()=>{document.hidden||u.currentDirectory&&(D.value.trim()||j())},Gt))}function Me(){A&&=(clearInterval(A),null)}S(()=>u.currentDirectory,async()=>{if(Qt=!1,je(),await Pe(),F.value.some(e=>e.isDirty)){Qt=!0;return}F.value=[],I.value=null,an(),await tn()}),S(()=>u.ui.fileTreeAutoRefresh,()=>{je()});async function Ne(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 Pe(){let e=u.currentDirectory;if(e){le.value=!0;try{C.value=await Ne(e,0)}finally{le.value=!1}}}function Fe(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Fe(n.children,t));return t}function Ie(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=Ie(e.children,t+1),n.expanded=!0),n})}async function Le(e){let t=u.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:Ie(n.items,0)}catch{return null}}function Re(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)?Re(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function j(e={}){if(!u.currentDirectory)return;let t=await Le([...Fe(C.value)]);if(!t){e.notifyOnError&&g.error(O(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Re(C.value,t)&&(C.value=t)}async function N(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ne(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function P(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...P(n.children));return t}let Be=f(()=>ue.value.trim().toLowerCase());function Ve(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Ve(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let He=f(()=>Ve(C.value,Be.value)),Ue=f(()=>Be.value.length>0&&He.value.length===0);function We(e){let t=ue.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let Ge=v(null);function Ke(){let e=Ge.value;e&&(e.focus(),e.select())}function qe(){D.value?(ke(),Ge.value?.focus()):(Ge.value?.blur(),z.value?.focus())}let F=v([]),I=v(null),L=v(null);async function qt(e){if(L.value=e,e.type!==`file`){N(e);return}let t=F.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:F.value.length}),t){I.value=e.path,p(()=>sn());return}let n=e.name.split(`.`).pop()||``;if(er.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};F.value.push(t),I.value=e.path,J.value=!0;return}if(ye(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};F.value.push(t),I.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){g.error(`${O(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=M(n),a=B.get(e.path);a&&!a.isDisposed()&&a.setValue(r.content);let o={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i,diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),F.value.push(o),I.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,F.value.length,`activeTabPath=`,I.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),g.error(`${O(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await p();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await qt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Jt(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(O(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Yt=()=>F.value.find(e=>e.path===I.value)??null,Xt=f(()=>({expandedDirs:[...Fe(C.value)],tabs:F.value.map(e=>e.path),activeTab:I.value})),Zt=!1,Qt=!1;function $t(){Qt&&!Zt&&u.isUiLoaded&&u.saveEditorWorkspace(Xt.value)}S(Xt,()=>$t());async function en(e){if(F.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(er.has(n)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(ye(t)){F.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=B.get(e);i&&!i.isDisposed()&&z.value?.getModel()!==i&&(i.dispose(),B.delete(e)),F.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:M(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function tn(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;H.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Zt=!0;try{if(e.expandedDirs.length>0){let t=await Le(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await en(t);if(!o.pendingFilePath&&e.activeTab&&F.value.some(t=>t.path===e.activeTab)){I.value=e.activeTab;let t=Yt(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(er.has(n)||ye(t.name))&&(J.value=!0)}}finally{Zt=!1}}finally{Qt=!0,$t()}}let nn=v(null),z=se(null),B=new Map;function rn(e){let t=B.get(e.path);return(!t||t.isDisposed())&&(t=Ee.createModel(e.content,e.language,we.file(e.path)),B.set(e.path,t)),t}function an(){z.value?.setModel(null);for(let e of B.values())e.isDisposed()||e.dispose();B.clear()}function on(){if(!nn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;z.value=Ee.create(nn.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}),z.value.onDidChangeModelContent(()=>{let e=Yt();if(!e)return;let t=z.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),z.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&Yt()?.isDirty&&bn(!1),requestAnimationFrame(()=>{if(!V.value||V.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`))||sn()})})}S(I,e=>{if(!z.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=rn(t);z.value.setModel(n),p(()=>sn()),pn(e)});function sn(){if(!z.value)return;z.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let cn=0,ln=new Map;async function un(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 dn(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 fn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=B.get(e.path);if(!r||r.isDisposed())return;let i=z.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 pn(e){if(!e)return;let t=F.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++cn,r=await un(e);if(n!==cn||F.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(ln.get(e)===r.mtimeMs)return;ln.set(e,r.mtimeMs);try{await ae.confirm(O(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),O(`@EDITOR:文件已被外部改动`),{confirmButtonText:O(`@EDITOR:重新加载`),cancelButtonText:O(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await dn(e);i&&F.value.find(t=>t.path===e)===t&&fn(t,i.content,i.mtimeMs)}function mn(){document.hidden||pn(I.value)}let hn=null;function gn(){_n(),hn=setInterval(()=>{document.hidden||pn(I.value)},Kt)}function _n(){hn&&=(clearInterval(hn),null)}S(()=>F.value.filter(e=>e.isDirty).length,e=>{ie.setDirtyCount(e)},{immediate:!0}),w(()=>ie.setDirtyCount(0)),Oe(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Ee.setTheme(e?`vs-dark`:`vs`)});let vn=null;function yn(){if(vn||!V.value)return;let e=[V.value],t=V.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}vn=new MutationObserver(()=>{V.value&&V.value.offsetParent!==null&&I.value&&z.value&&(pn(I.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`))||sn()}))});let n=vn;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}ne(async()=>{on(),await Pe(),await tn(),yn(),je(),window.addEventListener(`focus`,mn),document.addEventListener(`visibilitychange`,mn),gn(),I.value&&p(()=>sn())}),w(()=>{vn?.disconnect(),vn=null,window.removeEventListener(`focus`,mn),document.removeEventListener(`visibilitychange`,mn),z.value?.dispose(),B.forEach(e=>e.dispose()),B.clear()});async function bn(e=!1){let t=Yt();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){g.error(`${O(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||g.success(O(`@EDITOR:已保存`))}catch(e){g.error(`${O(`@EDITOR:保存失败: `)}${e.message}`)}}function xn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Ke();return}t&&e.key===`s`&&(e.preventDefault(),bn())}ne(()=>window.addEventListener(`keydown`,xn)),w(()=>window.removeEventListener(`keydown`,xn));let V=v(null),H=v(u.ui.editorSidebarWidth),Sn=!1,Cn=0,wn=0;function Tn(e){Sn=!0,Cn=e.clientX,wn=H.value,document.addEventListener(`mousemove`,En),document.addEventListener(`mouseup`,Dn),e.preventDefault()}function En(e){if(!Sn)return;let t=e.clientX-Cn;H.value=Math.max(140,Math.min(400,wn+t))}function Dn(){Sn=!1,document.removeEventListener(`mousemove`,En),document.removeEventListener(`mouseup`,Dn),H.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(H.value)}function On(e){return e.type===`directory`?pe(e.name):me(e.name)}let U=v(null),W=v(null),G=v(null),kn=v(null);function An(){let e=L.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(/[\\/][^\\/]+$/,``):u.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:u.currentDirectory??``,afterNode:null,depth:0}}async function jn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`file`,value:``},await p(),G.value?.focus()}async function Mn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`directory`,value:``},await p(),G.value?.focus()}function Nn(){U.value=null}async function Pn(){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){g.error(e.error);return}g.success(O(`@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){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}U.value=null,await j()}function Fn(e){e.key===`Enter`&&(e.preventDefault(),Pn()),e.key===`Escape`&&(e.preventDefault(),Nn())}let K=v(null),In=v(null);function Ln(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function Rn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`file`,value:``},await p(),G.value?.focus()}async function zn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`directory`,value:``},await p(),G.value?.focus()}async function Bn(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await p(),kn.value?.focus(),kn.value?.select())}async function Vn(){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){g.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),W.value=null,await j()}function Hn(e){e.key===`Enter`&&(e.preventDefault(),Vn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Un(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?O(`@EDITOR:文件夹`):O(`@EDITOR:文件`);if(!confirm(`${O(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){g.error(n.error);return}let r=F.value.findIndex(t=>t.path===e.path);r!==-1&&(F.value.splice(r,1),I.value===e.path&&(I.value=F.value[Math.max(0,r-1)]?.path??null)),g.success(O(`@EDITOR:已删除`)),await j()}async function Wn(){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||g.error(t.error)}catch(e){g.error(e?.message||String(e))}}function Gn(e){let t=u.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 Kn(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 qn(){let e=K.value?.node;q(),e&&(await Kn(e.path)?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Jn(){let e=K.value?.node;q(),e&&(await Kn(Gn(e.path))?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Yn(){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||g.error(t.error||O(`@EDITOR:VSCode 未安装`))}catch(e){g.error(e?.message||String(e))}}let Xn=new Set([`html`,`htm`]),Zn=f(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Xn.has(t)});async function Qn(){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||g.error(t.error||O(`@EDITOR:浏览器打开失败`))}catch(e){g.error(e?.message||String(e))}}ne(()=>document.addEventListener(`click`,q)),w(()=>document.removeEventListener(`click`,q));let $n=new Set([`md`,`html`,`htm`,`svg`]),er=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),X=v(!1),tr=v(!1),nr=v(0),Z=f(()=>F.value.find(e=>e.path===I.value)??null),rr=f(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),ir=f(()=>Z.value?.language===`office`),Q=f(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),ar=f(()=>$n.has(Q.value)||er.has(Q.value)||ye(Q.value)),or=f(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=f(()=>Q.value===`md`&&or.value>0);S(I,()=>{J.value&&!ar.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function sr(){ar.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function cr(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function lr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,tr.value=!0}let ur=f(()=>{let e=Z.value;if(!e)return``;let t=Q.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?_e(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>`:``}),dr=!1,fr=0,pr=0;function mr(e){dr=!0,fr=e.clientX,pr=nr.value,document.addEventListener(`mousemove`,hr),document.addEventListener(`mouseup`,gr),e.preventDefault()}function hr(e){if(!dr)return;let t=e.clientX-fr;nr.value=Math.max(200,Math.min(900,pr+t))}function gr(){dr=!1,document.removeEventListener(`mousemove`,hr),document.removeEventListener(`mouseup`,gr)}return(t,o)=>(h(),b(E,null,[i(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:V},[i(`div`,{class:`editor-sidebar`,style:m({width:H.value+`px`})},[i(`div`,Je,[i(`span`,Ye,d(a(O)(`@EDITOR:资源管理器`)),1),i(`div`,Xe,[l(a(te),{content:a(O)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:jn},[...o[11]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:Mn},[...o[12]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:o[0]||=e=>j({notifyOnError:!0})},[...o[13]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`1 4 1 10 7 10`}),i(`polyline`,{points:`23 20 23 14 17 14`}),i(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),i(`div`,Ze,[o[15]||=i(`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`},[i(`circle`,{cx:`11`,cy:`11`,r:`7`}),i(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(i(`input`,{ref_key:`searchInputRef`,ref:Ge,"onUpdate:modelValue":o[1]||=e=>D.value=e,type:`text`,class:`sidebar-search-input`,placeholder:a(O)(`@EDITOR:搜索文件...`),title:a(O)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ce(qe,[`escape`])},null,40,Qe),[[re,D.value]]),D.value?(h(),b(`button`,{key:0,class:`sidebar-search-clear`,title:a(O)(`@EDITOR:清除搜索`),"aria-label":a(O)(`@EDITOR:清除搜索`),onClick:ke},[...o[14]||=[i(`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`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$e)):c(``,!0)]),le.value?(h(),b(`div`,xt,[...o[24]||=[i(`span`,{class:`spin-icon`},null,-1)]])):(h(),b(`div`,et,[(h(!0),b(E,null,e(P(He.value),t=>(h(),b(E,{key:t.path},[W.value&&W.value.node.path===t.path?(h(),b(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+t.depth*14+`px`})},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[16]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,tt)),(h(),b(`svg`,nt,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,rt)])),x(i(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:kn,"onUpdate:modelValue":o[2]||=e=>W.value.value=e,onKeydown:Hn,onBlur:Vn,onClick:o[3]||=_(()=>{},[`stop`])},null,544),[[re,W.value.value]])],4)):(h(),b(`div`,{key:1,class:T([`tree-node`,{"tree-node--dir":t.type===`directory`,"tree-node--file":t.type===`file`,"tree-node--active":I.value===t.path,"tree-node--selected":L.value?.path===t.path&&I.value!==t.path}]),style:m({paddingLeft:12+t.depth*14+`px`}),onClick:e=>qt(t),onContextmenu:e=>Ln(e,t)},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[17]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,at)),t.type===`directory`?(h(),b(`svg`,ot,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,st)])):(h(),b(`svg`,ct,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,lt)])),i(`span`,{class:`tree-name`,title:t.path},[(h(!0),b(E,null,e(We(t.name),(e,t)=>(h(),b(E,{key:t},[e.hit?(h(),b(`span`,dt,d(e.text),1)):(h(),b(E,{key:1},[s(d(e.text),1)],64))],64))),128))],8,ut),t.loading?(h(),b(`span`,ft)):c(``,!0)],46,it)),U.value&&U.value.afterNode?.path===t.path?(h(),b(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+U.value.depth*14+`px`})},[o[20]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,pt,[...o[18]||=[i(`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)]])):(h(),b(`svg`,mt,[...o[19]||=[i(`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),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[5]||=_(()=>{},[`stop`])},null,40,ht),[[re,U.value.value]])],4)):c(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(h(),b(`div`,gt,[o[23]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,_t,[...o[21]||=[i(`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)]])):(h(),b(`svg`,vt,[...o[22]||=[i(`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),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[7]||=_(()=>{},[`stop`])},null,40,yt),[[re,U.value.value]])])):c(``,!0),!U.value&&(Ue.value||C.value.length===0)?(h(),b(`div`,bt,d(Ue.value?a(O)(`@EDITOR:未找到匹配文件`):a(O)(`@EDITOR:暂无文件`)),1)):c(``,!0)]))],4),i(`div`,{class:`editor-resizer`,onMousedown:Tn},null,32),i(`div`,St,[F.value.length>0?(h(),b(`div`,Ct,[(h(!0),b(E,null,e(F.value,e=>(h(),b(`div`,{key:e.path,class:T([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[i(`span`,Tt,d(e.name),1),e.isDirty?(h(),b(`span`,Et)):c(``,!0),i(`button`,{class:`tab-close`,onClick:t=>Jt(e.path,t)},[...o[25]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Dt)],10,wt))),128)),o[29]||=i(`div`,{class:`editor-tabs-spacer`},null,-1),ar.value?(h(),b(`button`,{key:0,class:T([`preview-toggle-btn`,{active:J.value}]),title:J.value?a(O)(`@EDITOR:关闭预览`):a(O)(`@EDITOR:打开预览`),onClick:sr},[o[26]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),i(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),i(`span`,null,d(a(O)(`@EDITOR:预览`)),1)],10,Ot)):c(``,!0),$.value?(h(),b(`button`,{key:1,class:T([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:打开思维导图`):a(O)(`@EDITOR:需要至少一个 # 标题`),onClick:cr},[o[27]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-cbd3d025><circle cx="12" cy="12" r="2" data-v-cbd3d025></circle><circle cx="5" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="5" cy="18" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="18" r="1.6" data-v-cbd3d025></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-cbd3d025></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-cbd3d025></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-cbd3d025></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-cbd3d025></line></svg>`,1),i(`span`,null,d(a(O)(`@EDITOR:思维导图`)),1)],10,kt)):c(``,!0),i(`button`,{class:T([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?a(O)(`@EDITOR:关闭 g ai 对话`):a(O)(`@EDITOR:打开 g ai 对话`),onClick:lr},[o[28]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),i(`path`,{d:`M18 16.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z`})],-1),i(`span`,null,d(a(O)(`@EDITOR:g ai 对话`)),1)],10,At)])):c(``,!0),F.value.length===0?(h(),b(`div`,jt,[(h(),b(`svg`,Mt,[...o[30]||=[i(`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),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),i(`p`,null,d(a(O)(`@EDITOR:从左侧选择文件打开`)),1),i(`p`,Nt,d(a(O)(`@EDITOR:Ctrl+S 保存`)),1)])):c(``,!0),i(`div`,Pt,[i(`div`,{class:T([`monaco-container`,{hidden:F.value.length===0||rr.value||ir.value}]),ref_key:`editorContainerRef`,ref:nn},null,2),rr.value&&F.value.length>0&&!J.value&&!Y.value?(h(),b(`div`,Ft,[(h(),b(`svg`,It,[...o[31]||=[i(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),i(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),i(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),i(`p`,Lt,d(Z.value?.name),1),i(`p`,Rt,d(a(O)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):c(``,!0),(J.value||Y.value||X.value)&&F.value.length>0?(h(),b(`div`,{key:1,class:`preview-resizer`,onMousedown:mr},null,32)):c(``,!0),tr.value?x((h(),r(R,{key:2,active:X.value&&F.value.length>0,"active-file-path":I.value,"active-file-name":Z.value?.name??``,style:m({flexBasis:nr.value+`px`}),onClose:o[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[oe,X.value&&F.value.length>0]]):c(``,!0),(J.value||Y.value)&&F.value.length>0?(h(),b(`div`,{key:3,class:`preview-panel`,style:m({flexBasis:nr.value+`px`})},[i(`div`,zt,[i(`span`,Bt,d(Y.value?a(O)(`@EDITOR:思维导图`):a(O)(`@EDITOR:预览`)),1),i(`span`,Vt,d(Q.value.toUpperCase()),1),o[33]||=i(`div`,{class:`preview-header-spacer`},null,-1),i(`button`,{class:`preview-close-btn`,title:Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:关闭预览`),onClick:o[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...o[32]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ht)]),i(`div`,Ut,[Y.value&&Q.value===`md`&&Z.value?(h(),r(ze,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(h(),r(ge,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(h(),b(`iframe`,{key:2,class:`preview-iframe`,sandbox:a(be),srcdoc:ur.value},null,8,Wt)):J.value&&a(er).has(Q.value)&&Z.value?(h(),r(he,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&ir.value&&Z.value?(h(),r(ve,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):c(``,!0)])],4)):c(``,!0)])])],512),(h(),r(n,{to:`body`},[K.value?(h(),b(`div`,{key:0,ref_key:`ctxMenuRef`,ref:In,class:`ctx-menu`,style:m({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:o[10]||=_(()=>{},[`stop`])},[i(`button`,{class:`ctx-menu-item`,onClick:Rn},[o[34]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:zn},[o[35]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件夹`)),1)]),o[42]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:qn},[o[36]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),i(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),s(` `+d(a(O)(`@EDITOR:复制绝对路径`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Jn},[o[37]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),i(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),s(` `+d(a(O)(`@EDITOR:复制相对路径`)),1)]),o[43]||=i(`div`,{class:`ctx-menu-sep`},null,-1),Zn.value?(h(),b(`button`,{key:0,class:`ctx-menu-item`,onClick:Qn},[o[38]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`circle`,{cx:`12`,cy:`12`,r:`9`}),i(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),i(`path`,{d:`M12 3a13 13 0 0 1 3.5 9 13 13 0 0 1-3.5 9 13 13 0 0 1-3.5-9A13 13 0 0 1 12 3z`})],-1),s(` `+d(a(O)(`@EDITOR:在浏览器中打开`)),1)])):c(``,!0),i(`button`,{class:`ctx-menu-item`,onClick:Wn},[o[39]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),i(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),s(` `+d(a(O)(`@EDITOR:在资源管理器中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Yn},[l(de,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),s(` `+d(a(O)(`@EDITOR:在 VSCode 中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Bn},[o[40]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),i(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),s(` `+d(a(O)(`@EDITOR:重命名`)),1)]),i(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Un},[o[41]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`3 6 5 6 21 6`}),i(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),i(`path`,{d:`M10 11v6`}),i(`path`,{d:`M14 11v6`}),i(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),s(` `+d(a(O)(`@EDITOR:删除`)),1)])],4)):c(``,!0)]))],64))}}),[[`__scopeId`,`data-v-cbd3d025`]]);export{qt as default};
|
|
1
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,Bn as t,Cn as n,Dn as r,En as i,Er as a,In as o,Mn as ee,Nn as s,On as c,Pn as l,Pr as u,Qr as d,Tn as f,W as te,Wn as p,Yn as ne,Yr as m,Zn as h,_n as re,a as g,bn as _,br as v,cr as y,dn as ie,i as ae,kn as b,lr as x,or as S,pr as C,qn as w,qr as T,vn as oe,xn as E,xr as se,yn as ce}from"./element-plus-CgEuJBlB.js";import{a as le,r as D,t as ue}from"./vendor-CDZ64WVU.js";import{n as O,t as k}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{t as de}from"./SvgIcon-B-2iTLW-.js";import{t as fe}from"./configStore-BFGSfIBp.js";import{n as pe,t as me}from"./fileIcon-B5p5pGN9.js";import{a as he,i as ge,n as _e,r as ve,s as ye,t as be}from"./previewSandbox-C_ZzCEpS.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De}from"./monaco-DF5LNTW7.js";import{t as Oe}from"./useThemeObserver-DAyxqy9l.js";import{r as ke,t as A}from"./flow-mindmap-CzytSMsF.js";import{i as Ae}from"./index-aNSr4k87.js";import{a as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./agentConversations-C0WoSH0y.js";import{n as Re,t as j}from"./AgentEngineSelector-CGrUh2kD.js";function M(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`}t(),C();var N={class:`mindmap-preview`},P={class:`mindmap-preview-canvas`},ze=k(o({__name:`MindmapPreview`,props:{content:{}},setup(e){let t=e,n=f(()=>A(t.content||``,`未命名文档`));return(e,t)=>(h(),b(`div`,N,[t[0]||=i(`div`,{class:`mindmap-preview-header`},[i(`span`,{class:`mindmap-preview-title`},`整篇导图`),i(`span`,{class:`mindmap-preview-hint`},`基于整篇 Markdown 自动生成 · 阅读模式`)],-1),i(`div`,P,[l(a(ke),{data:n.value,"preview-mode":``},null,8,[`data`])])]))}}),[[`__scopeId`,`data-v-d2fe328b`]]);t(),C(),u(),ie();var Be={class:`agent-panel-header`},Ve=[`title`,`aria-label`],He={class:`agent-panel-title`},Ue={key:1,class:`agent-panel-title`},We=[`title`,`aria-label`],Ge=[`title`],Ke={class:`agent-panel-convs`},qe=[`data-theme`],F=[`title`],I={class:`agent-context-att-name`},L=[`title`,`aria-label`],R=k(o({__name:`EditorAgentPanel`,props:{activeFilePath:{},activeFileName:{},active:{type:Boolean}},emits:[`close`],setup(e,{emit:t}){let o=e,s=t,{theme:u}=Oe(),te=f(()=>u.value===`dark`?`dark`:`light`),{sessions:m,sessionsLoading:re,currentSessionId:g,messages:_,isStreaming:y,pendingQuestion:ie,answeringQuestion:ae,isSessionGenerating:C,currentEngine:se,pendingEngine:ce,isEngineLocked:k,pickEngine:de,loadSessions:fe,loadSession:pe,deleteSession:me,renameSession:he,newSession:ge,sendMessage:_e,answerQuestion:ve,stop:ye}=Ie(),be=f(()=>k.value?se.value:ce.value);function xe(e){k.value||de(e)}let Se=f(()=>je(m.value,C)),Ce=Fe(),we=Me(),Te=v(null),Ee=v(null),De=v(null),ke=v(null),A=v(null),{width:Ae,narrow:M}=Re(A),N=v(`chat`),P=v(null),ze=v(!1),R=null,Je=f(()=>!!o.activeFileName&&!ze.value);function Ye(e){return Array.from(e.children).find(e=>e.classList?.contains(`acu-input-attachments`))??null}function Xe(){let e=Ee.value?.$el;if(!e)return;let t=e.querySelector(`.agent-context-slot`);if(!Je.value){if(!t)return;P.value=null,p(()=>t.remove());return}let n=P.value&&e.contains(P.value)?P.value:t;n||(n=document.createElement(`div`),n.className=`agent-context-slot`);let r=Ye(e),i=r??e;n.parentElement!==i&&i.insertBefore(n,r?r.firstChild:e.firstChild),P.value=n}function Ze(e=!0){Te.value?.scrollToBottom(e)}async function Qe(e){let t=ze.value?void 0:o.activeFilePath||void 0;await _e(e.text,e.files,{openFilePath:t}),await p(),Ze()}function $e(e){pe(e),N.value=`chat`}function et(){ge(),N.value=`chat`}S(()=>_.value.length,()=>{p(()=>Ze(!1))});function tt(){let e=ke.value;e&&typeof MutationObserver<`u`&&(R?.disconnect(),R=new MutationObserver(()=>Xe()),R.observe(e,{childList:!0,subtree:!0}))}return S(()=>o.active,e=>{e&&(N.value=`chat`,fe().catch(()=>{}),p(()=>{Xe(),Ze(!1)}))}),S(M,e=>{e||(N.value=`chat`)}),S(()=>o.activeFilePath,()=>{ze.value=!1}),S(Je,e=>{e&&p(Xe)}),ne(()=>{fe().catch(()=>{}),p(()=>{Xe(),tt()})}),w(()=>{R?.disconnect(),R=null,P.value=null}),(t,o)=>(h(),b(`div`,{ref_key:`rootRef`,ref:A,class:`editor-agent-panel`},[i(`div`,Be,[a(M)&&N.value===`list`?(h(),b(E,{key:0},[i(`button`,{class:`agent-panel-icon-btn agent-panel-back-btn`,title:a(O)(`@EDITOR:返回对话`),"aria-label":a(O)(`@EDITOR:返回对话`),onClick:o[0]||=e=>N.value=`chat`},[...o[4]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`line`,{x1:`19`,y1:`12`,x2:`5`,y2:`12`}),i(`polyline`,{points:`12 19 5 12 12 5`})],-1)]],8,Ve),i(`span`,He,d(a(O)(`@EDITOR:会话列表`)),1)],64)):(h(),b(`span`,Ue,d(a(O)(`@EDITOR:g ai 对话`)),1)),o[7]||=i(`div`,{class:`agent-panel-spacer`},null,-1),!a(M)||N.value===`chat`?(h(),r(j,{key:2,class:`agent-panel-engine`,engine:be.value,locked:a(k),onSelect:xe},null,8,[`engine`,`locked`])):c(``,!0),a(M)&&N.value===`chat`?(h(),b(`button`,{key:3,class:`agent-panel-icon-btn agent-panel-list-btn`,title:a(O)(`@EDITOR:会话列表`),"aria-label":a(O)(`@EDITOR:会话列表`),onClick:o[1]||=e=>N.value=`list`},[...o[5]||=[ee(`<svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" data-v-bbf532ae><line x1="8" y1="6" x2="21" y2="6" data-v-bbf532ae></line><line x1="8" y1="12" x2="21" y2="12" data-v-bbf532ae></line><line x1="8" y1="18" x2="21" y2="18" data-v-bbf532ae></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-bbf532ae></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-bbf532ae></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-bbf532ae></line></svg>`,1)]],8,We)):c(``,!0),i(`button`,{class:`agent-panel-icon-btn`,title:a(O)(`@EDITOR:关闭对话`),onClick:o[2]||=e=>s(`close`)},[...o[6]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ge)]),i(`div`,{class:T([`agent-panel-body`,{"is-wide":!a(M)}])},[x(i(`div`,Ke,[l(a(ue),{"show-search":!0,items:Se.value,"active-id":a(g),loading:a(re),labels:a(Ce),onSelect:$e,onNew:et,onRename:a(he),onDelete:a(me)},null,8,[`items`,`active-id`,`loading`,`labels`,`onRename`,`onDelete`])],512),[[oe,!a(M)||N.value===`list`]]),x(i(`div`,{ref_key:`chatHostRef`,ref:De,class:`agent-panel-chat`},[l(a(le),{ref_key:`chatRef`,ref:Te,"show-input":!1,messages:a(_),"assistant-name":a(Ne),"assistant-avatar":a(Le),theme:te.value,question:a(ie),"question-submitting":a(ae),"question-labels":a(we),"plan-config":{labels:{title:a(O)(`@AGENT:计划`),raw:a(O)(`@AGENT:原始参数`)}},onAnswer:a(ve)},null,8,[`messages`,`assistant-name`,`assistant-avatar`,`theme`,`question`,`question-submitting`,`question-labels`,`plan-config`,`onAnswer`])],512),[[oe,!a(M)||N.value===`chat`]]),a(Ae)>0?(h(),b(`div`,{key:0,ref_key:`composerRef`,ref:ke,class:`agent-panel-composer acu-root`,"data-theme":te.value},[l(a(D),{ref_key:`inputRef`,ref:Ee,disabled:a(y),generating:a(y),placeholder:a(y)?a(O)(`@AGENT:正在生成中...`):a(O)(`@AGENT:输入消息,Enter 发送`),"upload-config":{accept:a(Pe)},onSend:Qe,onStop:a(ye)},null,8,[`disabled`,`generating`,`placeholder`,`upload-config`,`onStop`]),P.value?(h(),r(n,{key:0,to:P.value},[Je.value?(h(),b(`div`,{key:0,class:`agent-context-att`,title:e.activeFilePath||``},[o[9]||=i(`svg`,{class:`agent-context-att-icon`,viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.7`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[i(`path`,{d:`M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z`}),i(`polyline`,{points:`14 3 14 8 19 8`})],-1),i(`span`,I,d(e.activeFileName),1),i(`button`,{type:`button`,class:`agent-context-att-remove`,title:a(O)(`@EDITOR:不引用当前文档`),"aria-label":a(O)(`@EDITOR:不引用当前文档`),onClick:o[3]||=e=>ze.value=!0},[...o[8]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`3`,"stroke-linecap":`round`,"aria-hidden":`true`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,L)],8,F)):c(``,!0)],8,[`to`])):c(``,!0)],8,qe)):c(``,!0)],2)],512))}}),[[`__scopeId`,`data-v-bbf532ae`]]);t(),C(),u(),ie();var Je={class:`sidebar-header`},Ye={class:`sidebar-title`},Xe={class:`sidebar-actions`},Ze={class:`sidebar-search`},Qe=[`placeholder`,`title`],$e=[`title`,`aria-label`],et={key:0,class:`sidebar-tree`},tt={key:1,class:`tree-arrow-spacer`},nt={class:`tree-icon mit-icon`,"aria-hidden":`true`},rt=[`xlink:href`],it=[`onClick`,`onContextmenu`],at={key:1,class:`tree-arrow-spacer`},ot={key:2,class:`tree-icon mit-icon`,"aria-hidden":`true`},st=[`xlink:href`],ct={key:3,class:`tree-icon mit-icon`,"aria-hidden":`true`},lt=[`xlink:href`],ut=[`title`],dt={key:0,class:`tree-name-hit`},ft={key:4,class:`tree-loading`},pt={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)`}},mt={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-tertiary)`}},ht=[`placeholder`],gt={key:0,class:`tree-node tree-inline-input-row`,style:{paddingLeft:`12px`}},_t={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)`}},vt={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-tertiary)`}},yt=[`placeholder`],bt={key:1,class:`tree-empty`},xt={key:1,class:`sidebar-loading`},St={class:`editor-main`},Ct={key:0,class:`editor-tabs`},wt=[`onClick`,`title`],Tt={class:`tab-name`},Et={key:0,class:`tab-dirty-dot`},Dt=[`onClick`],Ot=[`title`],kt=[`disabled`,`title`],At=[`title`],jt={key:1,class:`editor-empty`},Mt={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{opacity:`.3`}},Nt={class:`editor-empty-hint`},Pt={class:`editor-body`},Ft={key:0,class:`image-tab-placeholder`},It={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`}},Lt={class:`image-tab-placeholder-title`},Rt={class:`image-tab-placeholder-hint`},zt={class:`preview-header`},Bt={class:`preview-title`},Vt={class:`preview-ext-badge`},Ht=[`title`],Ut={class:`preview-body`},Wt=[`sandbox`,`srcdoc`],Gt=6e4,Kt=3e4,qt=k(o({__name:`EditorView`,props:{pendingFilePath:{}},setup(t){self.MonacoEnvironment={getWorker(e,t){return t===`json`?new De:t===`css`||t===`scss`||t===`less`?new Te:t===`html`||t===`handlebars`||t===`razor`?new xe:t===`typescript`||t===`javascript`?new Ce:new Se}};let o=t,u=fe(),ie=Ae(),C=v([]),le=v(!1),D=v(``),ue=v(``),k=null;function ke(){D.value=``,ue.value=``,k&&=(clearTimeout(k),null)}S(D,e=>{k&&clearTimeout(k),k=setTimeout(()=>{ue.value=e,k=null},180)}),w(()=>{k&&clearTimeout(k),Me(),_n()});let A=null;function je(){Me(),u.ui.fileTreeAutoRefresh&&(A=setInterval(()=>{document.hidden||u.currentDirectory&&(D.value.trim()||j())},Gt))}function Me(){A&&=(clearInterval(A),null)}S(()=>u.currentDirectory,async()=>{if(Qt=!1,je(),await Pe(),F.value.some(e=>e.isDirty)){Qt=!0;return}F.value=[],I.value=null,an(),await tn()}),S(()=>u.ui.fileTreeAutoRefresh,()=>{je()});async function Ne(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 Pe(){let e=u.currentDirectory;if(e){le.value=!0;try{C.value=await Ne(e,0)}finally{le.value=!1}}}function Fe(e,t=new Set){for(let n of e)n.type===`directory`&&n.expanded&&(t.add(n.path),n.children&&Fe(n.children,t));return t}function Ie(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=Ie(e.children,t+1),n.expanded=!0),n})}async function Le(e){let t=u.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:Ie(n.items,0)}catch{return null}}function Re(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)?Re(a.children,i.children)&&(a.children=i.children,r=!0):(a.children=i.children,r=!0)))}return r}async function j(e={}){if(!u.currentDirectory)return;let t=await Le([...Fe(C.value)]);if(!t){e.notifyOnError&&g.error(O(`@EDITOR:刷新失败`));return}if(C.value.length===0){C.value=t;return}Re(C.value,t)&&(C.value=t)}async function N(e){if(e.type===`directory`){if(e.expanded)e.expanded=!1;else{if(!e.children){e.loading=!0;try{e.children=await Ne(e.path,e.depth+1)}finally{e.loading=!1}}e.expanded=!0}}}function P(e){let t=[];for(let n of e)t.push(n),n.type===`directory`&&n.expanded&&n.children&&t.push(...P(n.children));return t}let Be=f(()=>ue.value.trim().toLowerCase());function Ve(e,t){if(!t)return e;let n=[];for(let r of e){let e=r.children?Ve(r.children,t):[],i=r.name.toLowerCase().includes(t);r.type===`directory`?(i||e.length>0)&&(r.expanded=!0,r.children!==void 0&&(r.children=e),n.push(r)):i&&n.push(r)}return n}let He=f(()=>Ve(C.value,Be.value)),Ue=f(()=>Be.value.length>0&&He.value.length===0);function We(e){let t=ue.value.trim();if(!t)return[{text:e,hit:!1}];let n=e.toLowerCase(),r=t.toLowerCase(),i=[],a=0,o=n.indexOf(r,a);for(;o!==-1;)o>a&&i.push({text:e.slice(a,o),hit:!1}),i.push({text:e.slice(o,o+r.length),hit:!0}),a=o+r.length,o=n.indexOf(r,a);return a<e.length&&i.push({text:e.slice(a),hit:!1}),i}let Ge=v(null);function Ke(){let e=Ge.value;e&&(e.focus(),e.select())}function qe(){D.value?(ke(),Ge.value?.focus()):(Ge.value?.blur(),z.value?.focus())}let F=v([]),I=v(null),L=v(null);async function qt(e){if(L.value=e,e.type!==`file`){N(e);return}let t=F.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:F.value.length}),t){I.value=e.path,p(()=>sn());return}let n=e.name.split(`.`).pop()||``;if(er.has(n.toLowerCase())){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null};F.value.push(t),I.value=e.path,J.value=!0;return}if(ye(e.name)){let t={path:e.path,name:e.name,content:``,originalContent:``,isDirty:!1,language:`office`,diskMtimeMs:null};F.value.push(t),I.value=e.path,Y.value=!1,J.value=!0;return}try{let t=await fetch(`/api/editor/file?path=${encodeURIComponent(e.path)}`),r=await t.json();if(console.log(`[debug-open-in-editor] EditorView fetch /api/editor/file response:`,{path:e.path,status:t.status,data:r}),!r.success){g.error(`${O(`@EDITOR:打开文件失败: `)}${r.error}`);return}let i=M(n),a=B.get(e.path);a&&!a.isDisposed()&&a.setValue(r.content);let o={path:e.path,name:e.name,content:r.content,originalContent:r.content,isDirty:!1,language:i,diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null};console.log(`[debug-open-in-editor] EditorView pushing tab:`,{path:o.path,name:o.name,contentLen:o.content.length,lang:o.language}),F.value.push(o),I.value=e.path,console.log(`[debug-open-in-editor] EditorView tabs after push:`,F.value.length,`activeTabPath=`,I.value)}catch(e){console.log(`[debug-open-in-editor] EditorView fetch threw:`,e),g.error(`${O(`@EDITOR:打开文件失败: `)}${e.message}`)}}S(()=>o.pendingFilePath,async e=>{if(console.log(`[debug-open-in-editor] EditorView watcher fired, filePath=`,e),!e)return;await p();let t=e.split(/[\\/]/).pop()||e;console.log(`[debug-open-in-editor] EditorView calling openFile, name=`,t,`path=`,e),await qt({name:t,path:e,type:`file`,depth:0}),console.log(`[debug-open-in-editor] EditorView openFile returned`)},{immediate:!0});function Jt(e,t){t.stopPropagation();let n=F.value.findIndex(t=>t.path===e);n!==-1&&(!F.value[n].isDirty||confirm(O(`@EDITOR:文件未保存,确认关闭?`)))&&(F.value.splice(n,1),I.value===e&&(I.value=F.value[Math.min(n,F.value.length-1)]?.path??null))}let Yt=()=>F.value.find(e=>e.path===I.value)??null,Xt=f(()=>({expandedDirs:[...Fe(C.value)],tabs:F.value.map(e=>e.path),activeTab:I.value})),Zt=!1,Qt=!1;function $t(){Qt&&!Zt&&u.isUiLoaded&&u.saveEditorWorkspace(Xt.value)}S(Xt,()=>$t());async function en(e){if(F.value.some(t=>t.path===e))return;let t=e.split(/[\\/]/).pop()||e,n=(t.split(`.`).pop()||``).toLowerCase();if(er.has(n)){F.value.push({path:e,name:t,content:``,originalContent:``,isDirty:!1,language:`plaintext`,diskMtimeMs:null});return}if(ye(t)){F.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=B.get(e);i&&!i.isDisposed()&&z.value?.getModel()!==i&&(i.dispose(),B.delete(e)),F.value.push({path:e,name:t,content:r.content,originalContent:r.content,isDirty:!1,language:M(n),diskMtimeMs:typeof r.mtimeMs==`number`?r.mtimeMs:null})}catch{}}async function tn(){try{for(let e=0;e<100&&!u.isUiLoaded;e++)await new Promise(e=>setTimeout(e,50));if(!u.isUiLoaded)return;H.value=u.ui.editorSidebarWidth;let e=u.getEditorWorkspace();if(!e)return;Zt=!0;try{if(e.expandedDirs.length>0){let t=await Le(e.expandedDirs);t&&(C.value=t)}for(let t of e.tabs)await en(t);if(!o.pendingFilePath&&e.activeTab&&F.value.some(t=>t.path===e.activeTab)){I.value=e.activeTab;let t=Yt(),n=(t?.name.split(`.`).pop()||``).toLowerCase();t&&(er.has(n)||ye(t.name))&&(J.value=!0)}}finally{Zt=!1}}finally{Qt=!0,$t()}}let nn=v(null),z=se(null),B=new Map;function rn(e){let t=B.get(e.path);return(!t||t.isDisposed())&&(t=Ee.createModel(e.content,e.language,we.file(e.path)),B.set(e.path,t)),t}function an(){z.value?.setModel(null);for(let e of B.values())e.isDisposed()||e.dispose();B.clear()}function on(){if(!nn.value)return;let e=document.documentElement.getAttribute(`data-theme`)===`dark`;z.value=Ee.create(nn.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}),z.value.onDidChangeModelContent(()=>{let e=Yt();if(!e)return;let t=z.value.getValue();e.content=t,e.isDirty=t!==e.originalContent}),z.value.onDidBlurEditorText(()=>{u.ui.editorAutoSave&&Yt()?.isDirty&&bn(!1),requestAnimationFrame(()=>{if(!V.value||V.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`))||sn()})})}S(I,e=>{if(!z.value||!e)return;let t=F.value.find(t=>t.path===e);if(!t)return;let n=rn(t);z.value.setModel(n),p(()=>sn()),pn(e)});function sn(){if(!z.value)return;z.value.focus();let e=document.querySelector(`.monaco-editor .native-edit-context`);e&&document.activeElement!==e&&requestAnimationFrame(()=>e.focus?.())}let cn=0,ln=new Map;async function un(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 dn(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 fn(e,t,n){e.content=t,e.originalContent=t,e.isDirty=!1,e.diskMtimeMs=n;let r=B.get(e.path);if(!r||r.isDisposed())return;let i=z.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 pn(e){if(!e)return;let t=F.value.find(t=>t.path===e);if(!t||t.diskMtimeMs===null)return;let n=++cn,r=await un(e);if(n!==cn||F.value.find(t=>t.path===e)!==t||!r||r.mtimeMs===t.diskMtimeMs)return;if(t.isDirty){if(ln.get(e)===r.mtimeMs)return;ln.set(e,r.mtimeMs);try{await ae.confirm(O(`@EDITOR:这个文件在磁盘上已被改动,你这边也有未保存的编辑。重新加载会丢弃你的改动。`),O(`@EDITOR:文件已被外部改动`),{confirmButtonText:O(`@EDITOR:重新加载`),cancelButtonText:O(`@EDITOR:保留我的`),type:`warning`})}catch{return}if(t.isDirty)return}let i=await dn(e);i&&F.value.find(t=>t.path===e)===t&&fn(t,i.content,i.mtimeMs)}function mn(){document.hidden||pn(I.value)}let hn=null;function gn(){_n(),hn=setInterval(()=>{document.hidden||pn(I.value)},Kt)}function _n(){hn&&=(clearInterval(hn),null)}S(()=>F.value.filter(e=>e.isDirty).length,e=>{ie.setDirtyCount(e)},{immediate:!0}),w(()=>ie.setDirtyCount(0)),Oe(()=>{let e=document.documentElement.getAttribute(`data-theme`)===`dark`;Ee.setTheme(e?`vs-dark`:`vs`)});let vn=null;function yn(){if(vn||!V.value)return;let e=[V.value],t=V.value.parentElement;for(;t;){if(t.classList.contains(`view-pane`)||t.classList.contains(`editor-pane`)){e.push(t);break}t=t.parentElement}vn=new MutationObserver(()=>{V.value&&V.value.offsetParent!==null&&I.value&&z.value&&(pn(I.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`))||sn()}))});let n=vn;e.forEach(e=>n.observe(e,{attributes:!0,attributeFilter:[`style`,`class`,`hidden`]}))}ne(async()=>{on(),await Pe(),await tn(),yn(),je(),window.addEventListener(`focus`,mn),document.addEventListener(`visibilitychange`,mn),gn(),I.value&&p(()=>sn())}),w(()=>{vn?.disconnect(),vn=null,window.removeEventListener(`focus`,mn),document.removeEventListener(`visibilitychange`,mn),z.value?.dispose(),B.forEach(e=>e.dispose()),B.clear()});async function bn(e=!1){let t=Yt();if(t)try{let n=await(await fetch(`/api/editor/file`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t.path,content:t.content})})).json();if(!n.success){g.error(`${O(`@EDITOR:保存失败: `)}${n.error}`);return}t.originalContent=t.content,t.isDirty=!1,typeof n.mtimeMs==`number`&&(t.diskMtimeMs=n.mtimeMs),e||g.success(O(`@EDITOR:已保存`))}catch(e){g.error(`${O(`@EDITOR:保存失败: `)}${e.message}`)}}function xn(e){let t=e.ctrlKey||e.metaKey;if(t&&e.key.toLowerCase()===`f`){e.preventDefault(),Ke();return}t&&e.key===`s`&&(e.preventDefault(),bn())}ne(()=>window.addEventListener(`keydown`,xn)),w(()=>window.removeEventListener(`keydown`,xn));let V=v(null),H=v(u.ui.editorSidebarWidth),Sn=!1,Cn=0,wn=0;function Tn(e){Sn=!0,Cn=e.clientX,wn=H.value,document.addEventListener(`mousemove`,En),document.addEventListener(`mouseup`,Dn),e.preventDefault()}function En(e){if(!Sn)return;let t=e.clientX-Cn;H.value=Math.max(140,Math.min(400,wn+t))}function Dn(){Sn=!1,document.removeEventListener(`mousemove`,En),document.removeEventListener(`mouseup`,Dn),H.value!==u.ui.editorSidebarWidth&&u.setEditorSidebarWidth(H.value)}function On(e){return e.type===`directory`?pe(e.name):me(e.name)}let U=v(null),W=v(null),G=v(null),kn=v(null);function An(){let e=L.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(/[\\/][^\\/]+$/,``):u.currentDirectory??``,afterNode:e,depth:e.depth}:{parentPath:u.currentDirectory??``,afterNode:null,depth:0}}async function jn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`file`,value:``},await p(),G.value?.focus()}async function Mn(){let e=An();L.value?.type===`directory`&&!L.value.expanded&&await N(L.value),U.value={...e,kind:`directory`,value:``},await p(),G.value?.focus()}function Nn(){U.value=null}async function Pn(){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){g.error(e.error);return}g.success(O(`@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){g.error(e.error);return}g.success(O(`@EDITOR:创建成功`))}U.value=null,await j()}function Fn(e){e.key===`Enter`&&(e.preventDefault(),Pn()),e.key===`Escape`&&(e.preventDefault(),Nn())}let K=v(null),In=v(null);function Ln(e,t){e.preventDefault(),K.value={x:e.clientX,y:e.clientY,node:t}}function q(){K.value=null}async function Rn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`file`,value:``},await p(),G.value?.focus()}async function zn(){let e=K.value?.node;q(),e&&(L.value=e),e?.type===`directory`&&!e.expanded&&await N(e);let t=An();U.value={...t,kind:`directory`,value:``},await p(),G.value?.focus()}async function Bn(){let e=K.value?.node;q(),e&&(W.value={node:e,value:e.name},await p(),kn.value?.focus(),kn.value?.select())}async function Vn(){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){g.error(r.error);return}let i=F.value.find(t=>t.path===e.node.path);i&&(i.path=n,i.name=t,I.value===e.node.path&&(I.value=n)),W.value=null,await j()}function Hn(e){e.key===`Enter`&&(e.preventDefault(),Vn()),e.key===`Escape`&&(e.preventDefault(),W.value=null)}async function Un(){let e=K.value?.node;if(q(),!e)return;let t=e.type===`directory`?O(`@EDITOR:文件夹`):O(`@EDITOR:文件`);if(!confirm(`${O(`@EDITOR:确认删除`)} ${t} "${e.name}"?`))return;let n=await(await fetch(`/api/editor/entry?path=${encodeURIComponent(e.path)}`,{method:`DELETE`})).json();if(!n.success){g.error(n.error);return}let r=F.value.findIndex(t=>t.path===e.path);r!==-1&&(F.value.splice(r,1),I.value===e.path&&(I.value=F.value[Math.max(0,r-1)]?.path??null)),g.success(O(`@EDITOR:已删除`)),await j()}async function Wn(){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||g.error(t.error)}catch(e){g.error(e?.message||String(e))}}function Gn(e){let t=u.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 Kn(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 qn(){let e=K.value?.node;q(),e&&(await Kn(e.path)?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Jn(){let e=K.value?.node;q(),e&&(await Kn(Gn(e.path))?g.success(O(`@EDITOR:已复制到剪贴板`)):g.error(O(`@EDITOR:复制失败`)))}async function Yn(){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||g.error(t.error||O(`@EDITOR:VSCode 未安装`))}catch(e){g.error(e?.message||String(e))}}let Xn=new Set([`html`,`htm`]),Zn=f(()=>{let e=K.value?.node;if(!e||e.type!==`file`)return!1;let t=e.name.slice(e.name.lastIndexOf(`.`)+1).toLowerCase();return Xn.has(t)});async function Qn(){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||g.error(t.error||O(`@EDITOR:浏览器打开失败`))}catch(e){g.error(e?.message||String(e))}}ne(()=>document.addEventListener(`click`,q)),w(()=>document.removeEventListener(`click`,q));let $n=new Set([`md`,`html`,`htm`,`svg`]),er=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`ico`,`bmp`]),J=v(!1),Y=v(!1),X=v(!1),tr=v(!1),nr=v(0),Z=f(()=>F.value.find(e=>e.path===I.value)??null),rr=f(()=>Z.value?.language===`plaintext`&&Z.value?.content===``),ir=f(()=>Z.value?.language===`office`),Q=f(()=>(Z.value?.name??``).split(`.`).pop()?.toLowerCase()??``),ar=f(()=>$n.has(Q.value)||er.has(Q.value)||ye(Q.value)),or=f(()=>((Z.value?.content??``).match(/^#{1,6}\s+/gm)||[]).length),$=f(()=>Q.value===`md`&&or.value>0);S(I,()=>{J.value&&!ar.value&&(J.value=!1),Y.value&&!$.value&&(Y.value=!1)});function sr(){ar.value&&(J.value||(Y.value=!1,X.value=!1),J.value=!J.value)}function cr(){$.value&&(Y.value||(J.value=!1,X.value=!1),Y.value=!Y.value)}function lr(){X.value||(J.value=!1,Y.value=!1),X.value=!X.value,tr.value=!0}let ur=f(()=>{let e=Z.value;if(!e)return``;let t=Q.value,n=document.documentElement.getAttribute(`data-theme`)===`light`?`#ffffff`:`#0d1117`;return t===`html`||t===`htm`?_e(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>`:``}),dr=!1,fr=0,pr=0;function mr(e){dr=!0,fr=e.clientX,pr=nr.value,document.addEventListener(`mousemove`,hr),document.addEventListener(`mouseup`,gr),e.preventDefault()}function hr(e){if(!dr)return;let t=e.clientX-fr;nr.value=Math.max(200,Math.min(900,pr+t))}function gr(){dr=!1,document.removeEventListener(`mousemove`,hr),document.removeEventListener(`mouseup`,gr)}return(t,o)=>(h(),b(E,null,[i(`div`,{class:`editor-view`,ref_key:`containerRef`,ref:V},[i(`div`,{class:`editor-sidebar`,style:m({width:H.value+`px`})},[i(`div`,Je,[i(`span`,Ye,d(a(O)(`@EDITOR:资源管理器`)),1),i(`div`,Xe,[l(a(te),{content:a(O)(`@EDITOR:新建文件`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:jn},[...o[11]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:新建文件夹`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:Mn},[...o[12]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1)]])]),_:1},8,[`content`]),l(a(te),{content:a(O)(`@EDITOR:刷新`),placement:`bottom`,"show-after":300},{default:y(()=>[i(`button`,{class:`sidebar-action-btn`,onClick:o[0]||=e=>j({notifyOnError:!0})},[...o[13]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`1 4 1 10 7 10`}),i(`polyline`,{points:`23 20 23 14 17 14`}),i(`path`,{d:`M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15`})],-1)]])]),_:1},8,[`content`])])]),i(`div`,Ze,[o[15]||=i(`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`},[i(`circle`,{cx:`11`,cy:`11`,r:`7`}),i(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})],-1),x(i(`input`,{ref_key:`searchInputRef`,ref:Ge,"onUpdate:modelValue":o[1]||=e=>D.value=e,type:`text`,class:`sidebar-search-input`,placeholder:a(O)(`@EDITOR:搜索文件...`),title:a(O)(`@EDITOR:搜索文件...`),spellcheck:`false`,autocomplete:`off`,onKeydown:ce(qe,[`escape`])},null,40,Qe),[[re,D.value]]),D.value?(h(),b(`button`,{key:0,class:`sidebar-search-clear`,title:a(O)(`@EDITOR:清除搜索`),"aria-label":a(O)(`@EDITOR:清除搜索`),onClick:ke},[...o[14]||=[i(`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`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,$e)):c(``,!0)]),le.value?(h(),b(`div`,xt,[...o[24]||=[i(`span`,{class:`spin-icon`},null,-1)]])):(h(),b(`div`,et,[(h(!0),b(E,null,e(P(He.value),t=>(h(),b(E,{key:t.path},[W.value&&W.value.node.path===t.path?(h(),b(`div`,{key:0,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+t.depth*14+`px`})},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[16]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,tt)),(h(),b(`svg`,nt,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,rt)])),x(i(`input`,{ref_for:!0,ref_key:`renameInputRef`,ref:kn,"onUpdate:modelValue":o[2]||=e=>W.value.value=e,onKeydown:Hn,onBlur:Vn,onClick:o[3]||=_(()=>{},[`stop`])},null,544),[[re,W.value.value]])],4)):(h(),b(`div`,{key:1,class:T([`tree-node`,{"tree-node--dir":t.type===`directory`,"tree-node--file":t.type===`file`,"tree-node--active":I.value===t.path,"tree-node--selected":L.value?.path===t.path&&I.value!==t.path}]),style:m({paddingLeft:12+t.depth*14+`px`}),onClick:e=>qt(t),onContextmenu:e=>Ln(e,t)},[t.type===`directory`?(h(),b(`span`,{key:0,class:T([`tree-arrow`,{expanded:t.expanded}])},[...o[17]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`9 18 15 12 9 6`})],-1)]],2)):(h(),b(`span`,at)),t.type===`directory`?(h(),b(`svg`,ot,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,st)])):(h(),b(`svg`,ct,[i(`use`,{"xlink:href":`#${On(t)}`},null,8,lt)])),i(`span`,{class:`tree-name`,title:t.path},[(h(!0),b(E,null,e(We(t.name),(e,t)=>(h(),b(E,{key:t},[e.hit?(h(),b(`span`,dt,d(e.text),1)):(h(),b(E,{key:1},[s(d(e.text),1)],64))],64))),128))],8,ut),t.loading?(h(),b(`span`,ft)):c(``,!0)],46,it)),U.value&&U.value.afterNode?.path===t.path?(h(),b(`div`,{key:2,class:`tree-node tree-inline-input-row`,style:m({paddingLeft:12+U.value.depth*14+`px`})},[o[20]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,pt,[...o[18]||=[i(`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)]])):(h(),b(`svg`,mt,[...o[19]||=[i(`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),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_for:!0,ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[4]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[5]||=_(()=>{},[`stop`])},null,40,ht),[[re,U.value.value]])],4)):c(``,!0)],64))),128)),U.value&&U.value.afterNode===null?(h(),b(`div`,gt,[o[23]||=i(`span`,{class:`tree-arrow-spacer`},null,-1),U.value.kind===`directory`?(h(),b(`svg`,_t,[...o[21]||=[i(`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)]])):(h(),b(`svg`,vt,[...o[22]||=[i(`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),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),x(i(`input`,{ref_key:`inlineInputRef`,ref:G,class:`tree-inline-input`,"onUpdate:modelValue":o[6]||=e=>U.value.value=e,placeholder:U.value.kind===`file`?a(O)(`@EDITOR:输入文件名`):a(O)(`@EDITOR:输入文件夹名`),onKeydown:Fn,onBlur:Nn,onClick:o[7]||=_(()=>{},[`stop`])},null,40,yt),[[re,U.value.value]])])):c(``,!0),!U.value&&(Ue.value||C.value.length===0)?(h(),b(`div`,bt,d(Ue.value?a(O)(`@EDITOR:未找到匹配文件`):a(O)(`@EDITOR:暂无文件`)),1)):c(``,!0)]))],4),i(`div`,{class:`editor-resizer`,onMousedown:Tn},null,32),i(`div`,St,[F.value.length>0?(h(),b(`div`,Ct,[(h(!0),b(E,null,e(F.value,e=>(h(),b(`div`,{key:e.path,class:T([`editor-tab`,{active:I.value===e.path,dirty:e.isDirty}]),onClick:t=>I.value=e.path,title:e.path},[i(`span`,Tt,d(e.name),1),e.isDirty?(h(),b(`span`,Et)):c(``,!0),i(`button`,{class:`tab-close`,onClick:t=>Jt(e.path,t)},[...o[25]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Dt)],10,wt))),128)),o[29]||=i(`div`,{class:`editor-tabs-spacer`},null,-1),ar.value?(h(),b(`button`,{key:0,class:T([`preview-toggle-btn`,{active:J.value}]),title:J.value?a(O)(`@EDITOR:关闭预览`):a(O)(`@EDITOR:打开预览`),onClick:sr},[o[26]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z`}),i(`circle`,{cx:`12`,cy:`12`,r:`3`})],-1),i(`span`,null,d(a(O)(`@EDITOR:预览`)),1)],10,Ot)):c(``,!0),$.value?(h(),b(`button`,{key:1,class:T([`preview-toggle-btn mindmap-toggle-btn`,{active:Y.value,disabled:!$.value}]),disabled:!$.value,title:$.value?Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:打开思维导图`):a(O)(`@EDITOR:需要至少一个 # 标题`),onClick:cr},[o[27]||=ee(`<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" data-v-cbd3d025><circle cx="12" cy="12" r="2" data-v-cbd3d025></circle><circle cx="5" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="6" r="1.6" data-v-cbd3d025></circle><circle cx="5" cy="18" r="1.6" data-v-cbd3d025></circle><circle cx="19" cy="18" r="1.6" data-v-cbd3d025></circle><line x1="11" y1="11" x2="6.4" y2="7" data-v-cbd3d025></line><line x1="13" y1="11" x2="17.6" y2="7" data-v-cbd3d025></line><line x1="11" y1="13" x2="6.4" y2="17" data-v-cbd3d025></line><line x1="13" y1="13" x2="17.6" y2="17" data-v-cbd3d025></line></svg>`,1),i(`span`,null,d(a(O)(`@EDITOR:思维导图`)),1)],10,kt)):c(``,!0),i(`button`,{class:T([`preview-toggle-btn agent-toggle-btn`,{active:X.value}]),title:X.value?a(O)(`@EDITOR:关闭 g ai 对话`):a(O)(`@EDITOR:打开 g ai 对话`),onClick:lr},[o[28]||=i(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M12 3l1.9 4.6L18.5 9.5l-4.6 1.9L12 16l-1.9-4.6L5.5 9.5l4.6-1.9z`}),i(`path`,{d:`M18 16.5l.9 2.1 2.1.9-2.1.9-.9 2.1-.9-2.1-2.1-.9 2.1-.9z`})],-1),i(`span`,null,d(a(O)(`@EDITOR:g ai 对话`)),1)],10,At)])):c(``,!0),F.value.length===0?(h(),b(`div`,jt,[(h(),b(`svg`,Mt,[...o[30]||=[i(`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),i(`polyline`,{points:`14 2 14 8 20 8`},null,-1)]])),i(`p`,null,d(a(O)(`@EDITOR:从左侧选择文件打开`)),1),i(`p`,Nt,d(a(O)(`@EDITOR:Ctrl+S 保存`)),1)])):c(``,!0),i(`div`,Pt,[i(`div`,{class:T([`monaco-container`,{hidden:F.value.length===0||rr.value||ir.value}]),ref_key:`editorContainerRef`,ref:nn},null,2),rr.value&&F.value.length>0&&!J.value&&!Y.value?(h(),b(`div`,Ft,[(h(),b(`svg`,It,[...o[31]||=[i(`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`},null,-1),i(`circle`,{cx:`9`,cy:`9`,r:`2`},null,-1),i(`path`,{d:`m21 15-5-5L5 21`},null,-1)]])),i(`p`,Lt,d(Z.value?.name),1),i(`p`,Rt,d(a(O)(`@EDITOR:这是图片文件,已在右侧预览面板中打开`)),1)])):c(``,!0),(J.value||Y.value||X.value)&&F.value.length>0?(h(),b(`div`,{key:1,class:`preview-resizer`,onMousedown:mr},null,32)):c(``,!0),tr.value?x((h(),r(R,{key:2,active:X.value&&F.value.length>0,"active-file-path":I.value,"active-file-name":Z.value?.name??``,style:m({flexBasis:nr.value+`px`}),onClose:o[8]||=e=>X.value=!1},null,8,[`active`,`active-file-path`,`active-file-name`,`style`])),[[oe,X.value&&F.value.length>0]]):c(``,!0),(J.value||Y.value)&&F.value.length>0?(h(),b(`div`,{key:3,class:`preview-panel`,style:m({flexBasis:nr.value+`px`})},[i(`div`,zt,[i(`span`,Bt,d(Y.value?a(O)(`@EDITOR:思维导图`):a(O)(`@EDITOR:预览`)),1),i(`span`,Vt,d(Q.value.toUpperCase()),1),o[33]||=i(`div`,{class:`preview-header-spacer`},null,-1),i(`button`,{class:`preview-close-btn`,title:Y.value?a(O)(`@EDITOR:关闭思维导图`):a(O)(`@EDITOR:关闭预览`),onClick:o[9]||=e=>Y.value?Y.value=!1:J.value=!1},[...o[32]||=[i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`},[i(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),i(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})],-1)]],8,Ht)]),i(`div`,Ut,[Y.value&&Q.value===`md`&&Z.value?(h(),r(ze,{key:0,content:Z.value.content,class:`preview-mindmap`},null,8,[`content`])):J.value&&Q.value===`md`&&Z.value?(h(),r(ge,{key:Z.value.path,content:Z.value.content,class:`preview-markdown`},null,8,[`content`])):J.value&&[`html`,`htm`,`svg`].includes(Q.value)?(h(),b(`iframe`,{key:2,class:`preview-iframe`,sandbox:a(be),srcdoc:ur.value},null,8,Wt)):J.value&&a(er).has(Q.value)&&Z.value?(h(),r(he,{key:3,"file-path":Z.value.path,"file-name":Z.value.name},null,8,[`file-path`,`file-name`])):J.value&&ir.value&&Z.value?(h(),r(ve,{key:4,"file-path":Z.value.path},null,8,[`file-path`])):c(``,!0)])],4)):c(``,!0)])])],512),(h(),r(n,{to:`body`},[K.value?(h(),b(`div`,{key:0,ref_key:`ctxMenuRef`,ref:In,class:`ctx-menu`,style:m({left:K.value.x+`px`,top:K.value.y+`px`}),onClick:o[10]||=_(()=>{},[`stop`])},[i(`button`,{class:`ctx-menu-item`,onClick:Rn},[o[34]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`polyline`,{points:`14 2 14 8 20 8`}),i(`line`,{x1:`12`,y1:`13`,x2:`12`,y2:`19`}),i(`line`,{x1:`9`,y1:`16`,x2:`15`,y2:`16`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:zn},[o[35]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`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`}),i(`line`,{x1:`12`,y1:`11`,x2:`12`,y2:`17`}),i(`line`,{x1:`9`,y1:`14`,x2:`15`,y2:`14`})],-1),s(` `+d(a(O)(`@EDITOR:新建文件夹`)),1)]),o[42]||=i(`div`,{class:`ctx-menu-sep`},null,-1),i(`button`,{class:`ctx-menu-item`,onClick:qn},[o[36]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),i(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})],-1),s(` `+d(a(O)(`@EDITOR:复制绝对路径`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Jn},[o[37]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71`}),i(`path`,{d:`M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71`})],-1),s(` `+d(a(O)(`@EDITOR:复制相对路径`)),1)]),o[43]||=i(`div`,{class:`ctx-menu-sep`},null,-1),Zn.value?(h(),b(`button`,{key:0,class:`ctx-menu-item`,onClick:Qn},[o[38]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`circle`,{cx:`12`,cy:`12`,r:`9`}),i(`line`,{x1:`3`,y1:`12`,x2:`21`,y2:`12`}),i(`path`,{d:`M12 3a13 13 0 0 1 3.5 9 13 13 0 0 1-3.5 9 13 13 0 0 1-3.5-9A13 13 0 0 1 12 3z`})],-1),s(` `+d(a(O)(`@EDITOR:在浏览器中打开`)),1)])):c(``,!0),i(`button`,{class:`ctx-menu-item`,onClick:Wn},[o[39]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`}),i(`path`,{d:`M3 7v10a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2`})],-1),s(` `+d(a(O)(`@EDITOR:在资源管理器中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Yn},[l(de,{"icon-class":`vscode`,"class-name":`ctx-menu-icon`}),s(` `+d(a(O)(`@EDITOR:在 VSCode 中打开`)),1)]),i(`button`,{class:`ctx-menu-item`,onClick:Bn},[o[40]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`path`,{d:`M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`}),i(`path`,{d:`M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z`})],-1),s(` `+d(a(O)(`@EDITOR:重命名`)),1)]),i(`button`,{class:`ctx-menu-item ctx-menu-item--danger`,onClick:Un},[o[41]||=i(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[i(`polyline`,{points:`3 6 5 6 21 6`}),i(`path`,{d:`M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`}),i(`path`,{d:`M10 11v6`}),i(`path`,{d:`M14 11v6`}),i(`path`,{d:`M9 6V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2`})],-1),s(` `+d(a(O)(`@EDITOR:删除`)),1)])],4)):c(``,!0)]))],64))}}),[[`__scopeId`,`data-v-cbd3d025`]]);export{qt as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-DF5LNTW7.js","assets/rolldown-runtime-C0FnF6B9.js","assets/dagre-Dfa6RS7s.js","assets/monaco-B2lPvkrc.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,At as t,Bn as n,Ct as r,Dn as i,En as a,Er as o,Gt as s,H as c,Ht as l,In as u,J as d,Mn as f,Mt as p,Nn as m,On as h,Pn as g,Pr as _,Q as v,Qr as y,Tn as b,U as ee,W as x,Wt as S,Y as C,Yn as w,Yr as T,Zn as E,a as D,an as te,br as O,c as ne,cr as k,ct as re,dn as A,er as ie,ft as ae,in as oe,jt as j,kn as M,lr as N,nr as P,nt as se,o as ce,or as F,ot as I,pr as L,pt as le,qn as ue,qr as de,s as fe,tn as R,tr as pe,vn as me,wt as z,x as B,xn as he,z as V}from"./element-plus-CgEuJBlB.js";import{n as H,t as U}from"./_plugin-vue_export-helper-
|
|
2
|
+
import"./rolldown-runtime-C0FnF6B9.js";import{$n as e,At as t,Bn as n,Ct as r,Dn as i,En as a,Er as o,Gt as s,H as c,Ht as l,In as u,J as d,Mn as f,Mt as p,Nn as m,On as h,Pn as g,Pr as _,Q as v,Qr as y,Tn as b,U as ee,W as x,Wt as S,Y as C,Yn as w,Yr as T,Zn as E,a as D,an as te,br as O,c as ne,cr as k,ct as re,dn as A,er as ie,ft as ae,in as oe,jt as j,kn as M,lr as N,nr as P,nt as se,o as ce,or as F,ot as I,pr as L,pt as le,qn as ue,qr as de,s as fe,tn as R,tr as pe,vn as me,wt as z,x as B,xn as he,z as V}from"./element-plus-CgEuJBlB.js";import{n as H,t as U}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{ir as W}from"./dagre-Dfa6RS7s.js";import{t as ge}from"./SvgIcon-B-2iTLW-.js";import{t as _e}from"./IconButton-BflzboUD.js";import{t as ve}from"./configStore-BFGSfIBp.js";import{r as ye}from"./gitStore-BcrFZogC.js";import{r as G,t as be}from"./fileIcon-B5p5pGN9.js";import{a as xe,c as Se,i as Ce,n as we,o as Te,r as Ee,s as De,t as Oe}from"./previewSandbox-C_ZzCEpS.js";import{a as K,c as ke,i as Ae,o as je,s as Me}from"./monaco-DF5LNTW7.js";import{t as Ne}from"./useThemeObserver-DAyxqy9l.js";import{t as q}from"./CommonDialog-kDck8ITZ.js";n();var Pe=[`width`,`height`],Fe=u({__name:`TreeIcon`,props:{size:{default:`1em`}},setup(e){return(t,n)=>(E(),M(`svg`,{viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,width:e.size,height:e.size,fill:`none`,stroke:`currentColor`,"stroke-width":`1.5`,"stroke-linecap":`round`},[...n[0]||=[f(`<line x1="3" y1="2" x2="3" y2="14"></line><line x1="3" y1="4" x2="6" y2="4"></line><rect x="2" y="3" width="8" height="2" rx="0.5" fill="currentColor" stroke="none"></rect><line x1="3" y1="8" x2="6" y2="8"></line><rect x="4" y="7" width="8" height="2" rx="0.5" fill="currentColor" stroke="none"></rect><line x1="3" y1="12" x2="6" y2="12"></line><rect x="6" y="11" width="8" height="2" rx="0.5" fill="currentColor" stroke="none"></rect>`,7)]],8,Pe))}});n();var Ie=[`width`,`height`],Le=u({__name:`ListIcon`,props:{size:{default:`1em`}},setup(e){return(t,n)=>(E(),M(`svg`,{viewBox:`0 0 16 16`,xmlns:`http://www.w3.org/2000/svg`,width:e.size,height:e.size,fill:`currentColor`,stroke:`none`},[...n[0]||=[a(`rect`,{x:`2`,y:`3`,width:`12`,height:`2`,rx:`0.5`},null,-1),a(`rect`,{x:`2`,y:`7`,width:`12`,height:`2`,rx:`0.5`},null,-1),a(`rect`,{x:`2`,y:`11`,width:`12`,height:`2`,rx:`0.5`},null,-1)]],8,Ie))}});function Re(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function ze(e){if(!e)return``;let t=e.split(`
|
|
3
3
|
`),n=!1,r=null;return t.map(e=>{let t=Re(e);return e.startsWith(`diff --git`)||e.startsWith(`diff --cc`)||e.startsWith(`diff --combined`)?`<div class="diff-header">${t}</div>`:e.startsWith(`---`)?`<div class="diff-old-file">${t}</div>`:e.startsWith(`+++`)?`<div class="diff-new-file">${t}</div>`:e.startsWith(`@@`)?`<div class="diff-hunk-header">${t}</div>`:e.match(/^[+\-\s]*<{7,}\s+(HEAD|.*)/)?(n=!0,r=`current`,`<div class="diff-conflict-start">${t}</div>`):e.match(/^[+\-\s]*={7,}\s*$/)?(r=`incoming`,`<div class="diff-conflict-separator">${t}</div>`):e.match(/^[+\-\s]*>{7,}\s+.*/)?(n=!1,r=null,`<div class="diff-conflict-end">${t}</div>`):n&&r?r===`current`?`<div class="diff-conflict-current">${t}</div>`:`<div class="diff-conflict-incoming">${t}</div>`:e.startsWith(`+`)?`<div class="diff-added">${` `+t.substring(1)}</div>`:e.startsWith(`-`)?`<div class="diff-removed">${` `+t.substring(1)}</div>`:`<div class="diff-context">${t}</div>`}).join(``)}function Be(e){if(!e)return``;let t=e.match(/^(feat|fix|docs|style|refactor|perf|test|chore|build|ci|revert)(\([^)]+\))?\s*:\s*(.+)$/s);return t?t[3].trim():e.trim()}n(),L(),_();var Ve={class:`file-action-buttons`},He={key:1,style:{"font-size":`var(--font-size-md)`,"font-weight":`bold`}},Ue=U(u({__name:`FileActionButtons`,props:{filePath:{},fileType:{},isLocked:{type:Boolean,default:!1},isLocking:{type:Boolean,default:!1},showLockButton:{type:Boolean,default:!0}},emits:[`toggleLock`,`stage`,`unstage`,`revert`,`manageLockedFiles`],setup(t,{emit:n}){let r=t,s=n,c=b(()=>{switch(r.fileType){case`added`:return[{type:`unstage`,tooltip:H(`@0883F:取消暂存`),buttonType:`warning`,icon:`-`,handler:()=>s(`unstage`,r.filePath)}];case`modified`:case`deleted`:return[{type:`stage`,tooltip:H(`@0883F:添加到暂存区`),buttonType:`success`,icon:`+`,handler:()=>s(`stage`,r.filePath)},{type:`revert`,tooltip:H(`@0883F:撤回修改`),buttonType:`danger`,icon:S,handler:()=>s(`revert`,r.filePath)}];case`untracked`:return[{type:`stage`,tooltip:H(`@0883F:添加到暂存区`),buttonType:`success`,icon:`+`,handler:()=>s(`stage`,r.filePath)},{type:`delete`,tooltip:H(`@0883F:删除文件`),buttonType:`danger`,icon:I,handler:()=>s(`revert`,r.filePath)}];default:return[]}});function l(e){e.stopPropagation(),s(`toggleLock`,r.filePath)}function u(e,t){t.stopPropagation(),e()}function f(e){e.stopPropagation(),s(`manageLockedFiles`)}return(n,r)=>{let s=d,p=V,m=x;return E(),M(`div`,Ve,[t.showLockButton?(E(),i(m,{key:0,content:t.isLocking?o(H)(`@0883F:处理中...`):t.isLocked?o(H)(`@0883F:解锁文件`):o(H)(`@0883F:锁定文件`),placement:`top`,disabled:t.isLocking,"show-after":200},{default:k(()=>[g(p,{type:t.isLocked?`danger`:`info`,size:`small`,text:``,loading:t.isLocking,disabled:t.isLocking,onClick:l,class:`file-action-btn`},{default:k(()=>[t.isLocking?h(``,!0):(E(),i(s,{key:0,size:`16`},{default:k(()=>[(E(),i(P(t.isLocked?o(j):o(R))))]),_:1}))]),_:1},8,[`type`,`loading`,`disabled`])]),_:1},8,[`content`,`disabled`])):h(``,!0),t.isLocked?(E(),i(m,{key:1,content:o(H)(`@13D1C:管理锁定文件`),placement:`top`,"show-after":200},{default:k(()=>[g(p,{type:`warning`,size:`small`,text:``,onClick:f,class:`file-action-btn`},{default:k(()=>[g(s,{size:`16`},{default:k(()=>[...r[0]||=[a(`svg`,{viewBox:`0 0 1024 1024`,xmlns:`http://www.w3.org/2000/svg`},[a(`path`,{fill:`currentColor`,d:`M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357.12 357.12 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a351.616 351.616 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357.12 357.12 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296L315.2 220.096c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294.113 294.113 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293.12 293.12 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294.113 294.113 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288.282 288.282 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293.12 293.12 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a287.616 287.616 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384zm0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256z`})],-1)]]),_:1})]),_:1})]),_:1},8,[`content`])):h(``,!0),(E(!0),M(he,null,e(c.value,e=>(E(),i(m,{key:e.type,content:e.tooltip,placement:`top`,"show-after":200},{default:k(()=>[g(p,{type:e.buttonType,size:`small`,text:``,onClick:t=>u(e.handler,t),class:`file-action-btn`},{default:k(()=>[typeof e.icon==`string`?(E(),M(`span`,He,y(e.icon),1)):(E(),i(s,{key:0,size:`16`},{default:k(()=>[(E(),i(P(e.icon)))]),_:2},1024))]),_:2},1032,[`type`,`onClick`])]),_:2},1032,[`content`]))),128))])}}}),[[`__scopeId`,`data-v-e552faf2`]]);function We(e){let t=[],n=new Map;return[...e].sort((e,t)=>e.path.localeCompare(t.path)).forEach(e=>{let r=e.path.split(`/`).filter(e=>e),i=``,a=t;r.forEach((t,o)=>{let s=o===r.length-1;i=i?`${i}/${t}`:t;let c=n.get(i);c||(c={name:t,path:i,isDirectory:!s,expanded:!0},s?(c.file=e,c.type=e.type,c.locked=e.locked):c.children=[],n.set(i,c),a.push(c)),!s&&c.children&&(a=c.children)})}),t}function Ge(e){e.expanded=!e.expanded}function Ke(e,t){let n=new Map,r=e=>{e.forEach(e=>{e.isDirectory&&(n.set(e.path,e.expanded||!1),e.children&&r(e.children))})},i=e=>{e.forEach(e=>{if(e.isDirectory){let t=n.get(e.path);t!==void 0&&(e.expanded=t),e.children&&i(e.children)}})};r(t),i(e)}n(),_(),L();var qe={class:`tree-node-wrapper`},J=[`xlink:href`],Y={class:`node-name`},X={key:0,class:`file-type-tag`},Je={key:2,class:`file-actions`},Ye={key:0,class:`tree-children`},Z=U(u({__name:`TreeNodeItem`,props:{node:{},level:{},selectedFile:{default:``},showActionButtons:{type:Boolean,default:!1},isFileLocked:{type:Function,default:()=>!1},isLocking:{type:Function,default:()=>!1}},emits:[`file-select`,`toggle-lock`,`stage`,`unstage`,`revert`,`node-click`],setup(t,{emit:n}){let r=t,s=n;function c(e){return`${e*20+10}px`}function l(e){return G(e.name,e.isDirectory,!!e.expanded)}function u(e){return!e.isDirectory&&e.path===r.selectedFile}function f(){s(`node-click`,r.node)}return(n,r)=>{let p=pe(`TreeNodeItem`,!0);return E(),M(`div`,qe,[a(`div`,{class:de([`tree-node`,{"is-directory":t.node.isDirectory,"is-file":!t.node.isDirectory,"is-selected":u(t.node),"is-locked":t.node.locked,[`file-type-${t.node.type}`]:t.node.type}]),style:T({paddingLeft:c(t.level)}),onClick:f},[(E(),M(`svg`,{class:de([`node-icon mit-icon`,{"folder-icon":l(t.node).key.startsWith(`folder-`)}]),"aria-hidden":`true`},[a(`use`,{"xlink:href":`#${l(t.node).spriteId}`},null,8,J)],2)),g(o(x),{content:t.node.path,placement:`top`,disabled:t.node.name.length<=35,"show-after":200},{default:k(()=>[a(`span`,Y,y(t.node.name),1)]),_:1},8,[`content`,`disabled`]),t.node.isDirectory?h(``,!0):(E(),M(`span`,X,y(t.node.type||`modified`),1)),t.node.locked?(E(),i(o(x),{key:1,content:o(H)(`@E80AC:该文件已被锁定,提交时会被跳过`),placement:`top`,"show-after":200},{default:k(()=>[g(o(d),{class:`lock-icon`,color:`var(--color-warning)`},{default:k(()=>[g(o(j))]),_:1})]),_:1},8,[`content`])):h(``,!0),t.showActionButtons&&!t.node.isDirectory&&t.node.file?(E(),M(`div`,Je,[g(Ue,{"file-path":t.node.path,"file-type":t.node.type||`modified`,"is-locked":t.isFileLocked(t.node.path),"is-locking":t.isLocking(t.node.path),onToggleLock:r[0]||=e=>s(`toggle-lock`,e),onStage:r[1]||=e=>s(`stage`,e),onUnstage:r[2]||=e=>s(`unstage`,e),onRevert:r[3]||=e=>s(`revert`,e)},null,8,[`file-path`,`file-type`,`is-locked`,`is-locking`])])):h(``,!0)],6),t.node.isDirectory&&t.node.expanded&&t.node.children&&t.node.children.length>0?(E(),M(`div`,Ye,[(E(!0),M(he,null,e(t.node.children,e=>(E(),i(p,{key:e.path+`-`+(e.expanded?`open`:`closed`),node:e,level:t.level+1,"selected-file":t.selectedFile,"show-action-buttons":t.showActionButtons,"is-file-locked":t.isFileLocked,"is-locking":t.isLocking,onFileSelect:r[4]||=e=>s(`file-select`,e),onToggleLock:r[5]||=e=>s(`toggle-lock`,e),onStage:r[6]||=e=>s(`stage`,e),onUnstage:r[7]||=e=>s(`unstage`,e),onRevert:r[8]||=e=>s(`revert`,e),onNodeClick:r[9]||=e=>s(`node-click`,e)},null,8,[`node`,`level`,`selected-file`,`show-action-buttons`,`is-file-locked`,`is-locking`]))),128))])):h(``,!0)])}}}),[[`__scopeId`,`data-v-ec49f691`]]);n(),L();var Xe={class:`file-tree-view`},Ze=U(u({__name:`FileTreeView`,props:{treeData:{},selectedFile:{default:``},showActionButtons:{type:Boolean,default:!1},isFileLocked:{type:Function,default:()=>!1},isLocking:{type:Function,default:()=>!1}},emits:[`file-select`,`toggle-lock`,`stage`,`unstage`,`revert`],setup(t,{emit:n}){let r=n,a=O(0);function o(e){e.isDirectory?(Ge(e),a.value++):e.file&&r(`file-select`,e.path)}return(n,a)=>(E(),M(`div`,Xe,[(E(!0),M(he,null,e(t.treeData,e=>(E(),i(Z,{key:e.path+`-`+(e.expanded?`open`:`closed`),node:e,level:0,"selected-file":t.selectedFile,"show-action-buttons":t.showActionButtons,"is-file-locked":t.isFileLocked,"is-locking":t.isLocking,onFileSelect:a[0]||=e=>r(`file-select`,e),onToggleLock:a[1]||=e=>r(`toggle-lock`,e),onStage:a[2]||=e=>r(`stage`,e),onUnstage:a[3]||=e=>r(`unstage`,e),onRevert:a[4]||=e=>r(`revert`,e),onNodeClick:o},null,8,[`node`,`selected-file`,`show-action-buttons`,`is-file-locked`,`is-locking`]))),128))]))}}),[[`__scopeId`,`data-v-267015cf`]]);n(),L();var Qe=U(u({__name:`MonacoDiffViewer`,props:{original:{},modified:{},language:{default:`plaintext`},filePath:{default:``},theme:{default:`auto`},readOnly:{type:Boolean,default:!0}},setup(e){let t=e,n=O(null),r=null,i=null,a=null,o=null,s=null;async function c(){return r||s||(s=(async()=>{let e=self;return e.MonacoEnvironment||={getWorker(e,t){return t===`json`?new Me:t===`css`||t===`scss`||t===`less`?new je:t===`html`||t===`handlebars`||t===`razor`?new K:t===`typescript`||t===`javascript`?new Ae:new ke}},r=await W(()=>import(`./monaco-DF5LNTW7.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3])),r})(),s)}function l(e){let t=(e||``).toLowerCase().match(/\.([a-z0-9]+)$/),n=t?t[1]:``;return n===`ts`||n===`tsx`?`typescript`:n===`js`||n===`jsx`||n===`cjs`||n===`mjs`?`javascript`:n===`json`?`json`:n===`html`||n===`htm`||n===`vue`?`html`:n===`css`?`css`:n===`scss`?`scss`:n===`less`?`less`:n===`md`||n===`markdown`?`markdown`:n===`yml`||n===`yaml`?`yaml`:n===`xml`?`xml`:n===`sh`?`shell`:n===`ps1`?`powershell`:n===`go`?`go`:n===`rs`?`rust`:n===`py`?`python`:n===`java`?`java`:n===`cpp`||n===`cc`||n===`cxx`||n===`hpp`||n===`h`?`cpp`:n===`cs`?`csharp`:`plaintext`}function u(){return t.language===`auto`?l(t.filePath||``):t.language||`plaintext`}function d(){return t.theme&&t.theme!==`auto`?t.theme:document.documentElement.getAttribute(`data-theme`)===`dark`?`vs-dark`:`vs`}function f(){if(!r)return;let e=d();r.editor.setTheme(e)}Ne(()=>f());function p(){if(!r)return;a?.dispose(),o?.dispose();let e=u();a=r.editor.createModel(t.original||``,e),o=r.editor.createModel(t.modified||``,e)}function m(){i&&a&&o&&i.setModel({original:a,modified:o})}function h(){a&&a.getValue()!==(t.original||``)&&a.setValue(t.original||``),o&&o.getValue()!==(t.modified||``)&&o.setValue(t.modified||``)}return w(async()=>{n.value&&(r=await c(),f(),p(),i=r.editor.createDiffEditor(n.value,{automaticLayout:!0,readOnly:t.readOnly,renderSideBySide:!0,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,renderWhitespace:`selection`,originalEditable:!t.readOnly}),m())}),F(()=>t.language,()=>{if(!r)return;let e=u();a&&r.editor.setModelLanguage(a,e),o&&r.editor.setModelLanguage(o,e)}),F(()=>t.filePath,()=>{if(!r||t.language!==`auto`)return;let e=u();a&&r.editor.setModelLanguage(a,e),o&&r.editor.setModelLanguage(o,e)}),F(()=>t.theme,()=>{f()}),F(()=>[t.original,t.modified],()=>{h()}),ue(()=>{i?.dispose(),i=null,a?.dispose(),o?.dispose(),a=null,o=null}),(e,t)=>(E(),M(`div`,{ref_key:`containerRef`,ref:n,class:`monaco-diff-container`},null,512))}}),[[`__scopeId`,`data-v-0c23e676`]]);n(),_(),L();var $e=U(u({__name:`MonacoEditor`,props:{modelValue:{},language:{default:`plaintext`},filePath:{default:``},theme:{default:`auto`},readOnly:{type:Boolean,default:!1},minHeight:{default:`360px`},revealLine:{default:null},highlightRange:{default:null},dimHighlightRanges:{default:null},highlightKind:{default:``},gutterPlacement:{default:`glyph`},gutterItems:{default:()=>[]},rightActions:{default:()=>[]},appliedBlocks:{default:()=>[]},syncGroup:{default:null},syncScrollTop:{default:null}},emits:[`update:modelValue`,`gutter-click`,`scroll-change`],setup(e,{emit:t}){let n=e,r=t,i=O(null),a=null,o=null,s=null,c=null,l=!1,u=[],d=[],f=[],p=null,m=null,h=new Map,g=null,_=null;function v(){if(!o)return;let e=n.gutterItems||[],t=n.gutterPlacement===`glyph`&&e.length>0;try{o.updateOptions({glyphMargin:t})}catch{}}function y(){if(!o||m)return;let e=o.getDomNode?.();e&&(m=document.createElement(`div`),m.className=`merge-right-actions`,e.appendChild(m))}function b(){m&&(m.innerHTML=``,h.clear())}function ee(){if(!o||!a||!m)return;let e=n.rightActions||[];if(!e.length)return;let t=o.getLayoutInfo?.(),r=t?.contentLeft??0,i=t?.contentWidth??0,c=Math.max(0,r+i-44);for(let t of e){let e=h.get(t.blockId);if(!e)continue;let n=s?.getLineMaxColumn?.(t.line)??1,r=o.getScrolledVisiblePosition?.({lineNumber:t.line,column:n});if(!r){e.style.display=`none`;continue}e.style.display=``,e.style.top=`${r.top}px`,e.style.left=`${c}px`,e.style.height=`${r.height}px`}}function x(e,t){let r=(n.appliedBlocks||[]).find(t=>t.blockId===e);return r?t===`current`?r.choice===`current`||r.choice===`both`:r.choice===`incoming`||r.choice===`both`:!1}function S(e,t){let r=(n.appliedBlocks||[]).find(t=>t.blockId===e);return r?t===`current`?r.choice===`incoming`:r.choice===`current`:!1}function C(e,t,n){e.setAttribute(`role`,`button`),e.setAttribute(`tabindex`,`0`),e.setAttribute(`aria-label`,t),n&&e.setAttribute(`aria-pressed`,`true`),e.addEventListener(`keydown`,t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),e.click())})}function D(){if(!o||(y(),!m))return;let e=(n.rightActions||[]).filter(e=>e&&e.line&&e.line>0);if(!e.length){b();return}b();for(let t of e){let e=x(t.blockId,t.kind),n=S(t.blockId,t.kind),i=document.createElement(`div`);if(i.className=`merge-right-action-wrapper`,t.kind===`current`){let a=document.createElement(`div`);a.className=`merge-right-action merge-right-action-current${e?` is-applied`:``}`,a.textContent=e?`✓`:`→`,a.title=e?`已采用当前更改`:`采用当前更改`,C(a,a.title,e),a.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),a.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`accept`)});let o=document.createElement(`div`);o.className=`merge-right-action merge-right-action-close${n?` is-discarded`:``}`,o.textContent=`✕`,o.title=n?`已丢弃当前更改`:`丢弃当前更改`,C(o,o.title,n),o.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`discard`)}),i.appendChild(a),i.appendChild(o)}else{let a=document.createElement(`div`);a.className=`merge-right-action merge-right-action-close${n?` is-discarded`:``}`,a.textContent=`✕`,a.title=n?`已丢弃传入更改`:`丢弃传入更改`,C(a,a.title,n),a.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),a.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`discard`)});let o=document.createElement(`div`);o.className=`merge-right-action merge-right-action-incoming${e?` is-applied`:``}`,o.textContent=e?`✓`:`←`,o.title=e?`已采用传入更改`:`采用传入更改`,C(o,o.title,e),o.addEventListener(`mousedown`,e=>{e.preventDefault(),e.stopPropagation()}),o.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation(),r(`gutter-click`,t.blockId,`accept`)}),i.appendChild(a),i.appendChild(o)}m.appendChild(i),h.set(t.blockId,i)}ee()}async function te(){return a||c||(c=(async()=>{let e=self;return e.MonacoEnvironment||={getWorker(e,t){return t===`json`?new Me:t===`css`||t===`scss`||t===`less`?new je:t===`html`||t===`handlebars`||t===`razor`?new K:t===`typescript`||t===`javascript`?new Ae:new ke}},a=await W(()=>import(`./monaco-DF5LNTW7.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3])),a})(),c)}function ne(e){let t=(e||``).toLowerCase().match(/\.([a-z0-9]+)$/),n=t?t[1]:``;return n===`ts`||n===`tsx`?`typescript`:n===`js`||n===`jsx`||n===`cjs`||n===`mjs`?`javascript`:n===`json`?`json`:n===`html`||n===`htm`||n===`vue`?`html`:n===`css`?`css`:n===`scss`?`scss`:n===`less`?`less`:n===`md`||n===`markdown`?`markdown`:n===`yml`||n===`yaml`?`yaml`:n===`xml`?`xml`:n===`sh`?`shell`:n===`ps1`?`powershell`:n===`go`?`go`:n===`rs`?`rust`:n===`py`?`python`:n===`java`?`java`:n===`cpp`||n===`cc`||n===`cxx`||n===`hpp`||n===`h`?`cpp`:n===`cs`?`csharp`:`plaintext`}function k(){return n.language===`auto`?ne(n.filePath||``):n.language||`plaintext`}function re(){return n.theme&&n.theme!==`auto`?n.theme:document.documentElement.getAttribute(`data-theme`)===`dark`?`vs-dark`:`vs`}function A(){a&&a.editor.setTheme(re())}Ne(()=>A());function ie(){if(!a)return;let e=k();if(!s){s=a.editor.createModel(n.modelValue||``,e);return}try{a.editor.setModelLanguage(s,e)}catch{}}function ae(){if(!s)return;let e=n.modelValue||``;s.getValue()!==e&&(l=!0,s.setValue(e),l=!1)}function oe(){if(!o)return;let e=n.revealLine;if(!(!e||e<=0))try{o.revealLineInCenter(e)}catch{}}function j(){if(!a||!o)return;if(!n.dimHighlightRanges||!n.dimHighlightRanges.length||!n.highlightKind)d=o.deltaDecorations(d,[]);else{let e=n.highlightKind===`current`?`merge-highlight-current-dim`:n.highlightKind===`incoming`?`merge-highlight-incoming-dim`:`merge-highlight-merged-dim`;d=o.deltaDecorations(d,n.dimHighlightRanges.filter(e=>e&&e.startLine>0&&e.endLine>0).map(t=>{let n=Math.max(1,t.startLine),r=Math.max(n,t.endLine);return{range:new a.Range(n,1,r,1),options:{isWholeLine:!0,className:e,linesDecorationsClassName:e}}}))}if(!n.highlightRange||!n.highlightKind){u=o.deltaDecorations(u,[]);return}let e=Math.max(1,n.highlightRange.startLine),t=Math.max(e,n.highlightRange.endLine),r=n.highlightKind===`current`?`merge-highlight-current`:n.highlightKind===`incoming`?`merge-highlight-incoming`:`merge-highlight-merged`;u=o.deltaDecorations(u,[{range:new a.Range(e,1,t,1),options:{isWholeLine:!0,className:r,linesDecorationsClassName:r}}])}function N(){if(!a||!o)return;let e=n.gutterItems||[];if(!e.length){f=o.deltaDecorations(f,[]),v();return}v();let t=n.gutterPlacement===`line`;f=o.deltaDecorations(f,e.filter(e=>e&&e.line&&e.line>0).map(e=>{let n=x(e.blockId,e.kind),r=e.kind===`current`?n?`merge-glyph-current is-applied`:`merge-glyph-current`:n?`merge-glyph-incoming is-applied`:`merge-glyph-incoming`;return{range:new a.Range(e.line,1,e.line,1),options:{isWholeLine:!0,...t?{linesDecorationsClassName:r}:{glyphMarginClassName:r}}}}))}return w(async()=>{i.value&&(a=await te(),A(),ie(),o=a.editor.create(i.value,{automaticLayout:!0,readOnly:n.readOnly,glyphMargin:!1,minimap:{enabled:!1},fontSize:13,wordWrap:`on`,scrollBeyondLastLine:!1,renderWhitespace:`selection`,scrollbar:{verticalScrollbarSize:10,horizontalScrollbarSize:10}}),o.setModel(s),o.onDidChangeModelContent(()=>{if(l)return;let e=s?.getValue?.()??``;r(`update:modelValue`,e)}),oe(),j(),N(),D(),g=o.onDidScrollChange(e=>{ee(),n.syncGroup&&e.scrollTopChanged&&r(`scroll-change`,e.scrollTop)}),_=o.onDidLayoutChange(()=>{ee()}),p=o.onMouseDown(e=>{try{let t=e?.target,i=t?.position;if(!i?.lineNumber)return;let o=t?.type;if(o!==a.editor.MouseTargetType.GUTTER_GLYPH_MARGIN&&o!==a.editor.MouseTargetType.GUTTER_LINE_DECORATIONS)return;let s=i.lineNumber,c=(n.gutterItems||[]).find(e=>e.line===s);if(!c)return;r(`gutter-click`,c.blockId)}catch{}}))}),F(()=>n.modelValue,()=>{ae()}),F(()=>n.revealLine,()=>{oe()}),F(()=>[n.highlightRange,n.highlightKind],()=>{j()},{deep:!0}),F(()=>n.dimHighlightRanges,()=>{j()},{deep:!0}),F(()=>n.gutterItems,()=>{N()},{deep:!0}),F(()=>n.rightActions,()=>{D()},{deep:!0}),F(()=>n.appliedBlocks,()=>{D(),N()},{deep:!0}),F(()=>n.syncScrollTop,e=>{if(e!=null&&o){let t=o.getScrollTop();Math.abs(t-e)>5&&o.setScrollTop(e)}}),F(()=>n.gutterPlacement,()=>{N()}),F(()=>[n.language,n.filePath],()=>{a&&ie()}),F(()=>n.theme,()=>{A()}),F(()=>n.readOnly,e=>{o&&o.updateOptions({readOnly:e})}),ue(()=>{try{p?.dispose?.()}catch{}p=null;try{g?.dispose?.()}catch{}g=null;try{_?.dispose?.()}catch{}_=null;try{m?.remove?.()}catch{}m=null,h.clear(),o?.dispose(),o=null,d=[],s?.dispose(),s=null}),(t,n)=>(E(),M(`div`,{ref_key:`containerRef`,ref:i,class:`monaco-editor-container`,style:T(e.minHeight?{minHeight:e.minHeight}:{flex:1,minHeight:`200px`})},null,4))}}),[[`__scopeId`,`data-v-1432c6d1`]]);n(),L(),_(),A();var et={class:`summary-head`},Q={class:`summary-heading`},$={class:`summary-label`},tt=[`title`],nt={class:`summary-actions`},rt={class:`summary-body`},it={key:1,class:`summary-placeholder is-loading`},at={key:2,class:`summary-placeholder`},ot={key:3,class:`summary-placeholder`},st={key:4,class:`summary-error`},ct={class:`err-msg`},lt={key:0,class:`dialog-context`},ut={class:`dialog-body`},dt={key:1,class:`summary-placeholder is-loading`},ft={key:2,class:`summary-placeholder`},pt=U(u({__name:`AiDiffSummary`,props:{source:{},scope:{},commitHash:{default:``},file:{default:``},fileName:{default:``},fileRevision:{default:``},revision:{default:``},auto:{type:Boolean,default:!0}},setup(e){let n=e,r=ve(),s=b(()=>Array.isArray(r.models)&&r.models.length>0),c=b(()=>(r.locale||``).startsWith(`en`)?`en`:`zh`),u=b(()=>{let e=Array.isArray(r.models)?r.models:[],t=e.find(e=>e.isDefault)||e[0];return t?`${t.id}|${t.baseURL}|${t.model}`:``}),f=O({status:`idle`,text:``,error:``}),_=O(!1),ee=O(!1),x=new Map,S=null,w=null;function T(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return`${e.length}:${(t>>>0).toString(36)}`}function D(){let e=`${n.source}|${n.commitHash||``}|${n.scope}|${c.value}|${u.value}`;if(n.scope===`overall`)return`${e}|${n.source===`worktree`?T(n.revision):``}`;let t=n.source===`worktree`?T(n.fileRevision):``;return`${e}|${n.file||``}|${t}`}function ne(){let e=x.get(D());f.value=e?{status:`done`,text:e,error:``}:{status:`idle`,text:``,error:``}}function re(){S?.abort(),S=null}async function A(e=!1){if(!s.value||n.scope===`file`&&!n.file||n.source===`commit`&&!n.commitHash)return;let t=D();if(!e&&x.has(t)){f.value={status:`done`,text:x.get(t)||``,error:``};return}re();let r=new AbortController;S=r,f.value={status:`loading`,text:``,error:``};let i=``,a=e=>{let t=e.trim();if(!t.startsWith(`data:`))return;let n=t.slice(5).trim();if(!n)return;let r;try{r=JSON.parse(n)}catch{return}if(r.type===`delta`)i+=r.content||``,f.value={status:`loading`,text:i,error:``};else if(r.type===`done`)f.value={status:`done`,text:i,error:``};else if(r.type===`error`){let e=r.code===`NO_MODEL`?`no-model`:r.code===`EMPTY_DIFF`?`empty`:`error`;f.value={status:e,text:``,error:r.error||H(`@DIFFAI:生成失败`)}}};try{let o={scope:n.scope,source:n.source,locale:c.value};n.scope===`file`&&(o.file=n.file),n.source===`commit`&&(o.hash=n.commitHash),e&&(o.bypassCache=!0);let s=await fetch(`/api/ai/diff-summary`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify(o),signal:r.signal});if(!s.ok||!s.body)throw Error(`HTTP ${s.status}`);let l=s.body.getReader(),u=new TextDecoder,d=``;for(;;){let{done:e,value:t}=await l.read();if(e)break;d+=u.decode(t,{stream:!0});let n=d.split(`
|
|
4
4
|
`);d=n.pop()||``,n.forEach(a)}d+=u.decode(),d&&a(d),f.value.status===`loading`&&(f.value={status:i?`done`:`empty`,text:i,error:``}),f.value.status===`done`&&i&&x.set(t,i)}catch(e){e?.name!==`AbortError`&&S===r&&(f.value={status:`error`,text:``,error:e?.message||H(`@DIFFAI:生成失败`)})}finally{S===r&&(S=null)}}function ie(){x.delete(D()),A(!0)}function ae(){n.auto&&s.value&&(n.scope!==`file`||n.file)&&A()}function oe(){w&&clearTimeout(w),w=setTimeout(ae,350)}F(()=>[n.file,n.fileRevision,n.revision,n.commitHash,n.source,n.scope,s.value,c.value,u.value,n.auto],()=>{re(),ne(),s.value&&oe()},{immediate:!0}),ue(()=>{re(),w&&clearTimeout(w)});let j=b(()=>n.scope===`file`?H(`@DIFFAI:AI 文件说明`):H(`@DIFFAI:AI 整体说明`)),P=b(()=>n.scope===`file`?n.fileName||n.file:n.source===`commit`?H(`@DIFFAI:本次提交`):H(`@DIFFAI:未提交变更`));return(n,r)=>{let c=d,u=V;return s.value?(E(),M(`section`,{key:0,class:de([`ai-diff-summary`,`is-${e.scope}`])},[a(`header`,et,[a(`div`,Q,[g(c,{class:`ai-badge`},{default:k(()=>[g(o(p))]),_:1}),a(`span`,$,y(j.value),1)]),a(`span`,{class:`summary-context`,title:P.value},y(P.value),9,tt),a(`div`,nt,[f.value.status===`loading`?(E(),i(c,{key:0,class:`spin`},{default:k(()=>[g(o(t))]),_:1})):h(``,!0),g(u,{text:``,size:`small`,icon:o(z),disabled:!f.value.text,title:o(H)(`@DIFFAI:弹窗查看`),onClick:r[0]||=e=>ee.value=!0},null,8,[`icon`,`disabled`,`title`]),g(u,{text:``,size:`small`,icon:o(l),disabled:f.value.status===`loading`,title:o(H)(`@DIFFAI:重新生成`),onClick:ie},null,8,[`icon`,`disabled`,`title`]),g(u,{text:``,size:`small`,icon:_.value?o(C):o(v),title:_.value?o(H)(`@DIFFAI:展开说明`):o(H)(`@DIFFAI:收起说明`),onClick:r[1]||=e=>_.value=!_.value},null,8,[`icon`,`title`])])]),N(a(`div`,rt,[f.value.text?(E(),i(Ce,{key:0,content:f.value.text,"allow-html":!1},null,8,[`content`])):f.value.status===`loading`?(E(),M(`div`,it,y(o(H)(`@DIFFAI:正在生成差异说明...`)),1)):f.value.status===`empty`?(E(),M(`div`,at,y(e.scope===`file`?o(H)(`@DIFFAI:该文件没有可总结的变更`):o(H)(`@DIFFAI:没有可总结的变更`)),1)):f.value.status===`no-model`?(E(),M(`div`,ot,y(f.value.error),1)):f.value.status===`error`?(E(),M(`div`,st,[g(c,null,{default:k(()=>[g(o(te))]),_:1}),a(`span`,ct,y(f.value.error),1),g(u,{text:``,size:`small`,icon:o(l),onClick:ie},{default:k(()=>[m(y(o(H)(`@DIFFAI:重试`)),1)]),_:1},8,[`icon`])])):h(``,!0)],512),[[me,!_.value]]),g(q,{modelValue:ee.value,"onUpdate:modelValue":r[2]||=e=>ee.value=e,title:j.value,width:`680px`,type:`flex`,"close-on-click-modal":!0,"destroy-on-close":``,"custom-class":`ai-summary-dialog`},{default:k(()=>[P.value?(E(),M(`div`,lt,y(P.value),1)):h(``,!0),a(`div`,ut,[f.value.text?(E(),i(Ce,{key:0,content:f.value.text,"allow-html":!1},null,8,[`content`])):f.value.status===`loading`?(E(),M(`div`,dt,y(o(H)(`@DIFFAI:正在生成差异说明...`)),1)):(E(),M(`div`,ft,y(o(H)(`@DIFFAI:暂无说明内容`)),1))])]),_:1},8,[`modelValue`,`title`])],2)):h(``,!0)}}}),[[`__scopeId`,`data-v-36297805`]]);n(),_(),L();var mt={key:0,class:`diff-preview-panel`},ht={class:`diff-preview-header`},gt={class:`diff-preview-title`},_t={class:`diff-preview-ext-badge`},vt=[`title`],yt={class:`diff-preview-body`},bt={key:0,class:`diff-preview-loading`},xt={key:1,class:`diff-preview-error`},St=[`sandbox`,`srcdoc`],Ct={key:1,class:`diff-preview-panel diff-preview-unsupported`},wt={class:`diff-preview-body`},Tt={class:`diff-preview-empty`},Et=U(u({__name:`DiffPreviewPanel`,props:{filePath:{},content:{},loading:{type:Boolean,default:!1},error:{default:``},context:{default:`git-status`},commitHash:{default:``},officePreviewUrl:{default:``}},emits:[`refresh`],setup(e,{emit:t}){let n=e,r=t,s=b(()=>(n.filePath||``).split(`.`).pop()?.toLowerCase()??``),c=b(()=>s.value===`md`||s.value===`markdown`),u=b(()=>s.value===`html`||s.value===`htm`||s.value===`svg`),f=b(()=>[`doc`,`docx`,`xls`,`xlsx`,`ppt`,`pptx`,`odt`,`ods`,`odp`].includes(s.value)),p=b(()=>c.value||u.value||f.value&&!!n.officePreviewUrl),m=O(!0);function _(){typeof document<`u`&&(m.value=document.documentElement.getAttribute(`data-theme`)!==`light`)}let v=b(()=>{if(!u.value)return``;let e=m.value?`#0d1117`:`#ffffff`,t=m.value?`#e6edf3`:`var(--md-text-strong)`;return s.value===`svg`?`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:${e};color:${t};display:flex;align-items:center;justify-content:center;min-height:100vh;}svg{max-width:100%;max-height:90vh;}</style></head><body>${n.content||``}</body></html>`:we(n.content||``)});return F(()=>n.filePath,()=>{_()},{immediate:!0}),_(),(t,m)=>p.value?(E(),M(`div`,mt,[a(`div`,ht,[a(`span`,gt,y(t.$t(`@E80AC:文件预览`)),1),a(`span`,_t,y(s.value.toUpperCase()),1),m[1]||=a(`div`,{class:`diff-preview-spacer`},null,-1),g(o(x),{content:t.$t(`@E80AC:刷新预览`),placement:`top`},{default:k(()=>[a(`button`,{class:`diff-preview-btn`,title:t.$t(`@E80AC:刷新预览`),onClick:m[0]||=e=>r(`refresh`)},[g(o(d),null,{default:k(()=>[g(o(l))]),_:1})],8,vt)]),_:1},8,[`content`])]),a(`div`,yt,[e.loading?(E(),M(`div`,bt,[a(`span`,null,y(t.$t(`@E80AC:正在加载预览...`)),1)])):e.error?(E(),M(`div`,xt,[a(`span`,null,y(e.error),1)])):u.value?(E(),M(`iframe`,{key:2,class:`diff-preview-iframe`,sandbox:o(Oe),srcdoc:v.value},null,8,St)):f.value&&e.officePreviewUrl?(E(),i(Ee,{key:3,"file-path":e.filePath,source:e.context===`commit-detail`?`git`:`worktree`,rev:e.commitHash},null,8,[`file-path`,`source`,`rev`])):c.value?(E(),i(Ce,{key:4,content:n.content||``,class:`diff-preview-markdown`},null,8,[`content`])):h(``,!0)])])):(E(),M(`div`,Ct,[a(`div`,wt,[a(`span`,Tt,y(t.$t(`@E80AC:当前文件类型不支持预览`)),1)])]))}}),[[`__scopeId`,`data-v-1c750348`]]);n(),L(),_();var Dt={class:`diff-viewer-main`},Ot={class:`files-panel`},kt={class:`panel-header`},At={class:`header-left`},jt={key:0,class:`file-count`},Mt={class:`view-mode-toggle`},Nt={class:`search-box`},Pt={class:`files-list`},Ft=[`onClick`],It={class:`file-icon mit-icon`,"aria-hidden":`true`},Lt=[`xlink:href`],Rt={key:0,class:`conflict-marker`,title:`冲突文件`},zt={class:`file-name`},Bt=[`title`],Vt={class:`file-directory path-badge`},Ht={key:2,class:`file-actions`},Ut={key:0,class:`ai-summary-float`},Wt={class:`diff-panel`},Gt={class:`panel-header`},Kt={class:`header-right`},qt={class:`selected-file`},Jt={class:`path-dir`},Yt={class:`path-name`},Xt={key:1,class:`diff-stats-badge`},Zt={class:`stats-added`},Qt={class:`stats-deleted`},$t={key:2,class:`action-buttons`},en=[`aria-pressed`],tn={key:0,class:`conflict-resolution-container`},nn={key:0,class:`resolution-mode-switch`},rn={key:1,class:`block-conflict-resolution`},an={class:`merge-three-pane`},on={class:`pane`},sn={class:`pane-header`},cn={class:`pane-title`},ln={class:`pane-body`},un={class:`pane pane-merged`},dn={class:`pane-header`},fn={class:`pane-title`},pn={class:`pane-subhint`},mn={class:`pane-body`},hn={class:`pane`},gn={class:`pane-header`},_n={class:`pane-title`},vn={class:`pane-body`},yn={class:`save-resolution-bar`},bn={key:2,class:`global-conflict-wrapper`},xn={class:`global-conflict-resolution`},Sn={class:`conflict-warning`},Cn={class:`conflict-buttons`},wn={class:`diff-content`},Tn=[`textContent`],En=[`innerHTML`],Dn={key:1,class:`conflict-resolved-container`},On={class:`resolved-notice`},kn={class:`notice-text`},An={class:`diff-content`},jn=[`textContent`],Mn=[`innerHTML`],Nn={key:2,class:`diff-and-preview-wrapper`},Pn={key:2,class:`compare-view`},Fn=[`textContent`],In=[`innerHTML`],Ln={key:1,class:`diff-panel full-width`},Rn={class:`panel-header`},zn={class:`header-right`},Bn={class:`selected-file`},Vn={class:`path-dir`},Hn={class:`path-name`},Un={key:1,class:`action-buttons`},Wn={key:0,class:`conflict-resolution-container`},Gn={key:0,class:`resolution-mode-switch`},Kn={key:1,class:`block-conflict-resolution`},qn={class:`merge-three-pane`},Jn={class:`pane`},Yn={class:`pane-header`},Xn={class:`pane-title`},Zn={class:`pane-body`},Qn={class:`pane pane-merged`},$n={class:`pane-header`},er={class:`pane-title`},tr={class:`pane-subhint`},nr={class:`pane-body`},rr={class:`pane`},ir={class:`pane-header`},ar={class:`pane-title`},or={class:`pane-body`},sr={class:`save-resolution-bar`},cr={key:2,class:`global-conflict-wrapper`},lr={class:`global-conflict-resolution`},ur={class:`conflict-warning`},dr={class:`conflict-buttons`},fr={class:`diff-content`},pr=[`textContent`],mr=[`innerHTML`],hr={key:1,class:`diff-and-preview-wrapper`},gr={key:2,class:`compare-view`},_r=[`textContent`],vr=[`innerHTML`],yr=`merge-three-pane`,br=u({__name:`FileDiffViewer`,props:{files:{},emptyText:{default:H(`@E80AC:没有找到变更文件`)},diffContent:{default:``},diffStats:{default:null},selectedFile:{default:``},isLoading:{type:Boolean,default:!1},plainText:{type:Boolean,default:!1},compareMode:{type:Boolean,default:!1},compareOriginal:{default:``},compareModified:{default:``},height:{default:`100%`},showFileList:{type:Boolean,default:!0},context:{default:`git-status`},showOpenButton:{type:Boolean,default:!0},showActionButtons:{type:Boolean,default:!1},showVscodeButton:{type:Boolean,default:!0},showEditorButton:{type:Boolean,default:!0},isFileLocked:{type:Function,default:()=>!1},isLocking:{type:Function,default:()=>!1},commitHash:{default:``}},emits:[`file-select`,`open-file`,`open-with-vscode`,`open-in-editor`,`toggle-lock`,`stage`,`unstage`,`revert`],setup(t,{emit:n}){let l=new Set([`md`,`markdown`,`html`,`htm`,`svg`,`doc`,`docx`,`xls`,`xlsx`,`ppt`,`pptx`,`odt`,`ods`,`odp`]),u=t,f=n,p=ve(),_=ye(),v=O(``),S=O(``),C=e=>Math.min(85,Math.max(15,e)),A=b({get:()=>p.ui.fileListViewMode,set:e=>{p.ui.fileListViewMode=e}}),j=b({get:()=>C(p.ui.fileDiffSplitPercent),set:e=>{p.ui.fileDiffSplitPercent=C(e)}}),P=O(!1),I=O(``),L=O(!1),R=O(``),pe=O(``),me=0,z=b({get:()=>C(p.ui.diffPreviewSplitPercent??55),set:e=>{p.ui.diffPreviewSplitPercent=C(e)}}),U=b(()=>{let e=G.value||``;return(e.split(`/`).pop()||e).split(`.`).pop()?.toLowerCase()??``}),W=b(()=>l.has(U.value)),G=b(()=>u.selectedFile||v.value),Ce=b(()=>u.context===`commit-detail`?`commit`:u.context===`git-status`?`worktree`:``),we=b(()=>!!(Ce.value&&p.aiDiffSummaryEnabled)),Ee=b(()=>u.files.map(e=>`${e.path}\0${e.type||``}`).sort().join(`\0`)),Oe=b(()=>Se(G.value||``)),K=b(()=>G.value?u.files.find(e=>e.path===G.value)?.type===`conflicted`:!1),ke=b(()=>J.value.length>0),Ae=b(()=>u.files.map(e=>{let t=e.name||e.path.split(`/`).pop()||e.path;return{...e,displayName:t,dirPath:(()=>{let t=(e.path||``).split(`/`);return t.length>1?t.slice(0,-1).join(`/`):``})(),iconClass:be(t)}})),je=b(()=>{if(!S.value.trim())return Ae.value;let e=S.value.toLowerCase().trim();return Ae.value.filter(t=>t.displayName.toLowerCase().includes(e)||t.path.toLowerCase().includes(e))}),Me=O([]);function Ne(){let e=We(je.value);Me.value.length>0&&Ke(e,Me.value),Me.value=e}F(je,()=>{A.value===`tree`&&Ne()},{deep:!0}),F(A,e=>{e===`tree`&&Ne(),window.dispatchEvent(new CustomEvent(`file-list-view-mode-change`,{detail:{mode:e}}))});let q=b(()=>u.compareMode?!0:u.diffContent&&u.diffContent.trim()!==``),Pe=b(()=>{if(!G.value)return``;let e=G.value.split(`/`);return e.slice(0,-1).join(`/`)+(e.length>1?`/`:``)}),Ie=b(()=>{if(!G.value)return``;let e=G.value.split(`/`);return e[e.length-1]||G.value});function Re(e){v.value=e,f(`file-select`,e)}function Be(){if(!G.value){D.warning(H(`@E80AC:请先选择一个文件`));return}f(`open-file`,G.value,u.context)}function Ve(){if(!G.value){D.warning(H(`@E80AC:请先选择一个文件`));return}navigator.clipboard.writeText(G.value).then(()=>{D.success(H(`@E80AC:文件路径已复制到剪贴板`))}).catch(()=>{D.error(H(`@E80AC:复制失败`))})}function He(){_.copyCurrentDiff()}function Ge(){if(!G.value){D.warning(H(`@E80AC:请先选择一个文件`));return}f(`open-with-vscode`,G.value,u.context)}function qe(){if(console.log(`[debug-open-in-editor] FileDiffViewer handleOpenInEditor start`),!G.value){D.warning(H(`@E80AC:请先选择一个文件`));return}console.log(`[debug-open-in-editor] FileDiffViewer emit, filePath=`,G.value,`context=`,u.context),f(`open-in-editor`,G.value,u.context)}let J=O([]),Y=O(!0),X=O(``),Je=O(!1),Ye=O(``),Z=O(``),Xe=O(``),et=O(``),Q=O(new Map),$=O(null),tt=O(null),nt=O(new Map),rt=O(new Map),it=O(new Map);async function at(e){let t=await(await fetch(`/api/file-content?file=${encodeURIComponent(e)}`)).json();if(!t.success)throw Error(t.error||H(`@E80AC:无法读取文件内容`));return String(t.content??``)}async function ot(){let e=G.value;if(!e||!W.value)return;let t=++me;L.value=!0,R.value=``,pe.value=``;try{if(De(e)){pe.value=Te(e,{source:u.context===`commit-detail`?`git`:`worktree`,rev:u.context===`commit-detail`?u.commitHash:void 0}),L.value=!1;return}let n=null;if(n=u.context===`commit-detail`&&u.commitHash?await(await fetch(`/api/git-file-content?rev=${encodeURIComponent(u.commitHash)}&file=${encodeURIComponent(e)}`)).json():await(await fetch(`/api/file-content?file=${encodeURIComponent(e)}`)).json(),t!==me)return;if(!n||!n.success){R.value=n?.error||H(`@E80AC:无法读取文件内容`),I.value=``;return}I.value=String(n.content??``)}catch(e){if(t!==me)return;R.value=e.message||H(`@E80AC:无法读取文件内容`),I.value=``}finally{t===me&&(L.value=!1)}}function st(){W.value&&(P.value=!P.value,P.value&&!I.value&&!L.value&&ot())}F([G,()=>u.context,()=>u.commitHash],()=>{if(I.value=``,pe.value=``,R.value=``,!W.value&&P.value){P.value=!1;return}P.value&&ot()});let ct=!1,lt=0,ut=0;function dt(e){ct=!0,lt=e.clientY,ut=z.value,document.addEventListener(`mousemove`,ft),document.addEventListener(`mouseup`,mt),e.preventDefault()}function ft(e){if(!ct)return;let t=e.target?.closest(`.diff-panel`);if(!t)return;let n=t.getBoundingClientRect().height-34;if(n<=0)return;let r=e.clientY-lt,i=ut+r/n*100;z.value=C(i)}function mt(){ct=!1,document.removeEventListener(`mousemove`,ft),document.removeEventListener(`mouseup`,mt)}ue(()=>{ct&&mt()});function ht(e,t){let n=e.split(`
|
|
5
5
|
`),r=[],i=new Map,a=0,o=0;for(;a<n.length;){let e=n[a];if(e.includes(`<<<<<<<`)){o++;let e=[],s=[];for(a++;a<n.length&&!n[a].includes(`=======`);)e.push(n[a]),a++;for(a++;a<n.length&&!n[a].includes(`>>>>>>>`);)s.push(n[a]),a++;a<n.length&&n[a].includes(`>>>>>>>`)&&a++;let c=t(o),l=[];l=c===`incoming`?s:c===`both`?[...e,...s]:c===`none`?[]:e;let u=r.length+1;r.push(...l);let d=Math.max(u,r.length);i.set(o,{startLine:u,endLine:d});continue}r.push(e),a++}return{text:r.join(`
|
package/src/ui/public/assets/{FlowExecutionViewer-STZphigj.js → FlowExecutionViewer-DDkb05TW.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Bn as e,Er as t,In as n,Pn as r,Rn as i,Tn as a,Wn as o,Xn as s,Zn as c,cr as l,gr as u,kn as d,or as f,pr as p}from"./element-plus-CgEuJBlB.js";import{n as m,t as h}from"./_plugin-vue_export-helper-
|
|
1
|
+
import{Bn as e,Er as t,In as n,Pn as r,Rn as i,Tn as a,Wn as o,Xn as s,Zn as c,cr as l,gr as u,kn as d,or as f,pr as p}from"./element-plus-CgEuJBlB.js";import{n as m,t as h}from"./_plugin-vue_export-helper-D8rwCQpe.js";import{i as g,l as _,n as v,s as y}from"./vue-flow-tRJAB9jP.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-DIX4shBD.js";e(),p();var O={class:`flow-exec-viewer`},k=`flow-execution-viewer`,A=h(n({__name:`FlowExecutionViewer`,props:{flowData:{type:Object,required:!0},currentNodeId:{type:String,default:void 0},executedNodeIds:{type:Array,default:()=>[]},failedNodeIds:{type:Array,default:()=>[]},executedEdgeIds:{type:Array,default:()=>[]}},setup(e){function p(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=n({name:`FlowExecStartNodeRenderer`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(e){return()=>i(x,{id:e.id,nodeId:e.id,nodeType:`start`,title:m(`@FLOWNODE:开始`),icon:p(`start`),enabled:e.data?.enabled,selected:e.data?.selected,execStatus:e.data?.execStatus,deletable:!1},{})}});function A(e){return n({name:`FlowExecWrappedNode`,props:{id:{type:String,required:!0},data:{type:Object,required:!0}},setup(t){let n=a(()=>{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()=>i(x,{id:t.id,nodeId:t.id,nodeType:t.data?.type,title:t.data?.label,icon:p(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:()=>i(e,{data:t.data,id:t.id})})}})}let j={start:u(h),command:u(A(E)),wait:u(A(w)),version:u(A(b)),confirm:u(A(S)),code:u(A(T)),condition:u(A(C)),user_input:u(A(D))},M=e,{onPaneReady:N}=_({id:k}),P=null,F=null;async function I(e){if(e){if(!P){F=e;return}for(let t=0;t<6;t+=1){if(await o(),await new Promise(e=>requestAnimationFrame(()=>e())),!(typeof P?.findNode==`function`&&P.findNode(e))){await new Promise(e=>window.setTimeout(()=>e(),60));continue}try{await P.fitView({nodes:[e],padding:.35,includeHiddenNodes:!0,minZoom:.35,maxZoom:1.2,duration:200})}catch{}break}}}N(e=>{P=e,console.log(`[FlowExecutionViewer] onPaneReady, flowId=`,k),console.log(`[FlowExecutionViewer] instance keys=`,Object.keys(e||{}));try{P.fitView({padding:.2,includeHiddenNodes:!0,duration:0})}catch{}let t=(M.currentNodeId||F||``).trim();t&&(F=null,I(t))});let L=null;f(()=>M.currentNodeId,async e=>{e&&(L&&=(window.clearTimeout(L),null),L=window.setTimeout(async()=>{if(console.log(`[FlowExecutionViewer] focus request, flowId=`,k,`nodeId=`,e),!P){F=e,console.log(`[FlowExecutionViewer] flowInstance not ready, pendingFocusNodeId=`,F);return}I(e)},150))}),s(()=>{L&&=(window.clearTimeout(L),null)});let R=a(()=>{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=a(()=>{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(e,n)=>(c(),d(`div`,O,[r(t(y),{id:k,nodes:R.value,edges:z.value,"node-types":j,"nodes-draggable":!1,"nodes-connectable":!1,"elements-selectable":!1,"zoom-on-scroll":!0,"zoom-on-double-click":!1,"pan-on-drag":!0,"min-zoom":.2,"max-zoom":1.5},{default:l(()=>[r(t(g)),r(t(v))]),_:1},8,[`nodes`,`edges`])]))}}),[[`__scopeId`,`data-v-d2ccb36e`]]);export{A as default};
|