import{_ as e}from"./index119.js?v=1761009159";import{M as a,F as s}from"./utils-lib.js?v=1761009159";import{getBackupSize as l,getImportSize as t}from"./database.js?v=1761009159";import{c as r,r as i,q as n,aF as m,v as c,x as o,z as u,A as p,y as d,e as v,D as f}from"./base-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const x={class:"relative w-full text-medium flex items-center mb-2rem"},g={class:"flex flex-col ml-1rem leading-2rem"},y={class:"text-small mt-[8px]"},D={class:"grid grid-cols-3 leading-3rem py-1rem text-base"},b={class:"flex items-center mr-1rem"},h={class:"truncate flex-1"},_={class:"flex items-center mr-1rem"},F={class:"truncate flex-1"},j={class:"flex items-center"},w={class:"truncate flex-1"},k={key:0,class:"pl-2rem mt-2re leading-8 text-small list-disc"},C=r({__name:"index",props:{compData:{default:()=>({type:"",refreshFn:()=>{},successFlag:!1,config:{id:"",name:"",path:""}})}},emits:["close","onCancel"],setup(r,{expose:C,emit:T}){const O=r,q=T,{id:z,name:A,path:H}=O.compData.config,M=i(""),N=i(""),B=i("获取中...\t"),E=i(!0),G=i(null),I=i("import"===O.compData.type?"导入":"recover"===O.compData.type?"恢复":"压缩"),J=i(),K=async()=>{try{const{data:e}="backup"===O.compData.type?await l({id:Number(z)}):await t({name:A});if(J.value&&(E.value=!0),!e.status)return P(),E.value=!1,void(B.value=e.msg);B.value!==e.msg&&(B.value=e.msg),(null==e?void 0:e.total)&&(M.value=e.total,N.value=e.speed);let a=(-1!==e.msg.indexOf("成功!")||-1!==e.msg.indexOf("successful"))&&e.status;if(a)return void L();(null==e?void 0:e.speed)&&E.value&&!a&&(G.value=setTimeout(function(){K()},1e3))}catch(e){P()}},L=()=>{E.value=!1,"repair"===O.compData.type&&(a.success("修复完成，请按 Ctrl+F5 刷新缓存，或等待2s自动刷新！"),setTimeout(()=>{s(),window.location.reload()},2e3)),q("close"),P(),O.compData.refreshFn&&O.compData.refreshFn()},P=()=>{G.value=null,clearTimeout(G.value),E.value=!1};return n(K),m(P),C({onCancel:P}),(a,s)=>{const l=e;return c(),o("div",{class:"p-2rem flex-wrap",ref_key:"progressDialog",ref:J},[u("div",x,[s[0]||(s[0]=u("i",{class:"svgtofont-el-loading text-3rem animate-spin"},null,-1)),u("div",g,[u("span",null,"正在"+p(d(I))+"数据库文件，请稍后...",1),u("span",y,"当前"+p(d(I))+"任务为后台"+p(d(I))+"，可关闭此页面进行其他操作",1)])]),s[2]||(s[2]=u("hr",{class:"!border-[#dedede]"},null,-1)),u("div",D,[u("div",b,[u("span",null,p(d(I))+"数据库：",1),u("div",h,p(a.compData.config.name),1)]),u("div",_,[u("div",null,p(d(I))+"大小：",1),u("div",F,p(d(M)||"--"),1)]),u("div",j,[u("div",null,p(d(I))+"速度：",1),u("div",w,p(d(N)||"--"),1)])]),v(l,{class:"h-[30rem]",content:d(B)},null,8,["content"]),"import"===a.compData.type?(c(),o("ul",k,s[1]||(s[1]=[u("li",null,"导入完成后，可到导入->导入日志查看导入结果",-1)]))):f("",!0)],512)}}});export{C as default};
