{"version":3,"file":"Tx.rsc.cjs","names":["renderPreparedT","prepareT","getReactI18nCache"],"sources":["../../../src/components/translation/Tx.rsc.tsx"],"sourcesContent":["import { getI18nConfig } from 'gt-i18n/internal';\nimport type { ReactNode } from 'react';\nimport { getReactI18nCache } from '../../i18n-cache/singleton-operations';\nimport { renderPreparedT } from '../../utils/rendering/renderPipeline.rsc';\nimport {\n  prepareT,\n  type ResolvedTProps,\n} from '../../utils/translation/prepareT.shared';\n\n// RSC implementation: request conditions are passed explicitly instead of\n// being read from hooks. This module must stay free of hook/context imports\n// so it can be exported from the components-rsc entrypoint.\n\nasync function RscTx({\n  children: sourceChildren,\n  _locale,\n  _enableI18n,\n  // TODO: don't expose to consumer, this should be thru an internal path\n  _renderPreparedT = renderPreparedT,\n  ...params\n}: ResolvedTProps): Promise<ReactNode> {\n  const locale = _locale;\n  const enableI18n = _enableI18n;\n  const defaultLocale = getI18nConfig().getDefaultLocale();\n  const shouldTranslate =\n    enableI18n && getI18nConfig().requiresTranslation(locale);\n  const prepared = prepareT({\n    sourceChildren,\n    params,\n    locale,\n  });\n\n  if (!shouldTranslate) {\n    return _renderPreparedT({\n      ...prepared,\n      targetJsxChildren: undefined,\n      locale,\n      defaultLocale,\n      enableI18n,\n      shouldTranslate,\n      hash: prepared.targetOptions.$_hash,\n    });\n  }\n\n  const i18nCache = getReactI18nCache();\n  const targetJsxChildren = await i18nCache.lookupTranslationWithFallback(\n    locale,\n    prepared.sourceJsxChildren,\n    prepared.targetOptions\n  );\n\n  return _renderPreparedT({\n    ...prepared,\n    targetJsxChildren,\n    locale,\n    defaultLocale,\n    enableI18n,\n    shouldTranslate,\n    hash: prepared.targetOptions.$_hash,\n  });\n}\n\n/** @internal _gtt - The GT transformation for the component. */\nRscTx._gtt = 'translate-runtime';\n\n// ===== Exports ===== //\n\nexport { RscTx };\n"],"mappings":"kQAaA,eAAe,EAAM,CACnB,SAAU,EACV,UACA,cAEA,mBAAmBA,EAAAA,gBACnB,GAAG,GACkC,CACrC,IAAM,EAAS,EACT,EAAa,EACb,GAAA,EAAA,EAAA,gBAA+B,CAAC,kBAAkB,CAClD,EACJ,IAAA,EAAA,EAAA,gBAA6B,CAAC,oBAAoB,EAAO,CACrD,EAAWC,EAAAA,SAAS,CACxB,iBACA,SACA,SACD,CAAC,CAEF,GAAI,CAAC,EACH,OAAO,EAAiB,CACtB,GAAG,EACH,kBAAmB,IAAA,GACnB,SACA,gBACA,aACA,kBACA,KAAM,EAAS,cAAc,OAC9B,CAAC,CAIJ,IAAM,EAAoB,MADRC,EAAAA,mBACuB,CAAC,8BACxC,EACA,EAAS,kBACT,EAAS,cACV,CAED,OAAO,EAAiB,CACtB,GAAG,EACH,oBACA,SACA,gBACA,aACA,kBACA,KAAM,EAAS,cAAc,OAC9B,CAAC,CAIJ,EAAM,KAAO"}