'use client';


const require_rolldown_runtime = require('../../../../../_virtual/rolldown_runtime.cjs');
const require_IntlayerProvider = require('../IntlayerProvider.cjs');
const require_percentage = require('../../@intlayer/core/dist/esm/formatters/percentage.cjs');
let react = require("react");

//#region ../react-intlayer/dist/esm/client/format/usePercentage.mjs
/**
* React hook to provide a percentage formatter function
* based on the current application locale.
*
* This hook retrieves the active locale using {@link useLocaleBase}
* and memoizes a `createPercentage` instance for that locale.
*
* @example
* ```tsx
* const formatPercentage = usePercentage();
*
* const result = formatPercentage(0.875, { maximumFractionDigits: 1 });
* // "87.5%" (depending on locale)
* ```
*
* @returns {(value: string | number, options?: Omit<PercentageOptions, "value">) => string}
* A function that formats numbers or numeric strings into localized percentages.
*/
const usePercentage = () => {
	const { locale } = (0, react.useContext)(require_IntlayerProvider.IntlayerClientContext);
	return (0, react.useCallback)((...args) => require_percentage.percentage(args[0], {
		...args[1],
		locale: args[1]?.locale ?? locale
	}), [locale]);
};

//#endregion
exports.usePercentage = usePercentage;
//# sourceMappingURL=usePercentage.cjs.map