"use strict";

exports.__esModule = true;
exports.mappedCountries = exports.localizedCountry = void 0;
var _locale = require("./locale");
var _localizationHelper = require("../utils/localizationHelper");
var _reselect = require("reselect");
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var countriesData = function countriesData(state) {
  return state.get("countries");
};
var mappedCountries = exports.mappedCountries = (0, _reselect.createSelector)(countriesData, function (data) {
  var countries = data.toJS();
  return Object.keys(countries).map(function (key) {
    return countries[key];
  });
});
var localizedCountry = exports.localizedCountry = function localizedCountry(countryCode) {
  return (0, _reselect.createSelector)(countriesData, _locale.currentLocaleOrDefault, function (countries, locale) {
    var countryName = countries.getIn([countryCode, "name"]);
    var displayName = countryName ? countryName.toJS() : null;
    var country = (0, _localizationHelper.getLocalization)(displayName, locale, countryCode);
    return country;
  });
};
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(countriesData, "countriesData", "/home/vsts/work/1/s/src/selectors/countries.js");
  reactHotLoader.register(mappedCountries, "mappedCountries", "/home/vsts/work/1/s/src/selectors/countries.js");
  reactHotLoader.register(localizedCountry, "localizedCountry", "/home/vsts/work/1/s/src/selectors/countries.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(countriesData, "countriesData", "/home/vsts/work/1/s/src/selectors/countries.js");
  reactHotLoader.register(mappedCountries, "mappedCountries", "/home/vsts/work/1/s/src/selectors/countries.js");
  reactHotLoader.register(localizedCountry, "localizedCountry", "/home/vsts/work/1/s/src/selectors/countries.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();