import{d as v,g as t,A as s,K as h,L as k,H as C,J as o,a8 as m,G as d,B as x,j as z,P as f,O as p,D as B,t as S}from"./index-DOFLUERq.js";import{I as F}from"./iconify-p99pbjf9.js";import{_ as I}from"./_plugin-vue_export-helper-DlAUqK2U.js";const M={class:"file-masonry-view"},N=["onClick"],L=["checked","onChange"],D=["src","alt"],A={class:"masonry-overlay"},E={class:"overlay-name"},K={key:0,class:"overlay-size"},$=v({__name:"masonry_view",props:{rows:{},selectedKeys:{},previewName:{}},emits:["rowClick","toggleSelection"],setup(a){const r=["jpg","jpeg","png","gif","webp","svg","bmp","ico"];function y(i){return r.includes((i.file_type||"").toLowerCase())}function b(i){const e=(i.file_type||"").toLowerCase();return i.is_folder?"tabler:folder":r.includes(e)?"tabler:photo":["pdf"].includes(e)?"tabler:file-type-pdf":["doc","docx"].includes(e)?"tabler:file-type-doc":["xls","xlsx"].includes(e)?"tabler:file-type-xls":["zip","rar","7z","tar","gz"].includes(e)?"tabler:file-zip":["mp4","avi","mov","mkv","webm"].includes(e)?"tabler:file-type-video":["mp3","wav","flac","aac","ogg"].includes(e)?"tabler:file-type-audio":"tabler:file"}function c(i){const e=(i.file_type||"").toLowerCase();return i.is_folder?"#f59e0b":r.includes(e)?"#10b981":["pdf"].includes(e)?"#ef4444":["doc","docx"].includes(e)?"#3b82f6":["xls","xlsx"].includes(e)?"#059669":["zip","rar","7z"].includes(e)?"#8b5cf6":["mp4","avi","mov"].includes(e)?"#ec4899":["mp3","wav","flac"].includes(e)?"#f97316":"#6b7280"}const g={pdf:{label:"PDF",color:"#ef4444"},doc:{label:"DOC",color:"#3b82f6"},docx:{label:"DOC",color:"#3b82f6"},xls:{label:"XLS",color:"#059669"},xlsx:{label:"XLS",color:"#059669"},zip:{label:"ZIP",color:"#8b5cf6"},rar:{label:"RAR",color:"#8b5cf6"}};function u(i){return i.is_folder?{label:S("Folder"),color:"#f59e0b"}:g[(i.file_type||"").toLowerCase()]||null}function _(i){const e=typeof i=="string"?parseInt(i,10):i;if(isNaN(e)||e===0)return"0 B";const l=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,n)).toFixed(n>0?1:0)+" "+l[n]}return(i,e)=>(t(),s("div",M,[(t(!0),s(h,null,k(a.rows,l=>(t(),s("div",{key:l.name,class:C(["masonry-item",{selected:a.selectedKeys.includes(l.name),previewed:a.previewName===l.name}]),onClick:n=>i.$emit("rowClick",l)},[o("div",{class:"masonry-checkbox",onClick:e[0]||(e[0]=m(()=>{},["stop"]))},[o("input",{type:"checkbox",checked:a.selectedKeys.includes(l.name),onChange:n=>i.$emit("toggleSelection",l.name)},null,40,L)]),y(l)&&(l.thumbnail_url||l.file_url)?(t(),s("img",{key:0,src:l.thumbnail_url||l.file_url,alt:l.file_name,loading:"lazy",decoding:"async",class:"masonry-img"},null,8,D)):(t(),s("div",{key:1,class:"masonry-placeholder",style:d({backgroundColor:c(l)+"12"})},[x(z(F),{icon:b(l),size:48,style:d({color:c(l)})},null,8,["icon","style"]),u(l)?(t(),s("span",{key:0,class:"placeholder-badge",style:d({color:c(l)})},f(u(l).label),5)):p("",!0)],4)),o("div",A,[o("div",E,f(l.file_name||l.name),1),l.file_size?(t(),s("div",K,f(_(l.file_size)),1)):p("",!0)]),o("div",{class:"masonry-actions",onClick:e[1]||(e[1]=m(()=>{},["stop"]))},[B(i.$slots,"actions",{row:l},void 0,!0)])],10,N))),128))]))}}),V=I($,[["__scopeId","data-v-99364143"]]);export{V as default};
