{"version":3,"sources":["../../../src/interpreter/getIntlayerAsync.ts"],"sourcesContent":["import { fetchDistantDictionary } from '@intlayer/api';\nimport type { LocalesValues } from '@intlayer/config/client';\nimport type { DictionaryKeys } from '../types';\nimport type { Plugins } from './getContent';\nimport { getDictionary } from './getDictionary';\n\n/**\n * On the client side, Hook that picking one dictionary by its key and return the content\n *\n * This hook will prerender the locale dictionary and fetch simultaneously the distant dictionaries to hydrate it.\n *\n *\n * If the locale is not provided, it will use the locale from the client context\n */\nexport const getIntlayerAsync = async <\n  T extends DictionaryKeys,\n  L extends LocalesValues,\n>(\n  key: T,\n  locale?: L,\n  plugins?: Plugins[]\n) => {\n  const jsonDistantDictionary = await fetchDistantDictionary(key as string);\n\n  if (jsonDistantDictionary) {\n    return getDictionary(jsonDistantDictionary, locale, plugins);\n  }\n\n  return null;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAAuC;AAIvC,2BAA8B;AAUvB,MAAM,mBAAmB,OAI9B,KACA,QACA,YACG;AACH,QAAM,wBAAwB,UAAM,mCAAuB,GAAa;AAExE,MAAI,uBAAuB;AACzB,eAAO,oCAAc,uBAAuB,QAAQ,OAAO;AAAA,EAC7D;AAEA,SAAO;AACT;","names":[]}