var y=(a,f,s)=>new Promise((l,t)=>{var u=o=>{try{n(s.next(o))}catch(i){t(i)}},m=o=>{try{n(s.throw(o))}catch(i){t(i)}},n=o=>o.done?l(o.value):Promise.resolve(o.value).then(u,m);n((s=s.apply(a,f)).next())});import{I as p}from"./index-D4Ne4xf-.js";import{f as w,d as B}from"./upload-Dh64kBvI.js";import{u as E,c as F}from"./index-CwU__2FH.js";import{ab as j,T as S,b as V}from"./element-plus-DNKe9-lk.js";import{l as U,r as b,m as d,M as k,O as I,q as g,u as c,R as h,p as x,U as v}from"./vue-chunks-DyZSmvoe.js";const N={class:"rounded-2xl border border-green-500/50 border-dashed w-20 h-20 flex items-center justify-center"},R={key:1,class:"relative rounded-2xl w-full h-full"},M=["src"],q={class:"absolute w-full h-full hover:bg-black hover:bg-opacity-40 flex items-center justify-center"},A={key:2,class:"flex items-center justify-center"},G=U({__name:"as",props:{accept:{type:String,default:"image/png, image/jpeg"},action:{type:String,default:w},showFileList:{type:Boolean,default:!1},modelValue:{type:String,default:""}},emits:["update:modelValue"],setup(a,{emit:f}){E();const s=f,l=b("start"),t=b(0),u=a,m=e=>/[\u4e00-\u9fa5]/.test(e.name)?(V.error("文件名称不呢带中文呢!"),!1):(l.value="pending",!0),n=e=>{var r;V.error((r=e==null?void 0:e.data)==null?void 0:r.message)},o=()=>{F({urlList:[u.modelValue]})},i=e=>{t.value=100;const{data:r}=e;s("update:modelValue",r.key),l.value="start",t.value=0},C=e=>{t.value=e.percent/2},L=()=>y(this,null,function*(){try{l.value="pending",t.value<96&&(t.value=t.value+2),yield B({key:u.modelValue}),l.value="start",s("update:modelValue","")}catch(e){}});return(e,r)=>(d(),k(c(S),{action:c(w),accept:a.accept,onError:n,onSuccess:i,beforeUpload:m,withCredentials:!0,showFileList:a.showFileList,"on-progress":C,disabled:!!a.modelValue},{default:I(()=>[g("div",N,[!a.modelValue&&l.value=="start"?(d(),k(c(p),{key:0,icon:"ant-design:cloud-upload-outlined"})):h("",!0),a.modelValue&&l.value=="start"?(d(),x("div",R,[g("img",{src:a.modelValue,class:"absolute w-full h-full"},null,8,M),g("div",q,[v(c(p),{color:"#409eff",onClick:o,hoverColor:"#fff",icon:"ant-design:search-outlined",class:"mr-2"}),v(c(p),{onClick:L,color:"#409eff",hoverColor:"#fff",icon:"ep:delete"})])])):h("",!0),l.value!="start"?(d(),x("div",A,[v(c(j),{width:78,type:"circle","striped-flow":!0,percentage:t.value},null,8,["percentage"])])):h("",!0)])]),_:1},8,["action","accept","showFileList","disabled"]))}});export{G as default};
