import{V as U,W as V,J as R}from"./element-plus.f958bb38.js";import{a as D,j as p,R as C,f as m,d as L}from"./index.53b3eb4a.js";import{d as P,s as _,r as f,e as S,t as j,o as c,c as g,U as b,L as k,H as N,K as I,a as v,V as q,a7 as H,T as J,R as K}from"./@vue.e8706010.js";const O=P({components:{},props:{type:{type:String,default:"image"},multiple:{type:Boolean,default:!0},limit:{type:Number,default:10},data:{type:Object,default:()=>({})},showProgress:{type:Boolean,default:!1}},emits:["change","error","success"],setup(e,{emit:a}){const h=D(),n=_(),E=f(`${p.baseUrl}${p.urlPrefix}/upload/${e.type}`),F=S(()=>({token:h.token,version:p.version})),o=f(!1),u=f([]),d=(s,l,r)=>{o.value=!0,u.value=j(r)},t=(s,l,r)=>{var y;r.every(B=>B.status=="success")&&((y=n.value)==null||y.clearFiles(),o.value=!1),a("change",l),s.code==C.SUCCESS&&a("success",s),s.code==C.FAIL&&s.msg&&m.msgError(s.msg)},i=(s,l)=>{var r;m.msgError(`${l.name}\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25`),(r=n.value)==null||r.abort(l),o.value=!1,a("change",l),a("error",l)},A=()=>{m.msgError(`\u8D85\u51FA\u4E0A\u4F20\u4E0A\u9650${e.limit}\uFF0C\u8BF7\u91CD\u65B0\u4E0A\u4F20`)},$=()=>{var s;(s=n.value)==null||s.clearFiles(),o.value=!1},w=S(()=>{switch(e.type){case"image":return".jpg,.png,.gif,.jpeg";case"video":return".wmv,.avi,.mpg,.mpeg,.3gp,.mov,.mp4,.flv,.rmvb,.mkv";default:return"*"}});return{uploadRefs:n,action:E,headers:F,visible:o,fileList:u,getAccept:w,handleProgress:d,handleSuccess:t,handleError:i,handleExceed:A,handleClose:$}}}),T={class:"upload"},W={class:"file-list p-4"},z={class:"flex-1"};function G(e,a,h,n,E,F){const o=U,u=V,d=R;return c(),g("div",T,[b(o,{ref:"uploadRefs",action:e.action,multiple:e.multiple,limit:e.limit,"show-file-list":!1,headers:e.headers,data:e.data,"on-progress":e.handleProgress,"on-success":e.handleSuccess,"on-exceed":e.handleExceed,"on-error":e.handleError,accept:e.getAccept},{default:k(()=>[N(e.$slots,"default")]),_:3},8,["action","multiple","limit","headers","data","on-progress","on-success","on-exceed","on-error","accept"]),e.showProgress&&e.fileList.length?(c(),I(d,{key:0,modelValue:e.visible,"onUpdate:modelValue":a[0]||(a[0]=t=>e.visible=t),title:"\u4E0A\u4F20\u8FDB\u5EA6","close-on-click-modal":!1,width:"500px",modal:!1,onClose:e.handleClose},{default:k(()=>[v("div",W,[(c(!0),g(q,null,H(e.fileList,(t,i)=>(c(),g("div",{key:i,class:"mb-5"},[v("div",null,J(t.name),1),v("div",z,[b(u,{percentage:parseInt(t.percentage)},null,8,["percentage"])])]))),128))])]),_:1},8,["modelValue","onClose"])):K("",!0)])}const Z=L(O,[["render",G]]);export{Z as U};