var p = Object.defineProperty;
var l = (s, e, t) => e in s ? p(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
var r = (s, e, t) => l(s, typeof e != "symbol" ? e + "" : e, t);
import { ContentType as d } from "./index-Document.types.js";
import { MediaItemProcessor as m } from "./index-MediaItemProcessor.js";
class P extends m {
  constructor() {
    super(...arguments);
    r(this, "applicableFileTypes", [d.APPLICATION_PDF]);
    r(this, "process", (t) => new Promise(async (i) => {
      const n = [];
      for (const o of t) {
        const {
          file: a
        } = o;
        if (!a || o.fileType && !this.applicableFileTypes.includes(o.fileType)) {
          n.push(o);
          continue;
        }
        const c = await this.readFileAsDataURL(a);
        n.push({
          ...o,
          mediaItemContent: {
            base64EncodedContent: c,
            objectType: "DocumentContent"
          }
        });
      }
      i(n);
    }));
    r(this, "readFileAsDataURL", (t) => new Promise((i) => {
      const n = new FileReader();
      n.onload = (o) => {
        var a;
        i((a = o.target) == null ? void 0 : a.result);
      }, n.readAsDataURL(t);
    }));
  }
}
export {
  P as DocumentContentProcessor
};
