import { generatePreview as n } from "./generatePreview.js";
import { getTypeFileByMime as a } from "./getTypeFileByMime.js";
const c = async (o, r) => {
  const t = new FormData();
  t.append("file", r);
  const s = (o || "https://filebump2.services.mobilon.ru") + "/upload";
  try {
    return {
      url: (await (await fetch(
        s,
        {
          method: "POST",
          body: t
        }
      )).json()).url,
      name: r.name,
      size: r.size,
      type: a(r.type),
      status: "success",
      preview: n(r)
    };
  } catch (e) {
    return console.error("Ошибка при загрузке файла:", e), { status: "error" };
  }
};
export {
  c as uploadFile
};
