{"version":3,"file":"parseEnableI18n.mjs","names":[],"sources":["../../src/pages-dir/parseEnableI18n.ts"],"sourcesContent":["import { getI18nConfig } from '@generaltranslation/react-core/pure';\nimport type { GetServerSidePropsContext, PreviewData } from 'next';\nimport type { ParsedUrlQuery } from 'querystring';\n\n/**\n * Resolve the user's enableI18n state from a Next Pages Router server-side request.\n */\nexport function parseEnableI18n<\n  Params extends ParsedUrlQuery = ParsedUrlQuery,\n  Preview extends PreviewData = PreviewData,\n>(context: GetServerSidePropsContext<Params, Preview>): boolean {\n  const cookieEnableI18n =\n    context.req.cookies?.[getI18nConfig().getEnableI18nCookieName()];\n  if (cookieEnableI18n === undefined) return true;\n  return cookieEnableI18n === 'true';\n}\n"],"mappings":";;;;;AAOA,SAAgB,gBAGd,SAA8D;CAC9D,MAAM,mBACJ,QAAQ,IAAI,UAAU,eAAe,CAAC,yBAAyB;AACjE,KAAI,qBAAqB,KAAA,EAAW,QAAO;AAC3C,QAAO,qBAAqB"}