import{Z as B,_ as G,r as o,P as O,o as C,e as M,w as m,af as c,ai as g,ae as x,g as w,bv as H,b as I,h as N,E as P,__tla as b}from"./index.91e2b97e.js";import{E as j,__tla as S}from"./el-progress.4d9e61fa.js";import{d as h}from"./dayjs.min.4a1e4973.js";let F,q=Promise.all([(()=>{try{return b}catch{}})(),(()=>{try{return S}catch{}})()]).then(async()=>{F=B({__name:"index",props:{part:null,full:null,sizeLimit:null,size:null,time:null},emits:["update:part","update:full","update:size","update:time"],setup(L,{emit:p}){const i=L,d=G(),u=o(i.part),s=o(i.full),f=o(0),_=o(i.time??h().format("YYYY-MM-DD HH:mm:ss")),l=o([]);u.value!==void 0&&u.value!==""&&u.value!==null&&(l.value=u.value.split(";").map((t,a)=>({part_url:t,url:window.GLOBAL_CONFIG.oss+t,_status:1,uid:Date.now()-a,name:t.split("/").pop()}))),s.value!==void 0&&s.value!==""&&s.value!==null&&(l.value=s.value.split(";").map((t,a)=>{const[e,r]=t.split("|");return{part_url:e,url:window.GLOBAL_CONFIG.oss+e,_status:1,name:r,uid:Date.now()-a}}));function z(t){if(i.sizeLimit){const a=t.size/1024/1024<i.sizeLimit;return a||w.warning(`\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${i.sizeLimit}MB!`),a}}const D=({file:t})=>H({$type:"upload",url:"upload/main/file",data:{filedata:t},timeout:1e3*60}).then(({code:a,data:e})=>{if(a==="1"){const{url:r,file_name:Y}=e,n=l.value.find(({uid:$})=>$===t.uid);if(n===void 0)throw new Error("file is not exist");n._status=1,n.url=window.GLOBAL_CONFIG.oss+r,n.part_url=r,n.name=Y,v()}else return Promise.reject()});function v(){if(l.value.every(t=>t._status===1)){let t=[],a=[];l.value.forEach(e=>{t.push(e.part_url),a.push(`${e.part_url}|${e.name}`),f.value+=e.size??0}),s.value=a.join(";"),u.value=t.join(";"),_.value=h().format("YYYY-MM-DD HH:mm:ss")}}function E(t,a){l.value=a,v()}function y(){w.warning(`\u6700\u591A\u5141\u8BB8\u4E0A\u4F20${d.limit}\u4E2A\u6587\u4EF6`)}function A(t){return(t/1024).toString()}return O(()=>u.value,()=>{p("update:part",u.value),p("update:full",s.value),p("update:size",A(f.value)),p("update:time",_.value)}),(t,a)=>{const e=P,r=j;return C(),M(r,g({action:"#","http-request":D,"on-remove":E,"on-exceed":y,"before-upload":z,"file-list":l.value},x(d),{class:"w-100"}),{default:m(()=>[c(t.$slots,"default",{},()=>[I(e,{type:"primary"},{default:m(()=>[N("\u70B9\u51FB\u4E0A\u4F20")]),_:1})])]),tip:m(()=>[c(t.$slots,"tip")]),_:3},16,["file-list"])}}})});export{F as _,q as __tla};
