var e=Object.defineProperty,t=Object.defineProperties,a=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable,s=(t,a,r)=>a in t?e(t,a,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[a]=r,l=(e,t,a)=>new Promise((r,n)=>{var d=e=>{try{l(a.next(e))}catch(t){n(t)}},s=e=>{try{l(a.throw(e))}catch(t){n(t)}},l=e=>e.done?r(e.value):Promise.resolve(e.value).then(d,s);l((a=a.apply(e,t)).next())});import{aF as c,_ as o}from"./index-DuMLoKSq.js";import{l as p,r as u,j as y,h as i,ae as b,al as f,I as h,z as x,L as m,A as v,B as k,O as _,R as j,J as g}from"./vue-vendor-o3p-Y_v4.js";import{B as w}from"./base64-DKMy4_rM.js";import{f as C,e as O,x as P,h as R}from"./element-plus-pFwXBqSo.js";const D=["src"],I={key:2},V={controls:"",style:{width:"100%",height:"100%"},ref:"videoRef"},B=["src"],E={key:4,style:{display:"flex","justify-content":"space-around"}};const U=o({props:{data:{type:Object,required:!0}},setup(e,o){const f=p({type:0,url:"",text:"",rate:1}),h=u(null),x=e=>l(this,null,function*(){switch(e.type){case"md":case"txt":f.type=0,f.text=yield c(decodeURIComponent(escape(window.atob(e.data))));break;case"pdf":f.type=1,f.text=e.data;break;case"py":case"sage":f.type=0,f.text="```python\n"+w.decode(e.data)+"\n```";break;case"c":f.type=0,f.text="```c\n"+w.decode(e.data)+"\n```";break;case"cpp":case"cc":f.type=0,f.text="```cpp\n"+w.decode(e.data)+"\n```";break;case"go":f.type=0,f.text="```go\n"+w.decode(e.data)+"\n```";break;case"rb":f.type=0,f.text="```ruby\n"+w.decode(e.data)+"\n```";break;case"js":f.type=0,f.text="```js\n"+w.decode(e.data)+"\n```";break;case"php":f.type=0,f.text="```php\n"+w.decode(e.data)+"\n```";break;case"jsp":f.type=0,f.text="```jsp\n"+w.decode(e.data)+"\n```";break;case"java":f.type=0,f.text="```java\n"+w.decode(e.data)+"\n```";break;case"ts":f.type=0,f.text="```ts\n"+w.decode(e.data)+"\n```";break;case"sh":f.type=0,f.text="```sh\n"+w.decode(e.data)+"\n```";break;case"pl":f.type=0,f.text="```perl\n"+w.decode(e.data)+"\n```";break;case"mp4":f.type=2,f.url=e.url;break;case"png":case"jpg":case"bmp":case"gif":case"apng":case"ico":f.type=3,f.url=e.url;break;default:f.type=4,f.text=`暂时不支持${e.type}文件预览,请下载查看!`}});y(()=>l(this,null,function*(){yield x(e.data)})),i(()=>e.data,(e,t)=>l(this,null,function*(){yield x(e)}));return m=((e,t)=>{for(var a in t||(t={}))n.call(t,a)&&s(e,a,t[a]);if(r)for(var a of r(t))d.call(t,a)&&s(e,a,t[a]);return e})({},b(f)),v={handleChangeRate:e=>{h.value.playbackRate=e},videoRef:h,handleDownloadClick:()=>{const t=document.createElement("a"),a=e.data.url;t.style.display="none",t.href=a,t.target="_blank",document.body.appendChild(t),t.click(),document.body.removeChild(t)}},t(m,a(v));var m,v}},[["render",function(e,t,a,r,n,d){const s=f("v-md-preview"),l=C,c=O,o=P,p=R;return 0==e.type?(v(),h(s,{key:0,text:e.text},null,8,["text"])):1==e.type?(v(),x("iframe",{key:1,src:`data:application/pdf;base64,${e.text}`,frameborder:"0",width:"100%",height:"650px"},null,8,D)):2==e.type?(v(),x("div",I,[k("video",V,[k("source",{src:e.url,type:"video/mp4"},null,8,B)],512),k("p",null,[t[7]||(t[7]=_("选择播放速率:",-1)),j(c,{modelValue:e.rate,"onUpdate:modelValue":t[0]||(t[0]=t=>e.rate=t),onChange:r.handleChangeRate},{default:g(()=>[j(l,{value:.5},{default:g(()=>t[1]||(t[1]=[_("0.5",-1)])),_:1,__:[1]}),j(l,{value:1,selected:""},{default:g(()=>t[2]||(t[2]=[_("1.0",-1)])),_:1,__:[2]}),j(l,{value:1.25},{default:g(()=>t[3]||(t[3]=[_("1.25",-1)])),_:1,__:[3]}),j(l,{value:1.5},{default:g(()=>t[4]||(t[4]=[_("1.5",-1)])),_:1,__:[4]}),j(l,{value:2},{default:g(()=>t[5]||(t[5]=[_("2.0",-1)])),_:1,__:[5]}),j(l,{value:4},{default:g(()=>t[6]||(t[6]=[_("4.0",-1)])),_:1,__:[6]})]),_:1},8,["modelValue","onChange"])])])):3==e.type?(v(),h(o,{key:3,src:e.url},null,8,["src"])):4==e.type?(v(),x("div",E,[j(s,{text:e.text},null,8,["text"]),j(p,{onClick:r.handleDownloadClick},{default:g(()=>t[8]||(t[8]=[_("下载",-1)])),_:1,__:[8]},8,["onClick"])])):m("",!0)}]]);export{U as r};