{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,aAAa;;;;;AAaN,SAAS;IACd,IAAI,UAAC,MAAM,EAAC,GAAG,CAAA,GAAA,yCAAQ;IACvB,IAAI,aAAa,CAAA,GAAA,yCAA2B,EAAE,CAAA,GAAA,+CAAW,GAAG;IAC5D,OAAO,CAAA,GAAA,cAAM,EAAE;QACb,+GAA+G;QAC/G,kFAAkF;QAClF,IAAI;YACF,OAAO,IAAI,KAAK,YAAY,CAAC,QAAQ;gBAAC,MAAM;YAAe;QAC7D,EAAE,OAAM;YACN,OAAO,IAAI,2CAAqB,QAAQ;QAC1C;IACF,GAAG;QAAC;QAAQ;KAAW;AACzB;AAEA,MAAM;IAIJ,YAAY,MAAc,EAAE,UAAoD,CAAE;QAChF,IAAI,CAAC,MAAM,GAAG;QACd,IAAI,CAAC,UAAU,GAAG;IACpB;IAEA,GAAG,KAAY,EAAU;QACvB,OAAO,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,OAAO,IAAI,CAAC,MAAM;IAC9D;AACF","sources":["packages/react-aria/src/datepicker/useDisplayNames.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// @ts-ignore\nimport intlMessages from '../../intl/datepicker/*.json';\nimport {LocalizedStringDictionary} from '@internationalized/string';\nimport {useLocale} from '../i18n/I18nProvider';\nimport {useLocalizedStringDictionary} from '../i18n/useLocalizedStringFormatter';\nimport {useMemo} from 'react';\n\ntype Field = Intl.DateTimeFormatPartTypes;\ninterface DisplayNames {\n  of(field: Field): string | undefined\n}\n\n/** @private */\nexport function useDisplayNames(): DisplayNames {\n  let {locale} = useLocale();\n  let dictionary = useLocalizedStringDictionary(intlMessages, '@react-aria/datepicker');\n  return useMemo(() => {\n    // Try to use Intl.DisplayNames if possible. It may be supported in browsers, but not support the dateTimeField\n    // type as that was only added in v2. https://github.com/tc39/intl-displaynames-v2\n    try {\n      return new Intl.DisplayNames(locale, {type: 'dateTimeField'});\n    } catch {\n      return new DisplayNamesPolyfill(locale, dictionary);\n    }\n  }, [locale, dictionary]);\n}\n\nclass DisplayNamesPolyfill implements DisplayNames {\n  private locale: string;\n  private dictionary: LocalizedStringDictionary<Field, string>;\n\n  constructor(locale: string, dictionary: LocalizedStringDictionary<Field, string>) {\n    this.locale = locale;\n    this.dictionary = dictionary;\n  }\n\n  of(field: Field): string {\n    return this.dictionary.getStringForLocale(field, this.locale);\n  }\n}\n"],"names":[],"version":3,"file":"useDisplayNames.mjs.map"}