"use strict";
/* Socket Lib - Built with rolldown */
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });

//#region src/words/pluralize.ts
const CLDR_TO_FIELD = {
	one: "singular",
	other: "plural",
	zero: "zero",
	two: "two",
	few: "few",
	many: "many"
};
const RULES_CACHE = /* @__PURE__ */ new Map();
function getRules(locale, type) {
	const key = `${locale}:${type}`;
	let r = RULES_CACHE.get(key);
	if (!r) {
		r = new Intl.PluralRules(locale, { type });
		RULES_CACHE.set(key, r);
	}
	return r;
}
/**
* Pluralize a word based on count.
*
* @example
*   ;```typescript
*   pluralize('file') // 'file'
*   pluralize('file', { count: 3 }) // 'files'
*   pluralize('file', { count: 0 }) // 'files'
*
*   // Dictionary mode for irregulars.
*   pluralize('child', {
*   count: 3,
*   forms: { singular: 'child', plural: 'children' },
*   }) // 'children'
*
*   // Locale + cardinal/ordinal. `singular` here covers CLDR's `one`
*   // category (the count===1 ordinal suffix); `two`/`few` map directly;
*   // `plural` is the fallback for everything else.
*   pluralize('place', {
*   count: 2,
*   type: 'ordinal',
*   forms: { singular: 'st', two: 'nd', few: 'rd', plural: 'th' },
*   }) // 'nd'
*   ```
*/
/*@__NO_SIDE_EFFECTS__*/
function pluralize(word, options) {
	const { count = 1, forms, locale = "en-US", type = "cardinal" } = {
		__proto__: null,
		...options
	};
	if (forms) return forms[CLDR_TO_FIELD[getRules(locale, type).select(count)]] ?? forms.plural;
	return count === 1 ? word : `${word}s`;
}

//#endregion
exports.getRules = getRules;
exports.pluralize = pluralize;