"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.txTagSafeTranslation = void 0;
exports.txTagSafeTranslation = ({ data, langs, }) => {
    const tempObj = Object.assign({}, data);
    const convertIfNeeded = (targetObj) => {
        Object.keys(targetObj).forEach((key) => {
            let newKey;
            if (key.includes('.')) {
                newKey = key.replace(/\./g, '_');
                targetObj[newKey] = targetObj[key];
                delete targetObj[key];
            }
            const targetKey = newKey || key;
            if (typeof targetObj[targetKey] === 'object' &&
                targetObj[targetKey] !== null) {
                targetObj[targetKey] = convertIfNeeded(targetObj[targetKey]);
            }
        });
        return targetObj;
    };
    langs.forEach((lang) => {
        tempObj[lang] = convertIfNeeded(Object.assign({}, data[lang]));
    });
    return tempObj;
};
//# sourceMappingURL=txTagSafeTranslation.js.map