'use strict';

var index$1 = require('../../../common/locale/index.js');
var index = require('../findCountryByCode/index.js');

/**
 * Default phone code, the UK one `+44`
 */
const DEFAULT_PHONE_CODE = '+44';
/**
 * Given a valid locale it returns the correspondent prefix if found or +44 otherwise.
 *
 * @param locale BCP 47 language tag of locale, e.g. `"es-ES"`.
 * @param countryCode Two-letter country code (ISO 3166-1 alpha-2).
 */
const setDefaultPrefix = (locale, countryCode) => {
  const country = (countryCode != null ? index.findCountryByCode(countryCode) : null) ?? index.findCountryByCode(index$1.getCountryFromLocale(locale) ?? locale);
  return country?.phone ?? DEFAULT_PHONE_CODE;
};

exports.setDefaultPrefix = setDefaultPrefix;
//# sourceMappingURL=index.js.map
