import{aY as G,_ as I,r,P as $,o as N,c as O,b as d,w as o,af as _,ai as U,ae as K,a as Y,ac as q,g as F,h as M,E as R,__tla as T}from"./index.91e2b97e.js";import{a as X,__tla as H}from"./el-tag.b6486cea.js";import{E as J,__tla as Q}from"./el-progress.4d9e61fa.js";import{g as L,a as S}from"./helper.2ba6f024.js";let A,W=Promise.all([(()=>{try{return T}catch{}})(),(()=>{try{return H}catch{}})(),(()=>{try{return Q}catch{}})()]).then(async()=>{let g;g=["src"],A={__name:"index",props:{part:String,full:String,list:Array,sizeLimit:Number,size:String,time:String},emits:["update:part","update:full","update:size","update:time","compile","update:list"],setup(b,{emit:n}){const l=b,j=G.token,D=window.GLOBAL_CONFIG.api+"/upload/main/file",B={token:j,client:"web",api:"json",issubmit:"1",site:"tyyx"},w=I(),i=r(l.part),s=r(l.full),c=r(0),h=r(l.time??new Date().toLocaleString()),u=r([]);function y(){i.value!==void 0&&i.value!==""&&i.value!==null&&(u.value=i.value.split(";").map((a,e)=>({part_url:L(a),url:S(a),name:a.split("/").pop()}))),s.value!==void 0&&s.value!==""&&s.value!==null&&(u.value=s.value.split(";").map((a,e)=>{const[t,p]=a.split("|");return{part_url:L(t),url:S(t),name:p}}))}y(),$(()=>[l.part,l.full],(a,e)=>{i.value=l.part,s.value=l.full,y()});function x(a){if(l.sizeLimit){const e=a.size/1024<l.sizeLimit;return e||F.warning(`\u4E0A\u4F20\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7 ${l.sizeLimit}KB!`),e}}function z(){if(console.log("handleSuccess :>> ",u.value.map(a=>a.status),u.value),u.value.every(a=>a.status==="success")){let a=[],e=[];u.value.forEach(t=>{if(t.percentage===100){const{url:p,file_name:v}=t.response.data;a.push(p),e.push(`${p}|${v}`),c.value+=t.size??0}else a.push(t.part_url),e.push(`${t.part_url}|${t.name}`),c.value+=t.size??0}),n("update:list",a),s.value=e.join(";"),i.value=a.join(";"),h.value=new Date().toLocaleString()}}function C(a,e){u.value=e,z()}function P(){F.warning(`\u6700\u591A\u5141\u8BB8\u4E0A\u4F20${w.limit}\u4E2A\u6587\u4EF6`)}const E=r(""),m=r(!1),V=a=>{var e;["png","jpg","jpeg"].includes((e=a.url)==null?void 0:e.split(".").at(-1))&&(E.value=a.url,m.value=!0)};function k(a){return(a/1024).toString()}return $(()=>i.value,()=>{n("update:part",i.value),n("update:full",s.value),n("update:size",k(c.value)),n("update:time",h.value),n("compile",u.value),console.log("compile")}),(a,e)=>{const t=R,p=J,v=X;return N(),O(q,null,[d(p,U({action:D,data:B,name:"filedata","on-success":z,"on-remove":C,"on-exceed":P,"before-upload":x,"file-list":u.value,"onUpdate:file-list":e[0]||(e[0]=f=>u.value=f),"on-preview":V},K(w),{class:"w-full"}),{default:o(()=>[_(a.$slots,"default",{},()=>[d(t,{type:"primary"},{default:o(()=>[M("\u70B9\u51FB\u4E0A\u4F20")]),_:1})])]),tip:o(()=>[_(a.$slots,"tip")]),file:o(()=>[_(a.$slots,"file")]),_:3},16,["file-list"]),d(v,{modelValue:m.value,"onUpdate:modelValue":e[1]||(e[1]=f=>m.value=f)},{default:o(()=>[Y("img",{"w-full":"",src:E.value,alt:"Preview Image"},null,8,g)]),_:1},8,["modelValue"])],64)}}}});export{A as _,W as __tla};
