{"version":3,"file":"resolveChartLocale.cjs","names":["FALLBACK_LOCALE","resolveChartLocale","languageCode","Intl","getCanonicalLocales","replaceAll","exports"],"sources":["../../../../src/charts/utils/resolveChartLocale.ts"],"sourcesContent":["/*!\n * Copyright (c) 2026-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nconst FALLBACK_LOCALE = \"en-US\";\n\n/**\n * The function converts a language code from the Odyssey translation context to a BCP 47 locale tag. `Intl` constructors accept this tag.\n *\n * Okta's translation codes use an underscore to separate the region subtag, for example `pt_BR`, `zh_CN`, and `nl_NL`. Every `Intl` constructor rejects these codes with a `RangeError`. The Applitools test environment reports the code `en-us@posix`. This code has no BCP 47 equivalent. As a result, six of the codes in `SupportedLanguages` crash an unguarded `Intl` call.\n *\n * If a code has no valid equivalent, the function returns `en-US` instead of raising an error. A chart with the wrong thousands separator is still better than a chart that fails to render.\n */\nexport const resolveChartLocale = (languageCode: string): string => {\n  try {\n    return (\n      Intl.getCanonicalLocales(languageCode.replaceAll(\"_\", \"-\"))[0] ??\n      FALLBACK_LOCALE\n    );\n  } catch {\n    return FALLBACK_LOCALE;\n  }\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,eAAe,GAAG,OAAO;AASxB,MAAMC,kBAAkB,GAAIC,YAAoB,IAAa;EAClE,IAAI;IACF,OACEC,IAAI,CAACC,mBAAmB,CAACF,YAAY,CAACG,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAC9DL,eAAe;EAEnB,CAAC,CAAC,MAAM;IACN,OAAOA,eAAe;EACxB;AACF,CAAC;AAACM,OAAA,CAAAL,kBAAA,GAAAA,kBAAA","ignoreList":[]}