import{c as a,r as e,q as s,n as l,aF as r,y as t,v as n,N as i,B as u,z as o,A as v,e as c,C as m,D as p,G as d,az as f,aY as g}from"./base-lib.js?v=1761009159";import{fU as y,P as b,g7 as _,g8 as w}from"./utils-lib.js?v=1761009159";const h={class:"text-base"},k=["innerHTML"],M=a({__name:"version-compare",setup(a){const M=e(!1),x=e(!1),A=e(!1),{version:C,cloudVersionInfo:I,getInfo:T,getCloudVersionInfo:V}=y(),j=()=>{I.value&&I.value.version&&""!==I.value.version.trim()?M.value=!((a,e)=>{const{versionArr:s,cloudVersionArr:l}=w(a,e);for(let r=0;r<s.length;r++){const a=s[r],e=l[r];if(a>e)return!0;if(a<e)return!1}return!0})(C.value,I.value.version):M.value=!1},q=()=>{b({loading:"更新中...",request:_(),message:!0,success:async()=>{await T(),await V(),j()}})};return s(async()=>{j(),await l(),setTimeout(()=>{(async()=>{if(!A.value&&!x.value){x.value=!0;try{await V(),A.value||j()}catch(a){A.value||(M.value=!1)}finally{A.value||(x.value=!1)}}})()},100)}),r(()=>{A.value=!0}),(a,e)=>{const s=d,l=f,r=g;return t(M)?(n(),i(r,{key:0,type:"warning",class:"!mb-[1.2rem] !p-[1.2rem]",closable:!1,"show-icon":""},{title:u(()=>{var a,r,d;return[o("span",h,[o("span",null," 提示：有一个新版本（"+v(null==(a=t(I))?void 0:a.version)+"）可更新，更新时间："+v(null==(r=t(I))?void 0:r.uptime),1),c(s,{class:"!ml-[1.2rem]",type:"primary",onClick:q},{default:u(()=>e[0]||(e[0]=[m("立即更新",-1)])),_:1,__:[0]}),(null==(d=t(I))?void 0:d.updateMsg)?(n(),i(l,{key:0,placement:"bottom-start",width:"200",trigger:"hover"},{default:u(()=>{var a;return[o("div",{class:"update-details",innerHTML:null==(a=t(I))?void 0:a.updateMsg},null,8,k)]}),reference:u(()=>e[1]||(e[1]=[o("span",{class:"!ml-[1.2rem] bt-link text-small"},"详情",-1)])),_:1})):p("",!0)])]}),_:1})):p("",!0)}}});export{M as _};
