import "../../../zero-protocol/src/data.js";
const runtimeDebugFlags = {
  trackRowCountsVended: false,
  trackRowsVended: false
};
class Debug {
  #rowCountsBySource;
  #rowsBySource;
  #nvisitBySource;
  constructor() {
    this.#rowCountsBySource = {};
    this.#rowsBySource = {};
    this.#nvisitBySource = {};
  }
  getVendedRowCounts() {
    return this.#rowCountsBySource;
  }
  getVendedRows() {
    return this.#rowsBySource;
  }
  getNVisitCounts() {
    return this.#nvisitBySource;
  }
  initQuery(table, query) {
    const { counts } = this.#getRowStats(table);
    if (counts) {
      if (!counts[query]) {
        counts[query] = 0;
      }
    }
  }
  reset() {
    this.#rowCountsBySource = {};
    this.#rowsBySource = {};
    this.#nvisitBySource = {};
  }
  rowVended(table, query, row) {
    const { counts, rows } = this.#getRowStats(table);
    if (counts) {
      counts[query] = (counts[query] ?? 0) + 1;
    }
    if (rows) {
      rows[query] = [...rows[query] ?? [], row];
    }
  }
  recordNVisit(table, query, nvisit) {
    let nvisitCounts = this.#nvisitBySource[table];
    if (!nvisitCounts) {
      nvisitCounts = {};
      this.#nvisitBySource[table] = nvisitCounts;
    }
    if (!nvisitCounts[query]) {
      nvisitCounts[query] = 0;
    }
    nvisitCounts[query] += nvisit;
  }
  #getRowStats(source) {
    let counts;
    let rows;
    counts = this.#rowCountsBySource[source];
    if (!counts) {
      counts = {};
      this.#rowCountsBySource[source] = counts;
    }
    rows = this.#rowsBySource[source];
    if (!rows) {
      rows = {};
      this.#rowsBySource[source] = rows;
    }
    return { counts, rows };
  }
}
export {
  Debug,
  runtimeDebugFlags
};
//# sourceMappingURL=debug-delegate.js.map
