var f = (c, s, n) => new Promise((r, e) => {
  var t = (a) => {
    try {
      d(n.next(a));
    } catch (i) {
      e(i);
    }
  }, o = (a) => {
    try {
      d(n.throw(a));
    } catch (i) {
      e(i);
    }
  }, d = (a) => a.done ? r(a.value) : Promise.resolve(a.value).then(t, o);
  d((n = n.apply(c, s)).next());
});
import { B as m } from "./cde606f5.js";
class l extends m {
  constructor() {
    if (super(), typeof createImageBitmap == "undefined")
      throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");
    if (typeof document == "undefined" && typeof OffscreenCanvas == "undefined")
      throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available");
  }
  decode(s, n) {
    return f(this, null, function* () {
      const r = new Blob([n]), e = yield createImageBitmap(r);
      let t;
      typeof document != "undefined" ? (t = document.createElement("canvas"), t.width = e.width, t.height = e.height) : t = new OffscreenCanvas(e.width, e.height);
      const o = t.getContext("2d");
      return o.drawImage(e, 0, 0), o.getImageData(0, 0, e.width, e.height).data.buffer;
    });
  }
}
export {
  l as default
};
