import{_ as v,i as y,a as C,u as S,q as F,o as I,aD as N,s as k,c as p,d as u,e as l,f as R,h as _,w as P,g as e,t as m,j as T,aE as x}from"./index-ojdwC1S2.js";import{C as M}from"./index-CwrlpCyS.js";import{d as b}from"./updating-x5avpz8W.js";import{i as D}from"./info-Bq3qLitc.js";import"./index-SLHq6L4P.js";import{s as E,b as V}from"./index-DPGlNZ3P.js";import"./index-CyegA5zg.js";const q={class:"install-wrapper"},B={class:"install-inner"},A={class:"circle-inner"},U=["src"],$={key:0,class:"mt20"},j={key:1,class:"mt20"},z={class:"bottom-message"},Q=["src"],G={__name:"under-install",setup(H){var d;const n=y.global.t,h=C(),i=S(),c=(d=h.query)==null?void 0:d.appName;let t=F({consoleCurrentRate:0,installProgress:0,timer:null,installStatus:"installing"});const f={"0%":"#46A2FF","100%":"#12F3FF"},w=async o=>{var s,r;try{const a=await x({task_id:o});if(a.code===200){const g=Number((s=a.data)==null?void 0:s.progress)||0;t.installProgress=g,t.consoleCurrentRate=g,t.installStatus=(r=a.data)==null?void 0:r.status,t.installStatus==="completed"?(clearInterval(t.timer),setTimeout(()=>{i.push({name:"applicationManage"})},2e3)):t.installStatus==="failed"&&(E({message:n("application.installFailed"),type:"warning",duration:2e3}),setTimeout(()=>{i.push({name:"applicationManage"})},2e3))}else throw new Error(`进度查询失败：${a.msg||"接口返回异常"}`)}catch(a){console.error("查询安装进度失败：",a),clearInterval(t.timer),V({message:n("application.progressQueryFailed"),duration:3e3}),setTimeout(()=>{i.push({name:"applicationManage"})},3e3)}};return I(async()=>{try{const{code:o,data:s}=await N({app_name:c});if(o===200){let r=s==null?void 0:s.task_id;t.timer=setInterval(()=>w(r),2e3)}else throw new Error(`安装接口调用失败：${msg||"接口返回异常"}`)}catch(o){console.log(o),i.push({name:"applicationManage"})}}),k(()=>{clearInterval(t.timer),t.timer=null}),(o,s)=>{const r=M;return u(),p("div",q,[l("div",B,[R(r,{"current-rate":e(t).consoleCurrentRate,"onUpdate:currentRate":s[0]||(s[0]=a=>e(t).consoleCurrentRate=a),rate:e(t).installProgress,speed:100,size:"8.125rem",color:f},{default:P(()=>[l("div",A,[l("img",{src:e(b),alt:""},null,8,U)])]),_:1},8,["current-rate","rate"]),e(t).installStatus==="installing"||e(t).installStatus==="pulling"?(u(),p("div",$,m(e(n)("application.installing",{name:e(c),progress:e(t).installProgress})),1)):_("",!0),e(t).installStatus==="completed"?(u(),p("div",j,m(e(n)("application.installSuccess",{name:e(c)})),1)):_("",!0)]),l("div",z,[l("img",{src:e(D),alt:""},null,8,Q),T(" "+m(e(n)("application.doNotClose")),1)])])}}},Z=v(G,[["__scopeId","data-v-78992895"]]);export{Z as default};
