import { getMemoOptions, memo } from '../utils';
export function createCell(table, row, column, columnId) {
    const getRenderValue = () => { var _a; return (_a = cell.getValue()) !== null && _a !== void 0 ? _a : table.options.renderFallbackValue; };
    const cell = {
        id: `${row.id}_${column.id}`,
        row,
        column,
        getValue: () => row.getValue(columnId),
        renderValue: getRenderValue,
        getContext: memo(() => [table, column, row, cell], (t, col, r, c) => ({
            table: t,
            column: col,
            row: r,
            cell: c,
            getValue: c.getValue,
            renderValue: c.renderValue,
        }), getMemoOptions(table.options, 'debugCells', 'cell.getContext')),
    };
    table._features.forEach((feature) => {
        var _a;
        (_a = feature.createCell) === null || _a === void 0 ? void 0 : _a.call(feature, cell, column, row, table);
    }, {});
    return cell;
}
