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