import {} from "../../../zero-protocol/src/data.js";
export const runtimeDebugFlags = {
    trackRowCountsVended: false,
    trackRowsVended: false,
};
export class Debug {
    #rowCountsBySource;
    #rowsBySource;
    constructor() {
        this.#rowCountsBySource = {};
        this.#rowsBySource = {};
    }
    getVendedRowCounts() {
        return this.#rowCountsBySource;
    }
    getVendedRows() {
        return this.#rowsBySource;
    }
    initQuery(table, query) {
        const { counts } = this.#getRowStats(table);
        if (counts) {
            if (!counts[query]) {
                counts[query] = 0;
            }
        }
    }
    reset() {
        this.#rowCountsBySource = {};
        this.#rowsBySource = {};
    }
    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];
        }
    }
    #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 };
    }
}
//# sourceMappingURL=debug-delegate.js.map