import{v as u,o as e,c as h,w as a,b as s,C as d,e as T,D as _,a5 as p,n,l as r,f,g as o,t as l,B as w,K as y}from"./index-6e6522ad.js";import{u as S}from"./common-f00522b3.js";import{_ as k}from"./_plugin-vue_export-helper-c27b6911.js";const b={name:"WaitingForRestart",data(){return{visible:!1,startTime:-1,newStartTime:-1,status:"",cnt:0}},methods:{async check(){this.newStartTime=-1,this.startTime=S().getStartTime(),this.visible=!0,this.status="",console.log("start wfr"),setTimeout(()=>{this.timeoutInternal()},1e3)},timeoutInternal(){console.log("wfr: timeoutInternal",this.newStartTime,this.startTime),this.newStartTime===-1&&this.cnt<60&&this.visible?(this.checkStartTime(),this.cnt++,setTimeout(()=>{this.timeoutInternal()},1e3)):(this.cnt==10&&(this.status="拉取状态达到最大次数，请手动检查。"),this.cnt=0,setTimeout(()=>{this.visible=!1},1e3))},async checkStartTime(){let i=(await u.get("/api/stat/start-time",{timeout:3e3})).data.data.start_time;return console.log("wfr: checkStartTime",this.newStartTime,this.startTime),this.newStartTime!==this.startTime&&(this.newStartTime=i,console.log("wfr: restarted"),setTimeout(()=>{this.visible=!1,window.location.reload()},2e3)),this.newStartTime}}},g={style:{"margin-top":"16px"}},V={key:0,class:"py-12 text-center"},v=n("p",null,"重启成功！",-1),x={key:1,style:{display:"block"}},C={key:2,style:{display:"block"}},B={key:3,style:{display:"block"}},I={style:{display:"block"}};function N(m,i,D,W,t,F){return e(),h(y,{modelValue:t.visible,"onUpdate:modelValue":i[0]||(i[0]=c=>t.visible=c),persistent:"","max-width":"400"},{default:a(()=>[s(w,null,{default:a(()=>[s(d,null,{default:a(()=>[T("正在等待 AstrBot 重启...")]),_:1}),s(_,null,{default:a(()=>[s(p,{indeterminate:"",color:"primary"}),n("div",g,[t.newStartTime!=-1?(e(),r("div",V,[s(f,{class:"mb-6",color:"success",icon:"mdi-check-circle-outline",size:"128"}),v])):o("",!0),t.startTime!=-1?(e(),r("small",x,"当前实例标识："+l(t.startTime),1)):o("",!0),t.newStartTime!=-1?(e(),r("small",C,"检查到新实例："+l(t.newStartTime)+"，即将自动刷新页面",1)):o("",!0),t.status?(e(),r("small",B,l(t.status),1)):o("",!0),n("small",I,"尝试次数："+l(t.cnt)+" / 60",1)])]),_:1})]),_:1})]),_:1},8,["modelValue"])}const E=k(b,[["render",N]]);export{E as W};
