{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } it = o[Symbol.iterator](); return it.next.bind(it); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nimport _babelRuntimeHelpersEsmExtends from \"@babel/runtime/helpers/esm/extends\";\nimport _intlMessageformat from \"intl-messageformat\";\nimport { useIsSSR } from \"@react-aria/ssr\";\nimport _react, { useEffect, useState, useContext, useCallback, useRef } from \"react\";\nvar $d26e725ad56fbcb2c25f52b7de27$var$RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);\nvar $d26e725ad56fbcb2c25f52b7de27$var$RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\nfunction $d26e725ad56fbcb2c25f52b7de27$export$isRTL(locale) {\n  if (Intl.Locale) {\n    var script = new Intl.Locale(locale).maximize().script;\n    return $d26e725ad56fbcb2c25f52b7de27$var$RTL_SCRIPTS.has(script);\n  }\n\n  var lang = locale.split('-')[0];\n  return $d26e725ad56fbcb2c25f52b7de27$var$RTL_LANGS.has(lang);\n}\n\nfunction $d26e725ad56fbcb2c25f52b7de27$export$numberFormatSignDisplayPolyfill(numberFormat, signDisplay, num) {\n  if (signDisplay === 'auto') {\n    return numberFormat.format(num);\n  } else if (signDisplay === 'never') {\n    return numberFormat.format(Math.abs(num));\n  } else {\n    var needsPositiveSign = false;\n\n    if (signDisplay === 'always') {\n      needsPositiveSign = num > 0 || Object.is(num, 0);\n    } else if (signDisplay === 'exceptZero') {\n      if (Object.is(num, -0) || Object.is(num, 0)) {\n        num = Math.abs(num);\n      } else {\n        needsPositiveSign = num > 0;\n      }\n    }\n\n    if (needsPositiveSign) {\n      var negative = numberFormat.format(-num);\n      var noSign = numberFormat.format(num);\n      var minus = negative.replace(noSign, '').replace(/\\u200e|\\u061C/, '');\n\n      if (_toConsumableArray(minus).length !== 1) {\n        console.warn('@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case');\n      }\n\n      var positive = negative.replace(noSign, '!!!').replace(minus, '+').replace('!!!', noSign);\n      return positive;\n    } else {\n      return numberFormat.format(num);\n    }\n  }\n}\n\nfunction $e851d0b81d46abd5f971c8e95c27f1$export$getDefaultLocale() {\n  var locale = typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';\n  return {\n    locale: locale,\n    direction: $d26e725ad56fbcb2c25f52b7de27$export$isRTL(locale) ? 'rtl' : 'ltr'\n  };\n}\n\nvar $e851d0b81d46abd5f971c8e95c27f1$var$currentLocale = $e851d0b81d46abd5f971c8e95c27f1$export$getDefaultLocale();\nvar $e851d0b81d46abd5f971c8e95c27f1$var$listeners = new Set();\n\nfunction $e851d0b81d46abd5f971c8e95c27f1$var$updateLocale() {\n  $e851d0b81d46abd5f971c8e95c27f1$var$currentLocale = $e851d0b81d46abd5f971c8e95c27f1$export$getDefaultLocale();\n\n  for (var _iterator = _createForOfIteratorHelperLoose($e851d0b81d46abd5f971c8e95c27f1$var$listeners), _step; !(_step = _iterator()).done;) {\n    var listener = _step.value;\n    listener($e851d0b81d46abd5f971c8e95c27f1$var$currentLocale);\n  }\n}\n\nfunction $e851d0b81d46abd5f971c8e95c27f1$export$useDefaultLocale() {\n  var isSSR = useIsSSR();\n\n  var _useState = useState($e851d0b81d46abd5f971c8e95c27f1$var$currentLocale),\n      _useState2 = _slicedToArray(_useState, 2),\n      defaultLocale = _useState2[0],\n      setDefaultLocale = _useState2[1];\n\n  useEffect(function () {\n    if ($e851d0b81d46abd5f971c8e95c27f1$var$listeners.size === 0) {\n      window.addEventListener('languagechange', $e851d0b81d46abd5f971c8e95c27f1$var$updateLocale);\n    }\n\n    $e851d0b81d46abd5f971c8e95c27f1$var$listeners.add(setDefaultLocale);\n    return function () {\n      $e851d0b81d46abd5f971c8e95c27f1$var$listeners.delete(setDefaultLocale);\n\n      if ($e851d0b81d46abd5f971c8e95c27f1$var$listeners.size === 0) {\n        window.removeEventListener('languagechange', $e851d0b81d46abd5f971c8e95c27f1$var$updateLocale);\n      }\n    };\n  }, []);\n\n  if (isSSR) {\n    return {\n      locale: 'en-US',\n      direction: 'ltr'\n    };\n  }\n\n  return defaultLocale;\n}\n\nvar $cff8541df3b5c83067b2ab3ee0d20$var$I18nContext = _react.createContext(null);\n\nexport function I18nProvider(props) {\n  var locale = props.locale,\n      children = props.children;\n  var defaultLocale = $e851d0b81d46abd5f971c8e95c27f1$export$useDefaultLocale();\n  var value = locale ? {\n    locale: locale,\n    direction: $d26e725ad56fbcb2c25f52b7de27$export$isRTL(locale) ? 'rtl' : 'ltr'\n  } : defaultLocale;\n  return _react.createElement($cff8541df3b5c83067b2ab3ee0d20$var$I18nContext.Provider, {\n    value: value\n  }, children);\n}\nexport function useLocale() {\n  var defaultLocale = $e851d0b81d46abd5f971c8e95c27f1$export$useDefaultLocale();\n  var context = useContext($cff8541df3b5c83067b2ab3ee0d20$var$I18nContext);\n  return context || defaultLocale;\n}\nvar $f58d206cee90f9c2bf3c03e4522c35$var$formatterCache = new Map();\nexport function useMessageFormatter(strings) {\n  var _useLocale = useLocale(),\n      currentLocale = _useLocale.locale;\n\n  var localeCache = $f58d206cee90f9c2bf3c03e4522c35$var$formatterCache.get(strings);\n\n  if (localeCache && localeCache.has(currentLocale)) {\n    return localeCache.get(currentLocale);\n  }\n\n  if (!localeCache) {\n    localeCache = new Map();\n    $f58d206cee90f9c2bf3c03e4522c35$var$formatterCache.set(strings, localeCache);\n  }\n\n  var localeStrings = $f58d206cee90f9c2bf3c03e4522c35$var$selectLocale(strings, currentLocale);\n  var cache = {};\n\n  var formatMessage = function formatMessage(key, variables) {\n    var message = cache[key + '.' + currentLocale];\n\n    if (!message) {\n      var msg = localeStrings[key];\n\n      if (!msg) {\n        throw new Error(\"Could not find intl message \" + key + \" in \" + currentLocale + \" locale\");\n      }\n\n      message = new _intlMessageformat(msg, currentLocale);\n      cache[key] = message;\n    }\n\n    return message.format(variables);\n  };\n\n  localeCache.set(currentLocale, formatMessage);\n  return formatMessage;\n}\n\nfunction $f58d206cee90f9c2bf3c03e4522c35$var$selectLocale(strings, locale) {\n  if (strings[locale]) {\n    return strings[locale];\n  }\n\n  var language = $f58d206cee90f9c2bf3c03e4522c35$var$getLanguage(locale);\n\n  for (var key in strings) {\n    if (key.startsWith(language + '-')) {\n      return strings[key];\n    }\n  }\n\n  return strings['en-US'];\n}\n\nfunction $f58d206cee90f9c2bf3c03e4522c35$var$getLanguage(locale) {\n  if (Intl.Locale) {\n    return new Intl.Locale(locale).language;\n  }\n\n  return locale.split('-')[0];\n}\n\nvar $b0007c63a64054c318efb8b6cd0053f$var$formatterCache = new Map();\nexport function useDateFormatter(options) {\n  var _useLocale2 = useLocale(),\n      locale = _useLocale2.locale;\n\n  var cacheKey = locale + (options ? Object.entries(options).sort(function (a, b) {\n    return a[0] < b[0] ? -1 : 1;\n  }).join() : '');\n\n  if ($b0007c63a64054c318efb8b6cd0053f$var$formatterCache.has(cacheKey)) {\n    return $b0007c63a64054c318efb8b6cd0053f$var$formatterCache.get(cacheKey);\n  }\n\n  var formatter = new Intl.DateTimeFormat(locale, options);\n  $b0007c63a64054c318efb8b6cd0053f$var$formatterCache.set(cacheKey, formatter);\n  return formatter;\n}\nexport function useNumberParser() {\n  var _useLocale3 = useLocale(),\n      locale = _useLocale3.locale;\n\n  var numberData = useRef({\n    group: null,\n    decimal: null,\n    numeral: null,\n    index: null\n  });\n  useEffect(function () {\n    var parts = new Intl.NumberFormat(locale).formatToParts(12345.6);\n\n    var numerals = _toConsumableArray(new Intl.NumberFormat(locale, {\n      useGrouping: false\n    }).format(9876543210)).reverse();\n\n    var index = new Map(numerals.map(function (d, i) {\n      return [d, i];\n    }));\n    numberData.current.group = new RegExp(\"[\" + parts.find(function (d) {\n      return d.type === 'group';\n    }).value + \"]\", 'g');\n    numberData.current.decimal = new RegExp(\"[\" + parts.find(function (d) {\n      return d.type === 'decimal';\n    }).value + \"]\");\n    numberData.current.numeral = new RegExp(\"[\" + numerals.join('') + \"]\", 'g');\n\n    numberData.current.index = function (d) {\n      return index.get(d);\n    };\n  }, [locale]);\n  var parse = useCallback(function (value) {\n    value = value.trim().replace(numberData.current.group, '').replace(numberData.current.decimal, '.').replace(numberData.current.numeral, numberData.current.index);\n    return value ? +value : NaN;\n  }, []);\n  return {\n    parse: parse\n  };\n}\nvar $ece3e138e83d330f42860705a2ec18a$var$formatterCache = new Map();\nvar $ece3e138e83d330f42860705a2ec18a$var$supportsSignDisplay = false;\n\ntry {\n  $ece3e138e83d330f42860705a2ec18a$var$supportsSignDisplay = new Intl.NumberFormat('de-DE', {\n    signDisplay: 'exceptZero'\n  }).resolvedOptions().signDisplay === 'exceptZero';\n} catch (e) {}\n\nexport function useNumberFormatter(options) {\n  var _useLocale4 = useLocale(),\n      locale = _useLocale4.locale;\n\n  var cacheKey = locale + (options ? Object.entries(options).sort(function (a, b) {\n    return a[0] < b[0] ? -1 : 1;\n  }).join() : '');\n\n  if ($ece3e138e83d330f42860705a2ec18a$var$formatterCache.has(cacheKey)) {\n    return $ece3e138e83d330f42860705a2ec18a$var$formatterCache.get(cacheKey);\n  }\n\n  var numberFormatter = new Intl.NumberFormat(locale, options);\n\n  var _ref = options || {},\n      signDisplay = _ref.signDisplay;\n\n  $ece3e138e83d330f42860705a2ec18a$var$formatterCache.set(cacheKey, !$ece3e138e83d330f42860705a2ec18a$var$supportsSignDisplay && signDisplay != null ? new Proxy(numberFormatter, {\n    get: function get(target, property) {\n      if (property === 'format') {\n        return function (v) {\n          return $d26e725ad56fbcb2c25f52b7de27$export$numberFormatSignDisplayPolyfill(numberFormatter, signDisplay, v);\n        };\n      } else {\n        return target[property];\n      }\n    }\n  }) : numberFormatter);\n  return numberFormatter;\n}\nvar $a4045a18d7252bf6de9312e613c4e$var$cache = new Map();\nexport function useCollator(options) {\n  var _useLocale5 = useLocale(),\n      locale = _useLocale5.locale;\n\n  var cacheKey = locale + (options ? Object.entries(options).sort(function (a, b) {\n    return a[0] < b[0] ? -1 : 1;\n  }).join() : '');\n\n  if ($a4045a18d7252bf6de9312e613c4e$var$cache.has(cacheKey)) {\n    return $a4045a18d7252bf6de9312e613c4e$var$cache.get(cacheKey);\n  }\n\n  var formatter = new Intl.Collator(locale, options);\n  $a4045a18d7252bf6de9312e613c4e$var$cache.set(cacheKey, formatter);\n  return formatter;\n}\nexport function useFilter(options) {\n  var collator = useCollator(_babelRuntimeHelpersEsmExtends({\n    usage: 'search'\n  }, options));\n  return {\n    startsWith: function startsWith(string, substring) {\n      if (substring.length === 0) {\n        return true;\n      }\n\n      string = string.normalize('NFC');\n      substring = substring.normalize('NFC');\n      return collator.compare(string.slice(0, substring.length), substring) === 0;\n    },\n    endsWith: function endsWith(string, substring) {\n      if (substring.length === 0) {\n        return true;\n      }\n\n      string = string.normalize('NFC');\n      substring = substring.normalize('NFC');\n      return collator.compare(string.slice(-substring.length), substring) === 0;\n    },\n    contains: function contains(string, substring) {\n      if (substring.length === 0) {\n        return true;\n      }\n\n      string = string.normalize('NFC');\n      substring = substring.normalize('NFC');\n      var scan = 0;\n      var sliceLen = substring.length;\n\n      for (; scan + sliceLen <= string.length; scan++) {\n        var slice = string.slice(scan, scan + sliceLen);\n\n        if (collator.compare(substring, slice) === 0) {\n          return true;\n        }\n      }\n\n      return false;\n    }\n  };\n}","map":{"version":3,"sources":["packages/@react-aria/i18n/src/utils.ts","packages/@react-aria/i18n/src/useDefaultLocale.ts","packages/@react-aria/i18n/src/context.tsx","packages/@react-aria/i18n/src/useMessageFormatter.ts","packages/@react-aria/i18n/src/useDateFormatter.ts","packages/@react-aria/i18n/src/useNumberParser.ts","packages/@react-aria/i18n/src/useNumberFormatter.ts","packages/@react-aria/i18n/src/useCollator.ts","packages/@react-aria/i18n/src/useFilter.ts"],"names":["RTL_SCRIPTS","RTL_LANGS","Intl","script","lang","locale","signDisplay","numberFormat","Math","needsPositiveSign","num","Object","negative","noSign","minus","console","positive","navigator","direction","currentLocale","getDefaultLocale","listeners","listener","isSSR","useIsSSR","useState","useEffect","window","I18nContext","React","children","defaultLocale","value","context","useContext","formatterCache","localeCache","localeStrings","selectLocale","cache","formatMessage","message","key","msg","strings","language","getLanguage","cacheKey","options","a","b","formatter","numberData","useRef","group","decimal","numeral","index","parts","numerals","useGrouping","d","parse","useCallback","supportsSignDisplay","numberFormatter","get","property","v","target","collator","usage","startsWith","substring","string","endsWith","contains","scan","sliceLen","slice"],"mappings":";;;;;;;;;;;;;AAaA,IAAMA,6CAAW,GAAG,IAAA,GAAA,CAAQ,CAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAA5B,MAA4B,CAAR,CAApB;AACA,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IAAI,GAAJA,QAAAA,IAAmBH,MAAM,CAAhC,MAAA,EAAyCG,IAAzC,EAAA,EAAiD;AAC/C,YAAIE,KAAK,GAAGL,MAAM,CAANA,KAAAA,CAAAA,IAAAA,EAAmBG,IAAI,GAAnC,QAAYH,CAAZ;;AACA,YAAIJ,QAAQ,CAARA,OAAAA,CAAAA,SAAAA,EAAAA,KAAAA,MAAJ,CAAA,EAA8C;AAC5C,iBAAA,IAAA;AACD;AACF;;AAED,aAAA,KAAA;AACD;AAvCI,GAAP;AAyCD","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// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);\nconst RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\n/**\n * Determines if a locale is read right to left using [Intl.Locale]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale}.\n */\nexport function isRTL(locale: string) {\n  // If the Intl.Locale API is available, use it to get the script for the locale.\n  // This is more accurate than guessing by language, since languages can be written in multiple scripts.\n  // @ts-ignore\n  if (Intl.Locale) {\n    // @ts-ignore\n    let script = new Intl.Locale(locale).maximize().script;\n    return RTL_SCRIPTS.has(script);\n  }\n\n  // If not, just guess by the language (first part of the locale)\n  let lang = locale.split('-')[0];\n  return RTL_LANGS.has(lang);\n}\n\nexport function numberFormatSignDisplayPolyfill(numberFormat: Intl.NumberFormat, signDisplay: 'always' | 'exceptZero' | 'auto' | 'never', num: number) {\n  if (signDisplay === 'auto') {\n    return numberFormat.format(num);\n  } else if (signDisplay === 'never') {\n    return numberFormat.format(Math.abs(num));\n  } else {\n    let needsPositiveSign = false;\n    if (signDisplay === 'always') {\n      needsPositiveSign = num > 0 || Object.is(num, 0);\n    } else if (signDisplay === 'exceptZero') {\n      if (Object.is(num, -0) || Object.is(num, 0)) {\n        num = Math.abs(num);\n      } else {\n        needsPositiveSign = num > 0;\n      }\n    }\n\n    if (needsPositiveSign) {\n      let negative = numberFormat.format(-num);\n      let noSign = numberFormat.format(num);\n      // ignore RTL/LTR marker character\n      let minus = negative.replace(noSign, '').replace(/\\u200e|\\u061C/, '');\n      if ([...minus].length !== 1) {\n        console.warn('@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case');\n      }\n      let positive = negative.replace(noSign, '!!!').replace(minus, '+').replace('!!!', noSign);\n      return positive;\n    } else {\n      return numberFormat.format(num);\n    }\n  }\n}\n","/*\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\nimport {Direction} from '@react-types/shared';\nimport {isRTL} from './utils';\nimport {useEffect, useState} from 'react';\nimport {useIsSSR} from '@react-aria/ssr';\n\nexport interface Locale {\n  /** The [BCP47](https://www.ietf.org/rfc/bcp/bcp47.txt) language code for the locale. */\n  locale: string,\n  /** The writing direction for the locale. */\n  direction: Direction\n}\n\n/**\n * Gets the locale setting of the browser.\n */\nexport function getDefaultLocale(): Locale {\n  // @ts-ignore\n  let locale = (typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage)) || 'en-US';\n  return {\n    locale,\n    direction: isRTL(locale) ? 'rtl' : 'ltr'\n  };\n}\n\nlet currentLocale = getDefaultLocale();\nlet listeners = new Set<(locale: Locale) => void>();\n\nfunction updateLocale() {\n  currentLocale = getDefaultLocale();\n  for (let listener of listeners) {\n    listener(currentLocale);\n  }\n}\n\n/**\n * Returns the current browser/system language, and updates when it changes.\n */\nexport function useDefaultLocale(): Locale {\n  let isSSR = useIsSSR();\n  let [defaultLocale, setDefaultLocale] = useState(currentLocale);\n\n  useEffect(() => {\n    if (listeners.size === 0) {\n      window.addEventListener('languagechange', updateLocale);\n    }\n\n    listeners.add(setDefaultLocale);\n\n    return () => {\n      listeners.delete(setDefaultLocale);\n      if (listeners.size === 0) {\n        window.removeEventListener('languagechange', updateLocale);\n      }\n    };\n  }, []);\n\n  // We cannot determine the browser's language on the server, so default to\n  // en-US. This will be updated after hydration on the client to the correct value.\n  if (isSSR) {\n    return {\n      locale: 'en-US',\n      direction: 'ltr'\n    };\n  }\n\n  return defaultLocale;\n}\n","/*\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\nimport {isRTL} from './utils';\nimport {Locale, useDefaultLocale} from './useDefaultLocale';\nimport React, {ReactNode, useContext} from 'react';\n\ninterface ProviderProps {\n  /** Contents that should have the locale applied. */\n  children: ReactNode,\n  /** The locale to apply to the children. */\n  locale?: string\n}\n\nconst I18nContext = React.createContext<Locale>(null);\n\n/**\n * Provides the locale for the application to all child components.\n */\nexport function I18nProvider(props: ProviderProps) {\n  let {locale, children} = props;\n  let defaultLocale = useDefaultLocale();\n\n  let value: Locale = locale ? {\n    locale,\n    direction: isRTL(locale) ? 'rtl' : 'ltr'\n  } : defaultLocale;\n\n  return (\n    <I18nContext.Provider value={value}>\n      {children}\n    </I18nContext.Provider>\n  );\n}\n\n/**\n * Returns the current locale and layout direction.\n */\nexport function useLocale(): Locale {\n  let defaultLocale = useDefaultLocale();\n  let context = useContext(I18nContext);\n  return context || defaultLocale;\n}\n","/*\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\nimport IntlMessageFormat from 'intl-messageformat';\nimport {useLocale} from './context';\n\ntype MessageFormatterStrings = {\n  [lang: string]: {\n    [key: string]: string\n  }\n};\n\ntype FormatMessage = (key: string, variables?: {[key: string]: any}) => string;\n\nconst formatterCache = new Map();\n\n/**\n * Handles formatting ICU Message strings to create localized strings for the current locale.\n * Automatically updates when the locale changes, and handles caching of messages for performance.\n * @param strings - A mapping of languages to strings by key.\n */\nexport function useMessageFormatter(strings: MessageFormatterStrings): FormatMessage {\n  let {locale: currentLocale} = useLocale();\n\n  // Check the cache\n  let localeCache = formatterCache.get(strings);\n  if (localeCache && localeCache.has(currentLocale)) {\n    return localeCache.get(currentLocale);\n  }\n\n  // Add to the formatter cache if needed\n  if (!localeCache) {\n    localeCache = new Map();\n    formatterCache.set(strings, localeCache);\n  }\n\n  // Get the strings for the current locale\n  let localeStrings = selectLocale(strings, currentLocale);\n\n  // Create a new message formatter\n  let cache = {};\n  let formatMessage = (key, variables) => {\n    let message = cache[key + '.' + currentLocale];\n    if (!message) {\n      let msg = localeStrings[key];\n      if (!msg) {\n        throw new Error(`Could not find intl message ${key} in ${currentLocale} locale`);\n      }\n\n      message = new IntlMessageFormat(msg, currentLocale);\n      cache[key] = message;\n    }\n\n    return message.format(variables);\n  };\n\n  localeCache.set(currentLocale, formatMessage);\n  return formatMessage;\n}\n\nfunction selectLocale(strings, locale) {\n  // If there is an exact match, use it.\n  if (strings[locale]) {\n    return strings[locale];\n  }\n\n  // Attempt to find the closest match by language.\n  // For example, if the locale is fr-CA (French Canadian), but there is only\n  // an fr-FR (France) set of strings, use that.\n  let language = getLanguage(locale);\n  for (let key in strings) {\n    if (key.startsWith(language + '-')) {\n      return strings[key];\n    }\n  }\n\n  // Nothing close, use english.\n  return strings['en-US'];\n}\n\nfunction getLanguage(locale) {\n  // @ts-ignore\n  if (Intl.Locale) {\n    // @ts-ignore\n    return new Intl.Locale(locale).language;\n  }\n\n  return locale.split('-')[0];\n}\n","/*\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\nimport {useLocale} from './context';\n\nlet formatterCache = new Map<string, Intl.DateTimeFormat>();\n\n/**\n * Provides localized date formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the date formatter for performance.\n * @param options - Formatting options.\n */\nexport function useDateFormatter(options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat {\n  let {locale} = useLocale();\n\n  let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n  if (formatterCache.has(cacheKey)) {\n    return formatterCache.get(cacheKey);\n  }\n\n  let formatter = new Intl.DateTimeFormat(locale, options);\n  formatterCache.set(cacheKey, formatter);\n  return formatter;\n}\n","/*\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\nimport {useCallback, useEffect, useRef} from 'react';\nimport {useLocale} from './context';\n\ntype NumberParser = {\n  parse: (value:string) => number\n}\n\n/**\n * Provides localized number parsing for the current locale.\n * Idea from https://observablehq.com/@mbostock/localized-number-parsing.\n */\nexport function useNumberParser(): NumberParser {\n  let {locale} = useLocale();\n  const numberData = useRef({group: null, decimal: null, numeral: null, index: null});\n\n  useEffect(() => {\n    const parts = new Intl.NumberFormat(locale).formatToParts(12345.6);\n    const numerals = [...new Intl.NumberFormat(locale, {useGrouping: false}).format(9876543210)].reverse();\n    const index = new Map(numerals.map((d, i) => [d, i]));\n    \n    numberData.current.group = new RegExp(`[${parts.find(d => d.type === 'group').value}]`, 'g');\n    numberData.current.decimal = new RegExp(`[${parts.find(d => d.type === 'decimal').value}]`);\n    numberData.current.numeral = new RegExp(`[${numerals.join('')}]`, 'g');\n    numberData.current.index = d => index.get(d);\n  },  [locale]);\n\n  const parse = useCallback((value:string) => {\n    value = value.trim()\n      .replace(numberData.current.group, '')\n      .replace(numberData.current.decimal, '.')\n      .replace(numberData.current.numeral, numberData.current.index);\n    return value ? +value : NaN;\n  }, []);\n\n  return  {parse};\n}\n","/*\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\nimport {numberFormatSignDisplayPolyfill} from './utils';\nimport {useLocale} from './context';\n\nlet formatterCache = new Map<string, Intl.NumberFormat>();\n\nlet supportsSignDisplay = false;\ntry {\n  // @ts-ignore\n  supportsSignDisplay = (new Intl.NumberFormat('de-DE', {signDisplay: 'exceptZero'})).resolvedOptions().signDisplay === 'exceptZero';\n  // eslint-disable-next-line no-empty\n} catch (e) {}\n\n/**\n * Provides localized number formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the number formatter for performance.\n * @param options - Formatting options.\n */\nexport function useNumberFormatter(options?: Intl.NumberFormatOptions): Intl.NumberFormat {\n  let {locale} = useLocale();\n\n  let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n  if (formatterCache.has(cacheKey)) {\n    return formatterCache.get(cacheKey);\n  }\n\n  let numberFormatter = new Intl.NumberFormat(locale, options);\n  // @ts-ignore\n  let {signDisplay} = options || {};\n  formatterCache.set(cacheKey, (!supportsSignDisplay && signDisplay != null) ? new Proxy(numberFormatter, {\n    get(target, property) {\n      if (property === 'format') {\n        return (v) => numberFormatSignDisplayPolyfill(numberFormatter, signDisplay, v);\n      } else {\n        return target[property];\n      }\n    }\n  }) : numberFormatter);\n  return numberFormatter;\n}\n","/*\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\nimport {useLocale} from './context';\n\nlet cache = new Map<string, Intl.Collator>();\n\n/**\n * Provides localized string collation for the current locale. Automatically updates when the locale changes,\n * and handles caching of the collator for performance.\n * @param options - Collator options.\n */\nexport function useCollator(options?: Intl.CollatorOptions): Intl.Collator {\n  let {locale} = useLocale();\n\n  let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : '');\n  if (cache.has(cacheKey)) {\n    return cache.get(cacheKey);\n  }\n\n  let formatter = new Intl.Collator(locale, options);\n  cache.set(cacheKey, formatter);\n  return formatter;\n}\n","/*\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\nimport {useCollator} from './useCollator';\n\ninterface Filter {\n  /** Returns whether a string starts with a given substring. */\n  startsWith(string: string, substring: string): boolean,\n  /** Returns whether a string ends with a given substring. */\n  endsWith(string: string, substring: string): boolean,\n  /** Returns whether a string contains a given substring. */\n  contains(string: string, substring: string): boolean\n}\n\n/**\n * Provides localized string search functionality that is useful for filtering or matching items\n * in a list. Options can be provided to adjust the sensitivity to case, diacritics, and other parameters.\n */\nexport function useFilter(options?: Intl.CollatorOptions): Filter {\n  let collator = useCollator({\n    usage: 'search',\n    ...options\n  });\n\n  // TODO(later): these methods don't currently support the ignorePunctuation option.\n\n  return {\n    startsWith(string, substring) {\n      if (substring.length === 0) {\n        return true;\n      }\n\n      // Normalize both strings so we can slice safely\n      // TODO: take into account the ignorePunctuation option as well...\n      string = string.normalize('NFC');\n      substring = substring.normalize('NFC');\n      return collator.compare(string.slice(0, substring.length), substring) === 0;\n    },\n    endsWith(string, substring) {\n      if (substring.length === 0) {\n        return true;\n      }\n\n      string = string.normalize('NFC');\n      substring = substring.normalize('NFC');\n      return collator.compare(string.slice(-substring.length), substring) === 0;\n    },\n    contains(string, substring) {\n      if (substring.length === 0) {\n        return true;\n      }\n\n      string = string.normalize('NFC');\n      substring = substring.normalize('NFC');\n\n      let scan = 0;\n      let sliceLen = substring.length;\n      for (; scan + sliceLen <= string.length; scan++) {\n        let slice = string.slice(scan, scan + sliceLen);\n        if (collator.compare(substring, slice) === 0) {\n          return true;\n        }\n      }\n\n      return false;\n    }\n  };\n}\n"]},"metadata":{},"sourceType":"module"}