"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = convertLegacyTranslationsToIntlProps;

var _lodash = require("lodash");

var _useLocalizeConfig = require("../useLocalizeConfig");

function convertLegacyTranslationsToIntlProps(config) {
  var translatedConfig = (0, _lodash.omitBy)(config, _useLocalizeConfig.isLecacyTranslationObject);
  var translate = (0, _lodash.pickBy)(config, _useLocalizeConfig.isLecacyTranslationObject);

  if (Object.keys(translate).length) {
    translatedConfig.intl = translate;
  }

  return (0, _lodash.mapValues)(translatedConfig, function (value, key) {
    return _useLocalizeConfig.translateArrayProperties.includes(key) ? value.map(function (value) {
      return typeof value === 'object' ? convertLegacyTranslationsToIntlProps(value) : value;
    }) : value;
  });
}
//# sourceMappingURL=convertLegacyTranslationsToIntlProps.cjs.map