{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nimport $iFADg$react, { useContext as $iFADg$useContext, useState as $iFADg$useState, useEffect as $iFADg$useEffect, useMemo as $iFADg$useMemo, useCallback as $iFADg$useCallback } from \"react\";\nimport { useIsSSR as $iFADg$useIsSSR } from \"@react-aria/ssr\";\nimport { LocalizedStringDictionary as $iFADg$LocalizedStringDictionary, LocalizedStringFormatter as $iFADg$LocalizedStringFormatter } from \"@internationalized/string\";\nimport { DateFormatter as $iFADg$DateFormatter } from \"@internationalized/date\";\nimport { useDeepMemo as $iFADg$useDeepMemo } from \"@react-aria/utils\";\nimport { NumberFormatter as $iFADg$NumberFormatter } from \"@internationalized/number\";\nvar $148a7a147e38ea7f$var$RTL_SCRIPTS = new Set([\"Arab\", \"Syrc\", \"Samr\", \"Mand\", \"Thaa\", \"Mend\", \"Nkoo\", \"Adlm\", \"Rohg\", \"Hebr\"]);\nvar $148a7a147e38ea7f$var$RTL_LANGS = new Set([\"ae\", \"ar\", \"arc\", \"bcc\", \"bqi\", \"ckb\", \"dv\", \"fa\", \"glk\", \"he\", \"ku\", \"mzn\", \"nqo\", \"pnb\", \"ps\", \"sd\", \"ug\", \"ur\", \"yi\"]);\nfunction $148a7a147e38ea7f$export$702d680b21cbd764(locale) {\n  if (Intl.Locale) {\n    var script = new Intl.Locale(locale).maximize().script;\n    return $148a7a147e38ea7f$var$RTL_SCRIPTS.has(script);\n  }\n  var lang = locale.split(\"-\")[0];\n  return $148a7a147e38ea7f$var$RTL_LANGS.has(lang);\n}\nfunction $1e5a04cdaf7d1af8$export$f09106e7c6677ec5() {\n  var locale = typeof navigator !== \"undefined\" && (navigator.language || navigator.userLanguage) || \"en-US\";\n  try {\n    Intl.DateTimeFormat.supportedLocalesOf([locale]);\n  } catch (_err) {\n    locale = \"en-US\";\n  }\n  return {\n    locale: locale,\n    direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? \"rtl\" : \"ltr\"\n  };\n}\nvar $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();\nvar $1e5a04cdaf7d1af8$var$listeners = new Set();\nfunction $1e5a04cdaf7d1af8$var$updateLocale() {\n  $1e5a04cdaf7d1af8$var$currentLocale = $1e5a04cdaf7d1af8$export$f09106e7c6677ec5();\n  for (var listener of $1e5a04cdaf7d1af8$var$listeners) listener($1e5a04cdaf7d1af8$var$currentLocale);\n}\nfunction $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a() {\n  var isSSR = (0, $iFADg$useIsSSR)();\n  var _ref = (0, $iFADg$useState)($1e5a04cdaf7d1af8$var$currentLocale),\n    _ref2 = _slicedToArray(_ref, 2),\n    defaultLocale = _ref2[0],\n    setDefaultLocale = _ref2[1];\n  (0, $iFADg$useEffect)(function () {\n    if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.addEventListener(\"languagechange\", $1e5a04cdaf7d1af8$var$updateLocale);\n    $1e5a04cdaf7d1af8$var$listeners.add(setDefaultLocale);\n    return function () {\n      $1e5a04cdaf7d1af8$var$listeners.delete(setDefaultLocale);\n      if ($1e5a04cdaf7d1af8$var$listeners.size === 0) window.removeEventListener(\"languagechange\", $1e5a04cdaf7d1af8$var$updateLocale);\n    };\n  }, []);\n  if (isSSR) return {\n    locale: \"en-US\",\n    direction: \"ltr\"\n  };\n  return defaultLocale;\n}\nvar $18f2051aff69b9bf$var$I18nContext = (0, $iFADg$react).createContext(null);\nfunction $18f2051aff69b9bf$export$a54013f0d02a8f82(props) {\n  var locale = props.locale,\n    children = props.children;\n  var defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();\n  var value = locale ? {\n    locale: locale,\n    direction: (0, $148a7a147e38ea7f$export$702d680b21cbd764)(locale) ? \"rtl\" : \"ltr\"\n  } : defaultLocale;\n  return (0, $iFADg$react).createElement($18f2051aff69b9bf$var$I18nContext.Provider, {\n    value: value\n  }, children);\n}\nfunction $18f2051aff69b9bf$export$43bb16f9c6d9e3f7() {\n  var defaultLocale = (0, $1e5a04cdaf7d1af8$export$188ec29ebc2bdc3a)();\n  var context = (0, $iFADg$useContext)($18f2051aff69b9bf$var$I18nContext);\n  return context || defaultLocale;\n}\nvar $2aa2084a6c2b6b4f$exports = {};\n\"use strict\";\nvar $fca6afa0e843324b$var$cache = new WeakMap();\nfunction $fca6afa0e843324b$var$getCachedDictionary(strings) {\n  var dictionary = $fca6afa0e843324b$var$cache.get(strings);\n  if (!dictionary) {\n    dictionary = new (0, $iFADg$LocalizedStringDictionary)(strings);\n    $fca6afa0e843324b$var$cache.set(strings, dictionary);\n  }\n  return dictionary;\n}\nfunction $fca6afa0e843324b$export$f12b703ca79dfbb1(strings) {\n  var _ref3 = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)(),\n    locale = _ref3.locale;\n  var dictionary = (0, $iFADg$useMemo)(function () {\n    return $fca6afa0e843324b$var$getCachedDictionary(strings);\n  }, [strings]);\n  return (0, $iFADg$useMemo)(function () {\n    return new (0, $iFADg$LocalizedStringFormatter)(locale, dictionary);\n  }, [locale, dictionary]);\n}\nfunction $33bf17300c498528$export$a2f47a3d2973640() {\n  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n  var _ref4 = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)(),\n    locale = _ref4.locale;\n  return (0, $iFADg$useMemo)(function () {\n    return new Intl.ListFormat(locale, options);\n  }, [locale, options]);\n}\nfunction $896ba0a80a8f4d36$export$85fd5fdf27bacc79(options) {\n  options = (0, $iFADg$useDeepMemo)(options, $896ba0a80a8f4d36$var$isEqual);\n  var _ref5 = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)(),\n    locale = _ref5.locale;\n  return (0, $iFADg$useMemo)(function () {\n    return new (0, $iFADg$DateFormatter)(locale, options);\n  }, [locale, options]);\n}\nfunction $896ba0a80a8f4d36$var$isEqual(a, b) {\n  if (a === b) return true;\n  var aKeys = Object.keys(a);\n  var bKeys = Object.keys(b);\n  if (aKeys.length !== bKeys.length) return false;\n  for (var key of aKeys) {\n    if (b[key] !== a[key]) return false;\n  }\n  return true;\n}\nfunction $a916eb452884faea$export$b7a616150fdb9f44() {\n  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n  var _ref6 = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)(),\n    locale = _ref6.locale;\n  return (0, $iFADg$useMemo)(function () {\n    return new (0, $iFADg$NumberFormatter)(locale, options);\n  }, [locale, options]);\n}\nvar $325a3faab7a68acd$var$cache = new Map();\nfunction $325a3faab7a68acd$export$a16aca283550c30d(options) {\n  var _ref7 = (0, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7)(),\n    locale = _ref7.locale;\n  var cacheKey = locale + (options ? Object.entries(options).sort(function (a, b) {\n    return a[0] < b[0] ? -1 : 1;\n  }).join() : \"\");\n  if ($325a3faab7a68acd$var$cache.has(cacheKey)) return $325a3faab7a68acd$var$cache.get(cacheKey);\n  var formatter = new Intl.Collator(locale, options);\n  $325a3faab7a68acd$var$cache.set(cacheKey, formatter);\n  return formatter;\n}\nfunction $bb77f239b46e8c72$export$3274cf84b703fff(options) {\n  var collator = (0, $325a3faab7a68acd$export$a16aca283550c30d)(_objectSpread({\n    usage: \"search\"\n  }, options));\n  var startsWith = (0, $iFADg$useCallback)(function (string, substring) {\n    if (substring.length === 0) return true;\n    string = string.normalize(\"NFC\");\n    substring = substring.normalize(\"NFC\");\n    return collator.compare(string.slice(0, substring.length), substring) === 0;\n  }, [collator]);\n  var endsWith = (0, $iFADg$useCallback)(function (string, substring) {\n    if (substring.length === 0) return true;\n    string = string.normalize(\"NFC\");\n    substring = substring.normalize(\"NFC\");\n    return collator.compare(string.slice(-substring.length), substring) === 0;\n  }, [collator]);\n  var contains = (0, $iFADg$useCallback)(function (string, substring) {\n    if (substring.length === 0) return true;\n    string = string.normalize(\"NFC\");\n    substring = substring.normalize(\"NFC\");\n    var scan = 0;\n    var sliceLen = substring.length;\n    for (; scan + sliceLen <= string.length; scan++) {\n      var slice = string.slice(scan, scan + sliceLen);\n      if (collator.compare(substring, slice) === 0) return true;\n    }\n    return false;\n  }, [collator]);\n  return (0, $iFADg$useMemo)(function () {\n    return {\n      startsWith: startsWith,\n      endsWith: endsWith,\n      contains: contains\n    };\n  }, [startsWith, endsWith, contains]);\n}\nexport { $18f2051aff69b9bf$export$a54013f0d02a8f82 as I18nProvider, $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 as useLocale, $fca6afa0e843324b$export$f12b703ca79dfbb1 as useLocalizedStringFormatter, $33bf17300c498528$export$a2f47a3d2973640 as useListFormatter, $896ba0a80a8f4d36$export$85fd5fdf27bacc79 as useDateFormatter, $a916eb452884faea$export$b7a616150fdb9f44 as useNumberFormatter, $325a3faab7a68acd$export$a16aca283550c30d as useCollator, $bb77f239b46e8c72$export$3274cf84b703fff as useFilter };","map":{"version":3,"sources":["packages/@react-aria/i18n/src/context.tsx","packages/@react-aria/i18n/src/utils.ts","packages/@react-aria/i18n/src/useDefaultLocale.ts","node_modules/@parcel/node-resolver-core/lib/_empty.js","packages/@react-aria/i18n/src/useLocalizedStringFormatter.ts","packages/@react-aria/i18n/src/useListFormatter.tsx","packages/@react-aria/i18n/src/useDateFormatter.ts","packages/@react-aria/i18n/src/useNumberFormatter.ts","packages/@react-aria/i18n/src/useCollator.ts","packages/@react-aria/i18n/src/useFilter.ts"],"names":[],"mappings":";;;;;;;;;;ACaA,IAAM,iCAAA,GAAc,IAAI,GAAA,CAAI,CAAC,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,MAAA,EAAQ,MAAA,CAAO,CAAA;AAC5G,IAAM,+BAAA,GAAY,IAAI,GAAA,CAAI,CAAC,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,IAAA,EAAM,IAAA,EAAM,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,IAAA,CAAK,CAAA;AAK7I,SAAS,yCAAA,CAAM,MAAc,EAAA;EAIlC,IAAI,IAAA,CAAK,MAAA,EAAQ;IAEf,IAAI,MAAA,GAAS,IAAI,IAAA,CAAK,MAAA,CAAO,MAAA,CAAA,CAAQ,QAAA,CAAA,CAAA,CAAW,MAAA;IAChD,OAAO,iCAAA,CAAY,GAAA,CAAI,MAAA,CAAA;EACzB;EAGA,IAAI,IAAA,GAAO,MAAA,CAAO,KAAA,CAAM,GAAA,CAAI,CAAC,CAAA,CAAE;EAC/B,OAAO,+BAAA,CAAU,GAAA,CAAI,IAAA,CAAA;AACvB;ACLO,SAAS,yCAAA,CAAA,EAAA;EAEd,IAAI,MAAA,GAAU,OAAO,SAAA,KAAc,WAAA,KAAgB,SAAA,CAAU,QAAA,IAAY,SAAA,CAAU,YAAW,CAAA,IAAO,OAAA;EACrG,IAAI;IAEF,IAAA,CAAK,cAAA,CAAe,kBAAA,CAAmB,CAAC,MAAA,CAAO,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AA,CAAU,MAAA,KAAW,CAAA,EACvB,OAAO,IAAA;IAGT,MAAA,GAAS,MAAA,CAAO,SAAA,CAAU,KAAA,CAAA;IAC1B,SAAA,GAAY,SAAA,CAAU,SAAA,CAAU,KAAA,CAAA;IAEhC,IAAI,IAAA,GAAO,CAAA;IACX,IAAI,QAAA,GAAW,SAAA,CAAU,MAAA;IACzB,OAAO,IAAA,GAAO,QAAA,IAAY,MAAA,CAAO,MAAA,EAAQ,IAAA,EAAA,EAAQ;MAC/C,IAAI,KAAA,GAAQ,MAAA,CAAO,KAAA,CAAM,IAAA,EAAM,IAAA,GAAO,QAAA,CAAA;MACtC,IAAI,QAAA,CAAS,OAAA,CAAQ,SAAA,EAAW,KAAA,CAAA,KAAW,CAAA,EACzC,OAAO,IAAA;IAEX;IAEA,OAAO,KAAA;EACT,CAAA,EAAG,CAAC,QAAA,CAAS,CAAA;EAEb,OAAO,CAAA,CAAA,EAAA,cAAM,EAAE;IAAA,OAAO;kBACpB,UAAA;gBACA,QAAA;gBACA;IACF,CAAA;EAAA,CAAA,EAAI,CAAC,UAAA,EAAY,QAAA,EAAU,QAAA,CAAS,CAAA;AACtC","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\nimport {isRTL} from './utils';\nimport {Locale, useDefaultLocale} from './useDefaultLocale';\nimport React, {ReactNode, useContext} from 'react';\n\nexport interface I18nProviderProps {\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: I18nProviderProps) {\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\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","/*\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  try {\n    // @ts-ignore\n    Intl.DateTimeFormat.supportedLocalesOf([locale]);\n  } catch (_err) {\n    locale = 'en-US';\n  }\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","\"use strict\";","/*\n * Copyright 2022 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 {LocalizedString, LocalizedStringDictionary, LocalizedStringFormatter, LocalizedStrings} from '@internationalized/string';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\nconst cache = new WeakMap();\nfunction getCachedDictionary<K extends string, T extends LocalizedString>(strings: LocalizedStrings<K, T>): LocalizedStringDictionary<K, T> {\n  let dictionary = cache.get(strings);\n  if (!dictionary) {\n    dictionary = new LocalizedStringDictionary(strings);\n    cache.set(strings, dictionary);\n  }\n\n  return dictionary;\n}\n\n/**\n * Provides localized string formatting for the current locale. Supports interpolating variables,\n * selecting the correct pluralization, and formatting numbers. Automatically updates when the locale changes.\n * @param strings - A mapping of languages to localized strings by key.\n */\nexport function useLocalizedStringFormatter<K extends string = string, T extends LocalizedString = string>(strings: LocalizedStrings<K, T>): LocalizedStringFormatter<K, T> {\n  let {locale} = useLocale();\n  let dictionary = useMemo(() => getCachedDictionary(strings), [strings]);\n  return useMemo(() => new LocalizedStringFormatter(locale, dictionary), [locale, dictionary]);\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';\nimport {useMemo} from 'react';\n\n/**\n * Provides localized list formatting for the current locale. Automatically updates when the locale changes,\n * and handles caching of the list formatter for performance.\n * @param options - Formatting options.\n */\n\n// Typescript version 4.7 supports Intl.ListFormat - TODO upgrade\n// @ts-ignore\nexport function useListFormatter(options: Intl.ListFormatOptions = {}): Intl.ListFormat {\n  let {locale} = useLocale();\n  // @ts-ignore\n  return useMemo(() => new Intl.ListFormat(locale, options), [locale, options]);\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 {DateFormatter} from '@internationalized/date';\nimport {useDeepMemo} from '@react-aria/utils';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\n\nexport interface DateFormatterOptions extends Intl.DateTimeFormatOptions {\n  calendar?: string\n}\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?: DateFormatterOptions): DateFormatter {\n  // Reuse last options object if it is shallowly equal, which allows the useMemo result to also be reused.\n  options = useDeepMemo(options, isEqual);\n  let {locale} = useLocale();\n  return useMemo(() => new DateFormatter(locale, options), [locale, options]);\n}\n\nfunction isEqual(a: DateFormatterOptions, b: DateFormatterOptions) {\n  if (a === b) {\n    return true;\n  }\n\n  let aKeys = Object.keys(a);\n  let bKeys = Object.keys(b);\n  if (aKeys.length !== bKeys.length) {\n    return false;\n  }\n\n  for (let key of aKeys) {\n    if (b[key] !== a[key]) {\n      return false;\n    }\n  }\n\n  return true;\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 {NumberFormatOptions, NumberFormatter} from '@internationalized/number';\nimport {useLocale} from './context';\nimport {useMemo} from 'react';\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: NumberFormatOptions = {}): Intl.NumberFormat {\n  let {locale} = useLocale();\n  return useMemo(() => new NumberFormatter(locale, options), [locale, options]);\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 {useCallback, useMemo} from 'react';\nimport {useCollator} from './useCollator';\n\nexport interface 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  let startsWith = useCallback((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  }, [collator]);\n\n  let endsWith = useCallback((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  }, [collator]);\n\n  let contains = useCallback((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  }, [collator]);\n\n  return useMemo(() => ({\n    startsWith,\n    endsWith,\n    contains\n  }), [startsWith, endsWith, contains]);\n}\n"]},"metadata":{},"sourceType":"module"}