{"version":3,"file":"useLocale.cjs","names":["internationalization","resolveAmbientLocale"],"sources":["../../../src/server/useLocale.ts"],"sourcesContent":["import { internationalization } from '@intlayer/config/built';\nimport type { DeclaredLocales } from '@intlayer/types/module_augmentation';\nimport { resolveAmbientLocale } from './ambientLocale';\n\nexport type UseLocaleResult = {\n  locale: DeclaredLocales;\n  defaultLocale: DeclaredLocales;\n  availableLocales: DeclaredLocales[];\n};\n\nconst { defaultLocale, locales: availableLocales } = internationalization ?? {};\n\n/**\n * On the server side, hook returning the current locale along with the default\n * and available ones.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server`: that one\n * takes no locale argument, so there is no way to hand it the ambient locale —\n * it would read the server context alone and report the default locale on any\n * render the provider did not reach.\n */\nexport const useLocale = (): UseLocaleResult => {\n  const locale = (resolveAmbientLocale() ?? defaultLocale) as DeclaredLocales;\n\n  return { locale, defaultLocale, availableLocales };\n};\n"],"mappings":";;;;;AAUA,MAAM,EAAE,eAAe,SAAS,qBAAqBA,+CAAwB,CAAC;;;;;;;;;;AAW9E,MAAa,kBAAmC;CAG9C,OAAO;EAAE,QAFOC,kDAAqB,KAAK;EAEzB;EAAe;CAAiB;AACnD"}