@shaohui_jin/git-cockpit-mcp-server 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-5CZ3BO3H.js → chunk-2U5EIJJV.js} +140 -9
- package/dist/chunk-2U5EIJJV.js.map +1 -0
- package/dist/{chunk-WCLC5KOG.js → chunk-OKXMVKBU.js} +172 -2
- package/dist/chunk-OKXMVKBU.js.map +1 -0
- package/dist/{chunk-CLCT6P3U.js → chunk-OSNDWKJ6.js} +6 -7
- package/dist/chunk-OSNDWKJ6.js.map +1 -0
- package/dist/cli-entry.js +3 -3
- package/dist/cli-entry.js.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/index.js +3 -3
- package/dist/mcpServer.js +1 -1
- package/dist/web/assets/index-C5nhakYS.js +126 -0
- package/dist/web/assets/index-CFqNjmhP.css +1 -0
- package/dist/web/index.html +2 -2
- package/dist/webServer.js +2 -2
- package/package.json +6 -2
- package/dist/chunk-5CZ3BO3H.js.map +0 -1
- package/dist/chunk-CLCT6P3U.js.map +0 -1
- package/dist/chunk-WCLC5KOG.js.map +0 -1
- package/dist/web/assets/index-BrQ29WGx.css +0 -1
- package/dist/web/assets/index-rh3DXMef.js +0 -114
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import{az as Ze,c as q,G as Ce,d as Me,w as be,a6 as Gn,O as X,W as m,aj as z,aA as Kn,aB as yt,L as k,a0 as y,P as _,$ as V,u as J,M,F as ie,ae as me,_ as P,Y as Xn,k as Y,aq as _t,S as Ee,ac as De,Z as K,i as an,e as ht,X as et,ak as tt,n as Jn,aC as Yn,aD as Qn,aw as Zn,aE as es}from"./vue-CYNDxJyv.js";import{E as oe,a as wt,e as ts}from"./element-plus-D8uC5V5h.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))e(l);new MutationObserver(l=>{for(const i of l)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&e(o)}).observe(document,{childList:!0,subtree:!0});function n(l){const i={};return l.integrity&&(i.integrity=l.integrity),l.referrerPolicy&&(i.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?i.credentials="include":l.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function e(l){if(l.ep)return;l.ep=!0;const i=n(l);fetch(l.href,i)}})();class mt extends Error{constructor(t,n,e,l){super(t),this.status=n,this.code=e,this.requiredApproval=l,this.name="ApiError"}}async function ge(s,t,n){let e;try{e=await fetch(t,{method:s,headers:n!==void 0?{"Content-Type":"application/json"}:void 0,body:n!==void 0?JSON.stringify(n):void 0})}catch(l){throw new mt(`无法连接后端服务(${t}):${l instanceof Error?l.message:String(l)}`,0)}if(!e.ok){let l=e.statusText,i,o;try{const u=await e.json();typeof u.error=="string"?(l=u.error,i=u.code,o=u.requiredApproval):u.error&&typeof u.error=="object"?(l=u.error.message??l,i=u.error.code??u.code,o=u.error.requiredApproval??u.requiredApproval):u.message&&(l=u.message,i=u.code,o=u.requiredApproval)}catch{}throw new mt(l,e.status,i,o)}return await e.json()}function ns(){return ge("GET","/api/repos")}function ss(s){return ge("POST","/api/repos/open",{path:s})}function ls(s){return ge("POST",`/api/repos/${s}/activate`)}function is(s){return ge("DELETE",`/api/repos/${s}`)}function os(s){return ge("GET",`/api/repos/${s}/status`)}function as(s,t={}){const n=new URLSearchParams;t.maxCount&&n.set("maxCount",String(t.maxCount)),t.all&&n.set("all","true"),t.path&&n.set("path",t.path),t.from&&n.set("from",t.from),t.to&&n.set("to",t.to),t.author&&n.set("author",t.author);const e=n.toString();return ge("GET",`/api/repos/${s}/log${e?`?${e}`:""}`)}function rs(s,t={}){const n=new URLSearchParams;t.from&&n.set("from",t.from),t.to&&n.set("to",t.to),t.path&&n.set("path",t.path),t.staged&&n.set("staged","true");const e=n.toString();return ge("GET",`/api/repos/${s}/diff${e?`?${e}`:""}`)}function us(s,t){return ge("GET",`/api/repos/${s}/show/${encodeURIComponent(t)}`)}function ds(s){return ge("GET",`/api/repos/${s}/branches`)}function cs(s){return ge("GET",`/api/repos/${s}/stashes`)}function fs(s){return ge("GET",`/api/repos/${s}/remotes`)}function Ye(s,t,n={}){return ge("POST",`/api/repos/${s}/tools/${t}`,{params:n})}function ps(s={}){const t=new URLSearchParams;s.limit&&t.set("limit",String(s.limit)),s.tool&&t.set("tool",s.tool);const n=t.toString();return ge("GET",`/api/logs${n?`?${n}`:""}`)}function hs(){return ge("GET","/api/settings")}function ms(s){return ge("PUT","/api/settings",s)}function gs(){return ge("GET","/api/health")}function vs(s){const t=new EventSource("/api/events");return s.onRepoChanged&&t.addEventListener("repo-changed",n=>{var e;return(e=s.onRepoChanged)==null?void 0:e.call(s,JSON.parse(n.data))}),s.onLog&&t.addEventListener("log",()=>{var n;return(n=s.onLog)==null?void 0:n.call(s)}),s.onError&&(t.onerror=n=>{var e;return(e=s.onError)==null?void 0:e.call(s,n)}),()=>t.close()}const gt="git-cockpit:currentRepoId";function Ut(){try{const s=Number(window.localStorage.getItem(gt));return Number.isInteger(s)&&s>0?s:null}catch{return null}}function rt(s){try{s===null?window.localStorage.removeItem(gt):window.localStorage.setItem(gt,String(s))}catch{}}const Ne=Ze("repos",{state:()=>({repos:[],currentId:Ut(),loading:!1,error:null,healthOk:null}),getters:{current(s){return s.repos.find(t=>t.id===s.currentId)??null},currentPath(s){var t;return((t=s.repos.find(n=>n.id===s.currentId))==null?void 0:t.path)??null}},actions:{async checkHealth(){try{const s=await gs();this.healthOk=s.ok}catch{this.healthOk=!1}return this.healthOk===!0},async load(){var s;this.loading=!0,this.error=null;try{const{repos:t}=await ns();this.repos=t;const n=Ut();n!==null&&t.some(e=>e.id===n)?this.currentId=n:(!this.currentId||!t.some(e=>e.id===this.currentId))&&(this.currentId=((s=t[0])==null?void 0:s.id)??null),rt(this.currentId)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.loading=!1}},async open(s){const{repo:t}=await ss(s);return await this.load(),t},async activate(s){const{repo:t}=await ls(s);return this.currentId=s,rt(s),await this.load(),t},async remove(s){await is(s),this.currentId===s&&(this.currentId=null),await this.load()},switchTo(s){this.currentId=s,rt(s)}}}),kt=Ze("settings",{state:()=>({permissions:null,tools:[],githubTokenSet:!1,loading:!1,saving:!1,error:null}),actions:{async load(){var s;this.loading=!0,this.error=null;try{const t=await hs();this.permissions=t.permissions,this.tools=t.tools,this.githubTokenSet=!!((s=t.mr)!=null&&s.githubTokenSet)}catch(t){this.error=t instanceof Error?t.message:String(t)}finally{this.loading=!1}},async save(s){var t;this.saving=!0,this.error=null;try{const n=await ms(s);s.permissions&&this.permissions&&(this.permissions={...this.permissions,...s.permissions}),n.mr?this.githubTokenSet=n.mr.githubTokenSet:((t=s.mr)==null?void 0:t.githubToken)!==void 0&&(this.githubTokenSet=s.mr.githubToken.trim().length>0)}catch(n){throw this.error=n instanceof Error?n.message:String(n),n}finally{this.saving=!1}}}});function bs(s,t="all"){return t==="local"?s.filter(n=>!n.remote):t==="remote"?s.filter(n=>n.remote):s}function rn(s){s.sort((t,n)=>{const e=t.branch?1:0,l=n.branch?1:0;return e!==l?e-l:t.label.localeCompare(n.label)});for(const t of s)t.children&&rn(t.children)}function jt(s,t){const n=[];for(const{path:e,branch:l}of s){const i=e.split("/").filter(h=>h.length>0);if(i.length===0)continue;let o=n,u="";for(const[h,a]of i.entries()){u=u?`${u}/${a}`:a;const p=h===i.length-1,C=o.find(r=>r.label===a),w=C??{key:`${t}:${u}`,value:p?l.name:`${t}:${u}`,label:a,disabled:!p};C||o.push(w),p?(w.value=l.name,w.disabled=!1,w.branch=l,w.fullName=l.name,w.remote=l.remote):(w.children||(w.children=[]),o=w.children)}}return rn(n),n}function un(s,t="all"){const n=bs(s,t),e=n.filter(u=>!u.remote),l=n.filter(u=>u.remote),i=new Map;for(const u of l){const h=u.name.indexOf("/"),a=h===-1?"":u.name.slice(0,h);if(!a)continue;const p=i.get(a)??[];p.push({path:u.name.slice(h+1),branch:u}),i.set(a,p)}const o=[];if(e.length&&t!=="remote"&&o.push({key:"local",title:`本地分支(${e.length})`,tree:jt(e.map(u=>({path:u.name,branch:u})),"local")}),t!=="local")for(const[u,h]of i)o.push({key:`remote:${u}`,title:`远程 · ${u}(${h.length})`,tree:jt(h,`remote:${u}`)});return o}function ys(s,t=!1){return(t?[...s].reverse():s).map(e=>({key:`group:${e.key}`,value:`group:${e.key}`,label:e.title,disabled:!0,children:e.tree}))}let Ue=null;const qe=Ze("branches",{state:()=>({list:[],remotes:[],repoId:null,loading:!1}),getters:{current(s){return s.list.find(t=>t.current)??null},locals(s){return s.list.filter(t=>!t.remote)},remoteBranches(s){return s.list.filter(t=>t.remote)},hasRemote(s){return s.remotes.length>0||s.list.some(t=>t.remote)},panes(s){return un(s.list,"all")}},actions:{async load(){if(!(Ue&&(await Ue,this.repoId===Ne().currentId)))return Ue=this.fetch().finally(()=>{Ue=null}),Ue},async fetch(){const s=Ne().currentId;if(s===null){this.list=[],this.remotes=[],this.repoId=null;return}this.repoId!==s&&(this.list=[],this.remotes=[]),this.loading=!0;try{const[{branches:t},n]=await Promise.all([ds(s),fs(s)]);if(Ne().currentId!==s)return;this.list=t,this.remotes=n,this.repoId=s}catch{Ne().currentId===s&&this.repoId!==s&&(this.list=[],this.remotes=[])}finally{this.loading=!1}}}}),dn=q(0),_s=()=>{dn.value+=1};function nt(){return{revision:dn,bump:_s}}const ws={class:"repo-box"},ks=["title"],Cs={class:"menu-icon"},xs={class:"aside-footer"},$s=Ce({__name:"App",setup(s){const t=Ne(),n=kt(),e=qe(),l=Kn(),i=yt(),{bump:o,revision:u}=nt(),h=[{path:"/status",label:"状态",icon:"◧"},{path:"/merge",label:"合并预演",icon:"⇄"},{path:"/history",label:"历史",icon:"◫"},{path:"/repos",label:"仓库管理",icon:"▤"},{path:"/logs",label:"操作日志",icon:"≡"},{path:"/settings",label:"设置",icon:"⚙"}],a=Y(()=>{if(!t.currentId)return"未选择仓库";const C=t.repos.find(w=>w.id===t.currentId);return(C==null?void 0:C.path)??"未选择仓库"});let p=null;return Me(async()=>{await t.checkHealth(),await Promise.all([t.load(),n.load().catch(()=>{})]),await e.load(),p=vs({onRepoChanged:()=>o(),onLog:()=>o(),onError:()=>{}})}),be(()=>t.currentId,()=>void e.load()),be(u,()=>void e.load()),Gn(()=>{p==null||p()}),(C,w)=>{const r=z("el-menu-item"),c=z("el-menu"),g=z("el-tag"),d=z("el-aside"),S=z("router-view"),$=z("el-main"),L=z("el-container");return k(),X(L,{class:"app-shell"},{default:m(()=>[y(d,{width:"220px",class:"app-aside"},{default:m(()=>[w[4]||(w[4]=_("div",{class:"brand"},[_("span",{class:"brand-mark"},"⌘"),_("span",{class:"brand-name"},"Git Cockpit")],-1)),_("div",ws,[w[0]||(w[0]=_("div",{class:"repo-box-label"},"当前仓库",-1)),_("div",{class:"repo-box-path mono",title:a.value},V(a.value),9,ks)]),y(c,{"default-active":J(l).path,class:"nav-menu"},{default:m(()=>[(k(),M(ie,null,me(h,x=>y(r,{key:x.path,index:x.path,onClick:I=>J(i).push(x.path)},{default:m(()=>[_("span",Cs,V(x.icon),1),_("span",null,V(x.label),1)]),_:2},1032,["index","onClick"])),64))]),_:1},8,["default-active"]),_("div",xs,[J(t).healthOk?(k(),X(g,{key:0,size:"small",type:"success"},{default:m(()=>[...w[1]||(w[1]=[P("后端已连接",-1)])]),_:1})):J(t).healthOk===!1?(k(),X(g,{key:1,size:"small",type:"danger"},{default:m(()=>[...w[2]||(w[2]=[P("后端离线",-1)])]),_:1})):(k(),X(g,{key:2,size:"small",type:"info"},{default:m(()=>[...w[3]||(w[3]=[P("连接中…",-1)])]),_:1}))])]),_:1}),y(L,{class:"app-main"},{default:m(()=>[y($,{class:"main-content"},{default:m(()=>[y(S,null,{default:m(({Component:x})=>[(k(),X(Xn(x)))]),_:1})]),_:1})]),_:1})]),_:1})}}}),xe=(s,t)=>{const n=s.__vccOpts||s;for(const[e,l]of t)n[e]=l;return n},Ts=xe($s,[["__scopeId","data-v-cbdd67e4"]]),Ss={class:"page"},Ls={class:"open-row"},Es={class:"list-header"},Ns={key:1,class:"tree-scroll"},Is=["title"],Ps=["title","onDblclick"],Vs={class:"node-name mono"},Ds={class:"node-time"},Rs={class:"node-actions"},Fs=Ce({__name:"ReposView",setup(s){const t=Ne(),n=yt(),e=q(""),l=q(!1),i=Y(()=>{const w=[],r=new Map;t.repos.forEach((g,d)=>r.set(g.id,d));for(const g of t.repos){const d=g.path.split(/[\\/]+/).filter(L=>L.length>0);if(d.length===0)continue;let S=w,$="";for(const[L,x]of d.entries()){$=$?`${$}/${x}`:x;const I=L===d.length-1,B=S.find(Z=>!Z.repo&&Z.label===x);if(I)S.push({key:"repo:"+g.path,label:x,fullPath:g.path,repo:g});else{const Z=B??{key:"dir:"+$,label:x,fullPath:$};B||S.push(Z),Z.children??(Z.children=[]),S=Z.children}}}const c=g=>{g.sort((d,S)=>{const $=d.repo?1:0,L=S.repo?1:0;return $!==L?$-L:$===1?(r.get(d.repo.id)??0)-(r.get(S.repo.id)??0):d.label.localeCompare(S.label)});for(const d of g)d.children&&c(d.children)};return c(w),w}),o=Y(()=>{const w=t.current;if(w){const c=w.path.split(/[\\/]+/).filter(S=>S.length>0),g=[];let d="";for(let S=0;S<c.length-1;S++)d=d?`${d}/${c[S]}`:c[S],g.push("dir:"+d);if(g.length>0)return g}const r=i.value[0];return r&&!r.repo?[r.key]:[]});async function u(){const w=e.value.trim();if(!w){oe.warning("请输入仓库路径");return}l.value=!0;try{const r=await t.open(w);oe.success(`已打开 ${r.path}`),t.switchTo(r.id),await n.push("/status")}catch(r){oe.error(r instanceof Error?r.message:String(r))}finally{l.value=!1}}async function h(w,r){try{await wt.confirm(`确定从列表移除 ${r}?注意:不会删除磁盘上的仓库文件。`,"移除仓库",{type:"warning",confirmButtonText:"移除",cancelButtonText:"取消"})}catch{return}try{await t.remove(w),oe.success("已移除")}catch(c){oe.error(c instanceof Error?c.message:String(c))}}async function a(w){try{await t.activate(w)}catch{t.switchTo(w)}n.push("/status")}function p(w){const r=new Date(w);return Number.isNaN(r.getTime())?w:r.toLocaleString()}function C(w){w.repo&&a(w.repo.id)}return Me(()=>t.load()),(w,r)=>{const c=z("el-input"),g=z("el-button"),d=z("el-card"),S=z("el-empty"),$=z("el-tree");return k(),M("div",Ss,[r[7]||(r[7]=_("h2",{class:"page-title"},"仓库管理",-1)),y(d,{class:"open-card",shadow:"never"},{header:m(()=>[...r[2]||(r[2]=[P("打开本地仓库",-1)])]),default:m(()=>[_("div",Ls,[y(c,{modelValue:e.value,"onUpdate:modelValue":r[0]||(r[0]=L=>e.value=L),placeholder:"输入本地 Git 仓库路径,例如 D:\\project\\repo 或 /Users/me/code/app",clearable:"",onKeyup:_t(u,["enter"])},null,8,["modelValue"]),y(g,{type:"primary",loading:l.value,onClick:u},{default:m(()=>[...r[3]||(r[3]=[P("打开",-1)])]),_:1},8,["loading"])])]),_:1}),y(d,{shadow:"never",class:"list-card"},{header:m(()=>[_("div",Es,[_("span",null,"最近打开的仓库("+V(J(t).repos.length)+")",1),y(g,{text:"",type:"primary",loading:J(t).loading,onClick:r[1]||(r[1]=L=>J(t).load())},{default:m(()=>[...r[4]||(r[4]=[P("刷新",-1)])]),_:1},8,["loading"])])]),default:m(()=>[!J(t).loading&&J(t).repos.length===0?(k(),X(S,{key:0,description:"尚未打开任何仓库"})):(k(),M("div",Ns,[y($,{data:i.value,props:{label:"label",children:"children"},"node-key":"key",accordion:"","default-expanded-keys":o.value,indent:14,class:"repo-tree"},{default:m(({data:L})=>[L.repo?(k(),M("div",{key:1,class:Ee(["repo-node",{current:L.repo.id===J(t).currentId}]),title:L.repo.path,onDblclick:x=>C(L)},[_("span",Vs,V(L.label),1),_("span",Ds,V(p(L.repo.lastOpenedAt)),1),_("span",Rs,[y(g,{size:"small",text:"",type:"primary",onClick:De(x=>C(L),["stop"])},{default:m(()=>[...r[5]||(r[5]=[P("进入",-1)])]),_:1},8,["onClick"]),y(g,{size:"small",text:"",type:"danger",onClick:De(x=>h(L.repo.id,L.repo.path),["stop"])},{default:m(()=>[...r[6]||(r[6]=[P("移除",-1)])]),_:1},8,["onClick"])])],42,Ps)):(k(),M("span",{key:0,class:"tree-dir",title:L.fullPath},V(L.label),9,Is))]),_:1},8,["data","default-expanded-keys"])]))]),_:1})])}}}),As=xe(Fs,[["__scopeId","data-v-f0cfb33b"]]);function cn(s){const t=yt(),n=q(!1),e=q(null),l=q(!1),i=Y(()=>s()!==null);async function o(C,w={}){const r=s();if(r===null)return oe.warning("请先选择仓库"),!1;try{const c=await Ye(r,C,{...w,dryRun:!0});return c.success?(e.value={tool:C,params:w,preview:c.preview??c.result},n.value=!0,!0):(a(c),!1)}catch(c){return p(c),!1}}async function u(){const C=s(),w=e.value;if(C===null||!w)return null;l.value=!0,n.value=!1;try{const r=await Ye(C,w.tool,w.params);return r.success?(r.backupCreated?oe.success(`${w.tool} 执行成功(已自动备份:${r.backupCreated.branch??"分支"}${r.backupCreated.stashRef?` / ${r.backupCreated.stashRef}`:""})`):oe.success(`${w.tool} 执行成功`),r):(a(r),r)}catch(r){return p(r),null}finally{l.value=!1,e.value=null}}function h(){n.value=!1,e.value=null}function a(C){var w,r,c;if(((w=C.error)==null?void 0:w.code)==="PERMISSION_DENIED"){C.error.requiredApproval?wt.confirm(`操作 ${C.tool} 属于高风险操作,当前默认禁用,需要在设置中开启后才能执行。是否前往设置?`,"需要审批",{confirmButtonText:"去开启",cancelButtonText:"取消",type:"warning"}).then(()=>t.push("/settings")).catch(()=>{}):oe.error(((r=C.error)==null?void 0:r.message)??"操作被拒绝");return}oe.error(((c=C.error)==null?void 0:c.message)??"操作失败")}function p(C){const w=C instanceof Error?C.message:String(C);oe.error(w)}return{confirmVisible:n,pending:e,executing:l,canRun:i,previewAndConfirm:o,executeConfirmed:u,cancel:h}}const Ms={key:2,class:"cmd-box"},Os={class:"cmd-pre mono"},zs={key:3,class:"files-box"},Hs={class:"cmd-label"},Bs={key:4,class:"note-text"},Us={class:"risk-tag"},js=Ce({__name:"ConfirmDialog",props:{visible:{type:Boolean},tool:{},preview:{default:null},note:{default:""}},emits:["update:visible","confirm","cancel"],setup(s,{emit:t}){const n=s,e=t,l=Y(()=>{const p=n.preview;return p&&"command"in p&&typeof p.command=="string"?p.command:""}),i=Y(()=>{const p=n.preview,C=p&&"risk"in p&&typeof p.risk=="string"?String(p.risk):"write";return C==="dangerous"||C==="high"?"dangerous":C==="readonly"?"readonly":"write"}),o=Y(()=>{const p=n.preview;return p&&"affectedFiles"in p&&Array.isArray(p.affectedFiles)?p.affectedFiles:[]}),u=Y(()=>i.value==="dangerous"?{type:"danger",label:"高风险"}:i.value==="write"?{type:"warning",label:"写操作"}:{type:"info",label:"只读"});function h(){e("confirm")}function a(){e("cancel"),e("update:visible",!1),oe.info("操作已取消")}return(p,C)=>{const w=z("el-alert"),r=z("el-scrollbar"),c=z("el-tag"),g=z("el-button"),d=z("el-dialog");return k(),X(d,{"model-value":s.visible,title:`执行操作:${s.tool}`,width:"560px","close-on-click-modal":!1,onClosed:C[0]||(C[0]=S=>e("update:visible",!1))},{footer:m(()=>[_("span",Us,[y(c,{type:u.value.type,size:"small",effect:"dark"},{default:m(()=>[P(V(u.value.label),1)]),_:1},8,["type"])]),y(g,{onClick:a},{default:m(()=>[...C[4]||(C[4]=[P("取消",-1)])]),_:1}),y(g,{type:"primary",danger:i.value==="dangerous",onClick:h},{default:m(()=>[...C[5]||(C[5]=[P("确认执行",-1)])]),_:1},8,["danger"])]),default:m(()=>[i.value==="dangerous"?(k(),X(w,{key:0,type:"error",closable:!1,"show-icon":"",class:"risk-alert"},{title:m(()=>[...C[1]||(C[1]=[P("这是",-1),_("b",null,"高风险",-1),P("操作,将自动创建备份(临时分支 + stash)",-1)])]),_:1})):i.value==="write"?(k(),X(w,{key:1,type:"warning",closable:!1,"show-icon":"",class:"risk-alert"},{title:m(()=>[...C[2]||(C[2]=[P("写操作:执行后将修改仓库状态",-1)])]),_:1})):K("",!0),l.value?(k(),M("div",Ms,[C[3]||(C[3]=_("div",{class:"cmd-label"},"将执行的命令(dry-run 预览,未实际执行)",-1)),_("pre",Os,V(l.value),1)])):K("",!0),o.value.length?(k(),M("div",zs,[_("div",Hs,"涉及文件("+V(o.value.length)+")",1),y(r,{"max-height":"140px"},{default:m(()=>[(k(!0),M(ie,null,me(o.value,S=>(k(),M("div",{key:S,class:"file-item mono"},V(S),1))),128))]),_:1})])):K("",!0),s.note?(k(),M("div",Bs,V(s.note),1)):K("",!0)]),_:1},8,["model-value","title"])}}}),fn=xe(js,[["__scopeId","data-v-8484f9b1"]]);var de;(function(s){s.INSERT="insert",s.DELETE="delete",s.CONTEXT="context"})(de||(de={}));const Ws={LINE_BY_LINE:"line-by-line"},qs={NONE:"none"},Gs={WORD:"word"};var Ae;(function(s){s.AUTO="auto",s.DARK="dark",s.LIGHT="light"})(Ae||(Ae={}));const Ks=["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"],Xs=RegExp("["+Ks.join("\\")+"]","g");function Js(s){return s.replace(Xs,"\\$&")}function Wt(s){return s&&s.replace(/\\/g,"/")}function Ys(s){let t,n,e,l=0;for(t=0,e=s.length;t<e;t++)n=s.charCodeAt(t),l=(l<<5)-l+n,l|=0;return l}function pn(s){const t=s.length;let n=-1/0;for(let e=0;e<t;e++)n=Math.max(n,s[e]);return n}function qt(s,t){const n=s.split(".");return n.length>1?n[n.length-1]:t}function Gt(s,t){return t.reduce((n,e)=>n||s.startsWith(e),!1)}const Kt=["a/","b/","i/","w/","c/","o/"];function Ve(s,t,n){const e=n!==void 0?[...Kt,n]:Kt,l=t?new RegExp(`^${Js(t)} "?(.+?)"?$`):new RegExp('^"?(.+?)"?$'),[,i=""]=l.exec(s)||[],o=e.find(h=>i.indexOf(h)===0);return(o?i.slice(o.length):i).replace(/\s+\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d+)? [+-]\d{4}.*$/,"")}function Qs(s,t){return Ve(s,"---",t)}function Zs(s,t){return Ve(s,"+++",t)}function el(s,t={}){const n=[];let e=null,l=null,i=null,o=null,u=null,h=null,a=null;const p="--- ",C="+++ ",w="@@",r=/^old mode (\d{6})/,c=/^new mode (\d{6})/,g=/^deleted file mode (\d{6})/,d=/^new file mode (\d{6})/,S=/^copy from "?(.+)"?/,$=/^copy to "?(.+)"?/,L=/^rename from "?(.+)"?/,x=/^rename to "?(.+)"?/,I=/^similarity index (\d+)%/,B=/^dissimilarity index (\d+)%/,Z=/^index ([\da-z]+)\.\.([\da-z]+)\s*(\d{6})?/,T=/^Binary files (.*) and (.*) differ/,N=/^GIT binary patch/,D=/^index ([\da-z]+),([\da-z]+)\.\.([\da-z]+)/,R=/^mode (\d{6}),(\d{6})\.\.(\d{6})/,ne=/^new file mode (\d{6})/,re=/^deleted file mode (\d{6}),(\d{6})/,W=s.replace(/\/g,"").replace(/\r\n?/g,`
|
|
2
|
+
`).split(`
|
|
3
|
+
`);function Q(){l!==null&&e!==null&&(e.blocks.push(l),l=null)}function he(){e!==null&&(!e.oldName&&h!==null&&(e.oldName=h),!e.newName&&a!==null&&(e.newName=a),e.newName&&(n.push(e),e=null)),h=null,a=null}function fe(){Q(),he(),e={blocks:[],deletedLines:0,addedLines:0}}function U(f){Q();let A;e!==null&&((A=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@.*/.exec(f))?(e.isCombined=!1,i=parseInt(A[1],10),u=parseInt(A[2],10)):(A=/^@@@ -(\d+)(?:,\d+)? -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@@.*/.exec(f))?(e.isCombined=!0,i=parseInt(A[1],10),o=parseInt(A[2],10),u=parseInt(A[3],10)):(f.startsWith(w)&&console.error("Failed to parse lines, starting in 0!"),i=0,u=0,e.isCombined=!1)),l={lines:[],oldStartLine:i,oldStartLine2:o,newStartLine:u,header:f}}function O(f){if(e===null||l===null||i===null||u===null)return;const A={content:f},v=e.isCombined?["+ "," +","++"]:["+"],j=e.isCombined?["- "," -","--"]:["-"];Gt(f,v)?(e.addedLines++,A.type=de.INSERT,A.oldNumber=void 0,A.newNumber=u++):Gt(f,j)?(e.deletedLines++,A.type=de.DELETE,A.oldNumber=i++,A.newNumber=void 0):(A.type=de.CONTEXT,A.oldNumber=i++,A.newNumber=u++),l.lines.push(A)}function F(f,A){let v=A;for(;v<W.length-3;){if(f.startsWith("diff"))return!1;if(W[v].startsWith(p)&&W[v+1].startsWith(C)&&W[v+2].startsWith(w))return!0;v++}return!1}return W.forEach((f,A)=>{if(!f||f.startsWith("*"))return;let v;const j=W[A-1],le=W[A+1],pe=W[A+2];if(f.startsWith("diff --git")||f.startsWith("diff --combined")){if(fe(),(v=/^diff --git "?([a-ciow]\/.+)"? "?([a-ciow]\/.+)"?/.exec(f))&&(h=Ve(v[1],void 0,t.dstPrefix),a=Ve(v[2],void 0,t.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isGitDiff=!0;return}if(f.startsWith("Binary files")&&!(e!=null&&e.isGitDiff)){if(fe(),(v=/^Binary files "?([a-ciow]\/.+)"? and "?([a-ciow]\/.+)"? differ/.exec(f))&&(h=Ve(v[1],void 0,t.dstPrefix),a=Ve(v[2],void 0,t.srcPrefix)),e===null)throw new Error("Where is my file !!!");e.isBinary=!0;return}if((!e||!e.isGitDiff&&e&&f.startsWith(p)&&le.startsWith(C)&&pe.startsWith(w))&&fe(),e!=null&&e.isTooBig)return;if(e&&(typeof t.diffMaxChanges=="number"&&e.addedLines+e.deletedLines>t.diffMaxChanges||typeof t.diffMaxLineLength=="number"&&f.length>t.diffMaxLineLength)){e.isTooBig=!0,e.addedLines=0,e.deletedLines=0,e.blocks=[],l=null;const se=typeof t.diffTooBigMessage=="function"?t.diffTooBigMessage(n.length):"Diff too big to be displayed";U(se);return}if(f.startsWith(p)&&le.startsWith(C)||f.startsWith(C)&&j.startsWith(p)){if(e&&!e.oldName&&f.startsWith("--- ")&&(v=Qs(f,t.srcPrefix))){e.oldName=v,e.language=qt(e.oldName,e.language);return}if(e&&!e.newName&&f.startsWith("+++ ")&&(v=Zs(f,t.dstPrefix))){e.newName=v,e.language=qt(e.newName,e.language);return}}if(e&&(f.startsWith(w)||e.isGitDiff&&e.oldName&&e.newName&&!l)){U(f);return}if(l&&(f.startsWith("+")||f.startsWith("-")||f.startsWith(" "))){O(f);return}const te=!F(f,A);if(e===null)throw new Error("Where is my file !!!");(v=r.exec(f))?e.oldMode=v[1]:(v=c.exec(f))?e.newMode=v[1]:(v=g.exec(f))?(e.deletedFileMode=v[1],e.isDeleted=!0):(v=d.exec(f))?(e.newFileMode=v[1],e.isNew=!0):(v=S.exec(f))?(te&&(e.oldName=v[1]),e.isCopy=!0):(v=$.exec(f))?(te&&(e.newName=v[1]),e.isCopy=!0):(v=L.exec(f))?(te&&(e.oldName=v[1]),e.isRename=!0):(v=x.exec(f))?(te&&(e.newName=v[1]),e.isRename=!0):(v=T.exec(f))?(e.isBinary=!0,e.oldName=Ve(v[1],void 0,t.srcPrefix),e.newName=Ve(v[2],void 0,t.dstPrefix),U("Binary file")):N.test(f)?(e.isBinary=!0,U(f)):(v=I.exec(f))?e.unchangedPercentage=parseInt(v[1],10):(v=B.exec(f))?e.changedPercentage=parseInt(v[1],10):(v=Z.exec(f))?(e.checksumBefore=v[1],e.checksumAfter=v[2],v[3]&&(e.mode=v[3])):(v=D.exec(f))?(e.checksumBefore=[v[2],v[3]],e.checksumAfter=v[1]):(v=R.exec(f))?(e.oldMode=[v[2],v[3]],e.newMode=v[1]):(v=ne.exec(f))?(e.newFileMode=v[1],e.isNew=!0):(v=re.exec(f))&&(e.deletedFileMode=v[1],e.isDeleted=!0)}),Q(),he(),n}let hn=class{diff(t,n,e={}){let l;typeof e=="function"?(l=e,e={}):"callback"in e&&(l=e.callback);const i=this.castInput(t,e),o=this.castInput(n,e),u=this.removeEmpty(this.tokenize(i,e)),h=this.removeEmpty(this.tokenize(o,e));return this.diffWithOptionsObj(u,h,e,l)}diffWithOptionsObj(t,n,e,l){var i;const o=$=>{if($=this.postProcess($,e),l){setTimeout(function(){l($)},0);return}else return $},u=n.length,h=t.length;let a=1,p=u+h;e.maxEditLength!=null&&(p=Math.min(p,e.maxEditLength));const C=(i=e.timeout)!==null&&i!==void 0?i:1/0,w=Date.now()+C,r=[{oldPos:-1,lastComponent:void 0}];let c=this.extractCommon(r[0],n,t,0,e);if(r[0].oldPos+1>=h&&c+1>=u)return o(this.buildValues(r[0].lastComponent,n,t));let g=-1/0,d=1/0;const S=()=>{for(let $=Math.max(g,-a);$<=Math.min(d,a);$+=2){let L;const x=r[$-1],I=r[$+1];x&&(r[$-1]=void 0);let B=!1;if(I){const T=I.oldPos-$;B=I&&0<=T&&T<u}const Z=x&&x.oldPos+1<h;if(!B&&!Z){r[$]=void 0;continue}if(!Z||B&&x.oldPos<I.oldPos?L=this.addToPath(I,!0,!1,0,e):L=this.addToPath(x,!1,!0,1,e),c=this.extractCommon(L,n,t,$,e),L.oldPos+1>=h&&c+1>=u)return o(this.buildValues(L.lastComponent,n,t))||!0;r[$]=L,L.oldPos+1>=h&&(d=Math.min(d,$-1)),c+1>=u&&(g=Math.max(g,$+1))}a++};if(l)(function $(){setTimeout(function(){if(a>p||Date.now()>w)return l(void 0);S()||$()},0)})();else for(;a<=p&&Date.now()<=w;){const $=S();if($)return $}}addToPath(t,n,e,l,i){const o=t.lastComponent;return o&&!i.oneChangePerToken&&o.added===n&&o.removed===e?{oldPos:t.oldPos+l,lastComponent:{count:o.count+1,added:n,removed:e,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+l,lastComponent:{count:1,added:n,removed:e,previousComponent:o}}}extractCommon(t,n,e,l,i){const o=n.length,u=e.length;let h=t.oldPos,a=h-l,p=0;for(;a+1<o&&h+1<u&&this.equals(e[h+1],n[a+1],i);)a++,h++,p++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return p&&!i.oneChangePerToken&&(t.lastComponent={count:p,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,a}equals(t,n,e){return e.comparator?e.comparator(t,n):t===n||!!e.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let e=0;e<t.length;e++)t[e]&&n.push(t[e]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,e){const l=[];let i;for(;t;)l.push(t),i=t.previousComponent,delete t.previousComponent,t=i;l.reverse();const o=l.length;let u=0,h=0,a=0;for(;u<o;u++){const p=l[u];if(p.removed)p.value=this.join(e.slice(a,a+p.count)),a+=p.count;else{if(!p.added&&this.useLongestToken){let C=n.slice(h,h+p.count);C=C.map(function(w,r){const c=e[a+r];return c.length>w.length?c:w}),p.value=this.join(C)}else p.value=this.join(n.slice(h,h+p.count));h+=p.count,p.added||(a+=p.count)}}return l}};class tl extends hn{}const nl=new tl;function sl(s,t,n){return nl.diff(s,t,n)}const Xt="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class ll extends hn{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${Xt}]+|[^\\S\\n\\r]+|[^${Xt}]`,"ug");return t.match(n)||[]}}const il=new ll;function ol(s,t,n){return il.diff(s,t,n)}function al(s,t){if(s.length===0)return t.length;if(t.length===0)return s.length;const n=[];let e;for(e=0;e<=t.length;e++)n[e]=[e];let l;for(l=0;l<=s.length;l++)n[0][l]=l;for(e=1;e<=t.length;e++)for(l=1;l<=s.length;l++)t.charAt(e-1)===s.charAt(l-1)?n[e][l]=n[e-1][l-1]:n[e][l]=Math.min(n[e-1][l-1]+1,Math.min(n[e][l-1]+1,n[e-1][l]+1));return n[t.length][s.length]}function Ct(s){return(t,n)=>{const e=s(t).trim(),l=s(n).trim();return al(e,l)/(e.length+l.length)}}function xt(s){function t(e,l,i=new Map){let o=1/0,u;for(let h=0;h<e.length;++h)for(let a=0;a<l.length;++a){const p=JSON.stringify([e[h],l[a]]);let C;i.has(p)&&(C=i.get(p))||(C=s(e[h],l[a]),i.set(p,C)),C<o&&(o=C,u={indexA:h,indexB:a,score:o})}return u}function n(e,l,i=0,o=new Map){const u=t(e,l,o);if(!u||e.length+l.length<3)return[[e,l]];const h=e.slice(0,u.indexA),a=l.slice(0,u.indexB),p=[e[u.indexA]],C=[l[u.indexB]],w=u.indexA+1,r=u.indexB+1,c=e.slice(w),g=l.slice(r),d=n(h,a,i+1,o),S=n(p,C,i+1,o),$=n(c,g,i+1,o);let L=S;return(u.indexA>0||u.indexB>0)&&(L=d.concat(L)),(e.length>w||l.length>r)&&(L=L.concat($)),L}return n}const ve={INSERTS:"d2h-ins",DELETES:"d2h-del",CONTEXT:"d2h-cntx",INFO:"d2h-info",INSERT_CHANGES:"d2h-ins d2h-change",DELETE_CHANGES:"d2h-del d2h-change"},st={matching:qs.NONE,matchWordsThreshold:.25,maxLineLengthHighlight:1e4,diffStyle:Gs.WORD,colorScheme:Ae.LIGHT},Te="/",mn=Ct(s=>s.value),rl=xt(mn);function ut(s){return s.indexOf("dev/null")!==-1}function ul(s){return s.replace(/(<ins[^>]*>((.|\n)*?)<\/ins>)/g,"")}function dl(s){return s.replace(/(<del[^>]*>((.|\n)*?)<\/del>)/g,"")}function Qe(s){switch(s){case de.CONTEXT:return ve.CONTEXT;case de.INSERT:return ve.INSERTS;case de.DELETE:return ve.DELETES}}function $t(s){switch(s){case Ae.DARK:return"d2h-dark-color-scheme";case Ae.AUTO:return"d2h-auto-color-scheme";case Ae.LIGHT:default:return"d2h-light-color-scheme"}}function cl(s){return s?2:1}function ze(s){return s.slice(0).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")}function Se(s,t,n=!0){const e=cl(t);return{prefix:s.substring(0,e),content:n?ze(s.substring(e)):s.substring(e)}}function lt(s){const t=Wt(s.oldName),n=Wt(s.newName);if(t!==n&&!ut(t)&&!ut(n)){const e=[],l=[],i=t.split(Te),o=n.split(Te),u=i.length,h=o.length;let a=0,p=u-1,C=h-1;for(;a<p&&a<C&&i[a]===o[a];)e.push(o[a]),a+=1;for(;p>a&&C>a&&i[p]===o[C];)l.unshift(o[C]),p-=1,C-=1;const w=e.join(Te),r=l.join(Te),c=i.slice(a,p+1).join(Te),g=o.slice(a,C+1).join(Te);return w.length&&r.length?w+Te+"{"+c+" → "+g+"}"+Te+r:w.length?w+Te+"{"+c+" → "+g+"}":r.length?"{"+c+" → "+g+"}"+Te+r:t+" → "+n}else return ut(n)?t:n}function Tt(s){return`d2h-${Ys(lt(s)).toString().slice(-6)}`}function St(s){let t="file-changed";return s.isRename||s.isCopy?t="file-renamed":s.isNew?t="file-added":s.isDeleted?t="file-deleted":s.newName!==s.oldName&&(t="file-renamed"),t}function gn(s,t,n,e={}){const{matching:l,maxLineLengthHighlight:i,matchWordsThreshold:o,diffStyle:u}=Object.assign(Object.assign({},st),e),h=Se(s,n,!1),a=Se(t,n,!1);if(h.content.length>i||a.content.length>i)return{oldLine:{prefix:h.prefix,content:ze(h.content)},newLine:{prefix:a.prefix,content:ze(a.content)}};const p=u==="char"?sl(h.content,a.content):ol(h.content,a.content),C=[];if(u==="word"&&l==="words"){const r=p.filter(d=>d.removed),c=p.filter(d=>d.added);rl(c,r).forEach(d=>{d[0].length===1&&d[1].length===1&&mn(d[0][0],d[1][0])<o&&(C.push(d[0][0]),C.push(d[1][0]))})}const w=p.reduce((r,c)=>{const g=c.added?"ins":c.removed?"del":null,d=C.indexOf(c)>-1?' class="d2h-change"':"",S=ze(c.value);return g!==null?`${r}<${g}${d}>${S}</${g}>`:`${r}${S}`},"");return{oldLine:{prefix:h.prefix,content:ul(w)},newLine:{prefix:a.prefix,content:dl(w)}}}const Jt="file-summary",fl="icon",pl={colorScheme:st.colorScheme};class hl{constructor(t,n={}){this.hoganUtils=t,this.config=Object.assign(Object.assign({},pl),n)}render(t){const n=t.map(e=>this.hoganUtils.render(Jt,"line",{fileHtmlId:Tt(e),oldName:e.oldName,newName:e.newName,fileName:lt(e),deletedLines:"-"+e.deletedLines,addedLines:"+"+e.addedLines},{fileIcon:this.hoganUtils.template(fl,St(e))})).join(`
|
|
4
|
+
`);return this.hoganUtils.render(Jt,"wrapper",{colorScheme:$t(this.config.colorScheme),filesNumber:t.length,files:n})}}const vn=Object.assign(Object.assign({},st),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),je="generic",Yt="line-by-line",ml="icon",gl="tag";class vl{constructor(t,n={}){this.hoganUtils=t,this.config=Object.assign(Object.assign({},vn),n)}render(t){const n=t.map(e=>{let l;return e.blocks.length?l=this.generateFileHtml(e):l=this.generateEmptyDiff(),this.makeFileDiffHtml(e,l)}).join(`
|
|
5
|
+
`);return this.hoganUtils.render(je,"wrapper",{colorScheme:$t(this.config.colorScheme),content:n})}makeFileDiffHtml(t,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(t.blocks)&&t.blocks.length===0)return"";const e=this.hoganUtils.template(Yt,"file-diff"),l=this.hoganUtils.template(je,"file-path"),i=this.hoganUtils.template(ml,"file"),o=this.hoganUtils.template(gl,St(t));return e.render({file:t,fileHtmlId:Tt(t),diffs:n,filePath:l.render({fileDiffName:lt(t)},{fileIcon:i,fileTag:o})})}generateEmptyDiff(){return this.hoganUtils.render(je,"empty-diff",{contentClass:"d2h-code-line",CSSLineClass:ve})}generateFileHtml(t){const n=xt(Ct(e=>Se(e.content,t.isCombined).content));return t.blocks.map(e=>{let l=this.hoganUtils.render(je,"block-header",{CSSLineClass:ve,blockHeader:t.isTooBig?e.header:ze(e.header),lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line"});return this.applyLineGroupping(e).forEach(([i,o,u])=>{if(o.length&&u.length&&!i.length)this.applyRematchMatching(o,u,n).map(([h,a])=>{const{left:p,right:C}=this.processChangedLines(t,t.isCombined,h,a);l+=p,l+=C});else if(i.length)i.forEach(h=>{const{prefix:a,content:p}=Se(h.content,t.isCombined);l+=this.generateSingleLineHtml(t,{type:ve.CONTEXT,prefix:a,content:p,oldNumber:h.oldNumber,newNumber:h.newNumber})});else if(o.length||u.length){const{left:h,right:a}=this.processChangedLines(t,t.isCombined,o,u);l+=h,l+=a}else console.error("Unknown state reached while processing groups of lines",i,o,u)}),l}).join(`
|
|
6
|
+
`)}applyLineGroupping(t){const n=[];let e=[],l=[];for(let i=0;i<t.lines.length;i++){const o=t.lines[i];(o.type!==de.INSERT&&l.length||o.type===de.CONTEXT&&e.length>0)&&(n.push([[],e,l]),e=[],l=[]),o.type===de.CONTEXT?n.push([[o],[],[]]):o.type===de.INSERT&&e.length===0?n.push([[],[],[o]]):o.type===de.INSERT&&e.length>0?l.push(o):o.type===de.DELETE&&e.push(o)}return(e.length||l.length)&&(n.push([[],e,l]),e=[],l=[]),n}applyRematchMatching(t,n,e){const l=t.length*n.length,i=pn(t.concat(n).map(u=>u.content.length));return l<this.config.matchingMaxComparisons&&i<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?e(t,n):[[t,n]]}processChangedLines(t,n,e,l){const i={right:"",left:""},o=Math.max(e.length,l.length);for(let u=0;u<o;u++){const h=e[u],a=l[u],p=h!==void 0&&a!==void 0?gn(h.content,a.content,n,this.config):void 0,C=h!==void 0&&h.oldNumber!==void 0?Object.assign(Object.assign({},p!==void 0?{prefix:p.oldLine.prefix,content:p.oldLine.content,type:ve.DELETE_CHANGES}:Object.assign(Object.assign({},Se(h.content,n)),{type:Qe(h.type)})),{oldNumber:h.oldNumber,newNumber:h.newNumber}):void 0,w=a!==void 0&&a.newNumber!==void 0?Object.assign(Object.assign({},p!==void 0?{prefix:p.newLine.prefix,content:p.newLine.content,type:ve.INSERT_CHANGES}:Object.assign(Object.assign({},Se(a.content,n)),{type:Qe(a.type)})),{oldNumber:a.oldNumber,newNumber:a.newNumber}):void 0,{left:r,right:c}=this.generateLineHtml(t,C,w);i.left+=r,i.right+=c}return i}generateLineHtml(t,n,e){return{left:this.generateSingleLineHtml(t,n),right:this.generateSingleLineHtml(t,e)}}generateSingleLineHtml(t,n){if(n===void 0)return"";const e=this.hoganUtils.render(Yt,"numbers",{oldNumber:n.oldNumber||"",newNumber:n.newNumber||""});return this.hoganUtils.render(je,"line",{type:n.type,lineClass:"d2h-code-linenumber",contentClass:"d2h-code-line",prefix:n.prefix===" "?" ":n.prefix,content:n.content,lineNumber:e,line:n,file:t})}}const bn=Object.assign(Object.assign({},st),{renderNothingWhenEmpty:!1,matchingMaxComparisons:2500,maxLineSizeInBlockForComparison:200}),We="generic",bl="side-by-side",yl="icon",_l="tag";class wl{constructor(t,n={}){this.hoganUtils=t,this.config=Object.assign(Object.assign({},bn),n)}render(t){const n=t.map(e=>{let l;return e.blocks.length?l=this.generateFileHtml(e):l=this.generateEmptyDiff(),this.makeFileDiffHtml(e,l)}).join(`
|
|
7
|
+
`);return this.hoganUtils.render(We,"wrapper",{colorScheme:$t(this.config.colorScheme),content:n})}makeFileDiffHtml(t,n){if(this.config.renderNothingWhenEmpty&&Array.isArray(t.blocks)&&t.blocks.length===0)return"";const e=this.hoganUtils.template(bl,"file-diff"),l=this.hoganUtils.template(We,"file-path"),i=this.hoganUtils.template(yl,"file"),o=this.hoganUtils.template(_l,St(t));return e.render({file:t,fileHtmlId:Tt(t),diffs:n,filePath:l.render({fileDiffName:lt(t)},{fileIcon:i,fileTag:o})})}generateEmptyDiff(){return{right:"",left:this.hoganUtils.render(We,"empty-diff",{contentClass:"d2h-code-side-line",CSSLineClass:ve})}}generateFileHtml(t){const n=xt(Ct(e=>Se(e.content,t.isCombined).content));return t.blocks.map(e=>{const l={left:this.makeHeaderHtml(e.header,t),right:this.makeHeaderHtml("")};return this.applyLineGroupping(e).forEach(([i,o,u])=>{if(o.length&&u.length&&!i.length)this.applyRematchMatching(o,u,n).map(([h,a])=>{const{left:p,right:C}=this.processChangedLines(t.isCombined,h,a);l.left+=p,l.right+=C});else if(i.length)i.forEach(h=>{const{prefix:a,content:p}=Se(h.content,t.isCombined),{left:C,right:w}=this.generateLineHtml({type:ve.CONTEXT,prefix:a,content:p,number:h.oldNumber},{type:ve.CONTEXT,prefix:a,content:p,number:h.newNumber});l.left+=C,l.right+=w});else if(o.length||u.length){const{left:h,right:a}=this.processChangedLines(t.isCombined,o,u);l.left+=h,l.right+=a}else console.error("Unknown state reached while processing groups of lines",i,o,u)}),l}).reduce((e,l)=>({left:e.left+l.left,right:e.right+l.right}),{left:"",right:""})}applyLineGroupping(t){const n=[];let e=[],l=[];for(let i=0;i<t.lines.length;i++){const o=t.lines[i];(o.type!==de.INSERT&&l.length||o.type===de.CONTEXT&&e.length>0)&&(n.push([[],e,l]),e=[],l=[]),o.type===de.CONTEXT?n.push([[o],[],[]]):o.type===de.INSERT&&e.length===0?n.push([[],[],[o]]):o.type===de.INSERT&&e.length>0?l.push(o):o.type===de.DELETE&&e.push(o)}return(e.length||l.length)&&(n.push([[],e,l]),e=[],l=[]),n}applyRematchMatching(t,n,e){const l=t.length*n.length,i=pn(t.concat(n).map(u=>u.content.length));return l<this.config.matchingMaxComparisons&&i<this.config.maxLineSizeInBlockForComparison&&(this.config.matching==="lines"||this.config.matching==="words")?e(t,n):[[t,n]]}makeHeaderHtml(t,n){return this.hoganUtils.render(We,"block-header",{CSSLineClass:ve,blockHeader:n!=null&&n.isTooBig?t:ze(t),lineClass:"d2h-code-side-linenumber",contentClass:"d2h-code-side-line"})}processChangedLines(t,n,e){const l={right:"",left:""},i=Math.max(n.length,e.length);for(let o=0;o<i;o++){const u=n[o],h=e[o],a=u!==void 0&&h!==void 0?gn(u.content,h.content,t,this.config):void 0,p=u!==void 0&&u.oldNumber!==void 0?Object.assign(Object.assign({},a!==void 0?{prefix:a.oldLine.prefix,content:a.oldLine.content,type:ve.DELETE_CHANGES}:Object.assign(Object.assign({},Se(u.content,t)),{type:Qe(u.type)})),{number:u.oldNumber}):void 0,C=h!==void 0&&h.newNumber!==void 0?Object.assign(Object.assign({},a!==void 0?{prefix:a.newLine.prefix,content:a.newLine.content,type:ve.INSERT_CHANGES}:Object.assign(Object.assign({},Se(h.content,t)),{type:Qe(h.type)})),{number:h.newNumber}):void 0,{left:w,right:r}=this.generateLineHtml(p,C);l.left+=w,l.right+=r}return l}generateLineHtml(t,n){return{left:this.generateSingleHtml(t),right:this.generateSingleHtml(n)}}generateSingleHtml(t){const n="d2h-code-side-linenumber",e="d2h-code-side-line";return this.hoganUtils.render(We,"line",{type:(t==null?void 0:t.type)||`${ve.CONTEXT} d2h-emptyplaceholder`,lineClass:t!==void 0?n:`${n} d2h-code-side-emptyplaceholder`,contentClass:t!==void 0?e:`${e} d2h-code-side-emptyplaceholder`,prefix:(t==null?void 0:t.prefix)===" "?" ":t==null?void 0:t.prefix,content:t==null?void 0:t.content,lineNumber:t==null?void 0:t.number})}}var dt={},Qt;function kl(){return Qt||(Qt=1,(function(s){(function(t){var n=/\S/,e=/\"/g,l=/\n/g,i=/\r/g,o=/\\/g,u=/\u2028/,h=/\u2029/;t.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},t.scan=function(N,D){var R=N.length,ne=0,re=1,W=2,Q=ne,he=null,fe=null,U="",O=[],F=!1,f=0,A=0,v="{{",j="}}";function le(){U.length>0&&(O.push({tag:"_t",text:new String(U)}),U="")}function pe(){for(var ye=!0,_e=A;_e<O.length;_e++)if(ye=t.tags[O[_e].tag]<t.tags._v||O[_e].tag=="_t"&&O[_e].text.match(n)===null,!ye)return!1;return ye}function te(ye,_e){if(le(),ye&&pe())for(var ke=A,Pe;ke<O.length;ke++)O[ke].text&&((Pe=O[ke+1])&&Pe.tag==">"&&(Pe.indent=O[ke].text.toString()),O.splice(ke,1));else _e||O.push({tag:`
|
|
8
|
+
`});F=!1,A=O.length}function se(ye,_e){var ke="="+j,Pe=ye.indexOf(ke,_e),He=p(ye.substring(ye.indexOf("=",_e)+1,Pe)).split(" ");return v=He[0],j=He[He.length-1],Pe+ke.length-1}for(D&&(D=D.split(" "),v=D[0],j=D[1]),f=0;f<R;f++)Q==ne?C(v,N,f)?(--f,le(),Q=re):N.charAt(f)==`
|
|
9
|
+
`?te(F):U+=N.charAt(f):Q==re?(f+=v.length-1,fe=t.tags[N.charAt(f+1)],he=fe?N.charAt(f+1):"_v",he=="="?(f=se(N,f),Q=ne):(fe&&f++,Q=W),F=f):C(j,N,f)?(O.push({tag:he,n:p(U),otag:v,ctag:j,i:he=="/"?F-v.length:f+j.length}),U="",f+=j.length-1,Q=ne,he=="{"&&(j=="}}"?f++:a(O[O.length-1]))):U+=N.charAt(f);return te(F,!0),O};function a(T){T.n.substr(T.n.length-1)==="}"&&(T.n=T.n.substring(0,T.n.length-1))}function p(T){return T.trim?T.trim():T.replace(/^\s*|\s*$/g,"")}function C(T,N,D){if(N.charAt(D)!=T.charAt(0))return!1;for(var R=1,ne=T.length;R<ne;R++)if(N.charAt(D+R)!=T.charAt(R))return!1;return!0}var w={_t:!0,"\n":!0,$:!0,"/":!0};function r(T,N,D,R){var ne=[],re=null,W=null,Q=null;for(W=D[D.length-1];T.length>0;){if(Q=T.shift(),W&&W.tag=="<"&&!(Q.tag in w))throw new Error("Illegal content in < super tag.");if(t.tags[Q.tag]<=t.tags.$||c(Q,R))D.push(Q),Q.nodes=r(T,Q.tag,D,R);else if(Q.tag=="/"){if(D.length===0)throw new Error("Closing tag without opener: /"+Q.n);if(re=D.pop(),Q.n!=re.n&&!g(Q.n,re.n,R))throw new Error("Nesting error: "+re.n+" vs. "+Q.n);return re.end=Q.i,ne}else Q.tag==`
|
|
10
|
+
`&&(Q.last=T.length==0||T[0].tag==`
|
|
11
|
+
`);ne.push(Q)}if(D.length>0)throw new Error("missing closing tag: "+D.pop().n);return ne}function c(T,N){for(var D=0,R=N.length;D<R;D++)if(N[D].o==T.n)return T.tag="#",!0}function g(T,N,D){for(var R=0,ne=D.length;R<ne;R++)if(D[R].c==T&&D[R].o==N)return!0}function d(T){var N=[];for(var D in T)N.push('"'+L(D)+'": function(c,p,t,i) {'+T[D]+"}");return"{ "+N.join(",")+" }"}function S(T){var N=[];for(var D in T.partials)N.push('"'+L(D)+'":{name:"'+L(T.partials[D].name)+'", '+S(T.partials[D])+"}");return"partials: {"+N.join(",")+"}, subs: "+d(T.subs)}t.stringify=function(T,N,D){return"{code: function (c,p,i) { "+t.wrapMain(T.code)+" },"+S(T)+"}"};var $=0;t.generate=function(T,N,D){$=0;var R={code:"",subs:{},partials:{}};return t.walk(T,R),D.asString?this.stringify(R,N,D):this.makeTemplate(R,N,D)},t.wrapMain=function(T){return'var t=this;t.b(i=i||"");'+T+"return t.fl();"},t.template=t.Template,t.makeTemplate=function(T,N,D){var R=this.makePartials(T);return R.code=new Function("c","p","i",this.wrapMain(T.code)),new this.template(R,N,this,D)},t.makePartials=function(T){var N,D={subs:{},partials:T.partials,name:T.name};for(N in D.partials)D.partials[N]=this.makePartials(D.partials[N]);for(N in T.subs)D.subs[N]=new Function("c","p","t","i",T.subs[N]);return D};function L(T){return T.replace(o,"\\\\").replace(e,'\\"').replace(l,"\\n").replace(i,"\\r").replace(u,"\\u2028").replace(h,"\\u2029")}function x(T){return~T.indexOf(".")?"d":"f"}function I(T,N){var D="<"+(N.prefix||""),R=D+T.n+$++;return N.partials[R]={name:T.n,partials:{}},N.code+='t.b(t.rp("'+L(R)+'",c,p,"'+(T.indent||"")+'"));',R}t.codegen={"#":function(T,N){N.code+="if(t.s(t."+x(T.n)+'("'+L(T.n)+'",c,p,1),c,p,0,'+T.i+","+T.end+',"'+T.otag+" "+T.ctag+'")){t.rs(c,p,function(c,p,t){',t.walk(T.nodes,N),N.code+="});c.pop();}"},"^":function(T,N){N.code+="if(!t.s(t."+x(T.n)+'("'+L(T.n)+'",c,p,1),c,p,1,0,0,"")){',t.walk(T.nodes,N),N.code+="};"},">":I,"<":function(T,N){var D={partials:{},code:"",subs:{},inPartial:!0};t.walk(T.nodes,D);var R=N.partials[I(T,N)];R.subs=D.subs,R.partials=D.partials},$:function(T,N){var D={subs:{},code:"",partials:N.partials,prefix:T.n};t.walk(T.nodes,D),N.subs[T.n]=D.code,N.inPartial||(N.code+='t.sub("'+L(T.n)+'",c,p,i);')},"\n":function(T,N){N.code+=Z('"\\n"'+(T.last?"":" + i"))},_v:function(T,N){N.code+="t.b(t.v(t."+x(T.n)+'("'+L(T.n)+'",c,p,0)));'},_t:function(T,N){N.code+=Z('"'+L(T.text)+'"')},"{":B,"&":B};function B(T,N){N.code+="t.b(t.t(t."+x(T.n)+'("'+L(T.n)+'",c,p,0)));'}function Z(T){return"t.b("+T+");"}t.walk=function(T,N){for(var D,R=0,ne=T.length;R<ne;R++)D=t.codegen[T[R].tag],D&&D(T[R],N);return N},t.parse=function(T,N,D){return D=D||{},r(T,"",[],D.sectionTags||[])},t.cache={},t.cacheKey=function(T,N){return[T,!!N.asString,!!N.disableLambda,N.delimiters,!!N.modelGet].join("||")},t.compile=function(T,N){N=N||{};var D=t.cacheKey(T,N),R=this.cache[D];if(R){var ne=R.partials;for(var re in ne)delete ne[re].instance;return R}return R=this.generate(this.parse(this.scan(T,N.delimiters),T,N),T,N),this.cache[D]=R}})(s)})(dt)),dt}var ct={},Zt;function Cl(){return Zt||(Zt=1,(function(s){(function(t){t.Template=function(r,c,g,d){r=r||{},this.r=r.code||this.r,this.c=g,this.options=d||{},this.text=c||"",this.partials=r.partials||{},this.subs=r.subs||{},this.buf=""},t.Template.prototype={r:function(r,c,g){return""},v:C,t:p,render:function(c,g,d){return this.ri([c],g||{},d)},ri:function(r,c,g){return this.r(r,c,g)},ep:function(r,c){var g=this.partials[r],d=c[g.name];if(g.instance&&g.base==d)return g.instance;if(typeof d=="string"){if(!this.c)throw new Error("No compiler available.");d=this.c.compile(d,this.options)}if(!d)return null;if(this.partials[r].base=d,g.subs){c.stackText||(c.stackText={});for(key in g.subs)c.stackText[key]||(c.stackText[key]=this.activeSub!==void 0&&c.stackText[this.activeSub]?c.stackText[this.activeSub]:this.text);d=e(d,g.subs,g.partials,this.stackSubs,this.stackPartials,c.stackText)}return this.partials[r].instance=d,d},rp:function(r,c,g,d){var S=this.ep(r,g);return S?S.ri(c,g,d):""},rs:function(r,c,g){var d=r[r.length-1];if(!w(d)){g(r,c,this);return}for(var S=0;S<d.length;S++)r.push(d[S]),g(r,c,this),r.pop()},s:function(r,c,g,d,S,$,L){var x;return w(r)&&r.length===0?!1:(typeof r=="function"&&(r=this.ms(r,c,g,d,S,$,L)),x=!!r,!d&&x&&c&&c.push(typeof r=="object"?r:c[c.length-1]),x)},d:function(r,c,g,d){var S,$=r.split("."),L=this.f($[0],c,g,d),x=this.options.modelGet,I=null;if(r==="."&&w(c[c.length-2]))L=c[c.length-1];else for(var B=1;B<$.length;B++)S=n($[B],L,x),S!==void 0?(I=L,L=S):L="";return d&&!L?!1:(!d&&typeof L=="function"&&(c.push(I),L=this.mv(L,c,g),c.pop()),L)},f:function(r,c,g,d){for(var S=!1,$=null,L=!1,x=this.options.modelGet,I=c.length-1;I>=0;I--)if($=c[I],S=n(r,$,x),S!==void 0){L=!0;break}return L?(!d&&typeof S=="function"&&(S=this.mv(S,c,g)),S):d?!1:""},ls:function(r,c,g,d,S,$){var L=this.options.delimiters;return this.options.delimiters=$,this.b(this.ct(p(r.call(c,S,g)),c,d)),this.options.delimiters=L,!1},ct:function(r,c,g){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(r,this.options).render(c,g)},b:function(r){this.buf+=r},fl:function(){var r=this.buf;return this.buf="",r},ms:function(r,c,g,d,S,$,L){var x,I=c[c.length-1],B=r.call(I);return typeof B=="function"?d?!0:(x=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(B,I,c,g,x.substring(S,$),L)):B},mv:function(r,c,g){var d=c[c.length-1],S=r.call(d);return typeof S=="function"?this.ct(p(S.call(d)),d,g):S},sub:function(r,c,g,d){var S=this.subs[r];S&&(this.activeSub=r,S(c,g,this,d),this.activeSub=!1)}};function n(r,c,g){var d;return c&&typeof c=="object"&&(c[r]!==void 0?d=c[r]:g&&c.get&&typeof c.get=="function"&&(d=c.get(r))),d}function e(r,c,g,d,S,$){function L(){}L.prototype=r;function x(){}x.prototype=r.subs;var I,B=new L;B.subs=new x,B.subsText={},B.buf="",d=d||{},B.stackSubs=d,B.subsText=$;for(I in c)d[I]||(d[I]=c[I]);for(I in d)B.subs[I]=d[I];S=S||{},B.stackPartials=S;for(I in g)S[I]||(S[I]=g[I]);for(I in S)B.partials[I]=S[I];return B}var l=/&/g,i=/</g,o=/>/g,u=/\'/g,h=/\"/g,a=/[&<>\"\']/;function p(r){return String(r??"")}function C(r){return r=p(r),a.test(r)?r.replace(l,"&").replace(i,"<").replace(o,">").replace(u,"'").replace(h,"""):r}var w=Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"}})(s)})(ct)),ct}var ft,en;function xl(){if(en)return ft;en=1;var s=kl();return s.Template=Cl().Template,s.template=s.Template,ft=s,ft}var ue=xl();const ce={};ce["file-summary-line"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<li class="d2h-file-list-line">'),e.b(`
|
|
12
|
+
`+n),e.b(' <span class="d2h-file-name-wrapper">'),e.b(`
|
|
13
|
+
`+n),e.b(e.rp("<fileIcon0",s,t," ")),e.b(' <a href="#'),e.b(e.v(e.f("fileHtmlId",s,t,0))),e.b('" class="d2h-file-name">'),e.b(e.v(e.f("fileName",s,t,0))),e.b("</a>"),e.b(`
|
|
14
|
+
`+n),e.b(' <span class="d2h-file-stats">'),e.b(`
|
|
15
|
+
`+n),e.b(' <span class="d2h-lines-added">'),e.b(e.v(e.f("addedLines",s,t,0))),e.b("</span>"),e.b(`
|
|
16
|
+
`+n),e.b(' <span class="d2h-lines-deleted">'),e.b(e.v(e.f("deletedLines",s,t,0))),e.b("</span>"),e.b(`
|
|
17
|
+
`+n),e.b(" </span>"),e.b(`
|
|
18
|
+
`+n),e.b(" </span>"),e.b(`
|
|
19
|
+
`+n),e.b("</li>"),e.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}}},subs:{}});ce["file-summary-wrapper"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<div class="d2h-file-list-wrapper '),e.b(e.v(e.f("colorScheme",s,t,0))),e.b('">'),e.b(`
|
|
20
|
+
`+n),e.b(' <div class="d2h-file-list-header">'),e.b(`
|
|
21
|
+
`+n),e.b(' <span class="d2h-file-list-title">Files changed ('),e.b(e.v(e.f("filesNumber",s,t,0))),e.b(")</span>"),e.b(`
|
|
22
|
+
`+n),e.b(' <a class="d2h-file-switch d2h-hide">hide</a>'),e.b(`
|
|
23
|
+
`+n),e.b(' <a class="d2h-file-switch d2h-show">show</a>'),e.b(`
|
|
24
|
+
`+n),e.b(" </div>"),e.b(`
|
|
25
|
+
`+n),e.b(' <ol class="d2h-file-list">'),e.b(`
|
|
26
|
+
`+n),e.b(" "),e.b(e.t(e.f("files",s,t,0))),e.b(`
|
|
27
|
+
`+n),e.b(" </ol>"),e.b(`
|
|
28
|
+
`+n),e.b("</div>"),e.fl()},partials:{},subs:{}});ce["generic-block-header"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b("<tr>"),e.b(`
|
|
29
|
+
`+n),e.b(' <td class="'),e.b(e.v(e.f("lineClass",s,t,0))),e.b(" "),e.b(e.v(e.d("CSSLineClass.INFO",s,t,0))),e.b('"></td>'),e.b(`
|
|
30
|
+
`+n),e.b(' <td class="'),e.b(e.v(e.d("CSSLineClass.INFO",s,t,0))),e.b('">'),e.b(`
|
|
31
|
+
`+n),e.b(' <div class="'),e.b(e.v(e.f("contentClass",s,t,0))),e.b('">'),e.s(e.f("blockHeader",s,t,1),s,t,0,156,173,"{{ }}")&&(e.rs(s,t,function(l,i,o){o.b(o.t(o.f("blockHeader",l,i,0)))}),s.pop()),e.s(e.f("blockHeader",s,t,1),s,t,1,0,0,"")||e.b(" "),e.b("</div>"),e.b(`
|
|
32
|
+
`+n),e.b(" </td>"),e.b(`
|
|
33
|
+
`+n),e.b("</tr>"),e.fl()},partials:{},subs:{}});ce["generic-empty-diff"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b("<tr>"),e.b(`
|
|
34
|
+
`+n),e.b(' <td class="'),e.b(e.v(e.d("CSSLineClass.INFO",s,t,0))),e.b('">'),e.b(`
|
|
35
|
+
`+n),e.b(' <div class="'),e.b(e.v(e.f("contentClass",s,t,0))),e.b('">'),e.b(`
|
|
36
|
+
`+n),e.b(" File without changes"),e.b(`
|
|
37
|
+
`+n),e.b(" </div>"),e.b(`
|
|
38
|
+
`+n),e.b(" </td>"),e.b(`
|
|
39
|
+
`+n),e.b("</tr>"),e.fl()},partials:{},subs:{}});ce["generic-file-path"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<span class="d2h-file-name-wrapper">'),e.b(`
|
|
40
|
+
`+n),e.b(e.rp("<fileIcon0",s,t," ")),e.b(' <span class="d2h-file-name">'),e.b(e.v(e.f("fileDiffName",s,t,0))),e.b("</span>"),e.b(`
|
|
41
|
+
`+n),e.b(e.rp("<fileTag1",s,t," ")),e.b("</span>"),e.b(`
|
|
42
|
+
`+n),e.b('<label class="d2h-file-collapse">'),e.b(`
|
|
43
|
+
`+n),e.b(' <input class="d2h-file-collapse-input" type="checkbox" name="viewed" value="viewed">'),e.b(`
|
|
44
|
+
`+n),e.b(" Viewed"),e.b(`
|
|
45
|
+
`+n),e.b("</label>"),e.fl()},partials:{"<fileIcon0":{name:"fileIcon",partials:{},subs:{}},"<fileTag1":{name:"fileTag",partials:{},subs:{}}},subs:{}});ce["generic-line"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b("<tr>"),e.b(`
|
|
46
|
+
`+n),e.b(' <td class="'),e.b(e.v(e.f("lineClass",s,t,0))),e.b(" "),e.b(e.v(e.f("type",s,t,0))),e.b('">'),e.b(`
|
|
47
|
+
`+n),e.b(" "),e.b(e.t(e.f("lineNumber",s,t,0))),e.b(`
|
|
48
|
+
`+n),e.b(" </td>"),e.b(`
|
|
49
|
+
`+n),e.b(' <td class="'),e.b(e.v(e.f("type",s,t,0))),e.b('">'),e.b(`
|
|
50
|
+
`+n),e.b(' <div class="'),e.b(e.v(e.f("contentClass",s,t,0))),e.b('">'),e.b(`
|
|
51
|
+
`+n),e.s(e.f("prefix",s,t,1),s,t,0,162,238,"{{ }}")&&(e.rs(s,t,function(l,i,o){o.b(' <span class="d2h-code-line-prefix">'),o.b(o.t(o.f("prefix",l,i,0))),o.b("</span>"),o.b(`
|
|
52
|
+
`+n)}),s.pop()),e.s(e.f("prefix",s,t,1),s,t,1,0,0,"")||(e.b(' <span class="d2h-code-line-prefix"> </span>'),e.b(`
|
|
53
|
+
`+n)),e.s(e.f("content",s,t,1),s,t,0,371,445,"{{ }}")&&(e.rs(s,t,function(l,i,o){o.b(' <span class="d2h-code-line-ctn">'),o.b(o.t(o.f("content",l,i,0))),o.b("</span>"),o.b(`
|
|
54
|
+
`+n)}),s.pop()),e.s(e.f("content",s,t,1),s,t,1,0,0,"")||(e.b(' <span class="d2h-code-line-ctn"><br></span>'),e.b(`
|
|
55
|
+
`+n)),e.b(" </div>"),e.b(`
|
|
56
|
+
`+n),e.b(" </td>"),e.b(`
|
|
57
|
+
`+n),e.b("</tr>"),e.fl()},partials:{},subs:{}});ce["generic-wrapper"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<div class="d2h-wrapper '),e.b(e.v(e.f("colorScheme",s,t,0))),e.b('">'),e.b(`
|
|
58
|
+
`+n),e.b(" "),e.b(e.t(e.f("content",s,t,0))),e.b(`
|
|
59
|
+
`+n),e.b("</div>"),e.fl()},partials:{},subs:{}});ce["icon-file-added"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<svg aria-hidden="true" class="d2h-icon d2h-added" height="16" title="added" version="1.1" viewBox="0 0 14 16"'),e.b(`
|
|
60
|
+
`+n),e.b(' width="14">'),e.b(`
|
|
61
|
+
`+n),e.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM6 9H3V7h3V4h2v3h3v2H8v3H6V9z"></path>'),e.b(`
|
|
62
|
+
`+n),e.b("</svg>"),e.fl()},partials:{},subs:{}});ce["icon-file-changed"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<svg aria-hidden="true" class="d2h-icon d2h-changed" height="16" title="modified" version="1.1"'),e.b(`
|
|
63
|
+
`+n),e.b(' viewBox="0 0 14 16" width="14">'),e.b(`
|
|
64
|
+
`+n),e.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM4 8c0-1.66 1.34-3 3-3s3 1.34 3 3-1.34 3-3 3-3-1.34-3-3z"></path>'),e.b(`
|
|
65
|
+
`+n),e.b("</svg>"),e.fl()},partials:{},subs:{}});ce["icon-file-deleted"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<svg aria-hidden="true" class="d2h-icon d2h-deleted" height="16" title="removed" version="1.1"'),e.b(`
|
|
66
|
+
`+n),e.b(' viewBox="0 0 14 16" width="14">'),e.b(`
|
|
67
|
+
`+n),e.b(' <path d="M13 1H1C0.45 1 0 1.45 0 2v12c0 0.55 0.45 1 1 1h12c0.55 0 1-0.45 1-1V2c0-0.55-0.45-1-1-1z m0 13H1V2h12v12zM11 9H3V7h8v2z"></path>'),e.b(`
|
|
68
|
+
`+n),e.b("</svg>"),e.fl()},partials:{},subs:{}});ce["icon-file-renamed"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<svg aria-hidden="true" class="d2h-icon d2h-moved" height="16" title="renamed" version="1.1"'),e.b(`
|
|
69
|
+
`+n),e.b(' viewBox="0 0 14 16" width="14">'),e.b(`
|
|
70
|
+
`+n),e.b(' <path d="M6 9H3V7h3V4l5 4-5 4V9z m8-7v12c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h12c0.55 0 1 0.45 1 1z m-1 0H1v12h12V2z"></path>'),e.b(`
|
|
71
|
+
`+n),e.b("</svg>"),e.fl()},partials:{},subs:{}});ce["icon-file"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<svg aria-hidden="true" class="d2h-icon" height="16" version="1.1" viewBox="0 0 12 16" width="12">'),e.b(`
|
|
72
|
+
`+n),e.b(' <path d="M6 5H2v-1h4v1zM2 8h7v-1H2v1z m0 2h7v-1H2v1z m0 2h7v-1H2v1z m10-7.5v9.5c0 0.55-0.45 1-1 1H1c-0.55 0-1-0.45-1-1V2c0-0.55 0.45-1 1-1h7.5l3.5 3.5z m-1 0.5L8 2H1v12h10V5z"></path>'),e.b(`
|
|
73
|
+
`+n),e.b("</svg>"),e.fl()},partials:{},subs:{}});ce["line-by-line-file-diff"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<div id="'),e.b(e.v(e.f("fileHtmlId",s,t,0))),e.b('" class="d2h-file-wrapper" data-lang="'),e.b(e.v(e.d("file.language",s,t,0))),e.b('">'),e.b(`
|
|
74
|
+
`+n),e.b(' <div class="d2h-file-header">'),e.b(`
|
|
75
|
+
`+n),e.b(" "),e.b(e.t(e.f("filePath",s,t,0))),e.b(`
|
|
76
|
+
`+n),e.b(" </div>"),e.b(`
|
|
77
|
+
`+n),e.b(' <div class="d2h-file-diff">'),e.b(`
|
|
78
|
+
`+n),e.b(' <div class="d2h-code-wrapper">'),e.b(`
|
|
79
|
+
`+n),e.b(' <table class="d2h-diff-table">'),e.b(`
|
|
80
|
+
`+n),e.b(' <tbody class="d2h-diff-tbody">'),e.b(`
|
|
81
|
+
`+n),e.b(" "),e.b(e.t(e.f("diffs",s,t,0))),e.b(`
|
|
82
|
+
`+n),e.b(" </tbody>"),e.b(`
|
|
83
|
+
`+n),e.b(" </table>"),e.b(`
|
|
84
|
+
`+n),e.b(" </div>"),e.b(`
|
|
85
|
+
`+n),e.b(" </div>"),e.b(`
|
|
86
|
+
`+n),e.b("</div>"),e.fl()},partials:{},subs:{}});ce["line-by-line-numbers"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<div class="line-num1">'),e.b(e.v(e.f("oldNumber",s,t,0))),e.b("</div>"),e.b(`
|
|
87
|
+
`+n),e.b('<div class="line-num2">'),e.b(e.v(e.f("newNumber",s,t,0))),e.b("</div>"),e.fl()},partials:{},subs:{}});ce["side-by-side-file-diff"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<div id="'),e.b(e.v(e.f("fileHtmlId",s,t,0))),e.b('" class="d2h-file-wrapper" data-lang="'),e.b(e.v(e.d("file.language",s,t,0))),e.b('">'),e.b(`
|
|
88
|
+
`+n),e.b(' <div class="d2h-file-header">'),e.b(`
|
|
89
|
+
`+n),e.b(" "),e.b(e.t(e.f("filePath",s,t,0))),e.b(`
|
|
90
|
+
`+n),e.b(" </div>"),e.b(`
|
|
91
|
+
`+n),e.b(' <div class="d2h-files-diff">'),e.b(`
|
|
92
|
+
`+n),e.b(' <div class="d2h-file-side-diff">'),e.b(`
|
|
93
|
+
`+n),e.b(' <div class="d2h-code-wrapper">'),e.b(`
|
|
94
|
+
`+n),e.b(' <table class="d2h-diff-table">'),e.b(`
|
|
95
|
+
`+n),e.b(' <tbody class="d2h-diff-tbody">'),e.b(`
|
|
96
|
+
`+n),e.b(" "),e.b(e.t(e.d("diffs.left",s,t,0))),e.b(`
|
|
97
|
+
`+n),e.b(" </tbody>"),e.b(`
|
|
98
|
+
`+n),e.b(" </table>"),e.b(`
|
|
99
|
+
`+n),e.b(" </div>"),e.b(`
|
|
100
|
+
`+n),e.b(" </div>"),e.b(`
|
|
101
|
+
`+n),e.b(' <div class="d2h-file-side-diff">'),e.b(`
|
|
102
|
+
`+n),e.b(' <div class="d2h-code-wrapper">'),e.b(`
|
|
103
|
+
`+n),e.b(' <table class="d2h-diff-table">'),e.b(`
|
|
104
|
+
`+n),e.b(' <tbody class="d2h-diff-tbody">'),e.b(`
|
|
105
|
+
`+n),e.b(" "),e.b(e.t(e.d("diffs.right",s,t,0))),e.b(`
|
|
106
|
+
`+n),e.b(" </tbody>"),e.b(`
|
|
107
|
+
`+n),e.b(" </table>"),e.b(`
|
|
108
|
+
`+n),e.b(" </div>"),e.b(`
|
|
109
|
+
`+n),e.b(" </div>"),e.b(`
|
|
110
|
+
`+n),e.b(" </div>"),e.b(`
|
|
111
|
+
`+n),e.b("</div>"),e.fl()},partials:{},subs:{}});ce["tag-file-added"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>'),e.fl()},partials:{},subs:{}});ce["tag-file-changed"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>'),e.fl()},partials:{},subs:{}});ce["tag-file-deleted"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>'),e.fl()},partials:{},subs:{}});ce["tag-file-renamed"]=new ue.Template({code:function(s,t,n){var e=this;return e.b(n=n||""),e.b('<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>'),e.fl()},partials:{},subs:{}});class $l{constructor({compiledTemplates:t={},rawTemplates:n={}}){const e=Object.entries(n).reduce((l,[i,o])=>{const u=ue.compile(o,{asString:!1});return Object.assign(Object.assign({},l),{[i]:u})},{});this.preCompiledTemplates=Object.assign(Object.assign(Object.assign({},ce),t),e)}static compile(t){return ue.compile(t,{asString:!1})}render(t,n,e,l,i){const o=this.templateKey(t,n);try{return this.preCompiledTemplates[o].render(e,l,i)}catch{throw new Error(`Could not find template to render '${o}'`)}}template(t,n){return this.preCompiledTemplates[this.templateKey(t,n)]}templateKey(t,n){return`${t}-${n}`}}const Tl=Object.assign(Object.assign(Object.assign({},vn),bn),{outputFormat:Ws.LINE_BY_LINE,drawFileList:!0});function Sl(s,t={}){const n=Object.assign(Object.assign({},Tl),t),e=typeof s=="string"?el(s,n):s,l=new $l(n),{colorScheme:i}=n,o={colorScheme:i},u=n.drawFileList?new hl(l,o).render(e):"",h=n.outputFormat==="side-by-side"?new wl(l,n).render(e):new vl(l,n).render(e);return u+h}const Ll={class:"diff-viewer"},El=["innerHTML"],Nl={key:1,class:"diff-fallback mono"},Il=Ce({__name:"DiffViewer",props:{patch:{}},setup(s){const t=s,n=Y(()=>{if(!t.patch.trim())return"";try{return Sl(t.patch,{drawFileList:!1,outputFormat:"line-by-line",matching:"lines",colorScheme:Ae.DARK,renderNothingWhenEmpty:!0})}catch{return""}}),e=Y(()=>n.value===""?t.patch.split(`
|
|
112
|
+
`):[]);return(l,i)=>(k(),M("div",Ll,[n.value?(k(),M("div",{key:0,class:"diff-html",innerHTML:n.value},null,8,El)):e.value.length?(k(),M("pre",Nl,[(k(!0),M(ie,null,me(e.value,(o,u)=>(k(),M(ie,{key:u},[P(V(o)+`
|
|
113
|
+
`,1)],64))),128))])):K("",!0)]))}}),vt=xe(Il,[["__scopeId","data-v-3ec3d3ee"]]),Pl={class:"page status-page"},Vl={class:"page-head"},Dl={class:"head-branch"},Rl={key:0,class:"tracking mono"},Fl={key:1,class:"sync ahead"},Al={key:2,class:"sync behind"},Ml={class:"repo-path mono"},Ol={key:1,class:"empty-tip"},zl={key:2,class:"status-layout"},Hl={class:"panel-head"},Bl={class:"panel-actions"},Ul={class:"tree-scroll"},jl={class:"group-label"},Wl={key:0,class:"tree-dir"},ql=["title","onDblclick"],Gl={class:"node-name"},Kl={class:"node-actions"},Xl={key:1,class:"pane-empty"},Jl={class:"status-content"},Yl={class:"toolbar"},Ql={class:"toolbar-group"},Zl={class:"card-head"},ei={class:"card-actions"},ti={class:"tab-label"},ni={class:"tab-hint"},si={key:0,class:"file-empty"},li={key:1,class:"file-list"},ii=["title"],oi={class:"card-head"},ai={class:"card-title"},ri={class:"card-actions"},ui={key:0,class:"file-empty"},di={key:1,class:"stash-list mono"},ci={class:"stash-main"},fi={class:"stash-ref"},pi=["title"],hi={key:0,class:"stash-date"},mi={class:"stash-actions"},gi={class:"diff-wrap"},vi={class:"diff-summary"},bi={class:"add"},yi={class:"del"},_i={key:0,class:"warn"},wi={key:0,class:"file-empty"},ki={key:0,class:"stash-files"},Ci={class:"stash-files-head"},xi={class:"stash-files-title"},$i={class:"card-actions"},Ti={class:"file-list compact"},Si={class:"file-path mono"},Li=Ce({__name:"StatusView",setup(s){const t=Ne(),n=qe(),{revision:e}=nt(),l=()=>t.currentId,i=q(null),o=q([]),u=q(!1),h=q(""),a=ht({visible:!1,title:"",diff:null,patch:"",loading:!1}),p=q(!1),C=q(""),w=q(!1),r=q(""),c=q(""),g=q(!1),d=q(""),S=q(!1),$=q(!1),L=q(""),x=ht(new Set),I=Y(()=>x.size),B=q("unstaged"),{confirmVisible:Z,pending:T,canRun:N,previewAndConfirm:D,executeConfirmed:R,cancel:ne}=cn(l),re=Y(()=>{var E;return((E=t.current)==null?void 0:E.path)??""}),W=Y(()=>{var E,b;return((E=i.value)==null?void 0:E.currentShort)??((b=i.value)==null?void 0:b.current)??""}),Q=Y(()=>{var E;return((E=i.value)==null?void 0:E.ahead)??0}),he=Y(()=>{var E;return((E=i.value)==null?void 0:E.behind)??0}),fe=Y(()=>n.panes),U=Y(()=>{const E=i.value;if(!E)return{unstaged:[],staged:[],untracked:[],all:[]};const b=E.untracked.map($e=>({path:$e,status:"??",indexStatus:"?",workTreeStatus:"?",staged:!1,untracked:!0,conflicted:!1})),ae=[...E.staged,...E.unstaged,...b],G=new Set,we=ae.filter($e=>G.has($e.path)?!1:(G.add($e.path),$e.path!==""));return{unstaged:E.unstaged,staged:E.staged,untracked:b,all:we}}),O=Y(()=>[{key:"unstaged",label:"未暂存",hint:"已修改,未 git add",count:U.value.unstaged.length},{key:"staged",label:"已暂存",hint:"已 git add,未提交",count:U.value.staged.length},{key:"untracked",label:"未跟踪",hint:"工作区新文件",count:U.value.untracked.length},{key:"all",label:"全部",hint:"全部更改",count:U.value.all.length}]),F=Y(()=>U.value[B.value]??[]),f=Y(()=>U.value.all.length);function A(E){if(!E||E.remote||!E.upstream)return"";const b=[];return(E.ahead??0)>0&&b.push(`↑${E.ahead}`),(E.behind??0)>0&&b.push(`↓${E.behind}`),b.join(" ")}async function v(){const E=l();if(E!==null){u.value=!0,h.value="";try{i.value=await os(E)}catch(b){h.value=b instanceof Error?b.message:String(b),i.value=null}finally{u.value=!1}}}async function j(){await n.load()}async function le(){const E=l();if(E!==null)try{o.value=await cs(E)}catch{}}async function pe(){await Promise.all([v(),j(),le()])}async function te(E,b={}){await D(E,b)&&oe.info("请在确认对话框中查看 dry-run 预览")}async function se(){const E=await R();E!=null&&E.success&&await pe()}function ye(E){te("git_add",{paths:[E.path]})}function _e(E){te("git_unstage",{paths:[E.path]})}function ke(E){E.staged?_e(E):ye(E)}function Pe(){te("git_add",{})}function He(){var b;const E=((b=i.value)==null?void 0:b.staged.map(ae=>ae.path))??[];if(E.length===0){oe.info("没有已暂存的文件");return}te("git_unstage",{paths:E})}async function Cn(E){const b=l();if(b!==null){a.title=`${E.path}(${E.staged?"已 git add":"工作区修改"})`,a.diff=null,a.patch="",a.visible=!0,a.loading=!0;try{a.diff=await rs(b,{path:E.path,staged:E.staged})}catch(ae){oe.error(ae instanceof Error?ae.message:String(ae)),a.visible=!1}finally{a.loading=!1}}}async function xn(E){var ae;const b=l();if(b!==null){a.title=`${E.ref} · ${E.message||"(无说明)"}`,a.diff=null,a.patch="",a.visible=!0,a.loading=!0;try{const G=await Ye(b,"git_stash_show",{index:E.index});if(G.success){const we=G.result??{};a.patch=we.patch??""}else oe.error(((ae=G.error)==null?void 0:ae.message)??"查看差异失败"),a.visible=!1}catch(G){oe.error(G instanceof Error?G.message:String(G)),a.visible=!1}finally{a.loading=!1}}}function Lt(E){x.has(E)?x.delete(E):x.add(E)}function Et(E){return x.has(E)}function Nt(){x.clear()}function $n(){for(const E of F.value)x.add(E.path)}function Tn(){for(const E of Ge.value)x.add(E)}const Ge=Y(()=>{const E=i.value;if(!E)return[];const b=new Set;return[...E.unstaged.map(ae=>ae.path),...E.untracked].filter(ae=>b.has(ae)?!1:(b.add(ae),ae!==""))});function Sn(){g.value=!0}function Ln(){const E=Ge.value,b=[...x].filter(we=>E.includes(we)),ae=b.some(we=>{var $e;return(($e=i.value)==null?void 0:$e.untracked.includes(we))??!1}),G={};d.value.trim()&&(G.message=d.value.trim()),b.length&&(G.paths=b),(S.value||ae)&&(G.includeUntracked=!0),g.value=!1,x.clear(),te("git_stash",G)}function En(){te("git_stash",{})}function Nn(E){te("git_stash_apply",{index:E.index})}function In(E){te("git_stash_pop",{index:E.index})}function Pn(E){wt.confirm(`确定删除 ${E.ref} 吗?删除后不可直接恢复。`,"删除 stash",{type:"warning",confirmButtonText:"继续",cancelButtonText:"取消"}).then(()=>void te("git_stash_drop",{index:E.index})).catch(()=>{})}function It(E){E.branch&&te("git_checkout",{branch:E.branch.name})}function Vn(){te("git_pull")}function Dn(){te("git_push")}function Pt(){const E=C.value.trim();if(!E){oe.warning("请输入提交信息");return}p.value=!1,te("git_commit",{message:E})}function Rn(){const E=r.value.trim();if(!E){oe.warning("请输入分支名");return}w.value=!1,te("git_branch_create",c.value.trim()?{name:E,startPoint:c.value.trim()}:{name:E})}function Fn(){const E=L.value.trim()||"HEAD";$.value=!1,L.value="",te("git_reset_hard",{target:E})}function An(E){return E.untracked?"?":E.staged?E.indexStatus||"M":E.workTreeStatus||"M"}function Mn(E){return E.untracked?"new":E.conflicted?"conflict":E.staged?"add":"mod"}function On(E){if(!E)return"";const b=new Date(E);return Number.isNaN(b.getTime())?E:b.toLocaleString()}function zn(E){return E.split(`
|
|
114
|
+
`)[0]??""}return be(l,()=>{a.diff=null,a.patch="",a.visible=!1,x.clear(),pe()}),be(e,()=>{pe()}),Me(()=>{pe()}),(E,b)=>{var Ft,At,Mt,Ot,zt;const ae=z("el-tag"),G=z("el-button"),we=z("el-alert"),$e=z("el-tree"),Vt=z("el-empty"),Ke=z("el-card"),Dt=z("el-badge"),Hn=z("el-tooltip"),ot=z("el-checkbox"),Bn=z("el-tab-pane"),Un=z("el-tabs"),jn=z("el-drawer"),Be=z("el-input"),Xe=z("el-dialog"),Je=z("el-form-item"),Rt=z("el-form"),Wn=tt("loading");return k(),M("div",Pl,[_("div",Vl,[b[26]||(b[26]=_("h2",{class:"page-title"},"仓库状态",-1)),_("div",Dl,[y(ae,{type:"primary",effect:"dark",class:"branch-tag"},{default:m(()=>[P(V(W.value||"—"),1)]),_:1}),(Ft=i.value)!=null&&Ft.tracking?(k(),M("span",Rl,V(i.value.tracking),1)):K("",!0),Q.value?(k(),M("span",Fl,"↑"+V(Q.value),1)):K("",!0),he.value?(k(),M("span",Al,"↓"+V(he.value),1)):K("",!0),(At=i.value)!=null&&At.isClean?(k(),X(ae,{key:3,type:"success",effect:"plain",size:"small"},{default:m(()=>[...b[24]||(b[24]=[P("工作区干净",-1)])]),_:1})):i.value?(k(),X(ae,{key:4,type:"warning",effect:"plain",size:"small"},{default:m(()=>[P(V(f.value)+" 处更改",1)]),_:1})):K("",!0),_("span",Ml,V(re.value),1)]),y(G,{loading:u.value,onClick:pe},{default:m(()=>[...b[25]||(b[25]=[P("刷新",-1)])]),_:1},8,["loading"])]),h.value?(k(),X(we,{key:0,title:h.value,type:"error",closable:!1,"show-icon":"",class:"mb"},null,8,["title"])):K("",!0),J(N)?(k(),M("div",zl,[y(Ke,{shadow:"never",class:"branch-panel"},{header:m(()=>[_("div",Hl,[b[29]||(b[29]=_("span",{class:"panel-title"},"分支 Branch",-1)),_("div",Bl,[y(G,{size:"small",text:"",onClick:j},{default:m(()=>[...b[27]||(b[27]=[P("刷新",-1)])]),_:1}),y(G,{size:"small",text:"",type:"primary",onClick:b[0]||(b[0]=H=>w.value=!0)},{default:m(()=>[...b[28]||(b[28]=[P("+ 新建",-1)])]),_:1})])])]),default:m(()=>[_("div",Ul,[(k(!0),M(ie,null,me(fe.value,H=>(k(),M(ie,{key:H.key},[_("div",jl,V(H.title),1),H.tree.length?(k(),X($e,{key:0,data:H.tree,props:{label:"label",children:"children"},"node-key":"key","default-expand-all":"",indent:14,class:"branch-tree"},{default:m(({data:ee})=>{var Le,at,Ht;return[ee.branch?(k(),M("div",{key:1,class:Ee(["branch-node",{current:(Le=ee.branch)==null?void 0:Le.current,remote:ee.remote}]),title:ee.fullName,onDblclick:qn=>{var Bt;return((Bt=ee.branch)==null?void 0:Bt.current)||It(ee)}},[_("span",Gl,V(ee.label),1),ee.remote?K("",!0):(k(),M("span",{key:0,class:Ee(["node-sync",{clean:!A(ee.branch)&&((at=ee.branch)==null?void 0:at.upstream)}])},V(A(ee.branch)),3)),_("span",Kl,[(Ht=ee.branch)!=null&&Ht.current?(k(),M(ie,{key:0},[y(G,{size:"small",text:"",type:"success",onClick:De(Vn,["stop"])},{default:m(()=>[...b[30]||(b[30]=[P("拉取",-1)])]),_:1}),y(G,{size:"small",text:"",type:"primary",onClick:De(Dn,["stop"])},{default:m(()=>[...b[31]||(b[31]=[P("推送",-1)])]),_:1})],64)):(k(),X(G,{key:1,size:"small",text:"",type:"primary",onClick:De(qn=>It(ee),["stop"])},{default:m(()=>[...b[32]||(b[32]=[P("切换",-1)])]),_:1},8,["onClick"]))])],42,ql)):(k(),M("span",Wl,V(ee.label),1))]}),_:1},8,["data"])):(k(),M("div",Xl,"暂无分支"))],64))),128)),fe.value.length===0?(k(),X(Vt,{key:0,description:"暂无分支","image-size":60})):K("",!0)])]),_:1}),_("div",Jl,[y(Ke,{shadow:"never",class:"toolbar-card"},{default:m(()=>{var H;return[_("div",Yl,[_("div",Ql,[y(G,{type:"primary",onClick:b[1]||(b[1]=ee=>p.value=!0)},{default:m(()=>[...b[33]||(b[33]=[P("提交 Commit",-1)])]),_:1}),y(G,{plain:"",onClick:Pe},{default:m(()=>[...b[34]||(b[34]=[P("暂存全部",-1)])]),_:1}),y(G,{plain:"",disabled:(((H=i.value)==null?void 0:H.staged.length)??0)===0,onClick:He},{default:m(()=>[...b[35]||(b[35]=[P("取消暂存全部",-1)])]),_:1},8,["disabled"]),y(Dt,{value:I.value,hidden:I.value===0,offset:[2,4]},{default:m(()=>[y(G,{type:"success",plain:"",onClick:Sn},{default:m(()=>[...b[36]||(b[36]=[P("暂存改动 Stash",-1)])]),_:1})]),_:1},8,["value","hidden"]),y(Hn,{content:"Shelve Silently:使用默认说明,一键暂存全部更改",placement:"top"},{default:m(()=>[y(G,{plain:"",onClick:En},{default:m(()=>[...b[37]||(b[37]=[P("静默 Stash",-1)])]),_:1})]),_:1}),y(G,{type:"danger",plain:"",onClick:b[2]||(b[2]=ee=>$.value=!0)},{default:m(()=>[...b[38]||(b[38]=[P("硬重置",-1)])]),_:1}),y(G,{type:"danger",plain:"",onClick:b[3]||(b[3]=ee=>te("git_clean"))},{default:m(()=>[...b[39]||(b[39]=[P("清理未跟踪",-1)])]),_:1})])])]}),_:1}),(Mt=i.value)!=null&&Mt.conflicted.length?(k(),X(we,{key:0,title:"存在合并冲突,请先解决冲突(修改文件后重新 git add 并提交)",type:"error",closable:!1,"show-icon":"",class:"mb"})):K("",!0),y(Ke,{shadow:"never",class:"changes-card"},{header:m(()=>[_("div",Zl,[b[42]||(b[42]=_("span",{class:"card-title"},"更改 Changes",-1)),_("div",ei,[I.value?(k(),X(ae,{key:0,size:"small",type:"primary",effect:"plain"},{default:m(()=>[P("已选 "+V(I.value),1)]),_:1})):K("",!0),y(G,{size:"small",text:"",onClick:$n},{default:m(()=>[...b[40]||(b[40]=[P("全选本组",-1)])]),_:1}),I.value?(k(),X(G,{key:1,size:"small",text:"",type:"danger",onClick:Nt},{default:m(()=>[...b[41]||(b[41]=[P("清除选择",-1)])]),_:1})):K("",!0)])])]),default:m(()=>[y(Un,{modelValue:B.value,"onUpdate:modelValue":b[4]||(b[4]=H=>B.value=H),class:"changes-tabs"},{default:m(()=>[(k(!0),M(ie,null,me(O.value,H=>(k(),X(Bn,{key:H.key,name:H.key},{label:m(()=>[_("span",ti,[P(V(H.label)+" ",1),y(Dt,{value:H.count,hidden:H.count===0,type:"primary",class:"tab-badge"},null,8,["value","hidden"])])]),default:m(()=>[_("div",ni,"「"+V(H.hint)+"」",1),H.count===0?(k(),M("div",si,"没有"+V(H.label)+"的文件",1)):(k(),M("div",li,[(k(!0),M(ie,null,me(U.value[H.key],ee=>(k(),M("div",{key:H.key+ee.path,class:"file-row"},[y(ot,{"model-value":Et(ee.path),onChange:Le=>Lt(ee.path)},null,8,["model-value","onChange"]),_("span",{class:Ee(["file-status",Mn(ee)])},V(An(ee)),3),_("span",{class:"file-path mono",title:ee.path},V(ee.path),9,ii),y(G,{size:"small",text:"",type:"primary",onClick:Le=>Cn(ee)},{default:m(()=>[...b[43]||(b[43]=[P("查看差异",-1)])]),_:1},8,["onClick"]),ee.conflicted?(k(),X(G,{key:0,size:"small",text:"",type:"warning",onClick:Le=>ye(ee)},{default:m(()=>[...b[44]||(b[44]=[P("标记已解决(git add)",-1)])]),_:1},8,["onClick"])):(k(),X(G,{key:1,size:"small",text:"",type:ee.staged?"warning":"success",onClick:Le=>ke(ee)},{default:m(()=>[P(V(ee.staged?"取消暂存":"暂存"),1)]),_:2},1032,["type","onClick"]))]))),128))]))]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"])]),_:1}),y(Ke,{shadow:"never",class:"stash-card"},{header:m(()=>[_("div",oi,[_("span",ai,"暂存列表 Stash("+V(o.value.length)+")",1),_("div",ri,[y(G,{size:"small",text:"",onClick:le},{default:m(()=>[...b[45]||(b[45]=[P("刷新",-1)])]),_:1})])])]),default:m(()=>[o.value.length===0?(k(),M("div",ui,"没有暂存的更改")):(k(),M("div",di,[(k(!0),M(ie,null,me(o.value,H=>(k(),M("div",{key:H.ref,class:"stash-row"},[_("div",ci,[_("span",fi,V(H.ref),1),_("span",{class:"stash-msg",title:H.message},V(zn(H.message)||"(无说明)"),9,pi),H.date?(k(),M("span",hi,V(On(H.date)),1)):K("",!0)]),_("div",mi,[y(G,{size:"small",text:"",type:"primary",onClick:ee=>xn(H)},{default:m(()=>[...b[46]||(b[46]=[P("差异",-1)])]),_:1},8,["onClick"]),y(G,{size:"small",text:"",type:"success",onClick:ee=>Nn(H)},{default:m(()=>[...b[47]||(b[47]=[P("应用",-1)])]),_:1},8,["onClick"]),y(G,{size:"small",text:"",type:"warning",onClick:ee=>In(H)},{default:m(()=>[...b[48]||(b[48]=[P("恢复",-1)])]),_:1},8,["onClick"]),y(G,{size:"small",text:"",type:"danger",onClick:ee=>Pn(H)},{default:m(()=>[...b[49]||(b[49]=[P("删除",-1)])]),_:1},8,["onClick"])])]))),128))]))]),_:1})])])):(k(),M("div",Ol,"请先在「仓库管理」中打开一个仓库")),y(fn,{visible:J(Z),"onUpdate:visible":b[5]||(b[5]=H=>an(Z)?Z.value=H:null),tool:((Ot=J(T))==null?void 0:Ot.tool)??"",preview:((zt=J(T))==null?void 0:zt.preview)??null,onConfirm:se,onCancel:J(ne)},null,8,["visible","tool","preview","onCancel"]),y(jn,{modelValue:a.visible,"onUpdate:modelValue":b[6]||(b[6]=H=>a.visible=H),title:a.title,size:"56%","destroy-on-close":""},{default:m(()=>[et((k(),M("div",gi,[a.diff?(k(),M(ie,{key:0},[_("div",vi,[_("span",null,V(a.diff.files.length)+" 个文件",1),_("span",bi,"+"+V(a.diff.insertions),1),_("span",yi,"-"+V(a.diff.deletions),1),a.diff.truncated?(k(),M("span",_i,"(已截断)")):K("",!0)]),y(vt,{patch:a.diff.rawPatch},null,8,["patch"])],64)):a.patch?(k(),M(ie,{key:1},[a.patch?(k(),X(vt,{key:1,patch:a.patch},null,8,["patch"])):(k(),M("div",wi,"无差异"))],64)):a.loading?K("",!0):(k(),X(Vt,{key:2,description:"无差异","image-size":60}))])),[[Wn,a.loading]])]),_:1},8,["modelValue","title"]),y(Xe,{modelValue:p.value,"onUpdate:modelValue":b[9]||(b[9]=H=>p.value=H),title:"提交 Commit",width:"520px",onClosed:b[10]||(b[10]=H=>C.value="")},{footer:m(()=>[y(G,{onClick:b[8]||(b[8]=H=>p.value=!1)},{default:m(()=>[...b[50]||(b[50]=[P("取消",-1)])]),_:1}),y(G,{type:"primary",onClick:Pt},{default:m(()=>[...b[51]||(b[51]=[P("下一步(dry-run 预览)",-1)])]),_:1})]),default:m(()=>[y(Be,{modelValue:C.value,"onUpdate:modelValue":b[7]||(b[7]=H=>C.value=H),type:"textarea",rows:5,placeholder:"输入提交信息(message)",onKeydown:_t(De(Pt,["ctrl"]),["enter"])},null,8,["modelValue","onKeydown"])]),_:1},8,["modelValue"]),y(Xe,{modelValue:w.value,"onUpdate:modelValue":b[14]||(b[14]=H=>w.value=H),title:"新建分支",width:"480px",onClosed:b[15]||(b[15]=H=>{r.value="",c.value=""})},{footer:m(()=>[y(G,{onClick:b[13]||(b[13]=H=>w.value=!1)},{default:m(()=>[...b[52]||(b[52]=[P("取消",-1)])]),_:1}),y(G,{type:"primary",onClick:Rn},{default:m(()=>[...b[53]||(b[53]=[P("下一步(dry-run 预览)",-1)])]),_:1})]),default:m(()=>[y(Rt,{"label-width":"100px"},{default:m(()=>[y(Je,{label:"分支名"},{default:m(()=>[y(Be,{modelValue:r.value,"onUpdate:modelValue":b[11]||(b[11]=H=>r.value=H),placeholder:"feature/xxx"},null,8,["modelValue"])]),_:1}),y(Je,{label:"起点(可选)"},{default:m(()=>[y(Be,{modelValue:c.value,"onUpdate:modelValue":b[12]||(b[12]=H=>c.value=H),placeholder:"默认当前 HEAD,如 main 或 commit hash"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1},8,["modelValue"]),y(Xe,{modelValue:g.value,"onUpdate:modelValue":b[19]||(b[19]=H=>g.value=H),title:"暂存改动 Stash",width:"560px"},{footer:m(()=>[y(G,{onClick:b[18]||(b[18]=H=>g.value=!1)},{default:m(()=>[...b[57]||(b[57]=[P("取消",-1)])]),_:1}),y(G,{type:"primary",onClick:Ln},{default:m(()=>[...b[58]||(b[58]=[P("下一步(dry-run 预览)",-1)])]),_:1})]),default:m(()=>[y(we,{class:"stash-tip",title:"可勾选左侧更改列表的文件随本次 stash 一起保存;不勾选则保存全部更改。",type:"info",closable:!1,"show-icon":""}),y(Rt,{"label-width":"90px"},{default:m(()=>[y(Je,{label:"说明(可选)"},{default:m(()=>[y(Be,{modelValue:d.value,"onUpdate:modelValue":b[16]||(b[16]=H=>d.value=H),placeholder:"留空则使用默认说明(WIP on 分支: 提交)"},null,8,["modelValue"])]),_:1}),y(Je,{label:"包含未跟踪"},{default:m(()=>[y(ot,{modelValue:S.value,"onUpdate:modelValue":b[17]||(b[17]=H=>S.value=H)},{default:m(()=>[...b[54]||(b[54]=[P("包含未跟踪文件(-u)。勾选文件后会自动包含其中的未跟踪文件",-1)])]),_:1},8,["modelValue"])]),_:1})]),_:1}),Ge.value.length?(k(),M("div",ki,[_("div",Ci,[_("span",xi,"选择文件(已选 "+V(I.value)+")",1),_("div",$i,[y(G,{size:"small",text:"",onClick:Tn},{default:m(()=>[...b[55]||(b[55]=[P("全选",-1)])]),_:1}),y(G,{size:"small",text:"",onClick:Nt},{default:m(()=>[...b[56]||(b[56]=[P("清除选择",-1)])]),_:1})])]),_("div",Ti,[(k(!0),M(ie,null,me(Ge.value,H=>{var ee,Le;return k(),M("div",{key:H,class:"file-row"},[y(ot,{"model-value":Et(H),onChange:at=>Lt(H)},null,8,["model-value","onChange"]),_("span",{class:Ee(["file-status",(ee=i.value)!=null&&ee.untracked.includes(H)?"new":"mod"])},V((Le=i.value)!=null&&Le.untracked.includes(H)?"?":"M"),3),_("span",Si,V(H),1)])}),128))])])):K("",!0)]),_:1},8,["modelValue"]),y(Xe,{modelValue:$.value,"onUpdate:modelValue":b[22]||(b[22]=H=>$.value=H),title:"硬重置(高风险)",width:"480px",onClosed:b[23]||(b[23]=H=>L.value="")},{footer:m(()=>[y(G,{onClick:b[21]||(b[21]=H=>$.value=!1)},{default:m(()=>[...b[59]||(b[59]=[P("取消",-1)])]),_:1}),y(G,{type:"danger",onClick:Fn},{default:m(()=>[...b[60]||(b[60]=[P("下一步(dry-run 预览)",-1)])]),_:1})]),default:m(()=>[y(we,{title:"将丢弃索引与工作区所有更改(不可逆),执行前会自动创建备份",type:"error",closable:!1,"show-icon":"",class:"mb"}),y(Be,{modelValue:L.value,"onUpdate:modelValue":b[20]||(b[20]=H=>L.value=H),placeholder:"重置目标,默认 HEAD,如 HEAD~1 / commit hash / main"},null,8,["modelValue"])]),_:1},8,["modelValue"])])}}}),Ei=xe(Li,[["__scopeId","data-v-9abc2245"]]),Ni=Ce({__name:"BranchTreeSelect",props:{modelValue:{},placeholder:{default:"选择分支"},scope:{default:"all"},remoteFirst:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(s,{emit:t}){const n=s,e=t,l=qe(),i=Y(()=>ys(un(l.list,n.scope),n.remoteFirst));function o(u,h){if(!u)return!0;const a=u.toLowerCase();return(h.label??"").toLowerCase().includes(a)||(h.value??"").toLowerCase().includes(a)}return(u,h)=>{const a=z("el-tree-select");return k(),X(a,{"model-value":s.modelValue,data:i.value,filterable:"","filter-node-method":o,"check-strictly":"","default-expand-all":"","render-after-expand":!1,placeholder:s.placeholder,class:"branch-tree-select","onUpdate:modelValue":h[0]||(h[0]=p=>e("update:modelValue",p))},null,8,["model-value","data","placeholder"])}}}),bt=xe(Ni,[["__scopeId","data-v-fc71d58d"]]);class Ii{diff(t,n,e={}){let l;typeof e=="function"?(l=e,e={}):"callback"in e&&(l=e.callback);const i=this.castInput(t,e),o=this.castInput(n,e),u=this.removeEmpty(this.tokenize(i,e)),h=this.removeEmpty(this.tokenize(o,e));return this.diffWithOptionsObj(u,h,e,l)}diffWithOptionsObj(t,n,e,l){var i;const o=$=>{if($=this.postProcess($,e),l){setTimeout(function(){l($)},0);return}else return $},u=n.length,h=t.length;let a=1,p=u+h;e.maxEditLength!=null&&(p=Math.min(p,e.maxEditLength));const C=(i=e.timeout)!==null&&i!==void 0?i:1/0,w=Date.now()+C,r=[{oldPos:-1,lastComponent:void 0}];let c=this.extractCommon(r[0],n,t,0,e);if(r[0].oldPos+1>=h&&c+1>=u)return o(this.buildValues(r[0].lastComponent,n,t));let g=-1/0,d=1/0;const S=()=>{for(let $=Math.max(g,-a);$<=Math.min(d,a);$+=2){let L;const x=r[$-1],I=r[$+1];x&&(r[$-1]=void 0);let B=!1;if(I){const T=I.oldPos-$;B=I&&0<=T&&T<u}const Z=x&&x.oldPos+1<h;if(!B&&!Z){r[$]=void 0;continue}if(!Z||B&&x.oldPos<I.oldPos?L=this.addToPath(I,!0,!1,0,e):L=this.addToPath(x,!1,!0,1,e),c=this.extractCommon(L,n,t,$,e),L.oldPos+1>=h&&c+1>=u)return o(this.buildValues(L.lastComponent,n,t))||!0;r[$]=L,L.oldPos+1>=h&&(d=Math.min(d,$-1)),c+1>=u&&(g=Math.max(g,$+1))}a++};if(l)(function $(){setTimeout(function(){if(a>p||Date.now()>w)return l(void 0);S()||$()},0)})();else for(;a<=p&&Date.now()<=w;){const $=S();if($)return $}}addToPath(t,n,e,l,i){const o=t.lastComponent;return o&&!i.oneChangePerToken&&o.added===n&&o.removed===e?{oldPos:t.oldPos+l,lastComponent:{count:o.count+1,added:n,removed:e,previousComponent:o.previousComponent}}:{oldPos:t.oldPos+l,lastComponent:{count:1,added:n,removed:e,previousComponent:o}}}extractCommon(t,n,e,l,i){const o=n.length,u=e.length;let h=t.oldPos,a=h-l,p=0;for(;a+1<o&&h+1<u&&this.equals(e[h+1],n[a+1],i);)a++,h++,p++,i.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return p&&!i.oneChangePerToken&&(t.lastComponent={count:p,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=h,a}equals(t,n,e){return e.comparator?e.comparator(t,n):t===n||!!e.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let e=0;e<t.length;e++)t[e]&&n.push(t[e]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,e){const l=[];let i;for(;t;)l.push(t),i=t.previousComponent,delete t.previousComponent,t=i;l.reverse();const o=l.length;let u=0,h=0,a=0;for(;u<o;u++){const p=l[u];if(p.removed)p.value=this.join(e.slice(a,a+p.count)),a+=p.count;else{if(!p.added&&this.useLongestToken){let C=n.slice(h,h+p.count);C=C.map(function(w,r){const c=e[a+r];return c.length>w.length?c:w}),p.value=this.join(C)}else p.value=this.join(n.slice(h,h+p.count));h+=p.count,p.added||(a+=p.count)}}return l}}class Pi extends Ii{tokenize(t){return t.slice()}join(t){return t}removeEmpty(t){return t}}const Vi=new Pi;function yn(s,t,n){return Vi.diff(s,t,n)}const Di=/^<<<<<<<(?:\s+(.*))?$/,tn=/^\|\|\|\|\|\|\|(?:\s+(.*))?$/,pt=/^=======/,nn=/^>>>>>>>(?:\s+(.*))?$/;function _n(s,t){if(s&&s.includes("超出展示上限"))return[{id:"c-0",type:"conflict",ours:(t==null?void 0:t.ours)??"",base:(t==null?void 0:t.base)??"",theirs:(t==null?void 0:t.theirs)??"",choice:null}];if(s){const i=Ri(s);if(i.some(o=>o.type==="conflict"))return i}const n=(t==null?void 0:t.ours)??"",e=(t==null?void 0:t.theirs)??"",l=(t==null?void 0:t.base)??"";return n===e&&(s==null||s==="")?n?[{id:"t-0",type:"text",content:n}]:[]:n!==e||n===""&&e===""&&l!==""?[{id:"c-0",type:"conflict",ours:n,base:l,theirs:e,choice:null}]:n?[{id:"t-0",type:"text",content:n}]:[]}function Ri(s){const t=s.replace(/\r\n/g,`
|
|
115
|
+
`).split(`
|
|
116
|
+
`),n=[];let e=0,l=[],i=0;const o=()=>{if(l.length===0)return;const u=l.join(`
|
|
117
|
+
`);l=[],u.length!==0&&n.push({id:`t-${n.length}`,type:"text",content:u})};for(;e<t.length;){const u=t[e]??"";if(Di.test(u)){o(),e+=1;const h=[];for(;e<t.length&&!tn.test(t[e]??"")&&!pt.test(t[e]??"");)h.push(t[e]??""),e+=1;const a=[];if(e<t.length&&tn.test(t[e]??""))for(e+=1;e<t.length&&!pt.test(t[e]??"");)a.push(t[e]??""),e+=1;e<t.length&&pt.test(t[e]??"")&&(e+=1);const p=[];for(;e<t.length&&!nn.test(t[e]??"");)p.push(t[e]??""),e+=1;e<t.length&&nn.test(t[e]??"")&&(e+=1),n.push({id:`c-${i++}`,type:"conflict",ours:h.join(`
|
|
118
|
+
`),base:a.join(`
|
|
119
|
+
`),theirs:p.join(`
|
|
120
|
+
`),choice:null});continue}l.push(u),e+=1}return o(),n}function Ie(s){return s==null||s===""?[]:s.replace(/\r\n/g,`
|
|
121
|
+
`).split(`
|
|
122
|
+
`)}function Re(s){return s.join(`
|
|
123
|
+
`)}function sn(s,t){const n=yn(s,t),e=[];let l=0,i=0;for(;i<n.length;){const o=n[i];if(!o.added&&!o.removed){l+=o.value.length,i+=1;continue}const u=[],h=[],a=l;for(;i<n.length&&(n[i].added||n[i].removed);){const p=n[i];p.removed?(u.push(...p.value),l+=p.value.length):p.added&&h.push(...p.value),i+=1}e.push({start:a,end:a+u.length,lines:h})}return e}function ln(s,t){return s.filter(n=>n.start===n.end&&n.start===t)}function Oe(s,t,n){const e=Re(s),l=Re(t);return e===l?{kind:n.length===0?"add-left":"modify-left",leftLines:s,rightLines:t,baseLines:n,action:"auto"}:s.length===0&&t.length>0?{kind:"add-right",leftLines:s,rightLines:t,baseLines:n,action:"auto"}:t.length===0&&s.length>0?{kind:"add-left",leftLines:s,rightLines:t,baseLines:n,action:"auto"}:{kind:"conflict",leftLines:s,rightLines:t,baseLines:n,action:"pending"}}function Fi(s,t,n){const e=Ie(s??""),l=Ie(t??""),i=Ie(n??"");if(e.length===0)return Re(l)===Re(i)?[{id:"h-0",kind:"equal",leftLines:l,rightLines:i,baseLines:[],action:"auto"}]:Ai(l,i);const o=sn(e,l),u=sn(e,i),h=new Set([0,e.length]);for(const d of o)h.add(d.start),h.add(d.end);for(const d of u)h.add(d.start),h.add(d.end);const a=[...h].sort((d,S)=>d-S),p=[];let C=0;const w=d=>{p.push({...d,id:`h-${C++}`})},r=new Set,c=new Set,g=d=>{const S=ln(o,d).filter(x=>!r.has(x)),$=ln(u,d).filter(x=>!c.has(x)),L=Math.max(S.length,$.length);for(let x=0;x<L;x++){const I=S[x],B=$[x];I&&r.add(I),B&&c.add(B),I&&B?Re(I.lines)===Re(B.lines)?w({kind:"add-left",leftLines:I.lines,rightLines:B.lines,baseLines:[],action:"auto"}):w({kind:"conflict",leftLines:I.lines,rightLines:B.lines,baseLines:[],action:"pending"}):I?w({kind:"add-left",leftLines:I.lines,rightLines:[],baseLines:[],action:"auto"}):B&&w({kind:"add-right",leftLines:[],rightLines:B.lines,baseLines:[],action:"auto"})}};for(let d=0;d<a.length;d++){const S=a[d];if(g(S),d>=a.length-1)break;const $=S,L=a[d+1];if($>=L)continue;const x=e.slice($,L),I=o.find(R=>R.start!==R.end&&R.start===$&&R.end>=L&&!r.has(R)),B=u.find(R=>R.start!==R.end&&R.start===$&&R.end>=L&&!c.has(R)),Z=o.find(R=>R.start!==R.end&&R.start<$&&R.end>=L),T=u.find(R=>R.start!==R.end&&R.start<$&&R.end>=L);if((Z||T)&&!I&&!B)continue;const N=o.find(R=>R.start!==R.end&&R.start===$&&!r.has(R)),D=u.find(R=>R.start!==R.end&&R.start===$&&!c.has(R));if(N&&D){r.add(N),c.add(D);const R=e.slice(Math.min(N.start,D.start),Math.max(N.end,D.end));w(Oe(N.lines,D.lines,R));const ne=Math.max(N.end,D.end);for(;d+1<a.length-1&&a[d+1]<ne;)d+=1;continue}if(N&&!D){r.add(N);const R=e.slice(N.start,N.end);for(w(Oe(N.lines,R,R));d+1<a.length-1&&a[d+1]<N.end;)d+=1;continue}if(D&&!N){c.add(D);const R=e.slice(D.start,D.end);for(w(Oe(R,D.lines,R));d+1<a.length-1&&a[d+1]<D.end;)d+=1;continue}w({kind:"equal",leftLines:x,rightLines:[...x],baseLines:x,action:"auto"})}g(e.length);for(const d of o){if(r.has(d)||d.start===d.end)continue;const S=u.find($=>!c.has($)&&$.start===d.start&&$.end===d.end);if(S)c.add(S),r.add(d),w(Oe(d.lines,S.lines,e.slice(d.start,d.end)));else{r.add(d);const $=e.slice(d.start,d.end);w(Oe(d.lines,$,$))}}for(const d of u){if(c.has(d)||d.start===d.end)continue;c.add(d);const S=e.slice(d.start,d.end);w(Oe(S,d.lines,S))}return p.length===0?[{id:"h-0",kind:"equal",leftLines:l,rightLines:i,baseLines:e,action:"auto"}]:p}function Ai(s,t){const n=yn(s,t),e=[];let l=0,i=0;for(;i<n.length;){const o=n[i];if(!o.added&&!o.removed){e.push({id:`h-${l++}`,kind:"equal",leftLines:[...o.value],rightLines:[...o.value],baseLines:[...o.value],action:"auto"}),i+=1;continue}const u=[],h=[];for(;i<n.length&&(n[i].added||n[i].removed);){const a=n[i];a.removed?u.push(...a.value):a.added&&h.push(...a.value),i+=1}u.length&&h.length?e.push({id:`h-${l++}`,kind:"conflict",leftLines:u,rightLines:h,baseLines:[],action:"pending"}):u.length?e.push({id:`h-${l++}`,kind:"add-left",leftLines:u,rightLines:[],baseLines:[],action:"auto"}):e.push({id:`h-${l++}`,kind:"add-right",leftLines:[],rightLines:h,baseLines:[],action:"auto"})}return e}function Mi(s,t,n,e){let l=_n(s);l.length===0&&(t!=null||n!=null)&&(l=[{id:"c-0",type:"conflict",ours:t??"",base:e??"",theirs:n??"",choice:null}]);const i=[];let o=0;for(const u of l)if(u.type==="text"){const h=Ie(u.content);i.push({id:`h-${o++}`,kind:"equal",leftLines:h,rightLines:[...h],baseLines:[...h],action:"auto"})}else{const h=u;i.push({id:`h-${o++}`,kind:"conflict",leftLines:Ie(h.ours),rightLines:Ie(h.theirs),baseLines:Ie(h.base),action:"pending"})}return i}function Oi(s,t){const n=_n(t).filter(e=>e.type==="conflict");return n.length===0?s:s.map(e=>{if(e.kind==="equal"||e.kind==="conflict")return e;const l=Re(e.leftLines).trim(),i=Re(e.rightLines).trim();for(const o of n){const u=o.ours.trim(),h=o.theirs.trim();if(u===h)continue;const a=!!u&&(l===u||l.includes(u)||u.includes(l))||!u&&e.kind.endsWith("right")&&!!h&&(i===h||i.includes(h)),p=!!h&&(i===h||i.includes(h)||h.includes(i));if(!(!a&&!p))return{...e,kind:"conflict",leftLines:e.leftLines.length?e.leftLines:Ie(o.ours),rightLines:e.rightLines.length?e.rightLines:Ie(o.theirs),action:"pending"}}return e})}function on(s){if(s.oursContent!=null||s.theirsContent!=null||s.baseContent!=null){const n=Fi(s.baseContent,s.oursContent,s.theirsContent);return Oi(n,s.conflictContent)}return Mi(s.conflictContent,s.oursContent,s.theirsContent,s.baseContent)}function wn(s){switch(s.action){case"auto":return s.kind==="equal"?s.leftLines.length?s.leftLines:s.rightLines:s.kind==="add-left"||s.kind==="modify-left"?s.leftLines:s.kind==="add-right"||s.kind==="modify-right"?s.rightLines:null;case"accept-left":case"ignore-right":return s.leftLines;case"accept-right":case"ignore-left":return s.rightLines;case"custom":return s.customLines??[];case"pending":return null;default:return null}}function zi(s){const t=[];for(const n of s){const e=wn(n);e==null?t.push(["<<<<<<< 未解决",...n.leftLines,"=======",...n.rightLines,">>>>>>>"].join(`
|
|
124
|
+
`)):e.length>0&&t.push(e.join(`
|
|
125
|
+
`))}return t.join(`
|
|
126
|
+
`)}function Fe(s){let t=0,n=0,e=0,l=0;for(const i of s)i.kind!=="equal"&&(t+=1,i.kind==="conflict"&&(n+=1,i.action==="pending"?l+=1:e+=1));return{changes:t,conflicts:n,resolved:e,pending:l}}function Hi(s){switch(s){case"add-left":return"hunk-add hunk-add-left";case"add-right":return"hunk-add hunk-add-right";case"modify-left":return"hunk-modify hunk-modify-left";case"modify-right":return"hunk-modify hunk-modify-right";case"conflict":return"hunk-conflict";default:return"hunk-equal"}}const Bi={class:"resolve"},Ui={class:"resolve-head"},ji={class:"resolve-body"},Wi={class:"file-list"},qi={class:"file-list-head"},Gi={class:"file-nav"},Ki={class:"nav-pos"},Xi=["onClick"],Ji={class:"file-main"},Yi=["title"],Qi={class:"stat"},Zi={key:0,class:"file-sides"},eo=["onClick"],to={class:"file-main"},no=["title"],so={class:"stat"},lo={class:"merge-wrap"},io={class:"merge-bar"},oo=["title"],ao={class:"muted"},ro={class:"merge-bar-actions"},uo={class:"nav-pos"},co={key:0,class:"empty"},fo=["data-hunk-id","onClick"],po={class:"pane pane-ours"},ho={class:"code"},mo={class:"gutter"},go={class:"pane pane-result"},vo={class:"code"},bo={class:"gutter"},yo={class:"pane pane-theirs"},_o={class:"code"},wo=Ce({__name:"ConflictResolvePanel",props:{files:{}},emits:["progress"],setup(s,{expose:t,emit:n}){const e=s,l=q(""),i=q(null),o=q(!1),u=q({}),h=q(null);function a(F){var j,le,pe,te;const f={};for(const se of F)f[se.path]=on(se);u.value=f;const A=((j=F.find(se=>Fe(f[se.path]??[]).conflicts>0))==null?void 0:j.path)??((le=F[0])==null?void 0:le.path)??"";l.value=A;const v=f[A]??[];i.value=((pe=v.find(se=>se.kind==="conflict"))==null?void 0:pe.id)??((te=v[0])==null?void 0:te.id)??null,o.value=!1}be(()=>e.files,F=>a(F),{immediate:!0,deep:!0});const p=Y(()=>u.value[l.value]??[]),C=Y(()=>p.value.filter(F=>F.kind==="conflict")),w=Y(()=>p.value.find(F=>F.id===i.value)??null),r=Y(()=>e.files.filter(F=>Fe(u.value[F.path]??[]).conflicts>0)),c=Y(()=>e.files.filter(F=>Fe(u.value[F.path]??[]).conflicts===0)),g=Y(()=>Fe(p.value)),d=Y(()=>r.value.findIndex(F=>F.path===l.value)),S=Y(()=>{let F=0,f=0,A=0;for(const v of Object.values(u.value)){const j=Fe(v);F+=j.conflicts,f+=j.resolved,A+=j.pending}return{total:F,resolved:f,pending:A}}),$=Y(()=>C.value.findIndex(F=>F.id===i.value)),L=Y(()=>{var F;return((F=w.value)==null?void 0:F.kind)==="conflict"});function x(F){const f=Fe(u.value[F]??[]);return f.conflicts===0?f.changes?`${f.changes}Δ`:"—":`${f.resolved}/${f.conflicts}`}function I(F){l.value=F;const f=u.value[F]??[],A=f.find(v=>v.kind==="conflict"&&v.action==="pending")??f.find(v=>v.kind==="conflict")??f[0];i.value=(A==null?void 0:A.id)??null}function B(F){const f=r.value;if(f.length<2)return;let A=d.value;A<0&&(A=F>0?-1:0);let v=A+F;v<0?v=f.length-1:v>=f.length&&(v=0);const j=f[v];j&&I(j.path)}function Z(F,f){const A=l.value,v=u.value[A];v&&(u.value={...u.value,[A]:v.map(j=>j.id===F?{...j,action:f}:j)},i.value=F)}function T(F){Z(F.id,"accept-left")}function N(F){Z(F.id,"accept-right")}function D(F,f){const A=u.value[f];if(!A)return;f!==l.value&&(l.value=f);const v=F==="left"?"accept-left":"accept-right";u.value={...u.value,[f]:A.map(j=>j.kind==="conflict"?{...j,action:v}:j)}}function R(F){const f=w.value;!f||f.kind!=="conflict"||(F==="left"?T(f):N(f))}function ne(){var v,j;const F=l.value,f=e.files.find(le=>le.path===F);if(!f)return;const A=on(f);u.value={...u.value,[F]:A},i.value=((v=A.find(le=>le.kind==="conflict"))==null?void 0:v.id)??((j=A[0])==null?void 0:j.id)??null}function re(F){const f=wn(F);return f==null?["(未选边)"]:f.length?f:[""]}function W(F){return F.action==="accept-left"}function Q(F){return F.action==="accept-right"}function he(F){return F.kind==="conflict"&&F.action!=="pending"}function fe(F){const f=C.value;if(!f.length)return;const A=f.filter(te=>te.action==="pending"),v=A.length?A:f;let j=v.findIndex(te=>te.id===i.value);j<0&&(j=F>0?-1:0);let le=j+F;le<0?le=v.length-1:le>=v.length&&(le=0);const pe=v[le];i.value=pe.id,Jn(()=>{var te,se;(se=(te=h.value)==null?void 0:te.querySelector(`[data-hunk-id="${pe.id}"]`))==null||se.scrollIntoView({block:"center",behavior:"smooth"})})}function U(){return e.files.map(F=>({path:F.path,resolvedContent:zi(u.value[F.path]??[])}))}const O=n;return be(S,F=>O("progress",F),{immediate:!0}),t({buildFiles:U}),(F,f)=>{const A=z("el-button");return k(),M("div",Bi,[_("div",Ui,[_("span",null,[P(" 冲突 "+V(S.value.resolved)+" / "+V(S.value.total)+" ",1),f[7]||(f[7]=_("span",{class:"muted"}," · 绿=新增 蓝=修改(自动进结果) · 红块选线上或我的",-1))])]),_("div",ji,[_("div",Wi,[_("div",qi,[_("span",null,"冲突文件 "+V(r.value.length),1),_("span",Gi,[y(A,{size:"small",disabled:r.value.length<2,onClick:f[0]||(f[0]=v=>B(-1))},{default:m(()=>[...f[8]||(f[8]=[P("‹",-1)])]),_:1},8,["disabled"]),_("span",Ki,V(d.value>=0?d.value+1:0)+"/"+V(r.value.length),1),y(A,{size:"small",disabled:r.value.length<2,onClick:f[1]||(f[1]=v=>B(1))},{default:m(()=>[...f[9]||(f[9]=[P("›",-1)])]),_:1},8,["disabled"])])]),(k(!0),M(ie,null,me(r.value,v=>(k(),M(ie,{key:v.path},[_("button",{type:"button",class:Ee(["file-item",{active:v.path===l.value,done:J(Fe)(u.value[v.path]??[]).pending===0}]),onClick:j=>I(v.path)},[_("span",Ji,[_("span",{class:"mono path",title:v.path},V(v.path.split("/").pop()),9,Yi),_("span",Qi,V(x(v.path)),1)])],10,Xi),v.path===l.value?(k(),M("div",Zi,[y(A,{size:"small",onClick:j=>D("left",v.path)},{default:m(()=>[...f[10]||(f[10]=[P("线上",-1)])]),_:1},8,["onClick"]),y(A,{size:"small",onClick:j=>D("right",v.path)},{default:m(()=>[...f[11]||(f[11]=[P("我的",-1)])]),_:1},8,["onClick"])])):K("",!0)],64))),128)),c.value.length?(k(),M("button",{key:0,type:"button",class:"file-item auto-toggle",onClick:f[2]||(f[2]=v=>o.value=!o.value)},V(o.value?"▾":"▸")+" 仅自动合并("+V(c.value.length)+") ",1)):K("",!0),o.value?(k(!0),M(ie,{key:1},me(c.value,v=>(k(),M("button",{key:v.path,type:"button",class:Ee(["file-item auto",{active:v.path===l.value}]),onClick:j=>I(v.path)},[_("span",to,[_("span",{class:"mono path",title:v.path},V(v.path.split("/").pop()),9,no),_("span",so,V(x(v.path)),1)])],10,eo))),128)):K("",!0)]),_("div",lo,[_("div",io,[_("span",{class:"mono merge-path",title:l.value},V(l.value),9,oo),_("span",ao,V(g.value.resolved)+"/"+V(g.value.conflicts),1),_("span",ro,[y(A,{size:"small",disabled:!C.value.length,onClick:f[3]||(f[3]=v=>fe(-1))},{default:m(()=>[...f[12]||(f[12]=[P("上一处",-1)])]),_:1},8,["disabled"]),_("span",uo,V($.value>=0?$.value+1:0)+"/"+V(C.value.length),1),y(A,{size:"small",disabled:!C.value.length,onClick:f[4]||(f[4]=v=>fe(1))},{default:m(()=>[...f[13]||(f[13]=[P("下一处",-1)])]),_:1},8,["disabled"]),y(A,{size:"small",disabled:!L.value,onClick:f[5]||(f[5]=v=>R("left"))},{default:m(()=>[...f[14]||(f[14]=[P("采用线上",-1)])]),_:1},8,["disabled"]),y(A,{size:"small",disabled:!L.value,onClick:f[6]||(f[6]=v=>R("right"))},{default:m(()=>[...f[15]||(f[15]=[P("采用我的",-1)])]),_:1},8,["disabled"]),y(A,{size:"small",disabled:!l.value,onClick:ne},{default:m(()=>[...f[16]||(f[16]=[P("重置本文件",-1)])]),_:1},8,["disabled"])])]),_("div",{ref_key:"scrollRootRef",ref:h,class:"merge"},[f[17]||(f[17]=_("header",{class:"merge-heads"},[_("div",null,"线上(合入目标)"),_("div"),_("div",null,"结果"),_("div"),_("div",null,"我的分支")],-1)),p.value.length===0?(k(),M("div",co,"没有可展示的变更")):K("",!0),(k(!0),M(ie,null,me(p.value,v=>(k(),M("div",{key:v.id,class:Ee(["merge-row",[J(Hi)(v.kind),{active:v.id===i.value,resolved:he(v),"chose-left":W(v),"chose-right":Q(v)}]]),"data-hunk-id":v.id,onClick:j=>i.value=v.id},[_("div",po,[_("pre",ho,[(k(!0),M(ie,null,me(v.leftLines.length?v.leftLines:[""],(j,le)=>(k(),M("span",{key:"L"+le,class:"code-line"},V(j||" "),1))),128))])]),_("div",mo,[v.kind==="conflict"&&v.leftLines.length?(k(),X(A,{key:0,size:"small",text:"",type:"primary",title:W(v)?"已采用线上":"采用线上",onClick:De(j=>T(v),["stop"])},{default:m(()=>[P(V(W(v)?"✓":"≫"),1)]),_:2},1032,["title","onClick"])):K("",!0)]),_("div",go,[_("pre",vo,[(k(!0),M(ie,null,me(re(v),(j,le)=>(k(),M("span",{key:"R"+le,class:Ee(["code-line",{pending:v.kind==="conflict"&&v.action==="pending"}])},V(j||" "),3))),128))])]),_("div",bo,[v.kind==="conflict"&&v.rightLines.length?(k(),X(A,{key:0,size:"small",text:"",type:"primary",title:Q(v)?"已采用我的":"采用我的",onClick:De(j=>N(v),["stop"])},{default:m(()=>[P(V(Q(v)?"✓":"≪"),1)]),_:2},1032,["title","onClick"])):K("",!0)]),_("div",yo,[_("pre",_o,[(k(!0),M(ie,null,me(v.rightLines.length?v.rightLines:[""],(j,le)=>(k(),M("span",{key:"T"+le,class:"code-line"},V(j||" "),1))),128))])])],10,fo))),128))],512)])])])}}}),ko=xe(wo,[["__scopeId","data-v-3e657794"]]),Co={class:"page merge-page"},xo={class:"page-head"},$o={key:1,class:"empty-tip"},To={class:"filter-bar"},So={class:"field"},Lo={class:"field"},Eo={class:"field field-switch"},No={class:"result-head"},Io={class:"mono sha"},Po={key:0,class:"tip tip-inline"},Vo={key:1,class:"tip tip-inline"},Do={key:2,class:"tip tip-inline"},Ro={class:"tip"},Fo={class:"mono"},Ao={class:"mono"},Mo={key:0,class:"tip"},Oo=["href"],zo={key:1,class:"tip"},Ho={key:2,class:"tip"},Bo=["href"],Uo=Ce({__name:"MergeView",setup(s){const t=Ne(),n=qe(),e=kt(),l=()=>t.currentId,{confirmVisible:i,pending:o,canRun:u,previewAndConfirm:h,executeConfirmed:a,cancel:p}=cn(l),C=q(""),w=q(""),r=q(!0),c=q(!1),g=q(""),d=q(null),S=q(null),$=q(null),L=q(null),x=q(null),I=q(0),B=Y(()=>n.hasRemote),Z=Y(()=>{var U;return(((U=d.value)==null?void 0:U.conflictFiles)??[]).some(O=>(O.conflictContent??"").includes("超出展示上限"))}),T=Y(()=>{var O;const U=(O=d.value)==null?void 0:O.outcome;return U==="clean"?"success":U==="unrelated"?"warning":U==="conflicts"?"danger":"info"}),N=Y(()=>{var O;const U=(O=d.value)==null?void 0:O.outcome;return U==="clean"?"可干净合并":U==="unrelated"?"无关历史":U==="conflicts"?"存在冲突":""}),D=Y(()=>!u.value||!d.value||Z.value||d.value.outcome==="unrelated"&&d.value.conflictFiles.length===0?!1:d.value.clean?!0:d.value.outcome==="conflicts"&&I.value===0);function R(U){var A;const O=U.filter(v=>v.remote),F=["origin/main","origin/master","origin/develop"];for(const v of F)if(O.some(j=>j.name===v))return v;if(O[0])return O[0].name;const f=U.find(v=>v.current);return(f==null?void 0:f.name)??((A=U[0])==null?void 0:A.name)??""}function ne(U,O){const F=U.find(A=>A.current&&!A.remote);if(F&&F.name!==O)return F.name;const f=U.find(A=>!A.remote&&A.name!==O);return(f==null?void 0:f.name)??""}function re(U){(!C.value||!U.some(O=>O.name===C.value))&&(C.value=R(U)),(!w.value||!U.some(O=>O.name===w.value))&&(w.value=ne(U,C.value))}async function W(){var O;const U=l();if(U===null){oe.warning("请先选择仓库");return}if(!C.value||!w.value){oe.warning("请选择合入目标与我的分支");return}c.value=!0,g.value="",d.value=null,S.value=null,$.value=null;try{const F=await Ye(U,"git_merge_rehearse",{into:C.value,from:w.value,fetch:r.value,maxFiles:80,dryRun:!1});if(!F.success){g.value=((O=F.error)==null?void 0:O.message)??"预演失败";return}d.value=F.result,I.value=d.value.outcome==="conflicts"?d.value.conflictFiles.length:0}catch(F){g.value=F instanceof Error?F.message:String(F)}finally{c.value=!1}}async function Q(){var f;if(!D.value||!d.value)return;const U=d.value.outcome==="conflicts"?((f=x.value)==null?void 0:f.buildFiles())??[]:[];if(d.value.outcome==="conflicts"&&U.length===0){oe.warning("请先完成选边");return}const O={into:C.value,from:w.value,files:U,push:B.value};L.value="git_apply_resolve",await h("git_apply_resolve",O)||(L.value=null)}async function he(){if(!S.value)return;L.value="git_mr_create",await h("git_mr_create",{into:C.value,from:w.value,sourceBranch:S.value.tempBranch})||(L.value=null)}async function fe(){const U=await a();!(U!=null&&U.success)||!U.result||typeof U.result!="object"||(L.value==="git_apply_resolve"?(S.value=U.result,$.value=null,oe.success(S.value.pushed?"已落盘并推送临时分支":"已落盘到本地临时分支")):L.value==="git_mr_create"&&($.value=U.result,oe.success($.value.via==="token"?"已用 Token 创建 PR":"已返回浏览器创建页")))}return Me(()=>{e.load()}),be(()=>t.currentId,()=>{d.value=null,S.value=null,$.value=null,C.value="",w.value=""}),be(()=>[n.repoId,n.list],([U,O])=>{U===t.currentId&&re(O)},{deep:!0,immediate:!0}),(U,O)=>{var pe,te;const F=z("el-button"),f=z("el-alert"),A=z("el-switch"),v=z("el-card"),j=z("el-tag"),le=z("el-empty");return k(),M("div",Co,[_("div",xo,[O[6]||(O[6]=_("h2",{class:"page-title"},"合并预演",-1)),y(F,{loading:c.value,disabled:!J(u),type:"primary",onClick:W},{default:m(()=>[...O[5]||(O[5]=[P("预演",-1)])]),_:1},8,["loading","disabled"])]),g.value?(k(),X(f,{key:0,title:g.value,type:"error",closable:!1,"show-icon":""},null,8,["title"])):K("",!0),J(u)?(k(),M(ie,{key:2},[y(v,{shadow:"never",class:"filter-card"},{default:m(()=>[_("div",To,[_("div",So,[O[7]||(O[7]=_("span",{class:"field-label"},"合入目标 into(线上 / ours)",-1)),y(bt,{modelValue:C.value,"onUpdate:modelValue":O[0]||(O[0]=se=>C.value=se),"remote-first":"",placeholder:"选择合入目标"},null,8,["modelValue"])]),_("div",Lo,[O[8]||(O[8]=_("span",{class:"field-label"},"我的分支 from(theirs)",-1)),y(bt,{modelValue:w.value,"onUpdate:modelValue":O[1]||(O[1]=se=>w.value=se),placeholder:"选择我的分支"},null,8,["modelValue"])]),_("div",Eo,[O[9]||(O[9]=_("span",{class:"field-label"},"先 fetch",-1)),y(A,{modelValue:r.value,"onUpdate:modelValue":O[2]||(O[2]=se=>r.value=se)},null,8,["modelValue"])])]),O[10]||(O[10]=_("p",{class:"tip"},[P(" 预演使用 "),_("span",{class:"mono"},"git merge-tree"),P(",不会改工作区。方向:把「我的分支」合入「合入目标」。 ")],-1))]),_:1}),d.value?(k(),X(v,{key:0,shadow:"never",class:"preview-card"},{header:m(()=>[_("div",No,[y(j,{type:T.value,effect:"dark"},{default:m(()=>[P(V(N.value),1)]),_:1},8,["type"]),_("span",Io,V(d.value.into)+" ("+V(d.value.intoSha.slice(0,7))+") ← "+V(d.value.from)+" ("+V(d.value.fromSha.slice(0,7))+")",1),d.value.fetchAttempted&&!d.value.fetched?(k(),X(j,{key:0,type:"warning",effect:"plain",size:"small"},{default:m(()=>[...O[11]||(O[11]=[P("远程未更新",-1)])]),_:1})):K("",!0),D.value?(k(),X(F,{key:1,type:"primary",onClick:Q},{default:m(()=>[...O[12]||(O[12]=[P("落盘并推送",-1)])]),_:1})):K("",!0)])]),default:m(()=>[d.value.outcome==="conflicts"?(k(),M("p",Po,V(Z.value?"冲突文件超过展示上限,无法在网页选边。请缩小范围或提高 maxFiles。":"红块用 ≫ / ≪ 选线上或我的;绿=新增、蓝=修改,已自动进入结果。"),1)):d.value.outcome==="unrelated"?(k(),M("p",Vo," 两条历史没有共同祖先,不能当作干净合并落盘。 ")):d.value.clean?(k(),M("p",Do," 可干净合并。落盘会在独立 worktree 提交到临时分支,主工作区保持不变。 ")):K("",!0),d.value.outcome==="conflicts"&&d.value.conflictFiles.length?(k(),X(ko,{key:3,ref_key:"resolvePanel",ref:x,files:d.value.conflictFiles,onProgress:O[3]||(O[3]=se=>I.value=se.pending)},null,8,["files"])):d.value.clean?(k(),X(le,{key:4,description:"没有冲突文件"})):K("",!0)]),_:1})):K("",!0),S.value?(k(),X(v,{key:1,shadow:"never",class:"apply-card"},{header:m(()=>[...O[13]||(O[13]=[P("落盘结果",-1)])]),default:m(()=>{var se;return[_("p",Ro,[O[14]||(O[14]=P("临时分支 ",-1)),_("span",Fo,V(S.value.tempBranch),1),O[15]||(O[15]=P(" · 提交 ",-1)),_("span",Ao,V(S.value.commitSha.slice(0,7)),1)]),S.value.createMrUrl?(k(),M("p",Mo,[_("a",{href:S.value.createMrUrl,target:"_blank",rel:"noreferrer"},"打开创建 MR/PR 页面",8,Oo)])):K("",!0),J(e).githubTokenSet?(k(),M("p",zo,[y(F,{type:"primary",size:"small",onClick:he},{default:m(()=>[...O[16]||(O[16]=[P("用 Token 创建 PR",-1)])]),_:1})])):K("",!0),(se=$.value)!=null&&se.url?(k(),M("p",Ho,[_("a",{href:$.value.url,target:"_blank",rel:"noreferrer"},V($.value.via==="token"?`已创建 PR${$.value.number!=null?" #"+$.value.number:""}`:"打开创建页"),9,Bo)])):K("",!0)]}),_:1})):K("",!0)],64)):(k(),M("div",$o,"请先在「仓库管理」中打开一个仓库")),y(fn,{visible:J(i),"onUpdate:visible":O[4]||(O[4]=se=>an(i)?i.value=se:null),tool:((pe=J(o))==null?void 0:pe.tool)??"",preview:((te=J(o))==null?void 0:te.preview)??null,onConfirm:fe,onCancel:J(p)},null,8,["visible","tool","preview","onCancel"])])}}}),jo=xe(Uo,[["__scopeId","data-v-01f14503"]]),Wo={class:"page"},qo={class:"filter-bar"},Go={class:"mono hash"},Ko={class:"subject"},Xo={key:0,class:"refs"},Jo={class:"sub"},Yo={class:"commit-head"},Qo={class:"mono commit-hash"},Zo={class:"commit-subject"},ea={class:"commit-meta"},ta={key:0},na={key:0,class:"commit-body"},sa={class:"diff-wrap"},la={class:"diff-summary"},ia={class:"add"},oa={class:"del"},aa={key:0,class:"warn"},ra=Ce({__name:"HistoryView",setup(s){const t=Ne(),n=qe(),{revision:e}=nt(),l=()=>t.currentId,i=q([]),o=q(!1),u=q(""),h=q("head"),a=q(""),p=q(""),C=q(50),w=q(!1),r=q(null),c=q(null),g=Y(()=>{var x;return((x=n.current)==null?void 0:x.name)??""});async function d(){const x=l();if(x!==null){o.value=!0,u.value="";try{const I={maxCount:C.value};h.value==="all"?I.all=!0:h.value==="branch"&&a.value&&(I.from=a.value),p.value.trim()&&(I.path=p.value.trim()),i.value=await as(x,I)}catch(I){u.value=I instanceof Error?I.message:String(I),i.value=[]}finally{o.value=!1}}}async function S(){await d()}async function $(x){const I=l();if(I!==null){o.value=!0;try{const{diff:B}=await us(I,x.hash);r.value=x,console.log(B),c.value=B,w.value=!0}catch(B){B instanceof mt&&B.code==="COMMIT_NOT_FOUND"?oe.warning(`提交不存在(${x.shortHash}),可能已被清理,请刷新列表`):oe.error(B instanceof Error?B.message:String(B))}finally{o.value=!1}}}function L(x){const I=new Date(x);return Number.isNaN(I.getTime())?x:I.toLocaleString()}return be(l,()=>{a.value="",S()}),be(e,()=>void d()),be([h,a,C],()=>void d()),Me(()=>void S()),(x,I)=>{const B=z("el-alert"),Z=z("el-radio-button"),T=z("el-radio-group"),N=z("el-input"),D=z("el-option"),R=z("el-select"),ne=z("el-button"),re=z("el-card"),W=z("el-table-column"),Q=z("el-tag"),he=z("el-table"),fe=z("el-empty"),U=z("el-divider"),O=z("el-drawer"),F=tt("loading");return k(),M("div",Wo,[I[8]||(I[8]=_("h2",{class:"page-title"},"提交历史",-1)),u.value?(k(),X(B,{key:0,title:u.value,type:"error",closable:!1,"show-icon":"",class:"mb"},null,8,["title"])):K("",!0),y(re,{shadow:"never",class:"mb"},{default:m(()=>[_("div",qo,[y(T,{modelValue:h.value,"onUpdate:modelValue":I[0]||(I[0]=f=>h.value=f)},{default:m(()=>[y(Z,{value:"head"},{default:m(()=>[P("当前分支("+V(g.value)+")",1)]),_:1}),y(Z,{value:"all"},{default:m(()=>[...I[5]||(I[5]=[P("全部分支",-1)])]),_:1}),y(Z,{value:"branch"},{default:m(()=>[...I[6]||(I[6]=[P("指定分支",-1)])]),_:1})]),_:1},8,["modelValue"]),h.value==="branch"?(k(),X(bt,{key:0,modelValue:a.value,"onUpdate:modelValue":I[1]||(I[1]=f=>a.value=f),placeholder:"选择分支"},null,8,["modelValue"])):K("",!0),y(N,{modelValue:p.value,"onUpdate:modelValue":I[2]||(I[2]=f=>p.value=f),clearable:"",placeholder:"按路径过滤(可选)",class:"path-input",onKeyup:_t(d,["enter"])},null,8,["modelValue"]),y(R,{modelValue:C.value,"onUpdate:modelValue":I[3]||(I[3]=f=>C.value=f),class:"count-select"},{default:m(()=>[y(D,{label:"20 条",value:20}),y(D,{label:"50 条",value:50}),y(D,{label:"100 条",value:100})]),_:1},8,["modelValue"]),y(ne,{loading:o.value,onClick:d},{default:m(()=>[...I[7]||(I[7]=[P("刷新",-1)])]),_:1},8,["loading"])])]),_:1}),y(re,{shadow:"never"},{default:m(()=>[et((k(),X(he,{data:i.value,size:"default","highlight-current-row":"",onRowClick:$},{default:m(()=>[y(W,{label:"提交",width:"100"},{default:m(({row:f})=>[_("span",Go,V(f.shortHash),1)]),_:1}),y(W,{label:"信息","min-width":"300"},{default:m(({row:f})=>[_("div",Ko,V(f.subject),1),f.refs?(k(),M("div",Xo,[(k(!0),M(ie,null,me(f.refs.split(",").map(A=>A.trim()).filter(Boolean),A=>(k(),X(Q,{key:A,size:"small",effect:"plain",class:"ref-tag"},{default:m(()=>[P(V(A.startsWith("tag: ")?A:A.includes("/")&&!A.startsWith("HEAD")?A.split("/").pop():A),1)]),_:2},1024))),128))])):K("",!0)]),_:1}),y(W,{label:"作者",width:"170"},{default:m(({row:f})=>[_("div",null,V(f.authorName),1),_("div",Jo,V(f.authorEmail),1)]),_:1}),y(W,{label:"时间",width:"180"},{default:m(({row:f})=>[P(V(L(f.authorDate)),1)]),_:1})]),_:1},8,["data"])),[[F,o.value]]),!o.value&&i.value.length===0?(k(),X(fe,{key:0,description:"暂无提交记录"})):K("",!0)]),_:1}),y(O,{modelValue:w.value,"onUpdate:modelValue":I[4]||(I[4]=f=>w.value=f),size:"60%","destroy-on-close":""},{default:m(()=>[r.value?(k(),M(ie,{key:0},[_("div",Yo,[_("div",Qo,V(r.value.hash),1),_("h3",Zo,V(r.value.subject),1),_("div",ea,[_("span",null,V(r.value.authorName)+" <"+V(r.value.authorEmail)+">",1),_("span",null,V(L(r.value.authorDate)),1),r.value.refs?(k(),M("span",ta,"refs: "+V(r.value.refs),1)):K("",!0)]),r.value.body?(k(),M("pre",na,V(r.value.body),1)):K("",!0)]),y(U),_("div",sa,[c.value?(k(),M(ie,{key:0},[_("div",la,[_("span",null,V(c.value.files.length)+" 个文件",1),_("span",ia,"+"+V(c.value.insertions),1),_("span",oa,"-"+V(c.value.deletions),1),c.value.truncated?(k(),M("span",aa,"(已截断)")):K("",!0)]),y(vt,{patch:c.value.rawPatch},null,8,["patch"])],64)):(k(),X(fe,{key:1,description:"无差异","image-size":60}))])],64)):K("",!0)]),_:1},8,["modelValue"])])}}}),ua=xe(ra,[["__scopeId","data-v-851d8cb3"]]),da=Ze("logs",{state:()=>({logs:[],loading:!1,error:null,limit:50,toolFilter:""}),actions:{async load(){this.loading=!0,this.error=null;try{const{logs:s}=await ps({limit:this.limit,tool:this.toolFilter||void 0});this.logs=s}catch(s){this.error=s instanceof Error?s.message:String(s)}finally{this.loading=!1}}}}),ca={class:"page"},fa={class:"filter-bar"},pa={class:"tool-cell"},ha={class:"mono repo-path"},ma=["title"],ga=["title"],va=["title"],ba=Ce({__name:"LogsView",setup(s){const t=da(),{revision:n}=nt(),e=Y(()=>{const a=new Set;for(const p of t.logs)a.add(p.tool);return[...a].sort()}),l=a=>a.includes("reset")||a.includes("clean")||a.includes("force")||a.includes("rebase")?"dangerous":"write";function i(a){return l(a)==="dangerous"?"danger":a.startsWith("git_")?"primary":"success"}function o(a){const p=new Date(a);return Number.isNaN(p.getTime())?a:p.toLocaleString()}function u(a){return a==="mcp"?"primary":a==="web"?"success":"warning"}function h(a){if(a==null)return"";if(typeof a=="string")return a;try{const p=JSON.stringify(a);return p===void 0?"":p}catch{return String(a)}}return be(n,()=>{t.load()}),Me(()=>{t.load()}),(a,p)=>{const C=z("el-option"),w=z("el-select"),r=z("el-button"),c=z("el-card"),g=z("el-table-column"),d=z("el-tag"),S=z("el-table"),$=z("el-empty"),L=tt("loading");return k(),M("div",ca,[p[7]||(p[7]=_("h2",{class:"page-title"},"操作日志",-1)),y(c,{shadow:"never",class:"mb"},{default:m(()=>[_("div",fa,[y(w,{modelValue:J(t).toolFilter,"onUpdate:modelValue":p[0]||(p[0]=x=>J(t).toolFilter=x),clearable:"",placeholder:"按工具过滤",class:"tool-select",onChange:J(t).load},{default:m(()=>[(k(!0),M(ie,null,me(e.value,x=>(k(),X(C,{key:x,label:x,value:x},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onChange"]),y(w,{modelValue:J(t).limit,"onUpdate:modelValue":p[1]||(p[1]=x=>J(t).limit=x),class:"limit-select",onChange:J(t).load},{default:m(()=>[y(C,{label:"最近 20 条",value:20}),y(C,{label:"最近 50 条",value:50}),y(C,{label:"最近 100 条",value:100})]),_:1},8,["modelValue","onChange"]),y(r,{loading:J(t).loading,onClick:J(t).load},{default:m(()=>[...p[2]||(p[2]=[P("刷新",-1)])]),_:1},8,["loading","onClick"]),p[3]||(p[3]=_("span",{class:"tip"},"记录来源:Web / MCP / CLI 全部写入操作(只读操作不记录)",-1))])]),_:1}),y(c,{shadow:"never"},{default:m(()=>[et((k(),X(S,{data:J(t).logs,size:"default"},{default:m(()=>[y(g,{label:"时间",width:"180"},{default:m(({row:x})=>[P(V(o(x.timestamp)),1)]),_:1}),y(g,{label:"来源",width:"90"},{default:m(({row:x})=>[y(d,{type:u(x.source),size:"small",effect:"plain"},{default:m(()=>[P(V(x.source.toUpperCase()),1)]),_:2},1032,["type"])]),_:1}),y(g,{label:"工具",width:"200"},{default:m(({row:x})=>[_("div",pa,[y(d,{type:i(x.tool),size:"small",effect:"dark"},{default:m(()=>[P(V(x.tool),1)]),_:2},1032,["type"]),x.dryRun?(k(),X(d,{key:0,size:"small",type:"info",effect:"plain",class:"dry-tag"},{default:m(()=>[...p[4]||(p[4]=[P("dry-run",-1)])]),_:1})):K("",!0)])]),_:1}),y(g,{label:"仓库","min-width":"200"},{default:m(({row:x})=>[_("span",ha,V(x.repoPath??"—"),1)]),_:1}),y(g,{label:"参数(脱敏)","min-width":"180"},{default:m(({row:x})=>[_("span",{class:"mono params",title:h(x.params)},V(h(x.params)||"—"),9,ma)]),_:1}),y(g,{label:"结果","min-width":"150"},{default:m(({row:x})=>[x.error?(k(),M(ie,{key:0},[y(d,{type:"danger",size:"small",effect:"plain",class:"result-tag"},{default:m(()=>[...p[5]||(p[5]=[P("失败",-1)])]),_:1}),_("div",{class:"err-text",title:x.error},V(x.error),9,ga)],64)):(k(),M(ie,{key:1},[y(d,{type:"success",size:"small",effect:"plain",class:"result-tag"},{default:m(()=>[...p[6]||(p[6]=[P("成功",-1)])]),_:1}),_("div",{class:"ok-text",title:x.result},V(x.result),9,va)],64))]),_:1}),y(g,{label:"耗时",width:"90"},{default:m(({row:x})=>[P(V(x.durationMs)+" ms",1)]),_:1})]),_:1},8,["data"])),[[L,J(t).loading]]),!J(t).loading&&J(t).logs.length===0?(k(),X($,{key:0,description:"暂无操作日志"})):K("",!0)]),_:1})])}}}),ya=xe(ba,[["__scopeId","data-v-79ac665b"]]),_a={class:"page"},wa={class:"token-row"},ka={class:"form-tip form-tip-block"},Ca={class:"card-head"},xa={class:"mono"},$a={class:"desc"},Ta={key:1,class:"action-bar"},Sa=Ce({__name:"SettingsView",setup(s){const t=kt(),n=ht({disabledTools:[],requireApprovalFor:[],dryRunDefault:!1}),e=q(""),l=q(!1),i=q(!1),o=Y(()=>{const c=t.permissions;return c?JSON.stringify([...n.disabledTools].sort())!==JSON.stringify([...c.disabledTools].sort())||JSON.stringify([...n.requireApprovalFor].sort())!==JSON.stringify([...c.requireApprovalFor].sort())||n.dryRunDefault!==c.dryRunDefault||e.value.trim().length>0||l.value:!1}),u=Y(()=>t.tools.filter(c=>c.riskLevel==="dangerous")),h=Y(()=>u.value.map(c=>c.name));function a(){const c=t.permissions;c&&(n.disabledTools=[...c.disabledTools],n.requireApprovalFor=[...c.requireApprovalFor],n.dryRunDefault=c.dryRunDefault,e.value="",l.value=!1,i.value=!0)}be(()=>t.permissions,c=>{c&&!o.value&&a()});async function p(c,g){g?n.disabledTools=n.disabledTools.filter(d=>d!==c.name):(n.disabledTools.includes(c.name)||n.disabledTools.push(c.name),n.requireApprovalFor=n.requireApprovalFor.filter(d=>d!==c.name))}function C(c){return c==="readonly"?"success":c==="write"?"primary":"danger"}function w(c){return c==="readonly"?"只读":c==="write"?"写操作":"高风险"}async function r(){try{const c=e.value.trim();await t.save({permissions:{disabledTools:[...n.disabledTools],requireApprovalFor:[...n.requireApprovalFor],dryRunDefault:n.dryRunDefault},...l.value?{mr:{githubToken:""}}:c?{mr:{githubToken:c}}:{}}),e.value="",l.value=!1,oe.success("设置已保存")}catch(c){oe.error(c instanceof Error?c.message:String(c))}}return Me(async()=>{await t.load(),a()}),(c,g)=>{const d=z("el-alert"),S=z("el-switch"),$=z("el-form-item"),L=z("el-form"),x=z("el-card"),I=z("el-input"),B=z("el-checkbox"),Z=z("el-tag"),T=z("el-table-column"),N=z("el-table"),D=z("el-option"),R=z("el-select"),ne=z("el-button"),re=tt("loading");return k(),M("div",_a,[g[16]||(g[16]=_("h2",{class:"page-title"},"设置",-1)),J(t).error?(k(),X(d,{key:0,title:J(t).error,type:"error",closable:!1,"show-icon":"",class:"mb"},null,8,["title"])):K("",!0),y(x,{shadow:"never",class:"mb"},{header:m(()=>[...g[4]||(g[4]=[P("默认行为",-1)])]),default:m(()=>[y(L,{"label-width":"180px","label-position":"left"},{default:m(()=>[y($,{label:"写操作默认 dry-run 预览"},{default:m(()=>[y(S,{modelValue:n.dryRunDefault,"onUpdate:modelValue":g[0]||(g[0]=W=>n.dryRunDefault=W)},null,8,["modelValue"]),g[5]||(g[5]=_("span",{class:"form-tip"},"开启后所有写操作(MCP/CLI)默认只生成预览,不真正执行",-1))]),_:1})]),_:1})]),_:1}),y(x,{shadow:"never",class:"mb"},{header:m(()=>[...g[6]||(g[6]=[P("MR 配置",-1)])]),default:m(()=>[y(L,{"label-width":"180px","label-position":"left"},{default:m(()=>[y($,{label:"GitHub Token"},{default:m(()=>[_("div",wa,[y(I,{modelValue:e.value,"onUpdate:modelValue":g[1]||(g[1]=W=>e.value=W),type:"password","show-password":"",autocomplete:"new-password",placeholder:"不回填已保存的 Token;留空则不改",style:{"max-width":"420px"},disabled:l.value},null,8,["modelValue","disabled"]),y(B,{modelValue:l.value,"onUpdate:modelValue":g[2]||(g[2]=W=>l.value=W),disabled:!J(t).githubTokenSet&&!l.value},{default:m(()=>[...g[7]||(g[7]=[P(" 清除已保存的 Token ",-1)])]),_:1},8,["modelValue","disabled"])]),_("div",ka,[P(V(J(t).githubTokenSet?"已保存 Token(不会在此显示)。":"尚未配置。")+" 只用于 ",1),g[8]||(g[8]=_("span",{class:"mono"},"git_mr_create",-1)),g[9]||(g[9]=P(" 调 GitHub REST,不进工具参数。 ",-1))])]),_:1})]),_:1})]),_:1}),y(x,{shadow:"never",class:"mb"},{header:m(()=>[_("div",Ca,[g[11]||(g[11]=_("span",null,"工具开关与风险等级",-1)),y(Z,{size:"small",type:"warning",effect:"plain"},{default:m(()=>[...g[10]||(g[10]=[P("高危工具默认禁用,需在下方开启",-1)])]),_:1})])]),default:m(()=>[et((k(),X(N,{data:J(t).tools,size:"default"},{default:m(()=>[y(T,{label:"工具",width:"230"},{default:m(({row:W})=>[_("span",xa,V(W.name),1)]),_:1}),y(T,{label:"风险",width:"90"},{default:m(({row:W})=>[y(Z,{type:C(W.riskLevel),size:"small",effect:"dark"},{default:m(()=>[P(V(w(W.riskLevel)),1)]),_:2},1032,["type"])]),_:1}),y(T,{label:"描述","min-width":"240"},{default:m(({row:W})=>[_("span",$a,V(W.description),1)]),_:1}),y(T,{label:"启用",width:"100",align:"center"},{default:m(({row:W})=>[y(S,{"model-value":!n.disabledTools.includes(W.name),onChange:Q=>p(W,Q===!0)},null,8,["model-value","onChange"])]),_:1})]),_:1},8,["data"])),[[re,J(t).loading]])]),_:1}),y(x,{shadow:"never",class:"mb"},{header:m(()=>[...g[12]||(g[12]=[P("审批规则",-1)])]),default:m(()=>[y(L,{"label-position":"top"},{default:m(()=>[y($,{label:"执行前需要审批的工具(勾选后,执行时需在确认框中手工确认)"},{default:m(()=>[y(R,{modelValue:n.requireApprovalFor,"onUpdate:modelValue":g[3]||(g[3]=W=>n.requireApprovalFor=W),multiple:"",filterable:"","collapse-tags":"",placeholder:"选择需要审批的工具",style:{width:"100%"}},{default:m(()=>[(k(!0),M(ie,null,me(h.value,W=>(k(),X(D,{key:W,label:W,value:W,disabled:n.disabledTools.includes(W)},null,8,["label","value","disabled"]))),128))]),_:1},8,["modelValue"]),g[13]||(g[13]=_("span",{class:"form-tip"},"审批仅对已启用的高危工具生效;禁用后自动移除",-1))]),_:1})]),_:1})]),_:1}),i.value?(k(),M("div",Ta,[y(ne,{type:"primary",loading:J(t).saving,disabled:!o.value,onClick:r},{default:m(()=>[...g[14]||(g[14]=[P("保存设置",-1)])]),_:1},8,["loading","disabled"]),y(ne,{disabled:!o.value,onClick:a},{default:m(()=>[...g[15]||(g[15]=[P("放弃修改",-1)])]),_:1},8,["disabled"])])):K("",!0)])}}}),La=xe(Sa,[["__scopeId","data-v-1b73fec7"]]),kn=Yn({history:Qn(),routes:[{path:"/",redirect:"/status"},{path:"/repos",name:"repos",component:As,meta:{title:"仓库管理"}},{path:"/status",name:"status",component:Ei,meta:{title:"状态"}},{path:"/merge",name:"merge",component:jo,meta:{title:"合并预演"}},{path:"/history",name:"history",component:ua,meta:{title:"历史"}},{path:"/logs",name:"logs",component:ya,meta:{title:"操作日志"}},{path:"/settings",name:"settings",component:La,meta:{title:"设置"}}]});kn.afterEach(s=>{const t=s.meta.title;document.title=t?`${t} · Git Cockpit`:"Git Cockpit"});document.documentElement.classList.add("dark");const it=Zn(Ts);it.use(es());it.use(kn);it.use(ts,{size:"default"});it.mount("#app");
|