@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,14 +1013,13 @@ 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
 
1012
1019
  // packages/modal/modal-footer.js
1013
1020
  import { html } from "lit";
1014
1021
 
1015
- // 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
1022
+ // 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
1016
1023
  var buttonDefaultStyling = "font-bold focusable justify-center transition-colors ease-in-out";
1017
1024
  var buttonColors = {
1018
1025
  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]",
@@ -1370,14 +1377,272 @@ var Move = class {
1370
1377
  }
1371
1378
  };
1372
1379
 
1373
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1380
+ // 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
1374
1381
  var import_unraw = __toESM(require_dist(), 1);
1375
1382
 
1376
- // node_modules/.pnpm/@lingui+message-utils@4.11.2/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1383
+ // node_modules/.pnpm/@lingui+message-utils@5.2.0/node_modules/@lingui/message-utils/dist/compileMessage.mjs
1377
1384
  var import_parser = __toESM(require_parser(), 1);
1385
+ var DateFormatError = class extends Error {
1386
+ /** @internal */
1387
+ constructor(msg, token, type) {
1388
+ super(msg);
1389
+ this.token = token;
1390
+ this.type = type || "error";
1391
+ }
1392
+ };
1393
+ var alpha = (width) => width < 4 ? "short" : width === 4 ? "long" : "narrow";
1394
+ var numeric = (width) => width % 2 === 0 ? "2-digit" : "numeric";
1395
+ function yearOptions(token, onError) {
1396
+ switch (token.char) {
1397
+ case "y":
1398
+ return { year: numeric(token.width) };
1399
+ case "r":
1400
+ return { calendar: "gregory", year: "numeric" };
1401
+ case "u":
1402
+ case "U":
1403
+ case "Y":
1404
+ default:
1405
+ onError(`${token.desc} is not supported; falling back to year:numeric`, DateFormatError.WARNING);
1406
+ return { year: "numeric" };
1407
+ }
1408
+ }
1409
+ function monthStyle(token, onError) {
1410
+ switch (token.width) {
1411
+ case 1:
1412
+ return "numeric";
1413
+ case 2:
1414
+ return "2-digit";
1415
+ case 3:
1416
+ return "short";
1417
+ case 4:
1418
+ return "long";
1419
+ case 5:
1420
+ return "narrow";
1421
+ default:
1422
+ onError(`${token.desc} is not supported with width ${token.width}`);
1423
+ return void 0;
1424
+ }
1425
+ }
1426
+ function dayStyle(token, onError) {
1427
+ const { char, desc, width } = token;
1428
+ if (char === "d") {
1429
+ return numeric(width);
1430
+ } else {
1431
+ onError(`${desc} is not supported`);
1432
+ return void 0;
1433
+ }
1434
+ }
1435
+ function weekdayStyle(token, onError) {
1436
+ const { char, desc, width } = token;
1437
+ if ((char === "c" || char === "e") && width < 3) {
1438
+ const msg = `Numeric value is not supported for ${desc}; falling back to weekday:short`;
1439
+ onError(msg, DateFormatError.WARNING);
1440
+ }
1441
+ return alpha(width);
1442
+ }
1443
+ function hourOptions(token) {
1444
+ const hour = numeric(token.width);
1445
+ let hourCycle;
1446
+ switch (token.char) {
1447
+ case "h":
1448
+ hourCycle = "h12";
1449
+ break;
1450
+ case "H":
1451
+ hourCycle = "h23";
1452
+ break;
1453
+ case "k":
1454
+ hourCycle = "h24";
1455
+ break;
1456
+ case "K":
1457
+ hourCycle = "h11";
1458
+ break;
1459
+ }
1460
+ return hourCycle ? { hour, hourCycle } : { hour };
1461
+ }
1462
+ function timeZoneNameStyle(token, onError) {
1463
+ const { char, desc, width } = token;
1464
+ switch (char) {
1465
+ case "v":
1466
+ case "z":
1467
+ return width === 4 ? "long" : "short";
1468
+ case "V":
1469
+ if (width === 4)
1470
+ return "long";
1471
+ onError(`${desc} is not supported with width ${width}`);
1472
+ return void 0;
1473
+ case "X":
1474
+ onError(`${desc} is not supported`);
1475
+ return void 0;
1476
+ }
1477
+ return "short";
1478
+ }
1479
+ function compileOptions(token, onError) {
1480
+ switch (token.field) {
1481
+ case "era":
1482
+ return { era: alpha(token.width) };
1483
+ case "year":
1484
+ return yearOptions(token, onError);
1485
+ case "month":
1486
+ return { month: monthStyle(token, onError) };
1487
+ case "day":
1488
+ return { day: dayStyle(token, onError) };
1489
+ case "weekday":
1490
+ return { weekday: weekdayStyle(token, onError) };
1491
+ case "period":
1492
+ return void 0;
1493
+ case "hour":
1494
+ return hourOptions(token);
1495
+ case "min":
1496
+ return { minute: numeric(token.width) };
1497
+ case "sec":
1498
+ return { second: numeric(token.width) };
1499
+ case "tz":
1500
+ return { timeZoneName: timeZoneNameStyle(token, onError) };
1501
+ case "quarter":
1502
+ case "week":
1503
+ case "sec-frac":
1504
+ case "ms":
1505
+ onError(`${token.desc} is not supported`);
1506
+ }
1507
+ return void 0;
1508
+ }
1509
+ function getDateFormatOptions(tokens, timeZone, onError = (error) => {
1510
+ throw error;
1511
+ }) {
1512
+ const options = {
1513
+ timeZone
1514
+ };
1515
+ const fields2 = [];
1516
+ for (const token of tokens) {
1517
+ const { error, field, str } = token;
1518
+ if (error) {
1519
+ const dte = new DateFormatError(error.message, token);
1520
+ dte.stack = error.stack;
1521
+ onError(dte);
1522
+ }
1523
+ if (str) {
1524
+ const msg = `Ignoring string part: ${str}`;
1525
+ onError(new DateFormatError(msg, token, DateFormatError.WARNING));
1526
+ }
1527
+ if (field) {
1528
+ if (fields2.indexOf(field) === -1)
1529
+ fields2.push(field);
1530
+ else
1531
+ onError(new DateFormatError(`Duplicate ${field} token`, token));
1532
+ }
1533
+ const opt = compileOptions(token, (msg, isWarning) => onError(new DateFormatError(msg, token, isWarning)));
1534
+ if (opt)
1535
+ Object.assign(options, opt);
1536
+ }
1537
+ return options;
1538
+ }
1539
+ var fields = {
1540
+ G: { field: "era", desc: "Era" },
1541
+ y: { field: "year", desc: "Year" },
1542
+ Y: { field: "year", desc: 'Year of "Week of Year"' },
1543
+ u: { field: "year", desc: "Extended year" },
1544
+ U: { field: "year", desc: "Cyclic year name" },
1545
+ r: { field: "year", desc: "Related Gregorian year" },
1546
+ Q: { field: "quarter", desc: "Quarter" },
1547
+ q: { field: "quarter", desc: "Stand-alone quarter" },
1548
+ M: { field: "month", desc: "Month in year" },
1549
+ L: { field: "month", desc: "Stand-alone month in year" },
1550
+ w: { field: "week", desc: "Week of year" },
1551
+ W: { field: "week", desc: "Week of month" },
1552
+ d: { field: "day", desc: "Day in month" },
1553
+ D: { field: "day", desc: "Day of year" },
1554
+ F: { field: "day", desc: "Day of week in month" },
1555
+ g: { field: "day", desc: "Modified julian day" },
1556
+ E: { field: "weekday", desc: "Day of week" },
1557
+ e: { field: "weekday", desc: "Local day of week" },
1558
+ c: { field: "weekday", desc: "Stand-alone local day of week" },
1559
+ a: { field: "period", desc: "AM/PM marker" },
1560
+ b: { field: "period", desc: "AM/PM/noon/midnight marker" },
1561
+ B: { field: "period", desc: "Flexible day period" },
1562
+ h: { field: "hour", desc: "Hour in AM/PM (1~12)" },
1563
+ H: { field: "hour", desc: "Hour in day (0~23)" },
1564
+ k: { field: "hour", desc: "Hour in day (1~24)" },
1565
+ K: { field: "hour", desc: "Hour in AM/PM (0~11)" },
1566
+ j: { field: "hour", desc: "Hour in preferred cycle" },
1567
+ J: { field: "hour", desc: "Hour in preferred cycle without marker" },
1568
+ C: { field: "hour", desc: "Hour in preferred cycle with flexible marker" },
1569
+ m: { field: "min", desc: "Minute in hour" },
1570
+ s: { field: "sec", desc: "Second in minute" },
1571
+ S: { field: "sec-frac", desc: "Fractional second" },
1572
+ A: { field: "ms", desc: "Milliseconds in day" },
1573
+ z: { field: "tz", desc: "Time Zone: specific non-location" },
1574
+ Z: { field: "tz", desc: "Time Zone" },
1575
+ O: { field: "tz", desc: "Time Zone: localized" },
1576
+ v: { field: "tz", desc: "Time Zone: generic non-location" },
1577
+ V: { field: "tz", desc: "Time Zone: ID" },
1578
+ X: { field: "tz", desc: "Time Zone: ISO8601 with Z" },
1579
+ x: { field: "tz", desc: "Time Zone: ISO8601" }
1580
+ };
1581
+ var isLetter = (char) => char >= "A" && char <= "Z" || char >= "a" && char <= "z";
1582
+ function readFieldToken(src, pos) {
1583
+ const char = src[pos];
1584
+ let width = 1;
1585
+ while (src[++pos] === char)
1586
+ ++width;
1587
+ const field = fields[char];
1588
+ if (!field) {
1589
+ const msg = `The letter ${char} is not a valid field identifier`;
1590
+ return { char, error: new Error(msg), width };
1591
+ }
1592
+ return { char, field: field.field, desc: field.desc, width };
1593
+ }
1594
+ function readQuotedToken(src, pos) {
1595
+ let str = src[++pos];
1596
+ let width = 2;
1597
+ if (str === "'")
1598
+ return { char: "'", str, width };
1599
+ while (true) {
1600
+ const next = src[++pos];
1601
+ ++width;
1602
+ if (next === void 0) {
1603
+ const msg = `Unterminated quoted literal in pattern: ${str || src}`;
1604
+ return { char: "'", error: new Error(msg), str, width };
1605
+ } else if (next === "'") {
1606
+ if (src[++pos] !== "'")
1607
+ return { char: "'", str, width };
1608
+ else
1609
+ ++width;
1610
+ }
1611
+ str += next;
1612
+ }
1613
+ }
1614
+ function readToken(src, pos) {
1615
+ const char = src[pos];
1616
+ if (!char)
1617
+ return null;
1618
+ if (isLetter(char))
1619
+ return readFieldToken(src, pos);
1620
+ if (char === "'")
1621
+ return readQuotedToken(src, pos);
1622
+ let str = char;
1623
+ let width = 1;
1624
+ while (true) {
1625
+ const next = src[++pos];
1626
+ if (!next || isLetter(next) || next === "'")
1627
+ return { char, str, width };
1628
+ str += next;
1629
+ width += 1;
1630
+ }
1631
+ }
1632
+ function parseDateTokens(src) {
1633
+ const tokens = [];
1634
+ let pos = 0;
1635
+ while (true) {
1636
+ const token = readToken(src, pos);
1637
+ if (!token)
1638
+ return tokens;
1639
+ tokens.push(token);
1640
+ pos += token.width;
1641
+ }
1642
+ }
1378
1643
  function processTokens(tokens, mapText) {
1379
1644
  if (!tokens.filter((token) => token.type !== "content").length) {
1380
- return tokens.map((token) => mapText(token.value)).join("");
1645
+ return tokens.map((token) => mapText(token.value));
1381
1646
  }
1382
1647
  return tokens.map((token) => {
1383
1648
  var _a;
@@ -1389,6 +1654,12 @@ function processTokens(tokens, mapText) {
1389
1654
  return [token.arg];
1390
1655
  } else if (token.type === "function") {
1391
1656
  const _param = (_a = token == null ? void 0 : token.param) == null ? void 0 : _a[0];
1657
+ if (token.key === "date" && _param) {
1658
+ const opts = compileDateExpression(_param.value.trim(), (e) => {
1659
+ throw new Error(`Unable to compile date expression: ${e.message}`);
1660
+ });
1661
+ return [token.arg, token.key, opts];
1662
+ }
1392
1663
  if (_param) {
1393
1664
  return [token.arg, token.key, _param.value.trim()];
1394
1665
  } else {
@@ -1410,6 +1681,13 @@ function processTokens(tokens, mapText) {
1410
1681
  ];
1411
1682
  });
1412
1683
  }
1684
+ function compileDateExpression(format, onError) {
1685
+ if (/^::/.test(format)) {
1686
+ const tokens = parseDateTokens(format.substring(2));
1687
+ return getDateFormatOptions(tokens, void 0, onError);
1688
+ }
1689
+ return format;
1690
+ }
1413
1691
  function compileMessage(message, mapText = (v) => v) {
1414
1692
  try {
1415
1693
  return processTokens((0, import_parser.parse)(message), mapText);
@@ -1417,11 +1695,11 @@ function compileMessage(message, mapText = (v) => v) {
1417
1695
  console.error(`${e.message}
1418
1696
 
1419
1697
  Message: ${message}`);
1420
- return message;
1698
+ return [message];
1421
1699
  }
1422
1700
  }
1423
1701
 
1424
- // node_modules/.pnpm/@lingui+core@4.11.2/node_modules/@lingui/core/dist/index.mjs
1702
+ // 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
1425
1703
  var isString = (s) => typeof s === "string";
1426
1704
  var isFunction = (f2) => typeof f2 === "function";
1427
1705
  var cache = /* @__PURE__ */ new Map();
@@ -1432,12 +1710,59 @@ function normalizeLocales(locales) {
1432
1710
  }
1433
1711
  function date(locales, value, format) {
1434
1712
  const _locales = normalizeLocales(locales);
1713
+ if (!format) {
1714
+ format = "default";
1715
+ }
1716
+ let o;
1717
+ if (typeof format === "string") {
1718
+ o = {
1719
+ day: "numeric",
1720
+ month: "short",
1721
+ year: "numeric"
1722
+ };
1723
+ switch (format) {
1724
+ case "full":
1725
+ o.weekday = "long";
1726
+ case "long":
1727
+ o.month = "long";
1728
+ break;
1729
+ case "short":
1730
+ o.month = "numeric";
1731
+ break;
1732
+ }
1733
+ } else {
1734
+ o = format;
1735
+ }
1435
1736
  const formatter = getMemoized(
1436
1737
  () => cacheKey("date", _locales, format),
1437
- () => new Intl.DateTimeFormat(_locales, format)
1738
+ () => new Intl.DateTimeFormat(_locales, o)
1438
1739
  );
1439
1740
  return formatter.format(isString(value) ? new Date(value) : value);
1440
1741
  }
1742
+ function time(locales, value, format) {
1743
+ let o;
1744
+ if (!format) {
1745
+ format = "default";
1746
+ }
1747
+ if (typeof format === "string") {
1748
+ o = {
1749
+ second: "numeric",
1750
+ minute: "numeric",
1751
+ hour: "numeric"
1752
+ };
1753
+ switch (format) {
1754
+ case "full":
1755
+ case "long":
1756
+ o.timeZoneName = "short";
1757
+ break;
1758
+ case "short":
1759
+ delete o.second;
1760
+ }
1761
+ } else {
1762
+ o = format;
1763
+ }
1764
+ return date(locales, value, o);
1765
+ }
1441
1766
  function number(locales, value, format) {
1442
1767
  const _locales = normalizeLocales(locales);
1443
1768
  const formatter = getMemoized(
@@ -1472,12 +1797,14 @@ function cacheKey(type, locales, options) {
1472
1797
  const localeKey = locales.join("-");
1473
1798
  return `${type}-${localeKey}-${JSON.stringify(options)}`;
1474
1799
  }
1475
- var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/g;
1800
+ var UNICODE_REGEX = /\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/;
1476
1801
  var OCTOTHORPE_PH = "%__lingui_octothorpe__%";
1477
1802
  var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1478
1803
  const locales = passedLocales || locale;
1479
1804
  const style = (format) => {
1480
- return typeof format === "object" ? format : formats[format] || { style: format };
1805
+ if (typeof format === "object")
1806
+ return format;
1807
+ return formats[format];
1481
1808
  };
1482
1809
  const replaceOctothorpe = (value, message) => {
1483
1810
  const numberFormat = Object.keys(formats).length ? style("number") : void 0;
@@ -1496,8 +1823,13 @@ var getDefaultFormats = (locale, passedLocales, formats = {}) => {
1496
1823
  return replaceOctothorpe(value - offset, message);
1497
1824
  },
1498
1825
  select: selectFormatter,
1499
- number: (value, format) => number(locales, value, style(format)),
1500
- date: (value, format) => date(locales, value, style(format))
1826
+ number: (value, format) => number(
1827
+ locales,
1828
+ value,
1829
+ style(format) || { style: format }
1830
+ ),
1831
+ date: (value, format) => date(locales, value, style(format) || format),
1832
+ time: (value, format) => time(locales, value, style(format) || format)
1501
1833
  };
1502
1834
  };
1503
1835
  var selectFormatter = (value, rules) => {
@@ -1546,10 +1878,10 @@ function interpolate(translation, locale, locales) {
1546
1878
  };
1547
1879
  const result = formatMessage(translation);
1548
1880
  if (isString(result) && UNICODE_REGEX.test(result)) {
1549
- return (0, import_unraw.unraw)(result.trim());
1881
+ return (0, import_unraw.unraw)(result);
1550
1882
  }
1551
1883
  if (isString(result))
1552
- return result.trim();
1884
+ return result;
1553
1885
  return result ? String(result) : "";
1554
1886
  };
1555
1887
  }
@@ -1604,7 +1936,11 @@ var I18n = class extends EventEmitter {
1604
1936
  __publicField2(this, "_localeData", {});
1605
1937
  __publicField2(this, "_messages", {});
1606
1938
  __publicField2(this, "_missing");
1939
+ __publicField2(this, "_messageCompiler");
1607
1940
  __publicField2(this, "t", this._.bind(this));
1941
+ if (true) {
1942
+ this.setMessagesCompiler(compileMessage);
1943
+ }
1608
1944
  if (params.missing != null)
1609
1945
  this._missing = params.missing;
1610
1946
  if (params.messages != null)
@@ -1640,12 +1976,30 @@ var I18n = class extends EventEmitter {
1640
1976
  Object.assign(maybeLocaleData, localeData);
1641
1977
  }
1642
1978
  }
1979
+ /**
1980
+ * Registers a `MessageCompiler` to enable the use of uncompiled catalogs at runtime.
1981
+ *
1982
+ * In production builds, the `MessageCompiler` is typically excluded to reduce bundle size.
1983
+ * By default, message catalogs should be precompiled during the build process. However,
1984
+ * if you need to compile catalogs at runtime, you can use this method to set a message compiler.
1985
+ *
1986
+ * Example usage:
1987
+ *
1988
+ * ```ts
1989
+ * import { compileMessage } from "@lingui/message-utils/compileMessage";
1990
+ *
1991
+ * i18n.setMessagesCompiler(compileMessage);
1992
+ * ```
1993
+ */
1994
+ setMessagesCompiler(compiler) {
1995
+ this._messageCompiler = compiler;
1996
+ return this;
1997
+ }
1643
1998
  /**
1644
1999
  * @deprecated Plurals automatically used from Intl.PluralRules you can safely remove this call. Deprecated in v4
1645
2000
  */
1646
- // @ts-ignore deprecated, so ignore the reported error
1647
2001
  loadLocaleData(localeOrAllData, localeData) {
1648
- if (localeData != null) {
2002
+ if (typeof localeOrAllData === "string") {
1649
2003
  this._loadLocaleData(localeOrAllData, localeData);
1650
2004
  } else {
1651
2005
  Object.keys(localeOrAllData).forEach(
@@ -1692,6 +2046,11 @@ var I18n = class extends EventEmitter {
1692
2046
  this.emit("change");
1693
2047
  }
1694
2048
  _(id, values, options) {
2049
+ if (!this.locale) {
2050
+ throw new Error(
2051
+ "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."
2052
+ );
2053
+ }
1695
2054
  let message = options == null ? void 0 : options.message;
1696
2055
  if (!id) {
1697
2056
  id = "";
@@ -1711,8 +2070,20 @@ var I18n = class extends EventEmitter {
1711
2070
  this.emit("missing", { id, locale: this._locale });
1712
2071
  }
1713
2072
  let translation = messageForId || message || id;
1714
- if (true) {
1715
- translation = isString(translation) ? compileMessage(translation) : translation;
2073
+ if (isString(translation)) {
2074
+ if (this._messageCompiler) {
2075
+ translation = this._messageCompiler(translation);
2076
+ } else {
2077
+ console.warn(`Uncompiled message detected! Message:
2078
+
2079
+ > ${translation}
2080
+
2081
+ That means you use raw catalog or your catalog doesn't have a translation for the message and fallback was used.
2082
+ ICU features such as interpolation and plurals will not work properly for that message.
2083
+
2084
+ Please compile your catalog first.
2085
+ `);
2086
+ }
1716
2087
  }
1717
2088
  if (isString(translation) && UNICODE_REGEX.test(translation))
1718
2089
  return JSON.parse(`"${translation}"`);
@@ -1736,14 +2107,14 @@ function setupI18n(params = {}) {
1736
2107
  }
1737
2108
  var i18n = setupI18n();
1738
2109
 
1739
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/arrow-left-16.js
2110
+ // 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/arrow-left-16.js
1740
2111
  import { LitElement } from "lit";
1741
2112
  import { unsafeStatic, html as html2 } from "lit/static-html.js";
1742
- var messages = JSON.parse('{"icon.title.arrow-left":"Pil som peker mot venstre"}');
1743
- var messages2 = JSON.parse('{"icon.title.arrow-left":"Leftward-pointing arrow"}');
1744
- var messages3 = JSON.parse('{"icon.title.arrow-left":"Vasemmalle osoittava nuoli"}');
1745
- var messages4 = JSON.parse('{"icon.title.arrow-left":"Pil til venstre"}');
1746
- var messages5 = JSON.parse('{"icon.title.arrow-left":"Pil som pekar v\xE4nster"}');
2113
+ var messages = JSON.parse('{"icon.title.arrow-left":["Pil som peker mot venstre"]}');
2114
+ var messages2 = JSON.parse('{"icon.title.arrow-left":["Leftward-pointing arrow"]}');
2115
+ var messages3 = JSON.parse('{"icon.title.arrow-left":["Vasemmalle osoittava nuoli"]}');
2116
+ var messages4 = JSON.parse('{"icon.title.arrow-left":["Pil til venstre"]}');
2117
+ var messages5 = JSON.parse('{"icon.title.arrow-left":["Pil som pekar v\xE4nster"]}');
1747
2118
  var supportedLocales = ["en", "nb", "fi", "da", "sv"];
1748
2119
  var defaultLocale2 = "en";
1749
2120
  var detectByBrand = () => {
@@ -1830,14 +2201,14 @@ if (!customElements.get("w-icon-arrow-left-16")) {
1830
2201
  customElements.define("w-icon-arrow-left-16", IconArrowLeft16);
1831
2202
  }
1832
2203
 
1833
- // node_modules/.pnpm/@warp-ds+icons@2.4.0/node_modules/@warp-ds/icons/dist/elements/close-16.js
2204
+ // 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
1834
2205
  import { LitElement as LitElement2 } from "lit";
1835
2206
  import { unsafeStatic as unsafeStatic2, html as html3 } from "lit/static-html.js";
1836
- var messages6 = JSON.parse('{"icon.title.close":"Kryss"}');
1837
- var messages22 = JSON.parse('{"icon.title.close":"Cross"}');
1838
- var messages32 = JSON.parse('{"icon.title.close":"Rasti"}');
1839
- var messages42 = JSON.parse('{"icon.title.close":"Kryds"}');
1840
- var messages52 = JSON.parse('{"icon.title.close":"Kryss"}');
2207
+ var messages6 = JSON.parse('{"icon.title.close":["Kryss"]}');
2208
+ var messages22 = JSON.parse('{"icon.title.close":["Cross"]}');
2209
+ var messages32 = JSON.parse('{"icon.title.close":["Rasti"]}');
2210
+ var messages42 = JSON.parse('{"icon.title.close":["Kryds"]}');
2211
+ var messages52 = JSON.parse('{"icon.title.close":["Kryss"]}');
1841
2212
  var supportedLocales2 = ["en", "nb", "fi", "da", "sv"];
1842
2213
  var defaultLocale3 = "en";
1843
2214
  var detectByBrand2 = () => {
@@ -1964,19 +2335,19 @@ var activateI18n3 = (enMessages, nbMessages, fiMessages, daMessages, svMessages)
1964
2335
  };
1965
2336
 
1966
2337
  // packages/modal/locales/da/messages.mjs
1967
- var messages7 = JSON.parse('{"modal.aria.back":"Tilbage","modal.aria.close":"Luk"}');
2338
+ var messages7 = JSON.parse('{"modal.aria.back":["Tilbage"],"modal.aria.close":["Luk"]}');
1968
2339
 
1969
2340
  // packages/modal/locales/en/messages.mjs
1970
- var messages8 = JSON.parse('{"modal.aria.back":"Back","modal.aria.close":"Close"}');
2341
+ var messages8 = JSON.parse('{"modal.aria.back":["Back"],"modal.aria.close":["Close"]}');
1971
2342
 
1972
2343
  // packages/modal/locales/fi/messages.mjs
1973
- var messages9 = JSON.parse('{"modal.aria.back":"Takaisin","modal.aria.close":"Sulje"}');
2344
+ var messages9 = JSON.parse('{"modal.aria.back":["Takaisin"],"modal.aria.close":["Sulje"]}');
1974
2345
 
1975
2346
  // packages/modal/locales/nb/messages.mjs
1976
- var messages10 = JSON.parse('{"modal.aria.back":"Tilbake","modal.aria.close":"Lukk"}');
2347
+ var messages10 = JSON.parse('{"modal.aria.back":["Tilbake"],"modal.aria.close":["Lukk"]}');
1977
2348
 
1978
2349
  // packages/modal/locales/sv/messages.mjs
1979
- var messages11 = JSON.parse('{"modal.aria.back":"Tillbaka","modal.aria.close":"St\xE4ng"}');
2350
+ var messages11 = JSON.parse('{"modal.aria.back":["Tillbaka"],"modal.aria.close":["St\xE4ng"]}');
1980
2351
 
1981
2352
  // packages/modal/modal-header.js
1982
2353
  var NO_CLOSE_BUTTON = "no-close";