{ "version": 3, "sources": ["../../javascript/warp/utilities/parseJSONData.ts", "../../javascript/warp/context/TranslationContext.tsx"], "sourcesContent": ["const parseJSONData = (dataset: DOMStringMap, attribute: string) => {\n const json = dataset[attribute]\n\n if (json) {\n return JSON.parse(json)\n } else {\n throw new Error(`Failed to parse JSON in dataset attribute ${attribute}`)\n }\n}\n\nexport default parseJSONData\n", "import React, { useContext } from \"react\"\n\ntype Translations = { [key: string]: string }\n\nconst TranslationContext = React.createContext({})\n\nconst TranslationProvider = TranslationContext.Provider\nconst TranslationConsumer = TranslationContext.Consumer\n\n/* I wouldn't normally name something a single letter variable, but this\n * matches the I18N.t helper.\n */\nconst T: React.FC<{ tKey: string }> = ({ tKey }) => (\n \n {(translations) => translations[tKey]}\n \n)\n\nfunction useTranslation() {\n return useContext(TranslationContext)\n}\n\nexport {\n TranslationContext as default,\n TranslationProvider,\n TranslationConsumer,\n Translations,\n useTranslation,\n T\n}\n"], "mappings": "kHAAA,IAAMA,EAAgB,CAACC,EAAuBC,IAAsB,CAClE,IAAMC,EAAOF,EAAQC,GAErB,GAAIC,EACF,OAAO,KAAK,MAAMA,CAAI,EAEtB,MAAM,IAAI,MAAM,6CAA6CD,GAAW,CAE5E,EAEOE,EAAQJ,ECVf,IAAAK,EAAkC,SAI5BC,EAAqB,EAAAC,QAAM,cAA4B,CAAC,CAAC,EAEzDC,EAAsBF,EAAmB,SACzCG,EAAsBH,EAAmB,SAW/C,SAASI,GAAiB,CACxB,SAAO,cAAWC,CAAkB,CACtC", "names": ["parseJSONData", "dataset", "attribute", "json", "parseJSONData_default", "import_react", "TranslationContext", "React", "TranslationProvider", "TranslationConsumer", "useTranslation", "TranslationContext"] }