{"version":3,"file":"Currency.shared.mjs","names":[],"sources":["../../../src/components/variables/Currency.shared.ts"],"sourcesContent":["import { getI18nConfig } from 'gt-i18n/internal';\nimport { getFormatLocales } from '../../hooks/utils/getFormatLocales';\n\n// Pure compute logic shared by the hook-based and RSC implementations. This\n// module must stay free of hook/context imports so it can be reached from the\n// components-rsc entrypoint.\n\ntype CurrencyProps = {\n  children: number | string | null | undefined;\n  currency?: string;\n  options?: Intl.NumberFormatOptions;\n  locales?: string[];\n  name?: string;\n  _locale?: string;\n  _enableI18n?: boolean;\n};\n\ntype ResolvedCurrencyProps = CurrencyProps & {\n  _locale: string;\n  _enableI18n: boolean;\n};\n\nfunction computeCurrency({\n  _enableI18n,\n  _locale,\n  children,\n  currency = 'USD',\n  options = {},\n  locales: localesProp = [],\n}: ResolvedCurrencyProps): string | null {\n  const locales = getFormatLocales({\n    locale: _locale,\n    enableI18n: _enableI18n,\n    localesProp,\n  });\n  const gt = getI18nConfig().getGTClass();\n  if (children == null) return null;\n  const parsedNumber =\n    typeof children === 'string' ? parseFloat(children) : children;\n  return gt.formatCurrency(parsedNumber, currency, {\n    locales,\n    ...options,\n  });\n}\n\nexport { computeCurrency };\nexport type { CurrencyProps, ResolvedCurrencyProps };\n"],"mappings":"2HAsBA,SAAS,EAAgB,CACvB,cACA,UACA,WACA,WAAW,MACX,UAAU,EAAE,CACZ,QAAS,EAAc,EAAE,EACc,CACvC,IAAM,EAAU,EAAiB,CAC/B,OAAQ,EACR,WAAY,EACZ,cACD,CAAC,CACI,EAAK,GAAe,CAAC,YAAY,CACvC,GAAI,GAAY,KAAM,OAAO,KAC7B,IAAM,EACJ,OAAO,GAAa,SAAW,WAAW,EAAS,CAAG,EACxD,OAAO,EAAG,eAAe,EAAc,EAAU,CAC/C,UACA,GAAG,EACJ,CAAC"}