"use strict";
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable no-nested-ternary */
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
Object.defineProperty(exports, "__esModule", { value: true });
exports.mergeExisting = void 0;
const tslib_1 = require("tslib");
const isObject_1 = tslib_1.__importDefault(require("lodash/isObject"));
const transform_1 = tslib_1.__importDefault(require("lodash/transform"));
const mergeExisting = (left, right) => (0, transform_1.default)(left, (acc, value, key) => {
    if (key in right) {
        if ((0, isObject_1.default)(value) && (0, isObject_1.default)(right[key])) {
            acc[key] = (0, exports.mergeExisting)(value, right[key]);
        }
        else {
            acc[key] = right[key];
        }
    }
    else {
        acc[key] = value;
    }
}, left);
exports.mergeExisting = mergeExisting;
//# sourceMappingURL=merge.js.map