async function s(t) {
  return Promise.all(
    Array.from(t).map(async (e) => {
      const n = await new Promise((r, o) => {
        const a = new FileReader();
        a.onload = () => {
          const l = a.result;
          r(l.split(",")[1]);
        }, a.onerror = o, a.readAsDataURL(e);
      });
      return {
        fileName: e.name,
        fileType: e.type,
        file: e,
        fileData: n
      };
    })
  );
}
function m(t, e, n = !1) {
  return n ? [
    ...t.trim().length > 0 ? [{ type: "text", text: t.trim() }] : [],
    ...e.map((r) => ({
      type: "document",
      source: { filename: r.fileName, filetype: r.fileType }
    }))
  ] : [
    ...t.trim().length > 0 ? [{ type: "text", text: t }] : [],
    ...e.map((r) => ({
      type: "document",
      ...r,
      cache_control: { type: "ephemeral" }
    }))
  ];
}
export {
  m as buildContentBlocks,
  s as readFilesAsBase64
};
//# sourceMappingURL=submitUtils.es.js.map
