import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{M as t,_ as n,f as r,i,p as a}from"./semantic-ui-react-m4AAKEby.js";import{f as o,m as s}from"./react-vendor-dEvHdx-C.js";var c=e=>{if(e===void 0)return``;let t=new Date(1970,0,1);return t.setSeconds(e),e>=3600?t.toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/u,`$1`):t.toTimeString().replace(/.*(\d{2}:\d{2}).*/u,`$1`)},l=(e,t,n=2)=>{if(t===`B`)return e+` `+t;let r=n<0?0:n;return Number.parseFloat((e/1024**{EB:6,GB:3,KB:1,MB:2,PB:5,TB:4,YB:8,ZB:7}[t]).toFixed(r))},u=(e,t=2)=>{if(e===0)return`0 B`;let n=1024,r=t<0?0:t,i=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],a=Math.floor(Math.log(e)/Math.log(n));return Number.parseFloat((e/n**a).toFixed(r))+` `+i[a]},d=e=>new Date(e).toLocaleString(),f=e=>e.split(`\\`).pop().split(`/`).pop(),p=e=>{let t=e;return t.lastIndexOf(`\\`)>0&&(t=t.slice(0,Math.max(0,t.lastIndexOf(`\\`)))),t.lastIndexOf(`/`)>0&&(t=t.slice(0,Math.max(0,t.lastIndexOf(`/`)))),t},m=({bitRate:e,isVariableBitRate:t,bitDepth:n,sampleRate:r})=>r&&n?`${n}/${r/1e3}kHz`:t?`${e} Kbps, VBR`:e?`${e} Kbps`:``,h=e=>new Promise(t=>{setTimeout(t,e)}),g=e(s()),_=o(),v=({directoryName:e,disabled:o,files:s,footer:l,locked:d,onClose:p,onSelectionChange:h})=>{let[v,y]=(0,g.useState)(!1);return(0,_.jsxs)(`div`,{className:`filelist`,style:{opacity:d?.5:1},children:[(0,_.jsx)(r,{className:`filelist-header`,size:`small`,children:(0,_.jsxs)(`div`,{className:`filelist-title`,children:[(0,_.jsx)(a,{link:!d,name:d?`lock`:v?`folder`:`folder open`,onClick:()=>!d&&y(!v),size:`large`}),e,!!p&&(0,_.jsx)(a,{className:`close-button`,color:`red`,link:!0,name:`close`,onClick:()=>p()})]})}),!v&&s&&s.length>0&&(0,_.jsx)(n,{children:(0,_.jsx)(n.Item,{children:(0,_.jsxs)(t,{className:`filelist-table`,children:[(0,_.jsx)(t.Header,{children:(0,_.jsxs)(t.Row,{children:[(0,_.jsx)(t.HeaderCell,{className:`filelist-selector`,children:(0,_.jsx)(i,{checked:s.filter(e=>!e.selected).length===0,disabled:o,fitted:!0,onChange:(e,t)=>s.map(e=>h(e,t.checked))})}),(0,_.jsx)(t.HeaderCell,{className:`filelist-filename`,children:`File`}),(0,_.jsx)(t.HeaderCell,{className:`filelist-size`,children:`Size`}),(0,_.jsx)(t.HeaderCell,{className:`filelist-attributes`,children:`Attributes`}),(0,_.jsx)(t.HeaderCell,{className:`filelist-length`,children:`Length`})]})}),(0,_.jsx)(t.Body,{children:s.sort((e,t)=>e.filename>t.filename?1:-1).map(e=>(0,_.jsxs)(t.Row,{children:[(0,_.jsx)(t.Cell,{className:`filelist-selector`,children:(0,_.jsx)(i,{checked:e.selected,disabled:o,fitted:!0,onChange:(t,n)=>h(e,n.checked)})}),(0,_.jsxs)(t.Cell,{className:`filelist-filename`,children:[d?(0,_.jsx)(a,{name:`lock`}):``,f(e.filename)]}),(0,_.jsx)(t.Cell,{className:`filelist-size`,children:u(e.size)}),(0,_.jsx)(t.Cell,{className:`filelist-attributes`,children:m(e)}),(0,_.jsx)(t.Cell,{className:`filelist-length`,children:c(e.length)})]},e.filename))}),l&&(0,_.jsx)(t.Footer,{fullWidth:!0,children:(0,_.jsx)(t.Row,{children:(0,_.jsx)(t.HeaderCell,{colSpan:`5`,children:l})})})]})})})]})};export{p as a,d as i,u as n,f as o,l as r,h as s,v as t};