var c = Object.defineProperty;
var l = (a, e, s) => e in a ? c(a, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : a[e] = s;
var t = (a, e, s) => l(a, typeof e != "symbol" ? e + "" : e, s);
class o {
  constructor(e, s) {
    t(this, "debug");
    t(this, "name");
    this.debug = e, this.name = s;
  }
  log(...e) {
    if (this.debug) {
      let s = `[${Date.now()}]`;
      this.name && (s += ` - ${this.name}`), console.log.apply(console, [s, ...e]);
    }
  }
  warn(...e) {
    let s = `[${Date.now()}]`;
    this.name && (s += ` - ${this.name}`), console.warn.apply(console, [s, ...e]);
  }
}
class n {
  constructor() {
    t(this, "_sdk");
    t(this, "_isLoaded", !1);
    t(this, "_callBuffer", []);
    t(this, "_capacity", 1e5);
    t(this, "_droppedEvents", 0);
    t(this, "_exceededCapacity", !1);
    t(this, "_logger", new o());
  }
  _bufferCall(e, s) {
    if (this._isLoaded)
      return this._sdk[e](...s);
    this._enqueue({ method: e, args: s });
  }
  _enqueue(e) {
    this._callBuffer.length < this._capacity ? (this._callBuffer.push(e), this._exceededCapacity = !1) : (this._exceededCapacity || (this._exceededCapacity = !0, this._logger.warn("Exceeded event queue capacity. Increase capacity to avoid dropping events.")), this._droppedEvents += 1);
  }
  load(e) {
    this._sdk = e, this._isLoaded = !0;
    for (const { method: s, args: i } of this._callBuffer)
      try {
        this._sdk[s](...i);
      } catch (r) {
        console.error(`Error executing buffered call to ${s}:`, r);
      }
    this._callBuffer = [];
  }
}
export {
  n as B,
  o as L
};
//# sourceMappingURL=buffer-9GjOvOok.js.map
