var f=(s,e,i)=>new Promise((l,r)=>{var t=a=>{try{n(i.next(a))}catch(o){r(o)}},d=a=>{try{n(i.throw(a))}catch(o){r(o)}},n=a=>a.done?l(a.value):Promise.resolve(a.value).then(t,d);n((i=i.apply(s,e)).next())});import{d as p}from"./uploadAction-50b8a6f7.js";import{u as m}from"./useCurrentInstance-cd4729ef.js";import{d as _,r as u,K as g,h,w,j as y,o as c,g as j,c as v,l as x}from"./index-90c78f99.js";const b=["src"],k=["src"],L=_({__name:"index",props:{visible:{type:Boolean,default:!1,required:!0},data:Object},setup(s){const e=s,{proxy:i}=m(),l=u(),r=u(!1),t=u("");return g(()=>e.visible,d=>f(this,null,function*(){if(d)if(e&&e.data&&e.data.fileUrl)l.value=e&&e.data&&e.data.fileUrl;else try{r.value=!0;const n=yield p(Number(e.data&&e.data.id),!1),a=e.data&&e.data.title.split(".");t.value=a&&a[a.length-1],["pdf","png","jpg","jpeg"].includes(t.value)?l.value=URL.createObjectURL(n):i.$message.warning("暂不支持预览")}finally{r.value=!1}})),(d,n)=>{const a=y("el-drawer"),o=x("loading");return c(),h(a,{"model-value":s.visible,title:s.data&&s.data.title,size:"80%",class:"drawer-perview"},{default:w(()=>[j((c(),v("div",null,[t.value==="png"||t.value==="jpg"||t.value==="jpeg"||t.value==="gif"?(c(),v("img",{key:0,src:l.value},null,8,b)):(c(),v("iframe",{key:l.value,src:l.value,style:{height:"100vh"},width:"100%"},null,8,k))])),[[o,r.value]])]),_:1},8,["model-value","title"])}}});export{L as _};
