{
  "version": 3,
  "sources": ["../../src/translations/translations.ts"],
  "sourcesContent": ["import { LANGUAGES } from './languages'\n\n/** @public */\nexport { LANGUAGES }\n\n/** @public */\nexport type TLLanguage = (typeof LANGUAGES)[number]\n// {\n// \treadonly locale: string\n// \treadonly label: string\n// }\n\n/** @public */\nexport function getDefaultTranslationLocale(): TLLanguage['locale'] {\n\tconst locales = typeof window !== 'undefined' ? window.navigator.languages ?? ['en'] : ['en']\n\treturn _getDefaultTranslationLocale(locales)\n}\n\n/** @internal */\nexport function _getDefaultTranslationLocale(locales: readonly string[]): TLLanguage['locale'] {\n\tfor (const locale of locales) {\n\t\tconst supportedLocale = getSupportedLocale(locale)\n\t\tif (supportedLocale) {\n\t\t\treturn supportedLocale\n\t\t}\n\t}\n\treturn 'en'\n}\n\n/** @public */\nconst DEFAULT_LOCALE_REGIONS: { [locale: string]: TLLanguage['locale'] } = {\n\tzh: 'zh-cn',\n\tpt: 'pt-br',\n\tko: 'ko-kr',\n\thi: 'hi-in',\n}\n\n/** @public */\nfunction getSupportedLocale(locale: string): TLLanguage['locale'] | null {\n\t// If we have an exact match, return it!\n\t// (e.g. if the user has 'fr' and we have 'fr')\n\t// (or if the user has 'pt-BR' and we have 'pt-br')\n\tconst exactMatch = LANGUAGES.find((t) => t.locale === locale.toLowerCase())\n\tif (exactMatch) {\n\t\treturn exactMatch.locale\n\t}\n\n\t// Otherwise, we need to be more flexible...\n\tconst [language, region] = locale.split(/[-_]/).map((s) => s.toLowerCase())\n\n\t// If the user's language has a region...\n\t// let's try to find non-region-specific locale for them\n\t// (e.g. if they have 'fr-CA' but we only have 'fr')\n\tif (region) {\n\t\tconst languageMatch = LANGUAGES.find((t) => t.locale === language)\n\t\tif (languageMatch) {\n\t\t\treturn languageMatch.locale\n\t\t}\n\t}\n\n\t// If the user's language doesn't have a region...\n\t// let's try to find a region-specific locale for them\n\t// (e.g. if they have 'pt' but we only have 'pt-pt' or 'pt-br')\n\t//\n\t// In this case, we choose the hard-coded default region for that language\n\tif (language in DEFAULT_LOCALE_REGIONS) {\n\t\treturn DEFAULT_LOCALE_REGIONS[language]\n\t}\n\n\t// Oh no! We don't have a translation for this language!\n\t// Let's give up...\n\treturn null\n}\n"],
  "mappings": "AAAA,SAAS,iBAAiB;AAanB,SAAS,8BAAoD;AACnE,QAAM,UAAU,OAAO,WAAW,cAAc,OAAO,UAAU,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI;AAC5F,SAAO,6BAA6B,OAAO;AAC5C;AAGO,SAAS,6BAA6B,SAAkD;AAC9F,aAAW,UAAU,SAAS;AAC7B,UAAM,kBAAkB,mBAAmB,MAAM;AACjD,QAAI,iBAAiB;AACpB,aAAO;AAAA,IACR;AAAA,EACD;AACA,SAAO;AACR;AAGA,MAAM,yBAAqE;AAAA,EAC1E,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACL;AAGA,SAAS,mBAAmB,QAA6C;AAIxE,QAAM,aAAa,UAAU,KAAK,CAAC,MAAM,EAAE,WAAW,OAAO,YAAY,CAAC;AAC1E,MAAI,YAAY;AACf,WAAO,WAAW;AAAA,EACnB;AAGA,QAAM,CAAC,UAAU,MAAM,IAAI,OAAO,MAAM,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC;AAK1E,MAAI,QAAQ;AACX,UAAM,gBAAgB,UAAU,KAAK,CAAC,MAAM,EAAE,WAAW,QAAQ;AACjE,QAAI,eAAe;AAClB,aAAO,cAAc;AAAA,IACtB;AAAA,EACD;AAOA,MAAI,YAAY,wBAAwB;AACvC,WAAO,uBAAuB,QAAQ;AAAA,EACvC;AAIA,SAAO;AACR;",
  "names": []
}
