UNPKG

@formatjs/intl-pluralrules

Version:

Polyfill for Intl.PluralRules

5,106 lines • 131 kB
// packages/ecma262-abstract/HasOwnProperty.js
const hasOwn$1 = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
function HasOwnProperty(o, prop) {
	return hasOwn$1(o, prop);
}
// packages/ecma262-abstract/intrinsics.js
const floor = Math.floor;
const numberFrom = Number;
const bigIntFrom = BigInt;
const objectFrom = Object;
const objectCreate = Object.create;
function createFromConstructor(newTarget, defaultPrototype) {
	const prototype = newTarget.prototype;
	return objectCreate(objectFrom(prototype) === prototype ? prototype : defaultPrototype);
}
const mathMin$1 = Math.min;
const mathMax = Math.max;
const numberIsInteger = Number.isInteger;
const numberIsFinite = Number.isFinite;
Number.isSafeInteger;
const ErrorConstructor$1 = Error;
const TypeErrorConstructor$2 = TypeError;
const RangeErrorConstructor = RangeError;
const arrayApply = Reflect.apply;
Array.prototype.every;
const some$1 = Array.prototype.some;
function arraySome(values, predicate) {
	return arrayApply(some$1, values, [predicate]);
}
const includes$2 = Array.prototype.includes;
Array.prototype.indexOf;
function arrayIncludes$1(values, search) {
	return arrayApply(includes$2, values, [search]);
}
const defineProperty$3 = Object.defineProperty;
function setDataProperty$1(target, key, value) {
	defineProperty$3(target, key, {
		__proto__: null,
		value,
		writable: true,
		enumerable: true,
		configurable: true
	});
}
// packages/ecma402-abstract/CanonicalizeLocaleList.js
let canonicalIntl$1 = globalThis.Intl;
const canonicalDescriptor = Object.getOwnPropertyDescriptor;
const canonicalApply = Reflect.apply;
const providerKey$1 = Symbol.for("@formatjs/intlCanonicalizeLocaleList");
function ownCanonicalProvider() {
	const descriptor = canonicalIntl$1 && canonicalDescriptor(canonicalIntl$1, "getCanonicalLocales");
	return (descriptor && canonicalDescriptor(descriptor, "value"))?.value;
}
let canonicalProvider = ownCanonicalProvider();
function registeredCanonicalProvider() {
	try {
		const descriptor = canonicalIntl$1 && canonicalDescriptor(canonicalIntl$1, providerKey$1);
		return descriptor && canonicalDescriptor(descriptor, "value")?.value;
	} catch {}
}
function CanonicalizeLocaleList$1(locales) {
	if (canonicalIntl$1 === void 0) canonicalIntl$1 = globalThis.Intl;
	const registered = registeredCanonicalProvider();
	if (typeof registered === "function") return canonicalApply(registered, canonicalIntl$1, [locales]);
	if (typeof canonicalProvider !== "function") canonicalProvider = ownCanonicalProvider();
	return canonicalApply(canonicalProvider, canonicalIntl$1, [locales]);
}
// packages/ecma402-abstract/Locale/splitUnicodeExtension.js
const apply$10 = Reflect.apply;
const split$2 = String.prototype.split;
const hyphen$1 = {
	__proto__: null,
	toString: () => "-"
};
function splitLocaleSubtags$1(value) {
	return apply$10(split$2, value, [hyphen$1]);
}
function splitUnicodeExtension$1(locale) {
	const subtags = splitLocaleSubtags$1(locale);
	for (let i = 1; i < subtags.length; i++) {
		if (subtags[i] === "x") break;
		if (subtags[i] !== "u") continue;
		let end = i + 1;
		while (end < subtags.length && subtags[end].length > 1) end++;
		let base = subtags[0];
		for (let j = 1; j < i; j++) base += "-" + subtags[j];
		for (let j = end; j < subtags.length; j++) base += "-" + subtags[j];
		let extension = "";
		for (let j = i; j < end; j++) extension += "-" + subtags[j];
		return {
			locale: base,
			extension
		};
	}
	return {
		locale,
		extension: void 0
	};
}
// node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-locales@0.0.0/node_modules/@formatjs_generated/cldr.supported-locales/default-content.js
const defaultContent = {
	"ady": ["ady-RU"],
	"af": ["af-ZA"],
	"agq": ["agq-CM"],
	"ak": ["ak-GH"],
	"am": ["am-ET"],
	"ar": ["ar-001"],
	"as": ["as-IN"],
	"asa": ["asa-TZ"],
	"ast": ["ast-ES"],
	"az-Cyrl": ["az-Cyrl-AZ"],
	"az-Latn": ["az-Latn-AZ"],
	"ba": ["ba-RU"],
	"bal-Latn": ["bal-Latn-PK"],
	"bas": ["bas-CM"],
	"be": ["be-BY"],
	"bem": ["bem-ZM"],
	"bez": ["bez-TZ"],
	"bg": ["bg-BG"],
	"bgc": ["bgc-IN"],
	"bho": ["bho-IN"],
	"blo": ["blo-BJ"],
	"bm": ["bm-ML"],
	"bn": ["bn-BD"],
	"bo": ["bo-CN"],
	"br": ["br-FR"],
	"brx": ["brx-IN"],
	"bs-Cyrl": ["bs-Cyrl-BA"],
	"bs-Latn": ["bs-Latn-BA"],
	"bua": ["bua-RU"],
	"ca": ["ca-ES"],
	"ccp": ["ccp-BD"],
	"ce": ["ce-RU"],
	"ceb": ["ceb-PH"],
	"cgg": ["cgg-UG"],
	"chr": ["chr-US"],
	"ckb": ["ckb-IQ"],
	"cop": ["cop-EG"],
	"cs": ["cs-CZ"],
	"csw": ["csw-CA"],
	"cv": ["cv-RU"],
	"cy": ["cy-GB"],
	"da": ["da-DK"],
	"dav": ["dav-KE"],
	"de": ["de-DE"],
	"dje": ["dje-NE"],
	"doi": ["doi-IN"],
	"dsb": ["dsb-DE"],
	"dua": ["dua-CM"],
	"dyo": ["dyo-SN"],
	"dz": ["dz-BT"],
	"ebu": ["ebu-KE"],
	"ee": ["ee-GH"],
	"el": ["el-GR"],
	"en": ["en-US"],
	"eo": ["eo-001"],
	"es": ["es-ES"],
	"et": ["et-EE"],
	"eu": ["eu-ES"],
	"ewo": ["ewo-CM"],
	"fa": ["fa-IR"],
	"ff-Adlm": ["ff-Adlm-GN"],
	"ff-Latn": ["ff-Latn-SN"],
	"fi": ["fi-FI"],
	"fil": ["fil-PH"],
	"fo": ["fo-FO"],
	"fr": ["fr-FR"],
	"fur": ["fur-IT"],
	"fy": ["fy-NL"],
	"ga": ["ga-IE"],
	"gaa": ["gaa-GH"],
	"gd": ["gd-GB"],
	"gl": ["gl-ES"],
	"gsw": ["gsw-CH"],
	"gu": ["gu-IN"],
	"guz": ["guz-KE"],
	"gv": ["gv-IM"],
	"ha": ["ha-NG"],
	"haw": ["haw-US"],
	"he": ["he-IL"],
	"hi": ["hi-IN"],
	"hi-Latn": ["hi-Latn-IN"],
	"hr": ["hr-HR"],
	"hsb": ["hsb-DE"],
	"hu": ["hu-HU"],
	"hy": ["hy-AM"],
	"ia": ["ia-001"],
	"id": ["id-ID"],
	"ie": ["ie-EE"],
	"ig": ["ig-NG"],
	"ii": ["ii-CN"],
	"is": ["is-IS"],
	"it": ["it-IT"],
	"ja": ["ja-JP"],
	"jgo": ["jgo-CM"],
	"jmc": ["jmc-TZ"],
	"jv": ["jv-ID"],
	"ka": ["ka-GE"],
	"kab": ["kab-DZ"],
	"kam": ["kam-KE"],
	"kbd": ["kbd-RU"],
	"kde": ["kde-TZ"],
	"kea": ["kea-CV"],
	"kek": ["kek-GT"],
	"kgp": ["kgp-BR"],
	"khq": ["khq-ML"],
	"ki": ["ki-KE"],
	"kk-Arab": ["kk-Arab-CN"],
	"kk-Cyrl": ["kk-Cyrl-KZ"],
	"kkj": ["kkj-CM"],
	"kl": ["kl-GL"],
	"kln": ["kln-KE"],
	"km": ["km-KH"],
	"kn": ["kn-IN"],
	"ko": ["ko-KR"],
	"kok-Deva": ["kok-Deva-IN"],
	"kok-Latn": ["kok-Latn-IN"],
	"ks-Arab": ["ks-Arab-IN"],
	"ks-Deva": ["ks-Deva-IN"],
	"ksb": ["ksb-TZ"],
	"ksf": ["ksf-CM"],
	"ksh": ["ksh-DE"],
	"ku-Latn": ["ku-Latn-TR"],
	"kw": ["kw-GB"],
	"kxv-Deva": ["kxv-Deva-IN"],
	"kxv-Latn": ["kxv-Latn-IN"],
	"kxv-Orya": ["kxv-Orya-IN"],
	"kxv-Telu": ["kxv-Telu-IN"],
	"ky": ["ky-KG"],
	"lag": ["lag-TZ"],
	"lb": ["lb-LU"],
	"lg": ["lg-UG"],
	"lij": ["lij-IT"],
	"lkt": ["lkt-US"],
	"lld": ["lld-IT"],
	"lmo": ["lmo-IT"],
	"ln": ["ln-CD"],
	"lo": ["lo-LA"],
	"lrc": ["lrc-IR"],
	"lt": ["lt-LT"],
	"lu": ["lu-CD"],
	"luo": ["luo-KE"],
	"luy": ["luy-KE"],
	"lv": ["lv-LV"],
	"mai": ["mai-IN"],
	"mas": ["mas-KE"],
	"mer": ["mer-KE"],
	"mfe": ["mfe-MU"],
	"mg": ["mg-MG"],
	"mgh": ["mgh-MZ"],
	"mgo": ["mgo-CM"],
	"mi": ["mi-NZ"],
	"mk": ["mk-MK"],
	"ml": ["ml-IN"],
	"mn": ["mn-MN"],
	"mni-Beng": ["mni-Beng-IN"],
	"mr": ["mr-IN"],
	"ms": ["ms-MY"],
	"mt": ["mt-MT"],
	"mua": ["mua-CM"],
	"my": ["my-MM"],
	"mzn": ["mzn-IR"],
	"naq": ["naq-NA"],
	"nb": ["nb-NO"],
	"nd": ["nd-ZW"],
	"nds": ["nds-DE"],
	"ne": ["ne-NP"],
	"nl": ["nl-NL"],
	"nmg": ["nmg-CM"],
	"nn": ["nn-NO"],
	"nnh": ["nnh-CM"],
	"nqo": ["nqo-GN"],
	"nso": ["nso-ZA"],
	"nus": ["nus-SS"],
	"nyn": ["nyn-UG"],
	"oc": ["oc-FR"],
	"om": ["om-ET"],
	"or": ["or-IN"],
	"os": ["os-GE"],
	"pa-Arab": ["pa-Arab-PK"],
	"pa-Guru": ["pa-Guru-IN"],
	"pcm": ["pcm-NG"],
	"pl": ["pl-PL"],
	"pms": ["pms-IT"],
	"prg": ["prg-PL"],
	"ps": ["ps-AF"],
	"pt": ["pt-BR"],
	"qu": ["qu-PE"],
	"quc": ["quc-GT"],
	"raj": ["raj-IN"],
	"rm": ["rm-CH"],
	"rn": ["rn-BI"],
	"ro": ["ro-RO"],
	"rof": ["rof-TZ"],
	"ru": ["ru-RU"],
	"rw": ["rw-RW"],
	"rwk": ["rwk-TZ"],
	"sa": ["sa-IN"],
	"sah": ["sah-RU"],
	"saq": ["saq-KE"],
	"sat-Olck": ["sat-Olck-IN"],
	"sbp": ["sbp-TZ"],
	"sc": ["sc-IT"],
	"scn": ["scn-IT"],
	"sd-Arab": ["sd-Arab-PK"],
	"sd-Deva": ["sd-Deva-IN"],
	"se": ["se-NO"],
	"seh": ["seh-MZ"],
	"ses": ["ses-ML"],
	"sg": ["sg-CF"],
	"shi-Latn": ["shi-Latn-MA"],
	"shi-Tfng": ["shi-Tfng-MA"],
	"shn": ["shn-MM"],
	"si": ["si-LK"],
	"sk": ["sk-SK"],
	"sl": ["sl-SI"],
	"smn": ["smn-FI"],
	"sn": ["sn-ZW"],
	"so": ["so-SO"],
	"sq": ["sq-AL"],
	"sr-Cyrl": ["sr-Cyrl-RS"],
	"sr-Latn": ["sr-Latn-RS"],
	"st": ["st-ZA"],
	"su-Latn": ["su-Latn-ID"],
	"suz-Sunu": ["suz-Sunu-NP"],
	"sv": ["sv-SE"],
	"sw": ["sw-TZ"],
	"syr": ["syr-IQ"],
	"szl": ["szl-PL"],
	"ta": ["ta-IN"],
	"te": ["te-IN"],
	"teo": ["teo-UG"],
	"tg": ["tg-TJ"],
	"th": ["th-TH"],
	"ti": ["ti-ET"],
	"tk": ["tk-TM"],
	"tn": ["tn-ZA"],
	"to": ["to-TO"],
	"tok": ["tok-001"],
	"tr": ["tr-TR"],
	"tt": ["tt-RU"],
	"twq": ["twq-NE"],
	"tyv": ["tyv-RU"],
	"tzm": ["tzm-MA"],
	"ug": ["ug-CN"],
	"uk": ["uk-UA"],
	"ur": ["ur-PK"],
	"uz-Arab": ["uz-Arab-AF"],
	"uz-Cyrl": ["uz-Cyrl-UZ"],
	"uz-Latn": ["uz-Latn-UZ"],
	"vai-Latn": ["vai-Latn-LR"],
	"vai-Vaii": ["vai-Vaii-LR"],
	"vec": ["vec-IT"],
	"vi": ["vi-VN"],
	"vmw": ["vmw-MZ"],
	"vun": ["vun-TZ"],
	"wae": ["wae-CH"],
	"wo": ["wo-SN"],
	"xh": ["xh-ZA"],
	"xnr": ["xnr-IN"],
	"xog": ["xog-UG"],
	"yav": ["yav-CM"],
	"yi": ["yi-UA"],
	"yo": ["yo-NG"],
	"yrl": ["yrl-BR"],
	"yue-Hans": ["yue-Hans-CN"],
	"yue-Hant": ["yue-Hant-HK"],
	"za": ["za-CN"],
	"zgh": ["zgh-MA"],
	"zh-Hans": ["zh-Hans-CN"],
	"zh-Hant": ["zh-Hant-TW"],
	"zu": ["zu-ZA"]
};
// packages/ecma402-abstract/registerLocaleData.js
const registrations = /* @__PURE__ */ new WeakMap();
const getRegistrations = registrations.get.bind(registrations);
const setRegistrations = registrations.set.bind(registrations);
const LocaleMap$1 = Map;
const apply$9 = Reflect.apply;
const add = Set.prototype.add;
const getOwner = Map.prototype.get;
const setOwner = Map.prototype.set;
const forEachOwner = Map.prototype.forEach;
const split$1 = String.prototype.split;
const slice$5 = String.prototype.slice;
function canonicalizeLocaleDataTag(tag) {
	const [locale] = CanonicalizeLocaleList$1(tag);
	return splitUnicodeExtension$1(locale).locale;
}
function registerLocaleData(locale, data, localeData, availableLocales) {
	let owners = getRegistrations(localeData);
	if (!owners) {
		owners = new LocaleMap$1();
		setRegistrations(localeData, owners);
	}
	if (apply$9(getOwner, owners, [locale]) === locale) apply$9(forEachOwner, owners, [(owner, tag) => {
		if (owner === locale) setDataProperty$1(localeData, tag, data);
	}]);
	apply$9(setOwner, owners, [locale, locale]);
	setDataProperty$1(localeData, locale, data);
	apply$9(add, availableLocales, [locale]);
	const aliases = HasOwnProperty(defaultContent, locale) ? defaultContent[locale] : void 0;
	for (let index = 0; index < (aliases?.length ?? 0); index++) {
		const tag = aliases[index];
		if (apply$9(getOwner, owners, [tag]) !== tag) {
			setDataProperty$1(localeData, tag, data);
			apply$9(setOwner, owners, [tag, locale]);
		}
		apply$9(add, availableLocales, [tag]);
	}
	for (let index = -1; index < (aliases?.length ?? 0); index++) {
		const tag = index === -1 ? locale : aliases[index];
		const owner = apply$9(getOwner, owners, [tag]) ?? tag;
		const selected = localeData[tag];
		const addFallback = (fallback) => {
			if (!HasOwnProperty(localeData, fallback)) {
				setDataProperty$1(localeData, fallback, selected);
				apply$9(setOwner, owners, [fallback, owner]);
			}
			apply$9(add, availableLocales, [fallback]);
		};
		const parts = apply$9(split$1, tag, ["-"]);
		const scriptEnd = parts[0].length + 5;
		let parent = tag;
		let length = 1;
		let end = parts[0].length;
		for (; length < parts.length && parts[length].length > 1; length++) end += parts[length].length + 1;
		if (length < parts.length) {
			parent = apply$9(slice$5, parent, [0, end]);
			addFallback(parent);
		}
		for (; length > 1; length--) {
			if (length > 2 && parts[1].length === 4) addFallback(parts[0] + apply$9(slice$5, parent, [scriptEnd]));
			parent = apply$9(slice$5, parent, [0, parent.length - parts[length - 1].length - 1]);
			addFallback(parent);
		}
	}
}
// node_modules/.aspect_rules_js/@formatjs+fast-memoize@0.0.0/node_modules/@formatjs/fast-memoize/index.js
const apply$8 = Reflect.apply;
const bind = Function.prototype.bind;
const slice$4 = Array.prototype.slice;
const stringify = JSON.stringify;
const create$1 = Object.create;
const defineProperty$2 = Object.defineProperty;
const setPrototypeOf = Object.setPrototypeOf;
function memoize(fn, options) {
	const cache = options && options.cache ? options.cache : cacheDefault;
	const serializer = options && options.serializer ? options.serializer : serializerDefault;
	return (options && options.strategy ? options.strategy : strategyDefault)(fn, {
		cache,
		serializer
	});
}
function isPrimitive(value) {
	return value == null || typeof value === "number" || typeof value === "boolean";
}
function monadic(fn, cache, serializer, arg) {
	const cacheKey = isPrimitive(arg) ? arg : serializer(arg);
	let computedValue = cache.get(cacheKey);
	if (typeof computedValue === "undefined") {
		computedValue = apply$8(fn, this, [arg]);
		cache.set(cacheKey, computedValue);
	}
	return computedValue;
}
function variadic(fn, cache, serializer) {
	const args = apply$8(slice$4, arguments, [3]);
	if (serializer === serializerDefault) setPrototypeOf(args, null);
	const cacheKey = serializer(args);
	let computedValue = cache.get(cacheKey);
	if (typeof computedValue === "undefined") {
		computedValue = apply$8(fn, this, args);
		cache.set(cacheKey, computedValue);
	}
	return computedValue;
}
function assemble(fn, context, strategy, cache, serialize) {
	return apply$8(bind, strategy, [
		context,
		fn,
		cache,
		serialize
	]);
}
function strategyDefault(fn, options) {
	const strategy = fn.length === 1 ? monadic : variadic;
	return assemble(fn, this, strategy, options.cache.create(), options.serializer);
}
function strategyVariadic(fn, options) {
	return assemble(fn, this, variadic, options.cache.create(), options.serializer);
}
function strategyMonadic(fn, options) {
	return assemble(fn, this, monadic, options.cache.create(), options.serializer);
}
const serializerDefault = function() {
	setPrototypeOf(arguments, null);
	return stringify(arguments);
};
var ObjectWithoutPrototypeCache = class {
	constructor() {
		defineProperty$2(this, "cache", {
			__proto__: null,
			value: create$1(null),
			writable: true,
			enumerable: true,
			configurable: true
		});
	}
	get(key) {
		return this.cache[key];
	}
	set(key, value) {
		this.cache[key] = value;
	}
};
const cacheDefault = { create: function create() {
	return new ObjectWithoutPrototypeCache();
} };
const strategies = {
	variadic: strategyVariadic,
	monadic: strategyMonadic
};
// node_modules/.aspect_rules_js/@formatjs+intl-localematcher@0.0.0/node_modules/@formatjs/intl-localematcher/index.js
let canonicalIntl = globalThis.Intl;
const getOwnDescriptor = Object.getOwnPropertyDescriptor;
const apply$3$1 = Reflect.apply;
const providerKey = Symbol.for("@formatjs/intlCanonicalizeLocaleList");
function ownCanonicalizer() {
	const descriptor = canonicalIntl && getOwnDescriptor(canonicalIntl, "getCanonicalLocales");
	return descriptor && getOwnDescriptor(descriptor, "value")?.value;
}
let canonicalize$1 = ownCanonicalizer();
function registeredCanonicalizer() {
	try {
		const descriptor = canonicalIntl && getOwnDescriptor(canonicalIntl, providerKey);
		return descriptor && getOwnDescriptor(descriptor, "value")?.value;
	} catch {}
}
function CanonicalizeLocaleList(locales) {
	if (canonicalIntl === void 0) canonicalIntl = globalThis.Intl;
	const registered = registeredCanonicalizer();
	if (typeof registered === "function") return apply$3$1(registered, canonicalIntl, [locales]);
	if (typeof canonicalize$1 !== "function") canonicalize$1 = ownCanonicalizer();
	return apply$3$1(canonicalize$1, canonicalIntl, [locales]);
}
const apply$2$1 = Reflect.apply;
const includes$1 = Array.prototype.includes;
const indexOf$1 = Array.prototype.indexOf;
function arrayIncludes(values, search) {
	return apply$2$1(includes$1, values, [search]);
}
function arrayIndexOf(values, search) {
	return apply$2$1(indexOf$1, values, [search]);
}
const find = Array.prototype.find;
function arrayFind(values, predicate) {
	return apply$2$1(find, values, [predicate]);
}
const defineProperty$1 = Object.defineProperty;
function setDataProperty(target, key, value) {
	defineProperty$1(target, key, {
		__proto__: null,
		value,
		writable: true,
		enumerable: true,
		configurable: true
	});
}
const stringSlice$1 = Function.prototype.call.bind(String.prototype.slice);
const stringIndexOf$1 = Function.prototype.call.bind(String.prototype.indexOf);
const stringLastIndexOf = Function.prototype.call.bind(String.prototype.lastIndexOf);
const stringLowerCase = Function.prototype.call.bind(String.prototype.toLowerCase);
const stringCharCodeAt = Function.prototype.call.bind(String.prototype.charCodeAt);
const LocaleSet$1 = Set;
const setAdd = Function.prototype.call.bind(Set.prototype.add);
const setHas = Function.prototype.call.bind(Set.prototype.has);
const availableLocalesSetCache = /* @__PURE__ */ new WeakMap();
const getAvailableLocales = availableLocalesSetCache.get.bind(availableLocalesSetCache);
const setAvailableLocales = availableLocalesSetCache.set.bind(availableLocalesSetCache);
/**
* https://tc39.es/ecma402/#sec-lookupmatchinglocalebyprefix
* @param availableLocales
* @param locale
*/
function BestAvailableLocale(availableLocales, locale) {
	let availableSet = getAvailableLocales(availableLocales);
	if (!availableSet) {
		availableSet = new LocaleSet$1();
		for (let i = 0; i < availableLocales.length; i++) setAdd(availableSet, availableLocales[i]);
		setAvailableLocales(availableLocales, availableSet);
	}
	let candidate = locale;
	while (candidate.length) {
		if (setHas(availableSet, candidate)) return candidate;
		let pos = stringLastIndexOf(candidate, "-");
		if (pos === -1) return;
		while (pos >= 2 && candidate[pos - 2] === "-") pos -= 2;
		candidate = stringSlice$1(candidate, 0, pos);
	}
}
const apply$1$1 = Reflect.apply;
const split = String.prototype.split;
const hyphen = {
	__proto__: null,
	toString: () => "-"
};
function splitLocaleSubtags(value) {
	return apply$1$1(split, value, [hyphen]);
}
function splitUnicodeExtension(locale) {
	const subtags = splitLocaleSubtags(locale);
	for (let i = 1; i < subtags.length; i++) {
		if (subtags[i] === "x") break;
		if (subtags[i] !== "u") continue;
		let end = i + 1;
		while (end < subtags.length && subtags[end].length > 1) end++;
		let base = subtags[0];
		for (let j = 1; j < i; j++) base += "-" + subtags[j];
		for (let j = end; j < subtags.length; j++) base += "-" + subtags[j];
		let extension = "";
		for (let j = i; j < end; j++) extension += "-" + subtags[j];
		return {
			locale: base,
			extension
		};
	}
	return {
		locale,
		extension: void 0
	};
}
const matchingData = {
	"language": {
		"nb|no": 1,
		"no|nb": 1,
		"hr|bs": 4,
		"bs|hr": 4,
		"sh|bs": 4,
		"bs|sh": 4,
		"sh|hr": 4,
		"hr|sh": 4,
		"sh|sr": 4,
		"sr|sh": 4,
		"ssy|aa": 4,
		"aa|ssy": 4,
		"gsw|de": 4,
		"lb|de": 4,
		"da|no": 8,
		"no|da": 8,
		"da|nb": 8,
		"nb|da": 8,
		"ab|ru": 30,
		"ach|en": 30,
		"af|en": 20,
		"ak|en": 30,
		"am|en": 30,
		"ay|es": 20,
		"az|ru": 30,
		"bal|ur": 20,
		"be|ru": 20,
		"bem|en": 30,
		"bh|hi": 30,
		"bn|en": 30,
		"bo|zh": 20,
		"br|fr": 20,
		"ca|es": 20,
		"ceb|fil": 30,
		"chr|en": 20,
		"ckb|ar": 30,
		"co|fr": 20,
		"crs|fr": 20,
		"cs|sk": 20,
		"sk|cs": 20,
		"cy|en": 20,
		"ee|en": 30,
		"eo|en": 30,
		"eu|es": 20,
		"fo|da": 20,
		"fy|nl": 20,
		"ga|en": 20,
		"gaa|en": 30,
		"gd|en": 20,
		"gl|es": 20,
		"gn|es": 20,
		"gu|hi": 30,
		"ha|en": 30,
		"haw|en": 20,
		"ht|fr": 20,
		"hy|ru": 30,
		"ia|en": 30,
		"ig|en": 30,
		"is|en": 20,
		"jv|id": 20,
		"ka|en": 30,
		"kg|fr": 30,
		"kk|ru": 30,
		"km|en": 30,
		"kn|en": 30,
		"kri|en": 30,
		"ku|tr": 30,
		"ky|ru": 30,
		"la|it": 20,
		"lg|en": 30,
		"ln|fr": 30,
		"lo|en": 30,
		"loz|en": 30,
		"lua|fr": 30,
		"mai|hi": 20,
		"mfe|en": 30,
		"mg|fr": 30,
		"mi|en": 20,
		"ml|en": 30,
		"mn|ru": 30,
		"mr|hi": 30,
		"ms|id": 30,
		"mt|en": 30,
		"my|en": 30,
		"ne|en": 30,
		"nn|nb": 20,
		"nb|nn": 20,
		"nn|no": 20,
		"no|nn": 20,
		"nso|en": 30,
		"ny|en": 30,
		"nyn|en": 30,
		"oc|fr": 20,
		"om|en": 30,
		"or|en": 30,
		"pa|en": 30,
		"pcm|en": 20,
		"ps|en": 30,
		"qu|es": 30,
		"rm|de": 20,
		"rn|rw": 10,
		"rw|rn": 10,
		"rn|fr": 30,
		"rn|en": 35,
		"rw|en": 30,
		"rw|fr": 35,
		"sa|hi": 30,
		"scn|it": 20,
		"sd|en": 30,
		"si|en": 30,
		"sn|en": 30,
		"so|en": 30,
		"sq|en": 30,
		"st|en": 30,
		"su|id": 20,
		"sw|en": 30,
		"ta|en": 30,
		"te|en": 30,
		"tg|ru": 30,
		"ti|en": 30,
		"tk|ru": 30,
		"tlh|en": 30,
		"tn|en": 30,
		"to|en": 30,
		"tt|ru": 30,
		"tum|en": 30,
		"ug|zh": 20,
		"ur|en": 30,
		"uz|ru": 30,
		"wo|fr": 30,
		"xh|en": 30,
		"yi|en": 30,
		"yo|en": 30,
		"za|zh": 20,
		"zu|en": 30,
		"aao|ar": 10,
		"abh|ar": 10,
		"abv|ar": 10,
		"acm|ar": 10,
		"acq|ar": 10,
		"acw|ar": 10,
		"acx|ar": 10,
		"acy|ar": 10,
		"adf|ar": 10,
		"aeb|ar": 10,
		"aec|ar": 10,
		"afb|ar": 10,
		"apc|ar": 10,
		"apd|ar": 10,
		"arq|ar": 10,
		"ars|ar": 10,
		"ary|ar": 10,
		"arz|ar": 10,
		"auz|ar": 10,
		"avl|ar": 10,
		"ayh|ar": 10,
		"ayl|ar": 10,
		"ayn|ar": 10,
		"ayp|ar": 10,
		"bbz|ar": 10,
		"pga|ar": 10,
		"shu|ar": 10,
		"ssh|ar": 10,
		"azb|az": 10,
		"vro|et": 10,
		"ffm|ff": 10,
		"fub|ff": 10,
		"fue|ff": 10,
		"fuf|ff": 10,
		"fuh|ff": 10,
		"fui|ff": 10,
		"fuq|ff": 10,
		"fuv|ff": 10,
		"gnw|gn": 10,
		"gui|gn": 10,
		"gun|gn": 10,
		"nhd|gn": 10,
		"ikt|iu": 10,
		"enb|kln": 10,
		"eyo|kln": 10,
		"niq|kln": 10,
		"oki|kln": 10,
		"pko|kln": 10,
		"sgc|kln": 10,
		"tec|kln": 10,
		"tuy|kln": 10,
		"knn|kok": 10,
		"gkp|kpe": 10,
		"ida|luy": 10,
		"lkb|luy": 10,
		"lko|luy": 10,
		"lks|luy": 10,
		"lri|luy": 10,
		"lrm|luy": 10,
		"lsm|luy": 10,
		"lto|luy": 10,
		"lts|luy": 10,
		"lwg|luy": 10,
		"nle|luy": 10,
		"nyd|luy": 10,
		"rag|luy": 10,
		"ltg|lv": 10,
		"bhr|mg": 10,
		"bjq|mg": 10,
		"bmm|mg": 10,
		"bzc|mg": 10,
		"msh|mg": 10,
		"skg|mg": 10,
		"tdx|mg": 10,
		"tkg|mg": 10,
		"txy|mg": 10,
		"xmv|mg": 10,
		"xmw|mg": 10,
		"mvf|mn": 10,
		"bjn|ms": 10,
		"btj|ms": 10,
		"bve|ms": 10,
		"bvu|ms": 10,
		"coa|ms": 10,
		"dup|ms": 10,
		"hji|ms": 10,
		"id|ms": 10,
		"jak|ms": 10,
		"jax|ms": 10,
		"kvb|ms": 10,
		"kvr|ms": 10,
		"kxd|ms": 10,
		"lce|ms": 10,
		"lcf|ms": 10,
		"liw|ms": 10,
		"max|ms": 10,
		"meo|ms": 10,
		"mfa|ms": 10,
		"mfb|ms": 10,
		"min|ms": 10,
		"mqg|ms": 10,
		"msi|ms": 10,
		"mui|ms": 10,
		"orn|ms": 10,
		"ors|ms": 10,
		"pel|ms": 10,
		"pse|ms": 10,
		"tmw|ms": 10,
		"urk|ms": 10,
		"vkk|ms": 10,
		"vkt|ms": 10,
		"xmm|ms": 10,
		"zlm|ms": 10,
		"zmi|ms": 10,
		"dty|ne": 10,
		"gax|om": 10,
		"hae|om": 10,
		"orc|om": 10,
		"spv|or": 10,
		"pbt|ps": 10,
		"pst|ps": 10,
		"qub|qu": 10,
		"qud|qu": 10,
		"quf|qu": 10,
		"qug|qu": 10,
		"quh|qu": 10,
		"quk|qu": 10,
		"qul|qu": 10,
		"qup|qu": 10,
		"qur|qu": 10,
		"qus|qu": 10,
		"quw|qu": 10,
		"qux|qu": 10,
		"quy|qu": 10,
		"qva|qu": 10,
		"qvc|qu": 10,
		"qve|qu": 10,
		"qvh|qu": 10,
		"qvi|qu": 10,
		"qvj|qu": 10,
		"qvl|qu": 10,
		"qvm|qu": 10,
		"qvn|qu": 10,
		"qvo|qu": 10,
		"qvp|qu": 10,
		"qvs|qu": 10,
		"qvw|qu": 10,
		"qvz|qu": 10,
		"qwa|qu": 10,
		"qwc|qu": 10,
		"qwh|qu": 10,
		"qws|qu": 10,
		"qxa|qu": 10,
		"qxc|qu": 10,
		"qxh|qu": 10,
		"qxl|qu": 10,
		"qxn|qu": 10,
		"qxo|qu": 10,
		"qxp|qu": 10,
		"qxr|qu": 10,
		"qxt|qu": 10,
		"qxu|qu": 10,
		"qxw|qu": 10,
		"sdc|sc": 10,
		"sdn|sc": 10,
		"sro|sc": 10,
		"aae|sq": 10,
		"aat|sq": 10,
		"aln|sq": 10,
		"aii|syr": 10,
		"uzs|uz": 10,
		"yih|yi": 10,
		"cdo|zh": 10,
		"cjy|zh": 10,
		"cnp|zh": 10,
		"cpx|zh": 10,
		"csp|zh": 10,
		"czh|zh": 10,
		"czo|zh": 10,
		"gan|zh": 10,
		"hak|zh": 10,
		"hnm|zh": 10,
		"hsn|zh": 10,
		"luh|zh": 10,
		"lzh|zh": 10,
		"mnp|zh": 10,
		"nan|zh": 10,
		"sjc|zh": 10,
		"wuu|zh": 10,
		"yue|zh": 10
	},
	"script": {
		"am|en|Ethi|Latn": 10,
		"az|ru|Latn|Cyrl": 10,
		"bn|en|Beng|Latn": 10,
		"bo|zh|Tibt|Hans": 10,
		"hy|ru|Armn|Cyrl": 10,
		"ka|en|Geor|Latn": 10,
		"km|en|Khmr|Latn": 10,
		"kn|en|Knda|Latn": 10,
		"lo|en|Laoo|Latn": 10,
		"ml|en|Mlym|Latn": 10,
		"my|en|Mymr|Latn": 10,
		"ne|en|Deva|Latn": 10,
		"or|en|Orya|Latn": 10,
		"pa|en|Guru|Latn": 10,
		"ps|en|Arab|Latn": 10,
		"sd|en|Arab|Latn": 10,
		"si|en|Sinh|Latn": 10,
		"ta|en|Taml|Latn": 10,
		"te|en|Telu|Latn": 10,
		"ti|en|Ethi|Latn": 10,
		"tk|ru|Latn|Cyrl": 10,
		"ur|en|Arab|Latn": 10,
		"uz|ru|Latn|Cyrl": 10,
		"yi|en|Hebr|Latn": 10,
		"sr|sr|Latn|Cyrl": 5,
		"sr|sr|Cyrl|Latn": 5,
		"za|zh|Latn|Hans": 10,
		"zh|zh|Hani|Hans": 20,
		"zh|zh|Hani|Hant": 20,
		"ar|ar|Latn|Arab": 20,
		"bn|bn|Latn|Beng": 20,
		"gu|gu|Latn|Gujr": 20,
		"hi|hi|Latn|Deva": 20,
		"kn|kn|Latn|Knda": 20,
		"ml|ml|Latn|Mlym": 20,
		"mr|mr|Latn|Deva": 20,
		"ta|ta|Latn|Taml": 20,
		"te|te|Latn|Telu": 20,
		"zh|zh|Latn|Hans": 20,
		"ja|ja|Latn|Jpan": 5,
		"ja|ja|Hani|Jpan": 5,
		"ja|ja|Hira|Jpan": 5,
		"ja|ja|Kana|Jpan": 5,
		"ja|ja|Hrkt|Jpan": 5,
		"ja|ja|Hira|Hrkt": 5,
		"ja|ja|Kana|Hrkt": 5,
		"ko|ko|Hani|Kore": 5,
		"ko|ko|Hang|Kore": 5,
		"ko|ko|Jamo|Kore": 5,
		"ko|ko|Jamo|Hang": 5
	},
	"region": {
		"ar|ar|*|*": [
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			5,
			5,
			5,
			5,
			4,
			5,
			5,
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			4,
			4
		],
		"en|en|*|*": [
			4,
			4,
			5,
			5,
			4,
			3,
			4,
			4,
			4,
			5,
			5,
			4,
			3,
			4,
			5,
			5,
			4,
			4,
			5,
			5,
			5,
			5,
			5,
			4,
			4,
			5,
			5,
			5,
			4,
			4,
			5,
			5,
			4,
			3,
			4,
			3,
			3,
			5,
			5,
			3,
			3,
			3,
			4,
			4,
			5,
			5,
			4,
			3,
			4
		],
		"es|es|*|*": [
			4,
			5,
			4,
			5,
			4,
			4,
			4,
			5,
			4,
			5,
			4,
			5,
			5,
			5,
			4,
			5,
			4,
			5,
			4,
			4,
			4,
			5,
			4,
			5,
			4,
			5,
			5,
			5,
			4,
			5,
			4,
			5,
			4,
			4,
			4,
			4,
			5,
			4,
			5,
			4,
			4,
			4,
			4,
			5,
			4,
			5,
			4,
			4,
			4
		],
		"pt|pt|*|*": [
			4,
			5,
			4,
			5,
			4,
			4,
			4,
			5,
			4,
			5,
			4,
			5,
			5,
			5,
			4,
			5,
			4,
			5,
			4,
			4,
			4,
			5,
			4,
			5,
			4,
			5,
			5,
			5,
			4,
			5,
			4,
			5,
			4,
			4,
			4,
			4,
			5,
			4,
			5,
			4,
			4,
			4,
			4,
			5,
			4,
			5,
			4,
			4,
			4
		],
		"zh|zh|Hant|Hant": [
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			4,
			4,
			4,
			4,
			4,
			4,
			5,
			5,
			5,
			5,
			5,
			5,
			5,
			4
		]
	},
	"regions": {
		"142": [
			0,
			2,
			6
		],
		"143": [0],
		"145": [0],
		"150": [0, 5],
		"151": [0],
		"154": [0, 5],
		"155": [0],
		"202": [0, 4],
		"419": [1, 3],
		"001": [
			0,
			1,
			2,
			3,
			4,
			5,
			6
		],
		"002": [0, 4],
		"003": [1, 3],
		"005": [1],
		"009": [0, 2],
		"011": [0, 4],
		"013": [1],
		"014": [0],
		"015": [0, 4],
		"017": [0],
		"018": [0],
		"019": [1, 3],
		"021": [1, 3],
		"029": [1, 3],
		"030": [0, 6],
		"034": [0],
		"035": [0, 2],
		"039": [0],
		"053": [0],
		"054": [0],
		"057": [0, 2],
		"061": [0, 2],
		"AC": [0],
		"AD": [0],
		"AE": [0],
		"AF": [0],
		"AG": [1],
		"AI": [1],
		"AL": [0],
		"AM": [0],
		"AO": [0],
		"AQ": [0],
		"AR": [1],
		"AS": [2],
		"AT": [0],
		"AU": [0],
		"AW": [1],
		"AX": [0],
		"AZ": [0],
		"BA": [0],
		"BB": [1],
		"BD": [0],
		"BE": [0],
		"BF": [0],
		"BG": [0],
		"BH": [0],
		"BI": [0],
		"BJ": [0],
		"BL": [1],
		"BM": [1],
		"BN": [0],
		"BO": [1],
		"BQ": [1],
		"BR": [1],
		"BS": [1],
		"BT": [0],
		"BV": [1],
		"BW": [0],
		"BY": [0],
		"BZ": [1],
		"CA": [3],
		"CC": [0],
		"CD": [0],
		"CF": [0],
		"CG": [0],
		"CH": [0],
		"CI": [0],
		"CK": [0],
		"CL": [1],
		"CM": [0],
		"CN": [0],
		"CO": [1],
		"CP": [0],
		"CQ": [0],
		"CR": [1],
		"CU": [1],
		"CV": [0],
		"CW": [1],
		"CX": [0],
		"CY": [0],
		"CZ": [0],
		"DE": [0],
		"DG": [0],
		"DJ": [0],
		"DK": [0],
		"DM": [1],
		"DO": [1],
		"DZ": [4],
		"EA": [0],
		"EC": [1],
		"EE": [0],
		"EG": [0],
		"EH": [4],
		"ER": [0],
		"ES": [0],
		"ET": [0],
		"EU": [0],
		"EZ": [0],
		"FI": [0],
		"FJ": [0],
		"FK": [1],
		"FM": [0],
		"FO": [0],
		"FR": [0],
		"GA": [0],
		"GB": [5],
		"GD": [1],
		"GE": [0],
		"GF": [1],
		"GG": [0],
		"GH": [0],
		"GI": [0],
		"GL": [1],
		"GM": [0],
		"GN": [0],
		"GP": [1],
		"GQ": [0],
		"GR": [0],
		"GS": [1],
		"GT": [1],
		"GU": [2],
		"GW": [0],
		"GY": [1],
		"HK": [6],
		"HM": [0],
		"HN": [1],
		"HR": [0],
		"HT": [1],
		"HU": [0],
		"IC": [0],
		"ID": [0],
		"IE": [0],
		"IL": [0],
		"IM": [0],
		"IN": [0],
		"IO": [0],
		"IQ": [0],
		"IR": [0],
		"IS": [0],
		"IT": [0],
		"JE": [0],
		"JM": [1],
		"JO": [0],
		"JP": [0],
		"KE": [0],
		"KG": [0],
		"KH": [0],
		"KI": [0],
		"KM": [0],
		"KN": [1],
		"KP": [0],
		"KR": [0],
		"KW": [0],
		"KY": [1],
		"KZ": [0],
		"LA": [0],
		"LB": [0],
		"LC": [1],
		"LI": [0],
		"LK": [0],
		"LR": [0],
		"LS": [0],
		"LT": [0],
		"LU": [0],
		"LV": [0],
		"LY": [4],
		"MA": [4],
		"MC": [0],
		"MD": [0],
		"ME": [0],
		"MF": [1],
		"MG": [0],
		"MH": [2],
		"MK": [0],
		"ML": [0],
		"MM": [0],
		"MN": [0],
		"MO": [6],
		"MP": [2],
		"MQ": [1],
		"MR": [4],
		"MS": [1],
		"MT": [0],
		"MU": [0],
		"MV": [0],
		"MW": [0],
		"MX": [1],
		"MY": [0],
		"MZ": [0],
		"NA": [0],
		"NC": [0],
		"NE": [0],
		"NF": [0],
		"NG": [0],
		"NI": [1],
		"NL": [0],
		"NO": [0],
		"NP": [0],
		"NR": [0],
		"NU": [0],
		"NZ": [0],
		"OM": [0],
		"PA": [1],
		"PE": [1],
		"PF": [0],
		"PG": [0],
		"PH": [2],
		"PK": [0],
		"PL": [0],
		"PM": [1],
		"PN": [0],
		"PR": [3],
		"PS": [0],
		"PT": [0],
		"PW": [0],
		"PY": [1],
		"QA": [0],
		"QO": [0],
		"RE": [0],
		"RO": [0],
		"RS": [0],
		"RU": [0],
		"RW": [0],
		"SA": [0],
		"SB": [0],
		"SC": [0],
		"SD": [0],
		"SE": [0],
		"SG": [0],
		"SH": [0],
		"SI": [0],
		"SJ": [0],
		"SK": [0],
		"SL": [0],
		"SM": [0],
		"SN": [0],
		"SO": [0],
		"SR": [1],
		"SS": [0],
		"ST": [0],
		"SV": [1],
		"SX": [1],
		"SY": [0],
		"SZ": [0],
		"TA": [0],
		"TC": [1],
		"TD": [0],
		"TF": [0],
		"TG": [0],
		"TH": [0],
		"TJ": [0],
		"TK": [0],
		"TL": [0],
		"TM": [0],
		"TN": [4],
		"TO": [0],
		"TR": [0],
		"TT": [1],
		"TV": [0],
		"TW": [0],
		"TZ": [0],
		"UA": [0],
		"UG": [0],
		"UM": [2],
		"UN": [
			0,
			1,
			2,
			3,
			4,
			5
		],
		"US": [3],
		"UY": [1],
		"UZ": [0],
		"VA": [0],
		"VC": [1],
		"VE": [1],
		"VG": [1],
		"VI": [3],
		"VN": [0],
		"VU": [0],
		"WF": [0],
		"WS": [0],
		"XK": [0],
		"YE": [0],
		"YT": [0],
		"ZA": [0],
		"ZM": [0],
		"ZW": [0]
	},
	"defaults": [
		80,
		50,
		4
	],
	"partitionCount": 7,
	"paradigms": [
		"en",
		"en-GB",
		"es",
		"es-419",
		"pt-BR",
		"pt-PT"
	],
	"cldrVersion": "49",
	"macroRegions": ["419"],
	"canonicalAliases": {
		"language": [
			"aam",
			"aar",
			"abk",
			"adp",
			"afr",
			"agp",
			"ais",
			"ajp",
			"ajt",
			"aju",
			"aka",
			"alb",
			"als",
			"amh",
			"ara",
			"arb",
			"arg",
			"arm",
			"asd",
			"asm",
			"aue",
			"ava",
			"ave",
			"aym",
			"ayr",
			"ayx",
			"aze",
			"azj",
			"bak",
			"bam",
			"baq",
			"baz",
			"bcc",
			"bcl",
			"bel",
			"ben",
			"bgm",
			"bh",
			"bhk",
			"bic",
			"bih",
			"bis",
			"bjd",
			"bjq",
			"bkb",
			"blg",
			"bod",
			"bos",
			"bre",
			"btb",
			"bul",
			"bur",
			"bxk",
			"bxr",
			"cat",
			"ccq",
			"ces",
			"cha",
			"che",
			"chi",
			"chu",
			"chv",
			"cjr",
			"cka",
			"cld",
			"cls",
			"cmk",
			"cmn",
			"cnr",
			"cor",
			"cos",
			"coy",
			"cqu",
			"cre",
			"cwd",
			"cym",
			"cze",
			"daf",
			"dan",
			"dap",
			"dek",
			"deu",
			"dgo",
			"dhd",
			"dik",
			"diq",
			"dit",
			"div",
			"djl",
			"dkl",
			"drh",
			"drr",
			"drw",
			"dud",
			"duj",
			"dut",
			"dwl",
			"dzo",
			"ekk",
			"ell",
			"elp",
			"emk",
			"eng",
			"epo",
			"esk",
			"est",
			"eus",
			"ewe",
			"fao",
			"fas",
			"fij",
			"fin",
			"fra",
			"fre",
			"fry",
			"fuc",
			"ful",
			"gav",
			"gaz",
			"gbc",
			"gbo",
			"geo",
			"ger",
			"gfx",
			"ggn",
			"ggo",
			"ggr",
			"gio",
			"gla",
			"gle",
			"glg",
			"gli",
			"glv",
			"gno",
			"gom",
			"gre",
			"grn",
			"gti",
			"gug",
			"guj",
			"guv",
			"gya",
			"hat",
			"hau",
			"hbs",
			"hdn",
			"hea",
			"heb",
			"her",
			"him",
			"hin",
			"hmo",
			"hrr",
			"hrv",
			"hun",
			"hye",
			"ibi",
			"ibo",
			"ice",
			"ido",
			"iii",
			"ike",
			"iku",
			"ile",
			"ill",
			"ilw",
			"in",
			"ina",
			"ind",
			"ipk",
			"isl",
			"ita",
			"iw",
			"izi",
			"jar",
			"jav",
			"jeg",
			"ji",
			"jpn",
			"jw",
			"kal",
			"kan",
			"kas",
			"kat",
			"kau",
			"kaz",
			"kdv",
			"kgc",
			"kgd",
			"kgh",
			"kgm",
			"khk",
			"khm",
			"kik",
			"kin",
			"kir",
			"kmr",
			"knc",
			"kng",
			"koj",
			"kom",
			"kon",
			"kor",
			"kpp",
			"kpv",
			"krm",
			"ktr",
			"kua",
			"kur",
			"kvs",
			"kwq",
			"kxe",
			"kxl",
			"kzh",
			"kzj",
			"kzt",
			"lak",
			"lao",
			"lat",
			"lav",
			"lbk",
			"leg",
			"lii",
			"lim",
			"lin",
			"lit",
			"llo",
			"lmm",
			"ltz",
			"lub",
			"lug",
			"lvs",
			"mac",
			"mah",
			"mal",
			"mao",
			"mar",
			"may",
			"meg",
			"mgx",
			"mhr",
			"mkd",
			"mlg",
			"mlt",
			"mnt",
			"mo",
			"mof",
			"mol",
			"mon",
			"mrd",
			"mri",
			"msa",
			"mst",
			"mup",
			"mwd",
			"mwj",
			"mya",
			"myd",
			"myt",
			"nad",
			"nau",
			"nav",
			"nbf",
			"nbl",
			"nbx",
			"ncp",
			"nde",
			"ndo",
			"nep",
			"nld",
			"nln",
			"nlr",
			"nno",
			"nns",
			"nnx",
			"nob",
			"nom",
			"noo",
			"nor",
			"npi",
			"nte",
			"nts",
			"nxu",
			"nya",
			"oci",
			"ojg",
			"oji",
			"ori",
			"orm",
			"ory",
			"oss",
			"oun",
			"pan",
			"pat",
			"pbu",
			"pcr",
			"per",
			"pes",
			"pli",
			"plt",
			"pmc",
			"pmk",
			"pmu",
			"pnb",
			"pol",
			"por",
			"ppa",
			"ppr",
			"prp",
			"prs",
			"pry",
			"pus",
			"puz",
			"que",
			"quz",
			"rmr",
			"rmy",
			"roh",
			"ron",
			"rum",
			"run",
			"rus",
			"sag",
			"san",
			"sap",
			"sca",
			"scc",
			"scr",
			"sgl",
			"sgn",
			"sh",
			"shl",
			"sin",
			"skk",
			"slk",
			"slo",
			"slv",
			"smd",
			"sme",
			"smo",
			"sna",
			"snb",
			"snd",
			"som",
			"sot",
			"spa",
			"spy",
			"sqi",
			"src",
			"srd",
			"srp",
			"ssw",
			"sul",
			"sum",
			"sun",
			"swa",
			"swc",
			"swe",
			"swh",
			"szd",
			"tah",
			"tam",
			"tat",
			"tdu",
			"tel",
			"tgg",
			"tgk",
			"tgl",
			"tha",
			"thc",
			"thw",
			"thx",
			"tib",
			"tid",
			"tie",
			"tir",
			"tkk",
			"tl",
			"tlw",
			"tmk",
			"tmp",
			"tne",
			"tnf",
			"ton",
			"tpw",
			"tsf",
			"tsn",
			"tso",
			"ttq",
			"tuk",
			"tur",
			"tw",
			"twi",
			"uig",
			"ukr",
			"umu",
			"unp",
			"uok",
			"urd",
			"uzb",
			"uzn",
			"ven",
			"vie",
			"vol",
			"wel",
			"wgw",
			"wit",
			"wiw",
			"wln",
			"wol",
			"xba",
			"xho",
			"xia",
			"xkh",
			"xpe",
			"xrq",
			"xsj",
			"xsl",
			"xss",
			"ybd",
			"ydd",
			"yen",
			"yid",
			"yiy",
			"yma",
			"ymt",
			"yol",
			"yor",
			"yos",
			"yuu",
			"zai",
			"zha",
			"zho",
			"zir",
			"zkb",
			"zsm",
			"zul",
			"zyb"
		],
		"script": ["Qaai"],
		"region": [
			"004",
			"008",
			"010",
			"012",
			"016",
			"020",
			"024",
			"028",
			"031",
			"032",
			"036",
			"040",
			"044",
			"048",
			"050",
			"051",
			"052",
			"056",
			"060",
			"062",
			"064",
			"068",
			"070",
			"072",
			"074",
			"076",
			"084",
			"086",
			"090",
			"092",
			"096",
			"100",
			"104",
			"108",
			"112",
			"116",
			"120",
			"124",
			"132",
			"136",
			"140",
			"144",
			"148",
			"152",
			"156",
			"158",
			"162",
			"166",
			"170",
			"172",
			"174",
			"175",
			"178",
			"180",
			"184",
			"188",
			"191",
			"192",
			"196",
			"200",
			"203",
			"204",
			"208",
			"212",
			"214",
			"218",
			"222",
			"226",
			"230",
			"231",
			"232",
			"233",
			"234",
			"238",
			"239",
			"242",
			"246",
			"248",
			"249",
			"250",
			"254",
			"258",
			"260",
			"262",
			"266",
			"268",
			"270",
			"275",
			"276",
			"278",
			"280",
			"288",
			"292",
			"296",
			"300",
			"304",
			"308",
			"312",
			"316",
			"320",
			"324",
			"328",
			"332",
			"334",
			"336",
			"340",
			"344",
			"348",
			"352",
			"356",
			"360",
			"364",
			"368",
			"372",
			"376",
			"380",
			"384",
			"388",
			"392",
			"398",
			"400",
			"404",
			"408",
			"410",
			"414",
			"417",
			"418",
			"422",
			"426",
			"428",
			"430",
			"434",
			"438",
			"440",
			"442",
			"446",
			"450",
			"454",
			"458",
			"462",
			"466",
			"470",
			"474",
			"478",
			"480",
			"484",
			"492",
			"496",
			"498",
			"499",
			"500",
			"504",
			"508",
			"512",
			"516",
			"520",
			"524",
			"528",
			"530",
			"531",
			"532",
			"533",
			"534",
			"535",
			"536",
			"540",
			"548",
			"554",
			"558",
			"562",
			"566",
			"570",
			"574",
			"578",
			"580",
			"581",
			"582",
			"583",
			"584",
			"585",
			"586",
			"591",
			"598",
			"600",
			"604",
			"608",
			"612",
			"616",
			"620",
			"624",
			"626",
			"630",
			"634",
			"638",
			"642",
			"643",
			"646",
			"652",
			"654",
			"659",
			"660",
			"662",
			"663",
			"666",
			"670",
			"674",
			"678",
			"682",
			"686",
			"688",
			"690",
			"694",
			"702",
			"703",
			"704",
			"705",
			"706",
			"710",
			"716",
			"720",
			"724",
			"728",
			"729",
			"732",
			"736",
			"740",
			"744",
			"748",
			"752",
			"756",
			"760",
			"762",
			"764",
			"768",
			"772",
			"776",
			"780",
			"784",
			"788",
			"792",
			"795",
			"796",
			"798",
			"800",
			"804",
			"807",
			"810",
			"818",
			"826",
			"830",
			"831",
			"832",
			"833",
			"834",
			"840",
			"850",
			"854",
			"858",
			"860",
			"862",
			"876",
			"882",
			"886",
			"887",
			"890",
			"891",
			"894",
			"958",
			"959",
			"960",
			"962",
			"963",
			"964",
			"965",
			"966",
			"967",
			"968",
			"969",
			"970",
			"971",
			"972",
			"973",
			"974",
			"975",
			"976",
			"977",
			"978",
			"979",
			"980",
			"981",
			"982",
			"983",
			"984",
			"985",
			"986",
			"987",
			"988",
			"989",
			"990",
			"991",
			"992",
			"993",
			"994",
			"995",
			"996",
			"997",
			"998",
			"999",
			"AN",
			"BU",
			"CS",
			"CT",
			"DD",
			"DY",
			"FQ",
			"FX",
			"HV",
			"JT",
			"MI",
			"NH",
			"NQ",
			"NT",
			"PC",
			"PU",
			"PZ",
			"QU",
			"RH",
			"SU",
			"TP",
			"UK",
			"VD",
			"WK",
			"YD",
			"YU",
			"ZR"
		]
	},
	"minLsrDistance": 1,
	"demotion": 5
};
const apply$7 = Reflect.apply;
const some = Array.prototype.some;
const sortLocaleIndexes = Array.prototype.sort;
const freezeLocaleList = Object.freeze;
const LocaleError = Error;
const LocaleMap = Map;
const LocaleSet = Set;
const addLocaleSet = Function.prototype.call.bind(LocaleSet.prototype.add);
const hasLocaleSet = Function.prototype.call.bind(LocaleSet.prototype.has);
const minDistance = Math.min;
const maxDistance = Math.max;
/**
* Asserts that a condition is true, throwing an error if it is not.
* Used for runtime validation and type narrowing.
*
* @param condition - The condition to check
* @param message - Error message if condition is false
* @param Err - Error constructor to use (defaults to Error)
* @throws {Error} When condition is false
*
* @example
* ```ts
* invariant(locale !== undefined, 'Locale must be defined')
* // locale is now narrowed to non-undefined type
* ```
*/
function invariant$2(condition, message, Err = LocaleError) {
	if (!condition) throw new Err(message);
}
const DEFAULT_MATCHING_THRESHOLD = matchingData.defaults[1];
const DISTANCE_SCALE = 8;
const MIN_LSR_DISTANCE = matchingData.minLsrDistance;
const languageAliases = new LocaleSet(matchingData.canonicalAliases.language);
const scriptAliases = new LocaleSet(matchingData.canonicalAliases.script);
const regionAliases = new LocaleSet(matchingData.canonicalAliases.region);
function ascii(value, start, end, min, max) {
	for (let i = start; i < end; i++) {
		const code = stringCharCodeAt(value, i);
		if (code < min || code > max) return false;
	}
	return true;
}
function languageSubtag(value) {
	return value.length >= 2 && value.length <= 8 && value.length !== 4 && ascii(value, 0, value.length, 97, 122);
}
function scriptSubtag(value) {
	return value.length === 4 && ascii(value, 0, 1, 65, 90) && ascii(value, 1, 4, 97, 122);
}
function regionSubtag(value) {
	return value.length === 2 && ascii(value, 0, 2, 65, 90) || value.length === 3 && ascii(value, 0, 3, 48, 57);
}
function pseudoRegion(value) {
	return value === "XA" || value === "XB" || value === "XC";
}
function prefix(tag) {
	let end = stringIndexOf$1(tag, "-");
	if (end < 0) end = tag.length;
	const language = stringSlice$1(tag, 0, end);
	let script = "";
	let region = "";
	if (end < tag.length) {
		let next = stringIndexOf$1(tag, "-", end + 1);
		if (next < 0) next = tag.length;
		let part = stringSlice$1(tag, end + 1, next);
		if (scriptSubtag(part)) {
			script = part;
			end = next;
			next = stringIndexOf$1(tag, "-", end + 1);
			if (next < 0) next = tag.length;
			part = stringSlice$1(tag, end + 1, next);
		}
		if (regionSubtag(part)) {
			region = part;
			end = next;
		}
	}
	return {
		language,
		script,
		region,
		end
	};
}
function scriptlessRegionLocale(tag) {
	const { language, script, region } = prefix(tag);
	if (script && region) return language + "-" + region;
}
function canUseBestFitPrefixFallback(tag) {
	const { language, script, region } = prefix(tag);
	return language !== "und" && script !== "Zzzz" && region !== "ZZ" && !pseudoRegion(region) && (stringIndexOf$1(tag, "-ps") === -1 || fields(tag).pseudo === void 0);
}
function fields(tag) {
	const parsed = prefix(tag);
	const language = parsed.language;
	let { script, region } = parsed;
	const parts = parsed.end < tag.length ? splitLocaleSubtags(stringSlice$1(tag, parsed.end + 1)) : [];
	let pseudo;
	for (let index = 0; index < parts.length; index++) {
		const part = parts[index];
		if (part.length === 1) break;
		if (part === "psaccent" || part === "psbidi" || part === "pscrack") {
			pseudo = part;
			break;
		}
	}
	if (!pseudo && !pseudoRegion(region)) {
		if (script === "Zzzz") script = "";
		if (region === "ZZ") region = "";
	}
	const flags = (language !== "und" ? 4 : 0) | (script && script !== "Zzzz" ? 2 : 0) | (region && region !== "ZZ" ? 1 : 0);
	return {
		language,
		script,
		region,
		flags,
		pseudo,
		key: tag === "und" || stringIndexOf$1(tag, "und-x-") === 0 ? tag : `${language}|${script}|${region}|${flags}|${pseudo || ""}`
	};
}
const stringKey = (value) => value;
const canonicalize = memoize((tag) => {
	const basic = prefix(tag);
	if (basic.end === tag.length && languageSubtag(basic.language) && !hasLocaleSet(languageAliases, basic.language) && !hasLocaleSet(scriptAliases, basic.script) && !hasLocaleSet(regionAliases, basic.region)) return tag;
	return CanonicalizeLocaleList(tag)[0];
}, { serializer: stringKey });
const localeDescriptor$1 = Object.getOwnPropertyDescriptor;
const localePrototype = Object.getPrototypeOf;
const LocaleTypeError = TypeError;
const localeOperations = /* @__PURE__ */ new WeakMap();
const getLocaleOperations = localeOperations.get.bind(localeOperations);
const setLocaleOperations = localeOperations.set.bind(localeOperations);
let localeIntl = globalThis.Intl;
let localeConstructor;
function localeDescriptorMember(object, key, member = "value") {
	const descriptor = localeDescriptor$1(object, key);
	return descriptor && localeDescriptor$1(descriptor, member)?.value;
}
function localeFieldReader(prototype, key) {
	const reader = localeDescriptorMember(prototype, key, "get");
	return typeof reader === "function" ? reader : void 0;
}
function captureLocaleOperations(prototype) {
	if (prototype === null) return void 0;
	const cached = getLocaleOperations(prototype);
	if (cached) return cached;
	const inherited = captureLocaleOperations(localePrototype(prototype));
	const ownMaximize = localeDescriptorMember(prototype, "maximize");
	const operations = {
		maximize: typeof ownMaximize === "function" ? ownMaximize : inherited?.maximize,
		language: localeFieldReader(prototype, "language") ?? inherited?.language,
		script: localeFieldReader(prototype, "script") ?? inherited?.script,
		region: localeFieldReader(prototype, "region") ?? inherited?.region
	};
	setLocaleOperations(prototype, operations);
	return operations;
}
function getLocaleConstructor() {
	if (localeIntl === void 0) localeIntl = globalThis.Intl;
	const installed = localeIntl && localeDescriptorMember(localeIntl, "Locale");
	if (typeof installed === "function" && installed !== localeConstructor) {
		const prototype = localeDescriptorMember(installed, "prototype");
		if (typeof prototype === "object" && prototype !== null || typeof prototype === "function") captureLocaleOperations(prototype);
		localeConstructor = installed;
	}
	return localeConstructor;
}
getLocaleConstructor();
function maximizeLocale(tag) {
	const Constructor = getLocaleConstructor();
	if (!Constructor) throw new LocaleTypeError("Intl.Locale provider is unavailable");
	const locale = new Constructor(tag);
	const maximize = captureLocaleOperations(localePrototype(locale))?.maximize;
	if (!maximize) throw new LocaleTypeError("Intl.Locale maximize is unavailable");
	return apply$7(maximize, locale, []);
}
function readLocaleField(locale, key) {
	const reader = captureLocaleOperations(localePrototype(locale))?.[key];
	return reader && apply$7(reader, locale, []);
}
const maximal = memoize((tag) => {
	const input = fields(tag);
	if (tag === "und" || stringIndexOf$1(tag, "und-x-") === 0) return {
		...input,
		language: tag,
		script: "",
		region: "",
		flags: 7,
		key: tag
	};
	const pseudo = pseudoRegion(input.region) ? input.region : input.pseudo === "psaccent" ? "XA" : input.pseudo === "psbidi" ? "XB" : input.pseudo === "pscrack" ? "XC" : void 0;
	if (pseudo) {
		const language = `${pseudo}:${input.language}`;
		const script = `${pseudo}:${input.script}`;
		const region = input.region || pseudo;
		const flags = input.region ? 7 : 6;
		return {
			...input,
			language,
			script,
			region,
			flags,
			key: `${language}|${script}|${region}|${flags}`
		};
	}
	const locale = maximizeLocale(tag);
	let flags = input.flags;
	if (arrayIncludes(matchingData.macroRegions, input.region)) {
		const regionLocale = maximizeLocale(`und-${input.region}`);
		if (input.language === "und" && (!input.script || input.script === readLocaleField(regionLocale, "script")) || !input.script && !readLocaleField(maximizeLocale(input.language), "script")) flags &= -2;
	}
	let language = readLocaleField(locale, "language");
	let script = readLocaleField(locale, "script") || "";
	let region = readLocaleField(locale, "region") || "";
	if (language === "und" || !script || !region) {
		const fallback = maximizeLocale("und" + (script ? "-" + script : "") + (region ? "-" + region : ""));
		if (language === "und") language = readLocaleField(fallback, "language") === "und" ? "en" : readLocaleField(fallback, "language");
		script ||= readLocaleField(fallback, "script") || "Latn";
		region ||= readLocaleField(fallback, "region") || "US";
	}
	return {
		language,
		script,
		region,
		flags,
		key: `${language}|${script}|${region}|${flags}`
	};
}, { serializer: stringKey });
function rawKey(tag) {
	if (tag === "und") return "@und";
	if (stringIndexOf$1(tag, "und-x-") === 0) return tag;
	const parsed = prefix(tag);
	const base = stringSlice$1(tag, 0, parsed.end);
	if (pseudoRegion(parsed.region)) return base;
	if (stringIndexOf$1(tag, "-ps") !== -1) {
		const input = fields(tag);
		if (input.pseudo) return input.key;
	}
	if (parsed.script !== "Zzzz" && parsed.region !== "ZZ") return base;
	const script = parsed.script === "Zzzz" ? "" : parsed.script;
	const region = parsed.region === "ZZ" ? "" : parsed.region;
	return parsed.language + (script ? "-" + script : "") + (region ? "-" + region : "");
}
const hasOwnMatchingKey = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
function matchingValue(table, key) {
	return hasOwnMatchingKey(table, key) ? table[key] : void 0;
}
function distance(desired, supported) {
	const languages = `${desired.language}|${supported.language}`;
	let result = desired.language === supported.language ? 0 : matchingValue(matchingData.language, languages) ?? matchingData.defaults[0];
	if (desired.script !== supported.script) result += matchingValue(matchingData.script, `${languages}|${desired.script}|${supported.script}`) ?? matchingData.defaults[1];
	if (desired.region !== supported.region) {
		const matrix = matchingValue(matchingData.region, `${languages}|${desired.script}|${supported.script}`) ?? matchingValue(matchingData.region, `${languages}|*|*`);
		const desiredPartitions = matchingValue(matchingData.regions, desired.region);
		const supportedPartitions = matchingValue(matchingData.regions, supported.region);
		let regionDistance = matchingData.defaults[2];
		if (matrix && desiredPartitions && supportedPartitions) {
			regionDistance = 0;
			for (let i = 0; i < desiredPartitions.length; i++) {
				const row = desiredPartitions[i] * matchingData.partitionCount;
				for (let j = 0; j < supportedPartitions.length; j++) regionDistance = maxDistance(regionDistance, matrix[row + supportedPartitions[j]]);
			}
		}
		result += regionDistance;
	}
	return result === 0 ? (desired.flags ^ supported.flags) / DISTANCE_SCALE : result;
}
/** ICU language/script/region distance, including fractional explicit-subtag ties. */
const findMatchingDistance = memoize((desired, supported) => distance(maximal(canonicalize(desired)), maximal(canonicalize(supported))), { serializer: (args) => `${args[0]}|${args[1]}` });
const supportedCache = /* @__PURE__ */ new WeakMap();
const getSupported = supportedCache.get.bind(supportedCache);
const setSupported = supportedCache.set.bind(supportedCache);
const immutableLocaleLists = /* @__PURE__ */ new WeakSet();
const markLocaleListImmutable = immutableLocaleLists.add.bind(immutableLocaleLists);
const isLocaleListImmutable = immutableLocaleLists.has.bind(immutableLocaleLists);
let paradigms;
function createLocaleListSnapshot(locales, additionalLocales = []) {
	const snapshot = [];
	for (let index = 0; index < locales.length; index++) setDataProperty(snapshot, `${index}`, locales[index]);
	for (let index = 0; index < additionalLocales.length; index++) setDataProperty(snapshot, `${snapshot.length}`, additionalLocales[index]);
	markLocaleListImmutable(freezeLocaleList(snapshot));
	return snapshot;
}
function equivalentKey(lsr) {
	return `${lsr.language}|${lsr.script}|${lsr.region}`;
}
function prepare(locales) {
	const immutable = isLocaleListImmutable(locales);
	let result = getSupported(locales);
	if (result && !immutable && (result.original.length !== locales.length || apply$7(some, result.original, [(tag, index) => tag !== locales[index]]))) result = void 0;
	if (!result) {
		result = {
			__proto__: null,
			original: immutable ? locales : Array.from(locales),
			tags: [],
			raw: new LocaleMap(),
			orders: new LocaleMap(),
			best: new LocaleMap()
		};
		setSupported(locales, result);
	}
	return result;
}
const getLocaleMap = Function.prototype.call.bind(LocaleMap.prototype.get);
const hasLocaleMap = Function.prototype.call.bind(LocaleMap.prototype.has);
const setLocaleMap = Function.prototype.call.bind(LocaleMap.prototype.set);
const localeMapSize = Object.getOwnPropertyDescriptor(LocaleMap.prototype, "size").get;
const clearLocaleMap = LocaleMap.prototype.clear;
function rawMatch(data, key) {
	const cached = getLocaleMap(data.raw, key);
	if (cached !== void 0) return cached;
	for (let index = data.tags.length; index < data.original.length; index++) {
		const tag = canonicalize(data.original[index]);
		setDataProperty(data.tags, `${index}`, tag);
		const candidate = rawKey(tag);
		if (!hasLocaleMap(data.raw, candidate)) setLocaleMap(data.raw, candidate, index);
		if (candidate === key) return getLocaleMap(data.raw, candidate);
	}
}
function order(data, defaultLocale) {
	let result = getLocaleMap(data.orders, defaultLocale);
	if (!result) {
		if (!data.maximal) {
			const profiles = [];
			for (let index = 0; index < data.tags.length; index++) setDataProperty(profiles, `${index}`, maximal(data.tags[index]));
			data.maximal = profiles;
			const exact = new LocaleMap();
			data.exact = exact;
			for (let index = 0; index < profiles.length; index++) {
				const { key } = profiles[index];
				if (!hasLocaleMap(exact, key)) setLocaleMap(exact, key, index);
			}
		}
		if (!paradigms) {
			const keys = new LocaleSet();
			const tags = matchingData.paradigms;
			for (let index = 0; index < tags.length; index++) addLocaleSet(keys, equivalentKey(maximal(canonicalize(tags[index]))));
			paradigms = keys;
		}
		const defaultKey = defaultLocale ? equivalentKey(maximal(canonicalize(defaultLocale))) : "";
		const rank = (index) => {
			const key = equivalentKey(data.maximal[index]);
			return key === defaultKey ? 0 : hasLocaleSet(paradigms, key) ? 1 : 2;
		};
		result = [];
		for (let index = 0; index < data.tags.length; index++) setDataProperty(result, `${index}`, index);
		apply$7(sortLocaleIndexes, result, [(a, b) => rank(a) - rank(b)]);
		setLocaleMap(data.orders, defaultLocale, result);
	}
	return result;
}
function moreLikely(candidate, previous) {
	if (candidate.language !== previous.language) return false;
	if (!languageSubtag(candidate.language)) return false;
	const likely = maximal(candidate.language);
	return candidate.script !== previous.script ? candidate.script === likely.script : candidate.region !== previous.region && candidate.region === likely.region;
}
function equivalentMatch(desired, data) {
	let best;
	for (let flags = 0; flags < 8; flags++) {
		let key = flags & 4 ? desired.language : "und";
		if (flags & 2 && desired.script) key += "-" + desired.script;
		if (flags & 1 && desired.region) key += "-" + desired.region;
		const index = getLocaleMap(data.raw, key);
		if (index === void 0) continue;
		const supported = maximal(data.tags[index]);
		if (equivalentKey(desired) !== equivalentKey(supported)) continue;
		const d = distance(desired, supported);
		if (d < minDistance(1, MIN_LSR_DISTANCE) && (!best || d < best.distance || d === best.distance && index < best.index)) best = {
			index,
			distance: d
		};
	}
	return best;
}
/** Cached exact LSR lookup, then ICU distance matching. Threshold is exclusive. */
function findBestMatch(requestedLocales, supportedLocales, threshold = DEFAULT_MATCHING_THRESHOLD, defaultLocale = supportedLocales[0] || "", collectDistances = true) {
	const result = {
		__proto__: null,
		distances: {}
	};
	if (!supportedLocales.length || !requestedLocales.length || threshold <= 0) return result;
	const data = prepare(supportedLocales);
	const demotion = matchingData.demotion;
	let bestDistance = threshold;
	for (let i = 0; i < requestedLocales.length && bestDistance > 0; i++) {
		const desiredTag = requestedLocales[i];
		const canonical = canonicalize(desiredTag);
		const exactRaw = rawMatch(data, rawKey(canonical));
		if (exactRaw !== void 0) {
			result.matchedDesiredLocale = desiredTag;
			result.matchedSupportedLocale = supportedLocales[exactRaw];
			if (collectDistances) result.distances[desiredTag] = { [supportedLocales[exactRaw]]: i * demotion };
			return result;
		}
		const desired = maximal(canonical);
		const cacheKey = `${canonical}|${defaultLocale}`;
		if (!collectDistances) {
			const equivalent = getLocaleMap(data.best, cacheKey) || equivalentMatch(desired, data);
			if (equivalent && equivalent.distance < minDistance(1, MIN_LSR_DISTANCE)) {
				setLocaleMap(data.best, cacheKey, equivalent);
				if (equivalent.distance < bestDistance) {
					bestDistance = equivalent.distance;
					result.matchedDesiredLocale = desiredTag;
					result.matchedSupportedLocale = supportedLocales[equivalent.index];
				}
				bestDistance -= demotion;
				continue;
			}
		}
		const indexes = order(data, defaultLocale);
		const exact = getLocaleMap(data.exact, desired.key);
		if (exact !== void 0) {
			result.matchedDesiredLocale = desiredTag;
			result.matchedSupportedLocale = supportedLocales[exact];
			if (collectDistances) result.distances[desiredTag] = { [supportedLocales[exact]]: i * demotion };
			return result;
		}
		let best = collectDistances ? void 0 : getLocaleMap(data.best, cacheKey);
		if (!best) {
			best = {
				index: -1,
				distance: 1e400
			};
			const distances = {};
			for (let candidate = 0; candidate < indexes.length; candidate++) {
				const index = indexes[candidate];
				const d = collectDistances ? findMatchingDistance(desiredTag, supportedLocales[index]) : distance(desired, data.maximal[index]);
				if (collectDistances) distances[supportedLocales[index]] = d + i * demotion;
				if (d < best.distance || d === best.distance && d >= 1 && best.index >= 0 && moreLikely(data.maximal[index], data.maximal[best.index])) best = {
					index,
					distance: d
				};
			}
			if (collectDistances) result.distances[desiredTag] = distances;
			else {
				if (apply$7(localeMapSize, data.best, []) >= 256) apply$7(clearLocaleMap, data.best, []);
				setLocaleMap(data.best, cacheKey, best);
			}
		}
		if (best.distance < bestDistance) {
			bestDistance = best.distance;
			result.matchedDesiredLocale = desiredTag;
			result.matchedSupportedLocale = supportedLocales[best.index];
		}
		bestDistance -= demotion;
	}
	return result;
}
/**
* https://tc39.es/ecma402/#sec-lookupmatchinglocalebybestfit
* @param availableLocales
* @param requestedLocales
* @param getDefaultLocale
*/
function BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {
	let foundLocale;
	let extension;
	const noExtensionLocaleMap = { __proto__: null };
	const noExtensionLocales = [];
	for (let index = 0; index < requestedLocales.length; index++) {
		const locale = requestedLocales[index];
		const { locale: noExtensionLocale } = splitUnicodeExtension(locale);
		noExtensionLocaleMap[noExtensionLocale] ??= locale;
		setDataProperty(noExtensionLocales, `${index}`, noExtensionLocale);
	}
	const defaultLocale = getDefaultLocale();
	const result = findBestMatch(noExtensionLocales, availableLocales, void 0, defaultLocale, false);
	if (result.matchedSupportedLocale && result.matchedDesiredLocale) {
		foundLocale = result.matchedSupportedLocale;
		extension = splitUnicodeExtension(noExtensionLocaleMap[result.matchedDesiredLocale]).extension;
	}
	if (!foundLocale) return {
		locale: defaultLocale,
		extension: void 0
	};
	return {
		locale: foundLocale,
		extension
	};
}
const subdivisionAlias = {
	"cn11": "cnbj",
	"cn12": "cntj",
	"cn13": "cnhe",
	"cn14": "cnsx",
	"cn15": "cnmn",
	"cn21": "cnln",
	"cn22": "cnjl",
	"cn23": "cnhl",
	"cn31": "cnsh",
	"cn32": "cnjs",
	"cn33": "cnzj",
	"cn34": "cnah",
	"cn35": "cnfj",
	"cn36": "cnjx",
	"cn37": "cnsd",
	"cn41": "cnha",
	"cn42": "cnhb",
	"cn43": "cnhn",
	"cn44": "cngd",
	"cn45": "cngx",
	"cn46": "cnhi",
	"cn50": "cncq",
	"cn51": "cnsc",
	"cn52": "cngz",
	"cn53": "cnyn",
	"cn54": "cnxz",
	"cn61": "cnsn",
	"cn62": "cngs",
	"cn63": "cnqh",
	"cn64": "cnnx",
	"cn65": "cnxj",
	"cn71": "twzzzz",
	"cn91": "hkzzzz",
	"cn92": "mozzzz",
	"cz10a": "cz110",
	"cz10b": "cz111",
	"cz10c": "cz112",
	"cz10d": "cz113",
	"cz10e": "cz114",
	"cz10f": "cz115",
	"cz611": "cz663",
	"cz612": "cz632",
	"cz613": "cz633",
	"cz614": "cz634",
	"cz615": "cz635",
	"cz621": "cz641",
	"cz622": "cz642",
	"cz623": "cz643",
	"cz624": "cz644",
	"cz626": "cz646",
	"cz627": "cz647",
	"czjc": "cz31",
	"czjm": "cz64",
	"czka": "cz41",
	"czkr": "cz52",
	"czli": "cz51",
	"czmo": "cz80",
	"czol": "cz71",
	"czpa": "cz53",
	"czpl": "cz32",
	"czpr": "cz10",
	"czst": "cz20",
	"czus": "cz42",
	"czvy": "cz63",
	"czzl": "cz72",
	"fi01": "axzzzz",
	"fra": "frges",
	"frb": "frnaq",
	"frbl": "blzzzz",
	"frc": "frara",
	"frcp": "cpzzzz",
	"frd": "frbfc",
	"fre": "frbre",
	"frf": "frcvl",
	"frg": "frges",
	"frgf": "gfzzzz",
	"frgp": "gpzzzz",
	"frgua": "gpzzzz",
	"frh": "frcor",
	"fri": "frbfc",
	"frj": "fridf",
	"frk": "frocc",
	"frl": "frnaq",
	"frlre": "rezzzz",
	"frm": "frges",
	"frmay": "ytzzzz",
	"frmf": "mfzzzz",
	"frmq": "mqzzzz",
	"frn": "frocc",
	"frnc": "nczzzz",
	"fro": "frhdf",
	"frp": "frnor",
	"frpf": "pfzzzz",
	"frpm": "pmzzzz",
	"frq": "frnor",
	"frr": "frpdl",
	"frre": "rezzzz",
	"frs": "frhdf",
	"frt": "frnaq",
	"frtf": "tfzzzz",
	"fru": "frpac",
	"frv": "frara",
	"frwf": "wfzzzz",
	"fryt": "ytzzzz",
	"laxn": "laxs",
	"lud": "lucl",
	"lug": "luec",
	"lul": "luca",
	"mrnkc": "mr13",
	"nlaw": "awzzzz",
	"nlcw": "cwzzzz",
	"nlsx": "sxzzzz",
	"no23": "no50",
	"nzn": "nzauk",
	"nzs": "nzcan",
	"omba": "ombj",
	"omsh": "omsj",
	"plds": "pl02",
	"plkp": "pl04",
	"pllb": "pl08",
	"plld": "pl10",
	"pllu": "pl06",
	"plma": "pl12",
	"plmz": "pl14",
	"plop": "pl16",
	"plpd": "pl20",
	"plpk": "pl18",
	"plpm": "pl22",
	"plsk": "pl26",
	"plsl": "pl24",
	"plwn": "pl28",
	"plwp": "pl30",
	"plzp": "pl32",
	"shta": "tazzzz",
	"tteto": "tttob",
	"ttrcm": "ttmrc",
	"ttwto": "tttob",
	"twkhq": "twkhh",
	"twtnq": "twtnn",
	"twtpq": "twnwt",
	"twtxq": "twtxg",
	"usas": "aszzzz",
	"usgu": "guzzzz",
	"usmp": "mpzzzz",
	"uspr": "przzzz",
	"usum": "umzzzz",
	"usvi": "vizzzz"
};
const extensionAlias = {
	"t": {
		"d0": { "name": "charname" },
		"m0": {
			"beta-metsehaf": "betamets",
			"ies-jes": "iesjes",
			"names": "prprname",
			"tekie-alibekit": "tekieali"
		}
	},
	"u": {
		"ca": {
			"ethiopic-amete-alem": "ethioaa",
			"islamicc": "islamic-civil"
		},
		"kb": { "yes": "true" },
		"kc": { "yes": "true" },
		"kh": { "yes": "true" },
		"kk": { "yes": "true" },
		"kn": { "yes": "true" },
		"ks": {
			"primary": "level1",
			"tertiary": "level3"
		},
		"ms": { "imperial": "uksystem" },
		"tz": {
			"aqams": "aqmcm",
			"aukns": "auhba",
			"caffs": "cawnp",
			"camtr": "cator",
			"canpg": "cator",
			"capnt": "caiql",
			"cathu": "cator",
			"cayzf": "caedm",
			"cet": "bebru",
			"cnckg": "cnsha",
			"cnhrb": "cnsha",
			"cnkhg": "cnurc",
			"cuba": "cuhav",
			"eet": "grath",
			"egypt": "egcai",
			"eire": "iedub",
			"est": "papty",
			"factory": "unk",
			"gaza": "gazastrp",
			"gmt0": "gmt",
			"hongkong": "hkhkg",
			"hst": "ushnl",
			"iceland": "isrey",
			"iran": "irthr",
			"israel": "jeruslm",
			"jamaica": "jmkin",
			"japan": "jptyo",
			"libya": "lytip",
			"met": "bebru",
			"mncoq": "mnuln",
			"mst": "usphx",
			"mxstis": "mxtij",
			"navajo": "usden",
			"poland": "plwaw",
			"portugal": "ptlis",
			"prc": "cnsha",
			"roc": "twtpe",
			"rok": "krsel",
			"turkey": "trist",
			"uaozh": "uaiev",
			"uauzh": "uaiev",
			"uct": "utc",
			"umjon": "ushnl",
			"usnavajo": "usden",
			"wet": "ptlis",
			"zulu": "utc"
		}
	}
};
const hasOwn = Function.prototype.call.bind(Object.prototype.hasOwnProperty);
const fromCharCode = String.fromCharCode;
function CanonicalizeUValue(ukey, uvalue) {
	invariant$2(ukey !== void 0, `ukey must be defined`);
	let canonicalized = "";
	for (let i = 0; i < uvalue.length; i++) {
		const code = stringCharCodeAt(uvalue, i);
		canonicalized += code >= 65 && code <= 90 ? fromCharCode(code + 32) : uvalue[i];
	}
	const aliases = hasOwn(extensionAlias.u, ukey) ? extensionAlias.u[ukey] : void 0;
	if (aliases && hasOwn(aliases, canonicalized)) canonicalized = aliases[canonicalized];
	if ((ukey === "rg" || ukey === "sd") && hasOwn(subdivisionAlias, canonicalized)) canonicalized = subdivisionAlias[canonicalized];
	return canonicalized === "true" ? "" : canonicalized;
}
function CanonicalizeUnicodeLocaleId(locale) {
	return CanonicalizeLocaleList(locale)[0];
}
function InsertUnicodeExtensionAndCanonicalize(locale, attributes, keywords) {
	invariant$2(splitUnicodeExtension(locale).extension === void 0, "Expected locale to not have a Unicode locale extension");
	let extension = "-u";
	for (let i = 0; i < attributes.length; i++) extension += `-${attributes[i]}`;
	for (let i = 0; i < keywords.length; i++) {
		const { key, value } = keywords[i];
		extension += `-${key}`;
		if (value !== "") extension += `-${value}`;
	}
	if (extension === "-u") return CanonicalizeUnicodeLocaleId(locale);
	let privateIndex = stringIndexOf$1(locale, "-x-");
	let newLocale;
	if (privateIndex === -1) newLocale = locale + extension;
	else {
		let preExtension = stringSlice$1(locale, 0, privateIndex);
		let postExtension = stringSlice$1(locale, privateIndex);
		newLocale = preExtension + extension + postExtension;
	}
	return CanonicalizeUnicodeLocaleId(newLocale);
}
/**
* https://tc39.es/ecma402/#sec-lookupmatchinglocalebyprefix
* @param availableLocales
* @param requestedLocales
* @param getDefaultLocale
*/
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
	const result = {
		locale: "",
		extension: void 0
	};
	for (let i = 0; i < requestedLocales.length; i++) {
		const locale = requestedLocales[i];
		const { locale: noExtensionLocale, extension } = splitUnicodeExtension(locale);
		const availableLocale = BestAvailableLocale(availableLocales, noExtensionLocale);
		if (availableLocale) {
			result.locale = availableLocale;
			if (extension) result.extension = extension;
			return result;
		}
	}
	result.locale = getDefaultLocale();
	return result;
}
function UnicodeExtensionComponents(extension) {
	invariant$2(extension === stringLowerCase(extension), "Expected extension to be lowercase");
	invariant$2(stringSlice$1(extension, 0, 3) === "-u-", "Expected extension to be a Unicode locale extension");
	const attributes = [];
	const keywords = [];
	let keyword;
	let size = extension.length;
	let k = 3;
	while (k < size) {
		let e = stringIndexOf$1(extension, "-", k);
		let len;
		if (e === -1) len = size - k;
		else len = e - k;
		let subtag = stringSlice$1(extension, k, k + len);
		invariant$2(len >= 2, "Expected a subtag to have at least 2 characters");
		if (keyword === void 0 && len != 2) {
			if (arrayIndexOf(attributes, subtag) === -1) setDataProperty(attributes, `${attributes.length}`, subtag);
		} else if (len === 2) {
			keyword = {
				key: subtag,
				value: ""
			};
			if (arrayFind(keywords, (k) => k.key === keyword?.key) === void 0) setDataProperty(keywords, `${keywords.length}`, keyword);
		} else if (keyword?.value === "") keyword.value = subtag;
		else {
			invariant$2(keyword !== void 0, "Expected keyword to be defined");
			keyword.value += "-" + subtag;
		}
		k += len + 1;
	}
	return {
		attributes,
		keywords
	};
}
const availableLocaleArrays = /* @__PURE__ */ new WeakMap();
const getLocaleArray = availableLocaleArrays.get.bind(availableLocaleArrays);
const setLocaleArray = availableLocaleArrays.set.bind(availableLocaleArrays);
const localeApply = Reflect.apply;
const localeIsArray = Array.isArray;
const localeSetValues = Set.prototype.values;
const localeSetSize = Object.getOwnPropertyDescriptor(Set.prototype, "size").get;
const localeSetNext = Object.getPrototypeOf((/* @__PURE__ */ new Set()).values()).next;
const localeLowerCase = String.prototype.toLowerCase;
const localeDescriptor = Object.getOwnPropertyDescriptor;
const hostDefaultLocaleKey = Symbol.for("@formatjs/intlHostDefaultLocale");
function readHostDefaultLocale() {
	const intl = localeDescriptorMember(globalThis, "Intl");
	if (!intl) return void 0;
	let canRetain = false;
	try {
		const retained = localeDescriptor(intl, hostDefaultLocaleKey);
		const cached = retained && localeDescriptor(retained, "value")?.value;
		if (typeof cached === "string") return cached;
		canRetain = retained === void 0;
	} catch {}
	for (const name of ["NumberFormat", "DateTimeFormat"]) try {
		const Constructor = localeDescriptorMember(intl, name);
		if (typeof Constructor !== "function" || localeDescriptorMember(Constructor, "polyfilled")) continue;
		const prototype = localeDescriptorMember(Constructor, "prototype");
		if (!prototype) continue;
		const resolve = localeDescriptorMember(prototype, "resolvedOptions");
		if (typeof resolve !== "function") continue;
		const locale = localeDescriptorMember(localeApply(resolve, new Constructor(), []), "locale");
		if (typeof locale !== "string" || !locale) continue;
		const tag = splitUnicodeExtension(locale).locale;
		try {
			if (canRetain && Object.isExtensible(intl)) Object.defineProperty(intl, hostDefaultLocaleKey, {
				__proto__: null,
				value: tag
			});
		} catch {}
		return tag;
	} catch {}
}
const hostDefaultLocale = readHostDefaultLocale();
const hostRegionLocale = hostDefaultLocale && scriptlessRegionLocale(hostDefaultLocale);
const hostLocaleSupport = /* @__PURE__ */ new WeakMap();
const getHostLocaleSupport = hostLocaleSupport.get.bind(hostLocaleSupport);
const setHostLocaleSupport = hostLocaleSupport.set.bind(hostLocaleSupport);
function getServiceLocaleList(locales, bestFit) {
	const available = getAvailableLocaleList(locales, bestFit);
	const cacheable = !localeIsArray(locales);
	const cached = cacheable && getHostLocaleSupport(available);
	if (cached) return cached;
	const dataLocale = hostDefaultLocale && BestAvailableLocale(available, hostDefaultLocale);
	const aliases = [];
	if (hostDefaultLocale && dataLocale && dataLocale !== hostDefaultLocale) setDataProperty(aliases, 0, hostDefaultLocale);
	const regionAlias = dataLocale && hostRegionLocale && arrayIndexOf(available, hostRegionLocale) < 0 ? hostRegionLocale : void 0;
	if (regionAlias) setDataProperty(aliases, aliases.length, regionAlias);
	const support = {
		available: aliases.length ? createLocaleListSnapshot(available, aliases) : available,
		defaultLocale: dataLocale ? hostDefaultLocale : void 0,
		dataLocale,
		regionAlias
	};
	if (cacheable) setHostLocaleSupport(available, support);
	return support;
}
function getAvailableLocaleList(locales, bestFit) {
	if (localeIsArray(locales)) return locales;
	const available = locales;
	let cached = getLocaleArray(available);
	if (cached?.original.length !== localeApply(localeSetSize, available, [])) cached = void 0;
	if (cached) {
		const original = cached.original;
		let index = 0;
		const iterator = localeApply(localeSetValues, available, []);
		for (;;) {
			const next = localeApply(localeSetNext, iterator, []);
			if (next.done) break;
			if (original[index++] !== next.value) {
				cached = void 0;
				break;
			}
		}
	}
	if (!cached) {
		const original = [];
		const iterator = localeApply(localeSetValues, available, []);
		for (;;) {
			const next = localeApply(localeSetNext, iterator, []);
			if (next.done) break;
			setDataProperty(original, `${original.length}`, next.value);
		}
		cached = {
			original,
			snapshot: void 0
		};
		setLocaleArray(available, cached);
	}
	if (!bestFit) return cached.original;
	return cached.snapshot ??= createLocaleListSnapshot(cached.original);
}
/**
* https://tc39.es/ecma402/#sec-resolvelocale
*/
function ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale, mode = void 0) {
	const matcher = options.localeMatcher;
	const hostSupport = mode === "hostDefaultWithLocaleData" ? getServiceLocaleList(availableLocales, matcher !== "lookup") : void 0;
	const available = hostSupport?.available ?? getAvailableLocaleList(availableLocales, matcher !== "lookup");
	const hostLocale = hostSupport?.defaultLocale;
	const defaultLocale = hostLocale ? () => hostLocale : getDefaultLocale;
	let r;
	if (matcher === "lookup") r = LookupMatcher(available, requestedLocales, defaultLocale);
	else r = BestFitMatcher(available, requestedLocales, defaultLocale);
	if (r == null) r = {
		locale: defaultLocale(),
		extension: ""
	};
	let foundLocale = r.locale;
	const result = { __proto__: null };
	const dataLocale = foundLocale === hostLocale || foundLocale === hostSupport?.regionAlias ? hostSupport?.dataLocale ?? foundLocale : foundLocale;
	const foundLocaleData = localeData?.[dataLocale];
	result.dataLocale = dataLocale;
	if (mode) result.localeData = foundLocaleData;
	let components;
	let keywords;
	if (r.extension) {
		components = UnicodeExtensionComponents(r.extension);
		keywords = components.keywords;
	} else keywords = [];
	let supportedKeywords = [];
	for (let keyIndex = 0; keyIndex < relevantExtensionKeys.length; keyIndex++) {
		const key = relevantExtensionKeys[keyIndex];
		let keyLocaleData = foundLocaleData?.[key] ?? [];
		invariant$2(localeIsArray(keyLocaleData), `keyLocaleData for ${key} must be an array`);
		let value = keyLocaleData[0];
		invariant$2(value == null || typeof value === "string", `value must be a string, null, or undefined`);
		let supportedKeyword;
		let entry = arrayFind(keywords, (k) => k.key === key);
		if (entry) {
			let requestedValue = entry.value;
			if (requestedValue !== "") {
				if (arrayIndexOf(keyLocaleData, requestedValue) > -1) {
					value = requestedValue;
					supportedKeyword = {
						key,
						value
					};
				}
			} else if (arrayIndexOf(keyLocaleData, "true") > -1) {
				value = "true";
				supportedKeyword = {
					key,
					value
				};
			}
		}
		let optionsValue = options[key];
		invariant$2(optionsValue == null || typeof optionsValue === "string", `optionsValue must be a string or undefined`);
		if (typeof optionsValue === "string") {
			optionsValue = CanonicalizeUValue(localeApply(localeLowerCase, key, []), optionsValue);
			if (optionsValue === "") optionsValue = "true";
		}
		if (optionsValue !== void 0 && optionsValue !== value && arrayIndexOf(keyLocaleData, optionsValue) > -1) {
			value = optionsValue;
			supportedKeyword = void 0;
		}
		if (supportedKeyword) setDataProperty(supportedKeywords, `${supportedKeywords.length}`, supportedKeyword);
		result[key] = value;
	}
	if (supportedKeywords.length > 0) foundLocale = InsertUnicodeExtensionAndCanonicalize(foundLocale, [], supportedKeywords);
	result.locale = foundLocale;
	return result;
}
function FilterLocales(availableLocales, requestedLocales, matcher, includeHostLocale = false) {
	const bestFit = matcher === "best fit";
	const available = includeHostLocale ? getServiceLocaleList(availableLocales, bestFit).available : getAvailableLocaleList(availableLocales, bestFit);
	const subset = [];
	for (let index = 0; index < requestedLocales.length; index++) {
		const locale = requestedLocales[index];
		const { locale: noExtensionLocale } = splitUnicodeExtension(locale);
		if (matcher === "lookup" ? BestAvailableLocale(available, noExtensionLocale) : findBestMatch([noExtensionLocale], available, void 0, void 0, false).matchedSupportedLocale ?? (canUseBestFitPrefixFallback(noExtensionLocale) ? BestAvailableLocale(available, noExtensionLocale) : void 0)) setDataProperty(subset, subset.length, locale);
	}
	return subset;
}
function match(requestedLocales, availableLocales, defaultLocale, opts) {
	return ResolveLocale(availableLocales, CanonicalizeLocaleList(requestedLocales), { localeMatcher: opts?.algorithm || "best fit" }, [], void 0, () => defaultLocale).locale;
}
// packages/ecma262-abstract/ToObject.js
/**
* https://tc39.es/ecma262/#sec-toobject
*/
function ToObject(arg) {
	if (arg === void 0 || arg === null) throw new TypeErrorConstructor$2("undefined/null cannot be converted to object");
	return objectFrom(arg);
}
// packages/ecma402-abstract/CoerceOptionsToObject.js
const createObject = Object.create;
/**
* https://tc39.es/ecma402/#sec-coerceoptionstoobject
* @param options
* @returns
*/
function CoerceOptionsToObject(options) {
	if (options === void 0) return createObject(null);
	return ToObject(options);
}
// packages/ecma262-abstract/IsObject.js
function IsObject(value) {
	return value !== null && (typeof value === "object" || typeof value === "function" || typeof value === "undefined" && value !== void 0);
}
// packages/ecma262-abstract/ToString.js
const StringConstructor$1 = String;
const TypeErrorConstructor$1 = TypeError;
/**
* https://tc39.es/ecma262/#sec-tostring
*/
function ToString(o) {
	if (typeof o === "symbol") throw TypeErrorConstructor$1("Cannot convert a Symbol value to a string");
	return StringConstructor$1(o);
}
// packages/ecma402-abstract/GetOption.js
const optionApply = Reflect.apply;
const optionJoin = Array.prototype.join;
/**
* https://tc39.es/ecma402/#sec-getoption
* @param opts
* @param prop
* @param type
* @param values
* @param fallback
*/
function GetOption(opts, prop, type, values, fallback) {
	if (!IsObject(opts)) throw new TypeErrorConstructor$2("Options must be an object");
	let value = opts[prop];
	if (value !== void 0) {
		if (type !== "boolean" && type !== "string") throw new TypeErrorConstructor$2("invalid type");
		if (type === "boolean") value = !!value;
		if (type === "string") value = ToString(value);
		if (values?.length && !arraySome(values, (val) => val === value)) throw new RangeErrorConstructor(`${value} is not within ${optionApply(optionJoin, values, [", "])}`);
		return value;
	}
	return fallback;
}
// packages/ecma402-abstract/SupportedLocales.js
function SupportedLocales(availableLocales, requestedLocales, options) {
	return FilterLocales(availableLocales, requestedLocales, GetOption(CoerceOptionsToObject(options), "localeMatcher", "string", ["lookup", "best fit"], "best fit"), true);
}
// node_modules/.aspect_rules_js/@formatjs+bigdecimal@0.0.0/node_modules/@formatjs/bigdecimal/index.js
const DIV_PRECISION = 40;
const { log10: mathLog10, min: mathMin } = Math;
const { isInteger, isNaN, isSafeInteger } = Number;
const NumberConstructor = Number;
const BigIntConstructor = BigInt;
const StringConstructor = String;
const parseInteger = parseInt;
const create = Object.create;
const apply$6 = Reflect.apply;
const arrayPush = Array.prototype.push;
const { indexOf: stringIndexOf, repeat: stringRepeat$1, slice: stringSlice, trim: stringTrim } = String.prototype;
function removeTrailingZeros(mantissa, exponent) {
	if (mantissa === 0n) return [0n, 0];
	if (mantissa % 10n !== 0n) return [mantissa, exponent];
	while (mantissa % 100000000n === 0n && isSafeInteger(exponent) && isSafeInteger(exponent + 8)) {
		mantissa /= 100000000n;
		exponent += 8;
	}
	while (mantissa % 10n === 0n) {
		mantissa /= 10n;
		exponent++;
	}
	return [mantissa, exponent];
}
function bigintAbs(n) {
	return n < 0n ? -n : n;
}
function digitCount(n) {
	if (n === 0n) return 1;
	if (n < 0n) n = -n;
	let count = 0;
	const big15 = 1000000000000000n;
	while (n >= big15) {
		n /= big15;
		count += 15;
	}
	let r = NumberConstructor(n);
	while (r >= 1) {
		r /= 10;
		count++;
	}
	return count;
}
const TEN_BIGINT = 10n;
const SMALL_POWERS_OF_TEN = [1n];
function bigintPow10(n) {
	if (n <= 0) return 1n;
	if (n <= 64 && isInteger(n)) {
		for (let i = SMALL_POWERS_OF_TEN.length; i <= n; i++) apply$6(arrayPush, SMALL_POWERS_OF_TEN, [SMALL_POWERS_OF_TEN[i - 1] * TEN_BIGINT]);
		return SMALL_POWERS_OF_TEN[n];
	}
	let result = 1n;
	let base = TEN_BIGINT;
	let exp = n;
	while (exp > 0) {
		if (exp & 1) result *= base;
		base *= base;
		exp >>= 1;
	}
	return result;
}
function parseDecimalString(s) {
	s = apply$6(stringTrim, s, []);
	if (s === "NaN") return {
		mantissa: 0n,
		exponent: 0,
		special: 1,
		negativeZero: false
	};
	if (s === "Infinity" || s === "+Infinity") return {
		mantissa: 0n,
		exponent: 0,
		special: 2,
		negativeZero: false
	};
	if (s === "-Infinity") return {
		mantissa: 0n,
		exponent: 0,
		special: 3,
		negativeZero: false
	};
	let negative = false;
	let idx = 0;
	if (s[idx] === "-") {
		negative = true;
		idx++;
	} else if (s[idx] === "+") idx++;
	let eIdx = apply$6(stringIndexOf, s, ["e", idx]);
	if (eIdx === -1) eIdx = apply$6(stringIndexOf, s, ["E", idx]);
	let sciExp = 0;
	let numPart;
	if (eIdx !== -1) {
		sciExp = parseInteger(apply$6(stringSlice, s, [eIdx + 1]), 10);
		numPart = apply$6(stringSlice, s, [idx, eIdx]);
	} else numPart = apply$6(stringSlice, s, [idx]);
	const dotIdx = apply$6(stringIndexOf, numPart, ["."]);
	let intPart;
	let fracPart;
	if (dotIdx !== -1) {
		intPart = apply$6(stringSlice, numPart, [0, dotIdx]);
		fracPart = apply$6(stringSlice, numPart, [dotIdx + 1]);
	} else {
		intPart = numPart;
		fracPart = "";
	}
	const combined = intPart + fracPart;
	const exponent = sciExp - fracPart.length;
	let firstNonZero = 0;
	while (firstNonZero < combined.length && combined[firstNonZero] === "0") firstNonZero++;
	if (firstNonZero === combined.length) return {
		mantissa: 0n,
		exponent: 0,
		special: 0,
		negativeZero: negative
	};
	let mantissa = BigIntConstructor(combined);
	if (negative) mantissa = -mantissa;
	const [normMantissa, normExponent] = removeTrailingZeros(mantissa, exponent);
	return {
		mantissa: normMantissa,
		exponent: normExponent,
		special: 0,
		negativeZero: false
	};
}
var BigDecimal = class BigDecimal {
	constructor(value) {
		if (typeof value === "bigint") {
			const normalized = removeTrailingZeros(value, 0);
			this._mantissa = normalized[0];
			this._exponent = normalized[1];
			this._special = 0;
			this._negativeZero = false;
			return;
		}
		if (typeof value === "number") {
			if (isNaN(value)) {
				this._mantissa = 0n;
				this._exponent = 0;
				this._special = 1;
				this._negativeZero = false;
				return;
			}
			if (value === 1e400) {
				this._mantissa = 0n;
				this._exponent = 0;
				this._special = 2;
				this._negativeZero = false;
				return;
			}
			if (value === -1e400) {
				this._mantissa = 0n;
				this._exponent = 0;
				this._special = 3;
				this._negativeZero = false;
				return;
			}
			if (value === 0) {
				this._mantissa = 0n;
				this._exponent = 0;
				this._special = 0;
				this._negativeZero = 1 / value === -1e400;
				return;
			}
			if (isSafeInteger(value)) {
				const normalized = removeTrailingZeros(BigIntConstructor(value), 0);
				this._mantissa = normalized[0];
				this._exponent = normalized[1];
				this._special = 0;
				this._negativeZero = false;
				return;
			}
			value = StringConstructor(value);
		}
		const parsed = parseDecimalString(value);
		this._mantissa = parsed.mantissa;
		this._exponent = parsed.exponent;
		this._special = parsed.special;
		this._negativeZero = parsed.negativeZero;
	}
	static _create(mantissa, exponent, special, negativeZero) {
		const bd = create(BigDecimal.prototype);
		bd._mantissa = mantissa;
		bd._exponent = exponent;
		bd._special = special;
		bd._negativeZero = negativeZero;
		return bd;
	}
	static _coerce(v) {
		return v instanceof BigDecimal ? v : new BigDecimal(v);
	}
	times(y) {
		const other = BigDecimal._coerce(y);
		if (this._special || other._special) return this._specialArith(other, "times");
		if (this._mantissa === 0n || other._mantissa === 0n) {
			const negZero = this._isSignNegative() ? !other._isSignNegative() : other._isSignNegative();
			return BigDecimal._create(0n, 0, 0, negZero);
		}
		const [nm, ne] = removeTrailingZeros(this._mantissa * other._mantissa, this._exponent + other._exponent);
		return BigDecimal._create(nm, ne, 0, false);
	}
	div(y) {
		const other = BigDecimal._coerce(y);
		if (this._special || other._special) return this._specialArith(other, "div");
		if (other._mantissa === 0n) {
			if (this._mantissa === 0n) return BigDecimal._create(0n, 0, 1, false);
			const neg = this._isSignNegative() !== other._isSignNegative();
			return BigDecimal._create(0n, 0, neg ? 3 : 2, false);
		}
		if (this._mantissa === 0n) {
			const negZero = this._isSignNegative() !== other._isSignNegative();
			return BigDecimal._create(0n, 0, 0, negZero);
		}
		const exponent = this._exponent - other._exponent;
		const newExponent = exponent - DIV_PRECISION;
		if ((other._mantissa === 1n || other._mantissa === -1n) && isSafeInteger(exponent) && isSafeInteger(newExponent)) return BigDecimal._create(other._mantissa === 1n ? this._mantissa : -this._mantissa, exponent === 0 ? 0 : exponent, 0, false);
		const [nm, ne] = removeTrailingZeros(this._mantissa * bigintPow10(DIV_PRECISION) / other._mantissa, newExponent);
		return BigDecimal._create(nm, ne, 0, false);
	}
	plus(y) {
		const other = BigDecimal._coerce(y);
		if (this._special || other._special) return this._specialArith(other, "plus");
		if (this._mantissa === 0n && other._mantissa === 0n) {
			const negZero = this._negativeZero && other._negativeZero;
			return BigDecimal._create(0n, 0, 0, negZero);
		}
		if (this._mantissa === 0n) return other;
		if (other._mantissa === 0n) return this;
		let m1 = this._mantissa;
		let m2 = other._mantissa;
		const e1 = this._exponent;
		const e2 = other._exponent;
		const minE = mathMin(e1, e2);
		if (e1 > minE) m1 *= bigintPow10(e1 - minE);
		if (e2 > minE) m2 *= bigintPow10(e2 - minE);
		const sum = m1 + m2;
		if (sum === 0n) return BigDecimal._create(0n, 0, 0, false);
		const normalized = removeTrailingZeros(sum, minE);
		return BigDecimal._create(normalized[0], normalized[1], 0, false);
	}
	minus(y) {
		return this.plus(BigDecimal._coerce(y).negated());
	}
	mod(y) {
		const other = BigDecimal._coerce(y);
		if (this._special || other._special) {
			if (this._special === 1 || other._special === 1) return BigDecimal._create(0n, 0, 1, false);
			if (this._special === 2 || this._special === 3) return BigDecimal._create(0n, 0, 1, false);
			if (other._special === 2 || other._special === 3) return this;
		}
		if (other._mantissa === 0n) return BigDecimal._create(0n, 0, 1, false);
		if (this._mantissa === 0n) return this;
		let m1 = this._mantissa;
		let m2 = other._mantissa;
		const e1 = this._exponent;
		const e2 = other._exponent;
		const minE = mathMin(e1, e2);
		if (e1 > minE) m1 *= bigintPow10(e1 - minE);
		if (e2 > minE) m2 *= bigintPow10(e2 - minE);
		const remainder = m1 % m2;
		if (remainder === 0n) return BigDecimal._create(0n, 0, 0, false);
		const [nm, ne] = removeTrailingZeros(remainder, minE);
		return BigDecimal._create(nm, ne, 0, false);
	}
	abs() {
		if (this._special === 1) return this;
		if (this._special === 3) return BigDecimal._create(0n, 0, 2, false);
		return BigDecimal._create(bigintAbs(this._mantissa), this._exponent, this._special, false);
	}
	negated() {
		if (this._special === 1) return this;
		if (this._special === 2) return BigDecimal._create(0n, 0, 3, false);
		if (this._special === 3) return BigDecimal._create(0n, 0, 2, false);
		if (this._mantissa === 0n) return BigDecimal._create(0n, 0, 0, !this._negativeZero);
		return BigDecimal._create(-this._mantissa, this._exponent, 0, false);
	}
	pow(n) {
		if (this._special === 1) return this;
		if (n === 0) return new BigDecimal(1);
		if (n < 0) return new BigDecimal(1).div(this.pow(-n));
		if (this._special === 2) return this;
		if (this._special === 3) return n % 2 === 0 ? BigDecimal._create(0n, 0, 2, false) : this;
		if (this._mantissa === 0n) return new BigDecimal(0);
		const [nm, ne] = removeTrailingZeros(this._mantissa ** BigIntConstructor(n), this._exponent * n);
		return BigDecimal._create(nm, ne, 0, false);
	}
	floor() {
		if (this._special !== 0) return this;
		if (this._mantissa === 0n) return this;
		if (this._exponent >= 0) return this;
		const divisor = bigintPow10(-this._exponent);
		const m = this._mantissa;
		let q = m / divisor;
		if (m < 0n && m % divisor !== 0n) q -= 1n;
		if (q === 0n) {
			const negZero = this._mantissa < 0n;
			return BigDecimal._create(0n, 0, 0, negZero);
		}
		const [nm, ne] = removeTrailingZeros(q, 0);
		return BigDecimal._create(nm, ne, 0, false);
	}
	ceil() {
		if (this._special !== 0) return this;
		if (this._mantissa === 0n) return this;
		if (this._exponent >= 0) return this;
		const divisor = bigintPow10(-this._exponent);
		const m = this._mantissa;
		let q = m / divisor;
		if (m > 0n && m % divisor !== 0n) q += 1n;
		if (q === 0n) return BigDecimal._create(0n, 0, 0, false);
		const [nm, ne] = removeTrailingZeros(q, 0);
		return BigDecimal._create(nm, ne, 0, false);
	}
	log(base) {
		if (this._special === 1) return this;
		if (this._special === 3) return BigDecimal._create(0n, 0, 1, false);
		if (this._special === 2) return BigDecimal._create(0n, 0, 2, false);
		if (this._mantissa < 0n) return BigDecimal._create(0n, 0, 1, false);
		if (this._mantissa === 0n) return BigDecimal._create(0n, 0, 3, false);
		if (base === 10) return this._log10();
		const log10x = this._log10();
		const log10b = new BigDecimal(mathLog10(base));
		return log10x.div(log10b);
	}
	_log10() {
		const absMantissa = bigintAbs(this._mantissa);
		const digits = digitCount(absMantissa);
		let log10Mantissa;
		if (digits <= 15) log10Mantissa = mathLog10(NumberConstructor(absMantissa));
		else {
			const shift = digits - 17;
			const leading = absMantissa / bigintPow10(shift);
			log10Mantissa = mathLog10(NumberConstructor(leading)) + shift;
		}
		const totalLog10 = log10Mantissa + this._exponent;
		return new BigDecimal(totalLog10);
	}
	eq(y) {
		const other = BigDecimal._coerce(y);
		if (this._special === 1 || other._special === 1) return false;
		if (this._special !== other._special) return false;
		if (this._special !== 0) return true;
		if (this._mantissa === 0n && other._mantissa === 0n) return true;
		return this._mantissa === other._mantissa && this._exponent === other._exponent;
	}
	_compareTo(other) {
		if (this._special === 1 || other._special === 1) return NaN;
		if (this._special === 2) return other._special === 2 ? 0 : 1;
		if (this._special === 3) return other._special === 3 ? 0 : -1;
		if (other._special === 2) return -1;
		if (other._special === 3) return 1;
		const thisZero = this._mantissa === 0n;
		const otherZero = other._mantissa === 0n;
		if (thisZero && otherZero) return 0;
		if (thisZero) return other._mantissa > 0n ? -1 : 1;
		if (otherZero) return this._mantissa > 0n ? 1 : -1;
		const thisNeg = this._mantissa < 0n;
		if (thisNeg !== other._mantissa < 0n) return thisNeg ? -1 : 1;
		let m1 = this._mantissa;
		let m2 = other._mantissa;
		const e1 = this._exponent;
		const e2 = other._exponent;
		const minE = mathMin(e1, e2);
		if (e1 > minE) m1 *= bigintPow10(e1 - minE);
		if (e2 > minE) m2 *= bigintPow10(e2 - minE);
		if (m1 < m2) return -1;
		if (m1 > m2) return 1;
		return 0;
	}
	lessThan(y) {
		return this._compareTo(BigDecimal._coerce(y)) === -1;
	}
	greaterThan(y) {
		return this._compareTo(BigDecimal._coerce(y)) === 1;
	}
	lessThanOrEqualTo(y) {
		const c = this._compareTo(BigDecimal._coerce(y));
		return c === 0 || c === -1;
	}
	greaterThanOrEqualTo(y) {
		const c = this._compareTo(BigDecimal._coerce(y));
		return c === 0 || c === 1;
	}
	isZero() {
		return this._special === 0 && this._mantissa === 0n;
	}
	isNaN() {
		return this._special === 1;
	}
	isFinite() {
		return this._special === 0;
	}
	isNegative() {
		if (this._special === 1) return false;
		if (this._special === 3) return true;
		if (this._special === 2) return false;
		if (this._mantissa === 0n) return this._negativeZero;
		return this._mantissa < 0n;
	}
	isPositive() {
		if (this._special === 1) return false;
		if (this._special === 2) return true;
		if (this._special === 3) return false;
		if (this._mantissa === 0n) return !this._negativeZero;
		return this._mantissa > 0n;
	}
	isInteger() {
		if (this._special !== 0) return false;
		if (this._mantissa === 0n) return true;
		return this._exponent >= 0;
	}
	toJSON() {
		return this.toString();
	}
	toNumber() {
		if (this._special === 1) return NaN;
		if (this._special === 2) return 1e400;
		if (this._special === 3) return -1e400;
		if (this._mantissa === 0n) return this._negativeZero ? -0 : 0;
		if (this._exponent === 0) return NumberConstructor(this._mantissa);
		return NumberConstructor(this.toString());
	}
	toString() {
		if (this._special === 1) return "NaN";
		if (this._special === 2) return "Infinity";
		if (this._special === 3) return "-Infinity";
		if (this._mantissa === 0n) return "0";
		const negative = this._mantissa < 0n;
		const absStr = `${bigintAbs(this._mantissa)}`;
		const prefix = negative ? "-" : "";
		if (this._exponent === 0) return prefix + absStr;
		if (this._exponent > 0) return prefix + absStr + apply$6(stringRepeat$1, "0", [this._exponent]);
		const decimalPlaces = -this._exponent;
		if (decimalPlaces < absStr.length) {
			const split = absStr.length - decimalPlaces;
			const intPart = apply$6(stringSlice, absStr, [0, split]);
			const fracPart = apply$6(stringSlice, absStr, [split]);
			return prefix + intPart + "." + fracPart;
		} else {
			const leadingZeros = decimalPlaces - absStr.length;
			return prefix + "0." + apply$6(stringRepeat$1, "0", [leadingZeros]) + absStr;
		}
	}
	static pow(base, exp) {
		const n = typeof exp === "number" ? exp : exp.toNumber();
		if (typeof base === "number" && base === 10) return BigDecimal._create(1n, n, 0, false);
		return (base instanceof BigDecimal ? base : new BigDecimal(base)).pow(n);
	}
	static set(_config) {}
	_isSignNegative() {
		if (this._special === 3) return true;
		if (this._mantissa < 0n) return true;
		if (this._mantissa === 0n) return this._negativeZero;
		return false;
	}
	_specialArith(other, op) {
		const a = this._special;
		const b = other._special;
		if (a === 1 || b === 1) return BigDecimal._create(0n, 0, 1, false);
		const aNeg = this._isSignNegative();
		const bNeg = other._isSignNegative();
		const aInf = a === 2 || a === 3;
		const bInf = b === 2 || b === 3;
		if (op === "times") {
			if (aInf || bInf) {
				if (aInf && other._mantissa === 0n && !bInf || bInf && this._mantissa === 0n && !aInf) return BigDecimal._create(0n, 0, 1, false);
				const neg = aNeg !== bNeg;
				return BigDecimal._create(0n, 0, neg ? 3 : 2, false);
			}
		}
		if (op === "div") {
			if (aInf && bInf) return BigDecimal._create(0n, 0, 1, false);
			if (aInf) {
				const neg = aNeg !== bNeg;
				return BigDecimal._create(0n, 0, neg ? 3 : 2, false);
			}
			if (bInf) {
				const negZero = aNeg !== bNeg;
				return BigDecimal._create(0n, 0, 0, negZero);
			}
		}
		if (op === "plus") {
			if (aInf && bInf) {
				if (aNeg !== bNeg) return BigDecimal._create(0n, 0, 1, false);
				return this;
			}
			if (aInf) return this;
			if (bInf) return other;
		}
		return BigDecimal._create(0n, 0, 1, false);
	}
};
// packages/ecma262-abstract/ToPrimitive.js
const functionToString = Function.prototype.toString;
const apply$5 = Reflect.apply;
const toPrimitiveSymbol = Symbol.toPrimitive;
const TypeErrorConstructor = TypeError;
const ErrorConstructor = Error;
function IsPrimitive(value) {
	return !IsObject(value);
}
function invariant$1(condition, message, Err = ErrorConstructor) {
	if (!condition) throw new Err(message);
}
function IsCallable(fn) {
	if (typeof fn === "function") return true;
	if (typeof fn !== "undefined" || fn === void 0) return false;
	try {
		apply$5(functionToString, fn, []);
		return true;
	} catch {
		return false;
	}
}
function OrdinaryToPrimitive(O, hint) {
	let methodNames;
	if (hint === "string") methodNames = ["toString", "valueOf"];
	else methodNames = ["valueOf", "toString"];
	for (let index = 0; index < methodNames.length; index++) {
		const method = O[methodNames[index]];
		if (IsCallable(method)) {
			let result = apply$5(method, O, []);
			if (IsPrimitive(result)) return result;
		}
	}
	throw new TypeErrorConstructor("Cannot convert object to primitive value");
}
/**
* https://tc39.es/ecma262/#sec-toprimitive
*/
function ToPrimitive(input, preferredType) {
	if (IsObject(input)) {
		const exoticToPrim = input[toPrimitiveSymbol];
		let hint;
		if (exoticToPrim !== void 0 && exoticToPrim !== null) {
			if (preferredType === void 0) hint = "default";
			else if (preferredType === "string") hint = "string";
			else {
				invariant$1(preferredType === "number", "preferredType must be \"string\" or \"number\"");
				hint = "number";
			}
			let result = apply$5(exoticToPrim, input, [hint]);
			if (IsPrimitive(result)) return result;
			throw new TypeErrorConstructor("Cannot convert exotic object to primitive.");
		}
		if (preferredType === void 0) preferredType = "number";
		return OrdinaryToPrimitive(input, preferredType);
	}
	return input;
}
// packages/ecma402-abstract/ToIntlMathematicalValue.js
const apply$4 = Reflect.apply;
const trim = String.prototype.trim;
const slice$3 = String.prototype.slice;
function ToIntlMathematicalValue(input) {
	const primitive = ToPrimitive(input, "number");
	let stringDigitCount = 0;
	let stringFractionDigitCount = 0;
	if (typeof primitive === "bigint") return {
		value: new BigDecimal(primitive),
		stringDigitCount,
		stringFractionDigitCount
	};
	if (typeof primitive === "symbol") throw new TypeErrorConstructor$2("Cannot convert a Symbol value to a number");
	const rounded = +primitive;
	let exact = rounded;
	if (typeof primitive === "string" && rounded === rounded) {
		const text = apply$4(trim, primitive, []);
		const first = text.length > 0 ? text[0] : "";
		const prefix = first === "0" && text.length > 1 ? text[1] : "";
		const base = prefix === "x" || prefix === "X" || prefix === "o" || prefix === "O" || prefix === "b" || prefix === "B";
		const finite = numberIsFinite(rounded);
		if (base) {
			if (finite && rounded !== 0) exact = bigIntFrom(text);
		} else {
			const start = first === "+" || first === "-" ? 1 : 0;
			if (start < text.length && text[start] !== "I") {
				let fraction = 0;
				let exponent = 0;
				let fractional = false;
				for (let index = start; index < text.length; index++) {
					const digit = text[index];
					if (digit === "e" || digit === "E") {
						exponent = +apply$4(slice$3, text, [index + 1]);
						break;
					}
					if (digit === ".") {
						fractional = true;
						continue;
					}
					if (fractional) fraction++;
					if (stringDigitCount || digit !== "0") stringDigitCount++;
				}
				stringDigitCount = finite ? stringDigitCount || 1 + fraction : 0;
				stringFractionDigitCount = mathMin$1(9007199254740991, mathMax(0, fraction - exponent));
				if (finite && rounded !== 0) exact = text;
			}
		}
	}
	return {
		value: new BigDecimal(exact),
		stringDigitCount,
		stringFractionDigitCount
	};
}
// packages/ecma402-abstract/DefaultNumberOption.js
function DefaultNumberOption(inputVal, min, max, fallback) {
	if (inputVal === void 0) return fallback;
	const val = +inputVal;
	if (!numberIsFinite(val) || val < min || val > max) throw new RangeErrorConstructor(`${val} is outside of range [${min}, ${max}]`);
	return val === 0 ? 0 : floor(val);
}
// packages/ecma402-abstract/GetNumberOption.js
function GetNumberOption(options, property, minimum, maximum, fallback) {
	const val = options[property];
	return DefaultNumberOption(val, minimum, maximum, fallback);
}
// packages/ecma402-abstract/utils.js
const apply$3 = Reflect.apply;
const stringRepeat = String.prototype.repeat;
const arrayFrom = Array.from;
const arrayJoin = Array.prototype.join;
function repeat(s, times) {
	if (typeof stringRepeat === "function") return apply$3(stringRepeat, s, [times]);
	const arr = arrayFrom({ length: times });
	for (let i = 0; i < arr.length; i++) arr[i] = s;
	return apply$3(arrayJoin, arr, [""]);
}
function defineProperty(target, name, { value }) {
	Object.defineProperty(target, name, {
		configurable: true,
		enumerable: false,
		writable: true,
		value
	});
}
function ensureIntl() {
	if (typeof Intl === "undefined") {
		const intl = {};
		if (typeof Symbol !== "undefined") Object.defineProperty(intl, Symbol.toStringTag, {
			value: "Intl",
			writable: false,
			enumerable: false,
			configurable: true
		});
		Object.defineProperty(globalThis, "Intl", {
			configurable: true,
			enumerable: false,
			writable: true,
			value: intl
		});
	}
	if (providerIntl === void 0) providerIntl = Intl;
	return Intl;
}
function invariant(condition, message, Err = ErrorConstructor$1) {
	if (!condition) throw new Err(message);
}
memoize((...args) => new Intl.NumberFormat(...args), { strategy: strategies.variadic });
memoize((...args) => new Intl.ListFormat(...args), { strategy: strategies.variadic });
const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
strategies.variadic;
let providerIntl = globalThis.Intl;
function ownIntlProvider(name) {
	const descriptor = providerIntl && getOwnPropertyDescriptor(providerIntl, name);
	return (descriptor && getOwnPropertyDescriptor(descriptor, "value"))?.value;
}
let numberFormatIntrinsic = ownIntlProvider("NumberFormat");
let listFormatIntrinsic = ownIntlProvider("ListFormat");
let pluralRulesProvider = ownIntlProvider("PluralRules");
const formatterIntrinsicKeys = {
	NumberFormat: Symbol.for("@formatjs/intlNumberFormat"),
	ListFormat: Symbol.for("@formatjs/intlListFormat"),
	PluralRules: Symbol.for("@formatjs/intlPluralRules")
};
const defineIntrinsic = Object.defineProperty;
const isExtensible = Object.isExtensible;
function registerFormatterIntrinsic(intl, name, Constructor) {
	const key = formatterIntrinsicKeys[name];
	if (getOwnPropertyDescriptor(intl, key) || isExtensible(intl)) defineIntrinsic(intl, key, {
		__proto__: null,
		configurable: true,
		value: Constructor
	});
}
const getFormatterPrototype = Object.getPrototypeOf;
function formatterMethodLookup(name) {
	const methods = /* @__PURE__ */ new WeakMap();
	const owners = /* @__PURE__ */ new WeakMap();
	const getMethod = methods.get.bind(methods);
	const setMethod = methods.set.bind(methods);
	const getOwner = owners.get.bind(owners);
	const setOwner = owners.set.bind(owners);
	return (Constructor) => {
		const cached = getMethod(Constructor);
		if (cached) return cached;
		let prototype = getOwnPropertyDescriptor(Constructor, "prototype")?.value;
		while (prototype != null) {
			const inherited = getOwner(prototype);
			if (inherited) {
				setMethod(Constructor, inherited);
				return inherited;
			}
			const descriptor = getOwnPropertyDescriptor(prototype, name);
			const value = descriptor && getOwnPropertyDescriptor(descriptor, "value");
			if (value && typeof value.value === "function") {
				const method = value.value;
				setMethod(Constructor, method);
				setOwner(prototype, method);
				return method;
			}
			prototype = getFormatterPrototype(prototype);
		}
	};
}
const findFormatterPartsMethod = formatterMethodLookup("formatToParts");
const findPluralRulesSelectMethod = formatterMethodLookup("select");
if (typeof numberFormatIntrinsic === "function") findFormatterPartsMethod(numberFormatIntrinsic);
if (typeof listFormatIntrinsic === "function") findFormatterPartsMethod(listFormatIntrinsic);
if (typeof pluralRulesProvider === "function") findPluralRulesSelectMethod(pluralRulesProvider);
const numberFormatMemoizers = /* @__PURE__ */ new WeakMap();
numberFormatMemoizers.get.bind(numberFormatMemoizers);
numberFormatMemoizers.set.bind(numberFormatMemoizers);
const listFormatMemoizers = /* @__PURE__ */ new WeakMap();
listFormatMemoizers.get.bind(listFormatMemoizers);
listFormatMemoizers.set.bind(listFormatMemoizers);
const pluralRulesMemoizers = /* @__PURE__ */ new WeakMap();
pluralRulesMemoizers.get.bind(pluralRulesMemoizers);
pluralRulesMemoizers.set.bind(pluralRulesMemoizers);
// packages/ecma402-abstract/NumberFormat/SetNumberFormatDigitOptions.js
const VALID_ROUNDING_INCREMENTS = [
	1,
	2,
	5,
	10,
	20,
	25,
	50,
	100,
	200,
	250,
	500,
	1e3,
	2e3,
	2500,
	5e3
];
const validRoundingIncrementList = VALID_ROUNDING_INCREMENTS.join(", ");
/**
* https://tc39.es/ecma402/#sec-setnfdigitoptions
*/
function SetNumberFormatDigitOptions(internalSlots, opts, mnfdDefault, mxfdDefault, notation) {
	const mnid = GetNumberOption(opts, "minimumIntegerDigits", 1, 21, 1);
	let mnfd = opts.minimumFractionDigits;
	let mxfd = opts.maximumFractionDigits;
	let mnsd = opts.minimumSignificantDigits;
	let mxsd = opts.maximumSignificantDigits;
	const roundingIncrement = GetNumberOption(opts, "roundingIncrement", 1, 5e3, 1);
	if (!arrayIncludes$1(VALID_ROUNDING_INCREMENTS, roundingIncrement)) throw new RangeErrorConstructor(`Invalid rounding increment value: ${roundingIncrement}.
Valid values are ${validRoundingIncrementList}.`);
	const roundingMode = GetOption(opts, "roundingMode", "string", [
		"ceil",
		"floor",
		"expand",
		"trunc",
		"halfCeil",
		"halfFloor",
		"halfExpand",
		"halfTrunc",
		"halfEven"
	], "halfExpand");
	const roundingPriority = GetOption(opts, "roundingPriority", "string", [
		"auto",
		"morePrecision",
		"lessPrecision"
	], "auto");
	const trailingZeroDisplay = GetOption(opts, "trailingZeroDisplay", "string", [
		"auto",
		"stripIfInteger",
		"stripToMinimum"
	], "auto");
	if (roundingIncrement !== 1) mxfdDefault = mnfdDefault;
	internalSlots.minimumIntegerDigits = mnid;
	internalSlots.roundingIncrement = roundingIncrement;
	internalSlots.roundingMode = roundingMode;
	internalSlots.trailingZeroDisplay = trailingZeroDisplay;
	const hasSd = mnsd !== void 0 || mxsd !== void 0;
	const hasFd = mnfd !== void 0 || mxfd !== void 0;
	let needSd = true;
	let needFd = true;
	if (roundingPriority === "auto") {
		needSd = hasSd;
		if (hasSd || !hasFd && notation === "compact") needFd = false;
	}
	if (needSd) {
		if (hasSd) {
			internalSlots.minimumSignificantDigits = DefaultNumberOption(mnsd, 1, 21, 1);
			internalSlots.maximumSignificantDigits = DefaultNumberOption(mxsd, internalSlots.minimumSignificantDigits, 21, 21);
		} else {
			internalSlots.minimumSignificantDigits = 1;
			internalSlots.maximumSignificantDigits = 21;
		}
	}
	if (needFd) {
		if (hasFd) {
			mnfd = DefaultNumberOption(mnfd, 0, 100, void 0);
			mxfd = DefaultNumberOption(mxfd, 0, 100, void 0);
			if (mnfd === void 0) {
				invariant(mxfd !== void 0, "maximumFractionDigits must be defined");
				mnfd = mathMin$1(mnfdDefault, mxfd);
			} else if (mxfd === void 0) mxfd = mathMax(mxfdDefault, mnfd);
			else if (mnfd > mxfd) throw new RangeErrorConstructor(`Invalid range, ${mnfd} > ${mxfd}`);
			internalSlots.minimumFractionDigits = mnfd;
			internalSlots.maximumFractionDigits = mxfd;
		} else {
			internalSlots.minimumFractionDigits = mnfdDefault;
			internalSlots.maximumFractionDigits = mxfdDefault;
		}
	}
	if (!needSd && !needFd) {
		internalSlots.minimumFractionDigits = 0;
		internalSlots.maximumFractionDigits = 0;
		internalSlots.minimumSignificantDigits = 1;
		internalSlots.maximumSignificantDigits = 2;
		internalSlots.roundingType = "morePrecision";
		internalSlots.roundingPriority = "morePrecision";
	} else if (roundingPriority === "morePrecision") {
		internalSlots.roundingType = "morePrecision";
		internalSlots.roundingPriority = "morePrecision";
	} else if (roundingPriority === "lessPrecision") {
		internalSlots.roundingType = "lessPrecision";
		internalSlots.roundingPriority = "lessPrecision";
	} else if (hasSd) {
		internalSlots.roundingType = "significantDigits";
		internalSlots.roundingPriority = "auto";
	} else {
		internalSlots.roundingType = "fractionDigits";
		internalSlots.roundingPriority = "auto";
	}
	if (roundingIncrement !== 1) {
		invariant(internalSlots.roundingType === "fractionDigits", "Invalid roundingType", TypeErrorConstructor$2);
		invariant(internalSlots.maximumFractionDigits === internalSlots.minimumFractionDigits, "With roundingIncrement > 1, maximumFractionDigits and minimumFractionDigits must be equal.", RangeErrorConstructor);
	}
}
// packages/ecma402-abstract/PluralRules/InitializePluralRules.js
function InitializePluralRules(pl, locales, options, { availableLocales, relevantExtensionKeys, localeData, getDefaultLocale, getInternalSlots }) {
	const requestedLocales = CanonicalizeLocaleList$1(locales);
	const opt = { __proto__: null };
	const opts = CoerceOptionsToObject(options);
	const internalSlots = getInternalSlots(pl);
	internalSlots.initializedPluralRules = true;
	opt.localeMatcher = GetOption(opts, "localeMatcher", "string", ["best fit", "lookup"], "best fit");
	const r = ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale, "hostDefaultWithLocaleData");
	internalSlots.locale = r.locale;
	internalSlots.localeData = r.localeData;
	internalSlots.type = GetOption(opts, "type", "string", ["cardinal", "ordinal"], "cardinal");
	const notation = GetOption(opts, "notation", "string", [
		"standard",
		"scientific",
		"engineering",
		"compact"
	], "standard");
	internalSlots.notation = notation;
	const compactDisplay = GetOption(opts, "compactDisplay", "string", ["short", "long"], "short");
	if (notation === "compact") {
		internalSlots.compactDisplay = compactDisplay;
		const data = r.localeData;
		if (data && HasOwnProperty(data, "compactExponents")) internalSlots.compactExponents = data.compactExponents;
	}
	SetNumberFormatDigitOptions(internalSlots, opts, 0, 3, notation);
	return pl;
}
// packages/ecma262-abstract/Type.js
function Type(x) {
	if (x === null) return "Null";
	if (x === void 0) return "Undefined";
	if (IsObject(x)) return "Object";
	if (typeof x === "number") return "Number";
	if (typeof x === "boolean") return "Boolean";
	if (typeof x === "string") return "String";
	if (typeof x === "symbol") return "Symbol";
	if (typeof x === "bigint") return "BigInt";
}
// packages/ecma402-abstract/constants.js
const ZERO = new BigDecimal(0);
const NEGATIVE_ZERO = new BigDecimal(-0);
// packages/ecma402-abstract/NumberFormat/GetUnsignedRoundingMode.js
const negativeMapping = {
	ceil: "zero",
	floor: "infinity",
	expand: "infinity",
	trunc: "zero",
	halfCeil: "half-zero",
	halfFloor: "half-infinity",
	halfExpand: "half-infinity",
	halfTrunc: "half-zero",
	halfEven: "half-even"
};
const positiveMapping = {
	ceil: "infinity",
	floor: "zero",
	expand: "infinity",
	trunc: "zero",
	halfCeil: "half-infinity",
	halfFloor: "half-zero",
	halfExpand: "half-infinity",
	halfTrunc: "half-zero",
	halfEven: "half-even"
};
function GetUnsignedRoundingMode(roundingMode, isNegative) {
	if (isNegative) return negativeMapping[roundingMode];
	return positiveMapping[roundingMode];
}
// packages/ecma402-abstract/NumberFormat/ApplyUnsignedRoundingMode.js
function ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode) {
	if (x.eq(r1) || r1.eq(r2)) return r1;
	if (x.eq(r2)) return r2;
	invariant(r1.lessThan(x) && x.lessThan(r2), `x should be between r1 and r2 but x=${x}, r1=${r1}, r2=${r2}`);
	if (unsignedRoundingMode === "zero") return r1;
	if (unsignedRoundingMode === "infinity") return r2;
	const d1 = x.minus(r1);
	const d2 = r2.minus(x);
	if (d1.lessThan(d2)) return r1;
	if (d2.lessThan(d1)) return r2;
	invariant(d1.eq(d2), "d1 should be equal to d2");
	if (unsignedRoundingMode === "half-zero") return r1;
	if (unsignedRoundingMode === "half-infinity") return r2;
	invariant(unsignedRoundingMode === "half-even", "unsignedRoundingMode should be half-even");
	if (r1.div(r2.minus(r1)).mod(2).isZero()) return r1;
	return r2;
}
// packages/ecma402-abstract/NumberFormat/decimal-cache.js
const powersOfTen = /* @__PURE__ */ new Map();
const readPower = powersOfTen.get.bind(powersOfTen);
const storePower = powersOfTen.set.bind(powersOfTen);
const powerOf = BigDecimal.pow;
function decimalMagnitude(value) {
	return `${value._mantissa}`.length - 1 + value._exponent;
}
function getPowerOf10(exponent) {
	const n = typeof exponent === "number" ? exponent : exponent.toNumber();
	const cached = readPower(n);
	if (cached !== void 0) return cached;
	const power = powerOf(10, n);
	if (numberIsInteger(n) && n >= -324 && n <= 324) storePower(n, power);
	return power;
}
// packages/ecma402-abstract/NumberFormat/ToRawFixed.js
const apply$2 = Reflect.apply;
const slice$2 = String.prototype.slice;
function ToRawFixedFn(n, f) {
	return n.times(getPowerOf10(-f));
}
function findN1R1(x, f, roundingIncrement) {
	const n1 = x.times(getPowerOf10(f)).floor().div(roundingIncrement).floor().times(roundingIncrement);
	return {
		n1,
		r1: ToRawFixedFn(n1, f)
	};
}
function findN2R2(x, f, roundingIncrement) {
	const n2 = x.times(getPowerOf10(f)).ceil().div(roundingIncrement).ceil().times(roundingIncrement);
	return {
		n2,
		r2: ToRawFixedFn(n2, f)
	};
}
/**
* https://tc39.es/ecma402/#sec-torawfixed
* https://tc39.es/proposal-intl-keep-trailing-zeros/
* @param x a finite non-negative mathematical value
* @param minFraction an integer between 0 and 100
* @param maxFraction an integer between 0 and 100
*/
function ToRawFixed(x, minFraction, maxFraction, roundingIncrement, unsignedRoundingMode, digitCount = 0, fractionDigitCount = 0) {
	if (roundingIncrement === 1 && x.isInteger()) {
		const integer = x.toString();
		const minimum = mathMin$1(maxFraction, mathMax(minFraction, x.isZero() ? fractionDigitCount : digitCount - integer.length));
		return {
			formattedString: integer + (minimum === 0 ? "" : "." + repeat("0", minimum)),
			roundedNumber: x,
			integerDigitsCount: integer.length,
			roundingMagnitude: -maxFraction
		};
	}
	const f = maxFraction;
	const { n1, r1 } = findN1R1(x, f, roundingIncrement);
	const { n2, r2 } = findN2R2(x, f, roundingIncrement);
	const r = ApplyUnsignedRoundingMode(x, r1, r2, unsignedRoundingMode);
	let n, xFinal;
	let m;
	if (r.eq(r1)) {
		n = n1;
		xFinal = r1;
	} else {
		n = n2;
		xFinal = r2;
	}
	if (n.isZero()) m = "0";
	else m = n.toString();
	let int;
	let leadingZeros = 0;
	if (f !== 0) {
		let k = m.length;
		if (k <= f) {
			leadingZeros = f - k + 1;
			m = repeat("0", leadingZeros) + m;
			k = f + 1;
		}
		const a = apply$2(slice$2, m, [0, k - f]);
		const b = apply$2(slice$2, m, [m.length - f]);
		m = a + "." + b;
		int = a.length;
	} else int = m.length;
	const sourceFraction = n.isZero() ? fractionDigitCount : digitCount - int + leadingZeros;
	let cut = maxFraction - mathMax(minFraction, sourceFraction);
	while (cut > 0 && m[m.length - 1] === "0") {
		m = apply$2(slice$2, m, [0, m.length - 1]);
		cut--;
	}
	if (m[m.length - 1] === ".") m = apply$2(slice$2, m, [0, m.length - 1]);
	return {
		formattedString: m,
		roundedNumber: xFinal,
		integerDigitsCount: int,
		roundingMagnitude: -f
	};
}
// packages/ecma402-abstract/NumberFormat/ToRawPrecision.js
const apply$1 = Reflect.apply;
const { includes, slice: slice$1 } = String.prototype;
/**
* https://tc39.es/ecma402/#sec-torawprecision
* https://tc39.es/proposal-intl-keep-trailing-zeros/
* @param x a finite non-negative mathematical value
* @param minPrecision an integer between 1 and 21
* @param maxPrecision an integer between 1 and 21
*/
function ToRawPrecision(x, minPrecision, maxPrecision, unsignedRoundingMode, digitCount = 0, fractionDigitCount = 0) {
	const p = maxPrecision;
	let m;
	let e;
	let xFinal;
	if (x.isZero()) {
		m = repeat("0", p);
		e = 0;
		xFinal = ZERO;
	} else {
		e = decimalMagnitude(x);
		const step = getPowerOf10(e - p + 1);
		const scaled = x.div(step);
		const n1 = scaled.floor();
		const n2 = scaled.ceil();
		const r1 = n1.times(step);
		xFinal = ApplyUnsignedRoundingMode(x, r1, n2.times(step), unsignedRoundingMode);
		m = (xFinal.eq(r1) ? n1 : n2).toString();
		if (m.length > p) {
			e++;
			m = apply$1(slice$1, m, [0, p]);
		}
	}
	let int;
	if (e >= p - 1) {
		m = m + repeat("0", e - p + 1);
		int = e + 1;
	} else if (e >= 0) {
		m = apply$1(slice$1, m, [0, e + 1]) + "." + apply$1(slice$1, m, [e + 1]);
		int = e + 1;
	} else {
		invariant(e < 0, "e should be less than 0");
		m = "0." + repeat("0", -e - 1) + m;
		int = 1;
	}
	const resolvedMinPrecision = mathMax(minPrecision, xFinal.isZero() ? fractionDigitCount + 1 : digitCount);
	if (apply$1(includes, m, ["."]) && maxPrecision > resolvedMinPrecision) {
		let cut = maxPrecision - resolvedMinPrecision;
		while (cut > 0 && m[m.length - 1] === "0") {
			m = apply$1(slice$1, m, [0, m.length - 1]);
			cut--;
		}
		if (m[m.length - 1] === ".") m = apply$1(slice$1, m, [0, m.length - 1]);
	}
	return {
		formattedString: m,
		roundedNumber: xFinal,
		integerDigitsCount: int,
		roundingMagnitude: e - p + 1
	};
}
// packages/ecma402-abstract/NumberFormat/FormatNumericToString.js
const apply = Reflect.apply;
const { indexOf, slice } = String.prototype;
function FormatNumericToString(intlObject, _x, digitCount = 0, fractionDigitCount = 0) {
	if (intlObject.trailingZeroDisplay === "stripToMinimum") {
		digitCount = 0;
		fractionDigitCount = 0;
	}
	let x = _x;
	let sign;
	if (x.isZero() && x.isNegative()) {
		sign = "negative";
		x = ZERO;
	} else {
		invariant(x.isFinite(), "NumberFormatDigitInternalSlots value is not finite");
		if (x.lessThan(0)) sign = "negative";
		else sign = "positive";
		if (sign === "negative") x = x.negated();
	}
	let result;
	const roundingType = intlObject.roundingType;
	const unsignedRoundingMode = GetUnsignedRoundingMode(intlObject.roundingMode, sign === "negative");
	switch (roundingType) {
		case "significantDigits":
			result = ToRawPrecision(x, intlObject.minimumSignificantDigits, intlObject.maximumSignificantDigits, unsignedRoundingMode, digitCount, fractionDigitCount);
			break;
		case "fractionDigits":
			result = ToRawFixed(x, intlObject.minimumFractionDigits, intlObject.maximumFractionDigits, intlObject.roundingIncrement, unsignedRoundingMode, digitCount, fractionDigitCount);
			break;
		default:
			let sResult = ToRawPrecision(x, intlObject.minimumSignificantDigits, intlObject.maximumSignificantDigits, unsignedRoundingMode, digitCount, fractionDigitCount);
			let fResult = ToRawFixed(x, intlObject.minimumFractionDigits, intlObject.maximumFractionDigits, intlObject.roundingIncrement, unsignedRoundingMode, digitCount, fractionDigitCount);
			if (intlObject.roundingType === "morePrecision") {
				if (sResult.roundingMagnitude <= fResult.roundingMagnitude) result = sResult;
				else result = fResult;
			} else {
				invariant(intlObject.roundingType === "lessPrecision", "Invalid roundingType");
				if (sResult.roundingMagnitude <= fResult.roundingMagnitude) result = fResult;
				else result = sResult;
			}
	}
	x = result.roundedNumber;
	let string = result.formattedString;
	if (intlObject.trailingZeroDisplay === "stripIfInteger" && x.isInteger()) {
		const i = apply(indexOf, string, ["."]);
		if (i > -1) string = apply(slice, string, [0, i]);
	}
	const int = result.integerDigitsCount;
	const minInteger = intlObject.minimumIntegerDigits;
	if (int < minInteger) string = repeat("0", minInteger - int) + string;
	if (sign === "negative") {
		if (x.isZero()) x = NEGATIVE_ZERO;
		else x = x.negated();
	}
	return {
		roundedNumber: x,
		formattedString: string
	};
}
// packages/ecma402-abstract/PluralRules/ResolvePlural.js
const objectKeys = Object.keys;
/**
* ResolvePluralInternal ( pluralRules, n )
*
* Internal version of ResolvePlural that returns both the formatted string and plural category.
* This is needed for selectRange, which must compare formatted strings to determine if the
* start and end values are identical.
*
* The formatted string is obtained by applying the number formatting options (digit options)
* from the PluralRules object to the input number. This ensures that formatting-sensitive
* plural rules work correctly (e.g., rules that depend on visible fraction digits).
*
* @param pl - An initialized PluralRules object
* @param n - Mathematical value to resolve
* @returns Record containing the formatted string and plural category
*/
function ResolvePluralInternal(pl, n, { getInternalSlots, PluralRuleSelect }) {
	const record = "value" in n ? n : void 0;
	n = "value" in n ? n.value : n;
	const internalSlots = getInternalSlots(pl);
	invariant(Type(internalSlots) === "Object", "pl has to be an object");
	invariant("initializedPluralRules" in internalSlots, "pluralrules must be initialized");
	if (!n.isFinite()) return {
		formattedString: n.isNaN() ? "NaN" : n.isNegative() ? "-Infinity" : "Infinity",
		pluralCategory: "other"
	};
	const { localeData, type, notation } = internalSlots;
	const s = FormatNumericToString(internalSlots, n, record?.stringDigitCount || 0, record?.stringFractionDigitCount || 0).formattedString;
	let exponent = 0;
	if (notation === "compact") {
		const patterns = internalSlots.compactExponents?.[internalSlots.compactDisplay || "short"];
		if (patterns) {
			let first = 0;
			while (first < s.length && s[first] === "0") first++;
			let end = first;
			while (end < s.length && s[end] !== ".") end++;
			const magnitude = end - first - 1;
			let selectedMagnitude = -1;
			const keys = objectKeys(patterns);
			for (let i = 0; i < keys.length; i++) {
				const threshold = numberFrom(keys[i]);
				if (threshold <= magnitude && threshold > selectedMagnitude) {
					selectedMagnitude = threshold;
					exponent = patterns[threshold];
				}
			}
		}
	}
	return {
		formattedString: s,
		pluralCategory: PluralRuleSelect(localeData, type, s, exponent)
	};
}
/**
* https://tc39.es/ecma402/#sec-resolveplural
* @param pl
* @param n
* @param PluralRuleSelect Has to pass in bc it's implementation-specific
*/
function ResolvePlural(pl, n, { getInternalSlots, PluralRuleSelect }) {
	return ResolvePluralInternal(pl, n, {
		getInternalSlots,
		PluralRuleSelect
	}).pluralCategory;
}
// packages/ecma402-abstract/PluralRules/ResolvePluralRange.js
/**
* ResolvePluralRange ( pluralRules, x, y )
*
* The ResolvePluralRange abstract operation is called with arguments pluralRules (which must be
* an object initialized as a PluralRules), x (a mathematical value), and y (a mathematical value).
* It resolves the appropriate plural form for a range by determining the plural forms of both the
* start and end values, then consulting locale-specific range data.
*
* ECMA-402 §17.5.4 ResolvePluralRange, steps 1–3.
* Specification: https://tc39.es/ecma402/#sec-resolvepluralrange
*
* @param pluralRules - An initialized PluralRules object
* @param x - Mathematical value for the range start
* @param y - Mathematical value for the range end
* @returns The plural category for the range (zero, one, two, few, many, or other)
*/
function ResolvePluralRange(pluralRules, x, y, { getInternalSlots, PluralRuleSelect, PluralRuleSelectRange }) {
	if (("value" in x ? x.value : x).isNaN() || ("value" in y ? y.value : y).isNaN()) throw new RangeErrorConstructor("selectRange requires start and end values not to be NaN");
	const internalSlots = getInternalSlots(pluralRules);
	invariant(Type(internalSlots) === "Object", "pluralRules has to be an object");
	invariant("initializedPluralRules" in internalSlots, "pluralrules must be initialized");
	const xp = ResolvePluralInternal(pluralRules, x, {
		getInternalSlots,
		PluralRuleSelect
	});
	const yp = ResolvePluralInternal(pluralRules, y, {
		getInternalSlots,
		PluralRuleSelect
	});
	if (xp.formattedString === yp.formattedString) return xp.pluralCategory;
	const { localeData, type } = internalSlots;
	return PluralRuleSelectRange(localeData, type, xp.pluralCategory, yp.pluralCategory);
}
// packages/intl-pluralrules/get_internal_slots.ts
const internalSlotMap = /* @__PURE__ */ new WeakMap();
const readInternalSlots = internalSlotMap.get.bind(internalSlotMap);
const writeInternalSlots = internalSlotMap.set.bind(internalSlotMap);
function requireInternalSlots(receiver) {
	const slots = readInternalSlots(receiver);
	if (!slots?.initializedPluralRules) throw new TypeErrorConstructor$2("Incompatible Intl.PluralRules receiver");
	return slots;
}
function getInternalSlots(x) {
	let internalSlots = readInternalSlots(x);
	if (!internalSlots) {
		internalSlots = { __proto__: null };
		writeInternalSlots(x, internalSlots);
	}
	return internalSlots;
}
// packages/intl-pluralrules/index.ts
/**
* https://tc39.es/ecma402/#sec-pluralruleselect
*/
function PluralRuleSelect(localeData, type, decimalString, exponent) {
	return localeData.fn(decimalString, type === "ordinal", exponent);
}
function PluralRuleSelectRange(localeData, type, xp, yp) {
	const ranges = localeData && HasOwnProperty(localeData, "pluralRanges") ? localeData.pluralRanges : void 0;
	const rangeData = ranges && HasOwnProperty(ranges, type) ? ranges[type] : void 0;
	const key = `${xp}_${yp}`;
	return rangeData && HasOwnProperty(rangeData, key) ? rangeData[key] ?? yp : yp;
}
let defaultLocale = "";
function getDefaultLocale() {
	return defaultLocale;
}
const relevantExtensionKeys = [];
var PluralRules = class PluralRules extends null {
	constructor(locales, options) {
		return InitializePluralRules(createFromConstructor(new.target, PluralRules.prototype), locales, options, {
			availableLocales: PluralRules.availableLocales,
			relevantExtensionKeys,
			localeData: PluralRules.localeData,
			getDefaultLocale,
			getInternalSlots
		});
	}
	resolvedOptions() {
		const internalSlots = requireInternalSlots(this);
		const opts = {};
		const fields = [
			"locale",
			"type",
			"notation",
			"compactDisplay",
			"minimumIntegerDigits",
			"minimumFractionDigits",
			"maximumFractionDigits",
			"minimumSignificantDigits",
			"maximumSignificantDigits"
		];
		for (let index = 0; index < fields.length; index++) {
			const field = fields[index];
			const val = internalSlots[field];
			if (val !== void 0) setDataProperty$1(opts, field, val);
		}
		const categories = internalSlots.localeData.categories[internalSlots.type];
		const ordered = [
			"zero",
			"one",
			"two",
			"few",
			"many",
			"other"
		];
		const pluralCategories = [];
		for (let index = 0; index < ordered.length; index++) {
			const category = ordered[index];
			if (arrayIncludes$1(categories, category)) setDataProperty$1(pluralCategories, pluralCategories.length, category);
		}
		setDataProperty$1(opts, "pluralCategories", pluralCategories);
		setDataProperty$1(opts, "roundingIncrement", internalSlots.roundingIncrement);
		setDataProperty$1(opts, "roundingMode", internalSlots.roundingMode);
		setDataProperty$1(opts, "roundingPriority", internalSlots.roundingPriority);
		setDataProperty$1(opts, "trailingZeroDisplay", internalSlots.trailingZeroDisplay);
		return opts;
	}
	select(val) {
		requireInternalSlots(this);
		const n = ToIntlMathematicalValue(val);
		return ResolvePlural(this, n, {
			getInternalSlots,
			PluralRuleSelect
		});
	}
	selectRange(start, end) {
		requireInternalSlots(this);
		if (start === void 0 || end === void 0) throw new TypeErrorConstructor$2("selectRange requires both start and end arguments");
		const x = ToIntlMathematicalValue(start);
		const y = ToIntlMathematicalValue(end);
		return ResolvePluralRange(this, x, y, {
			getInternalSlots,
			PluralRuleSelect,
			PluralRuleSelectRange
		});
	}
	static supportedLocalesOf(locales, options) {
		return SupportedLocales(PluralRules.availableLocales, CanonicalizeLocaleList$1(locales), options);
	}
	static __addLocaleData(...data) {
		for (const { data: d, locale: tag } of data) {
			const locale = canonicalizeLocaleDataTag(tag);
			registerLocaleData(locale, d, PluralRules.localeData, PluralRules.availableLocales);
			if (!defaultLocale) defaultLocale = locale;
		}
	}
	static {
		this.localeData = Object.create(null);
	}
	static {
		this.availableLocales = /* @__PURE__ */ new Set();
	}
	static getDefaultLocale() {
		return getDefaultLocale();
	}
	static {
		this.relevantExtensionKeys = [];
	}
	static {
		this.polyfilled = true;
	}
};
Object.defineProperty(PluralRules, "__defaultLocale", {
	configurable: true,
	enumerable: true,
	get: getDefaultLocale,
	set(locale) {
		defaultLocale = locale;
	}
});
Object.setPrototypeOf(PluralRules.prototype, Object.prototype);
try {
	if (typeof Symbol !== "undefined") Object.defineProperty(PluralRules.prototype, Symbol.toStringTag, {
		value: "Intl.PluralRules",
		writable: false,
		enumerable: false,
		configurable: true
	});
	try {
		Object.defineProperty(PluralRules, "length", {
			value: 0,
			writable: false,
			enumerable: false,
			configurable: true
		});
	} catch {}
	Object.defineProperty(PluralRules.prototype.constructor, "length", {
		value: 0,
		writable: false,
		enumerable: false,
		configurable: true
	});
	Object.defineProperty(PluralRules.supportedLocalesOf, "length", {
		value: 1,
		writable: false,
		enumerable: false,
		configurable: true
	});
	Object.defineProperty(PluralRules, "name", {
		value: "PluralRules",
		writable: false,
		enumerable: false,
		configurable: true
	});
} catch {}
// node_modules/.aspect_rules_js/@formatjs_generated+cldr.supported-locales@0.0.0/node_modules/@formatjs_generated/cldr.supported-locales/intl-pluralrules.js
const supportedLocales = [
	"af",
	"ak",
	"am",
	"an",
	"ar",
	"ars",
	"as",
	"asa",
	"ast",
	"az",
	"bal",
	"be",
	"bem",
	"bez",
	"bg",
	"bho",
	"blo",
	"bm",
	"bn",
	"bo",
	"br",
	"brx",
	"bs",
	"ca",
	"ce",
	"ceb",
	"cgg",
	"chr",
	"ckb",
	"cs",
	"csw",
	"cv",
	"cy",
	"da",
	"de",
	"doi",
	"dsb",
	"dv",
	"dz",
	"ee",
	"el",
	"en",
	"eo",
	"es",
	"et",
	"eu",
	"fa",
	"ff",
	"fi",
	"fil",
	"fo",
	"fr",
	"fur",
	"fy",
	"ga",
	"gd",
	"gl",
	"gsw",
	"gu",
	"guw",
	"gv",
	"ha",
	"haw",
	"he",
	"hi",
	"hnj",
	"hr",
	"hsb",
	"hu",
	"hy",
	"ia",
	"id",
	"ie",
	"ig",
	"ii",
	"io",
	"is",
	"it",
	"iu",
	"ja",
	"jbo",
	"jgo",
	"jmc",
	"jv",
	"jw",
	"ka",
	"kab",
	"kaj",
	"kcg",
	"kde",
	"kea",
	"kk",
	"kkj",
	"kl",
	"km",
	"kn",
	"ko",
	"kok",
	"kok-Latn",
	"ks",
	"ksb",
	"ksh",
	"ku",
	"kw",
	"ky",
	"lag",
	"lb",
	"lg",
	"lij",
	"lkt",
	"lld",
	"ln",
	"lo",
	"lt",
	"lv",
	"mas",
	"mg",
	"mgo",
	"mk",
	"ml",
	"mn",
	"mo",
	"mr",
	"ms",
	"mt",
	"my",
	"nah",
	"naq",
	"nb",
	"nd",
	"ne",
	"nl",
	"nn",
	"nnh",
	"no",
	"nqo",
	"nr",
	"nso",
	"ny",
	"nyn",
	"om",
	"or",
	"os",
	"osa",
	"pa",
	"pap",
	"pcm",
	"pl",
	"prg",
	"ps",
	"pt",
	"pt-PT",
	"rm",
	"ro",
	"rof",
	"ru",
	"rwk",
	"sah",
	"saq",
	"sat",
	"sc",
	"scn",
	"sd",
	"sdh",
	"se",
	"seh",
	"ses",
	"sg",
	"sgs",
	"sh",
	"shi",
	"si",
	"sk",
	"sl",
	"sma",
	"smi",
	"smj",
	"smn",
	"sms",
	"sn",
	"so",
	"sq",
	"sr",
	"ss",
	"ssy",
	"st",
	"su",
	"sv",
	"sw",
	"syr",
	"ta",
	"te",
	"teo",
	"tg",
	"th",
	"ti",
	"tig",
	"tk",
	"tl",
	"tn",
	"to",
	"tpi",
	"tr",
	"ts",
	"tzm",
	"ug",
	"uk",
	"und",
	"ur",
	"uz",
	"ve",
	"vec",
	"vi",
	"vo",
	"vun",
	"wa",
	"wae",
	"wo",
	"xh",
	"xog",
	"yi",
	"yo",
	"yue",
	"zh",
	"zu"
];
// packages/intl-pluralrules/should-polyfill.ts
function supportedLocalesOf(locale) {
	if (!locale) return true;
	const locales = Array.isArray(locale) ? locale : [locale];
	return Intl.PluralRules.supportedLocalesOf(locales).length === locales.length;
}
function supportsSourcePrecision() {
	const keep = new Intl.PluralRules("en");
	const strip = new Intl.PluralRules("en", { trailingZeroDisplay: "stripToMinimum" });
	return keep.select("1.0") === "other" && keep.select(1) === "one" && strip.select("1.0") === "one";
}
function shouldPolyfill(locale = "en") {
	try {
		if (typeof Intl !== "undefined" && typeof Intl.PluralRules === "function" && typeof Intl.PluralRules.supportedLocalesOf === "function" && supportsSourcePrecision() && new Intl.PluralRules("en", { minimumFractionDigits: 2 }).select(1) !== "one" && supportedLocalesOf(locale)) return void 0;
	} catch {}
	return locale ? match([locale], supportedLocales, "en") : void 0;
}
// packages/intl-pluralrules/polyfill.ts
const intl = ensureIntl();
if (shouldPolyfill()) {
	defineProperty(intl, "PluralRules", { value: PluralRules });
	registerFormatterIntrinsic(intl, "PluralRules", PluralRules);
	const buf = globalThis.__FORMATJS_PLURALRULES_DATA__;
	if (buf) {
		for (const d of buf) PluralRules.__addLocaleData(d);
		delete globalThis.__FORMATJS_PLURALRULES_DATA__;
	}
}

//# sourceMappingURL=polyfill.iife.js.map