@warp-ds/elements 2.1.0 → 2.1.1-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -732,9 +732,9 @@ var require_moo = __commonJS({
732
732
  }
733
733
  });
734
734
 
735
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js
735
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js
736
736
  var require_lexer = __commonJS({
737
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
737
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
738
738
  "use strict";
739
739
  var __importDefault = exports && exports.__importDefault || function(mod) {
740
740
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -747,7 +747,7 @@ var require_lexer = __commonJS({
747
747
  doubleapos: { match: "''", value: () => "'" },
748
748
  quoted: {
749
749
  lineBreaks: true,
750
- match: /'[{}#](?:[^]*?[^'])?'(?!')/u,
750
+ match: /'[{}#](?:[^']|'')*'(?!')/u,
751
751
  value: (src) => src.slice(1, -1).replace(/''/g, "'")
752
752
  },
753
753
  argument: {
@@ -799,12 +799,13 @@ var require_lexer = __commonJS({
799
799
  }
800
800
  });
801
801
 
802
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js
802
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js
803
803
  var require_parser = __commonJS({
804
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js"(exports) {
804
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js"(exports) {
805
805
  "use strict";
806
806
  Object.defineProperty(exports, "__esModule", { value: true });
807
- exports.parse = exports.ParseError = void 0;
807
+ exports.ParseError = void 0;
808
+ exports.parse = parse2;
808
809
  var lexer_js_1 = require_lexer();
809
810
  var getContext = (lt) => ({
810
811
  offset: lt.offset,
@@ -870,8 +871,9 @@ var require_parser = __commonJS({
870
871
  }
871
872
  checkSelectKey(lt, type, key) {
872
873
  if (key[0] === "=") {
873
- if (type === "select")
874
+ if (type === "select") {
874
875
  throw new ParseError(lt, `The case ${key} is not valid with select`);
876
+ }
875
877
  } else if (type !== "select") {
876
878
  const keys = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
877
879
  if (this.strictPluralKeys && keys.length > 0 && !keys.includes(key)) {
@@ -889,10 +891,12 @@ var require_parser = __commonJS({
889
891
  for (const lt of this.lexer) {
890
892
  switch (lt.type) {
891
893
  case "offset":
892
- if (type === "select")
894
+ if (type === "select") {
893
895
  throw new ParseError(lt, "Unexpected plural offset for select");
894
- if (sel.cases.length > 0)
896
+ }
897
+ if (sel.cases.length > 0) {
895
898
  throw new ParseError(lt, "Plural offset must be set before cases");
899
+ }
896
900
  sel.pluralOffset = Number(lt.value);
897
901
  ctx.text += lt.text;
898
902
  ctx.lineBreaks += lt.lineBreaks;
@@ -932,11 +936,13 @@ var require_parser = __commonJS({
932
936
  const end = this.lexer.next();
933
937
  if (!end)
934
938
  throw new ParseError(null, "Unexpected message end");
935
- if (end.type !== "end")
939
+ if (end.type !== "end") {
936
940
  throw new ParseError(end, `Unexpected lexer token: ${end.type}`);
941
+ }
937
942
  ctx.text += end.text;
938
- if (isSelectType(argType.value.toLowerCase()))
943
+ if (isSelectType(argType.value.toLowerCase())) {
939
944
  throw new ParseError(argType, `Invalid type identifier: ${argType.value}`);
945
+ }
940
946
  return {
941
947
  type: "function",
942
948
  arg: lt.value,
@@ -950,8 +956,9 @@ var require_parser = __commonJS({
950
956
  throw new ParseError(argType, msg);
951
957
  }
952
958
  let param = this.parseBody(this.strict ? false : inPlural);
953
- if (this.strict && param.length > 0)
959
+ if (this.strict && param.length > 0) {
954
960
  param = strictArgStyleParam(lt, param);
961
+ }
955
962
  return {
956
963
  type: "function",
957
964
  arg: lt.value,
@@ -961,10 +968,11 @@ var require_parser = __commonJS({
961
968
  };
962
969
  }
963
970
  case "select":
964
- if (isSelectType(argType.value))
971
+ if (isSelectType(argType.value)) {
965
972
  return this.parseSelect(lt, inPlural, ctx, argType.value);
966
- else
973
+ } else {
967
974
  throw new ParseError(argType, `Unexpected select type ${argType.value}`);
975
+ }
968
976
  default:
969
977
  throw new ParseError(argType, `Unexpected lexer token: ${argType.type}`);
970
978
  }
@@ -1011,7 +1019,6 @@ var require_parser = __commonJS({
1011
1019
  const parser = new Parser(src, options);
1012
1020
  return parser.parse();
1013
1021
  }
1014
- exports.parse = parse2;
1015
1022
  }
1016
1023
  });
1017
1024
 
@@ -1028,14 +1035,272 @@ var r = function() {
1028
1035
  }, []).join(" ");
1029
1036
  };
1030
1037
 
1031
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1038
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1032
1039
  var import_unraw = __toESM(require_dist(), 1);
1033
1040
 
1034
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1041
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1035
1042
  var import_parser = __toESM(require_parser(), 1);
1043
+ var DateFormatError = class extends Error {
1044
+ /** @internal */
1045
+ constructor(msg, token, type) {
1046
+ super(msg);
1047
+ this.token = token;
1048
+ this.type = type || "error";
1049
+ }
1050
+ };
1051
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1052
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1053
+ function yearOptions(token, onError) {
1054
+ switch (token.char) {
1055
+ case "y":
1056
+ return { year: numeric(token.width) };
1057
+ case "r":
1058
+ return { calendar: "gregory", year: "numeric" };
1059
+ case "u":
1060
+ case "U":
1061
+ case "Y":
1062
+ default:
1063
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1064
+ return { year: "numeric" };
1065
+ }
1066
+ }
1067
+ function monthStyle(token, onError) {
1068
+ switch (token.width) {
1069
+ case 1:
1070
+ return "numeric";
1071
+ case 2:
1072
+ return "2-digit";
1073
+ case 3:
1074
+ return "short";
1075
+ case 4:
1076
+ return "long";
1077
+ case 5:
1078
+ return "narrow";
1079
+ default:
1080
+ onError(`${token.desc} is not supported with width ${token.width}`);
1081
+ return void 0;
1082
+ }
1083
+ }
1084
+ function dayStyle(token, onError) {
1085
+ const { char, desc, width } = token;
1086
+ if (char === "d") {
1087
+ return numeric(width);
1088
+ } else {
1089
+ onError(`${desc} is not supported`);
1090
+ return void 0;
1091
+ }
1092
+ }
1093
+ function weekdayStyle(token, onError) {
1094
+ const { char, desc, width } = token;
1095
+ if ((char === "c" || char === "e") && width < 3) {
1096
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1097
+ onError(msg, DateFormatError.WARNING);
1098
+ }
1099
+ return alpha(width);
1100
+ }
1101
+ function hourOptions(token) {
1102
+ const hour = numeric(token.width);
1103
+ let hourCycle;
1104
+ switch (token.char) {
1105
+ case "h":
1106
+ hourCycle = "h12";
1107
+ break;
1108
+ case "H":
1109
+ hourCycle = "h23";
1110
+ break;
1111
+ case "k":
1112
+ hourCycle = "h24";
1113
+ break;
1114
+ case "K":
1115
+ hourCycle = "h11";
1116
+ break;
1117
+ }
1118
+ return hourCycle ? { hour, hourCycle } : { hour };
1119
+ }
1120
+ function timeZoneNameStyle(token, onError) {
1121
+ const { char, desc, width } = token;
1122
+ switch (char) {
1123
+ case "v":
1124
+ case "z":
1125
+ return width === 4 ? "long" : "short";
1126
+ case "V":
1127
+ if (width === 4)
1128
+ return "long";
1129
+ onError(`${desc} is not supported with width ${width}`);
1130
+ return void 0;
1131
+ case "X":
1132
+ onError(`${desc} is not supported`);
1133
+ return void 0;
1134
+ }
1135
+ return "short";
1136
+ }
1137
+ function compileOptions(token, onError) {
1138
+ switch (token.field) {
1139
+ case "era":
1140
+ return { era: alpha(token.width) };
1141
+ case "year":
1142
+ return yearOptions(token, onError);
1143
+ case "month":
1144
+ return { month: monthStyle(token, onError) };
1145
+ case "day":
1146
+ return { day: dayStyle(token, onError) };
1147
+ case "weekday":
1148
+ return { weekday: weekdayStyle(token, onError) };
1149
+ case "period":
1150
+ return void 0;
1151
+ case "hour":
1152
+ return hourOptions(token);
1153
+ case "min":
1154
+ return { minute: numeric(token.width) };
1155
+ case "sec":
1156
+ return { second: numeric(token.width) };
1157
+ case "tz":
1158
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1159
+ case "quarter":
1160
+ case "week":
1161
+ case "sec-frac":
1162
+ case "ms":
1163
+ onError(`${token.desc} is not supported`);
1164
+ }
1165
+ return void 0;
1166
+ }
1167
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1168
+ throw error;
1169
+ }) {
1170
+ const options = {
1171
+ timeZone
1172
+ };
1173
+ const fields2 = [];
1174
+ for (const token of tokens) {
1175
+ const { error, field, str } = token;
1176
+ if (error) {
1177
+ const dte = new DateFormatError(error.message, token);
1178
+ dte.stack = error.stack;
1179
+ onError(dte);
1180
+ }
1181
+ if (str) {
1182
+ const msg = `Ignoring string part: ${str}`;
1183
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1184
+ }
1185
+ if (field) {
1186
+ if (fields2.indexOf(field) === -1)
1187
+ fields2.push(field);
1188
+ else
1189
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1190
+ }
1191
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1192
+ if (opt)
1193
+ Object.assign(options, opt);
1194
+ }
1195
+ return options;
1196
+ }
1197
+ var fields = {
1198
+ G: { field: "era", desc: "Era" },
1199
+ y: { field: "year", desc: "Year" },
1200
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1201
+ u: { field: "year", desc: "Extended year" },
1202
+ U: { field: "year", desc: "Cyclic year name" },
1203
+ r: { field: "year", desc: "Related Gregorian year" },
1204
+ Q: { field: "quarter", desc: "Quarter" },
1205
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1206
+ M: { field: "month", desc: "Month in year" },
1207
+ L: { field: "month", desc: "Stand-alone month in year" },
1208
+ w: { field: "week", desc: "Week of year" },
1209
+ W: { field: "week", desc: "Week of month" },
1210
+ d: { field: "day", desc: "Day in month" },
1211
+ D: { field: "day", desc: "Day of year" },
1212
+ F: { field: "day", desc: "Day of week in month" },
1213
+ g: { field: "day", desc: "Modified julian day" },
1214
+ E: { field: "weekday", desc: "Day of week" },
1215
+ e: { field: "weekday", desc: "Local day of week" },
1216
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1217
+ a: { field: "period", desc: "AM/PM marker" },
1218
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1219
+ B: { field: "period", desc: "Flexible day period" },
1220
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1221
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1222
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1223
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1224
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1225
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1226
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1227
+ m: { field: "min", desc: "Minute in hour" },
1228
+ s: { field: "sec", desc: "Second in minute" },
1229
+ S: { field: "sec-frac", desc: "Fractional second" },
1230
+ A: { field: "ms", desc: "Milliseconds in day" },
1231
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1232
+ Z: { field: "tz", desc: "Time Zone" },
1233
+ O: { field: "tz", desc: "Time Zone: localized" },
1234
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1235
+ V: { field: "tz", desc: "Time Zone: ID" },
1236
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1237
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1238
+ };
1239
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1240
+ function readFieldToken(src, pos) {
1241
+ const char = src[pos];
1242
+ let width = 1;
1243
+ while (src[++pos] === char)
1244
+ ++width;
1245
+ const field = fields[char];
1246
+ if (!field) {
1247
+ const msg = `The letter ${char} is not a valid field identifier`;
1248
+ return { char, error: new Error(msg), width };
1249
+ }
1250
+ return { char, field: field.field, desc: field.desc, width };
1251
+ }
1252
+ function readQuotedToken(src, pos) {
1253
+ let str = src[++pos];
1254
+ let width = 2;
1255
+ if (str === "'")
1256
+ return { char: "'", str, width };
1257
+ while (true) {
1258
+ const next = src[++pos];
1259
+ ++width;
1260
+ if (next === void 0) {
1261
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1262
+ return { char: "'", error: new Error(msg), str, width };
1263
+ } else if (next === "'") {
1264
+ if (src[++pos] !== "'")
1265
+ return { char: "'", str, width };
1266
+ else
1267
+ ++width;
1268
+ }
1269
+ str += next;
1270
+ }
1271
+ }
1272
+ function readToken(src, pos) {
1273
+ const char = src[pos];
1274
+ if (!char)
1275
+ return null;
1276
+ if (isLetter(char))
1277
+ return readFieldToken(src, pos);
1278
+ if (char === "'")
1279
+ return readQuotedToken(src, pos);
1280
+ let str = char;
1281
+ let width = 1;
1282
+ while (true) {
1283
+ const next = src[++pos];
1284
+ if (!next || isLetter(next) || next === "'")
1285
+ return { char, str, width };
1286
+ str += next;
1287
+ width += 1;
1288
+ }
1289
+ }
1290
+ function parseDateTokens(src) {
1291
+ const tokens = [];
1292
+ let pos = 0;
1293
+ while (true) {
1294
+ const token = readToken(src, pos);
1295
+ if (!token)
1296
+ return tokens;
1297
+ tokens.push(token);
1298
+ pos += token.width;
1299
+ }
1300
+ }
1036
1301
  function processTokens(tokens, mapText) {
1037
1302
  if (!tokens.filter((token) => token.type !== "content").length) {
1038
- return tokens.map((token) => mapText(token.value)).join("");
1303
+ return tokens.map((token) => mapText(token.value));
1039
1304
  }
1040
1305
  return tokens.map((token) => {
1041
1306
  var _a;
@@ -1047,6 +1312,12 @@ function processTokens(tokens, mapText) {
1047
1312
  return [token.arg];
1048
1313
  } else if (token.type === "function") {
1049
1314
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1315
+ if (token.key === "date" && _param) {
1316
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1317
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1318
+ });
1319
+ return [token.arg, token.key, opts];
1320
+ }
1050
1321
  if (_param) {
1051
1322
  return [token.arg, token.key, _param.value.trim()];
1052
1323
  } else {
@@ -1068,6 +1339,13 @@ function processTokens(tokens, mapText) {
1068
1339
  ];
1069
1340
  });
1070
1341
  }
1342
+ function compileDateExpression(format, onError) {
1343
+ if (/^::/.test(format)) {
1344
+ const tokens = parseDateTokens(format.substring(2));
1345
+ return getDateFormatOptions(tokens, void 0, onError);
1346
+ }
1347
+ return format;
1348
+ }
1071
1349
  function compileMessage(message, mapText = (v) => v) {
1072
1350
  try {
1073
1351
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1075,11 +1353,11 @@ function compileMessage(message, mapText = (v) => v) {
1075
1353
  console.error(`${e.message}
1076
1354
 
1077
1355
  Message: ${message}`);
1078
- return message;
1356
+ return [message];
1079
1357
  }
1080
1358
  }
1081
1359
 
1082
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1360
+ // node_modules/.pnpm/@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-macros@3.1.0_typescri_qfhfd5z2jpd4amxt2golzdalsi/node_modules/@lingui/core/dist/index.mjs
1083
1361
  var isString = (s) => typeof s === "string";
1084
1362
  var isFunction = (f) => typeof f === "function";
1085
1363
  var cache = /* @__PURE__ */ new Map();
@@ -1090,12 +1368,59 @@ function normalizeLocales(locales) {
1090
1368
  }
1091
1369
  function date(locales, value, format) {
1092
1370
  const _locales = normalizeLocales(locales);
1371
+ if (!format) {
1372
+ format = "default";
1373
+ }
1374
+ let o;
1375
+ if (typeof format === "string") {
1376
+ o = {
1377
+ day: "numeric",
1378
+ month: "short",
1379
+ year: "numeric"
1380
+ };
1381
+ switch (format) {
1382
+ case "full":
1383
+ o.weekday = "long";
1384
+ case "long":
1385
+ o.month = "long";
1386
+ break;
1387
+ case "short":
1388
+ o.month = "numeric";
1389
+ break;
1390
+ }
1391
+ } else {
1392
+ o = format;
1393
+ }
1093
1394
  const formatter = getMemoized(
1094
1395
  () => cacheKey("date", _locales, format),
1095
- () => new Intl.DateTimeFormat(_locales, format)
1396
+ () => new Intl.DateTimeFormat(_locales, o)
1096
1397
  );
1097
1398
  return formatter.format(isString(value) ? new Date(value) : value);
1098
1399
  }
1400
+ function time(locales, value, format) {
1401
+ let o;
1402
+ if (!format) {
1403
+ format = "default";
1404
+ }
1405
+ if (typeof format === "string") {
1406
+ o = {
1407
+ second: "numeric",
1408
+ minute: "numeric",
1409
+ hour: "numeric"
1410
+ };
1411
+ switch (format) {
1412
+ case "full":
1413
+ case "long":
1414
+ o.timeZoneName = "short";
1415
+ break;
1416
+ case "short":
1417
+ delete o.second;
1418
+ }
1419
+ } else {
1420
+ o = format;
1421
+ }
1422
+ return date(locales, value, o);
1423
+ }
1099
1424
  function number(locales, value, format) {
1100
1425
  const _locales = normalizeLocales(locales);
1101
1426
  const formatter = getMemoized(
@@ -1130,12 +1455,14 @@ function cacheKey(type, locales, options) {
1130
1455
  const localeKey = locales.join("-");
1131
1456
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1132
1457
  }
1133
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1458
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1134
1459
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1135
1460
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1136
1461
  const locales = passedLocales || locale;
1137
1462
  const style = (format) => {
1138
- return typeof format === "object" ? format : formats[format] || { style: format };
1463
+ if (typeof format === "object")
1464
+ return format;
1465
+ return formats[format];
1139
1466
  };
1140
1467
  const replaceOctothorpe = (value, message) => {
1141
1468
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1154,8 +1481,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1154
1481
  return replaceOctothorpe(value - offset, message);
1155
1482
  },
1156
1483
  select: selectFormatter,
1157
- number: (value, format) => number(locales, value, style(format)),
1158
- date: (value, format) => date(locales, value, style(format))
1484
+ number: (value, format) => number(
1485
+ locales,
1486
+ value,
1487
+ style(format) || { style: format }
1488
+ ),
1489
+ date: (value, format) => date(locales, value, style(format) || format),
1490
+ time: (value, format) => time(locales, value, style(format) || format)
1159
1491
  };
1160
1492
  };
1161
1493
  var selectFormatter = (value, rules) => {
@@ -1204,10 +1536,10 @@ function interpolate(translation, locale, locales) {
1204
1536
  };
1205
1537
  const result = formatMessage(translation);
1206
1538
  if (isString(result) && UNICODE_REGEX.test(result)) {
1207
- return (0, import_unraw.unraw)(result.trim());
1539
+ return (0, import_unraw.unraw)(result);
1208
1540
  }
1209
1541
  if (isString(result))
1210
- return result.trim();
1542
+ return result;
1211
1543
  return result ? String(result) : "";
1212
1544
  };
1213
1545
  }
@@ -1262,7 +1594,11 @@ var I18n = class extends EventEmitter {
1262
1594
  __publicField2(this, "_localeData", {});
1263
1595
  __publicField2(this, "_messages", {});
1264
1596
  __publicField2(this, "_missing");
1597
+ __publicField2(this, "_messageCompiler");
1265
1598
  __publicField2(this, "t", this._.bind(this));
1599
+ if (true) {
1600
+ this.setMessagesCompiler(compileMessage);
1601
+ }
1266
1602
  if (params.missing != null)
1267
1603
  this._missing = params.missing;
1268
1604
  if (params.messages != null)
@@ -1298,12 +1634,30 @@ var I18n = class extends EventEmitter {
1298
1634
  Object.assign(maybeLocaleData, localeData);
1299
1635
  }
1300
1636
  }
1637
+ /**
1638
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1639
+ *
1640
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1641
+ * By default, message catalogs should be precompiled during the build process. However,
1642
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1643
+ *
1644
+ * Example usage:
1645
+ *
1646
+ * ```ts
1647
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1648
+ *
1649
+ * i18n.setMessagesCompiler(compileMessage);
1650
+ * ```
1651
+ */
1652
+ setMessagesCompiler(compiler) {
1653
+ this._messageCompiler = compiler;
1654
+ return this;
1655
+ }
1301
1656
  /**
1302
1657
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1303
1658
  */
1304
- // @ts-ignore deprecated, so ignore the reported error
1305
1659
  loadLocaleData(localeOrAllData, localeData) {
1306
- if (localeData != null) {
1660
+ if (typeof localeOrAllData === "string") {
1307
1661
  this._loadLocaleData(localeOrAllData, localeData);
1308
1662
  } else {
1309
1663
  Object.keys(localeOrAllData).forEach(
@@ -1350,6 +1704,11 @@ var I18n = class extends EventEmitter {
1350
1704
  this.emit("change");
1351
1705
  }
1352
1706
  _(id, values, options) {
1707
+ if (!this.locale) {
1708
+ throw new Error(
1709
+ "Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic."
1710
+ );
1711
+ }
1353
1712
  let message = options == null ? void 0 : options.message;
1354
1713
  if (!id) {
1355
1714
  id = "";
@@ -1369,8 +1728,20 @@ var I18n = class extends EventEmitter {
1369
1728
  this.emit("missing", { id, locale: this._locale });
1370
1729
  }
1371
1730
  let translation = messageForId || message || id;
1372
- if (true) {
1373
- translation = isString(translation) ? compileMessage(translation) : translation;
1731
+ if (isString(translation)) {
1732
+ if (this._messageCompiler) {
1733
+ translation = this._messageCompiler(translation);
1734
+ } else {
1735
+ console.warn(`Uncompiled message detected! Message:
1736
+
1737
+ > ${translation}
1738
+
1739
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
1740
+ ICU features such as interpolation and plurals will not work properly for that message.
1741
+
1742
+ Please compile your catalog first.
1743
+ `);
1744
+ }
1374
1745
  }
1375
1746
  if (isString(translation) && UNICODE_REGEX.test(translation))
1376
1747
  return JSON.parse(`"${translation}"`);
@@ -1394,7 +1765,7 @@ function setupI18n(params = {}) {
1394
1765
  }
1395
1766
  var i18n = setupI18n();
1396
1767
 
1397
- // node_modules/.pnpm/@warp-ds+css@2.0.0_@warp-ds+uno@2.0.0_unocss@0.62.0_postcss@8.4.41_rollup@4.20.0_vite@5.3.3_@_vyiy5vwpqfzwy5hpmfkwp3zmle/node_modules/@warp-ds/css/component-classes/index.js
1768
+ // node_modules/.pnpm/@warp-ds+css@2.1.1_@warp-ds+uno@2.1.0_unocss@0.62.0_postcss@8.5.1_rollup@4.32.1_vite@5.3.3_@t_sgrraibu65gdmqpe655kfrpl6a/node_modules/@warp-ds/css/component-classes/index.js
1398
1769
  var toaster = {
1399
1770
  wrapper: "fixed transform translate-z-0 bottom-16 left-0 right-0 mx-8 sm:mx-16 z-50 pointer-events-none",
1400
1771
  base: "grid auto-rows-auto justify-items-center justify-center mx-auto pointer-events-none",
@@ -1714,14 +2085,14 @@ var collapse = (el, done) => {
1714
2085
  // packages/toast/toast.js
1715
2086
  import { when } from "lit/directives/when.js";
1716
2087
 
1717
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/warning-16.js
2088
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/warning-16.js
1718
2089
  import { LitElement } from "lit";
1719
2090
  import { unsafeStatic, html } from "lit/static-html.js";
1720
- var messages = JSON.parse('{"icon.title.warning":"Varseltrekant med utropstegn"}');
1721
- var messages2 = JSON.parse('{"icon.title.warning":"Warning triangle with exclamation point"}');
1722
- var messages3 = JSON.parse('{"icon.title.warning":"Varoituskolmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
1723
- var messages4 = JSON.parse('{"icon.title.warning":"Advarselstrekant med et udr\xE5bstegn"}');
1724
- var messages5 = JSON.parse('{"icon.title.warning":"Varningstriangel med utropstecken"}');
2091
+ var messages = JSON.parse('{"icon.title.warning":["Varseltrekant med utropstegn"]}');
2092
+ var messages2 = JSON.parse('{"icon.title.warning":["Warning triangle with exclamation point"]}');
2093
+ var messages3 = JSON.parse('{"icon.title.warning":["Varoituskolmio, jonka sis\xE4ll\xE4 on huutomerkki"]}');
2094
+ var messages4 = JSON.parse('{"icon.title.warning":["Advarselstrekant med et udr\xE5bstegn"]}');
2095
+ var messages5 = JSON.parse('{"icon.title.warning":["Varningstriangel med utropstecken"]}');
1725
2096
  var supportedLocales = ["en", "nb", "fi", "da", "sv"];
1726
2097
  var defaultLocale2 = "en";
1727
2098
  var detectByBrand = () => {
@@ -1808,14 +2179,14 @@ if (!customElements.get("w-icon-warning-16")) {
1808
2179
  customElements.define("w-icon-warning-16", IconWarning16);
1809
2180
  }
1810
2181
 
1811
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/error-16.js
2182
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/error-16.js
1812
2183
  import { LitElement as LitElement2 } from "lit";
1813
2184
  import { unsafeStatic as unsafeStatic2, html as html2 } from "lit/static-html.js";
1814
- var messages6 = JSON.parse('{"icon.title.error":"\xC5ttekant med utropstegn"}');
1815
- var messages22 = JSON.parse('{"icon.title.error":"Octagon with exclamation point"}');
1816
- var messages32 = JSON.parse('{"icon.title.error":"Kahdeksankulmio, jonka sis\xE4ll\xE4 on huutomerkki"}');
1817
- var messages42 = JSON.parse('{"icon.title.error":"Ottekant med et udr\xE5bstegn"}');
1818
- var messages52 = JSON.parse('{"icon.title.error":"Oktagon med utropstecken"}');
2185
+ var messages6 = JSON.parse('{"icon.title.error":["\xC5ttekant med utropstegn"]}');
2186
+ var messages22 = JSON.parse('{"icon.title.error":["Octagon with exclamation point"]}');
2187
+ var messages32 = JSON.parse('{"icon.title.error":["Kahdeksankulmio, jonka sis\xE4ll\xE4 on huutomerkki"]}');
2188
+ var messages42 = JSON.parse('{"icon.title.error":["Ottekant med et udr\xE5bstegn"]}');
2189
+ var messages52 = JSON.parse('{"icon.title.error":["Oktagon med utropstecken"]}');
1819
2190
  var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
1820
2191
  var defaultLocale3 = "en";
1821
2192
  var detectByBrand2 = () => {
@@ -1902,14 +2273,14 @@ if (!customElements.get("w-icon-error-16")) {
1902
2273
  customElements.define("w-icon-error-16", IconError16);
1903
2274
  }
1904
2275
 
1905
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/success-16.js
2276
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/success-16.js
1906
2277
  import { LitElement as LitElement3 } from "lit";
1907
2278
  import { unsafeStatic as unsafeStatic3, html as html3 } from "lit/static-html.js";
1908
- var messages7 = JSON.parse('{"icon.title.success":"Sirkel med sjekkmerke"}');
1909
- var messages23 = JSON.parse('{"icon.title.success":"Circle with checkmark"}');
1910
- var messages33 = JSON.parse('{"icon.title.success":"Ympyr\xE4, jonka sis\xE4ll\xE4 on valintamerkki"}');
1911
- var messages43 = JSON.parse('{"icon.title.success":"Cirkel med et flueben"}');
1912
- var messages53 = JSON.parse('{"icon.title.success":"Cirkel med bock"}');
2279
+ var messages7 = JSON.parse('{"icon.title.success":["Sirkel med sjekkmerke"]}');
2280
+ var messages23 = JSON.parse('{"icon.title.success":["Circle with checkmark"]}');
2281
+ var messages33 = JSON.parse('{"icon.title.success":["Ympyr\xE4, jonka sis\xE4ll\xE4 on valintamerkki"]}');
2282
+ var messages43 = JSON.parse('{"icon.title.success":["Cirkel med et flueben"]}');
2283
+ var messages53 = JSON.parse('{"icon.title.success":["Cirkel med bock"]}');
1913
2284
  var supportedLocales3 = ["en", "nb", "fi", "da", "sv"];
1914
2285
  var defaultLocale4 = "en";
1915
2286
  var detectByBrand3 = () => {
@@ -1996,14 +2367,14 @@ if (!customElements.get("w-icon-success-16")) {
1996
2367
  customElements.define("w-icon-success-16", IconSuccess16);
1997
2368
  }
1998
2369
 
1999
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
2370
+ // node_modules/.pnpm/@warp-ds+icons@2.5.0_@lingui+core@5.2.0_@lingui+babel-plugin-lingui-macro@5.2.0_babel-plugin-_hyhbgchrkasknlbocfng7geeci/node_modules/@warp-ds/icons/dist/elements/close-16.js
2000
2371
  import { LitElement as LitElement4 } from "lit";
2001
2372
  import { unsafeStatic as unsafeStatic4, html as html4 } from "lit/static-html.js";
2002
- var messages8 = JSON.parse('{"icon.title.close":"Kryss"}');
2003
- var messages24 = JSON.parse('{"icon.title.close":"Cross"}');
2004
- var messages34 = JSON.parse('{"icon.title.close":"Rasti"}');
2005
- var messages44 = JSON.parse('{"icon.title.close":"Kryds"}');
2006
- var messages54 = JSON.parse('{"icon.title.close":"Kryss"}');
2373
+ var messages8 = JSON.parse('{"icon.title.close":["Kryss"]}');
2374
+ var messages24 = JSON.parse('{"icon.title.close":["Cross"]}');
2375
+ var messages34 = JSON.parse('{"icon.title.close":["Rasti"]}');
2376
+ var messages44 = JSON.parse('{"icon.title.close":["Kryds"]}');
2377
+ var messages54 = JSON.parse('{"icon.title.close":["Kryss"]}');
2007
2378
  var supportedLocales4 = ["en", "nb", "fi", "da", "sv"];
2008
2379
  var defaultLocale5 = "en";
2009
2380
  var detectByBrand4 = () => {
@@ -2126,19 +2497,19 @@ var activateI18n5 = (enMessages, nbMessages, fiMessages, daMessages, svMessages)
2126
2497
  };
2127
2498
 
2128
2499
  // packages/toast/locales/da/messages.mjs
2129
- var messages9 = JSON.parse('{"toast.aria.error":"Fejl","toast.aria.successful":"Fuldf\xF8rt","toast.aria.warning":"Advarsel"}');
2500
+ var messages9 = JSON.parse('{"toast.aria.error":["Fejl"],"toast.aria.successful":["Fuldf\xF8rt"],"toast.aria.warning":["Advarsel"]}');
2130
2501
 
2131
2502
  // packages/toast/locales/en/messages.mjs
2132
- var messages10 = JSON.parse('{"toast.aria.error":"Error","toast.aria.successful":"Successful","toast.aria.warning":"Warning"}');
2503
+ var messages10 = JSON.parse('{"toast.aria.error":["Error"],"toast.aria.successful":["Successful"],"toast.aria.warning":["Warning"]}');
2133
2504
 
2134
2505
  // packages/toast/locales/fi/messages.mjs
2135
- var messages11 = JSON.parse('{"toast.aria.error":"Virhe","toast.aria.successful":"Onnistui","toast.aria.warning":"Varoitus"}');
2506
+ var messages11 = JSON.parse('{"toast.aria.error":["Virhe"],"toast.aria.successful":["Onnistui"],"toast.aria.warning":["Varoitus"]}');
2136
2507
 
2137
2508
  // packages/toast/locales/nb/messages.mjs
2138
- var messages12 = JSON.parse('{"toast.aria.error":"Feil","toast.aria.successful":"Vellykket","toast.aria.warning":"Advarsel"}');
2509
+ var messages12 = JSON.parse('{"toast.aria.error":["Feil"],"toast.aria.successful":["Vellykket"],"toast.aria.warning":["Advarsel"]}');
2139
2510
 
2140
2511
  // packages/toast/locales/sv/messages.mjs
2141
- var messages13 = JSON.parse('{"toast.aria.error":"Fel","toast.aria.successful":"Genomf\xF6rt","toast.aria.warning":"Varning"}');
2512
+ var messages13 = JSON.parse('{"toast.aria.error":["Fel"],"toast.aria.successful":["Genomf\xF6rt"],"toast.aria.warning":["Varning"]}');
2142
2513
 
2143
2514
  // packages/toast/toast.js
2144
2515
  var toastType = {