import { isEqual } from "@visactor/vutils";

export const themes = {};

function isTableTheme(theme) {
    return !!theme && "function" == typeof theme.getExtendTheme;
}

function getThemeComparableConfig(theme) {
    if (isTableTheme(theme)) {
        const extend = theme.getExtendTheme(), internal = theme.internalTheme, superTheme = null == internal ? void 0 : internal.superTheme;
        return {
            name: theme.name,
            extend: extend,
            superTheme: superTheme ? getThemeComparableConfig(superTheme) : void 0
        };
    }
    return theme;
}

export function tableThemeIsChanged(prevTableTheme, newTableTheme) {
    if (!prevTableTheme && !newTableTheme) return !1;
    if (!prevTableTheme && newTableTheme) return !0;
    if (prevTableTheme && !newTableTheme) return !0;
    if (prevTableTheme === newTableTheme) return !1;
    const next = newTableTheme, prevConfig = getThemeComparableConfig(prevTableTheme), newConfig = getThemeComparableConfig(next);
    return !isEqual(prevConfig, newConfig);
}
//# sourceMappingURL=themes.js.map
