import { getColumnsMap } from '../getColumnsMap';
export const mergeColumnsOptions = (columns, childrenColumns) => {
    if (!childrenColumns) {
        return columns;
    }
    const childrenColumnsMap = getColumnsMap(childrenColumns);
    if (!Object.keys(childrenColumnsMap).length) {
        return columns;
    }
    return columns.map((column) => {
        if (!column.hasOwnProperty('field')) {
            return column;
        }
        return {
            ...column,
            // biome-ignore lint/suspicious/noTsIgnore: <>
            // @ts-ignore
            ...(childrenColumnsMap[column.field] || {}),
        };
    });
};
