/**
 * 主题合并：支持 ConfigProvider 嵌套时的就近覆盖
 *
 * 优先级：parent < child（child 中非 undefined 的字段覆盖 parent）
 */
/**
 * 合并两层 ThemeConfig，child 优先于 parent
 */
export function mergeTheme(parent, child) {
    var _a, _b, _c, _d, _e, _f;
    if (!parent && !child)
        return {};
    if (!parent)
        return child;
    if (!child)
        return parent;
    return {
        token: { ...parent.token, ...child.token },
        components: {
            agent: { ...(_a = parent.components) === null || _a === void 0 ? void 0 : _a.agent, ...(_b = child.components) === null || _b === void 0 ? void 0 : _b.agent },
            filter: { ...(_c = parent.components) === null || _c === void 0 ? void 0 : _c.filter, ...(_d = child.components) === null || _d === void 0 ? void 0 : _d.filter },
            table: { ...(_e = parent.components) === null || _e === void 0 ? void 0 : _e.table, ...(_f = child.components) === null || _f === void 0 ? void 0 : _f.table },
        },
    };
}
