{"version":3,"sources":["../../../src/interpreter/getIntlayer.ts"],"sourcesContent":["import type { LocalesValues } from '@intlayer/config';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\n// @ts-ignore intlayer declared for module augmentation\nimport type { IntlayerDictionaryTypesConnector } from 'intlayer';\nimport type { Dictionary, DictionaryKeys } from '../types';\nimport type { DeepTransformContent, Plugins } from './getContent/plugins';\nimport { getDictionary } from './getDictionary';\n\nexport const getIntlayer = <T extends DictionaryKeys, L extends LocalesValues>(\n  key: T,\n  locale?: L,\n  plugins?: Plugins[]\n) => {\n  const dictionary = dictionaries[key as T];\n\n  if (!dictionary) {\n    throw new Error(`Dictionary ${key as string} not found`, dictionaries);\n  }\n\n  return getDictionary(\n    dictionary as Dictionary,\n    locale,\n    plugins\n  ) as any as DeepTransformContent<\n    IntlayerDictionaryTypesConnector[T]['content']\n  >;\n};\n"],"mappings":"AAMA,OAAO,kBAAkB;AAKzB,SAAS,qBAAqB;AAEvB,MAAM,cAAc,CACzB,KACA,QACA,YACG;AACH,QAAM,aAAa,aAAa,GAAQ;AAExC,MAAI,CAAC,YAAY;AACf,UAAM,IAAI,MAAM,cAAc,GAAa,cAAc,YAAY;AAAA,EACvE;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAGF;","names":[]}