import{_ as t}from"./index105.js?v=1761009159";import{p as a,V as e,P as s,l as i,b as o}from"./utils-lib.js?v=1761009159";import{$ as n,ar as r,as as c}from"./files.js?v=1761009159";import{an as l,aP as m,aB as p,aQ as d,aR as u,aS as f}from"./store.js?v=1761009159";import{c as h,r as y,aD as b,q as j,v as x,x as _,e as g,B as w,y as k}from"./base-lib.js?v=1761009159";import{u as v}from"./column.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./validator.js?v=1761009159";import"./index106.js?v=1761009159";import"./store2.js?v=1761009159";import"./index103.js?v=1761009159";const q={class:"py-[1rem] px-16px"},D=h({__name:"index",props:{compData:{default:()=>({})}},emits:["close"],setup(h,{expose:D,emit:N}){const C=o(),T=h,B=N,E=y(T.compData.editorTabsActive.history||[]),L=[{label:"版本时间",prop:"time",render:t=>b("span",{},(t=>{const a=new Date(1e3*Number(t));return isNaN(a.getTime())?t:e(a)})(t))},v([{onClick:async t=>{const a={filename:l.path,history:t},e=await s({request:r(a)}),i=m(l.id);e.status?(p.value={id:l.id,st_mtime:t,path:l.path,type:"editor"},B("close"),await d({title:"".concat(l.title," <-> ").concat(l.title),type:"diff",mode:"diff",path:l.path}),await u({mode:"ace/mode/".concat(l.mode),left:{content:e.data.data,editable:!1,copyLinkEnabled:!1},right:{content:i.getValue(),editable:!1,copyLinkEnabled:!1}})):C.request(e)},width:65,title:"文件对比"},{onClick:async t=>{await a({title:"恢复历史文件",content:"是否恢复历史文件 ".concat(e(Number(t)),"?恢复历史文件后，当前文件内容将会被替换！")}),s({loading:"正在恢复历史文件，请稍后...",request:n({filename:l.path,history:t}),message:!0,success:t=>{t.status&&(T.compData.callback(),P())}})},title:"恢复"},{onClick:async t=>{await a({title:"删除历史文件",content:"是否删除历史文件 ".concat(e(Number(t)),"?删除历史文件后，将无法恢复！")}),s({loading:"正在删除历史文件，请稍后...",request:c({filename:l.path||"",history:t}),message:!0,success:t=>{t.status&&P()}})},title:"删除"}])],P=async()=>{try{const{data:t}=await f(l.path);E.value=t.historys}catch(t){}};return j(()=>{P()}),D({}),(a,e)=>{const s=i,o=t;return x(),_("div",q,[g(o,null,{content:w(()=>[g(s,{ref:"fileTableRef",height:"40rem",column:L,description:"列表为空",data:k(E)},null,8,["data"])]),_:1})])}}});export{D as default};
