zen-gitsync 2.16.38 → 2.16.39

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.
@@ -1,4 +1,4 @@
1
- import"./rolldown-runtime-BM3Ffeng.js";import{Br as e,Dn as t,En as n,G as r,Gn as i,In as a,L as o,N as s,Qn as c,Rr as l,Rt as u,S as d,Sn as f,U as p,Un as m,Ur as h,Vn as g,_r as _,a as ee,bn as v,bt as te,dn as ne,dr as y,er as b,fn as re,ft as ie,ht as ae,i as x,kn as oe,m as S,mn as C,nn as se,p as ce,pn as w,q as le,r as ue,st as de,tr as fe,vn as T,x as pe,xn as E,yn as D,zn as me}from"./element-plus-Cchqf1s7.js";import{n as O,t as he}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{t as ge}from"./toolsStore-C0VjU2dD.js";import{n as _e,t as ve}from"./CommonDialog-ByvhJIxb.js";import{S as ye,f as be,w as xe}from"./index-D-n9_1ON.js";var k=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function A(e){return 10+e*14}function j(e){return k[e%k.length]}function M(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim();if(!e||e===`HEAD`||e.startsWith(`tag:`))continue;let r=e.match(/^HEAD\s*->\s*(.+)$/);t.push((r?r[1]:e).trim())}return t}function Se(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.hash)??new Set;for(let t of M(r.branch))e.add(t);n.set(r.hash,Array.from(e));for(let n of r.parents??[]){let r=t.get(n)??new Set;for(let t of e)r.add(t);t.set(n,r)}}return n}function Ce(e){let t=[],n=[],r=0,i=0,a=new Set(e.map(e=>e.hash)),o=e=>t.findIndex(t=>t!==null&&t.hash===e),s=()=>{let e=t.findIndex(e=>e===null);return e===-1?(t.push(null),t.length-1):e};for(let c of e){let e=Array.isArray(c.parents)?c.parents:[],l=t.slice(),u=o(c.hash),d,f=!1;u===-1?(f=!0,u=s(),d=r++):d=t[u].colorIdx,t[u]=null;let p=[],m=new Set;for(let e=0;e<t.length;e++){let n=t[e];n!==null&&n.hash===c.hash&&(p.push({fromLane:e,color:j(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,m.add(e))}let h=[],g=j(d);if(e.length>0){let n=e[0],i=o(n);i===-1?a.has(n)&&(t[u]={hash:n,colorIdx:d},h.push({toLane:u,color:g,kind:`straight`,branches:[],_hash:n})):(h.push({toLane:i,color:g,kind:i===u?`straight`:`curve`,branches:[],_hash:n}),i===u&&(t[u]={hash:n,colorIdx:d}));for(let n of e.slice(1)){let e=o(n);if(e!==-1)h.push({toLane:e,color:g,kind:e===u?`straight`:`curve`,branches:[],_hash:n});else if(a.has(n)){let e=s(),i=r++;t[e]={hash:n,colorIdx:i},h.push({toLane:e,color:j(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let _=t.slice();i=Math.max(i,t.length);let ee=[];for(let e=0;e<l.length;e++){let t=l[e];t!==null&&(e===u||m.has(e)||e<_.length&&_[e]!==null&&_[e].hash===t.hash&&ee.push({lane:e,color:j(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:g,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:ee,topCurves:p,bottomEdges:h,branches:[]})}let c=Se(e),l=e=>c.get(e)??[];for(let e of n){e.branches=l(e.hash);for(let t of e.passes)t.branches=l(t._hash),delete t._hash;for(let t of e.topCurves)t.branches=l(t._hash),delete t._hash;for(let t of e.bottomEdges)t.branches=l(t._hash),delete t._hash}let u=i>0?20+(i-1)*14:0;return{rows:n,maxLanes:i,width:u}}var we={class:`graph-wrap`},N=[`viewBox`],P=[`x1`,`x2`,`stroke`],F=[`x1`,`x2`],Te=[`d`,`stroke`],Ee=[`d`],De=[`x1`,`x2`,`stroke`],Oe=[`d`,`stroke`],I=[`d`],ke={class:`graph-layer graph-nodes`,"aria-hidden":`true`},L=[`cx`,`stroke`],R=[`cx`,`fill`],z=[`cx`,`stroke`],B=[`cx`],V=-1,Ae=he(oe({__name:`CommitGraphCell`,props:{layout:{},width:{}},setup(e){let t=e,n=T(()=>A(t.layout.commitLane)),r=O(`@A1833:暂不属于任何分支`);function a(e){return e.length>0?e.join(`, `):r}let o=T(()=>`${t.layout.hash.slice(0,7)} · ${a(t.layout.branches)}`),s=T(()=>t.layout.passes.map(e=>({x:A(e.lane),color:e.color,title:a(e.branches)}))),c=T(()=>t.layout.topCurves.map(e=>{let t=A(e.fromLane),r=n.value;return{d:`M ${t} ${V} C ${t} ${15/2}, ${r} ${15/2}, ${r} 15`,color:e.color,title:a(e.branches)}})),l=T(()=>t.layout.bottomEdges.map(e=>{let t=n.value,r=A(e.toLane);return{d:e.kind===`straight`||t===r?`M ${t} 15 L ${r} 31`:`M ${t} 15 C ${t} 23, ${r} ${31-16/2}, ${r} 31`,color:e.color,title:a(e.branches)}}));return(e,t)=>(m(),f(`div`,we,[(m(),f(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${e.width} ${_(30)}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[(m(!0),f(C,null,i(s.value,(e,t)=>(m(),f(`line`,{key:`p`+t,x1:e.x,y1:V,x2:e.x,y2:31,stroke:e.color,"stroke-width":`2`},[D(`title`,null,h(e.title),1)],8,P))),128)),(m(!0),f(C,null,i(s.value,(e,t)=>(m(),f(`line`,{key:`ph`+t,x1:e.x,y1:V,x2:e.x,y2:31,stroke:`transparent`,"stroke-width":`8`},[D(`title`,null,h(e.title),1)],8,F))),128)),(m(!0),f(C,null,i(c.value,(e,t)=>(m(),f(`path`,{key:`t`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[D(`title`,null,h(e.title),1)],8,Te))),128)),(m(!0),f(C,null,i(c.value,(e,t)=>(m(),f(`path`,{key:`th`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[D(`title`,null,h(e.title),1)],8,Ee))),128)),e.layout.hasTopLine?(m(),f(`line`,{key:0,x1:n.value,y1:V,x2:n.value,y2:15,stroke:e.layout.color,"stroke-width":`2`},[D(`title`,null,h(a(e.layout.branches)),1)],8,De)):E(``,!0),(m(!0),f(C,null,i(l.value,(e,t)=>(m(),f(`path`,{key:`b`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[D(`title`,null,h(e.title),1)],8,Oe))),128)),(m(!0),f(C,null,i(l.value,(e,t)=>(m(),f(`path`,{key:`bh`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[D(`title`,null,h(e.title),1)],8,I))),128))],8,N)),(m(),f(`svg`,ke,[D(`g`,null,[D(`title`,null,h(o.value),1),e.layout.isMerge?(m(),f(`circle`,{key:0,cx:n.value,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:e.layout.color,"stroke-width":`2`},null,8,L)):(m(),f(`circle`,{key:1,cx:n.value,cy:`50%`,r:`4`,fill:e.layout.color},null,8,R)),e.layout.isHead?(m(),f(`circle`,{key:2,cx:n.value,cy:`50%`,r:`7`,fill:`none`,stroke:e.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,z)):E(``,!0),D(`circle`,{cx:n.value,cy:`50%`,r:`9`,fill:`transparent`},null,8,B)])]))]))}}),[[`__scopeId`,`data-v-1288d6a2`]]),je={class:`log-header`},Me={class:`header-left`},Ne={class:`log-actions`},Pe={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},Fe={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},Ie={key:0,class:`filter-panel-header`},Le={class:`filter-form`},Re={class:`filter-item`},ze={class:`compact-label`},Be={class:`filter-item`},Ve={class:`compact-label`},He={class:`filter-item`},Ue={class:`compact-label`},We={class:`filter-item`},Ge={class:`compact-label`},Ke={class:`filter-actions`},qe={key:0,role:`alert`,class:`log-error`},Je={key:1,class:`log-empty-state`},Ye={class:`log-empty-text`},Xe={key:2,class:`content-area-content`},Ze={class:`table-view-container`},Qe={class:`commit-message-cell`},$e={class:`message-content`},et={key:0,class:`branch-container`},tt={class:`message-text`},nt={class:`author-name`},rt=[`title`,`aria-label`,`onClick`],it={class:`commit-detail-container`},at={key:0,class:`commit-info`},ot={class:`commit-info-row`},st={class:`info-item date-item`},ct={class:`info-label`},lt={class:`info-value`},ut={class:`info-item branch-item`},dt={class:`info-label`},ft={key:0,class:`branch-container`},pt={key:1,class:`info-value info-value-muted`},mt={class:`info-item message-item`},ht={class:`info-label`},gt={class:`info-message-wrapper`},_t={class:`info-message-title`},vt=[`innerHTML`],yt=[`aria-label`,`onKeydown`],bt=`zen-gitsync:log-show-graph`,H=he(oe({__name:`LogList`,setup(oe,{expose:he}){let k=xe(),A=ge(),j=y([]),M=y(``),we=y(!1),N=T(()=>k.isLoadingLog||we.value),P=y(!1),F=y(localStorage.getItem(bt)!==`false`);c(F,e=>{localStorage.setItem(bt,String(e))});let Te=T(()=>F.value&&j.value.length>0?Ce(j.value):null),Ee=T(()=>{let e=new Map;if(Te.value)for(let t of Te.value.rows)e.set(t.hash,t);return e}),De=T(()=>Math.max(Te.value?.width??0,28)),Oe=T(()=>Se(j.value)),I=y(!1),ke=y(null),L=y(!1),R=y(null),z=y([]),B=y(``),V=y(!1),H=y(``),U=y(`full-new`),W=y(``),G=y(``),xt=T(()=>R.value?Oe.value.get(R.value.hash)??[]:[]),K=y(!1),St=T(()=>R.value?.message?R.value.message.split(`
1
+ import"./rolldown-runtime-BM3Ffeng.js";import{Br as e,Dn as t,En as n,G as r,Gn as i,In as a,L as o,N as s,Qn as c,Rr as l,Rt as u,S as d,Sn as f,U as p,Un as m,Ur as h,Vn as g,_r as _,a as ee,bn as v,bt as te,dn as ne,dr as y,er as b,fn as re,ft as ie,ht as ae,i as x,kn as oe,m as S,mn as C,nn as se,p as ce,pn as w,q as le,r as ue,st as de,tr as fe,vn as T,x as pe,xn as E,yn as D,zn as me}from"./element-plus-Cchqf1s7.js";import{n as O,t as he}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{t as ge}from"./toolsStore-C0VjU2dD.js";import{n as _e,t as ve}from"./CommonDialog-ByvhJIxb.js";import{S as ye,f as be,w as xe}from"./index-hyzLLFKf.js";var k=[`#f14e32`,`#1e88e5`,`#43a047`,`#fb8c00`,`#8e24aa`,`#00acc1`,`#d81b60`,`#7cb342`,`#5e35b1`,`#00897b`];function A(e){return 10+e*14}function j(e){return k[e%k.length]}function M(e){if(!e)return[];let t=[];for(let n of e.split(`,`)){let e=n.trim();if(!e||e===`HEAD`||e.startsWith(`tag:`))continue;let r=e.match(/^HEAD\s*->\s*(.+)$/);t.push((r?r[1]:e).trim())}return t}function Se(e){let t=new Map,n=new Map;for(let r of e){let e=t.get(r.hash)??new Set;for(let t of M(r.branch))e.add(t);n.set(r.hash,Array.from(e));for(let n of r.parents??[]){let r=t.get(n)??new Set;for(let t of e)r.add(t);t.set(n,r)}}return n}function Ce(e){let t=[],n=[],r=0,i=0,a=new Set(e.map(e=>e.hash)),o=e=>t.findIndex(t=>t!==null&&t.hash===e),s=()=>{let e=t.findIndex(e=>e===null);return e===-1?(t.push(null),t.length-1):e};for(let c of e){let e=Array.isArray(c.parents)?c.parents:[],l=t.slice(),u=o(c.hash),d,f=!1;u===-1?(f=!0,u=s(),d=r++):d=t[u].colorIdx,t[u]=null;let p=[],m=new Set;for(let e=0;e<t.length;e++){let n=t[e];n!==null&&n.hash===c.hash&&(p.push({fromLane:e,color:j(n.colorIdx),branches:[],_hash:c.hash}),t[e]=null,m.add(e))}let h=[],g=j(d);if(e.length>0){let n=e[0],i=o(n);i===-1?a.has(n)&&(t[u]={hash:n,colorIdx:d},h.push({toLane:u,color:g,kind:`straight`,branches:[],_hash:n})):(h.push({toLane:i,color:g,kind:i===u?`straight`:`curve`,branches:[],_hash:n}),i===u&&(t[u]={hash:n,colorIdx:d}));for(let n of e.slice(1)){let e=o(n);if(e!==-1)h.push({toLane:e,color:g,kind:e===u?`straight`:`curve`,branches:[],_hash:n});else if(a.has(n)){let e=s(),i=r++;t[e]={hash:n,colorIdx:i},h.push({toLane:e,color:j(i),kind:e===u?`straight`:`curve`,branches:[],_hash:n})}}}let _=t.slice();i=Math.max(i,t.length);let ee=[];for(let e=0;e<l.length;e++){let t=l[e];t!==null&&(e===u||m.has(e)||e<_.length&&_[e]!==null&&_[e].hash===t.hash&&ee.push({lane:e,color:j(t.colorIdx),branches:[],_hash:t.hash}))}n.push({hash:c.hash,commitLane:u,color:g,isMerge:e.length>1,isHead:f,hasTopLine:!f,passes:ee,topCurves:p,bottomEdges:h,branches:[]})}let c=Se(e),l=e=>c.get(e)??[];for(let e of n){e.branches=l(e.hash);for(let t of e.passes)t.branches=l(t._hash),delete t._hash;for(let t of e.topCurves)t.branches=l(t._hash),delete t._hash;for(let t of e.bottomEdges)t.branches=l(t._hash),delete t._hash}let u=i>0?20+(i-1)*14:0;return{rows:n,maxLanes:i,width:u}}var we={class:`graph-wrap`},N=[`viewBox`],P=[`x1`,`x2`,`stroke`],F=[`x1`,`x2`],Te=[`d`,`stroke`],Ee=[`d`],De=[`x1`,`x2`,`stroke`],Oe=[`d`,`stroke`],I=[`d`],ke={class:`graph-layer graph-nodes`,"aria-hidden":`true`},L=[`cx`,`stroke`],R=[`cx`,`fill`],z=[`cx`,`stroke`],B=[`cx`],V=-1,Ae=he(oe({__name:`CommitGraphCell`,props:{layout:{},width:{}},setup(e){let t=e,n=T(()=>A(t.layout.commitLane)),r=O(`@A1833:暂不属于任何分支`);function a(e){return e.length>0?e.join(`, `):r}let o=T(()=>`${t.layout.hash.slice(0,7)} · ${a(t.layout.branches)}`),s=T(()=>t.layout.passes.map(e=>({x:A(e.lane),color:e.color,title:a(e.branches)}))),c=T(()=>t.layout.topCurves.map(e=>{let t=A(e.fromLane),r=n.value;return{d:`M ${t} ${V} C ${t} ${15/2}, ${r} ${15/2}, ${r} 15`,color:e.color,title:a(e.branches)}})),l=T(()=>t.layout.bottomEdges.map(e=>{let t=n.value,r=A(e.toLane);return{d:e.kind===`straight`||t===r?`M ${t} 15 L ${r} 31`:`M ${t} 15 C ${t} 23, ${r} ${31-16/2}, ${r} 31`,color:e.color,title:a(e.branches)}}));return(e,t)=>(m(),f(`div`,we,[(m(),f(`svg`,{class:`graph-layer graph-lines`,viewBox:`0 0 ${e.width} ${_(30)}`,preserveAspectRatio:`none`,"aria-hidden":`true`},[(m(!0),f(C,null,i(s.value,(e,t)=>(m(),f(`line`,{key:`p`+t,x1:e.x,y1:V,x2:e.x,y2:31,stroke:e.color,"stroke-width":`2`},[D(`title`,null,h(e.title),1)],8,P))),128)),(m(!0),f(C,null,i(s.value,(e,t)=>(m(),f(`line`,{key:`ph`+t,x1:e.x,y1:V,x2:e.x,y2:31,stroke:`transparent`,"stroke-width":`8`},[D(`title`,null,h(e.title),1)],8,F))),128)),(m(!0),f(C,null,i(c.value,(e,t)=>(m(),f(`path`,{key:`t`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[D(`title`,null,h(e.title),1)],8,Te))),128)),(m(!0),f(C,null,i(c.value,(e,t)=>(m(),f(`path`,{key:`th`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[D(`title`,null,h(e.title),1)],8,Ee))),128)),e.layout.hasTopLine?(m(),f(`line`,{key:0,x1:n.value,y1:V,x2:n.value,y2:15,stroke:e.layout.color,"stroke-width":`2`},[D(`title`,null,h(a(e.layout.branches)),1)],8,De)):E(``,!0),(m(!0),f(C,null,i(l.value,(e,t)=>(m(),f(`path`,{key:`b`+t,d:e.d,stroke:e.color,"stroke-width":`2`,fill:`none`},[D(`title`,null,h(e.title),1)],8,Oe))),128)),(m(!0),f(C,null,i(l.value,(e,t)=>(m(),f(`path`,{key:`bh`+t,d:e.d,stroke:`transparent`,"stroke-width":`8`,fill:`none`},[D(`title`,null,h(e.title),1)],8,I))),128))],8,N)),(m(),f(`svg`,ke,[D(`g`,null,[D(`title`,null,h(o.value),1),e.layout.isMerge?(m(),f(`circle`,{key:0,cx:n.value,cy:`50%`,r:`4.5`,fill:`var(--bg-panel, #fff)`,stroke:e.layout.color,"stroke-width":`2`},null,8,L)):(m(),f(`circle`,{key:1,cx:n.value,cy:`50%`,r:`4`,fill:e.layout.color},null,8,R)),e.layout.isHead?(m(),f(`circle`,{key:2,cx:n.value,cy:`50%`,r:`7`,fill:`none`,stroke:e.layout.color,"stroke-width":`1.5`,opacity:`0.55`},null,8,z)):E(``,!0),D(`circle`,{cx:n.value,cy:`50%`,r:`9`,fill:`transparent`},null,8,B)])]))]))}}),[[`__scopeId`,`data-v-1288d6a2`]]),je={class:`log-header`},Me={class:`header-left`},Ne={class:`log-actions`},Pe={viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,style:{display:`block`}},Fe={key:1,viewBox:`0 0 24 24`,width:`1em`,height:`1em`,fill:`currentColor`,style:{display:`block`}},Ie={key:0,class:`filter-panel-header`},Le={class:`filter-form`},Re={class:`filter-item`},ze={class:`compact-label`},Be={class:`filter-item`},Ve={class:`compact-label`},He={class:`filter-item`},Ue={class:`compact-label`},We={class:`filter-item`},Ge={class:`compact-label`},Ke={class:`filter-actions`},qe={key:0,role:`alert`,class:`log-error`},Je={key:1,class:`log-empty-state`},Ye={class:`log-empty-text`},Xe={key:2,class:`content-area-content`},Ze={class:`table-view-container`},Qe={class:`commit-message-cell`},$e={class:`message-content`},et={key:0,class:`branch-container`},tt={class:`message-text`},nt={class:`author-name`},rt=[`title`,`aria-label`,`onClick`],it={class:`commit-detail-container`},at={key:0,class:`commit-info`},ot={class:`commit-info-row`},st={class:`info-item date-item`},ct={class:`info-label`},lt={class:`info-value`},ut={class:`info-item branch-item`},dt={class:`info-label`},ft={key:0,class:`branch-container`},pt={key:1,class:`info-value info-value-muted`},mt={class:`info-item message-item`},ht={class:`info-label`},gt={class:`info-message-wrapper`},_t={class:`info-message-title`},vt=[`innerHTML`],yt=[`aria-label`,`onKeydown`],bt=`zen-gitsync:log-show-graph`,H=he(oe({__name:`LogList`,setup(oe,{expose:he}){let k=xe(),A=ge(),j=y([]),M=y(``),we=y(!1),N=T(()=>k.isLoadingLog||we.value),P=y(!1),F=y(localStorage.getItem(bt)!==`false`);c(F,e=>{localStorage.setItem(bt,String(e))});let Te=T(()=>F.value&&j.value.length>0?Ce(j.value):null),Ee=T(()=>{let e=new Map;if(Te.value)for(let t of Te.value.rows)e.set(t.hash,t);return e}),De=T(()=>Math.max(Te.value?.width??0,28)),Oe=T(()=>Se(j.value)),I=y(!1),ke=y(null),L=y(!1),R=y(null),z=y([]),B=y(``),V=y(!1),H=y(``),U=y(`full-new`),W=y(``),G=y(``),xt=T(()=>R.value?Oe.value.get(R.value.hash)??[]:[]),K=y(!1),St=T(()=>R.value?.message?R.value.message.split(`
2
2
  `)[0].trim():``),Ct=T(()=>R.value?.message?R.value.message.split(`
3
3
  `).slice(1).join(`
4
4
  `).trim():``),wt=T(()=>Ct.value.length>0),Tt=T(()=>Ct.value.replace(/\n/g,`<br>`)),q=y(!1),Et=y([]),Dt=y(``),J=y(null),Ot=y([]),kt=y([]),At=y([]),jt=y(!1),Mt=y(0),Nt=y(0),Y=y(null),Pt=y(null),Ft=T(()=>j.value),It=T(()=>z.value.map(e=>({path:e,name:e.split(`/`).pop()||e})));async function Lt(e=!1,t=1){let n=xe();if(!n.isGitRepo){M.value=`当前目录不是Git仓库`;return}try{t>1?I.value=!0:we.value=!0;let r=new URLSearchParams;r.append(`page`,t.toString()),r.append(`all`,e.toString()),r.append(`with_parents`,`true`),Et.value.length>0&&r.append(`author`,Et.value.join(`,`)),kt.value.length>0&&r.append(`branch`,kt.value.join(`,`)),Dt.value&&r.append(`message`,Dt.value),J.value&&Array.isArray(J.value)&&J.value.length===2&&(r.append(`dateFrom`,J.value[0]),r.append(`dateTo`,J.value[1])),r.append(`_t`,Date.now().toString());let i=await(await fetch(`/api/log?${r.toString()}`)).json();if(!i||!i.data||!Array.isArray(i.data)){M.value=`加载提交历史失败: 服务器返回数据格式不正确`;return}let o=t>1;o&&Array.isArray(i.data)?j.value=j.value.concat(i.data):Array.isArray(i.data)&&(j.value=i.data),n.currentPage=t,n.totalCommits=i.total??j.value.length,n.hasMoreData=i.hasMore===!0,!o&&!e&&a(()=>{Ut(),setTimeout(xn,200)}),M.value=``}catch(e){M.value=`加载提交历史失败: `+(e instanceof Error?e.message:String(e)),t>1&&(n.hasMoreData=!1)}finally{t>1?I.value=!1:we.value=!1}}function Rt(e){return e.includes(`HEAD -> `)?e.replace(`HEAD -> `,``):e.includes(`origin/`)?e:e.trim()}function zt(e){return e.includes(`HEAD`)?`success`:e.includes(`origin/`)?`warning`:`info`}function Bt(e){return e?e.length>60?!0:e.includes(`
@@ -1 +1 @@
1
- import"./rolldown-runtime-BM3Ffeng.js";import{Br as e,Dn as t,En as n,G as r,Gn as i,It as a,Rr as o,Sn as s,U as ee,Un as c,Ur as l,Vn as te,_r as u,dr as d,er as f,h as ne,i as p,kn as m,mn as re,nn as ie,q as ae,r as h,v as oe,vn as g,xn as _,yn as v,zn as y,zt as se}from"./element-plus-Cchqf1s7.js";import{n as b,t as x}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{t as S}from"./index-D-n9_1ON.js";var ce={class:`monitor-view`},le={class:`monitor-toolbar`},ue={class:`toolbar-title`},C={key:0,class:`toolbar-host`},w={class:`toolbar-actions`},T={class:`toolbar-label`},E={class:`toolbar-label`},D={key:0,class:`monitor-cards`},O={class:`metric-card`},k={class:`metric-card__header`},A={class:`metric-card__body`},j={class:`metric-sub`},M=[`title`],N={class:`metric-card`},P={class:`metric-card__header`},F={class:`metric-card__body`},I={class:`metric-sub`},L={class:`metric-card__footer`},R={class:`metric-card`},z={class:`metric-card__header`},B={class:`metric-card__body`},V={class:`metric-value`},H={class:`metric-sub`},U={class:`metric-card__footer`},de={class:`metric-card`},fe={class:`metric-card__header`},pe={class:`metric-card__body`},me={class:`metric-value`},he={class:`metric-sub`},ge={class:`metric-card__footer`},_e={key:1,class:`monitor-placeholder`},ve={key:2,class:`monitor-error`},ye={key:3,class:`monitor-ports`},be={class:`ports-header`},xe={class:`ports-title`},Se={class:`ports-table-wrap`},Ce={class:`ports-table`},we={class:`col-protocol`},Te={class:`col-address`},Ee={class:`col-state`},De={class:`col-action`},Oe={class:`col-protocol`},ke={class:`col-address`},Ae={class:`col-port`},je={class:`port-num`},Me={class:`col-state`},Ne={class:`col-pid`},Pe=[`title`],Fe={class:`col-action`},Ie={key:0},W={colspan:`7`,class:`ports-empty`},G=x(m({__name:`MonitorView`,setup(m){let x=S(),G=d(``),K=d(`port`),q=d(`asc`);function J(e){K.value===e?q.value=q.value===`asc`?`desc`:`asc`:(K.value=e,q.value=`asc`)}let Y=g(()=>{let e=x.ports.slice(),t=G.value.trim().toLowerCase();t&&(e=e.filter(e=>String(e.localPort).includes(t)||String(e.pid).includes(t)||(e.processName||``).toLowerCase().includes(t)||(e.localAddress||``).toLowerCase().includes(t)||(e.protocol||``).toLowerCase().includes(t)||(e.state||``).toLowerCase().includes(t)));let n=q.value===`asc`?1:-1;return e.sort((e,t)=>{let r,i;return K.value===`port`?(r=e.localPort,i=t.localPort):K.value===`pid`?(r=Number(e.pid)||0,i=Number(t.pid)||0):(r=(e.processName||``).toLowerCase(),i=(t.processName||``).toLowerCase()),r<i?-1*n:r>i?1*n:0}),e});function X(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function Le(e){if(!Number.isFinite(e)||e<=0)return`-`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=Math.floor(e%60),a=[];return t>0&&a.push(`${t} ${b(`@MONITOR:天`)}`),n>0&&a.push(`${n} ${b(`@MONITOR:时`)}`),r>0&&a.push(`${r} ${b(`@MONITOR:分`)}`),a.push(`${i} ${b(`@MONITOR:秒`)}`),a.join(` `)}function Z(e){return e>=90?`var(--color-danger)`:e>=70?`var(--color-warning)`:`var(--color-success)`}let Q=d(new Set);async function Re(e){let t=e.pid,n=e.processName||b(`@MONITOR:未知进程`);try{await h.confirm(b(`@MONITOR:确认终止进程提示`).replace(`{pid}`,String(t)).replace(`{process}`,n).replace(`{port}`,String(e.localPort)),b(`@MONITOR:终止进程`),{confirmButtonText:b(`@MONITOR:终止`),cancelButtonText:b(`@MONITOR:取消`),type:`warning`})}catch{return}Q.value.add(t);try{await x.killProcess(t,!0),p.success(b(`@MONITOR:已终止进程`).replace(`{pid}`,String(t)))}catch(e){p.error(e?.message||b(`@MONITOR:终止进程失败`))}finally{Q.value.delete(t)}}function $(){x.refresh().catch(e=>{p.error(e?.message||b(`@MONITOR:刷新失败`))})}function ze(e){x.setAutoRefresh(e)}function Be(e){x.setShowAllPorts(e)}return te(()=>{x.startAutoRefresh()}),y(()=>{x.stopAutoRefresh()}),(te,d)=>{let p=ne,m=r,h=ee,g=oe,y=ie,S=ae;return c(),s(`div`,ce,[v(`div`,le,[v(`div`,ue,[d[4]||=v(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})],-1),v(`span`,null,l(u(b)(`@MONITOR:系统监控`)),1),u(x).overview?(c(),s(`span`,C,l(u(x).overview.system.hostname)+` · `+l(u(x).overview.system.platform)+`/`+l(u(x).overview.system.arch),1)):_(``,!0)]),v(`div`,w,[t(m,{content:u(b)(`@MONITOR:显示所有连接`),placement:`bottom`},{default:f(()=>[t(p,{"model-value":u(x).showAllPorts,onChange:Be,size:`small`},null,8,[`model-value`])]),_:1},8,[`content`]),v(`span`,T,l(u(b)(`@MONITOR:全部连接`)),1),t(m,{content:u(b)(`@MONITOR:自动刷新`),placement:`bottom`},{default:f(()=>[t(p,{"model-value":u(x).autoRefresh,onChange:ze,size:`small`},null,8,[`model-value`])]),_:1},8,[`content`]),v(`span`,E,l(u(b)(`@MONITOR:自动`)),1),t(h,{size:`small`,icon:u(a),loading:u(x).loading,onClick:$},{default:f(()=>[n(l(u(b)(`@MONITOR:刷新`)),1)]),_:1},8,[`icon`,`loading`])])]),u(x).overview?(c(),s(`div`,D,[v(`div`,O,[v(`div`,k,[d[5]||=v(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),v(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),v(`path`,{d:`M9 2v2M15 2v2M9 20v2M15 20v2M2 9h2M2 15h2M20 9h2M20 15h2`})],-1),v(`span`,null,l(u(b)(`@MONITOR:CPU 占用`)),1)]),v(`div`,A,[v(`div`,{class:`metric-value`,style:e({color:Z(u(x).overview.cpu.usage)})},[n(l(u(x).overview.cpu.usage.toFixed(1)),1),d[6]||=v(`span`,{class:`metric-unit`},`%`,-1)],4),v(`div`,j,l(u(x).overview.cpu.cores)+` `+l(u(b)(`@MONITOR:核心`)),1)]),t(g,{percentage:u(x).overview.cpu.usage,"stroke-width":6,"show-text":!1,color:Z(u(x).overview.cpu.usage)},null,8,[`percentage`,`color`]),v(`div`,{class:`metric-card__footer`,title:u(x).overview.cpu.model},l(u(x).overview.cpu.model),9,M)]),v(`div`,N,[v(`div`,P,[d[7]||=v(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`rect`,{x:`2`,y:`6`,width:`20`,height:`12`,rx:`2`}),v(`path`,{d:`M6 10v4M10 10v4M14 10v4M18 10v4`})],-1),v(`span`,null,l(u(b)(`@MONITOR:内存占用`)),1)]),v(`div`,F,[v(`div`,{class:`metric-value`,style:e({color:Z(u(x).overview.memory.usagePercent)})},[n(l(u(x).overview.memory.usagePercent.toFixed(1)),1),d[8]||=v(`span`,{class:`metric-unit`},`%`,-1)],4),v(`div`,I,l(X(u(x).overview.memory.used))+` / `+l(X(u(x).overview.memory.total)),1)]),t(g,{percentage:u(x).overview.memory.usagePercent,"stroke-width":6,"show-text":!1,color:Z(u(x).overview.memory.usagePercent)},null,8,[`percentage`,`color`]),v(`div`,L,l(u(b)(`@MONITOR:空闲`))+` `+l(X(u(x).overview.memory.free)),1)]),v(`div`,R,[v(`div`,z,[d[9]||=v(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`circle`,{cx:`12`,cy:`12`,r:`10`}),v(`polyline`,{points:`12 6 12 12 16 14`})],-1),v(`span`,null,l(u(b)(`@MONITOR:系统运行时间`)),1)]),v(`div`,B,[v(`div`,V,l(Le(u(x).overview.system.uptime)),1),v(`div`,H,l(u(x).overview.system.nodeVersion),1)]),v(`div`,U,l(u(x).overview.system.hostname),1)]),v(`div`,de,[v(`div`,fe,[d[10]||=v(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})],-1),v(`span`,null,l(u(b)(`@MONITOR:监听端口`)),1)]),v(`div`,pe,[v(`div`,me,l(u(x).ports.length),1),v(`div`,he,l(u(b)(`@MONITOR:TCP`))+` `+l(u(x).ports.filter(e=>e.protocol===`TCP`).length)+` · `+l(u(b)(`@MONITOR:UDP`))+` `+l(u(x).ports.filter(e=>e.protocol===`UDP`).length),1)]),v(`div`,ge,l(u(x).showAllPorts?u(b)(`@MONITOR:显示全部连接`):u(b)(`@MONITOR:仅监听端口`)),1)])])):u(x).loading?(c(),s(`div`,_e,[t(y,{class:`is-loading`},{default:f(()=>[t(u(a))]),_:1}),v(`span`,null,l(u(b)(`@MONITOR:加载中`)),1)])):_(``,!0),u(x).error&&!u(x).overview?(c(),s(`div`,ve,[d[11]||=v(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`circle`,{cx:`12`,cy:`12`,r:`10`}),v(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),v(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})],-1),v(`span`,null,l(u(x).error),1),t(h,{size:`small`,onClick:$},{default:f(()=>[n(l(u(b)(`@MONITOR:重试`)),1)]),_:1})])):_(``,!0),u(x).overview?(c(),s(`div`,ye,[v(`div`,be,[v(`span`,xe,l(u(b)(`@MONITOR:端口占用列表`)),1),t(S,{modelValue:G.value,"onUpdate:modelValue":d[0]||=e=>G.value=e,placeholder:u(b)(`@MONITOR:搜索端口 / PID / 进程名`),size:`small`,clearable:``,class:`ports-search`},{prefix:f(()=>[t(y,null,{default:f(()=>[t(u(se))]),_:1})]),_:1},8,[`modelValue`,`placeholder`])]),v(`div`,Se,[v(`table`,Ce,[v(`thead`,null,[v(`tr`,null,[v(`th`,we,l(u(b)(`@MONITOR:协议`)),1),v(`th`,Te,l(u(b)(`@MONITOR:本地地址`)),1),v(`th`,{class:`col-port sortable`,onClick:d[1]||=e=>J(`port`)},[n(l(u(b)(`@MONITOR:端口`))+` `,1),v(`span`,{class:o([`sort-arrow`,{active:K.value===`port`,desc:q.value===`desc`}])},`↕`,2)]),v(`th`,Ee,l(u(b)(`@MONITOR:状态`)),1),v(`th`,{class:`col-pid sortable`,onClick:d[2]||=e=>J(`pid`)},[d[12]||=n(` PID `),v(`span`,{class:o([`sort-arrow`,{active:K.value===`pid`,desc:q.value===`desc`}])},`↕`,2)]),v(`th`,{class:`col-process sortable`,onClick:d[3]||=e=>J(`process`)},[n(l(u(b)(`@MONITOR:进程`))+` `,1),v(`span`,{class:o([`sort-arrow`,{active:K.value===`process`,desc:q.value===`desc`}])},`↕`,2)]),v(`th`,De,l(u(b)(`@MONITOR:操作`)),1)])]),v(`tbody`,null,[(c(!0),s(re,null,i(Y.value,(e,r)=>(c(),s(`tr`,{key:`${e.protocol}-${e.localPort}-${e.pid}-${r}`},[v(`td`,Oe,[v(`span`,{class:o([`proto-badge`,`proto-${e.protocol.toLowerCase()}`])},l(e.protocol),3)]),v(`td`,ke,l(e.localAddress),1),v(`td`,Ae,[v(`span`,je,l(e.localPort),1)]),v(`td`,Me,[v(`span`,{class:o([`state-tag`,`state-${(e.state||`unknown`).toLowerCase()}`])},l(e.state||`-`),3)]),v(`td`,Ne,l(e.pid),1),v(`td`,{class:`col-process`,title:e.processName},l(e.processName||u(b)(`@MONITOR:未知`)),9,Pe),v(`td`,Fe,[t(h,{size:`small`,type:`danger`,plain:``,loading:Q.value.has(e.pid),disabled:Q.value.has(e.pid),onClick:t=>Re(e)},{default:f(()=>[n(l(u(b)(`@MONITOR:终止`)),1)]),_:2},1032,[`loading`,`disabled`,`onClick`])])]))),128)),Y.value.length===0?(c(),s(`tr`,Ie,[v(`td`,W,l(G.value?u(b)(`@MONITOR:无匹配结果`):u(b)(`@MONITOR:暂无端口占用`)),1)])):_(``,!0)])])])])):_(``,!0)])}}}),[[`__scopeId`,`data-v-bb8bc21a`]]);export{G as default};
1
+ import"./rolldown-runtime-BM3Ffeng.js";import{Br as e,Dn as t,En as n,G as r,Gn as i,It as a,Rr as o,Sn as s,U as ee,Un as c,Ur as l,Vn as te,_r as u,dr as d,er as f,h as ne,i as p,kn as m,mn as re,nn as ie,q as ae,r as h,v as oe,vn as g,xn as _,yn as v,zn as y,zt as se}from"./element-plus-Cchqf1s7.js";import{n as b,t as x}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{t as S}from"./index-hyzLLFKf.js";var ce={class:`monitor-view`},le={class:`monitor-toolbar`},ue={class:`toolbar-title`},C={key:0,class:`toolbar-host`},w={class:`toolbar-actions`},T={class:`toolbar-label`},E={class:`toolbar-label`},D={key:0,class:`monitor-cards`},O={class:`metric-card`},k={class:`metric-card__header`},A={class:`metric-card__body`},j={class:`metric-sub`},M=[`title`],N={class:`metric-card`},P={class:`metric-card__header`},F={class:`metric-card__body`},I={class:`metric-sub`},L={class:`metric-card__footer`},R={class:`metric-card`},z={class:`metric-card__header`},B={class:`metric-card__body`},V={class:`metric-value`},H={class:`metric-sub`},U={class:`metric-card__footer`},de={class:`metric-card`},fe={class:`metric-card__header`},pe={class:`metric-card__body`},me={class:`metric-value`},he={class:`metric-sub`},ge={class:`metric-card__footer`},_e={key:1,class:`monitor-placeholder`},ve={key:2,class:`monitor-error`},ye={key:3,class:`monitor-ports`},be={class:`ports-header`},xe={class:`ports-title`},Se={class:`ports-table-wrap`},Ce={class:`ports-table`},we={class:`col-protocol`},Te={class:`col-address`},Ee={class:`col-state`},De={class:`col-action`},Oe={class:`col-protocol`},ke={class:`col-address`},Ae={class:`col-port`},je={class:`port-num`},Me={class:`col-state`},Ne={class:`col-pid`},Pe=[`title`],Fe={class:`col-action`},Ie={key:0},W={colspan:`7`,class:`ports-empty`},G=x(m({__name:`MonitorView`,setup(m){let x=S(),G=d(``),K=d(`port`),q=d(`asc`);function J(e){K.value===e?q.value=q.value===`asc`?`desc`:`asc`:(K.value=e,q.value=`asc`)}let Y=g(()=>{let e=x.ports.slice(),t=G.value.trim().toLowerCase();t&&(e=e.filter(e=>String(e.localPort).includes(t)||String(e.pid).includes(t)||(e.processName||``).toLowerCase().includes(t)||(e.localAddress||``).toLowerCase().includes(t)||(e.protocol||``).toLowerCase().includes(t)||(e.state||``).toLowerCase().includes(t)));let n=q.value===`asc`?1:-1;return e.sort((e,t)=>{let r,i;return K.value===`port`?(r=e.localPort,i=t.localPort):K.value===`pid`?(r=Number(e.pid)||0,i=Number(t.pid)||0):(r=(e.processName||``).toLowerCase(),i=(t.processName||``).toLowerCase()),r<i?-1*n:r>i?1*n:0}),e});function X(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r++;return`${n.toFixed(r===0?0:1)} ${t[r]}`}function Le(e){if(!Number.isFinite(e)||e<=0)return`-`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),i=Math.floor(e%60),a=[];return t>0&&a.push(`${t} ${b(`@MONITOR:天`)}`),n>0&&a.push(`${n} ${b(`@MONITOR:时`)}`),r>0&&a.push(`${r} ${b(`@MONITOR:分`)}`),a.push(`${i} ${b(`@MONITOR:秒`)}`),a.join(` `)}function Z(e){return e>=90?`var(--color-danger)`:e>=70?`var(--color-warning)`:`var(--color-success)`}let Q=d(new Set);async function Re(e){let t=e.pid,n=e.processName||b(`@MONITOR:未知进程`);try{await h.confirm(b(`@MONITOR:确认终止进程提示`).replace(`{pid}`,String(t)).replace(`{process}`,n).replace(`{port}`,String(e.localPort)),b(`@MONITOR:终止进程`),{confirmButtonText:b(`@MONITOR:终止`),cancelButtonText:b(`@MONITOR:取消`),type:`warning`})}catch{return}Q.value.add(t);try{await x.killProcess(t,!0),p.success(b(`@MONITOR:已终止进程`).replace(`{pid}`,String(t)))}catch(e){p.error(e?.message||b(`@MONITOR:终止进程失败`))}finally{Q.value.delete(t)}}function $(){x.refresh().catch(e=>{p.error(e?.message||b(`@MONITOR:刷新失败`))})}function ze(e){x.setAutoRefresh(e)}function Be(e){x.setShowAllPorts(e)}return te(()=>{x.startAutoRefresh()}),y(()=>{x.stopAutoRefresh()}),(te,d)=>{let p=ne,m=r,h=ee,g=oe,y=ie,S=ae;return c(),s(`div`,ce,[v(`div`,le,[v(`div`,ue,[d[4]||=v(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})],-1),v(`span`,null,l(u(b)(`@MONITOR:系统监控`)),1),u(x).overview?(c(),s(`span`,C,l(u(x).overview.system.hostname)+` · `+l(u(x).overview.system.platform)+`/`+l(u(x).overview.system.arch),1)):_(``,!0)]),v(`div`,w,[t(m,{content:u(b)(`@MONITOR:显示所有连接`),placement:`bottom`},{default:f(()=>[t(p,{"model-value":u(x).showAllPorts,onChange:Be,size:`small`},null,8,[`model-value`])]),_:1},8,[`content`]),v(`span`,T,l(u(b)(`@MONITOR:全部连接`)),1),t(m,{content:u(b)(`@MONITOR:自动刷新`),placement:`bottom`},{default:f(()=>[t(p,{"model-value":u(x).autoRefresh,onChange:ze,size:`small`},null,8,[`model-value`])]),_:1},8,[`content`]),v(`span`,E,l(u(b)(`@MONITOR:自动`)),1),t(h,{size:`small`,icon:u(a),loading:u(x).loading,onClick:$},{default:f(()=>[n(l(u(b)(`@MONITOR:刷新`)),1)]),_:1},8,[`icon`,`loading`])])]),u(x).overview?(c(),s(`div`,D,[v(`div`,O,[v(`div`,k,[d[5]||=v(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`}),v(`rect`,{x:`9`,y:`9`,width:`6`,height:`6`}),v(`path`,{d:`M9 2v2M15 2v2M9 20v2M15 20v2M2 9h2M2 15h2M20 9h2M20 15h2`})],-1),v(`span`,null,l(u(b)(`@MONITOR:CPU 占用`)),1)]),v(`div`,A,[v(`div`,{class:`metric-value`,style:e({color:Z(u(x).overview.cpu.usage)})},[n(l(u(x).overview.cpu.usage.toFixed(1)),1),d[6]||=v(`span`,{class:`metric-unit`},`%`,-1)],4),v(`div`,j,l(u(x).overview.cpu.cores)+` `+l(u(b)(`@MONITOR:核心`)),1)]),t(g,{percentage:u(x).overview.cpu.usage,"stroke-width":6,"show-text":!1,color:Z(u(x).overview.cpu.usage)},null,8,[`percentage`,`color`]),v(`div`,{class:`metric-card__footer`,title:u(x).overview.cpu.model},l(u(x).overview.cpu.model),9,M)]),v(`div`,N,[v(`div`,P,[d[7]||=v(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`rect`,{x:`2`,y:`6`,width:`20`,height:`12`,rx:`2`}),v(`path`,{d:`M6 10v4M10 10v4M14 10v4M18 10v4`})],-1),v(`span`,null,l(u(b)(`@MONITOR:内存占用`)),1)]),v(`div`,F,[v(`div`,{class:`metric-value`,style:e({color:Z(u(x).overview.memory.usagePercent)})},[n(l(u(x).overview.memory.usagePercent.toFixed(1)),1),d[8]||=v(`span`,{class:`metric-unit`},`%`,-1)],4),v(`div`,I,l(X(u(x).overview.memory.used))+` / `+l(X(u(x).overview.memory.total)),1)]),t(g,{percentage:u(x).overview.memory.usagePercent,"stroke-width":6,"show-text":!1,color:Z(u(x).overview.memory.usagePercent)},null,8,[`percentage`,`color`]),v(`div`,L,l(u(b)(`@MONITOR:空闲`))+` `+l(X(u(x).overview.memory.free)),1)]),v(`div`,R,[v(`div`,z,[d[9]||=v(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`circle`,{cx:`12`,cy:`12`,r:`10`}),v(`polyline`,{points:`12 6 12 12 16 14`})],-1),v(`span`,null,l(u(b)(`@MONITOR:系统运行时间`)),1)]),v(`div`,B,[v(`div`,V,l(Le(u(x).overview.system.uptime)),1),v(`div`,H,l(u(x).overview.system.nodeVersion),1)]),v(`div`,U,l(u(x).overview.system.hostname),1)]),v(`div`,de,[v(`div`,fe,[d[10]||=v(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`path`,{d:`M22 12h-4l-3 9L9 3l-3 9H2`})],-1),v(`span`,null,l(u(b)(`@MONITOR:监听端口`)),1)]),v(`div`,pe,[v(`div`,me,l(u(x).ports.length),1),v(`div`,he,l(u(b)(`@MONITOR:TCP`))+` `+l(u(x).ports.filter(e=>e.protocol===`TCP`).length)+` · `+l(u(b)(`@MONITOR:UDP`))+` `+l(u(x).ports.filter(e=>e.protocol===`UDP`).length),1)]),v(`div`,ge,l(u(x).showAllPorts?u(b)(`@MONITOR:显示全部连接`):u(b)(`@MONITOR:仅监听端口`)),1)])])):u(x).loading?(c(),s(`div`,_e,[t(y,{class:`is-loading`},{default:f(()=>[t(u(a))]),_:1}),v(`span`,null,l(u(b)(`@MONITOR:加载中`)),1)])):_(``,!0),u(x).error&&!u(x).overview?(c(),s(`div`,ve,[d[11]||=v(`svg`,{viewBox:`0 0 24 24`,width:`20`,height:`20`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[v(`circle`,{cx:`12`,cy:`12`,r:`10`}),v(`line`,{x1:`12`,y1:`8`,x2:`12`,y2:`12`}),v(`line`,{x1:`12`,y1:`16`,x2:`12.01`,y2:`16`})],-1),v(`span`,null,l(u(x).error),1),t(h,{size:`small`,onClick:$},{default:f(()=>[n(l(u(b)(`@MONITOR:重试`)),1)]),_:1})])):_(``,!0),u(x).overview?(c(),s(`div`,ye,[v(`div`,be,[v(`span`,xe,l(u(b)(`@MONITOR:端口占用列表`)),1),t(S,{modelValue:G.value,"onUpdate:modelValue":d[0]||=e=>G.value=e,placeholder:u(b)(`@MONITOR:搜索端口 / PID / 进程名`),size:`small`,clearable:``,class:`ports-search`},{prefix:f(()=>[t(y,null,{default:f(()=>[t(u(se))]),_:1})]),_:1},8,[`modelValue`,`placeholder`])]),v(`div`,Se,[v(`table`,Ce,[v(`thead`,null,[v(`tr`,null,[v(`th`,we,l(u(b)(`@MONITOR:协议`)),1),v(`th`,Te,l(u(b)(`@MONITOR:本地地址`)),1),v(`th`,{class:`col-port sortable`,onClick:d[1]||=e=>J(`port`)},[n(l(u(b)(`@MONITOR:端口`))+` `,1),v(`span`,{class:o([`sort-arrow`,{active:K.value===`port`,desc:q.value===`desc`}])},`↕`,2)]),v(`th`,Ee,l(u(b)(`@MONITOR:状态`)),1),v(`th`,{class:`col-pid sortable`,onClick:d[2]||=e=>J(`pid`)},[d[12]||=n(` PID `),v(`span`,{class:o([`sort-arrow`,{active:K.value===`pid`,desc:q.value===`desc`}])},`↕`,2)]),v(`th`,{class:`col-process sortable`,onClick:d[3]||=e=>J(`process`)},[n(l(u(b)(`@MONITOR:进程`))+` `,1),v(`span`,{class:o([`sort-arrow`,{active:K.value===`process`,desc:q.value===`desc`}])},`↕`,2)]),v(`th`,De,l(u(b)(`@MONITOR:操作`)),1)])]),v(`tbody`,null,[(c(!0),s(re,null,i(Y.value,(e,r)=>(c(),s(`tr`,{key:`${e.protocol}-${e.localPort}-${e.pid}-${r}`},[v(`td`,Oe,[v(`span`,{class:o([`proto-badge`,`proto-${e.protocol.toLowerCase()}`])},l(e.protocol),3)]),v(`td`,ke,l(e.localAddress),1),v(`td`,Ae,[v(`span`,je,l(e.localPort),1)]),v(`td`,Me,[v(`span`,{class:o([`state-tag`,`state-${(e.state||`unknown`).toLowerCase()}`])},l(e.state||`-`),3)]),v(`td`,Ne,l(e.pid),1),v(`td`,{class:`col-process`,title:e.processName},l(e.processName||u(b)(`@MONITOR:未知`)),9,Pe),v(`td`,Fe,[t(h,{size:`small`,type:`danger`,plain:``,loading:Q.value.has(e.pid),disabled:Q.value.has(e.pid),onClick:t=>Re(e)},{default:f(()=>[n(l(u(b)(`@MONITOR:终止`)),1)]),_:2},1032,[`loading`,`disabled`,`onClick`])])]))),128)),Y.value.length===0?(c(),s(`tr`,Ie,[v(`td`,W,l(G.value?u(b)(`@MONITOR:无匹配结果`):u(b)(`@MONITOR:暂无端口占用`)),1)])):_(``,!0)])])])])):_(``,!0)])}}}),[[`__scopeId`,`data-v-bb8bc21a`]]);export{G as default};
@@ -1 +1 @@
1
- import"./rolldown-runtime-BM3Ffeng.js";import{Dn as e,G as t,Sn as n,Un as r,Ur as i,_r as a,er as o,kn as s,pn as c,xn as l,yn as u}from"./element-plus-Cchqf1s7.js";import{n as d,t as f}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{t as p}from"./SvgIcon-ryKBwC8P.js";import{w as m}from"./index-D-n9_1ON.js";var h={key:0,class:`remote-wrapper`},g=[`href`,`aria-label`],_=[`aria-label`],v=f(s({__name:`RemoteRepoCard`,setup(s){let f=m();return(s,m)=>{let v=p,y=t;return a(f).remoteUrl?(r(),n(`div`,h,[e(y,{content:a(f).isRemoteBrowsable?a(d)(`@F13B4:在浏览器中打开仓库主页`):a(d)(`@F13B4:无法识别该远程仓库的网页地址`),placement:`top`,effect:`dark`,"show-after":300},{default:o(()=>[a(f).isRemoteBrowsable?(r(),n(`a`,{key:0,href:a(f).remoteWebUrl,target:`_blank`,rel:`noopener noreferrer`,class:`remote-repo-link`,"aria-label":a(d)(`@F13B4:在浏览器中打开仓库主页`),onClick:m[0]||=c(()=>{},[`stop`])},[e(v,{"icon-class":`remote-repo`,"class-name":`remote-repo-icon`})],8,g)):(r(),n(`span`,{key:1,class:`remote-repo-link remote-repo-link--disabled`,"aria-label":a(d)(`@F13B4:无法识别该远程仓库的网页地址`)},[e(v,{"icon-class":`remote-repo`,"class-name":`remote-repo-icon`})],8,_))]),_:1},8,[`content`]),e(y,{content:a(d)(`@F13B4:复制仓库地址`),placement:`top`,effect:`dark`,"show-after":300},{default:o(()=>[u(`span`,{class:`repo-url clickable`,onClick:m[1]||=e=>a(f).copyRemoteUrl()},i(a(f).remoteUrl),1)]),_:1},8,[`content`])])):l(``,!0)}}}),[[`__scopeId`,`data-v-89284d0c`]]);export{v as default};
1
+ import"./rolldown-runtime-BM3Ffeng.js";import{Dn as e,G as t,Sn as n,Un as r,Ur as i,_r as a,er as o,kn as s,pn as c,xn as l,yn as u}from"./element-plus-Cchqf1s7.js";import{n as d,t as f}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{t as p}from"./SvgIcon-ryKBwC8P.js";import{w as m}from"./index-hyzLLFKf.js";var h={key:0,class:`remote-wrapper`},g=[`href`,`aria-label`],_=[`aria-label`],v=f(s({__name:`RemoteRepoCard`,setup(s){let f=m();return(s,m)=>{let v=p,y=t;return a(f).remoteUrl?(r(),n(`div`,h,[e(y,{content:a(f).isRemoteBrowsable?a(d)(`@F13B4:在浏览器中打开仓库主页`):a(d)(`@F13B4:无法识别该远程仓库的网页地址`),placement:`top`,effect:`dark`,"show-after":300},{default:o(()=>[a(f).isRemoteBrowsable?(r(),n(`a`,{key:0,href:a(f).remoteWebUrl,target:`_blank`,rel:`noopener noreferrer`,class:`remote-repo-link`,"aria-label":a(d)(`@F13B4:在浏览器中打开仓库主页`),onClick:m[0]||=c(()=>{},[`stop`])},[e(v,{"icon-class":`remote-repo`,"class-name":`remote-repo-icon`})],8,g)):(r(),n(`span`,{key:1,class:`remote-repo-link remote-repo-link--disabled`,"aria-label":a(d)(`@F13B4:无法识别该远程仓库的网页地址`)},[e(v,{"icon-class":`remote-repo`,"class-name":`remote-repo-icon`})],8,_))]),_:1},8,[`content`]),e(y,{content:a(d)(`@F13B4:复制仓库地址`),placement:`top`,effect:`dark`,"show-after":300},{default:o(()=>[u(`span`,{class:`repo-url clickable`,onClick:m[1]||=e=>a(f).copyRemoteUrl()},i(a(f).remoteUrl),1)]),_:1},8,[`content`])])):l(``,!0)}}}),[[`__scopeId`,`data-v-89284d0c`]]);export{v as default};
@@ -1,3 +1,3 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Br as t,Dn as n,En as r,G as i,Gn as a,In as o,M as s,Qn as c,Rr as l,Sn as u,Tn as d,U as ee,Un as f,Ur as p,Vn as m,_r as h,dn as g,dr as _,er as v,fn as te,fr as ne,i as re,kn as y,mn as b,tr as x,un as ie,vn as S,xn as C,yn as w,zn as ae}from"./element-plus-Cchqf1s7.js";import{n as T,t as E}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{t as oe}from"./configStore-DdYe2Jg3.js";import{gt as D}from"./monaco-43aputPh.js";import{a as se,c as ce,i as le,l as ue,n as de,o as fe,r as pe,s as me,t as he}from"./vue-flow-3jJr-V2W.js";import{b as ge,v as _e}from"./index-D-n9_1ON.js";import{t as O}from"./dagre-97WoLjFt.js";var ve=e(O(),1),ye={class:`source-map-view`},be={class:`sm-toolbar`},xe={class:`sm-toolbar-left`},Se={class:`sm-title`},Ce={class:`sm-toolbar-center`},we=[`placeholder`,`disabled`],Te=[`disabled`],Ee={class:`sm-toolbar-right`},De=[`aria-label`],Oe={class:`sm-body`},ke={class:`sm-panel-header sm-panel-header--tabs`},Ae={key:0,class:`sm-badge`},je={class:`sm-panel-body sm-file-tree`},Me=[`onClick`],Ne={key:1,class:`sm-tree-arrow-spacer`},Pe={key:2,class:`sm-tree-icon mit-icon`,"aria-hidden":`true`},Fe=[`xlink:href`],Ie={key:3,class:`sm-tree-icon mit-icon`,"aria-hidden":`true`},Le=[`xlink:href`],Re=[`title`],ze={key:1,class:`sm-tree-empty`},Be={class:`sm-panel-body sm-outline-body`},Ve={class:`sm-badge`,style:{"margin-left":`auto`}},He=[`onClick`],Ue=[`title`],We={key:0,class:`sm-outline-desc`},Ge={key:1,class:`sm-tree-empty`},Ke={class:`sm-panel sm-panel-graph`},qe={key:0,class:`sm-project-info`},Je={class:`sm-lang-badge`},Ye={class:`sm-summary-text`},Xe={class:`sm-graph-container`},Ze={class:`sm-layout-btn-wrap`},Qe=[`disabled`],$e=[`title`],et={class:`sm-fn-label`},tt={key:0,class:`sm-fn-desc`},nt={key:0,class:`sm-graph-empty`},rt={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1`,style:{opacity:`0.3`}},it={key:1,class:`sm-graph-loading`},at={class:`sm-log-header`},ot={key:0,class:`sm-log-indicator`},st={class:`sm-log-body`,ref:`logBodyRef`},ct={key:0,class:`sm-empty`},lt={class:`sm-panel-header`},ut={key:0,class:`sm-badge sm-badge-amber`},dt={key:0,class:`sm-node-detail`},ft={class:`sm-node-name`},pt={class:`sm-node-file`},mt={key:0},ht={key:0,class:`sm-node-desc`},gt={class:`sm-panel-body sm-source-body`},_t={key:0,class:`sm-source-overlay`},vt={key:1,class:`sm-source-overlay sm-source-placeholder`},yt={class:`sm-gitnexus-dialog`},bt={class:`sm-gitnexus-intro`},xt={class:`sm-gitnexus-h`},St={class:`sm-gitnexus-cmd`},Ct={class:`sm-gitnexus-h`},wt={class:`sm-gitnexus-tip`},Tt={class:`sm-gitnexus-cmd`},Et={class:`sm-gitnexus-h`},Dt={class:`sm-gitnexus-cmd`},Ot={class:`sm-gitnexus-cmd`},kt={class:`sm-gitnexus-tip sm-gitnexus-tip--windows`},At={class:`sm-gitnexus-h`},jt={class:`sm-gitnexus-tip`},Mt={class:`sm-gitnexus-cmd`},Nt={class:`sm-gitnexus-h`},Pt={class:`sm-gitnexus-cmd`},Ft={viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"vertical-align":`-2px`,"margin-right":`4px`}},It=`https://github.com/abhigyanpatwari/GitNexus`,k=E(y({__name:`SourceMapView`,setup(e){let{theme:y}=_e(),E=oe(),O=_(E.currentDirectory||``),k=_(`idle`),A=_([]),Lt=0,j=_(null),M=_(null),N=_(`files`),P=_(``),F=_(``),I=_(!1),L=_([]),R=_(new Set),z=_({files:!0,graph:!0,source:!0}),B=_(!1),V=_(!1);function Rt(){window.open(It,`_blank`,`noopener,noreferrer`)}async function H(e){try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}re.success(T(`@SRCMAP:已复制到剪贴板`))}catch{re.warning(T(`@SRCMAP:复制失败,请手动选择`))}}let U=_(220),W=_(360),G=_(140),K=null,q=0,zt=0,J=0;function Y(e,t){K=e,q=t.clientX,zt=t.clientY,J=e===`files`?U.value:e===`source`?W.value:G.value,document.addEventListener(`mousemove`,Bt),document.addEventListener(`mouseup`,Vt),t.preventDefault()}function Bt(e){K&&(K===`files`?U.value=Math.max(120,Math.min(480,J+e.clientX-q)):K===`source`?W.value=Math.max(200,Math.min(700,J+q-e.clientX)):G.value=Math.max(60,Math.min(500,J+zt-e.clientY)))}function Vt(){K=null,document.removeEventListener(`mousemove`,Bt),document.removeEventListener(`mouseup`,Vt)}let Ht=_(null),X=ne(null),{fitView:Ut,setNodes:Wt,setEdges:Gt,getNodes:Kt,getEdges:qt,updateNodeInternals:Jt}=ue(),Z=S(()=>k.value===`scanning`||k.value===`analyzing`),Yt=S(()=>y.value===`dark`?`#334155`:`#cbd5e1`),Q=S(()=>j.value?.nodes.find(e=>e.id===M.value)??null),Xt=S(()=>{if(!j.value)return[];let e=new Map;for(let t of j.value.nodes){let n=t.subsystem??`__default__`;if(!e.has(n)){let r=j.value.subsystems?.find(e=>e.name===n);e.set(n,{displayName:r?.displayName||t.subsystem||T(`@SRCMAP:默认`),color:t.subsystemColor||Qt[0],nodes:[]})}e.get(n).nodes.push(t)}return[...e.entries()].map(([,e])=>e)});function $(e,t=`info`){A.value.push({id:++Lt,message:e,type:t,timestamp:Date.now()}),A.value.length>200&&A.value.splice(0,A.value.length-200)}function Zt(e){let t={name:``,path:``,kind:`dir`,children:[],childMap:new Map};for(let n of e){let e=n.trim().split(`/`).filter(Boolean),r=t,i=``;for(let t=0;t<e.length;t++){let n=e[t];i=i?`${i}/${n}`:n;let a=t===e.length-1,o=r.childMap.get(n);o||(o={name:n,path:i,kind:a?`file`:`dir`,children:[],childMap:new Map},r.childMap.set(n,o),r.children.push(o)),r=o}}let n=e=>{e.sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`dir`?-1:1),e.forEach(e=>{e.kind===`dir`&&n(e.children)})};return n(t.children),t.children}let Qt=[`#f59e0b`,`#3b82f6`,`#10b981`,`#8b5cf6`];function $t(e){return e.subsystemColor?e.subsystemColor:e.subsystemIndex===void 0?e.importance===`high`?`#f59e0b`:e.importance===`low`?`#94a3b8`:`#3b82f6`:Qt[e.subsystemIndex%Qt.length]}function en(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,svelte:`html`,html:`html`,py:`python`,java:`java`,go:`go`,rs:`rust`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,c:`c`,h:`c`,hpp:`cpp`,cs:`csharp`,rb:`ruby`,php:`php`,swift:`swift`,kt:`kotlin`,sh:`shell`,bash:`shell`,json:`json`,yaml:`yaml`,yml:`yaml`,md:`markdown`,css:`css`,scss:`scss`,less:`less`,sql:`sql`}[e.split(`.`).pop()?.toLowerCase()||``]||`plaintext`}function tn(){!Ht.value||X.value||(X.value=D.create(Ht.value,{value:``,language:`plaintext`,theme:y.value===`dark`?`vs-dark`:`vs`,readOnly:!0,fontSize:12,lineHeight:19,fontFamily:`'JetBrains Mono', 'Fira Code', Consolas, monospace`,minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,wordWrap:`off`,padding:{top:8,bottom:8},scrollbar:{verticalScrollbarSize:6,horizontalScrollbarSize:6}}))}c(y,e=>{X.value&&D.setTheme(e===`dark`?`vs-dark`:`vs`)});function nn(e,t){let n={};t.forEach(e=>{n[e.source]||(n[e.source]=[]),n[e.source].push(e.target)});let r=new Map;e.forEach(e=>{let t=e.subsystem??`__default`;r.has(t)||r.set(t,[]),r.get(t).push(e)});let i=[],a=0;for(let[,e]of r){let t=new Set(e.map(e=>e.id)),r={},o=e.length?[e[0].id]:[];for(o[0]&&(r[o[0]]=0);o.length;){let e=o.shift();(n[e]||[]).filter(e=>t.has(e)).forEach(t=>{r[t]===void 0&&(r[t]=(r[e]??0)+1,o.push(t))})}let s={};e.forEach(e=>{let t=r[e.id]??0;s[t]=(s[t]||0)+1});let c={};e.forEach(e=>{let t=r[e.id]??0;c[t]=(c[t]??-1)+1;let n=c[t],o=s[t]??1,l=a*600+n*220-(o-1)*220/2,u=t*110,d=$t(e);i.push({id:e.id,type:`default`,position:{x:l,y:u},label:e.label,class:`sm-fn-node`,data:{...e,_accentColor:d},style:{"--node-accent":d}})}),a++}return{flowNodes:i,flowEdges:t.map((e,t)=>({id:`e_${t}_${e.source}_${e.target}`,source:e.source,target:e.target,type:`smoothstep`,animated:!1,class:`sm-fn-edge`,markerEnd:{type:se.ArrowClosed}}))}}async function rn(){let e=Kt.value,t=qt.value;if(e.length!==0){B.value=!0;try{await o(),await new Promise(e=>requestAnimationFrame(()=>e())),Jt(e.map(e=>e.id)),await new Promise(e=>requestAnimationFrame(()=>e()));let n=new Map;e.forEach(e=>{let t=e.data?.subsystem??`__default__`;n.has(t)||n.set(t,[]),n.get(t).push(e)});let r=new Map,i=0;for(let[,e]of n){let n=new ve.default.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:`TB`,nodesep:55,ranksep:75,marginx:40,marginy:40});let a=new Set(e.map(e=>e.id));e.forEach(e=>{let t=190,r=e.data?.description?68:48,i=document.querySelector(`.vue-flow__node[data-id="${e.id}"]`);i&&i.offsetWidth>0&&(t=i.offsetWidth,r=i.offsetHeight),n.setNode(e.id,{width:t,height:r})}),t.forEach(e=>{a.has(e.source)&&a.has(e.target)&&n.setEdge(e.source,e.target)}),ve.default.layout(n);let o=0;e.forEach(e=>{let t=n.node(e.id);t&&(r.set(e.id,{x:i+t.x-t.width/2,y:t.y-t.height/2}),o=Math.max(o,t.x+t.width/2))}),i+=o+120}Wt(e.map(e=>({...e,position:r.get(e.id)??e.position}))),await o(),Ut({padding:.18})}finally{B.value=!1}}}async function an(){if(!O.value.trim()){re.warning(T(`@SRCMAP:请先输入项目路径`));return}if(!Z.value){A.value=[],j.value=null,M.value=null,P.value=``,F.value=``,Wt([]),Gt([]),k.value=`scanning`,$(T(`@SRCMAP:开始分析项目...`),`info`);try{let e=await fetch(`/api/code-analysis/analyze`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:O.value})});if(!e.ok){let t=await e.json().catch(()=>({error:`请求失败`}));throw Error(t.error||`HTTP ${e.status}`)}let t=e.body.getReader(),n=new TextDecoder,r=``;k.value=`analyzing`;let i=``,a=[];for(;;){let{done:e,value:o}=await t.read();if(e)break;r+=n.decode(o,{stream:!0});let s=r.split(`
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Br as t,Dn as n,En as r,G as i,Gn as a,In as o,M as s,Qn as c,Rr as l,Sn as u,Tn as d,U as ee,Un as f,Ur as p,Vn as m,_r as h,dn as g,dr as _,er as v,fn as te,fr as ne,i as re,kn as y,mn as b,tr as x,un as ie,vn as S,xn as C,yn as w,zn as ae}from"./element-plus-Cchqf1s7.js";import{n as T,t as E}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{t as oe}from"./configStore-DdYe2Jg3.js";import{gt as D}from"./monaco-43aputPh.js";import{a as se,c as ce,i as le,l as ue,n as de,o as fe,r as pe,s as me,t as he}from"./vue-flow-3jJr-V2W.js";import{b as ge,v as _e}from"./index-hyzLLFKf.js";import{t as O}from"./dagre-97WoLjFt.js";var ve=e(O(),1),ye={class:`source-map-view`},be={class:`sm-toolbar`},xe={class:`sm-toolbar-left`},Se={class:`sm-title`},Ce={class:`sm-toolbar-center`},we=[`placeholder`,`disabled`],Te=[`disabled`],Ee={class:`sm-toolbar-right`},De=[`aria-label`],Oe={class:`sm-body`},ke={class:`sm-panel-header sm-panel-header--tabs`},Ae={key:0,class:`sm-badge`},je={class:`sm-panel-body sm-file-tree`},Me=[`onClick`],Ne={key:1,class:`sm-tree-arrow-spacer`},Pe={key:2,class:`sm-tree-icon mit-icon`,"aria-hidden":`true`},Fe=[`xlink:href`],Ie={key:3,class:`sm-tree-icon mit-icon`,"aria-hidden":`true`},Le=[`xlink:href`],Re=[`title`],ze={key:1,class:`sm-tree-empty`},Be={class:`sm-panel-body sm-outline-body`},Ve={class:`sm-badge`,style:{"margin-left":`auto`}},He=[`onClick`],Ue=[`title`],We={key:0,class:`sm-outline-desc`},Ge={key:1,class:`sm-tree-empty`},Ke={class:`sm-panel sm-panel-graph`},qe={key:0,class:`sm-project-info`},Je={class:`sm-lang-badge`},Ye={class:`sm-summary-text`},Xe={class:`sm-graph-container`},Ze={class:`sm-layout-btn-wrap`},Qe=[`disabled`],$e=[`title`],et={class:`sm-fn-label`},tt={key:0,class:`sm-fn-desc`},nt={key:0,class:`sm-graph-empty`},rt={viewBox:`0 0 24 24`,width:`48`,height:`48`,fill:`none`,stroke:`currentColor`,"stroke-width":`1`,style:{opacity:`0.3`}},it={key:1,class:`sm-graph-loading`},at={class:`sm-log-header`},ot={key:0,class:`sm-log-indicator`},st={class:`sm-log-body`,ref:`logBodyRef`},ct={key:0,class:`sm-empty`},lt={class:`sm-panel-header`},ut={key:0,class:`sm-badge sm-badge-amber`},dt={key:0,class:`sm-node-detail`},ft={class:`sm-node-name`},pt={class:`sm-node-file`},mt={key:0},ht={key:0,class:`sm-node-desc`},gt={class:`sm-panel-body sm-source-body`},_t={key:0,class:`sm-source-overlay`},vt={key:1,class:`sm-source-overlay sm-source-placeholder`},yt={class:`sm-gitnexus-dialog`},bt={class:`sm-gitnexus-intro`},xt={class:`sm-gitnexus-h`},St={class:`sm-gitnexus-cmd`},Ct={class:`sm-gitnexus-h`},wt={class:`sm-gitnexus-tip`},Tt={class:`sm-gitnexus-cmd`},Et={class:`sm-gitnexus-h`},Dt={class:`sm-gitnexus-cmd`},Ot={class:`sm-gitnexus-cmd`},kt={class:`sm-gitnexus-tip sm-gitnexus-tip--windows`},At={class:`sm-gitnexus-h`},jt={class:`sm-gitnexus-tip`},Mt={class:`sm-gitnexus-cmd`},Nt={class:`sm-gitnexus-h`},Pt={class:`sm-gitnexus-cmd`},Ft={viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,style:{"vertical-align":`-2px`,"margin-right":`4px`}},It=`https://github.com/abhigyanpatwari/GitNexus`,k=E(y({__name:`SourceMapView`,setup(e){let{theme:y}=_e(),E=oe(),O=_(E.currentDirectory||``),k=_(`idle`),A=_([]),Lt=0,j=_(null),M=_(null),N=_(`files`),P=_(``),F=_(``),I=_(!1),L=_([]),R=_(new Set),z=_({files:!0,graph:!0,source:!0}),B=_(!1),V=_(!1);function Rt(){window.open(It,`_blank`,`noopener,noreferrer`)}async function H(e){try{if(navigator.clipboard?.writeText)await navigator.clipboard.writeText(e);else{let t=document.createElement(`textarea`);t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t)}re.success(T(`@SRCMAP:已复制到剪贴板`))}catch{re.warning(T(`@SRCMAP:复制失败,请手动选择`))}}let U=_(220),W=_(360),G=_(140),K=null,q=0,zt=0,J=0;function Y(e,t){K=e,q=t.clientX,zt=t.clientY,J=e===`files`?U.value:e===`source`?W.value:G.value,document.addEventListener(`mousemove`,Bt),document.addEventListener(`mouseup`,Vt),t.preventDefault()}function Bt(e){K&&(K===`files`?U.value=Math.max(120,Math.min(480,J+e.clientX-q)):K===`source`?W.value=Math.max(200,Math.min(700,J+q-e.clientX)):G.value=Math.max(60,Math.min(500,J+zt-e.clientY)))}function Vt(){K=null,document.removeEventListener(`mousemove`,Bt),document.removeEventListener(`mouseup`,Vt)}let Ht=_(null),X=ne(null),{fitView:Ut,setNodes:Wt,setEdges:Gt,getNodes:Kt,getEdges:qt,updateNodeInternals:Jt}=ue(),Z=S(()=>k.value===`scanning`||k.value===`analyzing`),Yt=S(()=>y.value===`dark`?`#334155`:`#cbd5e1`),Q=S(()=>j.value?.nodes.find(e=>e.id===M.value)??null),Xt=S(()=>{if(!j.value)return[];let e=new Map;for(let t of j.value.nodes){let n=t.subsystem??`__default__`;if(!e.has(n)){let r=j.value.subsystems?.find(e=>e.name===n);e.set(n,{displayName:r?.displayName||t.subsystem||T(`@SRCMAP:默认`),color:t.subsystemColor||Qt[0],nodes:[]})}e.get(n).nodes.push(t)}return[...e.entries()].map(([,e])=>e)});function $(e,t=`info`){A.value.push({id:++Lt,message:e,type:t,timestamp:Date.now()}),A.value.length>200&&A.value.splice(0,A.value.length-200)}function Zt(e){let t={name:``,path:``,kind:`dir`,children:[],childMap:new Map};for(let n of e){let e=n.trim().split(`/`).filter(Boolean),r=t,i=``;for(let t=0;t<e.length;t++){let n=e[t];i=i?`${i}/${n}`:n;let a=t===e.length-1,o=r.childMap.get(n);o||(o={name:n,path:i,kind:a?`file`:`dir`,children:[],childMap:new Map},r.childMap.set(n,o),r.children.push(o)),r=o}}let n=e=>{e.sort((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`dir`?-1:1),e.forEach(e=>{e.kind===`dir`&&n(e.children)})};return n(t.children),t.children}let Qt=[`#f59e0b`,`#3b82f6`,`#10b981`,`#8b5cf6`];function $t(e){return e.subsystemColor?e.subsystemColor:e.subsystemIndex===void 0?e.importance===`high`?`#f59e0b`:e.importance===`low`?`#94a3b8`:`#3b82f6`:Qt[e.subsystemIndex%Qt.length]}function en(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jsx:`javascript`,vue:`html`,svelte:`html`,html:`html`,py:`python`,java:`java`,go:`go`,rs:`rust`,cpp:`cpp`,cc:`cpp`,cxx:`cpp`,c:`c`,h:`c`,hpp:`cpp`,cs:`csharp`,rb:`ruby`,php:`php`,swift:`swift`,kt:`kotlin`,sh:`shell`,bash:`shell`,json:`json`,yaml:`yaml`,yml:`yaml`,md:`markdown`,css:`css`,scss:`scss`,less:`less`,sql:`sql`}[e.split(`.`).pop()?.toLowerCase()||``]||`plaintext`}function tn(){!Ht.value||X.value||(X.value=D.create(Ht.value,{value:``,language:`plaintext`,theme:y.value===`dark`?`vs-dark`:`vs`,readOnly:!0,fontSize:12,lineHeight:19,fontFamily:`'JetBrains Mono', 'Fira Code', Consolas, monospace`,minimap:{enabled:!1},scrollBeyondLastLine:!1,automaticLayout:!0,wordWrap:`off`,padding:{top:8,bottom:8},scrollbar:{verticalScrollbarSize:6,horizontalScrollbarSize:6}}))}c(y,e=>{X.value&&D.setTheme(e===`dark`?`vs-dark`:`vs`)});function nn(e,t){let n={};t.forEach(e=>{n[e.source]||(n[e.source]=[]),n[e.source].push(e.target)});let r=new Map;e.forEach(e=>{let t=e.subsystem??`__default`;r.has(t)||r.set(t,[]),r.get(t).push(e)});let i=[],a=0;for(let[,e]of r){let t=new Set(e.map(e=>e.id)),r={},o=e.length?[e[0].id]:[];for(o[0]&&(r[o[0]]=0);o.length;){let e=o.shift();(n[e]||[]).filter(e=>t.has(e)).forEach(t=>{r[t]===void 0&&(r[t]=(r[e]??0)+1,o.push(t))})}let s={};e.forEach(e=>{let t=r[e.id]??0;s[t]=(s[t]||0)+1});let c={};e.forEach(e=>{let t=r[e.id]??0;c[t]=(c[t]??-1)+1;let n=c[t],o=s[t]??1,l=a*600+n*220-(o-1)*220/2,u=t*110,d=$t(e);i.push({id:e.id,type:`default`,position:{x:l,y:u},label:e.label,class:`sm-fn-node`,data:{...e,_accentColor:d},style:{"--node-accent":d}})}),a++}return{flowNodes:i,flowEdges:t.map((e,t)=>({id:`e_${t}_${e.source}_${e.target}`,source:e.source,target:e.target,type:`smoothstep`,animated:!1,class:`sm-fn-edge`,markerEnd:{type:se.ArrowClosed}}))}}async function rn(){let e=Kt.value,t=qt.value;if(e.length!==0){B.value=!0;try{await o(),await new Promise(e=>requestAnimationFrame(()=>e())),Jt(e.map(e=>e.id)),await new Promise(e=>requestAnimationFrame(()=>e()));let n=new Map;e.forEach(e=>{let t=e.data?.subsystem??`__default__`;n.has(t)||n.set(t,[]),n.get(t).push(e)});let r=new Map,i=0;for(let[,e]of n){let n=new ve.default.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:`TB`,nodesep:55,ranksep:75,marginx:40,marginy:40});let a=new Set(e.map(e=>e.id));e.forEach(e=>{let t=190,r=e.data?.description?68:48,i=document.querySelector(`.vue-flow__node[data-id="${e.id}"]`);i&&i.offsetWidth>0&&(t=i.offsetWidth,r=i.offsetHeight),n.setNode(e.id,{width:t,height:r})}),t.forEach(e=>{a.has(e.source)&&a.has(e.target)&&n.setEdge(e.source,e.target)}),ve.default.layout(n);let o=0;e.forEach(e=>{let t=n.node(e.id);t&&(r.set(e.id,{x:i+t.x-t.width/2,y:t.y-t.height/2}),o=Math.max(o,t.x+t.width/2))}),i+=o+120}Wt(e.map(e=>({...e,position:r.get(e.id)??e.position}))),await o(),Ut({padding:.18})}finally{B.value=!1}}}async function an(){if(!O.value.trim()){re.warning(T(`@SRCMAP:请先输入项目路径`));return}if(!Z.value){A.value=[],j.value=null,M.value=null,P.value=``,F.value=``,Wt([]),Gt([]),k.value=`scanning`,$(T(`@SRCMAP:开始分析项目...`),`info`);try{let e=await fetch(`/api/code-analysis/analyze`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:O.value})});if(!e.ok){let t=await e.json().catch(()=>({error:`请求失败`}));throw Error(t.error||`HTTP ${e.status}`)}let t=e.body.getReader(),n=new TextDecoder,r=``;k.value=`analyzing`;let i=``,a=[];for(;;){let{done:e,value:o}=await t.read();if(e)break;r+=n.decode(o,{stream:!0});let s=r.split(`
2
2
  `);r=s.pop()??``;for(let e of s)if(e.startsWith(`event:`))i=e.slice(6).trim(),a=[];else if(e.startsWith(`data:`))a.push(e.slice(5).trim());else if(e===``){if(i&&a.length){let e=a.join(``);try{let t=JSON.parse(e);on(i,t)}catch{}}i=``,a=[]}}}catch(e){$(`${T(`@SRCMAP:分析失败`)}: ${e.message}`,`error`),k.value=`error`}}}function on(e,t){if(e===`log`)$(t.message,t.type||`info`);else if(e===`files`)L.value=Zt(t.files||[]),L.value.forEach(e=>{e.kind===`dir`&&R.value.add(e.path)});else if(e===`result`){j.value={language:t.language||``,entryFile:t.entryFile||``,entryFunction:t.entryFunction||``,nodes:Array.isArray(t.nodes)?t.nodes:[],edges:Array.isArray(t.edges)?t.edges:[],techStack:Array.isArray(t.techStack)?t.techStack:[],summary:t.summary||``,allFiles:Array.isArray(t.allFiles)?t.allFiles:[],codeFiles:Array.isArray(t.codeFiles)?t.codeFiles:[],subsystems:Array.isArray(t.subsystems)?t.subsystems:void 0};let{flowNodes:e,flowEdges:n}=nn(j.value.nodes,j.value.edges);Wt(e),Gt(n),o(()=>rn())}else e===`done`&&(t.error?($(`${T(`@SRCMAP:分析失败`)}: ${t.error}`,`error`),k.value=`error`):k.value=`done`)}async function sn(e){if(!(!e||I.value)&&F.value!==e){I.value=!0,F.value=e,P.value=``;try{let t=await(await fetch(`/api/code-analysis/file-content?path=${encodeURIComponent(O.value)}&file=${encodeURIComponent(e)}`)).json();if(t.error)throw Error(t.error);P.value=t.content||``}catch(e){P.value=`// ${T(`@SRCMAP:加载失败`)}: ${e.message}`}finally{I.value=!1}}}function cn(e){let t=e.node.data;M.value=t.id,t.file&&sn(t.file)}function ln(e){R.value.has(e)?R.value.delete(e):R.value.add(e)}let un=S(()=>{let e=[];function t(n,r){for(let i of n){let n=R.value.has(i.path);e.push({name:i.name,path:i.path,kind:i.kind,depth:r,expanded:n}),i.kind===`dir`&&n&&t(i.children,r+1)}}return t(L.value,0),e});return c(()=>E.currentDirectory,e=>{e&&!O.value&&(O.value=e)}),c([P,F],([e,t])=>{let n=X.value;if(!n)return;let r=en(t||``),i=n.getModel(),a=D.createModel(e||``,r);n.setModel(a),i?.dispose(),n.setScrollPosition({scrollTop:0,scrollLeft:0})}),m(()=>{tn(),!O.value&&E.currentDirectory&&(O.value=E.currentDirectory)}),ae(()=>{X.value?.getModel()?.dispose(),X.value?.dispose(),Vt()}),(e,o)=>{let c=i,m=ee;return f(),u(`div`,ye,[w(`div`,be,[w(`div`,xe,[o[18]||=w(`svg`,{viewBox:`0 0 24 24`,width:`18`,height:`18`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,class:`sm-icon-map`},[w(`polygon`,{points:`3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21`}),w(`line`,{x1:`9`,y1:`3`,x2:`9`,y2:`18`}),w(`line`,{x1:`15`,y1:`6`,x2:`15`,y2:`21`})],-1),w(`span`,Se,p(h(T)(`@SRCMAP:源码地图`)),1)]),w(`div`,Ce,[x(w(`input`,{"onUpdate:modelValue":o[0]||=e=>O.value=e,class:`sm-path-input`,placeholder:h(T)(`@SRCMAP:输入项目目录路径`),disabled:Z.value,onKeydown:te(an,[`enter`])},null,40,we),[[ie,O.value]]),w(`button`,{class:`sm-btn sm-btn-primary`,disabled:Z.value,onClick:an},[Z.value?(f(),u(b,{key:0},[o[19]||=w(`span`,{class:`sm-spinner`},null,-1),r(` `+p(h(T)(`@SRCMAP:分析中...`)),1)],64)):(f(),u(b,{key:1},[r(p(k.value===`done`?h(T)(`@SRCMAP:重新分析`):h(T)(`@SRCMAP:开始分析`)),1)],64))],8,Te)]),w(`div`,Ee,[n(c,{content:h(T)(`@SRCMAP:推荐安装 GitNexus - 更强的代码知识图谱 MCP`),placement:`bottom`},{default:v(()=>[w(`button`,{class:`sm-panel-btn sm-gitnexus-btn`,"aria-label":h(T)(`@SRCMAP:推荐安装 GitNexus`),onClick:o[1]||=e=>V.value=!0},o[20]||=[w(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[w(`circle`,{cx:`6`,cy:`6`,r:`2.5`}),w(`circle`,{cx:`18`,cy:`6`,r:`2.5`}),w(`circle`,{cx:`6`,cy:`18`,r:`2.5`}),w(`circle`,{cx:`18`,cy:`18`,r:`2.5`}),w(`circle`,{cx:`12`,cy:`12`,r:`2.5`}),w(`line`,{x1:`8`,y1:`7.5`,x2:`10.5`,y2:`10.5`}),w(`line`,{x1:`16`,y1:`7.5`,x2:`13.5`,y2:`10.5`}),w(`line`,{x1:`8`,y1:`16.5`,x2:`10.5`,y2:`13.5`}),w(`line`,{x1:`16`,y1:`16.5`,x2:`13.5`,y2:`13.5`})],-1)],8,De)]),_:1},8,[`content`]),n(c,{content:h(T)(`@SRCMAP:文件列表`),placement:`bottom`},{default:v(()=>[w(`button`,{class:l([`sm-panel-btn`,{active:z.value.files}]),onClick:o[2]||=e=>z.value.files=!z.value.files},o[21]||=[w(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[w(`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`})],-1)],2)]),_:1},8,[`content`]),n(c,{content:h(T)(`@SRCMAP:调用图`),placement:`bottom`},{default:v(()=>[w(`button`,{class:l([`sm-panel-btn`,{active:z.value.graph}]),onClick:o[3]||=e=>z.value.graph=!z.value.graph},o[22]||=[w(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[w(`circle`,{cx:`12`,cy:`12`,r:`3`}),w(`circle`,{cx:`3`,cy:`6`,r:`2`}),w(`circle`,{cx:`21`,cy:`6`,r:`2`}),w(`circle`,{cx:`3`,cy:`18`,r:`2`}),w(`circle`,{cx:`21`,cy:`18`,r:`2`}),w(`line`,{x1:`5`,y1:`6`,x2:`9`,y2:`11`}),w(`line`,{x1:`19`,y1:`6`,x2:`15`,y2:`11`}),w(`line`,{x1:`5`,y1:`18`,x2:`9`,y2:`13`}),w(`line`,{x1:`19`,y1:`18`,x2:`15`,y2:`13`})],-1)],2)]),_:1},8,[`content`]),n(c,{content:h(T)(`@SRCMAP:源码面板`),placement:`bottom`},{default:v(()=>[w(`button`,{class:l([`sm-panel-btn`,{active:z.value.source}]),onClick:o[4]||=e=>z.value.source=!z.value.source},o[23]||=[w(`svg`,{viewBox:`0 0 24 24`,width:`16`,height:`16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[w(`polyline`,{points:`16 18 22 12 16 6`}),w(`polyline`,{points:`8 6 2 12 8 18`})],-1)],2)]),_:1},8,[`content`])])]),w(`div`,Oe,[x(w(`div`,{class:`sm-panel sm-panel-files`,style:t({width:U.value+`px`})},[w(`div`,ke,[w(`button`,{class:l([`sm-tab-btn`,{active:N.value===`files`}]),onClick:o[5]||=e=>N.value=`files`},[o[24]||=w(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[w(`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`})],-1),r(` `+p(h(T)(`@SRCMAP:文件列表`))+` `,1),j.value?(f(),u(`span`,Ae,p(j.value.allFiles.length),1)):C(``,!0)],2),w(`button`,{class:l([`sm-tab-btn`,{active:N.value===`outline`}]),onClick:o[6]||=e=>N.value=`outline`},[o[25]||=d(`<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.8" data-v-d4696b78><line x1="8" y1="6" x2="21" y2="6" data-v-d4696b78></line><line x1="8" y1="12" x2="21" y2="12" data-v-d4696b78></line><line x1="8" y1="18" x2="21" y2="18" data-v-d4696b78></line><line x1="3" y1="6" x2="3.01" y2="6" data-v-d4696b78></line><line x1="3" y1="12" x2="3.01" y2="12" data-v-d4696b78></line><line x1="3" y1="18" x2="3.01" y2="18" data-v-d4696b78></line></svg>`,1),r(` `+p(h(T)(`@SRCMAP:大纲`)),1)],2)]),x(w(`div`,je,[un.value.length>0?(f(!0),u(b,{key:0},a(un.value,e=>(f(),u(`div`,{key:e.path,class:l([`sm-tree-node`,{"sm-tree-node--dir":e.kind===`dir`,"sm-tree-node--active":e.kind===`file`&&F.value===e.path}]),style:t({paddingLeft:10+e.depth*14+`px`}),onClick:t=>e.kind===`dir`?ln(e.path):sn(e.path)},[e.kind===`dir`?(f(),u(`span`,{key:0,class:l([`sm-tree-arrow`,{expanded:e.expanded}])},o[26]||=[w(`svg`,{viewBox:`0 0 24 24`,width:`10`,height:`10`,fill:`none`,stroke:`currentColor`,"stroke-width":`2.5`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[w(`polyline`,{points:`9 18 15 12 9 6`})],-1)],2)):(f(),u(`span`,Ne)),e.kind===`dir`?(f(),u(`svg`,Pe,[w(`use`,{"xlink:href":`#${h(ge)(e.name)||`icon-folder`}`},null,8,Fe)])):(f(),u(`svg`,Ie,[w(`use`,{"xlink:href":`#${h(ge)(e.name)}`},null,8,Le)])),w(`span`,{class:`sm-tree-name`,title:e.path},p(e.name),9,Re)],14,Me))),128)):(f(),u(`div`,ze,p(h(T)(`@SRCMAP:暂无文件,请先开始分析`)),1))],512),[[g,N.value===`files`]]),x(w(`div`,Be,[Xt.value.length>0?(f(!0),u(b,{key:0},a(Xt.value,e=>(f(),u(`div`,{key:e.displayName,class:`sm-outline-group`},[w(`div`,{class:`sm-outline-group-header`,style:t({color:e.color})},[o[27]||=w(`svg`,{viewBox:`0 0 24 24`,width:`8`,height:`8`,fill:`currentColor`},[w(`circle`,{cx:`12`,cy:`12`,r:`6`})],-1),r(` `+p(e.displayName)+` `,1),w(`span`,Ve,p(e.nodes.length),1)],4),(f(!0),u(b,null,a(e.nodes,n=>(f(),u(`div`,{key:n.id,class:l([`sm-outline-node`,{"sm-outline-node--active":M.value===n.id}]),onClick:e=>{M.value=n.id,n.file&&sn(n.file)}},[w(`span`,{class:`sm-outline-dot`,style:t({background:e.color})},null,4),w(`span`,{class:`sm-outline-label`,title:n.file||n.label},p(n.label),9,Ue),n.description?(f(),u(`span`,We,p(n.description.length>18?n.description.slice(0,18)+`…`:n.description),1)):C(``,!0)],10,He))),128))]))),128)):(f(),u(`div`,Ge,p(h(T)(`@SRCMAP:暂无分析结果`)),1))],512),[[g,N.value===`outline`]])],4),[[g,z.value.files]]),x(w(`div`,{class:`sm-resizer sm-resizer-v`,onMousedown:o[7]||=e=>Y(`files`,e)},null,544),[[g,z.value.files&&z.value.graph]]),x(w(`div`,Ke,[j.value?(f(),u(`div`,qe,[w(`span`,Je,p(j.value.language),1),j.value.subsystems&&j.value.subsystems.length>1?(f(!0),u(b,{key:0},a(j.value.subsystems,e=>(f(),u(`span`,{key:e.name,class:`sm-subsystem-tag`,style:t({borderColor:e.color,color:e.color})},`● `+p(e.displayName||e.name),5))),128)):(f(!0),u(b,{key:1},a(j.value.techStack.slice(0,4),e=>(f(),u(`span`,{key:e,class:`sm-tech-tag`},p(e),1))),128)),w(`span`,Ye,p(j.value.summary),1)])):C(``,!0),w(`div`,Xe,[w(`div`,Ze,[w(`button`,{class:`sm-layout-btn`,disabled:B.value||!j.value,onClick:rn},[o[28]||=d(`<svg viewBox="0 0 24 24" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.8" data-v-d4696b78><rect x="3" y="3" width="7" height="7" rx="1" data-v-d4696b78></rect><rect x="14" y="3" width="7" height="7" rx="1" data-v-d4696b78></rect><rect x="3" y="14" width="7" height="7" rx="1" data-v-d4696b78></rect><rect x="14" y="14" width="7" height="7" rx="1" data-v-d4696b78></rect></svg>`,1),r(` `+p(B.value?h(T)(`@SRCMAP:布局中...`):h(T)(`@SRCMAP:优化布局`)),1)],8,Qe)]),n(h(me),{class:`sm-vue-flow`,"default-viewport":{zoom:1},"min-zoom":.2,"max-zoom":4,"fit-view-on-init":``,onNodeClick:cn},{"node-default":v(({data:e,label:t})=>[n(h(ce),{type:`target`,position:h(fe).Top},null,8,[`position`]),w(`div`,{class:`sm-fn-inner`,title:`${t}${e?.description?`
3
3
  `+e.description:``}`},[w(`div`,et,p(t),1),e?.description?(f(),u(`div`,tt,p(e.description.length>22?e.description.slice(0,22)+`…`:e.description),1)):C(``,!0)],8,$e),n(h(ce),{type:`source`,position:h(fe).Bottom},null,8,[`position`])]),default:v(()=>[n(h(le),{variant:h(pe).Dots,gap:20,size:1,"pattern-color":Yt.value},null,8,[`variant`,`pattern-color`]),n(h(de)),n(h(he),{"node-color":`#3b82f6`,"mask-color":h(y)===`dark`?`rgba(0,0,0,0.55)`:`rgba(15,23,42,0.06)`},null,8,[`mask-color`])]),_:1}),!j.value&&!Z.value?(f(),u(`div`,nt,[(f(),u(`svg`,rt,o[29]||=[w(`polygon`,{points:`3 6 9 3 15 6 21 3 21 18 15 21 9 18 3 21`},null,-1),w(`line`,{x1:`9`,y1:`3`,x2:`9`,y2:`18`},null,-1),w(`line`,{x1:`15`,y1:`6`,x2:`15`,y2:`21`},null,-1)])),w(`p`,null,p(h(T)(`@SRCMAP:输入项目路径后点击开始分析`)),1)])):C(``,!0),Z.value&&!j.value?(f(),u(`div`,it,[o[30]||=w(`span`,{class:`sm-spinner sm-spinner-lg`},null,-1),w(`p`,null,p(h(T)(`@SRCMAP:AI 正在分析项目结构...`)),1)])):C(``,!0)]),w(`div`,{class:`sm-resizer sm-resizer-h`,onMousedown:o[8]||=e=>Y(`log`,e)},null,32),w(`div`,{class:`sm-log-panel`,style:t({height:G.value+`px`})},[w(`div`,at,[o[31]||=w(`svg`,{viewBox:`0 0 24 24`,width:`12`,height:`12`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[w(`polyline`,{points:`4 17 10 11 4 5`}),w(`line`,{x1:`12`,y1:`19`,x2:`20`,y2:`19`})],-1),r(` `+p(h(T)(`@SRCMAP:Agent 日志`))+` `,1),Z.value?(f(),u(`span`,ot)):C(``,!0)]),w(`div`,st,[(f(!0),u(b,null,a(A.value.slice(-50),e=>(f(),u(`div`,{key:e.id,class:l([`sm-log-entry`,`sm-log-entry--${e.type}`])},p(e.message),3))),128)),A.value.length===0?(f(),u(`div`,ct,p(h(T)(`@SRCMAP:等待开始分析`)),1)):C(``,!0)],512)],4)],512),[[g,z.value.graph]]),x(w(`div`,{class:`sm-resizer sm-resizer-v`,onMousedown:o[9]||=e=>Y(`source`,e)},null,544),[[g,z.value.graph&&z.value.source]]),x(w(`div`,{class:`sm-panel sm-panel-source`,style:t({width:W.value+`px`})},[w(`div`,lt,[o[32]||=w(`svg`,{viewBox:`0 0 24 24`,width:`13`,height:`13`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`},[w(`polyline`,{points:`16 18 22 12 16 6`}),w(`polyline`,{points:`8 6 2 12 8 18`})],-1),r(` `+p(F.value||h(T)(`@SRCMAP:源码面板`))+` `,1),Q.value?(f(),u(`span`,ut,p(Q.value.label),1)):C(``,!0)]),Q.value?(f(),u(`div`,dt,[w(`div`,ft,p(Q.value.label),1),w(`div`,pt,[r(p(Q.value.file),1),Q.value.line?(f(),u(`span`,mt,` :`+p(Q.value.line),1)):C(``,!0)]),Q.value.description?(f(),u(`div`,ht,p(Q.value.description),1)):C(``,!0)])):C(``,!0),w(`div`,gt,[I.value?(f(),u(`div`,_t,o[33]||=[w(`span`,{class:`sm-spinner`},null,-1)])):C(``,!0),!I.value&&!P.value?(f(),u(`div`,vt,p(h(T)(`@SRCMAP:点击调用图中的节点查看源码`)),1)):C(``,!0),w(`div`,{ref_key:`monacoContainerRef`,ref:Ht,class:`sm-monaco-container`},null,512)])],4),[[g,z.value.source]])]),n(h(s),{modelValue:V.value,"onUpdate:modelValue":o[17]||=e=>V.value=e,title:h(T)(`@SRCMAP:推荐安装 GitNexus`),width:`640px`,"close-on-click-modal":!0,"show-close":!0,"align-center":``,"destroy-on-close":``},{footer:v(()=>[n(m,{onClick:o[16]||=e=>V.value=!1},{default:v(()=>[r(p(h(T)(`@SRCMAP:关闭`)),1)]),_:1}),n(m,{type:`primary`,onClick:Rt},{default:v(()=>[(f(),u(`svg`,Ft,o[40]||=[w(`path`,{d:`M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22`},null,-1)])),r(` `+p(h(T)(`@SRCMAP:查看 GitHub 仓库`)),1)]),_:1})]),default:v(()=>[w(`div`,yt,[w(`p`,bt,p(h(T)(`@SRCMAP:GitNexus 是把代码库索引为知识图谱的开源工具,通过 MCP 协议喂给 Claude Code / Cursor 等 AI 助手,让它们在动手改代码前就能完整感知项目结构与调用链。`)),1),w(`h4`,xt,p(h(T)(`@SRCMAP:安装 GitNexus`)),1),w(`div`,St,[o[34]||=w(`code`,null,`npm install -g gitnexus`,-1),n(m,{size:`small`,type:`primary`,plain:``,onClick:o[10]||=e=>H(`npm install -g gitnexus`)},{default:v(()=>[r(p(h(T)(`@SRCMAP:复制`)),1)]),_:1})]),w(`h4`,Ct,p(h(T)(`@SRCMAP:一键配置编辑器 MCP`)),1),w(`p`,wt,p(h(T)(`@SRCMAP:自动检测本机已装的 Cursor / Claude Code / OpenCode / Codex / Windsurf 等编辑器,写入 MCP 配置并安装 Skill。`)),1),w(`div`,Tt,[o[35]||=w(`code`,null,`gitnexus setup`,-1),n(m,{size:`small`,type:`primary`,plain:``,onClick:o[11]||=e=>H(`gitnexus setup`)},{default:v(()=>[r(p(h(T)(`@SRCMAP:复制`)),1)]),_:1})]),w(`h4`,Et,p(h(T)(`@SRCMAP:仅配置 Claude Code`)),1),w(`div`,Dt,[o[36]||=w(`code`,null,`claude mcp add gitnexus -- gitnexus mcp`,-1),n(m,{size:`small`,type:`primary`,plain:``,onClick:o[12]||=e=>H(`claude mcp add gitnexus -- gitnexus mcp`)},{default:v(()=>[r(p(h(T)(`@SRCMAP:复制`)),1)]),_:1})]),w(`div`,Ot,[o[37]||=w(`code`,null,`claude mcp add gitnexus -- cmd /c gitnexus mcp`,-1),n(m,{size:`small`,type:`primary`,plain:``,onClick:o[13]||=e=>H(`claude mcp add gitnexus -- cmd /c gitnexus mcp`)},{default:v(()=>[r(p(h(T)(`@SRCMAP:复制`)),1)]),_:1})]),w(`p`,kt,p(h(T)(`@SRCMAP:第二行为 Windows 专用。配置后需完全退出再重启 Claude Code,MCP server 才生效。`)),1),w(`h4`,At,p(h(T)(`@SRCMAP:索引当前项目`)),1),w(`p`,jt,p(h(T)(`@SRCMAP:推荐用完整索引 —— 含语义搜索与每个功能社区的 SKILL.md。`)),1),w(`div`,Mt,[o[38]||=w(`code`,null,`gitnexus analyze --embeddings --skills --verbose`,-1),n(m,{size:`small`,type:`primary`,plain:``,onClick:o[14]||=e=>H(`gitnexus analyze --embeddings --skills --verbose`)},{default:v(()=>[r(p(h(T)(`@SRCMAP:复制`)),1)]),_:1})]),w(`h4`,Nt,p(h(T)(`@SRCMAP:验证安装`)),1),w(`div`,Pt,[o[39]||=w(`code`,null,`gitnexus --version`,-1),n(m,{size:`small`,type:`primary`,plain:``,onClick:o[15]||=e=>H(`gitnexus --version`)},{default:v(()=>[r(p(h(T)(`@SRCMAP:复制`)),1)]),_:1})])])]),_:1},8,[`modelValue`,`title`])])}}}),[[`__scopeId`,`data-v-d4696b78`]]);export{k as default};
@@ -1,4 +1,4 @@
1
- import"./rolldown-runtime-BM3Ffeng.js";import{$ as e,B as t,Br as n,C as r,Dn as i,Dt as a,E as o,En as s,F as c,Ft as l,Gn as u,I as d,In as f,It as p,J as m,Jn as h,M as g,Mt as _,Nt as v,Qn as y,Qt as b,R as x,Rr as S,S as ee,Sn as C,T as w,Tn as T,Tt as te,U as ne,Un as E,Ur as D,V as O,Vn as k,X as re,Y as A,Yt as j,_r as M,a as N,at as ie,b as ae,bn as P,c as oe,ct as F,d as se,dn as ce,dr as I,er as L,f as le,fn as ue,ft as de,gn as R,h as fe,i as z,it as B,j as V,kn as H,ln as pe,lr as me,mn as U,nn as he,nt as W,pn as G,q as ge,r as _e,rt as ve,st as ye,tr as be,un as xe,ut as Se,vn as K,vt as Ce,w as we,wt as Te,x as Ee,xn as q,y as De,yn as J,zn as Oe}from"./element-plus-Cchqf1s7.js";import{a as ke,i as Ae,n as je}from"./vendor-FHXYVNcm.js";import{n as Y,t as Me}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{n as X,t as Ne}from"./toolsStore-C0VjU2dD.js";import{t as Pe}from"./configStore-DdYe2Jg3.js";import{a as Z}from"./index-D-n9_1ON.js";var Fe={class:`ai-split-direct-pane`},Ie={key:0,class:`ai-split-status`},Le={key:1,class:`ai-split-status`},Re={key:1},ze={key:2},Be={key:2,class:`ai-split-status is-error`},Ve={key:3,class:`ai-split-idle`},Q={class:`ai-split-idle__title`},$={class:`ai-split-idle__desc`},He={class:`ai-split-prompt-actions`},Ue={key:0,class:`ai-split-prompt-editor`},We={class:`ai-split-prompt-editor__actions`},Ge={key:1,class:`ai-split-pre`},Ke={class:`ai-split-subhead`},qe={class:`ai-split-user-actions`},Je={key:3,class:`ai-split-pre`},Ye={key:0,class:`ai-split-tab-count`},Xe={class:`ai-split-pre ai-split-pre--think`},Ze={key:0,class:`ai-split-tab-count`},Qe={class:`ai-split-parse-error__detail`},$e={class:`ai-split-parse-error__hint`},et={class:`ai-split-parse-error__actions`},tt={key:1,class:`ai-split-raw-toolbar`},nt={class:`ai-split-raw-tip`},rt={key:0,class:`ai-split-tab-count`},it={key:0,class:`ai-split-empty`},at={key:1,class:`ai-split-list`},ot={class:`ai-split-list__no`},st={class:`ai-split-list__body`},ct={class:`ai-split-list__title`},lt={class:`ai-split-list__desc`},ut={key:5,class:`ai-split-footer-hint`},dt={class:`ai-split-direct-footer`},ft=Me(H({__name:`AISplitDirectPane`,props:{title:{},desc:{},taskId:{},promptId:{}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,a=I(`idle`),o=I(`prompt`),c=I(``),d=I(``),f=I(``),p=I(``),h=I(``),g=I([]),_=I(``),v=I(``),b=I(``),x=null,S=0,ee=K(()=>f.value.length),w=K(()=>p.value.length),O=K(()=>a.value===`result`&&g.value.length>0),k=K(()=>a.value===`running`),re=K(()=>a.value===`preview`),A=I(``),j=I(!1);function N(){x&&=(x.abort(),null)}function ie(){N(),a.value=`idle`,o.value=`prompt`,c.value=``,d.value=``,A.value=``,f.value=``,p.value=``,h.value=``,g.value=[],_.value=``,v.value=``,b.value=``}async function ae(){if(!n.title.trim()){z.warning(Y(`@WORKBENCH:请先填写任务标题`));return}ie(),a.value=`preview`,o.value=`prompt`,j.value=!0;try{let e=await fetch(`/api/workbench/tasks/ai-split-preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:n.title,desc:n.desc,taskId:n.taskId||``,promptId:n.promptId||``})}).then(e=>e.json());if(!e.success){a.value=`error`,_.value=e.error||Y(`@WORKBENCH:生成预览失败`);return}c.value=e.system||``,d.value=e.user||``,A.value=e.user||``}catch(e){a.value=`error`,_.value=e?.message||String(e)}finally{j.value=!1}}async function oe(){if(!A.value.trim()){z.warning(Y(`@WORKBENCH:提示词不能为空`));return}let e=++S;N(),f.value=``,p.value=``,h.value=``,g.value=[],v.value=``,b.value=``,_.value=``,a.value=`running`,o.value=`thinking`,d.value=A.value,x=new AbortController;let t=x;try{let r=await fetch(`/api/workbench/tasks/ai-split-subtasks`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify({title:n.title,desc:n.desc,taskId:n.taskId||``,promptId:n.promptId||``,customUserBlock:A.value}),signal:t.signal});if(e!==S)return;if(!r.ok||!r.body){let e=await r.text().catch(()=>``);throw Error(e||`HTTP ${r.status}`)}let i=r.body.getReader(),s=new TextDecoder(`utf-8`),l=``,u=null;for(;;){let{value:t,done:n}=await i.read();if(e!==S)return;if(n)break;l+=s.decode(t,{stream:!0});let r=l.split(`
1
+ import"./rolldown-runtime-BM3Ffeng.js";import{$ as e,B as t,Br as n,C as r,Dn as i,Dt as a,E as o,En as s,F as c,Ft as l,Gn as u,I as d,In as f,It as p,J as m,Jn as h,M as g,Mt as _,Nt as v,Qn as y,Qt as b,R as x,Rr as S,S as ee,Sn as C,T as w,Tn as T,Tt as te,U as ne,Un as E,Ur as D,V as O,Vn as k,X as re,Y as A,Yt as j,_r as M,a as N,at as ie,b as ae,bn as P,c as oe,ct as F,d as se,dn as ce,dr as I,er as L,f as le,fn as ue,ft as de,gn as R,h as fe,i as z,it as B,j as V,kn as H,ln as pe,lr as me,mn as U,nn as he,nt as W,pn as G,q as ge,r as _e,rt as ve,st as ye,tr as be,un as xe,ut as Se,vn as K,vt as Ce,w as we,wt as Te,x as Ee,xn as q,y as De,yn as J,zn as Oe}from"./element-plus-Cchqf1s7.js";import{a as ke,i as Ae,n as je}from"./vendor-FHXYVNcm.js";import{n as Y,t as Me}from"./_plugin-vue_export-helper-C5Vpcpi0.js";import{n as X,t as Ne}from"./toolsStore-C0VjU2dD.js";import{t as Pe}from"./configStore-DdYe2Jg3.js";import{a as Z}from"./index-hyzLLFKf.js";var Fe={class:`ai-split-direct-pane`},Ie={key:0,class:`ai-split-status`},Le={key:1,class:`ai-split-status`},Re={key:1},ze={key:2},Be={key:2,class:`ai-split-status is-error`},Ve={key:3,class:`ai-split-idle`},Q={class:`ai-split-idle__title`},$={class:`ai-split-idle__desc`},He={class:`ai-split-prompt-actions`},Ue={key:0,class:`ai-split-prompt-editor`},We={class:`ai-split-prompt-editor__actions`},Ge={key:1,class:`ai-split-pre`},Ke={class:`ai-split-subhead`},qe={class:`ai-split-user-actions`},Je={key:3,class:`ai-split-pre`},Ye={key:0,class:`ai-split-tab-count`},Xe={class:`ai-split-pre ai-split-pre--think`},Ze={key:0,class:`ai-split-tab-count`},Qe={class:`ai-split-parse-error__detail`},$e={class:`ai-split-parse-error__hint`},et={class:`ai-split-parse-error__actions`},tt={key:1,class:`ai-split-raw-toolbar`},nt={class:`ai-split-raw-tip`},rt={key:0,class:`ai-split-tab-count`},it={key:0,class:`ai-split-empty`},at={key:1,class:`ai-split-list`},ot={class:`ai-split-list__no`},st={class:`ai-split-list__body`},ct={class:`ai-split-list__title`},lt={class:`ai-split-list__desc`},ut={key:5,class:`ai-split-footer-hint`},dt={class:`ai-split-direct-footer`},ft=Me(H({__name:`AISplitDirectPane`,props:{title:{},desc:{},taskId:{},promptId:{}},emits:[`confirm`],setup(e,{emit:t}){let n=e,r=t,a=I(`idle`),o=I(`prompt`),c=I(``),d=I(``),f=I(``),p=I(``),h=I(``),g=I([]),_=I(``),v=I(``),b=I(``),x=null,S=0,ee=K(()=>f.value.length),w=K(()=>p.value.length),O=K(()=>a.value===`result`&&g.value.length>0),k=K(()=>a.value===`running`),re=K(()=>a.value===`preview`),A=I(``),j=I(!1);function N(){x&&=(x.abort(),null)}function ie(){N(),a.value=`idle`,o.value=`prompt`,c.value=``,d.value=``,A.value=``,f.value=``,p.value=``,h.value=``,g.value=[],_.value=``,v.value=``,b.value=``}async function ae(){if(!n.title.trim()){z.warning(Y(`@WORKBENCH:请先填写任务标题`));return}ie(),a.value=`preview`,o.value=`prompt`,j.value=!0;try{let e=await fetch(`/api/workbench/tasks/ai-split-preview`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:n.title,desc:n.desc,taskId:n.taskId||``,promptId:n.promptId||``})}).then(e=>e.json());if(!e.success){a.value=`error`,_.value=e.error||Y(`@WORKBENCH:生成预览失败`);return}c.value=e.system||``,d.value=e.user||``,A.value=e.user||``}catch(e){a.value=`error`,_.value=e?.message||String(e)}finally{j.value=!1}}async function oe(){if(!A.value.trim()){z.warning(Y(`@WORKBENCH:提示词不能为空`));return}let e=++S;N(),f.value=``,p.value=``,h.value=``,g.value=[],v.value=``,b.value=``,_.value=``,a.value=`running`,o.value=`thinking`,d.value=A.value,x=new AbortController;let t=x;try{let r=await fetch(`/api/workbench/tasks/ai-split-subtasks`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify({title:n.title,desc:n.desc,taskId:n.taskId||``,promptId:n.promptId||``,customUserBlock:A.value}),signal:t.signal});if(e!==S)return;if(!r.ok||!r.body){let e=await r.text().catch(()=>``);throw Error(e||`HTTP ${r.status}`)}let i=r.body.getReader(),s=new TextDecoder(`utf-8`),l=``,u=null;for(;;){let{value:t,done:n}=await i.read();if(e!==S)return;if(n)break;l+=s.decode(t,{stream:!0});let r=l.split(`
2
2
  `);l=r.pop()??``;for(let e of r){let t=e.trim();if(!t.startsWith(`data:`))continue;let n=t.slice(5).trim();if(!n)continue;let r;try{r=JSON.parse(n)}catch{continue}switch(r.type){case`meta`:c.value=r.prompt?.system||c.value;break;case`thinking`:f.value+=String(r.delta||``);break;case`content`:p.value+=String(r.delta||``);break;case`done`:u=r;break;case`error`:throw Error(r.error||`AI 拆分失败`)}}}if(e!==S)return;if(!u)throw Error(Y(`@WORKBENCH:AI 未返回结果`));g.value=Array.isArray(u.subtasks)?u.subtasks:[],h.value=u.raw||p.value,v.value=String(u.parseError||``),b.value=String(u.parseStage||``),f.value||=Y(`@WORKBENCH:(当前模型未返回独立的思考内容,可切换到「原始结果」查看完整输出)`),a.value=`result`,o.value=g.value.length>0?`confirm`:`raw`}catch(n){if(e!==S)return;if(n?.name===`AbortError`||t.signal.aborted){a.value=`preview`,o.value=`prompt`;return}a.value=`error`,_.value=n?.message||String(n)}finally{e===S&&(x=null)}}function F(){O.value&&r(`confirm`,g.value.slice())}function ce(){A.value.trim()?oe():ae()}function ue(){x&&(x.abort(),x=null,z.info(Y(`@WORKBENCH:已停止拆分`)))}let de=I(!1);async function R(){if(!p.value.trim()){z.warning(Y(`@WORKBENCH:原始结果为空,无法解析`));return}de.value=!0;try{let e=await fetch(`/api/workbench/tasks/parse-subtasks`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({raw:p.value})}).then(e=>e.json());if(!e.success){z.error(e.error||Y(`@WORKBENCH:解析失败`));return}g.value=Array.isArray(e.subtasks)?e.subtasks:[],v.value=String(e.parseError||``),b.value=String(e.parseStage||``),h.value=p.value,g.value.length>0?(z.success(Y(`@WORKBENCH:解析成功,已识别 {n} 个子任务`,{n:g.value.length})),o.value=`confirm`):z.warning(Y(`@WORKBENCH:仍未解析到子任务,请继续修改原始结果`))}catch(e){z.error(Y(`@WORKBENCH:解析失败: `)+(e?.message||e))}finally{de.value=!1}}y(()=>n.taskId,()=>{ie()});let fe=I(!1),B=I(``),V=I(!1);function H(){B.value=c.value,fe.value=!0}async function pe(){if(!B.value.trim()){z.warning(Y(`@WORKBENCH:指令内容不能为空`));return}V.value=!0;try{let e=await fetch(`/api/workbench/tasks/ai-subtask-instruction`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({instruction:B.value})}).then(e=>e.json());e.success?(z.success(Y(`@WORKBENCH:已保存指令`)),fe.value=!1,ae()):z.error(e.error||Y(`@WORKBENCH:保存失败`))}catch(e){z.error(Y(`@WORKBENCH:保存失败: `)+(e?.message||e))}finally{V.value=!1}}function me(){fe.value=!1}return(e,t)=>{let n=he,r=ne,h=ge,y=se,b=m,x=le;return E(),C(`div`,Fe,[k.value?(E(),C(`div`,Ie,[i(n,{class:`is-loading`},{default:L(()=>[i(M(te))]),_:1}),J(`span`,null,D(M(Y)(`@WORKBENCH:AI 正在拆分…`)),1),i(r,{size:`small`,link:``,type:`danger`,class:`ai-split-status__stop`,onClick:ue},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:停止拆分`)),1)]),_:1})])):re.value?(E(),C(`div`,Le,[j.value?(E(),P(n,{key:0,class:`is-loading`},{default:L(()=>[i(M(te))]),_:1})):q(``,!0),j.value?(E(),C(`span`,Re,D(M(Y)(`@WORKBENCH:正在生成提示词预览…`)),1)):(E(),C(`span`,ze,D(M(Y)(`@WORKBENCH:提示词已就绪,可在下方编辑后点「发送给 AI」开始拆分`)),1))])):a.value===`error`?(E(),C(`div`,Be,[i(n,{color:`var(--color-danger)`},{default:L(()=>[i(M(W))]),_:1}),J(`span`,null,D(_.value),1)])):a.value===`idle`?(E(),C(`div`,Ve,[t[5]||=T(`<div class="ai-split-idle__icon" aria-hidden="true" data-v-bff9eaf1><svg viewBox="0 0 24 24" width="36" height="36" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" data-v-bff9eaf1><path d="M12 3v3" data-v-bff9eaf1></path><path d="M12 18v3" data-v-bff9eaf1></path><path d="M3 12h3" data-v-bff9eaf1></path><path d="M18 12h3" data-v-bff9eaf1></path><path d="M5.6 5.6l2.1 2.1" data-v-bff9eaf1></path><path d="M16.3 16.3l2.1 2.1" data-v-bff9eaf1></path><path d="M5.6 18.4l2.1-2.1" data-v-bff9eaf1></path><path d="M16.3 7.7l2.1-2.1" data-v-bff9eaf1></path><circle cx="12" cy="12" r="4" data-v-bff9eaf1></circle></svg></div>`,1),J(`div`,Q,D(M(Y)(`@WORKBENCH:准备用 AI 拆分任务`)),1),J(`div`,$,D(M(Y)(`@WORKBENCH:点击下方按钮开始生成。生成期间可切换到「思考 / 原始结果」实时查看模型输出。`)),1),i(r,{type:`primary`,icon:M(l),onClick:ae},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:开始拆分`)),1)]),_:1},8,[`icon`])])):q(``,!0),a.value===`idle`?q(``,!0):(E(),P(x,{key:4,modelValue:o.value,"onUpdate:modelValue":t[4]||=e=>o.value=e,class:`ai-split-tabs`},{default:L(()=>[i(y,{label:M(Y)(`@WORKBENCH:提示词`),name:`prompt`},{default:L(()=>[J(`div`,He,[i(r,{size:`small`,disabled:k.value,onClick:H},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:编辑指令`)),1)]),_:1},8,[`disabled`])]),fe.value?(E(),C(`div`,Ue,[i(h,{modelValue:B.value,"onUpdate:modelValue":t[0]||=e=>B.value=e,type:`textarea`,rows:12,placeholder:M(Y)(`@WORKBENCH:指令内容`)},null,8,[`modelValue`,`placeholder`]),J(`div`,We,[i(r,{size:`small`,onClick:me},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:取消`)),1)]),_:1}),i(r,{size:`small`,type:`primary`,loading:V.value,onClick:pe},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:保存并重跑`)),1)]),_:1},8,[`loading`])])])):(E(),C(`pre`,Ge,D(c.value||`(等待 LLM 启动…)`),1)),J(`h4`,Ke,D(M(Y)(`@WORKBENCH:用户提示词(拼装后)`)),1),re.value?(E(),C(U,{key:2},[i(h,{modelValue:A.value,"onUpdate:modelValue":t[1]||=e=>A.value=e,type:`textarea`,rows:16,placeholder:M(Y)(`@WORKBENCH:正在生成预览…`),readonly:j.value,class:`ai-split-user-editor`,resize:`none`},null,8,[`modelValue`,`placeholder`,`readonly`]),J(`div`,qe,[i(r,{size:`small`,disabled:j.value,onClick:ie},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:取消`)),1)]),_:1},8,[`disabled`]),i(r,{type:`primary`,icon:M(l),disabled:j.value||!A.value.trim(),onClick:oe},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:发送给 AI`)),1)]),_:1},8,[`icon`,`disabled`])])],64)):(E(),C(`pre`,Je,D(d.value||`(等待 LLM 启动…)`),1))]),_:1},8,[`label`]),i(y,{name:`thinking`},{label:L(()=>[J(`span`,null,[s(D(M(Y)(`@WORKBENCH:思考`))+` `,1),ee.value>0?(E(),C(`span`,Ye,`(`+D(ee.value)+`)`,1)):q(``,!0)])]),default:L(()=>[J(`pre`,Xe,D(f.value||M(Y)(`@WORKBENCH:(暂无输出)`)),1)]),_:1}),i(y,{name:`raw`},{label:L(()=>[J(`span`,null,[s(D(M(Y)(`@WORKBENCH:原始结果`))+` `,1),w.value>0?(E(),C(`span`,Ze,`(`+D(w.value)+`)`,1)):q(``,!0)])]),default:L(()=>[v.value&&a.value===`result`?(E(),P(b,{key:0,type:`warning`,"show-icon":``,closable:!1,class:`ai-split-parse-error`},{title:L(()=>[s(D(M(Y)(`@WORKBENCH:模型返回内容解析失败,无法识别为有效的子任务 JSON`)),1)]),default:L(()=>[J(`div`,Qe,D(v.value),1),J(`div`,$e,D(M(Y)(`@WORKBENCH:常见原因:desc 内夹杂了 ASCII 双引号、出现尾随逗号,或输出被截断。可在下方文本框中手动修改后点「重新解析」,或重新生成。`)),1),J(`div`,et,[i(r,{size:`small`,type:`primary`,loading:de.value,onClick:R},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:重新解析`)),1)]),_:1},8,[`loading`]),i(r,{size:`small`,onClick:ce},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:重新生成`)),1)]),_:1}),i(r,{size:`small`,onClick:t[2]||=e=>o.value=`prompt`},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:去编辑指令`)),1)]),_:1})])]),_:1})):q(``,!0),a.value===`result`||p.value?(E(),C(`div`,tt,[J(`span`,nt,D(M(Y)(`@WORKBENCH:可直接编辑下方文本,修正后点「重新解析」即可入库`)),1),i(r,{size:`small`,type:`primary`,loading:de.value,disabled:!p.value.trim(),onClick:R},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:重新解析`)),1)]),_:1},8,[`loading`,`disabled`])])):q(``,!0),i(h,{modelValue:p.value,"onUpdate:modelValue":t[3]||=e=>p.value=e,type:`textarea`,rows:14,placeholder:M(Y)(`@WORKBENCH:(暂无输出)`),readonly:k.value,class:`ai-split-raw-editor`,resize:`none`},null,8,[`modelValue`,`placeholder`,`readonly`])]),_:1}),i(y,{name:`confirm`,disabled:g.value.length===0},{label:L(()=>[J(`span`,null,[s(D(M(Y)(`@WORKBENCH:确认入库`))+` `,1),g.value.length>0?(E(),C(`span`,rt,`(`+D(g.value.length)+`)`,1)):q(``,!0)])]),default:L(()=>[g.value.length===0?(E(),C(`div`,it,D(M(Y)(`@WORKBENCH:(暂无子任务)`)),1)):(E(),C(`ul`,at,[(E(!0),C(U,null,u(g.value,(e,t)=>(E(),C(`li`,{key:t,class:`ai-split-list__item`},[J(`div`,ot,D(t+1),1),J(`div`,st,[J(`div`,ct,D(e.title),1),J(`div`,lt,D(e.desc),1)])]))),128))]))]),_:1},8,[`disabled`])]),_:1},8,[`modelValue`])),v.value&&a.value===`result`&&g.value.length===0?(E(),C(`div`,ut,[i(n,{color:`var(--color-warning)`},{default:L(()=>[i(M(W))]),_:1}),J(`span`,null,D(M(Y)(`@WORKBENCH:解析失败,未能从模型输出中提取出子任务 — 请查看「原始结果」`)),1)])):q(``,!0),J(`div`,dt,[a.value===`error`||a.value===`result`&&v.value&&g.value.length===0?(E(),P(r,{key:0,onClick:ce},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:重新生成`)),1)]),_:1})):q(``,!0),a.value===`result`&&g.value.length>0?(E(),P(r,{key:1,onClick:ce},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:重新拆分`)),1)]),_:1})):q(``,!0),i(r,{type:`primary`,disabled:!O.value,onClick:F},{default:L(()=>[s(D(M(Y)(`@WORKBENCH:确认入库`))+` (`+D(g.value.length)+`) `,1)]),_:1},8,[`disabled`])])])}}}),[[`__scopeId`,`data-v-bff9eaf1`]]),pt={class:`ai-chat-pane`},mt={key:0,class:`ai-chat-streaming-banner`},ht={key:1,class:`ai-chat-empty`},gt={class:`ai-chat-empty__title`},_t={class:`ai-chat-empty__desc`},vt={key:0,class:`ai-chat-bubble user`},yt={class:`ai-chat-content`},bt={key:1,class:`ai-chat-bubble assistant`},xt={class:`ai-chat-pre ai-chat-pre--think`},St={key:1,class:`ai-chat-content-text`},Ct={key:2,class:`ai-chat-subtasks`},wt={class:`ai-chat-subtasks__head`},Tt={class:`ai-chat-subtasks__count`},Et={class:`ai-chat-list`},Dt={class:`ai-chat-list__no`},Ot={class:`ai-chat-list__body`},kt={class:`ai-chat-list__title`},At={class:`ai-chat-list__desc`},jt={class:`ai-chat-parse-error__detail`},Mt={class:`ai-chat-pre`},Nt={key:5,class:`ai-chat-turn__actions`},Pt={class:`ai-chat-input`},Ft={class:`ai-chat-input__actions`},It={key:0,class:`ai-chat-history__loading`},Lt={key:1,class:`ai-chat-history__empty`},Rt={key:2,class:`ai-chat-history__list`},zt={class:`ai-chat-history__title`},Bt={class:`ai-chat-history__meta`},Vt={class:`ai-chat-history__actions`},Ht=Me(H({__name:`AISplitChatPane`,props:{title:{},desc:{},taskId:{},promptId:{},initialSessionId:{}},emits:[`confirm`],setup(t,{emit:n}){let r=t,a=n,o=I(`idle`),m=I(``),h=I([]),g=I(``),_=I(``),v=null,y=0,b=I(null),x=K(()=>o.value===`streaming`),ee=K(()=>{if(!x.value)return``;let e=[...h.value].reverse().find(e=>e.role===`assistant`);return e?e.content?Y(`@WORKBENCH:AI 正在输出…`):e.thinking?Y(`@WORKBENCH:AI 正在思考… (已思考 {n} 字)`,{n:e.thinking.length}):Y(`@WORKBENCH:AI 正在思考…`):Y(`@WORKBENCH:AI 正在思考…`)}),w=I(!1),T=I(!1),O=I([]);function k(){b.value&&(b.value.scrollTop=b.value.scrollHeight)}async function re(){let e=g.value.trim();if(!e||x.value)return;if(!m.value&&!r.title.trim()){z.warning(Y(`@WORKBENCH:请先填写任务标题`));return}let t=++y;v=new AbortController;let n=v,i={role:`user`,content:e};h.value.push(i),g.value=``;let a={role:`assistant`,content:``,thinking:``};h.value.push(a),o.value=`streaming`,await f(),k();try{let i=await fetch(`/api/workbench/tasks/ai-chat-split`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`text/event-stream`},body:JSON.stringify({sessionId:m.value,title:r.title,desc:r.desc,taskId:r.taskId||``,promptId:r.promptId||``,userMessage:e}),signal:n.signal});if(t!==y)return;if(!i.ok||!i.body){let e=await i.text().catch(()=>``);throw Error(e||`HTTP ${i.status}`)}let s=i.body.getReader(),c=new TextDecoder(`utf-8`),l=``,u=null,d=!1;for(;;){let{value:e,done:n}=await s.read();if(t!==y)return;if(n)break;l+=c.decode(e,{stream:!0});let r=l.split(`
3
3
  `);l=r.pop()??``;for(let e of r){let t=e.trim();if(!t.startsWith(`data:`))continue;let n=t.slice(5).trim();if(!n)continue;let r;try{r=JSON.parse(n)}catch{continue}switch(r.type){case`meta`:r.sessionId&&(m.value=r.sessionId);break;case`user_echo`:d=!0;break;case`thinking`:a.thinking=(a.thinking||``)+String(r.delta||``);break;case`content`:a.content+=String(r.delta||``);break;case`done`:u=r;break;case`error`:throw Error(r.error||`对话拆分失败`)}}h.value=[...h.value],await f(),k()}if(t!==y)return;if(!d&&!u)throw Error(Y(`@WORKBENCH:AI 未返回结果`));u&&(a.subtasks=Array.isArray(u.subtasks)?u.subtasks:[],a.raw=String(u.raw||a.content),a.parseError=String(u.parseError||``),a.parseStage=String(u.parseStage||``)),h.value=[...h.value],await f(),k(),o.value=`idle`}catch(e){if(t!==y)return;if(e?.name===`AbortError`||n.signal.aborted){a.content=(a.content||``)+`
4
4