@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.
@@ -726,9 +726,9 @@ var require_moo = __commonJS({
726
726
  }
727
727
  });
728
728
 
729
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js
729
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js
730
730
  var require_lexer = __commonJS({
731
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
731
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/lexer.js"(exports) {
732
732
  "use strict";
733
733
  var __importDefault = exports && exports.__importDefault || function(mod) {
734
734
  return mod && mod.__esModule ? mod : { "default": mod };
@@ -741,7 +741,7 @@ var require_lexer = __commonJS({
741
741
  doubleapos: { match: "''", value: () => "'" },
742
742
  quoted: {
743
743
  lineBreaks: true,
744
- match: /'[{}#](?:[^]*?[^'])?'(?!')/u,
744
+ match: /'[{}#](?:[^']|'')*'(?!')/u,
745
745
  value: (src) => src.slice(1, -1).replace(/''/g, "'")
746
746
  },
747
747
  argument: {
@@ -793,12 +793,13 @@ var require_lexer = __commonJS({
793
793
  }
794
794
  });
795
795
 
796
- // node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js
796
+ // node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js
797
797
  var require_parser = __commonJS({
798
- "node_modules/.pnpm/@messageformat+parser@5.1.0/node_modules/@messageformat/parser/lib/parser.js"(exports) {
798
+ "node_modules/.pnpm/@messageformat+parser@5.1.1/node_modules/@messageformat/parser/lib/parser.js"(exports) {
799
799
  "use strict";
800
800
  Object.defineProperty(exports, "__esModule", { value: true });
801
- exports.parse = exports.ParseError = void 0;
801
+ exports.ParseError = void 0;
802
+ exports.parse = parse2;
802
803
  var lexer_js_1 = require_lexer();
803
804
  var getContext = (lt) => ({
804
805
  offset: lt.offset,
@@ -864,8 +865,9 @@ var require_parser = __commonJS({
864
865
  }
865
866
  checkSelectKey(lt, type, key) {
866
867
  if (key[0] === "=") {
867
- if (type === "select")
868
+ if (type === "select") {
868
869
  throw new ParseError(lt, `The case ${key} is not valid with select`);
870
+ }
869
871
  } else if (type !== "select") {
870
872
  const keys = type === "plural" ? this.cardinalKeys : this.ordinalKeys;
871
873
  if (this.strictPluralKeys && keys.length > 0 && !keys.includes(key)) {
@@ -883,10 +885,12 @@ var require_parser = __commonJS({
883
885
  for (const lt of this.lexer) {
884
886
  switch (lt.type) {
885
887
  case "offset":
886
- if (type === "select")
888
+ if (type === "select") {
887
889
  throw new ParseError(lt, "Unexpected plural offset for select");
888
- if (sel.cases.length > 0)
890
+ }
891
+ if (sel.cases.length > 0) {
889
892
  throw new ParseError(lt, "Plural offset must be set before cases");
893
+ }
890
894
  sel.pluralOffset = Number(lt.value);
891
895
  ctx.text += lt.text;
892
896
  ctx.lineBreaks += lt.lineBreaks;
@@ -926,11 +930,13 @@ var require_parser = __commonJS({
926
930
  const end = this.lexer.next();
927
931
  if (!end)
928
932
  throw new ParseError(null, "Unexpected message end");
929
- if (end.type !== "end")
933
+ if (end.type !== "end") {
930
934
  throw new ParseError(end, `Unexpected lexer token: ${end.type}`);
935
+ }
931
936
  ctx.text += end.text;
932
- if (isSelectType(argType.value.toLowerCase()))
937
+ if (isSelectType(argType.value.toLowerCase())) {
933
938
  throw new ParseError(argType, `Invalid type identifier: ${argType.value}`);
939
+ }
934
940
  return {
935
941
  type: "function",
936
942
  arg: lt.value,
@@ -944,8 +950,9 @@ var require_parser = __commonJS({
944
950
  throw new ParseError(argType, msg);
945
951
  }
946
952
  let param = this.parseBody(this.strict ? false : inPlural);
947
- if (this.strict && param.length > 0)
953
+ if (this.strict && param.length > 0) {
948
954
  param = strictArgStyleParam(lt, param);
955
+ }
949
956
  return {
950
957
  type: "function",
951
958
  arg: lt.value,
@@ -955,10 +962,11 @@ var require_parser = __commonJS({
955
962
  };
956
963
  }
957
964
  case "select":
958
- if (isSelectType(argType.value))
965
+ if (isSelectType(argType.value)) {
959
966
  return this.parseSelect(lt, inPlural, ctx, argType.value);
960
- else
967
+ } else {
961
968
  throw new ParseError(argType, `Unexpected select type ${argType.value}`);
969
+ }
962
970
  default:
963
971
  throw new ParseError(argType, `Unexpected lexer token: ${argType.type}`);
964
972
  }
@@ -1005,7 +1013,6 @@ var require_parser = __commonJS({
1005
1013
  const parser = new Parser(src, options);
1006
1014
  return parser.parse();
1007
1015
  }
1008
- exports.parse = parse2;
1009
1016
  }
1010
1017
  });
1011
1018
 
@@ -1022,14 +1029,272 @@ var r = function() {
1022
1029
  }, []).join(" ");
1023
1030
  };
1024
1031
 
1025
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1032
+ // 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
1026
1033
  var import_unraw = __toESM(require_dist(), 1);
1027
1034
 
1028
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1035
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1029
1036
  var import_parser = __toESM(require_parser(), 1);
1037
+ var DateFormatError = class extends Error {
1038
+ /** @internal */
1039
+ constructor(msg, token, type) {
1040
+ super(msg);
1041
+ this.token = token;
1042
+ this.type = type || "error";
1043
+ }
1044
+ };
1045
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1046
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1047
+ function yearOptions(token, onError) {
1048
+ switch (token.char) {
1049
+ case "y":
1050
+ return { year: numeric(token.width) };
1051
+ case "r":
1052
+ return { calendar: "gregory", year: "numeric" };
1053
+ case "u":
1054
+ case "U":
1055
+ case "Y":
1056
+ default:
1057
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1058
+ return { year: "numeric" };
1059
+ }
1060
+ }
1061
+ function monthStyle(token, onError) {
1062
+ switch (token.width) {
1063
+ case 1:
1064
+ return "numeric";
1065
+ case 2:
1066
+ return "2-digit";
1067
+ case 3:
1068
+ return "short";
1069
+ case 4:
1070
+ return "long";
1071
+ case 5:
1072
+ return "narrow";
1073
+ default:
1074
+ onError(`${token.desc} is not supported with width ${token.width}`);
1075
+ return void 0;
1076
+ }
1077
+ }
1078
+ function dayStyle(token, onError) {
1079
+ const { char, desc, width } = token;
1080
+ if (char === "d") {
1081
+ return numeric(width);
1082
+ } else {
1083
+ onError(`${desc} is not supported`);
1084
+ return void 0;
1085
+ }
1086
+ }
1087
+ function weekdayStyle(token, onError) {
1088
+ const { char, desc, width } = token;
1089
+ if ((char === "c" || char === "e") && width < 3) {
1090
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1091
+ onError(msg, DateFormatError.WARNING);
1092
+ }
1093
+ return alpha(width);
1094
+ }
1095
+ function hourOptions(token) {
1096
+ const hour = numeric(token.width);
1097
+ let hourCycle;
1098
+ switch (token.char) {
1099
+ case "h":
1100
+ hourCycle = "h12";
1101
+ break;
1102
+ case "H":
1103
+ hourCycle = "h23";
1104
+ break;
1105
+ case "k":
1106
+ hourCycle = "h24";
1107
+ break;
1108
+ case "K":
1109
+ hourCycle = "h11";
1110
+ break;
1111
+ }
1112
+ return hourCycle ? { hour, hourCycle } : { hour };
1113
+ }
1114
+ function timeZoneNameStyle(token, onError) {
1115
+ const { char, desc, width } = token;
1116
+ switch (char) {
1117
+ case "v":
1118
+ case "z":
1119
+ return width === 4 ? "long" : "short";
1120
+ case "V":
1121
+ if (width === 4)
1122
+ return "long";
1123
+ onError(`${desc} is not supported with width ${width}`);
1124
+ return void 0;
1125
+ case "X":
1126
+ onError(`${desc} is not supported`);
1127
+ return void 0;
1128
+ }
1129
+ return "short";
1130
+ }
1131
+ function compileOptions(token, onError) {
1132
+ switch (token.field) {
1133
+ case "era":
1134
+ return { era: alpha(token.width) };
1135
+ case "year":
1136
+ return yearOptions(token, onError);
1137
+ case "month":
1138
+ return { month: monthStyle(token, onError) };
1139
+ case "day":
1140
+ return { day: dayStyle(token, onError) };
1141
+ case "weekday":
1142
+ return { weekday: weekdayStyle(token, onError) };
1143
+ case "period":
1144
+ return void 0;
1145
+ case "hour":
1146
+ return hourOptions(token);
1147
+ case "min":
1148
+ return { minute: numeric(token.width) };
1149
+ case "sec":
1150
+ return { second: numeric(token.width) };
1151
+ case "tz":
1152
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1153
+ case "quarter":
1154
+ case "week":
1155
+ case "sec-frac":
1156
+ case "ms":
1157
+ onError(`${token.desc} is not supported`);
1158
+ }
1159
+ return void 0;
1160
+ }
1161
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1162
+ throw error;
1163
+ }) {
1164
+ const options = {
1165
+ timeZone
1166
+ };
1167
+ const fields2 = [];
1168
+ for (const token of tokens) {
1169
+ const { error, field, str } = token;
1170
+ if (error) {
1171
+ const dte = new DateFormatError(error.message, token);
1172
+ dte.stack = error.stack;
1173
+ onError(dte);
1174
+ }
1175
+ if (str) {
1176
+ const msg = `Ignoring string part: ${str}`;
1177
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1178
+ }
1179
+ if (field) {
1180
+ if (fields2.indexOf(field) === -1)
1181
+ fields2.push(field);
1182
+ else
1183
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1184
+ }
1185
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1186
+ if (opt)
1187
+ Object.assign(options, opt);
1188
+ }
1189
+ return options;
1190
+ }
1191
+ var fields = {
1192
+ G: { field: "era", desc: "Era" },
1193
+ y: { field: "year", desc: "Year" },
1194
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1195
+ u: { field: "year", desc: "Extended year" },
1196
+ U: { field: "year", desc: "Cyclic year name" },
1197
+ r: { field: "year", desc: "Related Gregorian year" },
1198
+ Q: { field: "quarter", desc: "Quarter" },
1199
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1200
+ M: { field: "month", desc: "Month in year" },
1201
+ L: { field: "month", desc: "Stand-alone month in year" },
1202
+ w: { field: "week", desc: "Week of year" },
1203
+ W: { field: "week", desc: "Week of month" },
1204
+ d: { field: "day", desc: "Day in month" },
1205
+ D: { field: "day", desc: "Day of year" },
1206
+ F: { field: "day", desc: "Day of week in month" },
1207
+ g: { field: "day", desc: "Modified julian day" },
1208
+ E: { field: "weekday", desc: "Day of week" },
1209
+ e: { field: "weekday", desc: "Local day of week" },
1210
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1211
+ a: { field: "period", desc: "AM/PM marker" },
1212
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1213
+ B: { field: "period", desc: "Flexible day period" },
1214
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1215
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1216
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1217
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1218
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1219
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1220
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1221
+ m: { field: "min", desc: "Minute in hour" },
1222
+ s: { field: "sec", desc: "Second in minute" },
1223
+ S: { field: "sec-frac", desc: "Fractional second" },
1224
+ A: { field: "ms", desc: "Milliseconds in day" },
1225
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1226
+ Z: { field: "tz", desc: "Time Zone" },
1227
+ O: { field: "tz", desc: "Time Zone: localized" },
1228
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1229
+ V: { field: "tz", desc: "Time Zone: ID" },
1230
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1231
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1232
+ };
1233
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1234
+ function readFieldToken(src, pos) {
1235
+ const char = src[pos];
1236
+ let width = 1;
1237
+ while (src[++pos] === char)
1238
+ ++width;
1239
+ const field = fields[char];
1240
+ if (!field) {
1241
+ const msg = `The letter ${char} is not a valid field identifier`;
1242
+ return { char, error: new Error(msg), width };
1243
+ }
1244
+ return { char, field: field.field, desc: field.desc, width };
1245
+ }
1246
+ function readQuotedToken(src, pos) {
1247
+ let str = src[++pos];
1248
+ let width = 2;
1249
+ if (str === "'")
1250
+ return { char: "'", str, width };
1251
+ while (true) {
1252
+ const next = src[++pos];
1253
+ ++width;
1254
+ if (next === void 0) {
1255
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1256
+ return { char: "'", error: new Error(msg), str, width };
1257
+ } else if (next === "'") {
1258
+ if (src[++pos] !== "'")
1259
+ return { char: "'", str, width };
1260
+ else
1261
+ ++width;
1262
+ }
1263
+ str += next;
1264
+ }
1265
+ }
1266
+ function readToken(src, pos) {
1267
+ const char = src[pos];
1268
+ if (!char)
1269
+ return null;
1270
+ if (isLetter(char))
1271
+ return readFieldToken(src, pos);
1272
+ if (char === "'")
1273
+ return readQuotedToken(src, pos);
1274
+ let str = char;
1275
+ let width = 1;
1276
+ while (true) {
1277
+ const next = src[++pos];
1278
+ if (!next || isLetter(next) || next === "'")
1279
+ return { char, str, width };
1280
+ str += next;
1281
+ width += 1;
1282
+ }
1283
+ }
1284
+ function parseDateTokens(src) {
1285
+ const tokens = [];
1286
+ let pos = 0;
1287
+ while (true) {
1288
+ const token = readToken(src, pos);
1289
+ if (!token)
1290
+ return tokens;
1291
+ tokens.push(token);
1292
+ pos += token.width;
1293
+ }
1294
+ }
1030
1295
  function processTokens(tokens, mapText) {
1031
1296
  if (!tokens.filter((token) => token.type !== "content").length) {
1032
- return tokens.map((token) => mapText(token.value)).join("");
1297
+ return tokens.map((token) => mapText(token.value));
1033
1298
  }
1034
1299
  return tokens.map((token) => {
1035
1300
  var _a;
@@ -1041,6 +1306,12 @@ function processTokens(tokens, mapText) {
1041
1306
  return [token.arg];
1042
1307
  } else if (token.type === "function") {
1043
1308
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1309
+ if (token.key === "date" && _param) {
1310
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1311
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1312
+ });
1313
+ return [token.arg, token.key, opts];
1314
+ }
1044
1315
  if (_param) {
1045
1316
  return [token.arg, token.key, _param.value.trim()];
1046
1317
  } else {
@@ -1062,6 +1333,13 @@ function processTokens(tokens, mapText) {
1062
1333
  ];
1063
1334
  });
1064
1335
  }
1336
+ function compileDateExpression(format, onError) {
1337
+ if (/^::/.test(format)) {
1338
+ const tokens = parseDateTokens(format.substring(2));
1339
+ return getDateFormatOptions(tokens, void 0, onError);
1340
+ }
1341
+ return format;
1342
+ }
1065
1343
  function compileMessage(message, mapText = (v) => v) {
1066
1344
  try {
1067
1345
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1069,11 +1347,11 @@ function compileMessage(message, mapText = (v) => v) {
1069
1347
  console.error(`${e.message}
1070
1348
 
1071
1349
  Message: ${message}`);
1072
- return message;
1350
+ return [message];
1073
1351
  }
1074
1352
  }
1075
1353
 
1076
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1354
+ // 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
1077
1355
  var isString = (s) => typeof s === "string";
1078
1356
  var isFunction = (f) => typeof f === "function";
1079
1357
  var cache = /* @__PURE__ */ new Map();
@@ -1084,12 +1362,59 @@ function normalizeLocales(locales) {
1084
1362
  }
1085
1363
  function date(locales, value, format) {
1086
1364
  const _locales = normalizeLocales(locales);
1365
+ if (!format) {
1366
+ format = "default";
1367
+ }
1368
+ let o;
1369
+ if (typeof format === "string") {
1370
+ o = {
1371
+ day: "numeric",
1372
+ month: "short",
1373
+ year: "numeric"
1374
+ };
1375
+ switch (format) {
1376
+ case "full":
1377
+ o.weekday = "long";
1378
+ case "long":
1379
+ o.month = "long";
1380
+ break;
1381
+ case "short":
1382
+ o.month = "numeric";
1383
+ break;
1384
+ }
1385
+ } else {
1386
+ o = format;
1387
+ }
1087
1388
  const formatter = getMemoized(
1088
1389
  () => cacheKey("date", _locales, format),
1089
- () => new Intl.DateTimeFormat(_locales, format)
1390
+ () => new Intl.DateTimeFormat(_locales, o)
1090
1391
  );
1091
1392
  return formatter.format(isString(value) ? new Date(value) : value);
1092
1393
  }
1394
+ function time(locales, value, format) {
1395
+ let o;
1396
+ if (!format) {
1397
+ format = "default";
1398
+ }
1399
+ if (typeof format === "string") {
1400
+ o = {
1401
+ second: "numeric",
1402
+ minute: "numeric",
1403
+ hour: "numeric"
1404
+ };
1405
+ switch (format) {
1406
+ case "full":
1407
+ case "long":
1408
+ o.timeZoneName = "short";
1409
+ break;
1410
+ case "short":
1411
+ delete o.second;
1412
+ }
1413
+ } else {
1414
+ o = format;
1415
+ }
1416
+ return date(locales, value, o);
1417
+ }
1093
1418
  function number(locales, value, format) {
1094
1419
  const _locales = normalizeLocales(locales);
1095
1420
  const formatter = getMemoized(
@@ -1124,12 +1449,14 @@ function cacheKey(type, locales, options) {
1124
1449
  const localeKey = locales.join("-");
1125
1450
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1126
1451
  }
1127
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1452
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1128
1453
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1129
1454
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1130
1455
  const locales = passedLocales || locale;
1131
1456
  const style = (format) => {
1132
- return typeof format === "object" ? format : formats[format] || { style: format };
1457
+ if (typeof format === "object")
1458
+ return format;
1459
+ return formats[format];
1133
1460
  };
1134
1461
  const replaceOctothorpe = (value, message) => {
1135
1462
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1148,8 +1475,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1148
1475
  return replaceOctothorpe(value - offset, message);
1149
1476
  },
1150
1477
  select: selectFormatter,
1151
- number: (value, format) => number(locales, value, style(format)),
1152
- date: (value, format) => date(locales, value, style(format))
1478
+ number: (value, format) => number(
1479
+ locales,
1480
+ value,
1481
+ style(format) || { style: format }
1482
+ ),
1483
+ date: (value, format) => date(locales, value, style(format) || format),
1484
+ time: (value, format) => time(locales, value, style(format) || format)
1153
1485
  };
1154
1486
  };
1155
1487
  var selectFormatter = (value, rules) => {
@@ -1198,10 +1530,10 @@ function interpolate(translation, locale, locales) {
1198
1530
  };
1199
1531
  const result = formatMessage(translation);
1200
1532
  if (isString(result) && UNICODE_REGEX.test(result)) {
1201
- return (0, import_unraw.unraw)(result.trim());
1533
+ return (0, import_unraw.unraw)(result);
1202
1534
  }
1203
1535
  if (isString(result))
1204
- return result.trim();
1536
+ return result;
1205
1537
  return result ? String(result) : "";
1206
1538
  };
1207
1539
  }
@@ -1256,7 +1588,11 @@ var I18n = class extends EventEmitter {
1256
1588
  __publicField2(this, "_localeData", {});
1257
1589
  __publicField2(this, "_messages", {});
1258
1590
  __publicField2(this, "_missing");
1591
+ __publicField2(this, "_messageCompiler");
1259
1592
  __publicField2(this, "t", this._.bind(this));
1593
+ if (true) {
1594
+ this.setMessagesCompiler(compileMessage);
1595
+ }
1260
1596
  if (params.missing != null)
1261
1597
  this._missing = params.missing;
1262
1598
  if (params.messages != null)
@@ -1292,12 +1628,30 @@ var I18n = class extends EventEmitter {
1292
1628
  Object.assign(maybeLocaleData, localeData);
1293
1629
  }
1294
1630
  }
1631
+ /**
1632
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1633
+ *
1634
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1635
+ * By default, message catalogs should be precompiled during the build process. However,
1636
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1637
+ *
1638
+ * Example usage:
1639
+ *
1640
+ * ```ts
1641
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1642
+ *
1643
+ * i18n.setMessagesCompiler(compileMessage);
1644
+ * ```
1645
+ */
1646
+ setMessagesCompiler(compiler) {
1647
+ this._messageCompiler = compiler;
1648
+ return this;
1649
+ }
1295
1650
  /**
1296
1651
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1297
1652
  */
1298
- // @ts-ignore deprecated, so ignore the reported error
1299
1653
  loadLocaleData(localeOrAllData, localeData) {
1300
- if (localeData != null) {
1654
+ if (typeof localeOrAllData === "string") {
1301
1655
  this._loadLocaleData(localeOrAllData, localeData);
1302
1656
  } else {
1303
1657
  Object.keys(localeOrAllData).forEach(
@@ -1344,6 +1698,11 @@ var I18n = class extends EventEmitter {
1344
1698
  this.emit("change");
1345
1699
  }
1346
1700
  _(id, values, options) {
1701
+ if (!this.locale) {
1702
+ throw new Error(
1703
+ "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."
1704
+ );
1705
+ }
1347
1706
  let message = options == null ? void 0 : options.message;
1348
1707
  if (!id) {
1349
1708
  id = "";
@@ -1363,8 +1722,20 @@ var I18n = class extends EventEmitter {
1363
1722
  this.emit("missing", { id, locale: this._locale });
1364
1723
  }
1365
1724
  let translation = messageForId || message || id;
1366
- if (true) {
1367
- translation = isString(translation) ? compileMessage(translation) : translation;
1725
+ if (isString(translation)) {
1726
+ if (this._messageCompiler) {
1727
+ translation = this._messageCompiler(translation);
1728
+ } else {
1729
+ console.warn(`Uncompiled message detected! Message:
1730
+
1731
+ > ${translation}
1732
+
1733
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
1734
+ ICU features such as interpolation and plurals will not work properly for that message.
1735
+
1736
+ Please compile your catalog first.
1737
+ `);
1738
+ }
1368
1739
  }
1369
1740
  if (isString(translation) && UNICODE_REGEX.test(translation))
1370
1741
  return JSON.parse(`"${translation}"`);
@@ -1388,7 +1759,7 @@ function setupI18n(params = {}) {
1388
1759
  }
1389
1760
  var i18n = setupI18n();
1390
1761
 
1391
- // 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
1762
+ // 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
1392
1763
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1393
1764
  var buttonColors = {
1394
1765
  primary: "s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",
@@ -1673,19 +2044,19 @@ function kebabCaseAttributes(constructor) {
1673
2044
  }
1674
2045
 
1675
2046
  // packages/button/locales/da/messages.mjs
1676
- var messages = JSON.parse('{"button.aria.loading":"Indl\xE6ser..."}');
2047
+ var messages = JSON.parse('{"button.aria.loading":["Indl\xE6ser..."]}');
1677
2048
 
1678
2049
  // packages/button/locales/en/messages.mjs
1679
- var messages2 = JSON.parse('{"button.aria.loading":"Loading..."}');
2050
+ var messages2 = JSON.parse('{"button.aria.loading":["Loading..."]}');
1680
2051
 
1681
2052
  // packages/button/locales/fi/messages.mjs
1682
- var messages3 = JSON.parse('{"button.aria.loading":"Ladataan..."}');
2053
+ var messages3 = JSON.parse('{"button.aria.loading":["Ladataan..."]}');
1683
2054
 
1684
2055
  // packages/button/locales/nb/messages.mjs
1685
- var messages4 = JSON.parse('{"button.aria.loading":"Laster..."}');
2056
+ var messages4 = JSON.parse('{"button.aria.loading":["Laster..."]}');
1686
2057
 
1687
2058
  // packages/button/locales/sv/messages.mjs
1688
- var messages5 = JSON.parse('{"button.aria.loading":"Laddar ..."}');
2059
+ var messages5 = JSON.parse('{"button.aria.loading":["Laddar ..."]}');
1689
2060
 
1690
2061
  // packages/button/index.js
1691
2062
  var buttonTypes2 = ["primary", "secondary", "negative", "utility", "pill", "link"];