System.register(["./base-lib-legacy.js?v=1761009159","./utils-lib-legacy.js?v=1761009159","./useStore-legacy2.js?v=1761009159","./__commonjsHelpers__-legacy.js?v=1761009159"],function(e,t){"use strict";var n,a,r,u,o,s,l,i,c,f,p,d,m,v,_,g,b,h,w,y,z,x,k,j,q,C,D,O,I;return{setters:[function(e){n=e.c,a=e.aA,r=e.r,u=e.V,o=e.g,s=e.o,l=e.w,i=e.v,c=e.x,f=e.e,p=e.B,d=e.C,m=e.y,v=e.z,_=e.A,g=e.F,b=e.N,h=e.I,w=e.J,y=e.G,z=e.b3,x=e.aw,k=e.b5,j=e.ax,q=e.ay},function(e){C=e.u,D=e.x,O=e.b},function(e){I=e.u},null],execute:function(){var t={class:"p-[2rem]"},S={class:"h-[40rem] border border-base mt-[1rem]"},A={class:"ml-[0.5rem]"};e("default",n({__name:"index",props:{compData:{default:function(){return{path:"",refreshEvent:function(){}}}}},setup:function(e,n){var E=n.expose,F=O(),B=C().panel;I();var G=e,H=a("popupSetFooter"),J=a("buttonText"),M=!0,N=r(),P=r([]),T=u([".sql",".zip",".bak",".gz"].join(",")),V={"x-http-token":window.vite_public_request_token},K=window.location.protocol+"//"+window.location.host+"/files?action=upload",L=o(function(){var e;return G.compData.path?G.compData.path:null===(e=B.value.backupPath+"/database")||void 0===e?void 0:e.replace(/\/\//g,"/")}),Q=s({f_size:0,f_path:L.value,f_name:"",f_start:0}),R=function(){F.success("导入成功"),G.compData.refreshEvent()},U=function(e,t,n){n.push(t),F.error("导入失败")},W=function(e){Q.f_size=e.size,Q.f_name=e.name,Q.f_start=0},X=function(e,t){var n=e.name.substring(e.name.lastIndexOf(".")+1),a=["sql","zip","bak","gz"];if(-1===a.indexOf(n))return!1;P.value=t.filter(function(e){var t=e.name.substring(e.name.lastIndexOf(".")+1);return-1!==a.indexOf(t)})||[]},Y=function(e,t,n){Q.f_start=e.percent,P.value=n.map(function(n){return n.uid===t.uid&&(n.percentage=e.percent),n})};return l(function(){return P.value.length},function(e){if(0!==e){for(var t=["success","fail","ready"],n=0;n<P.value.length;n++)if(!t.includes(P.value[n].status))return void H(!1);P.value.some(function(e){return"success"!==e.status})&&(J.value=M?"开始上传":"重新上传",H(!0))}else H(!1)}),E({onConfirm:function(){P.value.map(function(e){"success"!==e.status&&(e.status="ready")}),M=!1,N.value.submit(),H(!1)}}),function(e,n){var a=y,r=z,u=x,o=k,s=j,l=q;return i(),c("div",t,[f(r,{class:"upload-demo",ref_key:"upload",ref:N,name:"blob",data:m(Q),action:K,headers:V,accept:m(T),multiple:!0,"show-file-list":!1,"auto-upload":!1,"file-list":m(P),"on-error":U,"on-success":R,"on-progress":Y,"on-change":X,"before-upload":W},{default:p(function(){return[f(a,{type:"primary"},{default:p(function(){return n[0]||(n[0]=[d("导入",-1)])}),_:1,__:[0]})]}),_:1},8,["data","accept","file-list"]),v("div",S,[f(l,{height:"400",data:m(P)},{empty:p(function(){return[f(s,{description:"只支持'.sql', '.zip', '.bak', '.gz'文件格式导入"})]}),default:p(function(){return[f(u,{prop:"name","show-overflow-tooltip":!0,label:"名称"},{default:p(function(e){return[n[1]||(n[1]=v("i",{class:"svgtofont-el-document text-supplement"},null,-1)),v("span",A,_(e.row.name),1)]}),_:1}),f(u,{prop:"name",label:"是否成功",width:"300"},{default:p(function(e){return["success"===e.row.status?(i(),c(g,{key:0},[d("上传成功！")],64)):"fail"===e.row.status?(i(),c(g,{key:1},[d("上传失败!")],64)):"ready"===e.row.status?(i(),c(g,{key:2},[d("等待上传")],64)):(i(),b(o,{key:3,percentage:Math.floor(e.row.percentage)},null,8,["percentage"]))]}),_:1}),f(u,{width:"120",prop:"size",label:"大小"},{default:p(function(e){return[d(_(m(D)(e.row.size)),1)]}),_:1}),f(u,{prop:"name",width:"180",align:"right","show-overflow-tooltip":!0,label:"操作"},{default:p(function(e){return[h(f(a,{type:"text",size:"small",onClick:function(t){return n=e.row,void(P.value=P.value.filter(function(e){return e.name!==n.name}));var n}},{default:p(function(){return n[2]||(n[2]=[d("删除",-1)])}),_:2,__:[2]},1032,["onClick"]),[[w,"ready"===e.row.status||"fail"===e.row.status]])]}),_:1})]}),_:1},8,["data"])]),n[3]||(n[3]=v("ul",{class:"mt-8px leading-8 text-small list-disc ml-2rem"},[v("li",null,"仅支持sql、zip、sql.gz、(tar.gz|gz|tgz)")],-1))])}}}))}}});
