import{d as k,i as E,r as m,c as N,w as P,a as g,o as p,e as T,n as a,f as l,t as i,F as w,g as H,b as f,u as n,y as h,l as j,P as A,h as U,L as V,j as x,k as S,m as M,T as O,p as R,B as Q,D as q,z as G,_ as J}from"./index-DSRztm3-.js";const K=k({__name:"upload-files-dialog",props:{currentFolder:{}},emits:["close","select","confirm"],setup(v,{emit:B}){const C=O,b=v,z=B,{$tr:y}=E(G),d=m({}),_=m(!1),c=m(0),u=m({}),D=N(()=>b.currentFolder?b.currentFolder.replaceAll("/"," / "):"Home"),I=N(()=>Object.keys(u.value).reduce((e,t)=>{const o=d.value[t].size,s=u.value[t],$=o*s/100;return e+=$,e},0));function F(e,t){e.lengthComputable&&(u.value[t]=parseFloat((e.loaded/e.total*100).toFixed(1)))}function L(e){_.value=!0,c.value=[...e].reduce((t,o)=>(t+=o.size,t),0),[...e].forEach(t=>{const o=q(5);if(!d.value[o]){d.value[o]=t;const s=new FileReader,$=new AbortController;s.addEventListener("loadstart",r=>F(r,o)),s.addEventListener("load",r=>F(r,o)),s.addEventListener("loadend",()=>{u.value[o]=100,$.abort()}),s.addEventListener("progress",r=>F(r,o)),s.readAsDataURL(t)}})}return P(()=>I.value,()=>{_.value&&I.value===c.value&&(z("select",Object.values(d.value)),z("confirm"))}),(e,t)=>(p(),g("div",{class:a(e.$style.uploadFilesDialog)},[_.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(D.value),3),l("div",{class:a(e.$style.totalProgress)},i(c.value===0?0:parseInt((I.value/c.value*100).toFixed(1)))+"% ",3)],2),l("div",{class:a(e.$style.uploadingContent)},[(p(!0),g(w,null,H(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(j),{value:o},null,8,["value"])],2),l("div",{class:a(e.$style.uploadingItemType)},[f(U,{"file-type":n(A)(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(),T(n(Q),{key:1,"permanent-display":"",onSelect:L},{"additional-text":x(()=>[l("div",{class:a(e.$style.additional)},[l("span",{class:a(e.$style.text)},[S(i(n(y)("app.upload.text.additional1"))+": ",1),l("b",null,i(v.currentFolder?`/${v.currentFolder}`:"Home"),1)],2),l("div",{class:a(e.$style.additionalInfo)},[M(l("span",null,null,512),[[n(C),n(y)("app.upload.text.additional2")]]),t[0]||(t[0]=S("  ",-1)),f(n(R),{multiple:"","button-text":n(y)("app.upload.file.text"),"onUpdate:modelValue":L},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};
