{"version":3,"file":"useDate.cjs","names":["resolveAmbientLocale","date","presets"],"sources":["../../../../src/server/format/useDate.ts"],"sourcesContent":["import { date, presets } from '@intlayer/core/formatters';\nimport { resolveAmbientLocale } from '../ambientLocale';\n\n/**\n * On the server side, hook returning a `date` 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 *\n * The options argument is either a preset name or an options object, so the\n * preset is resolved before the locale is merged in — spreading the string\n * itself would scatter its characters and drop the preset.\n */\nexport const useDate = () => {\n  const locale = resolveAmbientLocale();\n\n  return (...args: Parameters<typeof date>) =>\n    date(\n      args[0],\n      typeof args[1] === 'string'\n        ? { ...presets[args[1]], locale }\n        : { ...args[1], locale: args[1]?.locale ?? locale }\n    );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,MAAa,gBAAgB;CAC3B,MAAM,SAASA,kDAAqB;CAEpC,QAAQ,GAAG,aACTC,gCACE,KAAK,IACL,OAAO,KAAK,OAAO,WACf;EAAE,GAAGC,kCAAQ,KAAK;EAAK;CAAO,IAC9B;EAAE,GAAG,KAAK;EAAI,QAAQ,KAAK,EAAE,EAAE,UAAU;CAAO,CACtD;AACJ"}