{"version":3,"sources":["../../../../src/server/format/useNumber.ts"],"sourcesContent":["import { type LocalesValues } from '@intlayer/config/client';\nimport { number } from '@intlayer/core';\nimport { IntlayerServerContext } from '../IntlayerServerProvider';\nimport { getServerContext } from '../serverContext';\n\n/**\n * React client hook that provides a localized number formatter.\n *\n * Uses the current locale from {@link useLocaleBase} and returns\n * a function that can be used to format numbers consistently\n * according to the user's locale.\n *\n * @example\n * ```tsx\n * const formatNumber = useNumber();\n *\n * formatNumber(12345);\n * // e.g. \"12,345\" (en-US)\n * // e.g. \"12 345\" (fr-FR)\n *\n * formatNumber(0.75, { style: \"percent\" });\n * // e.g. \"75%\"\n * ```\n *\n * @returns {(value: string | number, options?: import(\"../createNumber\").NumberProps) => string}\n * A number formatting function bound to the active locale.\n */\nexport const useNumber = () => {\n  const locale = getServerContext<LocalesValues>(IntlayerServerContext);\n\n  return (...args: Parameters<typeof number>) =>\n    number(args[0], {\n      ...args[1],\n      locale: args[1]?.locale ?? locale,\n    });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAuB;AACvB,oCAAsC;AACtC,2BAAiC;AAwB1B,MAAM,YAAY,MAAM;AAC7B,QAAM,aAAS,uCAAgC,mDAAqB;AAEpE,SAAO,IAAI,aACT,oBAAO,KAAK,CAAC,GAAG;AAAA,IACd,GAAG,KAAK,CAAC;AAAA,IACT,QAAQ,KAAK,CAAC,GAAG,UAAU;AAAA,EAC7B,CAAC;AACL;","names":[]}