@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
2,310 lines • 54.1 kB
JavaScript
"use client";
function d(e, t) {
const i = t && t.cache ? t.cache : re, n = t && t.serializer ? t.serializer : ne;
return (t && t.strategy ? t.strategy : te)(e, {
cache: i,
serializer: n
});
}
function K(e) {
return e == null || typeof e == "number" || typeof e == "boolean";
}
function ee(e, t, i, n) {
const r = K(n) ? n : i(n);
let s = t.get(r);
return typeof s > "u" && (s = e.call(this, n), t.set(r, s)), s;
}
function k(e, t, i) {
const n = Array.prototype.slice.call(arguments, 3), r = i(n);
let s = t.get(r);
return typeof s > "u" && (s = e.apply(this, n), t.set(r, s)), s;
}
function V(e, t, i, n, r) {
return i.bind(t, e, n, r);
}
function te(e, t) {
const i = e.length === 1 ? ee : k;
return V(e, this, i, t.cache.create(), t.serializer);
}
function ie(e, t) {
return V(e, this, k, t.cache.create(), t.serializer);
}
const ne = function() {
return JSON.stringify(arguments);
};
var se = class {
constructor() {
this.cache = /* @__PURE__ */ Object.create(null);
}
get(e) {
return this.cache[e];
}
set(e, t) {
this.cache[e] = t;
}
};
const re = { create: function() {
return new se();
} }, N = {
variadic: ie
}, he = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;
function oe(e) {
const t = {};
return e.replace(he, (i) => {
const n = i.length;
switch (i[0]) {
case "G":
t.era = n === 4 ? "long" : n === 5 ? "narrow" : "short";
break;
case "y":
t.year = n === 2 ? "2-digit" : "numeric";
break;
case "Y":
case "u":
case "U":
case "r":
throw new RangeError("`Y/u/U/r` (year) patterns are not supported, use `y` instead");
case "q":
case "Q":
throw new RangeError("`q/Q` (quarter) patterns are not supported");
case "M":
case "L":
t.month = [
"numeric",
"2-digit",
"short",
"long",
"narrow"
][n - 1];
break;
case "w":
case "W":
throw new RangeError("`w/W` (week) patterns are not supported");
case "d":
t.day = ["numeric", "2-digit"][n - 1];
break;
case "D":
case "F":
case "g":
throw new RangeError("`D/F/g` (day) patterns are not supported, use `d` instead");
case "E":
t.weekday = n === 4 ? "long" : n === 5 ? "narrow" : "short";
break;
case "e":
if (n < 4) throw new RangeError("`e..eee` (weekday) patterns are not supported");
t.weekday = [
"short",
"long",
"narrow",
"short"
][n - 4];
break;
case "c":
if (n < 4) throw new RangeError("`c..ccc` (weekday) patterns are not supported");
t.weekday = [
"short",
"long",
"narrow",
"short"
][n - 4];
break;
case "a":
t.hour12 = !0;
break;
case "b":
case "B":
throw new RangeError("`b/B` (period) patterns are not supported, use `a` instead");
case "h":
t.hourCycle = "h12", t.hour = ["numeric", "2-digit"][n - 1];
break;
case "H":
t.hourCycle = "h23", t.hour = ["numeric", "2-digit"][n - 1];
break;
case "K":
t.hourCycle = "h11", t.hour = ["numeric", "2-digit"][n - 1];
break;
case "k":
t.hourCycle = "h24", t.hour = ["numeric", "2-digit"][n - 1];
break;
case "j":
case "J":
case "C":
throw new RangeError("`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead");
case "m":
t.minute = ["numeric", "2-digit"][n - 1];
break;
case "s":
t.second = ["numeric", "2-digit"][n - 1];
break;
case "S":
case "A":
throw new RangeError("`S/A` (second) patterns are not supported, use `s` instead");
case "z":
t.timeZoneName = n < 4 ? "short" : "long";
break;
case "Z":
case "O":
case "v":
case "V":
case "X":
case "x":
throw new RangeError("`Z/O/v/V/X/x` (timeZone) patterns are not supported, use `z` instead");
}
return "";
}), t;
}
const ae = /[\t-\r \x85\u200E\u200F\u2028\u2029]/i;
function ue(e) {
if (e.length === 0) throw new Error("Number skeleton cannot be empty");
const t = e.split(ae).filter((n) => n.length > 0), i = [];
for (const n of t) {
let r = n.split("/");
if (r.length === 0) throw new Error("Invalid number skeleton");
const [s, ...c] = r;
for (const o of c) if (o.length === 0) throw new Error("Invalid number skeleton");
i.push({
stem: s,
options: c
});
}
return i;
}
function ce(e) {
return e.replace(/^(.*?)-/, "");
}
const M = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g, X = /^(@+)?(\+|#+)?[rs]?$/g, le = /(\*)(0+)|(#+)(0+)|(0+)/g, x = /^(0+)$/;
function O(e) {
const t = {};
return e[e.length - 1] === "r" ? t.roundingPriority = "morePrecision" : e[e.length - 1] === "s" && (t.roundingPriority = "lessPrecision"), e.replace(X, function(i, n, r) {
return typeof r != "string" ? (t.minimumSignificantDigits = n.length, t.maximumSignificantDigits = n.length) : r === "+" ? t.minimumSignificantDigits = n.length : n[0] === "#" ? t.maximumSignificantDigits = n.length : (t.minimumSignificantDigits = n.length, t.maximumSignificantDigits = n.length + (typeof r == "string" ? r.length : 0)), "";
}), t;
}
function W(e) {
switch (e) {
case "sign-auto":
return { signDisplay: "auto" };
case "sign-accounting":
case "()":
return { currencySign: "accounting" };
case "sign-always":
case "+!":
return { signDisplay: "always" };
case "sign-accounting-always":
case "()!":
return {
signDisplay: "always",
currencySign: "accounting"
};
case "sign-except-zero":
case "+?":
return { signDisplay: "exceptZero" };
case "sign-accounting-except-zero":
case "()?":
return {
signDisplay: "exceptZero",
currencySign: "accounting"
};
case "sign-never":
case "+_":
return { signDisplay: "never" };
}
}
function fe(e) {
let t;
if (e[0] === "E" && e[1] === "E" ? (t = { notation: "engineering" }, e = e.slice(2)) : e[0] === "E" && (t = { notation: "scientific" }, e = e.slice(1)), t) {
const i = e.slice(0, 2);
if (i === "+!" ? (t.signDisplay = "always", e = e.slice(2)) : i === "+?" && (t.signDisplay = "exceptZero", e = e.slice(2)), !x.test(e)) throw new Error("Malformed concise eng/scientific notation");
t.minimumIntegerDigits = e.length;
}
return t;
}
function G(e) {
const t = {}, i = W(e);
return i || t;
}
function pe(e) {
let t = {};
for (const i of e) {
switch (i.stem) {
case "percent":
case "%":
t.style = "percent";
continue;
case "%x100":
t.style = "percent", t.scale = 100;
continue;
case "currency":
t.style = "currency", t.currency = i.options[0];
continue;
case "group-off":
case ",_":
t.useGrouping = !1;
continue;
case "precision-integer":
case ".":
t.maximumFractionDigits = 0;
continue;
case "measure-unit":
case "unit":
t.style = "unit", t.unit = ce(i.options[0]);
continue;
case "compact-short":
case "K":
t.notation = "compact", t.compactDisplay = "short";
continue;
case "compact-long":
case "KK":
t.notation = "compact", t.compactDisplay = "long";
continue;
case "scientific":
t = {
...t,
notation: "scientific",
...i.options.reduce((s, c) => ({
...s,
...G(c)
}), {})
};
continue;
case "engineering":
t = {
...t,
notation: "engineering",
...i.options.reduce((s, c) => ({
...s,
...G(c)
}), {})
};
continue;
case "notation-simple":
t.notation = "standard";
continue;
case "unit-width-narrow":
t.currencyDisplay = "narrowSymbol", t.unitDisplay = "narrow";
continue;
case "unit-width-short":
t.currencyDisplay = "code", t.unitDisplay = "short";
continue;
case "unit-width-full-name":
t.currencyDisplay = "name", t.unitDisplay = "long";
continue;
case "unit-width-iso-code":
t.currencyDisplay = "symbol";
continue;
case "scale":
t.scale = parseFloat(i.options[0]);
continue;
case "rounding-mode-floor":
t.roundingMode = "floor";
continue;
case "rounding-mode-ceiling":
t.roundingMode = "ceil";
continue;
case "rounding-mode-down":
t.roundingMode = "trunc";
continue;
case "rounding-mode-up":
t.roundingMode = "expand";
continue;
case "rounding-mode-half-even":
t.roundingMode = "halfEven";
continue;
case "rounding-mode-half-down":
t.roundingMode = "halfTrunc";
continue;
case "rounding-mode-half-up":
t.roundingMode = "halfExpand";
continue;
case "integer-width":
if (i.options.length > 1) throw new RangeError("integer-width stems only accept a single optional option");
i.options[0].replace(le, function(s, c, o, h, p, a) {
if (c) t.minimumIntegerDigits = o.length;
else {
if (h && p) throw new Error("We currently do not support maximum integer digits");
if (a) throw new Error("We currently do not support exact integer digits");
}
return "";
});
continue;
}
if (x.test(i.stem)) {
t.minimumIntegerDigits = i.stem.length;
continue;
}
if (M.test(i.stem)) {
if (i.options.length > 1) throw new RangeError("Fraction-precision stems only accept a single optional option");
i.stem.replace(M, function(c, o, h, p, a, u) {
return h === "*" ? t.minimumFractionDigits = o.length : p && p[0] === "#" ? t.maximumFractionDigits = p.length : a && u ? (t.minimumFractionDigits = a.length, t.maximumFractionDigits = a.length + u.length) : (t.minimumFractionDigits = o.length, t.maximumFractionDigits = o.length), "";
});
const s = i.options[0];
s === "w" ? t = {
...t,
trailingZeroDisplay: "stripIfInteger"
} : s && (t = {
...t,
...O(s)
});
continue;
}
if (X.test(i.stem)) {
t = {
...t,
...O(i.stem)
};
continue;
}
const n = W(i.stem);
n && (t = {
...t,
...n
});
const r = fe(i.stem);
r && (t = {
...t,
...r
});
}
return t;
}
let f = /* @__PURE__ */ (function(e) {
return e[e.EXPECT_ARGUMENT_CLOSING_BRACE = 1] = "EXPECT_ARGUMENT_CLOSING_BRACE", e[e.EMPTY_ARGUMENT = 2] = "EMPTY_ARGUMENT", e[e.MALFORMED_ARGUMENT = 3] = "MALFORMED_ARGUMENT", e[e.EXPECT_ARGUMENT_TYPE = 4] = "EXPECT_ARGUMENT_TYPE", e[e.INVALID_ARGUMENT_TYPE = 5] = "INVALID_ARGUMENT_TYPE", e[e.EXPECT_ARGUMENT_STYLE = 6] = "EXPECT_ARGUMENT_STYLE", e[e.INVALID_NUMBER_SKELETON = 7] = "INVALID_NUMBER_SKELETON", e[e.INVALID_DATE_TIME_SKELETON = 8] = "INVALID_DATE_TIME_SKELETON", e[e.EXPECT_NUMBER_SKELETON = 9] = "EXPECT_NUMBER_SKELETON", e[e.EXPECT_DATE_TIME_SKELETON = 10] = "EXPECT_DATE_TIME_SKELETON", e[e.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE = 11] = "UNCLOSED_QUOTE_IN_ARGUMENT_STYLE", e[e.EXPECT_SELECT_ARGUMENT_OPTIONS = 12] = "EXPECT_SELECT_ARGUMENT_OPTIONS", e[e.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE = 13] = "EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE", e[e.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE = 14] = "INVALID_PLURAL_ARGUMENT_OFFSET_VALUE", e[e.EXPECT_SELECT_ARGUMENT_SELECTOR = 15] = "EXPECT_SELECT_ARGUMENT_SELECTOR", e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR = 16] = "EXPECT_PLURAL_ARGUMENT_SELECTOR", e[e.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT = 17] = "EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT", e[e.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT = 18] = "EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT", e[e.INVALID_PLURAL_ARGUMENT_SELECTOR = 19] = "INVALID_PLURAL_ARGUMENT_SELECTOR", e[e.DUPLICATE_PLURAL_ARGUMENT_SELECTOR = 20] = "DUPLICATE_PLURAL_ARGUMENT_SELECTOR", e[e.DUPLICATE_SELECT_ARGUMENT_SELECTOR = 21] = "DUPLICATE_SELECT_ARGUMENT_SELECTOR", e[e.MISSING_OTHER_CLAUSE = 22] = "MISSING_OTHER_CLAUSE", e[e.INVALID_TAG = 23] = "INVALID_TAG", e[e.INVALID_TAG_NAME = 25] = "INVALID_TAG_NAME", e[e.UNMATCHED_CLOSING_TAG = 26] = "UNMATCHED_CLOSING_TAG", e[e.UNCLOSED_TAG = 27] = "UNCLOSED_TAG", e;
})({}), E = /* @__PURE__ */ (function(e) {
return e[e.literal = 0] = "literal", e[e.argument = 1] = "argument", e[e.number = 2] = "number", e[e.date = 3] = "date", e[e.time = 4] = "time", e[e.select = 5] = "select", e[e.plural = 6] = "plural", e[e.pound = 7] = "pound", e[e.tag = 8] = "tag", e;
})({}), A = /* @__PURE__ */ (function(e) {
return e[e.number = 0] = "number", e[e.dateTime = 1] = "dateTime", e;
})({});
function U(e) {
return e.type === E.literal;
}
function me(e) {
return e.type === E.argument;
}
function Z(e) {
return e.type === E.number;
}
function $(e) {
return e.type === E.date;
}
function j(e) {
return e.type === E.time;
}
function z(e) {
return e.type === E.select;
}
function Q(e) {
return e.type === E.plural;
}
function Ee(e) {
return e.type === E.pound;
}
function J(e) {
return e.type === E.tag;
}
function q(e) {
return !!(e && typeof e == "object" && e.type === A.number);
}
function I(e) {
return !!(e && typeof e == "object" && e.type === A.dateTime);
}
const Y = /[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000]/, _ = {
"001": ["H", "h"],
419: [
"h",
"H",
"hB",
"hb"
],
AC: [
"H",
"h",
"hb",
"hB"
],
AD: ["H", "hB"],
AE: [
"h",
"hB",
"hb",
"H"
],
AF: [
"H",
"hb",
"hB",
"h"
],
AG: [
"h",
"hb",
"H",
"hB"
],
AI: [
"H",
"h",
"hb",
"hB"
],
AL: [
"h",
"H",
"hB"
],
AM: ["H", "hB"],
AO: ["H", "hB"],
AR: [
"h",
"H",
"hB",
"hb"
],
AS: ["h", "H"],
AT: ["H", "hB"],
AU: [
"h",
"hb",
"H",
"hB"
],
AW: ["H", "hB"],
AX: ["H"],
AZ: [
"H",
"hB",
"h"
],
BA: [
"H",
"hB",
"h"
],
BB: [
"h",
"hb",
"H",
"hB"
],
BD: [
"h",
"hB",
"H"
],
BE: ["H", "hB"],
BF: ["H", "hB"],
BG: [
"H",
"hB",
"h"
],
BH: [
"h",
"hB",
"hb",
"H"
],
BI: ["H", "h"],
BJ: ["H", "hB"],
BL: ["H", "hB"],
BM: [
"h",
"hb",
"H",
"hB"
],
BN: [
"hb",
"hB",
"h",
"H"
],
BO: [
"h",
"H",
"hB",
"hb"
],
BQ: ["H"],
BR: ["H", "hB"],
BS: [
"h",
"hb",
"H",
"hB"
],
BT: ["h", "H"],
BW: [
"H",
"h",
"hb",
"hB"
],
BY: ["H", "h"],
BZ: [
"H",
"h",
"hb",
"hB"
],
CA: [
"h",
"hb",
"H",
"hB"
],
CC: [
"H",
"h",
"hb",
"hB"
],
CD: ["hB", "H"],
CF: [
"H",
"h",
"hB"
],
CG: ["H", "hB"],
CH: [
"H",
"hB",
"h"
],
CI: ["H", "hB"],
CK: [
"H",
"h",
"hb",
"hB"
],
CL: [
"h",
"H",
"hB",
"hb"
],
CM: [
"H",
"h",
"hB"
],
CN: [
"H",
"hB",
"hb",
"h"
],
CO: [
"h",
"H",
"hB",
"hb"
],
CP: ["H"],
CR: [
"h",
"H",
"hB",
"hb"
],
CU: [
"h",
"H",
"hB",
"hb"
],
CV: ["H", "hB"],
CW: ["H", "hB"],
CX: [
"H",
"h",
"hb",
"hB"
],
CY: [
"h",
"H",
"hb",
"hB"
],
CZ: ["H"],
DE: ["H", "hB"],
DG: [
"H",
"h",
"hb",
"hB"
],
DJ: ["h", "H"],
DK: ["H"],
DM: [
"h",
"hb",
"H",
"hB"
],
DO: [
"h",
"H",
"hB",
"hb"
],
DZ: [
"h",
"hB",
"hb",
"H"
],
EA: [
"H",
"h",
"hB",
"hb"
],
EC: [
"h",
"H",
"hB",
"hb"
],
EE: ["H", "hB"],
EG: [
"h",
"hB",
"hb",
"H"
],
EH: [
"h",
"hB",
"hb",
"H"
],
ER: ["h", "H"],
ES: [
"H",
"hB",
"h",
"hb"
],
ET: [
"hB",
"hb",
"h",
"H"
],
FI: ["H"],
FJ: [
"h",
"hb",
"H",
"hB"
],
FK: [
"H",
"h",
"hb",
"hB"
],
FM: [
"h",
"hb",
"H",
"hB"
],
FO: ["H", "h"],
FR: ["H", "hB"],
GA: ["H", "hB"],
GB: [
"H",
"h",
"hb",
"hB"
],
GD: [
"h",
"hb",
"H",
"hB"
],
GE: [
"H",
"hB",
"h"
],
GF: ["H", "hB"],
GG: [
"H",
"h",
"hb",
"hB"
],
GH: ["h", "H"],
GI: [
"H",
"h",
"hb",
"hB"
],
GL: ["H", "h"],
GM: [
"h",
"hb",
"H",
"hB"
],
GN: ["H", "hB"],
GP: ["H", "hB"],
GQ: [
"H",
"hB",
"h",
"hb"
],
GR: [
"h",
"H",
"hb",
"hB"
],
GS: [
"H",
"h",
"hb",
"hB"
],
GT: [
"h",
"H",
"hB",
"hb"
],
GU: [
"h",
"hb",
"H",
"hB"
],
GW: ["H", "hB"],
GY: [
"h",
"hb",
"H",
"hB"
],
HK: [
"h",
"hB",
"hb",
"H"
],
HN: [
"h",
"H",
"hB",
"hb"
],
HR: ["H", "hB"],
HU: ["H", "h"],
IC: [
"H",
"h",
"hB",
"hb"
],
ID: ["H"],
IE: [
"H",
"h",
"hb",
"hB"
],
IL: ["H", "hB"],
IM: [
"H",
"h",
"hb",
"hB"
],
IN: ["h", "H"],
IO: [
"H",
"h",
"hb",
"hB"
],
IQ: [
"h",
"hB",
"hb",
"H"
],
IR: ["hB", "H"],
IS: ["H"],
IT: ["H", "hB"],
JE: [
"H",
"h",
"hb",
"hB"
],
JM: [
"h",
"hb",
"H",
"hB"
],
JO: [
"h",
"hB",
"hb",
"H"
],
JP: [
"H",
"K",
"h"
],
KE: [
"hB",
"hb",
"H",
"h"
],
KG: [
"H",
"h",
"hB",
"hb"
],
KH: [
"hB",
"h",
"H",
"hb"
],
KI: [
"h",
"hb",
"H",
"hB"
],
KM: [
"H",
"h",
"hB",
"hb"
],
KN: [
"h",
"hb",
"H",
"hB"
],
KP: [
"h",
"H",
"hB",
"hb"
],
KR: [
"h",
"H",
"hB",
"hb"
],
KW: [
"h",
"hB",
"hb",
"H"
],
KY: [
"h",
"hb",
"H",
"hB"
],
KZ: ["H", "hB"],
LA: [
"H",
"hb",
"hB",
"h"
],
LB: [
"h",
"hB",
"hb",
"H"
],
LC: [
"h",
"hb",
"H",
"hB"
],
LI: [
"H",
"hB",
"h"
],
LK: [
"H",
"h",
"hB",
"hb"
],
LR: [
"h",
"hb",
"H",
"hB"
],
LS: ["h", "H"],
LT: [
"H",
"h",
"hb",
"hB"
],
LU: [
"H",
"h",
"hB"
],
LV: [
"H",
"hB",
"hb",
"h"
],
LY: [
"h",
"hB",
"hb",
"H"
],
MA: [
"H",
"h",
"hB",
"hb"
],
MC: ["H", "hB"],
MD: ["H", "hB"],
ME: [
"H",
"hB",
"h"
],
MF: ["H", "hB"],
MG: ["H", "h"],
MH: [
"h",
"hb",
"H",
"hB"
],
MK: [
"H",
"h",
"hb",
"hB"
],
ML: ["H"],
MM: [
"hB",
"hb",
"H",
"h"
],
MN: [
"H",
"h",
"hb",
"hB"
],
MO: [
"h",
"hB",
"hb",
"H"
],
MP: [
"h",
"hb",
"H",
"hB"
],
MQ: ["H", "hB"],
MR: [
"h",
"hB",
"hb",
"H"
],
MS: [
"H",
"h",
"hb",
"hB"
],
MT: ["H", "h"],
MU: ["H", "h"],
MV: ["H", "h"],
MW: [
"h",
"hb",
"H",
"hB"
],
MX: [
"h",
"H",
"hB",
"hb"
],
MY: [
"hb",
"hB",
"h",
"H"
],
MZ: ["H", "hB"],
NA: [
"h",
"H",
"hB",
"hb"
],
NC: ["H", "hB"],
NE: ["H"],
NF: [
"H",
"h",
"hb",
"hB"
],
NG: [
"H",
"h",
"hb",
"hB"
],
NI: [
"h",
"H",
"hB",
"hb"
],
NL: ["H", "hB"],
NO: ["H", "h"],
NP: [
"H",
"h",
"hB"
],
NR: [
"H",
"h",
"hb",
"hB"
],
NU: [
"H",
"h",
"hb",
"hB"
],
NZ: [
"h",
"hb",
"H",
"hB"
],
OM: [
"h",
"hB",
"hb",
"H"
],
PA: [
"h",
"H",
"hB",
"hb"
],
PE: [
"h",
"H",
"hB",
"hb"
],
PF: [
"H",
"h",
"hB"
],
PG: ["h", "H"],
PH: [
"h",
"hB",
"hb",
"H"
],
PK: [
"h",
"hB",
"H"
],
PL: ["H", "h"],
PM: ["H", "hB"],
PN: [
"H",
"h",
"hb",
"hB"
],
PR: [
"h",
"H",
"hB",
"hb"
],
PS: [
"h",
"hB",
"hb",
"H"
],
PT: ["H", "hB"],
PW: ["h", "H"],
PY: [
"h",
"H",
"hB",
"hb"
],
QA: [
"h",
"hB",
"hb",
"H"
],
RE: ["H", "hB"],
RO: ["H", "hB"],
RS: [
"H",
"hB",
"h"
],
RU: ["H"],
RW: ["H", "h"],
SA: [
"h",
"hB",
"hb",
"H"
],
SB: [
"h",
"hb",
"H",
"hB"
],
SC: [
"H",
"h",
"hB"
],
SD: [
"h",
"hB",
"hb",
"H"
],
SE: ["H"],
SG: [
"h",
"hb",
"H",
"hB"
],
SH: [
"H",
"h",
"hb",
"hB"
],
SI: ["H", "hB"],
SJ: ["H"],
SK: ["H"],
SL: [
"h",
"hb",
"H",
"hB"
],
SM: [
"H",
"h",
"hB"
],
SN: [
"H",
"h",
"hB"
],
SO: ["h", "H"],
SR: ["H", "hB"],
SS: [
"h",
"hb",
"H",
"hB"
],
ST: ["H", "hB"],
SV: [
"h",
"H",
"hB",
"hb"
],
SX: [
"H",
"h",
"hb",
"hB"
],
SY: [
"h",
"hB",
"hb",
"H"
],
SZ: [
"h",
"hb",
"H",
"hB"
],
TA: [
"H",
"h",
"hb",
"hB"
],
TC: [
"h",
"hb",
"H",
"hB"
],
TD: [
"h",
"H",
"hB"
],
TF: [
"H",
"h",
"hB"
],
TG: ["H", "hB"],
TH: ["H", "h"],
TJ: ["H", "h"],
TL: [
"H",
"hB",
"hb",
"h"
],
TM: ["H", "h"],
TN: [
"h",
"hB",
"hb",
"H"
],
TO: ["h", "H"],
TR: ["H", "hB"],
TT: [
"h",
"hb",
"H",
"hB"
],
TW: [
"hB",
"hb",
"h",
"H"
],
TZ: [
"hB",
"hb",
"H",
"h"
],
UA: [
"H",
"hB",
"h"
],
UG: [
"hB",
"hb",
"H",
"h"
],
UM: [
"h",
"hb",
"H",
"hB"
],
US: [
"h",
"hb",
"H",
"hB"
],
UY: [
"h",
"H",
"hB",
"hb"
],
UZ: [
"H",
"hB",
"h"
],
VA: [
"H",
"h",
"hB"
],
VC: [
"h",
"hb",
"H",
"hB"
],
VE: [
"h",
"H",
"hB",
"hb"
],
VG: [
"h",
"hb",
"H",
"hB"
],
VI: [
"h",
"hb",
"H",
"hB"
],
VN: ["H", "h"],
VU: ["h", "H"],
WF: ["H", "hB"],
WS: ["h", "H"],
XK: [
"H",
"hB",
"h"
],
YE: [
"h",
"hB",
"hb",
"H"
],
YT: ["H", "hB"],
ZA: [
"H",
"h",
"hb",
"hB"
],
ZM: [
"h",
"hb",
"H",
"hB"
],
ZW: ["H", "h"],
"af-ZA": [
"H",
"h",
"hB",
"hb"
],
"ar-001": [
"h",
"hB",
"hb",
"H"
],
"ca-ES": [
"H",
"h",
"hB"
],
"en-001": [
"h",
"hb",
"H",
"hB"
],
"en-HK": [
"h",
"hb",
"H",
"hB"
],
"en-IL": [
"H",
"h",
"hb",
"hB"
],
"en-MY": [
"h",
"hb",
"H",
"hB"
],
"es-BR": [
"H",
"h",
"hB",
"hb"
],
"es-ES": [
"H",
"h",
"hB",
"hb"
],
"es-GQ": [
"H",
"h",
"hB",
"hb"
],
"fr-CA": [
"H",
"h",
"hB"
],
"gl-ES": [
"H",
"h",
"hB"
],
"gu-IN": [
"hB",
"hb",
"h",
"H"
],
"hi-IN": [
"hB",
"h",
"H"
],
"it-CH": [
"H",
"h",
"hB"
],
"it-IT": [
"H",
"h",
"hB"
],
"kn-IN": [
"hB",
"h",
"H"
],
"ku-SY": ["H", "hB"],
"ml-IN": [
"hB",
"h",
"H"
],
"mr-IN": [
"hB",
"hb",
"h",
"H"
],
"pa-IN": [
"hB",
"hb",
"h",
"H"
],
"ta-IN": [
"hB",
"h",
"hb",
"H"
],
"te-IN": [
"hB",
"h",
"H"
],
"zu-ZA": [
"H",
"hB",
"hb",
"h"
]
};
function be(e, t) {
let i = "";
for (let n = 0; n < e.length; n++) {
const r = e.charAt(n);
if (r === "j") {
let s = 0;
for (; n + 1 < e.length && e.charAt(n + 1) === r; )
s++, n++;
let c = 1 + (s & 1), o = s < 2 ? 1 : 3 + (s >> 1), h = "a", p = ge(t);
for ((p == "H" || p == "k") && (o = 0); o-- > 0; ) i += h;
for (; c-- > 0; ) i = p + i;
} else r === "J" ? i += "H" : i += r;
}
return i;
}
function ge(e) {
let t = e.hourCycle;
if (t === void 0 && e.hourCycles && e.hourCycles.length && (t = e.hourCycles[0]), t) switch (t) {
case "h24":
return "k";
case "h23":
return "H";
case "h12":
return "h";
case "h11":
return "K";
default:
throw new Error("Invalid hourCycle");
}
const i = e.language;
let n;
return i !== "root" && (n = e.maximize().region), (_[n || ""] || _[i || ""] || _[`${i}-001`] || _["001"])[0];
}
const He = new RegExp(`^${Y.source}*`), Be = new RegExp(`${Y.source}*$`);
function l(e, t) {
return {
start: e,
end: t
};
}
const Te = !!Object.fromEntries, _e = !!String.prototype.trimStart, ye = !!String.prototype.trimEnd, w = Te ? Object.fromEntries : function(t) {
const i = {};
for (const [n, r] of t) i[n] = r;
return i;
}, Ae = _e ? function(t) {
return t.trimStart();
} : function(t) {
return t.replace(He, "");
}, Se = ye ? function(t) {
return t.trimEnd();
} : function(t) {
return t.replace(Be, "");
}, D = /* @__PURE__ */ new RegExp("([^\\p{White_Space}\\p{Pattern_Syntax}]*)", "yu");
function Le(e, t) {
return D.lastIndex = t, D.exec(e)[1] ?? "";
}
var de = class {
constructor(e, t = {}) {
this.message = e, this.position = {
offset: 0,
line: 1,
column: 1
}, this.ignoreTag = !!t.ignoreTag, this.locale = t.locale, this.requiresOtherClause = !!t.requiresOtherClause, this.shouldParseSkeletons = !!t.shouldParseSkeletons;
}
parse() {
if (this.offset() !== 0) throw Error("parser can only be used once");
return this.parseMessage(0, "", !1);
}
parseMessage(e, t, i) {
let n = [];
for (; !this.isEOF(); ) {
const r = this.char();
if (r === 123) {
const s = this.parseArgument(e, i);
if (s.err) return s;
n.push(s.val);
} else {
if (r === 125 && e > 0) break;
if (r === 35 && (t === "plural" || t === "selectordinal")) {
const s = this.clonePosition();
this.bump(), n.push({
type: E.pound,
location: l(s, this.clonePosition())
});
} else if (r === 60 && !this.ignoreTag && this.peek() === 47) {
if (i) break;
return this.error(f.UNMATCHED_CLOSING_TAG, l(this.clonePosition(), this.clonePosition()));
} else if (r === 60 && !this.ignoreTag && R(this.peek() || 0)) {
const s = this.parseTag(e, t);
if (s.err) return s;
n.push(s.val);
} else {
const s = this.parseLiteral(e, t);
if (s.err) return s;
n.push(s.val);
}
}
}
return {
val: n,
err: null
};
}
/**
* A tag name must start with an ASCII lower/upper case letter. The grammar is based on the
* [custom element name][] except that a dash is NOT always mandatory and uppercase letters
* are accepted:
*
* ```
* tag ::= "<" tagName (whitespace)* "/>" | "<" tagName (whitespace)* ">" message "</" tagName (whitespace)* ">"
* tagName ::= [a-z] (PENChar)*
* PENChar ::=
* "-" | "." | [0-9] | "_" | [a-z] | [A-Z] | #xB7 | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x37D] |
* [#x37F-#x1FFF] | [#x200C-#x200D] | [#x203F-#x2040] | [#x2070-#x218F] | [#x2C00-#x2FEF] |
* [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
* ```
*
* [custom element name]: https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name
* NOTE: We're a bit more lax here since HTML technically does not allow uppercase HTML element but we do
* since other tag-based engines like React allow it
*/
parseTag(e, t) {
const i = this.clonePosition();
this.bump();
const n = this.parseTagName();
if (this.bumpSpace(), this.bumpIf("/>")) return {
val: {
type: E.literal,
value: `<${n}/>`,
location: l(i, this.clonePosition())
},
err: null
};
if (this.bumpIf(">")) {
const r = this.parseMessage(e + 1, t, !0);
if (r.err) return r;
const s = r.val, c = this.clonePosition();
if (this.bumpIf("</")) {
if (this.isEOF() || !R(this.char())) return this.error(f.INVALID_TAG, l(c, this.clonePosition()));
const o = this.clonePosition();
return n !== this.parseTagName() ? this.error(f.UNMATCHED_CLOSING_TAG, l(o, this.clonePosition())) : (this.bumpSpace(), this.bumpIf(">") ? {
val: {
type: E.tag,
value: n,
children: s,
location: l(i, this.clonePosition())
},
err: null
} : this.error(f.INVALID_TAG, l(c, this.clonePosition())));
} else return this.error(f.UNCLOSED_TAG, l(i, this.clonePosition()));
} else return this.error(f.INVALID_TAG, l(i, this.clonePosition()));
}
/**
* This method assumes that the caller has peeked ahead for the first tag character.
*/
parseTagName() {
const e = this.offset();
for (this.bump(); !this.isEOF() && Pe(this.char()); ) this.bump();
return this.message.slice(e, this.offset());
}
parseLiteral(e, t) {
const i = this.clonePosition();
let n = "";
for (; ; ) {
const s = this.tryParseQuote(t);
if (s) {
n += s;
continue;
}
const c = this.tryParseUnquoted(e, t);
if (c) {
n += c;
continue;
}
const o = this.tryParseLeftAngleBracket();
if (o) {
n += o;
continue;
}
break;
}
const r = l(i, this.clonePosition());
return {
val: {
type: E.literal,
value: n,
location: r
},
err: null
};
}
tryParseLeftAngleBracket() {
return !this.isEOF() && this.char() === 60 && (this.ignoreTag || !Ne(this.peek() || 0)) ? (this.bump(), "<") : null;
}
/**
* Starting with ICU 4.8, an ASCII apostrophe only starts quoted text if it immediately precedes
* a character that requires quoting (that is, "only where needed"), and works the same in
* nested messages as on the top level of the pattern. The new behavior is otherwise compatible.
*/
tryParseQuote(e) {
if (this.isEOF() || this.char() !== 39) return null;
switch (this.peek()) {
case 39:
return this.bump(), this.bump(), "'";
case 123:
case 60:
case 62:
case 125:
break;
case 35:
if (e === "plural" || e === "selectordinal") break;
return null;
default:
return null;
}
this.bump();
const t = [this.char()];
for (this.bump(); !this.isEOF(); ) {
const i = this.char();
if (i === 39) if (this.peek() === 39)
t.push(39), this.bump();
else {
this.bump();
break;
}
else t.push(i);
this.bump();
}
return String.fromCodePoint(...t);
}
tryParseUnquoted(e, t) {
if (this.isEOF()) return null;
const i = this.char();
return i === 60 || i === 123 || i === 35 && (t === "plural" || t === "selectordinal") || i === 125 && e > 0 ? null : (this.bump(), String.fromCodePoint(i));
}
parseArgument(e, t) {
const i = this.clonePosition();
if (this.bump(), this.bumpSpace(), this.isEOF()) return this.error(f.EXPECT_ARGUMENT_CLOSING_BRACE, l(i, this.clonePosition()));
if (this.char() === 125)
return this.bump(), this.error(f.EMPTY_ARGUMENT, l(i, this.clonePosition()));
let n = this.parseIdentifierIfPossible().value;
if (!n) return this.error(f.MALFORMED_ARGUMENT, l(i, this.clonePosition()));
if (this.bumpSpace(), this.isEOF()) return this.error(f.EXPECT_ARGUMENT_CLOSING_BRACE, l(i, this.clonePosition()));
switch (this.char()) {
case 125:
return this.bump(), {
val: {
type: E.argument,
value: n,
location: l(i, this.clonePosition())
},
err: null
};
case 44:
return this.bump(), this.bumpSpace(), this.isEOF() ? this.error(f.EXPECT_ARGUMENT_CLOSING_BRACE, l(i, this.clonePosition())) : this.parseArgumentOptions(e, t, n, i);
default:
return this.error(f.MALFORMED_ARGUMENT, l(i, this.clonePosition()));
}
}
/**
* Advance the parser until the end of the identifier, if it is currently on
* an identifier character. Return an empty string otherwise.
*/
parseIdentifierIfPossible() {
const e = this.clonePosition(), t = this.offset(), i = Le(this.message, t), n = t + i.length;
return this.bumpTo(n), {
value: i,
location: l(e, this.clonePosition())
};
}
parseArgumentOptions(e, t, i, n) {
let r = this.clonePosition(), s = this.parseIdentifierIfPossible().value, c = this.clonePosition();
switch (s) {
case "":
return this.error(f.EXPECT_ARGUMENT_TYPE, l(r, c));
case "number":
case "date":
case "time": {
this.bumpSpace();
let o = null;
if (this.bumpIf(",")) {
this.bumpSpace();
const a = this.clonePosition(), u = this.parseSimpleArgStyleIfPossible();
if (u.err) return u;
const m = Se(u.val);
if (m.length === 0) return this.error(f.EXPECT_ARGUMENT_STYLE, l(this.clonePosition(), this.clonePosition()));
o = {
style: m,
styleLocation: l(a, this.clonePosition())
};
}
const h = this.tryParseArgumentClose(n);
if (h.err) return h;
const p = l(n, this.clonePosition());
if (o && o.style.startsWith("::")) {
let a = Ae(o.style.slice(2));
if (s === "number") {
const u = this.parseNumberSkeletonFromString(a, o.styleLocation);
return u.err ? u : {
val: {
type: E.number,
value: i,
location: p,
style: u.val
},
err: null
};
} else {
if (a.length === 0) return this.error(f.EXPECT_DATE_TIME_SKELETON, p);
let u = a;
this.locale && (u = be(a, this.locale));
const m = {
type: A.dateTime,
pattern: u,
location: o.styleLocation,
parsedOptions: this.shouldParseSkeletons ? oe(u) : {}
};
return {
val: {
type: s === "date" ? E.date : E.time,
value: i,
location: p,
style: m
},
err: null
};
}
}
return {
val: {
type: s === "number" ? E.number : s === "date" ? E.date : E.time,
value: i,
location: p,
style: o?.style ?? null
},
err: null
};
}
case "plural":
case "selectordinal":
case "select": {
const o = this.clonePosition();
if (this.bumpSpace(), !this.bumpIf(",")) return this.error(f.EXPECT_SELECT_ARGUMENT_OPTIONS, l(o, { ...o }));
this.bumpSpace();
let h = this.parseIdentifierIfPossible(), p = 0;
if (s !== "select" && h.value === "offset") {
if (!this.bumpIf(":")) return this.error(f.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, l(this.clonePosition(), this.clonePosition()));
this.bumpSpace();
const H = this.tryParseDecimalInteger(f.EXPECT_PLURAL_ARGUMENT_OFFSET_VALUE, f.INVALID_PLURAL_ARGUMENT_OFFSET_VALUE);
if (H.err) return H;
this.bumpSpace(), h = this.parseIdentifierIfPossible(), p = H.val;
}
const a = this.tryParsePluralOrSelectOptions(e, s, t, h);
if (a.err) return a;
const u = this.tryParseArgumentClose(n);
if (u.err) return u;
const m = l(n, this.clonePosition());
return s === "select" ? {
val: {
type: E.select,
value: i,
options: w(a.val),
location: m
},
err: null
} : {
val: {
type: E.plural,
value: i,
options: w(a.val),
offset: p,
pluralType: s === "plural" ? "cardinal" : "ordinal",
location: m
},
err: null
};
}
default:
return this.error(f.INVALID_ARGUMENT_TYPE, l(r, c));
}
}
tryParseArgumentClose(e) {
return this.isEOF() || this.char() !== 125 ? this.error(f.EXPECT_ARGUMENT_CLOSING_BRACE, l(e, this.clonePosition())) : (this.bump(), {
val: !0,
err: null
});
}
/**
* See: https://github.com/unicode-org/icu/blob/af7ed1f6d2298013dc303628438ec4abe1f16479/icu4c/source/common/messagepattern.cpp#L659
*/
parseSimpleArgStyleIfPossible() {
let e = 0;
const t = this.clonePosition();
for (; !this.isEOF(); ) switch (this.char()) {
case 39: {
this.bump();
let i = this.clonePosition();
if (!this.bumpUntil("'")) return this.error(f.UNCLOSED_QUOTE_IN_ARGUMENT_STYLE, l(i, this.clonePosition()));
this.bump();
break;
}
case 123:
e += 1, this.bump();
break;
case 125:
if (e > 0) e -= 1;
else return {
val: this.message.slice(t.offset, this.offset()),
err: null
};
break;
default:
this.bump();
break;
}
return {
val: this.message.slice(t.offset, this.offset()),
err: null
};
}
parseNumberSkeletonFromString(e, t) {
let i = [];
try {
i = ue(e);
} catch {
return this.error(f.INVALID_NUMBER_SKELETON, t);
}
return {
val: {
type: A.number,
tokens: i,
location: t,
parsedOptions: this.shouldParseSkeletons ? pe(i) : {}
},
err: null
};
}
/**
* @param nesting_level The current nesting level of messages.
* This can be positive when parsing message fragment in select or plural argument options.
* @param parent_arg_type The parent argument's type.
* @param parsed_first_identifier If provided, this is the first identifier-like selector of
* the argument. It is a by-product of a previous parsing attempt.
* @param expecting_close_tag If true, this message is directly or indirectly nested inside
* between a pair of opening and closing tags. The nested message will not parse beyond
* the closing tag boundary.
*/
tryParsePluralOrSelectOptions(e, t, i, n) {
let r = !1;
const s = [], c = /* @__PURE__ */ new Set();
let { value: o, location: h } = n;
for (; ; ) {
if (o.length === 0) {
const m = this.clonePosition();
if (t !== "select" && this.bumpIf("=")) {
const H = this.tryParseDecimalInteger(f.EXPECT_PLURAL_ARGUMENT_SELECTOR, f.INVALID_PLURAL_ARGUMENT_SELECTOR);
if (H.err) return H;
h = l(m, this.clonePosition()), o = this.message.slice(m.offset, this.offset());
} else break;
}
if (c.has(o)) return this.error(t === "select" ? f.DUPLICATE_SELECT_ARGUMENT_SELECTOR : f.DUPLICATE_PLURAL_ARGUMENT_SELECTOR, h);
o === "other" && (r = !0), this.bumpSpace();
const p = this.clonePosition();
if (!this.bumpIf("{")) return this.error(t === "select" ? f.EXPECT_SELECT_ARGUMENT_SELECTOR_FRAGMENT : f.EXPECT_PLURAL_ARGUMENT_SELECTOR_FRAGMENT, l(this.clonePosition(), this.clonePosition()));
const a = this.parseMessage(e + 1, t, i);
if (a.err) return a;
const u = this.tryParseArgumentClose(p);
if (u.err) return u;
s.push([o, {
value: a.val,
location: l(p, this.clonePosition())
}]), c.add(o), this.bumpSpace(), { value: o, location: h } = this.parseIdentifierIfPossible();
}
return s.length === 0 ? this.error(t === "select" ? f.EXPECT_SELECT_ARGUMENT_SELECTOR : f.EXPECT_PLURAL_ARGUMENT_SELECTOR, l(this.clonePosition(), this.clonePosition())) : this.requiresOtherClause && !r ? this.error(f.MISSING_OTHER_CLAUSE, l(this.clonePosition(), this.clonePosition())) : {
val: s,
err: null
};
}
tryParseDecimalInteger(e, t) {
let i = 1;
const n = this.clonePosition();
this.bumpIf("+") || this.bumpIf("-") && (i = -1);
let r = !1, s = 0;
for (; !this.isEOF(); ) {
const o = this.char();
if (o >= 48 && o <= 57)
r = !0, s = s * 10 + (o - 48), this.bump();
else break;
}
const c = l(n, this.clonePosition());
return r ? (s *= i, Number.isSafeInteger(s) ? {
val: s,
err: null
} : this.error(t, c)) : this.error(e, c);
}
offset() {
return this.position.offset;
}
isEOF() {
return this.offset() === this.message.length;
}
clonePosition() {
return {
offset: this.position.offset,
line: this.position.line,
column: this.position.column
};
}
/**
* Return the code point at the current position of the parser.
* Throws if the index is out of bound.
*/
char() {
const e = this.position.offset;
if (e >= this.message.length) throw Error("out of bound");
const t = this.message.codePointAt(e);
if (t === void 0) throw Error(`Offset ${e} is at invalid UTF-16 code unit boundary`);
return t;
}
error(e, t) {
return {
val: null,
err: {
kind: e,
message: this.message,
location: t
}
};
}
/** Bump the parser to the next UTF-16 code unit. */
bump() {
if (this.isEOF()) return;
const e = this.char();
e === 10 ? (this.position.line += 1, this.position.column = 1, this.position.offset += 1) : (this.position.column += 1, this.position.offset += e < 65536 ? 1 : 2);
}
/**
* If the substring starting at the current position of the parser has
* the given prefix, then bump the parser to the character immediately
* following the prefix and return true. Otherwise, don't bump the parser
* and return false.
*/
bumpIf(e) {
if (this.message.startsWith(e, this.offset())) {
for (let t = 0; t < e.length; t++) this.bump();
return !0;
}
return !1;
}
/**
* Bump the parser until the pattern character is found and return `true`.
* Otherwise bump to the end of the file and return `false`.
*/
bumpUntil(e) {
const t = this.offset(), i = this.message.indexOf(e, t);
return i >= 0 ? (this.bumpTo(i), !0) : (this.bumpTo(this.message.length), !1);
}
/**
* Bump the parser to the target offset.
* If target offset is beyond the end of the input, bump the parser to the end of the input.
*/
bumpTo(e) {
if (this.offset() > e) throw Error(`targetOffset ${e} must be greater than or equal to the current offset ${this.offset()}`);
for (e = Math.min(e, this.message.length); ; ) {
const t = this.offset();
if (t === e) break;
if (t > e) throw Error(`targetOffset ${e} is at invalid UTF-16 code unit boundary`);
if (this.bump(), this.isEOF()) break;
}
}
/** advance the parser through all whitespace to the next non-whitespace code unit. */
bumpSpace() {
for (; !this.isEOF() && Ie(this.char()); ) this.bump();
}
/**
* Peek at the *next* Unicode codepoint in the input without advancing the parser.
* If the input has been exhausted, then this returns null.
*/
peek() {
if (this.isEOF()) return null;
const e = this.char(), t = this.offset();
return this.message.charCodeAt(t + (e >= 65536 ? 2 : 1)) ?? null;
}
};
function R(e) {
return e >= 97 && e <= 122 || e >= 65 && e <= 90;
}
function Ne(e) {
return R(e) || e === 47;
}
function Pe(e) {
return e === 45 || e === 46 || e >= 48 && e <= 57 || e === 95 || e >= 97 && e <= 122 || e >= 65 && e <= 90 || e == 183 || e >= 192 && e <= 214 || e >= 216 && e <= 246 || e >= 248 && e <= 893 || e >= 895 && e <= 8191 || e >= 8204 && e <= 8205 || e >= 8255 && e <= 8256 || e >= 8304 && e <= 8591 || e >= 11264 && e <= 12271 || e >= 12289 && e <= 55295 || e >= 63744 && e <= 64975 || e >= 65008 && e <= 65533 || e >= 65536 && e <= 983039;
}
function Ie(e) {
return e >= 9 && e <= 13 || e === 32 || e === 133 || e >= 8206 && e <= 8207 || e === 8232 || e === 8233;
}
function C(e) {
e.forEach((t) => {
if (delete t.location, z(t) || Q(t)) for (const i in t.options)
delete t.options[i].location, C(t.options[i].value);
else Z(t) && q(t.style) || ($(t) || j(t)) && I(t.style) ? delete t.style.location : J(t) && C(t.children);
});
}
function Re(e, t = {}) {
t = {
shouldParseSkeletons: !0,
requiresOtherClause: !0,
...t
};
const i = new de(e, t).parse();
if (i.err) {
const n = SyntaxError(f[i.err.kind]);
throw n.location = i.err.location, n.originalMessage = i.err.message, n;
}
return t?.captureLocation || C(i.val), i.val;
}
let S = /* @__PURE__ */ (function(e) {
return e.MISSING_VALUE = "MISSING_VALUE", e.INVALID_VALUE = "INVALID_VALUE", e.MISSING_INTL_API = "MISSING_INTL_API", e;
})({});
var L = class extends Error {
constructor(e, t, i) {
super(e), this.code = t, this.originalMessage = i;
}
toString() {
return `[formatjs Error: ${this.code}] ${this.message}`;
}
}, v = class extends L {
constructor(e, t, i, n) {
super(`Invalid values for "${e}": "${t}". Options are "${Object.keys(i).join('", "')}"`, S.INVALID_VALUE, n);
}
}, Ce = class extends L {
constructor(e, t, i) {
super(`Value for "${e}" must be of type ${t}`, S.INVALID_VALUE, i);
}
}, Me = class extends L {
constructor(e, t) {
super(`The intl string context variable "${e}" was not provided to the string "${t}"`, S.MISSING_VALUE, t);
}
};
let g = /* @__PURE__ */ (function(e) {
return e[e.literal = 0] = "literal", e[e.object = 1] = "object", e;
})({});
function Oe(e) {
return e.length < 2 ? e : e.reduce((t, i) => {
const n = t[t.length - 1];
return !n || n.type !== g.literal || i.type !== g.literal ? t.push(i) : n.value += i.value, t;
}, []);
}
function Ge(e) {
return typeof e == "function";
}
function y(e, t, i, n, r, s, c) {
if (e.length === 1 && U(e[0])) return [{
type: g.literal,
value: e[0].value
}];
const o = [];
for (const h of e) {
if (U(h)) {
o.push({
type: g.literal,
value: h.value
});
continue;
}
if (Ee(h)) {
typeof s == "number" && o.push({
type: g.literal,
value: i.getNumberFormat(t).format(s)
});
continue;
}
const { value: p } = h;
if (!(r && p in r)) throw new Me(p, c);
let a = r[p];
if (me(h)) {
(!a || typeof a == "string" || typeof a == "number" || typeof a == "bigint") && (a = typeof a == "string" || typeof a == "number" || typeof a == "bigint" ? String(a) : ""), o.push({
type: typeof a == "string" ? g.literal : g.object,
value: a
});
continue;
}
if ($(h)) {
const u = typeof h.style == "string" ? n.date[h.style] : I(h.style) ? h.style.parsedOptions : void 0;
o.push({
type: g.literal,
value: i.getDateTimeFormat(t, u).format(a)
});
continue;
}
if (j(h)) {
const u = typeof h.style == "string" ? n.time[h.style] : I(h.style) ? h.style.parsedOptions : n.time.medium;
o.push({
type: g.literal,
value: i.getDateTimeFormat(t, u).format(a)
});
continue;
}
if (Z(h)) {
const u = typeof h.style == "string" ? n.number[h.style] : q(h.style) ? h.style.parsedOptions : void 0;
if (u && u.scale) {
const m = u.scale || 1;
if (typeof a == "bigint") {
if (!Number.isInteger(m)) throw new TypeError(`Cannot apply fractional scale ${m} to bigint value. Scale must be an integer when formatting bigint.`);
a = a * BigInt(m);
} else a = a * m;
}
o.push({
type: g.literal,
value: i.getNumberFormat(t, u).format(a)
});
continue;
}
if (J(h)) {
const { children: u, value: m } = h, H = r[m];
if (!Ge(H)) throw new Ce(m, "function", c);
let T = H(y(u, t, i, n, r, s).map((B) => B.value));
Array.isArray(T) || (T = [T]), o.push(...T.map((B) => ({
type: typeof B == "string" ? g.literal : g.object,
value: B
})));
}
if (z(h)) {
const u = a, m = (Object.prototype.hasOwnProperty.call(h.options, u) ? h.options[u] : void 0) || h.options.other;
if (!m) throw new v(h.value, a, Object.keys(h.options), c);
o.push(...y(m.value, t, i, n, r));
continue;
}
if (Q(h)) {
const u = `=${a}`;
let m = Object.prototype.hasOwnProperty.call(h.options, u) ? h.options[u] : void 0;
if (!m) {
if (!Intl.PluralRules) throw new L(`Intl.PluralRules is not available in this environment.
Try polyfilling it using "@formatjs/intl-pluralrules"
`, S.MISSING_INTL_API, c);
const T = typeof a == "bigint" ? Number(a) : a, B = i.getPluralRules(t, { type: h.pluralType }).select(T - (h.offset || 0));
m = (Object.prototype.hasOwnProperty.call(h.options, B) ? h.options[B] : void 0) || h.options.other;
}
if (!m) throw new v(h.value, a, Object.keys(h.options), c);
const H = ty