import{d as M,p as o,r as N,f as R,i as f,a as m,c as E,k as y,m as _,v as A,n as T,j,e as l,F as I,t as P,l as D,a4 as $,z as q,M as r,av as H,_ as O}from"./index-deffec86.js";const G={class:"local-container",style:{position:"relative"}},J={class:"el-upload__tip font-grey"},K=M({__name:"VideoUp",props:{fileList:{default:()=>[]}},emits:["update:fileList","success","delete"],setup(C,{emit:x}){const L=C,p=o(1024),U=o(["video/mp4"]),F=o(0),v=o(!1),d=o(!1),h=o(!0),z=o({}),n=N({time_len:0,size:0,url:""}),i=R({set(e){c("update:fileList",e)},get(){return L.fileList}}),w=e=>{const u=e.size/1024/1024<p.value,a=U.value;return a.includes(e.type)||r({title:"\u6E29\u99A8\u63D0\u793A",message:"\u4E0A\u4F20\u7684\u89C6\u9891\u4E0D\u7B26\u5408\u6240\u9700\u7684\u683C\u5F0F\uFF01",type:"warning"}),u||r({title:"\u6E29\u99A8\u63D0\u793A",message:`\u4E0A\u4F20\u7684\u89C6\u9891\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${p.value}M\uFF01`,type:"warning"}),a.includes(e.type)&&u},g=o(""),B=async e=>{const u=URL.createObjectURL(e.file),a=new Audio(u);a.addEventListener("loadedmetadata",function(t){n.time_len=a.duration}),n.size=e.file.size,d.value=!0;const s=new H({totalSize:0,chunkSize:10*1024*1024,maxMemory:100*1024*1024,file:e.file});g.value=s,s.on("retry",t=>{t.url}),s.on("complete",t=>{v.value=!1}),s.on("success",t=>{n.url=t.url,e.onSuccess(t),c("success",n)}),s.on("fail",t=>{}),s.on("uploadDone",t=>{}),s.on("progress",t=>{F.value=t.progress}),s.upload()},S=()=>{r({title:"\u6E29\u99A8\u63D0\u793A",message:"\u5F53\u524D\u6700\u591A\u53EA\u80FD\u4E0A\u4F20 1 \u4E2A\u89C6\u9891\uFF0C\u8BF7\u79FB\u9664\u540E\u4E0A\u4F20\uFF01",type:"warning"})},c=x,V=(e,u)=>{!e||(u.url=e.url,c("update:fileList",i.value),r({title:"\u6E29\u99A8\u63D0\u793A",message:"\u89C6\u9891\u4E0A\u4F20\u6210\u529F\uFF01",type:"success"}))},k=e=>{g.value.pause(),d.value=!1,c("delete",e)};return(e,u)=>{const a=f("el-button"),s=f("el-upload"),t=f("el-progress");return m(),E("div",G,[y(s,{class:"upload-demo","file-list":l(i),"onUpdate:fileList":u[0]||(u[0]=b=>$(i)?i.value=b:null),action:"#","http-request":B,"list-type":"text",name:"image",data:l(z),limit:1,"before-upload":w,"on-exceed":S,"on-remove":k,"on-success":V},{trigger:_(()=>[y(a,{type:"primary",plain:""},{default:_(()=>u[1]||(u[1]=[A("\u89C6\u9891\u4E0A\u4F20")])),_:1}),T(e.$slots,"button",{},void 0,!0)]),tip:_(()=>[j("div",J,[l(h)?(m(),E(I,{key:0},[A("\u53EA\u80FD\u4E0A\u4F20\u89C6\u9891\u6587\u4EF6MP4,\u4E14\u4E0D\u8D85\u8FC7"+P(l(p))+"MB",1)],64)):D("v-if",!0)])]),_:3},8,["file-list","data"]),l(d)?(m(),q(t,{key:0,style:{width:"400px"},percentage:l(F),status:l(v)===!1?"":"success"},null,8,["percentage","status"])):D("v-if",!0)])}}});const W=O(K,[["__scopeId","data-v-9ae4a24d"]]);export{W as V};
