import{d as B,c as S,r as m,i as w,w as H,a as g,o as p,f as j,n as a,g as l,t as i,F as E,h as P,b as f,u as n,k as h,S as q,D as T,l as U,m as V,p as A,q as D,s as M,v as O,x as Q,y as R,z as x,j as G,_ as J}from"./index-BPhyrT9l.js";const K=B({__name:"upload-files-dialog",props:{currentFolder:{}},emits:["close","select","confirm"],setup(N,{emit:C}){const L=O,F=N,k=S(()=>F.currentFolder?F.currentFolder.replaceAll("/"," / "):"Home"),d=m({}),v=m(!1),c=m(0),u=m({}),_=S(()=>Object.keys(u.value).reduce((e,t)=>{const o=d.value[t].size,s=u.value[t],$=o*s/100;return e+=$,e},0)),b=C,{$tr:y}=w(G);function I(e,t){e.lengthComputable&&(u.value[t]=parseFloat((e.loaded/e.total*100).toFixed(1)))}function z(e){v.value=!0,c.value=[...e].reduce((t,o)=>(t+=o.size,t),0),[...e].forEach(t=>{const o=x(5);if(!d.value[o]){d.value[o]=t;const s=new FileReader,$=new AbortController;s.addEventListener("loadstart",r=>I(r,o)),s.addEventListener("load",r=>I(r,o)),s.addEventListener("loadend",()=>{u.value[o]=100,$.abort()}),s.addEventListener("progress",r=>I(r,o)),s.readAsDataURL(t)}})}return H(()=>_.value,()=>{v.value&&_.value===c.value&&(b("select",Object.values(d.value)),b("confirm"))}),(e,t)=>(p(),g("div",{class:a(e.$style.uploadFilesDialog)},[v.value?(p(),g("div",{key:0,class:a(e.$style.uploading)},[l("div",{class:a(e.$style.uploadingHeader)},[l("div",{class:a(e.$style.folderName)},i(k.value),3),l("div",{class:a(e.$style.totalProgress)},i(c.value===0?0:parseInt((_.value/c.value*100).toFixed(1)))+"% ",3)],2),l("div",{class:a(e.$style.uploadingContent)},[(p(!0),g(E,null,P(u.value,(o,s)=>(p(),g("div",{key:s,class:a(e.$style.uploadingItem)},[l("div",{class:a(e.$style.uploadingItemBody)},[l("div",{class:a(e.$style.uploadingItemLabel)},[f(n(h),{icon:"round-subject",color:"var(--color-icon-table-secondary-default)"}),l("div",{class:a(e.$style.uploadingItemName)},i(d.value[s].name),3)],2),f(n(q),{value:o},null,8,["value"])],2),l("div",{class:a(e.$style.uploadingItemType)},[f(U,{"file-type":n(T)(d.value[s].name).toLowerCase()},null,8,["file-type"])],2),l("div",{class:a(e.$style.uploadingItemSize)},i(n(V)(d.value[s].size)),3)],2))),128))],2)],2)):(p(),j(n(R),{key:1,"permanent-display":"",onSelect:z},{"additional-text":A(()=>[l("div",{class:a(e.$style.additional)},[l("span",{class:a(e.$style.text)},[D(i(n(y)("app.upload.text.additional1"))+": ",1),l("b",null,i(e.currentFolder?`/${e.currentFolder}`:"Home"),1)],2),l("div",{class:a(e.$style.additionalInfo)},[M(l("span",null,null,512),[[n(L),n(y)("app.upload.text.additional2")]]),t[0]||(t[0]=D("  ")),f(n(Q),{multiple:"","button-text":n(y)("app.upload.file.text"),"onUpdate:modelValue":z},null,8,["button-text"])],2)],2)]),_:1}))],2))}}),W="_uploadFilesDialog_1f40d_1",X="_uploading_1f40d_10",Y="_uploadingHeader_1f40d_20",Z="_folderName_1f40d_30",ee="_totalProgress_1f40d_40",ae="_uploadingContent_1f40d_47",le="_uploadingItem_1f40d_54",te="_uploadingItemBody_1f40d_66",oe="_uploadingItemLabel_1f40d_71",se="_uploadingItemName_1f40d_80",ne="_uploadingItemType_1f40d_86",de="_uploadingItemSize_1f40d_94",ie="_additional_1f40d_104",ue="_text_1f40d_108",re="_additionalInfo_1f40d_116",pe={uploadFilesDialog:W,uploading:X,uploadingHeader:Y,folderName:Z,totalProgress:ee,uploadingContent:ae,uploadingItem:le,uploadingItemBody:te,uploadingItemLabel:oe,uploadingItemName:se,uploadingItemType:ne,uploadingItemSize:de,additional:ie,text:ue,additionalInfo:re},ce={$style:pe},ge=J(K,[["__cssModules",ce]]);export{ge as default};
