/**
 * Deep merge two objects.
 * @param target
 * @param ...sources
 * @param source
 * @param fallback
 */
export function umbDeepMerge(source, fallback) {
    const result = { ...fallback };
    for (const key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key) && source[key] !== undefined) {
            if (source[key]?.constructor === Object && fallback[key]?.constructor === Object) {
                result[key] = umbDeepMerge(source[key], fallback[key]);
            }
            else {
                result[key] = source[key];
            }
        }
    }
    return result;
}
