import{B as s}from"./index-25eb6331.js";const a=e=>{if(e===0)return"-";if(e===-1)return"未知";const t=1024,n=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],r=Math.floor(Math.log(e)/Math.log(t));return(e/Math.pow(t,r)).toFixed(2)+" "+n[r]},u=(e,t,n)=>e.type==="BACK"?"":e.type==="ROOT"||e.type==="FOLDER"&&!e.size?"-":n===0?"0 B":n===-1?"未知":a(n),c=e=>{let t;if(e.type==="BACK"||e.type==="FOLDER"||e.type==="ROOT")return e.type.toLowerCase();{const n=i(e.name),r=f(e.name);s.iconFileType.indexOf(n)!==-1?t=n:r?t=r:t="file"}return t},i=e=>{const t=e.lastIndexOf(".");return t===-1?"other":e.substring(t+1).toLowerCase()},p=e=>{const t=e.lastIndexOf("/");return t===-1?e:e.substring(t+1)},d=e=>{const t=e.lastIndexOf(".");return t===-1?"":e.substring(0,t)},f=e=>{let t;for(const n in s.fileTypeMap){const r=i(e);if(s.fileTypeMap[n].indexOf(r)!==-1){t=n;break}}return t};function x(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>{t(r.result)},r.onerror=o=>{n(o)}})}export{x as a,f as b,u as c,i as d,d as e,a as f,c as g,p as h};
