{"version":3,"file":"useUnit.cjs","names":["resolveAmbientLocale","units"],"sources":["../../../../src/server/format/useUnit.ts"],"sourcesContent":["import { units } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `units` formatter bound to the ambient\n * locale: the server context, falling back to the locale carried by the\n * request. A per-call `locale` option still wins.\n *\n * Reimplemented rather than re-exported from `react-intlayer/server/format`:\n * that one takes no locale argument, so there is no way to hand it the ambient\n * locale — it would read the server context alone and format with the default\n * locale on any render the provider did not reach.\n */\nexport const useUnit = () => {\n  const locale = resolveAmbientLocale();\n\n  return (...args: Parameters<typeof units>) =>\n    units(args[0], {\n      ...args[1],\n      locale: args[1]?.locale ?? locale,\n    });\n};\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,iCAAM,KAAK,IAAI;EACb,GAAG,KAAK;EACR,QAAQ,KAAK,EAAE,EAAE,UAAU;CAC7B,CAAC;AACL"}