import e from "./exponent.js";
import t from "./formatGroup.js";
import n from "./formatNumerals.js";
import r from "./formatSpecifier.js";
import i from "./formatTrim.js";
import { prefixExponent as a } from "./formatPrefixAuto.js";
import o from "./formatTypes.js";
import s from "./identity.js";
//#region ../../node_modules/d3-format/src/locale.js
var c = Array.prototype.map, l = [
	"y",
	"z",
	"a",
	"f",
	"p",
	"n",
	"µ",
	"m",
	"",
	"k",
	"M",
	"G",
	"T",
	"P",
	"E",
	"Z",
	"Y"
];
function u(u) {
	var d = u.grouping === void 0 || u.thousands === void 0 ? s : t(c.call(u.grouping, Number), u.thousands + ""), f = u.currency === void 0 ? "" : u.currency[0] + "", p = u.currency === void 0 ? "" : u.currency[1] + "", m = u.decimal === void 0 ? "." : u.decimal + "", h = u.numerals === void 0 ? s : n(c.call(u.numerals, String)), g = u.percent === void 0 ? "%" : u.percent + "", _ = u.minus === void 0 ? "-" : u.minus + "", v = u.nan === void 0 ? "NaN" : u.nan + "";
	function y(e) {
		e = r(e);
		var t = e.fill, n = e.align, s = e.sign, c = e.symbol, u = e.zero, y = e.width, b = e.comma, x = e.precision, S = e.trim, C = e.type;
		C === "n" ? (b = !0, C = "g") : o[C] || (x === void 0 && (x = 12), S = !0, C = "g"), (u || t === "0" && n === "=") && (u = !0, t = "0", n = "=");
		var w = c === "$" ? f : c === "#" && /[boxX]/.test(C) ? "0" + C.toLowerCase() : "", T = c === "$" ? p : /[%p]/.test(C) ? g : "", E = o[C], D = /[defgprs%]/.test(C);
		x = x === void 0 ? 6 : /[gprs]/.test(C) ? Math.max(1, Math.min(21, x)) : Math.max(0, Math.min(20, x));
		function O(e) {
			var r = w, o = T, c, f, p;
			if (C === "c") o = E(e) + o, e = "";
			else {
				e = +e;
				var g = e < 0 || 1 / e < 0;
				if (e = isNaN(e) ? v : E(Math.abs(e), x), S && (e = i(e)), g && +e == 0 && s !== "+" && (g = !1), r = (g ? s === "(" ? s : _ : s === "-" || s === "(" ? "" : s) + r, o = (C === "s" ? l[8 + a / 3] : "") + o + (g && s === "(" ? ")" : ""), D) {
					for (c = -1, f = e.length; ++c < f;) if (p = e.charCodeAt(c), 48 > p || p > 57) {
						o = (p === 46 ? m + e.slice(c + 1) : e.slice(c)) + o, e = e.slice(0, c);
						break;
					}
				}
			}
			b && !u && (e = d(e, Infinity));
			var O = r.length + e.length + o.length, k = O < y ? Array(y - O + 1).join(t) : "";
			switch (b && u && (e = d(k + e, k.length ? y - o.length : Infinity), k = ""), n) {
				case "<":
					e = r + e + o + k;
					break;
				case "=":
					e = r + k + e + o;
					break;
				case "^":
					e = k.slice(0, O = k.length >> 1) + r + e + o + k.slice(O);
					break;
				default:
					e = k + r + e + o;
					break;
			}
			return h(e);
		}
		return O.toString = function() {
			return e + "";
		}, O;
	}
	function b(t, n) {
		var i = y((t = r(t), t.type = "f", t)), a = Math.max(-8, Math.min(8, Math.floor(e(n) / 3))) * 3, o = 10 ** -a, s = l[8 + a / 3];
		return function(e) {
			return i(o * e) + s;
		};
	}
	return {
		format: y,
		formatPrefix: b
	};
}
//#endregion
export { u as default };

//# sourceMappingURL=locale.js.map