{"version":3,"file":"index.mjs","sources":["../../../../src/phoneNumberInput/utils/setDefaultPrefix/index.ts"],"sourcesContent":["import { getCountryFromLocale } from '../../../common/locale';\nimport { findCountryByCode } from '../findCountryByCode';\n\n/**\n * Default phone code, the UK one `+44`\n */\nconst DEFAULT_PHONE_CODE = '+44';\n\n/**\n * Given a valid locale it returns the correspondent prefix if found or +44 otherwise.\n *\n * @param locale BCP 47 language tag of locale, e.g. `\"es-ES\"`.\n * @param countryCode Two-letter country code (ISO 3166-1 alpha-2).\n */\nexport const setDefaultPrefix = (locale: string, countryCode?: string) => {\n  const country =\n    (countryCode != null ? findCountryByCode(countryCode) : null) ??\n    findCountryByCode(getCountryFromLocale(locale) ?? locale);\n  return country?.phone ?? DEFAULT_PHONE_CODE;\n};\n"],"names":["DEFAULT_PHONE_CODE","setDefaultPrefix","locale","countryCode","country","findCountryByCode","getCountryFromLocale","phone"],"mappings":";;;AAGA;;AAEG;AACH,MAAMA,kBAAkB,GAAG,KAAK;AAEhC;;;;;AAKG;MACUC,gBAAgB,GAAGA,CAACC,MAAc,EAAEC,WAAoB,KAAI;EACvE,MAAMC,OAAO,GACX,CAACD,WAAW,IAAI,IAAI,GAAGE,iBAAiB,CAACF,WAAW,CAAC,GAAG,IAAI,KAC5DE,iBAAiB,CAACC,oBAAoB,CAACJ,MAAM,CAAC,IAAIA,MAAM,CAAC;AAC3D,EAAA,OAAOE,OAAO,EAAEG,KAAK,IAAIP,kBAAkB;AAC7C;;;;"}