import { ref as i } from "vue";
import { getTypeFileByMime as n } from "./getTypeFileByMime.js";
const m = (l) => {
  const s = n(l.type), t = i(!1), a = i(!1), u = i(!1), o = i("");
  s === "image" ? t.value = !0 : s === "video" ? a.value = !0 : s === "audio" && (u.value = !0), t.value || a.value || u.value ? o.value = URL.createObjectURL(l) : o.value = "";
  const v = ["б", "Кб", "Мб", "Гб"];
  let e = l.size, r = 0;
  for (; e > 1024; )
    e = e / 1024, r++;
  return {
    isImage: t.value,
    isVideo: a.value,
    isAudio: u.value,
    previewUrl: o.value,
    fileSize: e.toFixed(2) + v[r]
  };
};
export {
  m as generatePreview
};
