import{d as v,c1 as I,bI as C,o as n,k as _,l as f,c,x as r,m as h,t as d,z as e,v as z,L as F,c2 as x,c3 as B,V as $,q as R}from"./index-00b4fcdc.js";import{u as S,b as V,k as E,F as A,g as L}from"./FileItem-40e08df3.js";import"./functionalCallableComp-fa3cc081.js";import"./index-57be937e.js";import"./db-6498d1af.js";import"./index-9c72d52d.js";const T={class:"actions-panel actions"},N={key:0,class:"file-list"},U={class:"hint"},q=v({__name:"batchDownload",props:{tabIdx:{},paneIdx:{},id:{}},setup(H){const{stackViewEl:k}=S().toRefs(),{itemSize:p,gridItems:w,cellWidth:b}=V(),l=E(),{selectdFiles:i}=I(l),m=C(),y=async t=>{const s=x(t);s&&l.addFiles(s.nodes)},D=async()=>{m.pushAction(async()=>{const t=await B.value.post("/zip",{paths:i.value.map(o=>o.fullpath)},{responseType:"blob"}),s=window.URL.createObjectURL(new Blob([t.data])),a=document.createElement("a");a.href=s,a.setAttribute("download",`iib_${new Date().toLocaleString()}.zip`),document.body.appendChild(a),a.click()})},g=t=>{i.value.splice(t,1)};return(t,s)=>{const a=$;return n(),_("div",{class:"container",ref_key:"stackViewEl",ref:k,onDrop:y},[f("div",T,[c(a,{onClick:s[0]||(s[0]=o=>e(l).selectdFiles=[])},{default:r(()=>[h(d(t.$t("clear")),1)]),_:1}),c(a,{onClick:D,type:"primary",loading:!e(m).isIdle},{default:r(()=>[h(d(t.$t("zipDownload")),1)]),_:1},8,["loading"])]),e(i).length?(n(),z(e(L),{key:1,ref:"scroller",class:"file-list",items:e(i).slice(),"item-size":e(p).first,"key-field":"fullpath","item-secondary-size":e(p).second,gridItems:e(w)},{default:r(({item:o,index:u})=>[c(A,{idx:u,file:o,"cell-width":e(b),"enable-close-icon":"",onCloseIconClick:j=>g(u),"full-screen-preview-image-url":e(F)(o),"enable-right-click-menu":!1},null,8,["idx","file","cell-width","onCloseIconClick","full-screen-preview-image-url"])]),_:1},8,["items","item-size","item-secondary-size","gridItems"])):(n(),_("div",N,[f("p",U,d(t.$t("batchDownloaDDragAndDropHint")),1)]))],544)}}});const M=R(q,[["__scopeId","data-v-aab31da2"]]);export{M as default};
