import{_ as e}from"./index119.js?v=1761009159";import{bk as a,F as s,b as t}from"./utils-lib.js?v=1761009159";import{c as o,w as c,r as l,q as n,aF as m,v as u,x as i,e as r,y as p}from"./base-lib.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const v={class:"flex-wrap"},d=o({__name:"index",props:{compData:{default:()=>({type:"scan",endMsg:"扫描结束",logPath:"",successMsg:"修复成功",isClear:!1,completeEvent:null,failMsg:""})}},emits:["close","onCancel"],setup(o,{expose:d,emit:g}){const f=o,D=t();c(()=>f.compData,()=>{y.value=!0,C()});const x=g,M=l("获取中..."),y=l(!0),_=l(null),C=async()=>{try{const e=await a({num:20,filename:f.compData.logPath});if(M.value!==e.msg&&(M.value=e.msg),""!==f.compData.failMsg&&-1!==e.msg.indexOf(f.compData.failMsg))return y.value=!1,f.compData.completeEvent?(b(),void f.compData.completeEvent(!1,()=>{x("close")})):(D.error("失败"),void b());if(-1!==e.msg.indexOf(f.compData.endMsg))return y.value=!1,f.compData.completeEvent?(f.compData.completeEvent(!0,()=>{x("close")}),void b()):("repair"===f.compData.type?(x("close"),D.msg({dangerouslyUseHTMLString:!0,message:"修复完成，请按 Ctrl+F5 刷新缓存，或等待2s自动刷新！",type:"success",duration:2e3}),setTimeout(()=>{s(),window.location.reload()},2e3)):"scan"===f.compData.type?D.success("扫描已结束"):(D.success(f.compData.successMsg),x("close")),void b());-1===e.msg.indexOf(f.compData.endMsg)&&y.value&&(_.value=setTimeout(function(){C()},1500)),e.status||(D.request(e),y.value=!1)}catch(e){y.value&&C()}},b=()=>{_.value&&clearTimeout(_.value)},j=()=>{f.compData.isClear&&clearTimeout(_.value)};return x("onCancel",j),n(()=>{C()}),m(()=>{b()}),d({onCancel:j}),(a,s)=>{const t=e;return u(),i("div",v,[r(t,{class:"h-[40rem] !rounded-none",content:p(M)},null,8,["content"])])}}});export{d as default};
