const l = Object.freeze([]);
function y(n) {
  return !!n;
}
function p() {
}
function a(n, t, o) {
  return Object.assign(Reflect.construct(n, t ?? l), o);
}
function d(n) {
  return new Promise(
    (t, o) => a(FileReader, null, {
      onload: ({ target: e }) => t(e == null ? void 0 : e.result),
      onerror: ({ target: e }) => o(e == null ? void 0 : e.error)
    }).readAsArrayBuffer(n)
  );
}
function b(...n) {
  return URL.createObjectURL(new Blob(n));
}
function A(n) {
  n.cancelable && !n.defaultPrevented && n.preventDefault(), n.stopPropagation();
}
function h(n, t, o, ...e) {
  if (n.has(t))
    return n.get(t);
  const r = o == null ? /* @__PURE__ */ Object.create(null) : Reflect.construct(o, e);
  return n.set(t, r), r;
}
function m(n, t, o, e, r) {
  t.addEventListener(o, e, r);
  const u = [t, o, e];
  return n ? (n.push(u), n) : [u];
}
function E(n, t) {
  return new Promise((o) => setTimeout(o, n, t));
}
function v(n) {
  if (n == null || typeof n == "function")
    return !1;
  if (Array.isArray(n))
    return !0;
  const { length: t } = n;
  return Number.isInteger(t) && t >= 0;
}
function s(n) {
  return n != null && typeof n[Symbol.iterator] == "function";
}
function j(n) {
  return n == null ? l : s(n) ? n : Array.prototype.values.call(n);
}
function O(n, t, o) {
  if (n instanceof Set)
    n.forEach(t, o);
  else if (s(n))
    for (const e of n)
      t.call(o, e, e, n);
  else
    Array.prototype.forEach.call(n, t, o);
}
function F(n, t, o) {
  return new Promise(
    (e) => e(Function.prototype.apply.call(n, t, o))
  );
}
function c(n, t) {
  if (n == null)
    return;
  switch (typeof n) {
    case "undefined":
    case "function":
    case "symbol":
      return;
    case "number":
    case "boolean":
    case "string":
    case "bigint":
      return n;
  }
  const o = {};
  for (const e in t || n) {
    if (n[e] == null || typeof n[e] == "function" || n[e] instanceof EventTarget || n[e] instanceof Window)
      continue;
    const r = n[e];
    if (typeof r != "object") {
      o[e] = r;
      continue;
    }
    if (typeof r.length == "number") {
      let u;
      if (t) {
        if (Array.isArray(t[e]))
          u = t[e][0];
        else if (t[e] !== !0)
          continue;
      }
      const f = [];
      for (let i = 0; i < r.length; i++)
        f[i] = c(r[i], u);
      o[e] = f;
      continue;
    }
    if (typeof r[Symbol.iterator] == "function") {
      let u;
      if (t) {
        if (Array.isArray(t[e]))
          u = t[e][0];
        else if (t[e] !== !0)
          continue;
      }
      const f = [];
      for (const i of r)
        f.push(c(i, u));
      o[e] = f;
      continue;
    }
    o[e] = c(r, t && t[e]);
  }
  return o;
}
function I() {
  try {
    return window.self !== window.top;
  } catch {
    return !0;
  }
}
export {
  m as addEventListenerAndCache,
  b as arrayBufferToObjectUrl,
  d as blob2ArrayBuffer,
  F as defer,
  E as delay,
  l as emptyArray,
  O as forEach,
  h as getOrCreate,
  A as interceptEvent,
  v as isArrayLike,
  I as isInFrame,
  s as isIterable,
  y as isTruely,
  a as lazyInit,
  p as noop,
  c as sanitize,
  j as tryIterate
};
