"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PAGE_TABLE_SCOPE = void 0;
exports.blockTableScope = blockTableScope;
exports.resolveTableRoots = resolveTableRoots;
exports.PAGE_TABLE_SCOPE = { kind: 'page' };
function blockTableScope(tableLabel) {
    return { kind: 'block', tableLabel };
}
/**
 * Основная data-grid таблица на странице
 * На страницах с одним гридом — единственная `role="table"`
 */
function resolvePageGridTable(page) {
    return page.getByRole('table');
}
/**
 * Возвращает корни для поиска строк и заголовков колонок в зависимости от scope.
 */
function resolveTableRoots(page, scope) {
    if (scope.kind === 'block') {
        const container = page.getByLabel(scope.tableLabel);
        return {
            rowsRoot: container,
            structureRoot: container,
            tableLabel: scope.tableLabel,
        };
    }
    const gridTable = resolvePageGridTable(page);
    return {
        rowsRoot: gridTable,
        structureRoot: gridTable,
        tableLabel: 'таблица',
    };
}
