@economic/taco 2.60.1-date-fns.0 → 2.61.1

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.
package/dist/taco.cjs CHANGED
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2
5
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
6
  const React = require("react");
4
7
  const ReactDOM = require("react-dom");
@@ -4561,7 +4564,7 @@ var zeroGap = {
4561
4564
  right: 0,
4562
4565
  gap: 0
4563
4566
  };
4564
- var parse$2 = function(x2) {
4567
+ var parse$3 = function(x2) {
4565
4568
  return parseInt(x2 || "", 10) || 0;
4566
4569
  };
4567
4570
  var getOffset$1 = function(gapMode) {
@@ -4569,7 +4572,7 @@ var getOffset$1 = function(gapMode) {
4569
4572
  var left = cs[gapMode === "padding" ? "paddingLeft" : "marginLeft"];
4570
4573
  var top = cs[gapMode === "padding" ? "paddingTop" : "marginTop"];
4571
4574
  var right = cs[gapMode === "padding" ? "paddingRight" : "marginRight"];
4572
- return [parse$2(left), parse$2(top), parse$2(right)];
4575
+ return [parse$3(left), parse$3(top), parse$3(right)];
4573
4576
  };
4574
4577
  var getGapWidth = function(gapMode) {
4575
4578
  if (gapMode === void 0) {
@@ -9770,7 +9773,7 @@ const useMergedRef = (ref) => {
9770
9773
  return internalRef;
9771
9774
  };
9772
9775
  const FOCUSABLE_ELEMENTS = [
9773
- "[tabindex]:not([disabled])",
9776
+ '[tabindex]:not([tabindex="-1"]):not([disabled])',
9774
9777
  "input:not([disabled])",
9775
9778
  "select:not([disabled])",
9776
9779
  "textarea:not([disabled])",
@@ -9783,7 +9786,7 @@ const FOCUSABLE_ELEMENTS = [
9783
9786
  "embed",
9784
9787
  "audio[controls]",
9785
9788
  "video[controls]",
9786
- "[contenteditable]",
9789
+ '[contenteditable]:not([contenteditable="false"]):not([disabled])',
9787
9790
  "details:not([disabled])",
9788
9791
  "summary:not(:disabled)"
9789
9792
  ];
@@ -9808,14 +9811,14 @@ const getIndexOfFirstChildOverflowingParent = (element, overscan = 0) => {
9808
9811
  }
9809
9812
  return boundaryChildIndex;
9810
9813
  };
9811
- const getNextFocussableElement = (currentElement) => {
9814
+ const getNextFocussableElement = (currentElement, direction = 1) => {
9812
9815
  if (!currentElement) {
9813
9816
  return null;
9814
9817
  }
9815
9818
  let focussableElements = [...document.querySelectorAll(FOCUSABLE_ELEMENTS.join(","))];
9816
9819
  const currentElementIndex = focussableElements.indexOf(currentElement);
9817
9820
  if (currentElementIndex > -1) {
9818
- focussableElements = focussableElements.slice(currentElementIndex + 1).filter((element) => element.getAttribute("tabindex") !== "-1");
9821
+ focussableElements = focussableElements.slice(currentElementIndex + direction).filter((element) => element.getAttribute("tabindex") !== "-1");
9819
9822
  if (focussableElements.length) {
9820
9823
  focussableElements = focussableElements.filter((element) => {
9821
9824
  var _a;
@@ -9864,6 +9867,9 @@ function isSiblingElementInsideSameParentOverlay(element, sibling) {
9864
9867
  var _a;
9865
9868
  return !!((_a = element == null ? void 0 : element.closest("[role=dialog],[role=menu]")) == null ? void 0 : _a.contains(sibling));
9866
9869
  }
9870
+ function isElementInsideExternalRelatedOverlay(element, tableRef) {
9871
+ return isElementInsideOverlay(element) && !isSiblingElementInsideSameParentOverlay(element, tableRef.current) || isElementInteractive(element) && !isElementInsideOrTriggeredFromContainer(element, tableRef.current);
9872
+ }
9867
9873
  function isElementInteractive(element) {
9868
9874
  if (!element) {
9869
9875
  return false;
@@ -11886,13 +11892,16 @@ function addMonths(date2, amount) {
11886
11892
  }
11887
11893
  const millisecondsInWeek = 6048e5;
11888
11894
  const millisecondsInDay = 864e5;
11895
+ const millisecondsInMinute = 6e4;
11896
+ const millisecondsInHour = 36e5;
11897
+ const millisecondsInSecond = 1e3;
11889
11898
  let defaultOptions$3 = {};
11890
- function getDefaultOptions() {
11899
+ function getDefaultOptions$1() {
11891
11900
  return defaultOptions$3;
11892
11901
  }
11893
11902
  function startOfWeek(date2, options) {
11894
11903
  var _a, _b, _c, _d;
11895
- const defaultOptions2 = getDefaultOptions();
11904
+ const defaultOptions2 = getDefaultOptions$1();
11896
11905
  const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
11897
11906
  const _date = toDate(date2);
11898
11907
  const day = _date.getDay();
@@ -12036,7 +12045,7 @@ function startOfYear(date2) {
12036
12045
  }
12037
12046
  function endOfWeek(date2, options) {
12038
12047
  var _a, _b, _c, _d;
12039
- const defaultOptions2 = getDefaultOptions();
12048
+ const defaultOptions2 = getDefaultOptions$1();
12040
12049
  const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
12041
12050
  const _date = toDate(date2);
12042
12051
  const day = _date.getDay();
@@ -12552,7 +12561,7 @@ function getWeekYear(date2, options) {
12552
12561
  var _a, _b, _c, _d;
12553
12562
  const _date = toDate(date2);
12554
12563
  const year = _date.getFullYear();
12555
- const defaultOptions2 = getDefaultOptions();
12564
+ const defaultOptions2 = getDefaultOptions$1();
12556
12565
  const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
12557
12566
  const firstWeekOfNextYear = constructFrom(date2, 0);
12558
12567
  firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate);
@@ -12572,7 +12581,7 @@ function getWeekYear(date2, options) {
12572
12581
  }
12573
12582
  function startOfWeekYear(date2, options) {
12574
12583
  var _a, _b, _c, _d;
12575
- const defaultOptions2 = getDefaultOptions();
12584
+ const defaultOptions2 = getDefaultOptions$1();
12576
12585
  const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
12577
12586
  const year = getWeekYear(date2, options);
12578
12587
  const firstWeek = constructFrom(date2, 0);
@@ -13254,222 +13263,1977 @@ const formatters$1 = {
13254
13263
  // Long
13255
13264
  case "zzzz":
13256
13265
  default:
13257
- return "GMT" + formatTimezone(timezoneOffset, ":");
13266
+ return "GMT" + formatTimezone(timezoneOffset, ":");
13267
+ }
13268
+ },
13269
+ // Seconds timestamp
13270
+ t: function(date2, token, _localize) {
13271
+ const timestamp = Math.trunc(date2.getTime() / 1e3);
13272
+ return addLeadingZeros(timestamp, token.length);
13273
+ },
13274
+ // Milliseconds timestamp
13275
+ T: function(date2, token, _localize) {
13276
+ const timestamp = date2.getTime();
13277
+ return addLeadingZeros(timestamp, token.length);
13278
+ }
13279
+ };
13280
+ function formatTimezoneShort(offset2, delimiter = "") {
13281
+ const sign2 = offset2 > 0 ? "-" : "+";
13282
+ const absOffset = Math.abs(offset2);
13283
+ const hours = Math.trunc(absOffset / 60);
13284
+ const minutes = absOffset % 60;
13285
+ if (minutes === 0) {
13286
+ return sign2 + String(hours);
13287
+ }
13288
+ return sign2 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
13289
+ }
13290
+ function formatTimezoneWithOptionalMinutes(offset2, delimiter) {
13291
+ if (offset2 % 60 === 0) {
13292
+ const sign2 = offset2 > 0 ? "-" : "+";
13293
+ return sign2 + addLeadingZeros(Math.abs(offset2) / 60, 2);
13294
+ }
13295
+ return formatTimezone(offset2, delimiter);
13296
+ }
13297
+ function formatTimezone(offset2, delimiter = "") {
13298
+ const sign2 = offset2 > 0 ? "-" : "+";
13299
+ const absOffset = Math.abs(offset2);
13300
+ const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
13301
+ const minutes = addLeadingZeros(absOffset % 60, 2);
13302
+ return sign2 + hours + delimiter + minutes;
13303
+ }
13304
+ const dateLongFormatter = (pattern, formatLong2) => {
13305
+ switch (pattern) {
13306
+ case "P":
13307
+ return formatLong2.date({ width: "short" });
13308
+ case "PP":
13309
+ return formatLong2.date({ width: "medium" });
13310
+ case "PPP":
13311
+ return formatLong2.date({ width: "long" });
13312
+ case "PPPP":
13313
+ default:
13314
+ return formatLong2.date({ width: "full" });
13315
+ }
13316
+ };
13317
+ const timeLongFormatter = (pattern, formatLong2) => {
13318
+ switch (pattern) {
13319
+ case "p":
13320
+ return formatLong2.time({ width: "short" });
13321
+ case "pp":
13322
+ return formatLong2.time({ width: "medium" });
13323
+ case "ppp":
13324
+ return formatLong2.time({ width: "long" });
13325
+ case "pppp":
13326
+ default:
13327
+ return formatLong2.time({ width: "full" });
13328
+ }
13329
+ };
13330
+ const dateTimeLongFormatter = (pattern, formatLong2) => {
13331
+ const matchResult = pattern.match(/(P+)(p+)?/) || [];
13332
+ const datePattern = matchResult[1];
13333
+ const timePattern = matchResult[2];
13334
+ if (!timePattern) {
13335
+ return dateLongFormatter(pattern, formatLong2);
13336
+ }
13337
+ let dateTimeFormat;
13338
+ switch (datePattern) {
13339
+ case "P":
13340
+ dateTimeFormat = formatLong2.dateTime({ width: "short" });
13341
+ break;
13342
+ case "PP":
13343
+ dateTimeFormat = formatLong2.dateTime({ width: "medium" });
13344
+ break;
13345
+ case "PPP":
13346
+ dateTimeFormat = formatLong2.dateTime({ width: "long" });
13347
+ break;
13348
+ case "PPPP":
13349
+ default:
13350
+ dateTimeFormat = formatLong2.dateTime({ width: "full" });
13351
+ break;
13352
+ }
13353
+ return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
13354
+ };
13355
+ const longFormatters = {
13356
+ p: timeLongFormatter,
13357
+ P: dateTimeLongFormatter
13358
+ };
13359
+ const dayOfYearTokenRE = /^D+$/;
13360
+ const weekYearTokenRE = /^Y+$/;
13361
+ const throwTokens = ["D", "DD", "YY", "YYYY"];
13362
+ function isProtectedDayOfYearToken(token) {
13363
+ return dayOfYearTokenRE.test(token);
13364
+ }
13365
+ function isProtectedWeekYearToken(token) {
13366
+ return weekYearTokenRE.test(token);
13367
+ }
13368
+ function warnOrThrowProtectedError(token, format2, input) {
13369
+ const _message = message(token, format2, input);
13370
+ console.warn(_message);
13371
+ if (throwTokens.includes(token)) throw new RangeError(_message);
13372
+ }
13373
+ function message(token, format2, input) {
13374
+ const subject = token[0] === "Y" ? "years" : "days of the month";
13375
+ return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
13376
+ }
13377
+ const formattingTokensRegExp$1 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
13378
+ const longFormattingTokensRegExp$1 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
13379
+ const escapedStringRegExp$1 = /^'([^]*?)'?$/;
13380
+ const doubleQuoteRegExp$1 = /''/g;
13381
+ const unescapedLatinCharacterRegExp$1 = /[a-zA-Z]/;
13382
+ function format$2(date2, formatStr, options) {
13383
+ var _a, _b, _c, _d, _e, _f, _g, _h;
13384
+ const defaultOptions2 = getDefaultOptions$1();
13385
+ const locale2 = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
13386
+ const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
13387
+ const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_f = (_e = options == null ? void 0 : options.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_h = (_g = defaultOptions2.locale) == null ? void 0 : _g.options) == null ? void 0 : _h.weekStartsOn) ?? 0;
13388
+ const originalDate = toDate(date2);
13389
+ if (!isValid(originalDate)) {
13390
+ throw new RangeError("Invalid time value");
13391
+ }
13392
+ let parts = formatStr.match(longFormattingTokensRegExp$1).map((substring) => {
13393
+ const firstCharacter = substring[0];
13394
+ if (firstCharacter === "p" || firstCharacter === "P") {
13395
+ const longFormatter = longFormatters[firstCharacter];
13396
+ return longFormatter(substring, locale2.formatLong);
13397
+ }
13398
+ return substring;
13399
+ }).join("").match(formattingTokensRegExp$1).map((substring) => {
13400
+ if (substring === "''") {
13401
+ return { isToken: false, value: "'" };
13402
+ }
13403
+ const firstCharacter = substring[0];
13404
+ if (firstCharacter === "'") {
13405
+ return { isToken: false, value: cleanEscapedString$1(substring) };
13406
+ }
13407
+ if (formatters$1[firstCharacter]) {
13408
+ return { isToken: true, value: substring };
13409
+ }
13410
+ if (firstCharacter.match(unescapedLatinCharacterRegExp$1)) {
13411
+ throw new RangeError(
13412
+ "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
13413
+ );
13414
+ }
13415
+ return { isToken: false, value: substring };
13416
+ });
13417
+ if (locale2.localize.preprocessor) {
13418
+ parts = locale2.localize.preprocessor(originalDate, parts);
13419
+ }
13420
+ const formatterOptions = {
13421
+ firstWeekContainsDate,
13422
+ weekStartsOn,
13423
+ locale: locale2
13424
+ };
13425
+ return parts.map((part) => {
13426
+ if (!part.isToken) return part.value;
13427
+ const token = part.value;
13428
+ if (!(options == null ? void 0 : options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token) || !(options == null ? void 0 : options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {
13429
+ warnOrThrowProtectedError(token, formatStr, String(date2));
13430
+ }
13431
+ const formatter = formatters$1[token[0]];
13432
+ return formatter(originalDate, token, locale2.localize, formatterOptions);
13433
+ }).join("");
13434
+ }
13435
+ function cleanEscapedString$1(input) {
13436
+ const matched = input.match(escapedStringRegExp$1);
13437
+ if (!matched) {
13438
+ return input;
13439
+ }
13440
+ return matched[1].replace(doubleQuoteRegExp$1, "'");
13441
+ }
13442
+ function getDaysInMonth(date2) {
13443
+ const _date = toDate(date2);
13444
+ const year = _date.getFullYear();
13445
+ const monthIndex = _date.getMonth();
13446
+ const lastDayOfMonth2 = constructFrom(date2, 0);
13447
+ lastDayOfMonth2.setFullYear(year, monthIndex + 1, 0);
13448
+ lastDayOfMonth2.setHours(0, 0, 0, 0);
13449
+ return lastDayOfMonth2.getDate();
13450
+ }
13451
+ function getDefaultOptions() {
13452
+ return Object.assign({}, getDefaultOptions$1());
13453
+ }
13454
+ function getISODay(date2) {
13455
+ const _date = toDate(date2);
13456
+ let day = _date.getDay();
13457
+ if (day === 0) {
13458
+ day = 7;
13459
+ }
13460
+ return day;
13461
+ }
13462
+ function getUnixTime(date2) {
13463
+ return Math.trunc(+toDate(date2) / 1e3);
13464
+ }
13465
+ function lastDayOfMonth(date2) {
13466
+ const _date = toDate(date2);
13467
+ const month = _date.getMonth();
13468
+ _date.setFullYear(_date.getFullYear(), month + 1, 0);
13469
+ _date.setHours(0, 0, 0, 0);
13470
+ return _date;
13471
+ }
13472
+ function getWeeksInMonth(date2, options) {
13473
+ return differenceInCalendarWeeks(
13474
+ lastDayOfMonth(date2),
13475
+ startOfMonth(date2),
13476
+ options
13477
+ ) + 1;
13478
+ }
13479
+ function isAfter(date2, dateToCompare) {
13480
+ const _date = toDate(date2);
13481
+ const _dateToCompare = toDate(dateToCompare);
13482
+ return _date.getTime() > _dateToCompare.getTime();
13483
+ }
13484
+ function isBefore(date2, dateToCompare) {
13485
+ const _date = toDate(date2);
13486
+ const _dateToCompare = toDate(dateToCompare);
13487
+ return +_date < +_dateToCompare;
13488
+ }
13489
+ function transpose(fromDate, constructor) {
13490
+ const date2 = constructor instanceof Date ? constructFrom(constructor, 0) : new constructor(0);
13491
+ date2.setFullYear(
13492
+ fromDate.getFullYear(),
13493
+ fromDate.getMonth(),
13494
+ fromDate.getDate()
13495
+ );
13496
+ date2.setHours(
13497
+ fromDate.getHours(),
13498
+ fromDate.getMinutes(),
13499
+ fromDate.getSeconds(),
13500
+ fromDate.getMilliseconds()
13501
+ );
13502
+ return date2;
13503
+ }
13504
+ const TIMEZONE_UNIT_PRIORITY = 10;
13505
+ class Setter {
13506
+ constructor() {
13507
+ __publicField(this, "subPriority", 0);
13508
+ }
13509
+ validate(_utcDate, _options) {
13510
+ return true;
13511
+ }
13512
+ }
13513
+ class ValueSetter extends Setter {
13514
+ constructor(value, validateValue, setValue, priority, subPriority) {
13515
+ super();
13516
+ this.value = value;
13517
+ this.validateValue = validateValue;
13518
+ this.setValue = setValue;
13519
+ this.priority = priority;
13520
+ if (subPriority) {
13521
+ this.subPriority = subPriority;
13522
+ }
13523
+ }
13524
+ validate(date2, options) {
13525
+ return this.validateValue(date2, this.value, options);
13526
+ }
13527
+ set(date2, flags, options) {
13528
+ return this.setValue(date2, flags, this.value, options);
13529
+ }
13530
+ }
13531
+ class DateToSystemTimezoneSetter extends Setter {
13532
+ constructor() {
13533
+ super(...arguments);
13534
+ __publicField(this, "priority", TIMEZONE_UNIT_PRIORITY);
13535
+ __publicField(this, "subPriority", -1);
13536
+ }
13537
+ set(date2, flags) {
13538
+ if (flags.timestampIsSet) return date2;
13539
+ return constructFrom(date2, transpose(date2, Date));
13540
+ }
13541
+ }
13542
+ class Parser {
13543
+ run(dateString, token, match2, options) {
13544
+ const result = this.parse(dateString, token, match2, options);
13545
+ if (!result) {
13546
+ return null;
13547
+ }
13548
+ return {
13549
+ setter: new ValueSetter(
13550
+ result.value,
13551
+ this.validate,
13552
+ this.set,
13553
+ this.priority,
13554
+ this.subPriority
13555
+ ),
13556
+ rest: result.rest
13557
+ };
13558
+ }
13559
+ validate(_utcDate, _value, _options) {
13560
+ return true;
13561
+ }
13562
+ }
13563
+ class EraParser extends Parser {
13564
+ constructor() {
13565
+ super(...arguments);
13566
+ __publicField(this, "priority", 140);
13567
+ __publicField(this, "incompatibleTokens", ["R", "u", "t", "T"]);
13568
+ }
13569
+ parse(dateString, token, match2) {
13570
+ switch (token) {
13571
+ // AD, BC
13572
+ case "G":
13573
+ case "GG":
13574
+ case "GGG":
13575
+ return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
13576
+ // A, B
13577
+ case "GGGGG":
13578
+ return match2.era(dateString, { width: "narrow" });
13579
+ // Anno Domini, Before Christ
13580
+ case "GGGG":
13581
+ default:
13582
+ return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" });
13583
+ }
13584
+ }
13585
+ set(date2, flags, value) {
13586
+ flags.era = value;
13587
+ date2.setFullYear(value, 0, 1);
13588
+ date2.setHours(0, 0, 0, 0);
13589
+ return date2;
13590
+ }
13591
+ }
13592
+ const numericPatterns = {
13593
+ month: /^(1[0-2]|0?\d)/,
13594
+ // 0 to 12
13595
+ date: /^(3[0-1]|[0-2]?\d)/,
13596
+ // 0 to 31
13597
+ dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,
13598
+ // 0 to 366
13599
+ week: /^(5[0-3]|[0-4]?\d)/,
13600
+ // 0 to 53
13601
+ hour23h: /^(2[0-3]|[0-1]?\d)/,
13602
+ // 0 to 23
13603
+ hour24h: /^(2[0-4]|[0-1]?\d)/,
13604
+ // 0 to 24
13605
+ hour11h: /^(1[0-1]|0?\d)/,
13606
+ // 0 to 11
13607
+ hour12h: /^(1[0-2]|0?\d)/,
13608
+ // 0 to 12
13609
+ minute: /^[0-5]?\d/,
13610
+ // 0 to 59
13611
+ second: /^[0-5]?\d/,
13612
+ // 0 to 59
13613
+ singleDigit: /^\d/,
13614
+ // 0 to 9
13615
+ twoDigits: /^\d{1,2}/,
13616
+ // 0 to 99
13617
+ threeDigits: /^\d{1,3}/,
13618
+ // 0 to 999
13619
+ fourDigits: /^\d{1,4}/,
13620
+ // 0 to 9999
13621
+ anyDigitsSigned: /^-?\d+/,
13622
+ singleDigitSigned: /^-?\d/,
13623
+ // 0 to 9, -0 to -9
13624
+ twoDigitsSigned: /^-?\d{1,2}/,
13625
+ // 0 to 99, -0 to -99
13626
+ threeDigitsSigned: /^-?\d{1,3}/,
13627
+ // 0 to 999, -0 to -999
13628
+ fourDigitsSigned: /^-?\d{1,4}/
13629
+ // 0 to 9999, -0 to -9999
13630
+ };
13631
+ const timezonePatterns = {
13632
+ basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/,
13633
+ basic: /^([+-])(\d{2})(\d{2})|Z/,
13634
+ basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,
13635
+ extended: /^([+-])(\d{2}):(\d{2})|Z/,
13636
+ extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/
13637
+ };
13638
+ function mapValue(parseFnResult, mapFn) {
13639
+ if (!parseFnResult) {
13640
+ return parseFnResult;
13641
+ }
13642
+ return {
13643
+ value: mapFn(parseFnResult.value),
13644
+ rest: parseFnResult.rest
13645
+ };
13646
+ }
13647
+ function parseNumericPattern(pattern, dateString) {
13648
+ const matchResult = dateString.match(pattern);
13649
+ if (!matchResult) {
13650
+ return null;
13651
+ }
13652
+ return {
13653
+ value: parseInt(matchResult[0], 10),
13654
+ rest: dateString.slice(matchResult[0].length)
13655
+ };
13656
+ }
13657
+ function parseTimezonePattern(pattern, dateString) {
13658
+ const matchResult = dateString.match(pattern);
13659
+ if (!matchResult) {
13660
+ return null;
13661
+ }
13662
+ if (matchResult[0] === "Z") {
13663
+ return {
13664
+ value: 0,
13665
+ rest: dateString.slice(1)
13666
+ };
13667
+ }
13668
+ const sign2 = matchResult[1] === "+" ? 1 : -1;
13669
+ const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;
13670
+ const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;
13671
+ const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;
13672
+ return {
13673
+ value: sign2 * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond),
13674
+ rest: dateString.slice(matchResult[0].length)
13675
+ };
13676
+ }
13677
+ function parseAnyDigitsSigned(dateString) {
13678
+ return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString);
13679
+ }
13680
+ function parseNDigits(n2, dateString) {
13681
+ switch (n2) {
13682
+ case 1:
13683
+ return parseNumericPattern(numericPatterns.singleDigit, dateString);
13684
+ case 2:
13685
+ return parseNumericPattern(numericPatterns.twoDigits, dateString);
13686
+ case 3:
13687
+ return parseNumericPattern(numericPatterns.threeDigits, dateString);
13688
+ case 4:
13689
+ return parseNumericPattern(numericPatterns.fourDigits, dateString);
13690
+ default:
13691
+ return parseNumericPattern(new RegExp("^\\d{1," + n2 + "}"), dateString);
13692
+ }
13693
+ }
13694
+ function parseNDigitsSigned(n2, dateString) {
13695
+ switch (n2) {
13696
+ case 1:
13697
+ return parseNumericPattern(numericPatterns.singleDigitSigned, dateString);
13698
+ case 2:
13699
+ return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString);
13700
+ case 3:
13701
+ return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString);
13702
+ case 4:
13703
+ return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString);
13704
+ default:
13705
+ return parseNumericPattern(new RegExp("^-?\\d{1," + n2 + "}"), dateString);
13706
+ }
13707
+ }
13708
+ function dayPeriodEnumToHours(dayPeriod) {
13709
+ switch (dayPeriod) {
13710
+ case "morning":
13711
+ return 4;
13712
+ case "evening":
13713
+ return 17;
13714
+ case "pm":
13715
+ case "noon":
13716
+ case "afternoon":
13717
+ return 12;
13718
+ case "am":
13719
+ case "midnight":
13720
+ case "night":
13721
+ default:
13722
+ return 0;
13723
+ }
13724
+ }
13725
+ function normalizeTwoDigitYear(twoDigitYear, currentYear) {
13726
+ const isCommonEra = currentYear > 0;
13727
+ const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;
13728
+ let result;
13729
+ if (absCurrentYear <= 50) {
13730
+ result = twoDigitYear || 100;
13731
+ } else {
13732
+ const rangeEnd = absCurrentYear + 50;
13733
+ const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100;
13734
+ const isPreviousCentury = twoDigitYear >= rangeEnd % 100;
13735
+ result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);
13736
+ }
13737
+ return isCommonEra ? result : 1 - result;
13738
+ }
13739
+ function isLeapYearIndex$1(year) {
13740
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
13741
+ }
13742
+ class YearParser extends Parser {
13743
+ constructor() {
13744
+ super(...arguments);
13745
+ __publicField(this, "priority", 130);
13746
+ __publicField(this, "incompatibleTokens", ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]);
13747
+ }
13748
+ parse(dateString, token, match2) {
13749
+ const valueCallback = (year) => ({
13750
+ year,
13751
+ isTwoDigitYear: token === "yy"
13752
+ });
13753
+ switch (token) {
13754
+ case "y":
13755
+ return mapValue(parseNDigits(4, dateString), valueCallback);
13756
+ case "yo":
13757
+ return mapValue(
13758
+ match2.ordinalNumber(dateString, {
13759
+ unit: "year"
13760
+ }),
13761
+ valueCallback
13762
+ );
13763
+ default:
13764
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
13765
+ }
13766
+ }
13767
+ validate(_date, value) {
13768
+ return value.isTwoDigitYear || value.year > 0;
13769
+ }
13770
+ set(date2, flags, value) {
13771
+ const currentYear = date2.getFullYear();
13772
+ if (value.isTwoDigitYear) {
13773
+ const normalizedTwoDigitYear = normalizeTwoDigitYear(
13774
+ value.year,
13775
+ currentYear
13776
+ );
13777
+ date2.setFullYear(normalizedTwoDigitYear, 0, 1);
13778
+ date2.setHours(0, 0, 0, 0);
13779
+ return date2;
13780
+ }
13781
+ const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
13782
+ date2.setFullYear(year, 0, 1);
13783
+ date2.setHours(0, 0, 0, 0);
13784
+ return date2;
13785
+ }
13786
+ }
13787
+ class LocalWeekYearParser extends Parser {
13788
+ constructor() {
13789
+ super(...arguments);
13790
+ __publicField(this, "priority", 130);
13791
+ __publicField(this, "incompatibleTokens", [
13792
+ "y",
13793
+ "R",
13794
+ "u",
13795
+ "Q",
13796
+ "q",
13797
+ "M",
13798
+ "L",
13799
+ "I",
13800
+ "d",
13801
+ "D",
13802
+ "i",
13803
+ "t",
13804
+ "T"
13805
+ ]);
13806
+ }
13807
+ parse(dateString, token, match2) {
13808
+ const valueCallback = (year) => ({
13809
+ year,
13810
+ isTwoDigitYear: token === "YY"
13811
+ });
13812
+ switch (token) {
13813
+ case "Y":
13814
+ return mapValue(parseNDigits(4, dateString), valueCallback);
13815
+ case "Yo":
13816
+ return mapValue(
13817
+ match2.ordinalNumber(dateString, {
13818
+ unit: "year"
13819
+ }),
13820
+ valueCallback
13821
+ );
13822
+ default:
13823
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
13824
+ }
13825
+ }
13826
+ validate(_date, value) {
13827
+ return value.isTwoDigitYear || value.year > 0;
13828
+ }
13829
+ set(date2, flags, value, options) {
13830
+ const currentYear = getWeekYear(date2, options);
13831
+ if (value.isTwoDigitYear) {
13832
+ const normalizedTwoDigitYear = normalizeTwoDigitYear(
13833
+ value.year,
13834
+ currentYear
13835
+ );
13836
+ date2.setFullYear(
13837
+ normalizedTwoDigitYear,
13838
+ 0,
13839
+ options.firstWeekContainsDate
13840
+ );
13841
+ date2.setHours(0, 0, 0, 0);
13842
+ return startOfWeek(date2, options);
13843
+ }
13844
+ const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year;
13845
+ date2.setFullYear(year, 0, options.firstWeekContainsDate);
13846
+ date2.setHours(0, 0, 0, 0);
13847
+ return startOfWeek(date2, options);
13848
+ }
13849
+ }
13850
+ class ISOWeekYearParser extends Parser {
13851
+ constructor() {
13852
+ super(...arguments);
13853
+ __publicField(this, "priority", 130);
13854
+ __publicField(this, "incompatibleTokens", [
13855
+ "G",
13856
+ "y",
13857
+ "Y",
13858
+ "u",
13859
+ "Q",
13860
+ "q",
13861
+ "M",
13862
+ "L",
13863
+ "w",
13864
+ "d",
13865
+ "D",
13866
+ "e",
13867
+ "c",
13868
+ "t",
13869
+ "T"
13870
+ ]);
13871
+ }
13872
+ parse(dateString, token) {
13873
+ if (token === "R") {
13874
+ return parseNDigitsSigned(4, dateString);
13875
+ }
13876
+ return parseNDigitsSigned(token.length, dateString);
13877
+ }
13878
+ set(date2, _flags, value) {
13879
+ const firstWeekOfYear = constructFrom(date2, 0);
13880
+ firstWeekOfYear.setFullYear(value, 0, 4);
13881
+ firstWeekOfYear.setHours(0, 0, 0, 0);
13882
+ return startOfISOWeek(firstWeekOfYear);
13883
+ }
13884
+ }
13885
+ class ExtendedYearParser extends Parser {
13886
+ constructor() {
13887
+ super(...arguments);
13888
+ __publicField(this, "priority", 130);
13889
+ __publicField(this, "incompatibleTokens", ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]);
13890
+ }
13891
+ parse(dateString, token) {
13892
+ if (token === "u") {
13893
+ return parseNDigitsSigned(4, dateString);
13894
+ }
13895
+ return parseNDigitsSigned(token.length, dateString);
13896
+ }
13897
+ set(date2, _flags, value) {
13898
+ date2.setFullYear(value, 0, 1);
13899
+ date2.setHours(0, 0, 0, 0);
13900
+ return date2;
13901
+ }
13902
+ }
13903
+ class QuarterParser extends Parser {
13904
+ constructor() {
13905
+ super(...arguments);
13906
+ __publicField(this, "priority", 120);
13907
+ __publicField(this, "incompatibleTokens", [
13908
+ "Y",
13909
+ "R",
13910
+ "q",
13911
+ "M",
13912
+ "L",
13913
+ "w",
13914
+ "I",
13915
+ "d",
13916
+ "D",
13917
+ "i",
13918
+ "e",
13919
+ "c",
13920
+ "t",
13921
+ "T"
13922
+ ]);
13923
+ }
13924
+ parse(dateString, token, match2) {
13925
+ switch (token) {
13926
+ // 1, 2, 3, 4
13927
+ case "Q":
13928
+ case "QQ":
13929
+ return parseNDigits(token.length, dateString);
13930
+ // 1st, 2nd, 3rd, 4th
13931
+ case "Qo":
13932
+ return match2.ordinalNumber(dateString, { unit: "quarter" });
13933
+ // Q1, Q2, Q3, Q4
13934
+ case "QQQ":
13935
+ return match2.quarter(dateString, {
13936
+ width: "abbreviated",
13937
+ context: "formatting"
13938
+ }) || match2.quarter(dateString, {
13939
+ width: "narrow",
13940
+ context: "formatting"
13941
+ });
13942
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
13943
+ case "QQQQQ":
13944
+ return match2.quarter(dateString, {
13945
+ width: "narrow",
13946
+ context: "formatting"
13947
+ });
13948
+ // 1st quarter, 2nd quarter, ...
13949
+ case "QQQQ":
13950
+ default:
13951
+ return match2.quarter(dateString, {
13952
+ width: "wide",
13953
+ context: "formatting"
13954
+ }) || match2.quarter(dateString, {
13955
+ width: "abbreviated",
13956
+ context: "formatting"
13957
+ }) || match2.quarter(dateString, {
13958
+ width: "narrow",
13959
+ context: "formatting"
13960
+ });
13961
+ }
13962
+ }
13963
+ validate(_date, value) {
13964
+ return value >= 1 && value <= 4;
13965
+ }
13966
+ set(date2, _flags, value) {
13967
+ date2.setMonth((value - 1) * 3, 1);
13968
+ date2.setHours(0, 0, 0, 0);
13969
+ return date2;
13970
+ }
13971
+ }
13972
+ class StandAloneQuarterParser extends Parser {
13973
+ constructor() {
13974
+ super(...arguments);
13975
+ __publicField(this, "priority", 120);
13976
+ __publicField(this, "incompatibleTokens", [
13977
+ "Y",
13978
+ "R",
13979
+ "Q",
13980
+ "M",
13981
+ "L",
13982
+ "w",
13983
+ "I",
13984
+ "d",
13985
+ "D",
13986
+ "i",
13987
+ "e",
13988
+ "c",
13989
+ "t",
13990
+ "T"
13991
+ ]);
13992
+ }
13993
+ parse(dateString, token, match2) {
13994
+ switch (token) {
13995
+ // 1, 2, 3, 4
13996
+ case "q":
13997
+ case "qq":
13998
+ return parseNDigits(token.length, dateString);
13999
+ // 1st, 2nd, 3rd, 4th
14000
+ case "qo":
14001
+ return match2.ordinalNumber(dateString, { unit: "quarter" });
14002
+ // Q1, Q2, Q3, Q4
14003
+ case "qqq":
14004
+ return match2.quarter(dateString, {
14005
+ width: "abbreviated",
14006
+ context: "standalone"
14007
+ }) || match2.quarter(dateString, {
14008
+ width: "narrow",
14009
+ context: "standalone"
14010
+ });
14011
+ // 1, 2, 3, 4 (narrow quarter; could be not numerical)
14012
+ case "qqqqq":
14013
+ return match2.quarter(dateString, {
14014
+ width: "narrow",
14015
+ context: "standalone"
14016
+ });
14017
+ // 1st quarter, 2nd quarter, ...
14018
+ case "qqqq":
14019
+ default:
14020
+ return match2.quarter(dateString, {
14021
+ width: "wide",
14022
+ context: "standalone"
14023
+ }) || match2.quarter(dateString, {
14024
+ width: "abbreviated",
14025
+ context: "standalone"
14026
+ }) || match2.quarter(dateString, {
14027
+ width: "narrow",
14028
+ context: "standalone"
14029
+ });
14030
+ }
14031
+ }
14032
+ validate(_date, value) {
14033
+ return value >= 1 && value <= 4;
14034
+ }
14035
+ set(date2, _flags, value) {
14036
+ date2.setMonth((value - 1) * 3, 1);
14037
+ date2.setHours(0, 0, 0, 0);
14038
+ return date2;
14039
+ }
14040
+ }
14041
+ class MonthParser extends Parser {
14042
+ constructor() {
14043
+ super(...arguments);
14044
+ __publicField(this, "incompatibleTokens", [
14045
+ "Y",
14046
+ "R",
14047
+ "q",
14048
+ "Q",
14049
+ "L",
14050
+ "w",
14051
+ "I",
14052
+ "D",
14053
+ "i",
14054
+ "e",
14055
+ "c",
14056
+ "t",
14057
+ "T"
14058
+ ]);
14059
+ __publicField(this, "priority", 110);
14060
+ }
14061
+ parse(dateString, token, match2) {
14062
+ const valueCallback = (value) => value - 1;
14063
+ switch (token) {
14064
+ // 1, 2, ..., 12
14065
+ case "M":
14066
+ return mapValue(
14067
+ parseNumericPattern(numericPatterns.month, dateString),
14068
+ valueCallback
14069
+ );
14070
+ // 01, 02, ..., 12
14071
+ case "MM":
14072
+ return mapValue(parseNDigits(2, dateString), valueCallback);
14073
+ // 1st, 2nd, ..., 12th
14074
+ case "Mo":
14075
+ return mapValue(
14076
+ match2.ordinalNumber(dateString, {
14077
+ unit: "month"
14078
+ }),
14079
+ valueCallback
14080
+ );
14081
+ // Jan, Feb, ..., Dec
14082
+ case "MMM":
14083
+ return match2.month(dateString, {
14084
+ width: "abbreviated",
14085
+ context: "formatting"
14086
+ }) || match2.month(dateString, { width: "narrow", context: "formatting" });
14087
+ // J, F, ..., D
14088
+ case "MMMMM":
14089
+ return match2.month(dateString, {
14090
+ width: "narrow",
14091
+ context: "formatting"
14092
+ });
14093
+ // January, February, ..., December
14094
+ case "MMMM":
14095
+ default:
14096
+ return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, {
14097
+ width: "abbreviated",
14098
+ context: "formatting"
14099
+ }) || match2.month(dateString, { width: "narrow", context: "formatting" });
14100
+ }
14101
+ }
14102
+ validate(_date, value) {
14103
+ return value >= 0 && value <= 11;
14104
+ }
14105
+ set(date2, _flags, value) {
14106
+ date2.setMonth(value, 1);
14107
+ date2.setHours(0, 0, 0, 0);
14108
+ return date2;
14109
+ }
14110
+ }
14111
+ class StandAloneMonthParser extends Parser {
14112
+ constructor() {
14113
+ super(...arguments);
14114
+ __publicField(this, "priority", 110);
14115
+ __publicField(this, "incompatibleTokens", [
14116
+ "Y",
14117
+ "R",
14118
+ "q",
14119
+ "Q",
14120
+ "M",
14121
+ "w",
14122
+ "I",
14123
+ "D",
14124
+ "i",
14125
+ "e",
14126
+ "c",
14127
+ "t",
14128
+ "T"
14129
+ ]);
14130
+ }
14131
+ parse(dateString, token, match2) {
14132
+ const valueCallback = (value) => value - 1;
14133
+ switch (token) {
14134
+ // 1, 2, ..., 12
14135
+ case "L":
14136
+ return mapValue(
14137
+ parseNumericPattern(numericPatterns.month, dateString),
14138
+ valueCallback
14139
+ );
14140
+ // 01, 02, ..., 12
14141
+ case "LL":
14142
+ return mapValue(parseNDigits(2, dateString), valueCallback);
14143
+ // 1st, 2nd, ..., 12th
14144
+ case "Lo":
14145
+ return mapValue(
14146
+ match2.ordinalNumber(dateString, {
14147
+ unit: "month"
14148
+ }),
14149
+ valueCallback
14150
+ );
14151
+ // Jan, Feb, ..., Dec
14152
+ case "LLL":
14153
+ return match2.month(dateString, {
14154
+ width: "abbreviated",
14155
+ context: "standalone"
14156
+ }) || match2.month(dateString, { width: "narrow", context: "standalone" });
14157
+ // J, F, ..., D
14158
+ case "LLLLL":
14159
+ return match2.month(dateString, {
14160
+ width: "narrow",
14161
+ context: "standalone"
14162
+ });
14163
+ // January, February, ..., December
14164
+ case "LLLL":
14165
+ default:
14166
+ return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, {
14167
+ width: "abbreviated",
14168
+ context: "standalone"
14169
+ }) || match2.month(dateString, { width: "narrow", context: "standalone" });
14170
+ }
14171
+ }
14172
+ validate(_date, value) {
14173
+ return value >= 0 && value <= 11;
14174
+ }
14175
+ set(date2, _flags, value) {
14176
+ date2.setMonth(value, 1);
14177
+ date2.setHours(0, 0, 0, 0);
14178
+ return date2;
14179
+ }
14180
+ }
14181
+ function setWeek(date2, week, options) {
14182
+ const _date = toDate(date2);
14183
+ const diff = getWeek(_date, options) - week;
14184
+ _date.setDate(_date.getDate() - diff * 7);
14185
+ return _date;
14186
+ }
14187
+ class LocalWeekParser extends Parser {
14188
+ constructor() {
14189
+ super(...arguments);
14190
+ __publicField(this, "priority", 100);
14191
+ __publicField(this, "incompatibleTokens", [
14192
+ "y",
14193
+ "R",
14194
+ "u",
14195
+ "q",
14196
+ "Q",
14197
+ "M",
14198
+ "L",
14199
+ "I",
14200
+ "d",
14201
+ "D",
14202
+ "i",
14203
+ "t",
14204
+ "T"
14205
+ ]);
14206
+ }
14207
+ parse(dateString, token, match2) {
14208
+ switch (token) {
14209
+ case "w":
14210
+ return parseNumericPattern(numericPatterns.week, dateString);
14211
+ case "wo":
14212
+ return match2.ordinalNumber(dateString, { unit: "week" });
14213
+ default:
14214
+ return parseNDigits(token.length, dateString);
14215
+ }
14216
+ }
14217
+ validate(_date, value) {
14218
+ return value >= 1 && value <= 53;
14219
+ }
14220
+ set(date2, _flags, value, options) {
14221
+ return startOfWeek(setWeek(date2, value, options), options);
14222
+ }
14223
+ }
14224
+ function setISOWeek(date2, week) {
14225
+ const _date = toDate(date2);
14226
+ const diff = getISOWeek(_date) - week;
14227
+ _date.setDate(_date.getDate() - diff * 7);
14228
+ return _date;
14229
+ }
14230
+ class ISOWeekParser extends Parser {
14231
+ constructor() {
14232
+ super(...arguments);
14233
+ __publicField(this, "priority", 100);
14234
+ __publicField(this, "incompatibleTokens", [
14235
+ "y",
14236
+ "Y",
14237
+ "u",
14238
+ "q",
14239
+ "Q",
14240
+ "M",
14241
+ "L",
14242
+ "w",
14243
+ "d",
14244
+ "D",
14245
+ "e",
14246
+ "c",
14247
+ "t",
14248
+ "T"
14249
+ ]);
14250
+ }
14251
+ parse(dateString, token, match2) {
14252
+ switch (token) {
14253
+ case "I":
14254
+ return parseNumericPattern(numericPatterns.week, dateString);
14255
+ case "Io":
14256
+ return match2.ordinalNumber(dateString, { unit: "week" });
14257
+ default:
14258
+ return parseNDigits(token.length, dateString);
14259
+ }
14260
+ }
14261
+ validate(_date, value) {
14262
+ return value >= 1 && value <= 53;
14263
+ }
14264
+ set(date2, _flags, value) {
14265
+ return startOfISOWeek(setISOWeek(date2, value));
14266
+ }
14267
+ }
14268
+ const DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
14269
+ const DAYS_IN_MONTH_LEAP_YEAR = [
14270
+ 31,
14271
+ 29,
14272
+ 31,
14273
+ 30,
14274
+ 31,
14275
+ 30,
14276
+ 31,
14277
+ 31,
14278
+ 30,
14279
+ 31,
14280
+ 30,
14281
+ 31
14282
+ ];
14283
+ class DateParser extends Parser {
14284
+ constructor() {
14285
+ super(...arguments);
14286
+ __publicField(this, "priority", 90);
14287
+ __publicField(this, "subPriority", 1);
14288
+ __publicField(this, "incompatibleTokens", [
14289
+ "Y",
14290
+ "R",
14291
+ "q",
14292
+ "Q",
14293
+ "w",
14294
+ "I",
14295
+ "D",
14296
+ "i",
14297
+ "e",
14298
+ "c",
14299
+ "t",
14300
+ "T"
14301
+ ]);
14302
+ }
14303
+ parse(dateString, token, match2) {
14304
+ switch (token) {
14305
+ case "d":
14306
+ return parseNumericPattern(numericPatterns.date, dateString);
14307
+ case "do":
14308
+ return match2.ordinalNumber(dateString, { unit: "date" });
14309
+ default:
14310
+ return parseNDigits(token.length, dateString);
14311
+ }
14312
+ }
14313
+ validate(date2, value) {
14314
+ const year = date2.getFullYear();
14315
+ const isLeapYear = isLeapYearIndex$1(year);
14316
+ const month = date2.getMonth();
14317
+ if (isLeapYear) {
14318
+ return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];
14319
+ } else {
14320
+ return value >= 1 && value <= DAYS_IN_MONTH[month];
14321
+ }
14322
+ }
14323
+ set(date2, _flags, value) {
14324
+ date2.setDate(value);
14325
+ date2.setHours(0, 0, 0, 0);
14326
+ return date2;
14327
+ }
14328
+ }
14329
+ class DayOfYearParser extends Parser {
14330
+ constructor() {
14331
+ super(...arguments);
14332
+ __publicField(this, "priority", 90);
14333
+ __publicField(this, "subpriority", 1);
14334
+ __publicField(this, "incompatibleTokens", [
14335
+ "Y",
14336
+ "R",
14337
+ "q",
14338
+ "Q",
14339
+ "M",
14340
+ "L",
14341
+ "w",
14342
+ "I",
14343
+ "d",
14344
+ "E",
14345
+ "i",
14346
+ "e",
14347
+ "c",
14348
+ "t",
14349
+ "T"
14350
+ ]);
14351
+ }
14352
+ parse(dateString, token, match2) {
14353
+ switch (token) {
14354
+ case "D":
14355
+ case "DD":
14356
+ return parseNumericPattern(numericPatterns.dayOfYear, dateString);
14357
+ case "Do":
14358
+ return match2.ordinalNumber(dateString, { unit: "date" });
14359
+ default:
14360
+ return parseNDigits(token.length, dateString);
14361
+ }
14362
+ }
14363
+ validate(date2, value) {
14364
+ const year = date2.getFullYear();
14365
+ const isLeapYear = isLeapYearIndex$1(year);
14366
+ if (isLeapYear) {
14367
+ return value >= 1 && value <= 366;
14368
+ } else {
14369
+ return value >= 1 && value <= 365;
14370
+ }
14371
+ }
14372
+ set(date2, _flags, value) {
14373
+ date2.setMonth(0, value);
14374
+ date2.setHours(0, 0, 0, 0);
14375
+ return date2;
14376
+ }
14377
+ }
14378
+ function setDay(date2, day, options) {
14379
+ var _a, _b, _c, _d;
14380
+ const defaultOptions2 = getDefaultOptions$1();
14381
+ const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
14382
+ const _date = toDate(date2);
14383
+ const currentDay = _date.getDay();
14384
+ const remainder = day % 7;
14385
+ const dayIndex = (remainder + 7) % 7;
14386
+ const delta = 7 - weekStartsOn;
14387
+ const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7;
14388
+ return addDays(_date, diff);
14389
+ }
14390
+ class DayParser extends Parser {
14391
+ constructor() {
14392
+ super(...arguments);
14393
+ __publicField(this, "priority", 90);
14394
+ __publicField(this, "incompatibleTokens", ["D", "i", "e", "c", "t", "T"]);
14395
+ }
14396
+ parse(dateString, token, match2) {
14397
+ switch (token) {
14398
+ // Tue
14399
+ case "E":
14400
+ case "EE":
14401
+ case "EEE":
14402
+ return match2.day(dateString, {
14403
+ width: "abbreviated",
14404
+ context: "formatting"
14405
+ }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14406
+ // T
14407
+ case "EEEEE":
14408
+ return match2.day(dateString, {
14409
+ width: "narrow",
14410
+ context: "formatting"
14411
+ });
14412
+ // Tu
14413
+ case "EEEEEE":
14414
+ return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14415
+ // Tuesday
14416
+ case "EEEE":
14417
+ default:
14418
+ return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
14419
+ width: "abbreviated",
14420
+ context: "formatting"
14421
+ }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14422
+ }
14423
+ }
14424
+ validate(_date, value) {
14425
+ return value >= 0 && value <= 6;
14426
+ }
14427
+ set(date2, _flags, value, options) {
14428
+ date2 = setDay(date2, value, options);
14429
+ date2.setHours(0, 0, 0, 0);
14430
+ return date2;
14431
+ }
14432
+ }
14433
+ class LocalDayParser extends Parser {
14434
+ constructor() {
14435
+ super(...arguments);
14436
+ __publicField(this, "priority", 90);
14437
+ __publicField(this, "incompatibleTokens", [
14438
+ "y",
14439
+ "R",
14440
+ "u",
14441
+ "q",
14442
+ "Q",
14443
+ "M",
14444
+ "L",
14445
+ "I",
14446
+ "d",
14447
+ "D",
14448
+ "E",
14449
+ "i",
14450
+ "c",
14451
+ "t",
14452
+ "T"
14453
+ ]);
14454
+ }
14455
+ parse(dateString, token, match2, options) {
14456
+ const valueCallback = (value) => {
14457
+ const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
14458
+ return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
14459
+ };
14460
+ switch (token) {
14461
+ // 3
14462
+ case "e":
14463
+ case "ee":
14464
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
14465
+ // 3rd
14466
+ case "eo":
14467
+ return mapValue(
14468
+ match2.ordinalNumber(dateString, {
14469
+ unit: "day"
14470
+ }),
14471
+ valueCallback
14472
+ );
14473
+ // Tue
14474
+ case "eee":
14475
+ return match2.day(dateString, {
14476
+ width: "abbreviated",
14477
+ context: "formatting"
14478
+ }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14479
+ // T
14480
+ case "eeeee":
14481
+ return match2.day(dateString, {
14482
+ width: "narrow",
14483
+ context: "formatting"
14484
+ });
14485
+ // Tu
14486
+ case "eeeeee":
14487
+ return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14488
+ // Tuesday
14489
+ case "eeee":
14490
+ default:
14491
+ return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, {
14492
+ width: "abbreviated",
14493
+ context: "formatting"
14494
+ }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" });
14495
+ }
14496
+ }
14497
+ validate(_date, value) {
14498
+ return value >= 0 && value <= 6;
14499
+ }
14500
+ set(date2, _flags, value, options) {
14501
+ date2 = setDay(date2, value, options);
14502
+ date2.setHours(0, 0, 0, 0);
14503
+ return date2;
14504
+ }
14505
+ }
14506
+ class StandAloneLocalDayParser extends Parser {
14507
+ constructor() {
14508
+ super(...arguments);
14509
+ __publicField(this, "priority", 90);
14510
+ __publicField(this, "incompatibleTokens", [
14511
+ "y",
14512
+ "R",
14513
+ "u",
14514
+ "q",
14515
+ "Q",
14516
+ "M",
14517
+ "L",
14518
+ "I",
14519
+ "d",
14520
+ "D",
14521
+ "E",
14522
+ "i",
14523
+ "e",
14524
+ "t",
14525
+ "T"
14526
+ ]);
14527
+ }
14528
+ parse(dateString, token, match2, options) {
14529
+ const valueCallback = (value) => {
14530
+ const wholeWeekDays = Math.floor((value - 1) / 7) * 7;
14531
+ return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;
14532
+ };
14533
+ switch (token) {
14534
+ // 3
14535
+ case "c":
14536
+ case "cc":
14537
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
14538
+ // 3rd
14539
+ case "co":
14540
+ return mapValue(
14541
+ match2.ordinalNumber(dateString, {
14542
+ unit: "day"
14543
+ }),
14544
+ valueCallback
14545
+ );
14546
+ // Tue
14547
+ case "ccc":
14548
+ return match2.day(dateString, {
14549
+ width: "abbreviated",
14550
+ context: "standalone"
14551
+ }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
14552
+ // T
14553
+ case "ccccc":
14554
+ return match2.day(dateString, {
14555
+ width: "narrow",
14556
+ context: "standalone"
14557
+ });
14558
+ // Tu
14559
+ case "cccccc":
14560
+ return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
14561
+ // Tuesday
14562
+ case "cccc":
14563
+ default:
14564
+ return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, {
14565
+ width: "abbreviated",
14566
+ context: "standalone"
14567
+ }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" });
14568
+ }
14569
+ }
14570
+ validate(_date, value) {
14571
+ return value >= 0 && value <= 6;
14572
+ }
14573
+ set(date2, _flags, value, options) {
14574
+ date2 = setDay(date2, value, options);
14575
+ date2.setHours(0, 0, 0, 0);
14576
+ return date2;
14577
+ }
14578
+ }
14579
+ function setISODay(date2, day) {
14580
+ const _date = toDate(date2);
14581
+ const currentDay = getISODay(_date);
14582
+ const diff = day - currentDay;
14583
+ return addDays(_date, diff);
14584
+ }
14585
+ class ISODayParser extends Parser {
14586
+ constructor() {
14587
+ super(...arguments);
14588
+ __publicField(this, "priority", 90);
14589
+ __publicField(this, "incompatibleTokens", [
14590
+ "y",
14591
+ "Y",
14592
+ "u",
14593
+ "q",
14594
+ "Q",
14595
+ "M",
14596
+ "L",
14597
+ "w",
14598
+ "d",
14599
+ "D",
14600
+ "E",
14601
+ "e",
14602
+ "c",
14603
+ "t",
14604
+ "T"
14605
+ ]);
14606
+ }
14607
+ parse(dateString, token, match2) {
14608
+ const valueCallback = (value) => {
14609
+ if (value === 0) {
14610
+ return 7;
14611
+ }
14612
+ return value;
14613
+ };
14614
+ switch (token) {
14615
+ // 2
14616
+ case "i":
14617
+ case "ii":
14618
+ return parseNDigits(token.length, dateString);
14619
+ // 2nd
14620
+ case "io":
14621
+ return match2.ordinalNumber(dateString, { unit: "day" });
14622
+ // Tue
14623
+ case "iii":
14624
+ return mapValue(
14625
+ match2.day(dateString, {
14626
+ width: "abbreviated",
14627
+ context: "formatting"
14628
+ }) || match2.day(dateString, {
14629
+ width: "short",
14630
+ context: "formatting"
14631
+ }) || match2.day(dateString, {
14632
+ width: "narrow",
14633
+ context: "formatting"
14634
+ }),
14635
+ valueCallback
14636
+ );
14637
+ // T
14638
+ case "iiiii":
14639
+ return mapValue(
14640
+ match2.day(dateString, {
14641
+ width: "narrow",
14642
+ context: "formatting"
14643
+ }),
14644
+ valueCallback
14645
+ );
14646
+ // Tu
14647
+ case "iiiiii":
14648
+ return mapValue(
14649
+ match2.day(dateString, {
14650
+ width: "short",
14651
+ context: "formatting"
14652
+ }) || match2.day(dateString, {
14653
+ width: "narrow",
14654
+ context: "formatting"
14655
+ }),
14656
+ valueCallback
14657
+ );
14658
+ // Tuesday
14659
+ case "iiii":
14660
+ default:
14661
+ return mapValue(
14662
+ match2.day(dateString, {
14663
+ width: "wide",
14664
+ context: "formatting"
14665
+ }) || match2.day(dateString, {
14666
+ width: "abbreviated",
14667
+ context: "formatting"
14668
+ }) || match2.day(dateString, {
14669
+ width: "short",
14670
+ context: "formatting"
14671
+ }) || match2.day(dateString, {
14672
+ width: "narrow",
14673
+ context: "formatting"
14674
+ }),
14675
+ valueCallback
14676
+ );
14677
+ }
14678
+ }
14679
+ validate(_date, value) {
14680
+ return value >= 1 && value <= 7;
14681
+ }
14682
+ set(date2, _flags, value) {
14683
+ date2 = setISODay(date2, value);
14684
+ date2.setHours(0, 0, 0, 0);
14685
+ return date2;
14686
+ }
14687
+ }
14688
+ class AMPMParser extends Parser {
14689
+ constructor() {
14690
+ super(...arguments);
14691
+ __publicField(this, "priority", 80);
14692
+ __publicField(this, "incompatibleTokens", ["b", "B", "H", "k", "t", "T"]);
14693
+ }
14694
+ parse(dateString, token, match2) {
14695
+ switch (token) {
14696
+ case "a":
14697
+ case "aa":
14698
+ case "aaa":
14699
+ return match2.dayPeriod(dateString, {
14700
+ width: "abbreviated",
14701
+ context: "formatting"
14702
+ }) || match2.dayPeriod(dateString, {
14703
+ width: "narrow",
14704
+ context: "formatting"
14705
+ });
14706
+ case "aaaaa":
14707
+ return match2.dayPeriod(dateString, {
14708
+ width: "narrow",
14709
+ context: "formatting"
14710
+ });
14711
+ case "aaaa":
14712
+ default:
14713
+ return match2.dayPeriod(dateString, {
14714
+ width: "wide",
14715
+ context: "formatting"
14716
+ }) || match2.dayPeriod(dateString, {
14717
+ width: "abbreviated",
14718
+ context: "formatting"
14719
+ }) || match2.dayPeriod(dateString, {
14720
+ width: "narrow",
14721
+ context: "formatting"
14722
+ });
14723
+ }
14724
+ }
14725
+ set(date2, _flags, value) {
14726
+ date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
14727
+ return date2;
14728
+ }
14729
+ }
14730
+ class AMPMMidnightParser extends Parser {
14731
+ constructor() {
14732
+ super(...arguments);
14733
+ __publicField(this, "priority", 80);
14734
+ __publicField(this, "incompatibleTokens", ["a", "B", "H", "k", "t", "T"]);
14735
+ }
14736
+ parse(dateString, token, match2) {
14737
+ switch (token) {
14738
+ case "b":
14739
+ case "bb":
14740
+ case "bbb":
14741
+ return match2.dayPeriod(dateString, {
14742
+ width: "abbreviated",
14743
+ context: "formatting"
14744
+ }) || match2.dayPeriod(dateString, {
14745
+ width: "narrow",
14746
+ context: "formatting"
14747
+ });
14748
+ case "bbbbb":
14749
+ return match2.dayPeriod(dateString, {
14750
+ width: "narrow",
14751
+ context: "formatting"
14752
+ });
14753
+ case "bbbb":
14754
+ default:
14755
+ return match2.dayPeriod(dateString, {
14756
+ width: "wide",
14757
+ context: "formatting"
14758
+ }) || match2.dayPeriod(dateString, {
14759
+ width: "abbreviated",
14760
+ context: "formatting"
14761
+ }) || match2.dayPeriod(dateString, {
14762
+ width: "narrow",
14763
+ context: "formatting"
14764
+ });
14765
+ }
14766
+ }
14767
+ set(date2, _flags, value) {
14768
+ date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
14769
+ return date2;
14770
+ }
14771
+ }
14772
+ class DayPeriodParser extends Parser {
14773
+ constructor() {
14774
+ super(...arguments);
14775
+ __publicField(this, "priority", 80);
14776
+ __publicField(this, "incompatibleTokens", ["a", "b", "t", "T"]);
14777
+ }
14778
+ parse(dateString, token, match2) {
14779
+ switch (token) {
14780
+ case "B":
14781
+ case "BB":
14782
+ case "BBB":
14783
+ return match2.dayPeriod(dateString, {
14784
+ width: "abbreviated",
14785
+ context: "formatting"
14786
+ }) || match2.dayPeriod(dateString, {
14787
+ width: "narrow",
14788
+ context: "formatting"
14789
+ });
14790
+ case "BBBBB":
14791
+ return match2.dayPeriod(dateString, {
14792
+ width: "narrow",
14793
+ context: "formatting"
14794
+ });
14795
+ case "BBBB":
14796
+ default:
14797
+ return match2.dayPeriod(dateString, {
14798
+ width: "wide",
14799
+ context: "formatting"
14800
+ }) || match2.dayPeriod(dateString, {
14801
+ width: "abbreviated",
14802
+ context: "formatting"
14803
+ }) || match2.dayPeriod(dateString, {
14804
+ width: "narrow",
14805
+ context: "formatting"
14806
+ });
14807
+ }
14808
+ }
14809
+ set(date2, _flags, value) {
14810
+ date2.setHours(dayPeriodEnumToHours(value), 0, 0, 0);
14811
+ return date2;
14812
+ }
14813
+ }
14814
+ class Hour1to12Parser extends Parser {
14815
+ constructor() {
14816
+ super(...arguments);
14817
+ __publicField(this, "priority", 70);
14818
+ __publicField(this, "incompatibleTokens", ["H", "K", "k", "t", "T"]);
14819
+ }
14820
+ parse(dateString, token, match2) {
14821
+ switch (token) {
14822
+ case "h":
14823
+ return parseNumericPattern(numericPatterns.hour12h, dateString);
14824
+ case "ho":
14825
+ return match2.ordinalNumber(dateString, { unit: "hour" });
14826
+ default:
14827
+ return parseNDigits(token.length, dateString);
14828
+ }
14829
+ }
14830
+ validate(_date, value) {
14831
+ return value >= 1 && value <= 12;
14832
+ }
14833
+ set(date2, _flags, value) {
14834
+ const isPM = date2.getHours() >= 12;
14835
+ if (isPM && value < 12) {
14836
+ date2.setHours(value + 12, 0, 0, 0);
14837
+ } else if (!isPM && value === 12) {
14838
+ date2.setHours(0, 0, 0, 0);
14839
+ } else {
14840
+ date2.setHours(value, 0, 0, 0);
14841
+ }
14842
+ return date2;
14843
+ }
14844
+ }
14845
+ class Hour0to23Parser extends Parser {
14846
+ constructor() {
14847
+ super(...arguments);
14848
+ __publicField(this, "priority", 70);
14849
+ __publicField(this, "incompatibleTokens", ["a", "b", "h", "K", "k", "t", "T"]);
14850
+ }
14851
+ parse(dateString, token, match2) {
14852
+ switch (token) {
14853
+ case "H":
14854
+ return parseNumericPattern(numericPatterns.hour23h, dateString);
14855
+ case "Ho":
14856
+ return match2.ordinalNumber(dateString, { unit: "hour" });
14857
+ default:
14858
+ return parseNDigits(token.length, dateString);
14859
+ }
14860
+ }
14861
+ validate(_date, value) {
14862
+ return value >= 0 && value <= 23;
14863
+ }
14864
+ set(date2, _flags, value) {
14865
+ date2.setHours(value, 0, 0, 0);
14866
+ return date2;
14867
+ }
14868
+ }
14869
+ class Hour0To11Parser extends Parser {
14870
+ constructor() {
14871
+ super(...arguments);
14872
+ __publicField(this, "priority", 70);
14873
+ __publicField(this, "incompatibleTokens", ["h", "H", "k", "t", "T"]);
14874
+ }
14875
+ parse(dateString, token, match2) {
14876
+ switch (token) {
14877
+ case "K":
14878
+ return parseNumericPattern(numericPatterns.hour11h, dateString);
14879
+ case "Ko":
14880
+ return match2.ordinalNumber(dateString, { unit: "hour" });
14881
+ default:
14882
+ return parseNDigits(token.length, dateString);
14883
+ }
14884
+ }
14885
+ validate(_date, value) {
14886
+ return value >= 0 && value <= 11;
14887
+ }
14888
+ set(date2, _flags, value) {
14889
+ const isPM = date2.getHours() >= 12;
14890
+ if (isPM && value < 12) {
14891
+ date2.setHours(value + 12, 0, 0, 0);
14892
+ } else {
14893
+ date2.setHours(value, 0, 0, 0);
14894
+ }
14895
+ return date2;
14896
+ }
14897
+ }
14898
+ class Hour1To24Parser extends Parser {
14899
+ constructor() {
14900
+ super(...arguments);
14901
+ __publicField(this, "priority", 70);
14902
+ __publicField(this, "incompatibleTokens", ["a", "b", "h", "H", "K", "t", "T"]);
14903
+ }
14904
+ parse(dateString, token, match2) {
14905
+ switch (token) {
14906
+ case "k":
14907
+ return parseNumericPattern(numericPatterns.hour24h, dateString);
14908
+ case "ko":
14909
+ return match2.ordinalNumber(dateString, { unit: "hour" });
14910
+ default:
14911
+ return parseNDigits(token.length, dateString);
14912
+ }
14913
+ }
14914
+ validate(_date, value) {
14915
+ return value >= 1 && value <= 24;
14916
+ }
14917
+ set(date2, _flags, value) {
14918
+ const hours = value <= 24 ? value % 24 : value;
14919
+ date2.setHours(hours, 0, 0, 0);
14920
+ return date2;
14921
+ }
14922
+ }
14923
+ class MinuteParser extends Parser {
14924
+ constructor() {
14925
+ super(...arguments);
14926
+ __publicField(this, "priority", 60);
14927
+ __publicField(this, "incompatibleTokens", ["t", "T"]);
14928
+ }
14929
+ parse(dateString, token, match2) {
14930
+ switch (token) {
14931
+ case "m":
14932
+ return parseNumericPattern(numericPatterns.minute, dateString);
14933
+ case "mo":
14934
+ return match2.ordinalNumber(dateString, { unit: "minute" });
14935
+ default:
14936
+ return parseNDigits(token.length, dateString);
14937
+ }
14938
+ }
14939
+ validate(_date, value) {
14940
+ return value >= 0 && value <= 59;
14941
+ }
14942
+ set(date2, _flags, value) {
14943
+ date2.setMinutes(value, 0, 0);
14944
+ return date2;
14945
+ }
14946
+ }
14947
+ class SecondParser extends Parser {
14948
+ constructor() {
14949
+ super(...arguments);
14950
+ __publicField(this, "priority", 50);
14951
+ __publicField(this, "incompatibleTokens", ["t", "T"]);
14952
+ }
14953
+ parse(dateString, token, match2) {
14954
+ switch (token) {
14955
+ case "s":
14956
+ return parseNumericPattern(numericPatterns.second, dateString);
14957
+ case "so":
14958
+ return match2.ordinalNumber(dateString, { unit: "second" });
14959
+ default:
14960
+ return parseNDigits(token.length, dateString);
14961
+ }
14962
+ }
14963
+ validate(_date, value) {
14964
+ return value >= 0 && value <= 59;
14965
+ }
14966
+ set(date2, _flags, value) {
14967
+ date2.setSeconds(value, 0);
14968
+ return date2;
14969
+ }
14970
+ }
14971
+ class FractionOfSecondParser extends Parser {
14972
+ constructor() {
14973
+ super(...arguments);
14974
+ __publicField(this, "priority", 30);
14975
+ __publicField(this, "incompatibleTokens", ["t", "T"]);
14976
+ }
14977
+ parse(dateString, token) {
14978
+ const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3));
14979
+ return mapValue(parseNDigits(token.length, dateString), valueCallback);
14980
+ }
14981
+ set(date2, _flags, value) {
14982
+ date2.setMilliseconds(value);
14983
+ return date2;
14984
+ }
14985
+ }
14986
+ class ISOTimezoneWithZParser extends Parser {
14987
+ constructor() {
14988
+ super(...arguments);
14989
+ __publicField(this, "priority", 10);
14990
+ __publicField(this, "incompatibleTokens", ["t", "T", "x"]);
14991
+ }
14992
+ parse(dateString, token) {
14993
+ switch (token) {
14994
+ case "X":
14995
+ return parseTimezonePattern(
14996
+ timezonePatterns.basicOptionalMinutes,
14997
+ dateString
14998
+ );
14999
+ case "XX":
15000
+ return parseTimezonePattern(timezonePatterns.basic, dateString);
15001
+ case "XXXX":
15002
+ return parseTimezonePattern(
15003
+ timezonePatterns.basicOptionalSeconds,
15004
+ dateString
15005
+ );
15006
+ case "XXXXX":
15007
+ return parseTimezonePattern(
15008
+ timezonePatterns.extendedOptionalSeconds,
15009
+ dateString
15010
+ );
15011
+ case "XXX":
15012
+ default:
15013
+ return parseTimezonePattern(timezonePatterns.extended, dateString);
13258
15014
  }
13259
- },
13260
- // Seconds timestamp
13261
- t: function(date2, token, _localize) {
13262
- const timestamp = Math.trunc(date2.getTime() / 1e3);
13263
- return addLeadingZeros(timestamp, token.length);
13264
- },
13265
- // Milliseconds timestamp
13266
- T: function(date2, token, _localize) {
13267
- const timestamp = date2.getTime();
13268
- return addLeadingZeros(timestamp, token.length);
13269
15015
  }
13270
- };
13271
- function formatTimezoneShort(offset2, delimiter = "") {
13272
- const sign2 = offset2 > 0 ? "-" : "+";
13273
- const absOffset = Math.abs(offset2);
13274
- const hours = Math.trunc(absOffset / 60);
13275
- const minutes = absOffset % 60;
13276
- if (minutes === 0) {
13277
- return sign2 + String(hours);
15016
+ set(date2, flags, value) {
15017
+ if (flags.timestampIsSet) return date2;
15018
+ return constructFrom(
15019
+ date2,
15020
+ date2.getTime() - getTimezoneOffsetInMilliseconds(date2) - value
15021
+ );
13278
15022
  }
13279
- return sign2 + String(hours) + delimiter + addLeadingZeros(minutes, 2);
13280
15023
  }
13281
- function formatTimezoneWithOptionalMinutes(offset2, delimiter) {
13282
- if (offset2 % 60 === 0) {
13283
- const sign2 = offset2 > 0 ? "-" : "+";
13284
- return sign2 + addLeadingZeros(Math.abs(offset2) / 60, 2);
15024
+ class ISOTimezoneParser extends Parser {
15025
+ constructor() {
15026
+ super(...arguments);
15027
+ __publicField(this, "priority", 10);
15028
+ __publicField(this, "incompatibleTokens", ["t", "T", "X"]);
13285
15029
  }
13286
- return formatTimezone(offset2, delimiter);
13287
- }
13288
- function formatTimezone(offset2, delimiter = "") {
13289
- const sign2 = offset2 > 0 ? "-" : "+";
13290
- const absOffset = Math.abs(offset2);
13291
- const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2);
13292
- const minutes = addLeadingZeros(absOffset % 60, 2);
13293
- return sign2 + hours + delimiter + minutes;
13294
- }
13295
- const dateLongFormatter = (pattern, formatLong2) => {
13296
- switch (pattern) {
13297
- case "P":
13298
- return formatLong2.date({ width: "short" });
13299
- case "PP":
13300
- return formatLong2.date({ width: "medium" });
13301
- case "PPP":
13302
- return formatLong2.date({ width: "long" });
13303
- case "PPPP":
13304
- default:
13305
- return formatLong2.date({ width: "full" });
15030
+ parse(dateString, token) {
15031
+ switch (token) {
15032
+ case "x":
15033
+ return parseTimezonePattern(
15034
+ timezonePatterns.basicOptionalMinutes,
15035
+ dateString
15036
+ );
15037
+ case "xx":
15038
+ return parseTimezonePattern(timezonePatterns.basic, dateString);
15039
+ case "xxxx":
15040
+ return parseTimezonePattern(
15041
+ timezonePatterns.basicOptionalSeconds,
15042
+ dateString
15043
+ );
15044
+ case "xxxxx":
15045
+ return parseTimezonePattern(
15046
+ timezonePatterns.extendedOptionalSeconds,
15047
+ dateString
15048
+ );
15049
+ case "xxx":
15050
+ default:
15051
+ return parseTimezonePattern(timezonePatterns.extended, dateString);
15052
+ }
13306
15053
  }
13307
- };
13308
- const timeLongFormatter = (pattern, formatLong2) => {
13309
- switch (pattern) {
13310
- case "p":
13311
- return formatLong2.time({ width: "short" });
13312
- case "pp":
13313
- return formatLong2.time({ width: "medium" });
13314
- case "ppp":
13315
- return formatLong2.time({ width: "long" });
13316
- case "pppp":
13317
- default:
13318
- return formatLong2.time({ width: "full" });
15054
+ set(date2, flags, value) {
15055
+ if (flags.timestampIsSet) return date2;
15056
+ return constructFrom(
15057
+ date2,
15058
+ date2.getTime() - getTimezoneOffsetInMilliseconds(date2) - value
15059
+ );
13319
15060
  }
13320
- };
13321
- const dateTimeLongFormatter = (pattern, formatLong2) => {
13322
- const matchResult = pattern.match(/(P+)(p+)?/) || [];
13323
- const datePattern = matchResult[1];
13324
- const timePattern = matchResult[2];
13325
- if (!timePattern) {
13326
- return dateLongFormatter(pattern, formatLong2);
15061
+ }
15062
+ class TimestampSecondsParser extends Parser {
15063
+ constructor() {
15064
+ super(...arguments);
15065
+ __publicField(this, "priority", 40);
15066
+ __publicField(this, "incompatibleTokens", "*");
13327
15067
  }
13328
- let dateTimeFormat;
13329
- switch (datePattern) {
13330
- case "P":
13331
- dateTimeFormat = formatLong2.dateTime({ width: "short" });
13332
- break;
13333
- case "PP":
13334
- dateTimeFormat = formatLong2.dateTime({ width: "medium" });
13335
- break;
13336
- case "PPP":
13337
- dateTimeFormat = formatLong2.dateTime({ width: "long" });
13338
- break;
13339
- case "PPPP":
13340
- default:
13341
- dateTimeFormat = formatLong2.dateTime({ width: "full" });
13342
- break;
15068
+ parse(dateString) {
15069
+ return parseAnyDigitsSigned(dateString);
15070
+ }
15071
+ set(date2, _flags, value) {
15072
+ return [constructFrom(date2, value * 1e3), { timestampIsSet: true }];
13343
15073
  }
13344
- return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
13345
- };
13346
- const longFormatters = {
13347
- p: timeLongFormatter,
13348
- P: dateTimeLongFormatter
13349
- };
13350
- const dayOfYearTokenRE = /^D+$/;
13351
- const weekYearTokenRE = /^Y+$/;
13352
- const throwTokens = ["D", "DD", "YY", "YYYY"];
13353
- function isProtectedDayOfYearToken(token) {
13354
- return dayOfYearTokenRE.test(token);
13355
- }
13356
- function isProtectedWeekYearToken(token) {
13357
- return weekYearTokenRE.test(token);
13358
- }
13359
- function warnOrThrowProtectedError(token, format2, input) {
13360
- const _message = message(token, format2, input);
13361
- console.warn(_message);
13362
- if (throwTokens.includes(token)) throw new RangeError(_message);
13363
- }
13364
- function message(token, format2, input) {
13365
- const subject = token[0] === "Y" ? "years" : "days of the month";
13366
- return `Use \`${token.toLowerCase()}\` instead of \`${token}\` (in \`${format2}\`) for formatting ${subject} to the input \`${input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
13367
15074
  }
15075
+ class TimestampMillisecondsParser extends Parser {
15076
+ constructor() {
15077
+ super(...arguments);
15078
+ __publicField(this, "priority", 20);
15079
+ __publicField(this, "incompatibleTokens", "*");
15080
+ }
15081
+ parse(dateString) {
15082
+ return parseAnyDigitsSigned(dateString);
15083
+ }
15084
+ set(date2, _flags, value) {
15085
+ return [constructFrom(date2, value), { timestampIsSet: true }];
15086
+ }
15087
+ }
15088
+ const parsers = {
15089
+ G: new EraParser(),
15090
+ y: new YearParser(),
15091
+ Y: new LocalWeekYearParser(),
15092
+ R: new ISOWeekYearParser(),
15093
+ u: new ExtendedYearParser(),
15094
+ Q: new QuarterParser(),
15095
+ q: new StandAloneQuarterParser(),
15096
+ M: new MonthParser(),
15097
+ L: new StandAloneMonthParser(),
15098
+ w: new LocalWeekParser(),
15099
+ I: new ISOWeekParser(),
15100
+ d: new DateParser(),
15101
+ D: new DayOfYearParser(),
15102
+ E: new DayParser(),
15103
+ e: new LocalDayParser(),
15104
+ c: new StandAloneLocalDayParser(),
15105
+ i: new ISODayParser(),
15106
+ a: new AMPMParser(),
15107
+ b: new AMPMMidnightParser(),
15108
+ B: new DayPeriodParser(),
15109
+ h: new Hour1to12Parser(),
15110
+ H: new Hour0to23Parser(),
15111
+ K: new Hour0To11Parser(),
15112
+ k: new Hour1To24Parser(),
15113
+ m: new MinuteParser(),
15114
+ s: new SecondParser(),
15115
+ S: new FractionOfSecondParser(),
15116
+ X: new ISOTimezoneWithZParser(),
15117
+ x: new ISOTimezoneParser(),
15118
+ t: new TimestampSecondsParser(),
15119
+ T: new TimestampMillisecondsParser()
15120
+ };
13368
15121
  const formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
13369
15122
  const longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
13370
15123
  const escapedStringRegExp = /^'([^]*?)'?$/;
13371
15124
  const doubleQuoteRegExp = /''/g;
15125
+ const notWhitespaceRegExp = /\S/;
13372
15126
  const unescapedLatinCharacterRegExp = /[a-zA-Z]/;
13373
- function format$2(date2, formatStr, options) {
13374
- var _a, _b, _c, _d, _e, _f, _g, _h;
15127
+ function parse$2(dateStr, formatStr, referenceDate, options) {
15128
+ var _a, _b, _c, _d;
13375
15129
  const defaultOptions2 = getDefaultOptions();
13376
- const locale2 = (options == null ? void 0 : options.locale) ?? defaultOptions2.locale ?? enUS;
13377
- const firstWeekContainsDate = (options == null ? void 0 : options.firstWeekContainsDate) ?? ((_b = (_a = options == null ? void 0 : options.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? defaultOptions2.firstWeekContainsDate ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.firstWeekContainsDate) ?? 1;
13378
- const weekStartsOn = (options == null ? void 0 : options.weekStartsOn) ?? ((_f = (_e = options == null ? void 0 : options.locale) == null ? void 0 : _e.options) == null ? void 0 : _f.weekStartsOn) ?? defaultOptions2.weekStartsOn ?? ((_h = (_g = defaultOptions2.locale) == null ? void 0 : _g.options) == null ? void 0 : _h.weekStartsOn) ?? 0;
13379
- const originalDate = toDate(date2);
13380
- if (!isValid(originalDate)) {
13381
- throw new RangeError("Invalid time value");
15130
+ const locale2 = defaultOptions2.locale ?? enUS;
15131
+ const firstWeekContainsDate = defaultOptions2.firstWeekContainsDate ?? ((_b = (_a = defaultOptions2.locale) == null ? void 0 : _a.options) == null ? void 0 : _b.firstWeekContainsDate) ?? 1;
15132
+ const weekStartsOn = defaultOptions2.weekStartsOn ?? ((_d = (_c = defaultOptions2.locale) == null ? void 0 : _c.options) == null ? void 0 : _d.weekStartsOn) ?? 0;
15133
+ if (formatStr === "") {
15134
+ if (dateStr === "") {
15135
+ return toDate(referenceDate);
15136
+ } else {
15137
+ return constructFrom(referenceDate, NaN);
15138
+ }
13382
15139
  }
13383
- let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => {
15140
+ const subFnOptions = {
15141
+ firstWeekContainsDate,
15142
+ weekStartsOn,
15143
+ locale: locale2
15144
+ };
15145
+ const setters = [new DateToSystemTimezoneSetter()];
15146
+ const tokens = formatStr.match(longFormattingTokensRegExp).map((substring) => {
13384
15147
  const firstCharacter = substring[0];
13385
- if (firstCharacter === "p" || firstCharacter === "P") {
15148
+ if (firstCharacter in longFormatters) {
13386
15149
  const longFormatter = longFormatters[firstCharacter];
13387
15150
  return longFormatter(substring, locale2.formatLong);
13388
15151
  }
13389
15152
  return substring;
13390
- }).join("").match(formattingTokensRegExp).map((substring) => {
13391
- if (substring === "''") {
13392
- return { isToken: false, value: "'" };
13393
- }
13394
- const firstCharacter = substring[0];
13395
- if (firstCharacter === "'") {
13396
- return { isToken: false, value: cleanEscapedString(substring) };
13397
- }
13398
- if (formatters$1[firstCharacter]) {
13399
- return { isToken: true, value: substring };
13400
- }
13401
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
13402
- throw new RangeError(
13403
- "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
15153
+ }).join("").match(formattingTokensRegExp);
15154
+ const usedTokens = [];
15155
+ for (let token of tokens) {
15156
+ if (isProtectedWeekYearToken(token)) {
15157
+ warnOrThrowProtectedError(token, formatStr, dateStr);
15158
+ }
15159
+ if (isProtectedDayOfYearToken(token)) {
15160
+ warnOrThrowProtectedError(token, formatStr, dateStr);
15161
+ }
15162
+ const firstCharacter = token[0];
15163
+ const parser = parsers[firstCharacter];
15164
+ if (parser) {
15165
+ const { incompatibleTokens } = parser;
15166
+ if (Array.isArray(incompatibleTokens)) {
15167
+ const incompatibleToken = usedTokens.find(
15168
+ (usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter
15169
+ );
15170
+ if (incompatibleToken) {
15171
+ throw new RangeError(
15172
+ `The format string mustn't contain \`${incompatibleToken.fullToken}\` and \`${token}\` at the same time`
15173
+ );
15174
+ }
15175
+ } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) {
15176
+ throw new RangeError(
15177
+ `The format string mustn't contain \`${token}\` and any other token at the same time`
15178
+ );
15179
+ }
15180
+ usedTokens.push({ token: firstCharacter, fullToken: token });
15181
+ const parseResult = parser.run(
15182
+ dateStr,
15183
+ token,
15184
+ locale2.match,
15185
+ subFnOptions
13404
15186
  );
15187
+ if (!parseResult) {
15188
+ return constructFrom(referenceDate, NaN);
15189
+ }
15190
+ setters.push(parseResult.setter);
15191
+ dateStr = parseResult.rest;
15192
+ } else {
15193
+ if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
15194
+ throw new RangeError(
15195
+ "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`"
15196
+ );
15197
+ }
15198
+ if (token === "''") {
15199
+ token = "'";
15200
+ } else if (firstCharacter === "'") {
15201
+ token = cleanEscapedString(token);
15202
+ }
15203
+ if (dateStr.indexOf(token) === 0) {
15204
+ dateStr = dateStr.slice(token.length);
15205
+ } else {
15206
+ return constructFrom(referenceDate, NaN);
15207
+ }
13405
15208
  }
13406
- return { isToken: false, value: substring };
13407
- });
13408
- if (locale2.localize.preprocessor) {
13409
- parts = locale2.localize.preprocessor(originalDate, parts);
13410
15209
  }
13411
- const formatterOptions = {
13412
- firstWeekContainsDate,
13413
- weekStartsOn,
13414
- locale: locale2
13415
- };
13416
- return parts.map((part) => {
13417
- if (!part.isToken) return part.value;
13418
- const token = part.value;
13419
- if (!(options == null ? void 0 : options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(token) || !(options == null ? void 0 : options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(token)) {
13420
- warnOrThrowProtectedError(token, formatStr, String(date2));
15210
+ if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) {
15211
+ return constructFrom(referenceDate, NaN);
15212
+ }
15213
+ const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a2, b2) => b2 - a2).filter((priority, index2, array2) => array2.indexOf(priority) === index2).map(
15214
+ (priority) => setters.filter((setter) => setter.priority === priority).sort((a2, b2) => b2.subPriority - a2.subPriority)
15215
+ ).map((setterArray) => setterArray[0]);
15216
+ let date2 = toDate(referenceDate);
15217
+ if (isNaN(date2.getTime())) {
15218
+ return constructFrom(referenceDate, NaN);
15219
+ }
15220
+ const flags = {};
15221
+ for (const setter of uniquePrioritySetters) {
15222
+ if (!setter.validate(date2, subFnOptions)) {
15223
+ return constructFrom(referenceDate, NaN);
15224
+ }
15225
+ const result = setter.set(date2, flags, subFnOptions);
15226
+ if (Array.isArray(result)) {
15227
+ date2 = result[0];
15228
+ Object.assign(flags, result[1]);
15229
+ } else {
15230
+ date2 = result;
13421
15231
  }
13422
- const formatter = formatters$1[token[0]];
13423
- return formatter(originalDate, token, locale2.localize, formatterOptions);
13424
- }).join("");
13425
- }
13426
- function cleanEscapedString(input) {
13427
- const matched = input.match(escapedStringRegExp);
13428
- if (!matched) {
13429
- return input;
13430
15232
  }
13431
- return matched[1].replace(doubleQuoteRegExp, "'");
13432
- }
13433
- function getDaysInMonth(date2) {
13434
- const _date = toDate(date2);
13435
- const year = _date.getFullYear();
13436
- const monthIndex = _date.getMonth();
13437
- const lastDayOfMonth2 = constructFrom(date2, 0);
13438
- lastDayOfMonth2.setFullYear(year, monthIndex + 1, 0);
13439
- lastDayOfMonth2.setHours(0, 0, 0, 0);
13440
- return lastDayOfMonth2.getDate();
13441
- }
13442
- function getUnixTime(date2) {
13443
- return Math.trunc(+toDate(date2) / 1e3);
13444
- }
13445
- function lastDayOfMonth(date2) {
13446
- const _date = toDate(date2);
13447
- const month = _date.getMonth();
13448
- _date.setFullYear(_date.getFullYear(), month + 1, 0);
13449
- _date.setHours(0, 0, 0, 0);
13450
- return _date;
13451
- }
13452
- function getWeeksInMonth(date2, options) {
13453
- return differenceInCalendarWeeks(
13454
- lastDayOfMonth(date2),
13455
- startOfMonth(date2),
13456
- options
13457
- ) + 1;
13458
- }
13459
- function isAfter(date2, dateToCompare) {
13460
- const _date = toDate(date2);
13461
- const _dateToCompare = toDate(dateToCompare);
13462
- return _date.getTime() > _dateToCompare.getTime();
13463
- }
13464
- function isBefore(date2, dateToCompare) {
13465
- const _date = toDate(date2);
13466
- const _dateToCompare = toDate(dateToCompare);
13467
- return +_date < +_dateToCompare;
15233
+ return constructFrom(referenceDate, date2);
13468
15234
  }
13469
- function isEqual$2(leftDate, rightDate) {
13470
- const _dateLeft = toDate(leftDate);
13471
- const _dateRight = toDate(rightDate);
13472
- return +_dateLeft === +_dateRight;
15235
+ function cleanEscapedString(input) {
15236
+ return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, "'");
13473
15237
  }
13474
15238
  function isSameMonth(dateLeft, dateRight) {
13475
15239
  const _dateLeft = toDate(dateLeft);
@@ -13484,6 +15248,184 @@ function isSameYear(dateLeft, dateRight) {
13484
15248
  function subDays(date2, amount) {
13485
15249
  return addDays(date2, -amount);
13486
15250
  }
15251
+ function parseISO(argument, options) {
15252
+ const additionalDigits = 2;
15253
+ const dateStrings = splitDateString(argument);
15254
+ let date2;
15255
+ if (dateStrings.date) {
15256
+ const parseYearResult = parseYear$1(dateStrings.date, additionalDigits);
15257
+ date2 = parseDate(parseYearResult.restDateString, parseYearResult.year);
15258
+ }
15259
+ if (!date2 || isNaN(date2.getTime())) {
15260
+ return /* @__PURE__ */ new Date(NaN);
15261
+ }
15262
+ const timestamp = date2.getTime();
15263
+ let time2 = 0;
15264
+ let offset2;
15265
+ if (dateStrings.time) {
15266
+ time2 = parseTime(dateStrings.time);
15267
+ if (isNaN(time2)) {
15268
+ return /* @__PURE__ */ new Date(NaN);
15269
+ }
15270
+ }
15271
+ if (dateStrings.timezone) {
15272
+ offset2 = parseTimezone(dateStrings.timezone);
15273
+ if (isNaN(offset2)) {
15274
+ return /* @__PURE__ */ new Date(NaN);
15275
+ }
15276
+ } else {
15277
+ const dirtyDate = new Date(timestamp + time2);
15278
+ const result = /* @__PURE__ */ new Date(0);
15279
+ result.setFullYear(
15280
+ dirtyDate.getUTCFullYear(),
15281
+ dirtyDate.getUTCMonth(),
15282
+ dirtyDate.getUTCDate()
15283
+ );
15284
+ result.setHours(
15285
+ dirtyDate.getUTCHours(),
15286
+ dirtyDate.getUTCMinutes(),
15287
+ dirtyDate.getUTCSeconds(),
15288
+ dirtyDate.getUTCMilliseconds()
15289
+ );
15290
+ return result;
15291
+ }
15292
+ return new Date(timestamp + time2 + offset2);
15293
+ }
15294
+ const patterns = {
15295
+ dateTimeDelimiter: /[T ]/,
15296
+ timeZoneDelimiter: /[Z ]/i,
15297
+ timezone: /([Z+-].*)$/
15298
+ };
15299
+ const dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/;
15300
+ const timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/;
15301
+ const timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/;
15302
+ function splitDateString(dateString) {
15303
+ const dateStrings = {};
15304
+ const array2 = dateString.split(patterns.dateTimeDelimiter);
15305
+ let timeString;
15306
+ if (array2.length > 2) {
15307
+ return dateStrings;
15308
+ }
15309
+ if (/:/.test(array2[0])) {
15310
+ timeString = array2[0];
15311
+ } else {
15312
+ dateStrings.date = array2[0];
15313
+ timeString = array2[1];
15314
+ if (patterns.timeZoneDelimiter.test(dateStrings.date)) {
15315
+ dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0];
15316
+ timeString = dateString.substr(
15317
+ dateStrings.date.length,
15318
+ dateString.length
15319
+ );
15320
+ }
15321
+ }
15322
+ if (timeString) {
15323
+ const token = patterns.timezone.exec(timeString);
15324
+ if (token) {
15325
+ dateStrings.time = timeString.replace(token[1], "");
15326
+ dateStrings.timezone = token[1];
15327
+ } else {
15328
+ dateStrings.time = timeString;
15329
+ }
15330
+ }
15331
+ return dateStrings;
15332
+ }
15333
+ function parseYear$1(dateString, additionalDigits) {
15334
+ const regex = new RegExp(
15335
+ "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
15336
+ );
15337
+ const captures = dateString.match(regex);
15338
+ if (!captures) return { year: NaN, restDateString: "" };
15339
+ const year = captures[1] ? parseInt(captures[1]) : null;
15340
+ const century = captures[2] ? parseInt(captures[2]) : null;
15341
+ return {
15342
+ year: century === null ? year : century * 100,
15343
+ restDateString: dateString.slice((captures[1] || captures[2]).length)
15344
+ };
15345
+ }
15346
+ function parseDate(dateString, year) {
15347
+ if (year === null) return /* @__PURE__ */ new Date(NaN);
15348
+ const captures = dateString.match(dateRegex);
15349
+ if (!captures) return /* @__PURE__ */ new Date(NaN);
15350
+ const isWeekDate = !!captures[4];
15351
+ const dayOfYear = parseDateUnit(captures[1]);
15352
+ const month = parseDateUnit(captures[2]) - 1;
15353
+ const day = parseDateUnit(captures[3]);
15354
+ const week = parseDateUnit(captures[4]);
15355
+ const dayOfWeek = parseDateUnit(captures[5]) - 1;
15356
+ if (isWeekDate) {
15357
+ if (!validateWeekDate(year, week, dayOfWeek)) {
15358
+ return /* @__PURE__ */ new Date(NaN);
15359
+ }
15360
+ return dayOfISOWeekYear(year, week, dayOfWeek);
15361
+ } else {
15362
+ const date2 = /* @__PURE__ */ new Date(0);
15363
+ if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) {
15364
+ return /* @__PURE__ */ new Date(NaN);
15365
+ }
15366
+ date2.setUTCFullYear(year, month, Math.max(dayOfYear, day));
15367
+ return date2;
15368
+ }
15369
+ }
15370
+ function parseDateUnit(value) {
15371
+ return value ? parseInt(value) : 1;
15372
+ }
15373
+ function parseTime(timeString) {
15374
+ const captures = timeString.match(timeRegex);
15375
+ if (!captures) return NaN;
15376
+ const hours = parseTimeUnit(captures[1]);
15377
+ const minutes = parseTimeUnit(captures[2]);
15378
+ const seconds = parseTimeUnit(captures[3]);
15379
+ if (!validateTime(hours, minutes, seconds)) {
15380
+ return NaN;
15381
+ }
15382
+ return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3;
15383
+ }
15384
+ function parseTimeUnit(value) {
15385
+ return value && parseFloat(value.replace(",", ".")) || 0;
15386
+ }
15387
+ function parseTimezone(timezoneString) {
15388
+ if (timezoneString === "Z") return 0;
15389
+ const captures = timezoneString.match(timezoneRegex);
15390
+ if (!captures) return 0;
15391
+ const sign2 = captures[1] === "+" ? -1 : 1;
15392
+ const hours = parseInt(captures[2]);
15393
+ const minutes = captures[3] && parseInt(captures[3]) || 0;
15394
+ if (!validateTimezone(hours, minutes)) {
15395
+ return NaN;
15396
+ }
15397
+ return sign2 * (hours * millisecondsInHour + minutes * millisecondsInMinute);
15398
+ }
15399
+ function dayOfISOWeekYear(isoWeekYear, week, day) {
15400
+ const date2 = /* @__PURE__ */ new Date(0);
15401
+ date2.setUTCFullYear(isoWeekYear, 0, 4);
15402
+ const fourthOfJanuaryDay = date2.getUTCDay() || 7;
15403
+ const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay;
15404
+ date2.setUTCDate(date2.getUTCDate() + diff);
15405
+ return date2;
15406
+ }
15407
+ const daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
15408
+ function isLeapYearIndex(year) {
15409
+ return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;
15410
+ }
15411
+ function validateDate(year, month, date2) {
15412
+ return month >= 0 && month <= 11 && date2 >= 1 && date2 <= (daysInMonths[month] || (isLeapYearIndex(year) ? 29 : 28));
15413
+ }
15414
+ function validateDayOfYearDate(year, dayOfYear) {
15415
+ return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex(year) ? 366 : 365);
15416
+ }
15417
+ function validateWeekDate(_year, week, day) {
15418
+ return week >= 1 && week <= 53 && day >= 0 && day <= 6;
15419
+ }
15420
+ function validateTime(hours, minutes, seconds) {
15421
+ if (hours === 24) {
15422
+ return minutes === 0 && seconds === 0;
15423
+ }
15424
+ return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25;
15425
+ }
15426
+ function validateTimezone(_hours, minutes) {
15427
+ return minutes >= 0 && minutes <= 59;
15428
+ }
13487
15429
  function setMonth(date2, month) {
13488
15430
  const _date = toDate(date2);
13489
15431
  const year = _date.getFullYear();
@@ -16580,6 +18522,9 @@ const useCombobox = (props, ref) => {
16580
18522
  };
16581
18523
  const handleInputKeyDown = (event) => {
16582
18524
  event.persist();
18525
+ if (isElementInsideTable3OrReport(event.currentTarget) && (event.key === "ArrowUp" || event.key === "ArrowDown") && open) {
18526
+ event.stopPropagation();
18527
+ }
16583
18528
  if (!event.ctrlKey && !event.metaKey) {
16584
18529
  switch (event.key) {
16585
18530
  case "Backspace": {
@@ -16883,11 +18828,12 @@ const useDatepicker = ({ defaultValue: _, calendar: calendar2, onBlur, onChange,
16883
18828
  );
16884
18829
  const formattedValue = valueAsDate ? format$1(valueAsDate) || "" : "";
16885
18830
  event.target.value = formattedValue;
18831
+ const isEmpty = !event.target.value.trim();
16886
18832
  if (onChange) {
16887
- event.detail = valueAsDate;
18833
+ event.detail = !isEmpty ? valueAsDate : null;
16888
18834
  onChange(event);
16889
18835
  } else {
16890
- setInternalValue(formattedValue);
18836
+ setInternalValue(!isEmpty ? formattedValue : "");
16891
18837
  }
16892
18838
  if (onBlur) {
16893
18839
  onBlur(event);
@@ -32760,6 +34706,121 @@ var TableFilterComparator = /* @__PURE__ */ ((TableFilterComparator2) => {
32760
34706
  TableFilterComparator2[TableFilterComparator2["IsNoneOf"] = 15] = "IsNoneOf";
32761
34707
  return TableFilterComparator2;
32762
34708
  })(TableFilterComparator || {});
34709
+ class DataType {
34710
+ }
34711
+ const localeNumberSeparators = /* @__PURE__ */ new Map();
34712
+ class NumericDataType extends DataType {
34713
+ static format(value, locale2, options) {
34714
+ const localisedValue = new Intl.NumberFormat(locale2, options).format(value);
34715
+ return localisedValue.replace(/[\u00A0\u202F]/g, " ");
34716
+ }
34717
+ static parse(value, locale2) {
34718
+ if (value === void 0 || value === null || typeof value !== "string") {
34719
+ return void 0;
34720
+ }
34721
+ if (value === "Infinity" || value === "-Infinity") {
34722
+ return Number(value);
34723
+ }
34724
+ let sanitizedValue = value.replaceAll(" ", "").replace(/[^0-9.,-]+/g, "");
34725
+ if (!sanitizedValue.length) {
34726
+ return void 0;
34727
+ }
34728
+ const decimalSeparator = this.getSeparator(locale2);
34729
+ if (decimalSeparator === ",") {
34730
+ sanitizedValue = sanitizedValue.replaceAll(".", "").replace(",", ".");
34731
+ } else {
34732
+ sanitizedValue = sanitizedValue.replaceAll(",", "");
34733
+ }
34734
+ const output = Number(sanitizedValue);
34735
+ if (isNaN(output)) {
34736
+ return void 0;
34737
+ }
34738
+ return output;
34739
+ }
34740
+ static getSeparator(locale2) {
34741
+ var _a;
34742
+ if (localeNumberSeparators.has(locale2)) {
34743
+ return localeNumberSeparators.get(locale2);
34744
+ }
34745
+ const decimalSeparator = ((_a = new Intl.NumberFormat(locale2).formatToParts(1.1).find((part) => part.type === "decimal")) == null ? void 0 : _a.value) ?? ".";
34746
+ localeNumberSeparators.set(locale2, decimalSeparator);
34747
+ return decimalSeparator;
34748
+ }
34749
+ }
34750
+ const localeDateMasks = /* @__PURE__ */ new Map();
34751
+ class DateTimeDataType extends DataType {
34752
+ static format(value, locale2, options) {
34753
+ let date2;
34754
+ if (typeof value === "string") {
34755
+ date2 = new Date(value);
34756
+ } else if (value instanceof Date) {
34757
+ date2 = value;
34758
+ } else {
34759
+ return "";
34760
+ }
34761
+ if (isNaN(date2.getTime())) {
34762
+ return "";
34763
+ }
34764
+ return new Intl.DateTimeFormat(locale2, options).format(date2).replace(/[\u00A0\u202F]/g, " ");
34765
+ }
34766
+ static parse(value, locale2) {
34767
+ if (value === void 0 || value === null || typeof value !== "string") {
34768
+ return void 0;
34769
+ }
34770
+ const sanitizedValue = value == null ? void 0 : value.trim();
34771
+ if (!(sanitizedValue == null ? void 0 : sanitizedValue.length)) {
34772
+ return void 0;
34773
+ }
34774
+ const setHoursToMidday = (date2) => {
34775
+ date2.setHours(12 - date2.getTimezoneOffset() / 60);
34776
+ };
34777
+ try {
34778
+ const date2 = parseISO(sanitizedValue);
34779
+ if (isValid(date2)) {
34780
+ const timeRegex2 = /^\d{2}:\d{2}(?::\d{2}\.\d+|:\d{2})?(?:Z)?$/;
34781
+ const time2 = sanitizedValue.split("T")[1];
34782
+ if (!time2 || !timeRegex2.test(time2)) {
34783
+ setHoursToMidday(date2);
34784
+ }
34785
+ return date2;
34786
+ }
34787
+ } catch {
34788
+ }
34789
+ const mask = this.getMask(locale2);
34790
+ if (mask) {
34791
+ try {
34792
+ const date2 = parse$2(sanitizedValue, mask, /* @__PURE__ */ new Date());
34793
+ if (isValid(date2)) {
34794
+ setHoursToMidday(date2);
34795
+ return date2;
34796
+ }
34797
+ } catch {
34798
+ }
34799
+ }
34800
+ return void 0;
34801
+ }
34802
+ static getMask(locale2) {
34803
+ if (localeDateMasks.has(locale2)) {
34804
+ return localeDateMasks.get(locale2);
34805
+ }
34806
+ const parts = new Intl.DateTimeFormat(locale2).formatToParts(/* @__PURE__ */ new Date());
34807
+ const mask = parts.reduce((mask2, part) => {
34808
+ switch (part.type) {
34809
+ case "literal":
34810
+ return mask2 + part.value;
34811
+ case "day":
34812
+ return mask2 + "dd";
34813
+ case "month":
34814
+ return mask2 + "MM";
34815
+ case "year":
34816
+ return mask2 + "yyyy";
34817
+ }
34818
+ return mask2;
34819
+ }, "");
34820
+ localeDateMasks.set(locale2, mask);
34821
+ return mask;
34822
+ }
34823
+ }
32763
34824
  const dataTypes = {
32764
34825
  auto: {
32765
34826
  sortingFn: "auto",
@@ -32824,15 +34885,13 @@ function createDatetimeDataType(defaultOptions2) {
32824
34885
  TableFilterComparator.IsEmpty,
32825
34886
  TableFilterComparator.IsNotEmpty
32826
34887
  ],
32827
- getDisplayValue: (value, row, options) => {
32828
- var _a;
34888
+ getDisplayValue: (value, _, options) => {
32829
34889
  if (value === void 0) {
32830
34890
  return "";
32831
34891
  }
32832
- return new Intl.DateTimeFormat((_a = options == null ? void 0 : options.localization) == null ? void 0 : _a.locale, defaultOptions2).format(
32833
- typeof value === "string" ? Date.parse(value) : value
32834
- );
32835
- }
34892
+ return DateTimeDataType.format(value, options == null ? void 0 : options.localization.locale, defaultOptions2);
34893
+ },
34894
+ parse: (value, locale2) => DateTimeDataType.parse(value, locale2)
32836
34895
  };
32837
34896
  }
32838
34897
  function createNumberDataType(align, defaultOptions2) {
@@ -32840,6 +34899,8 @@ function createNumberDataType(align, defaultOptions2) {
32840
34899
  align,
32841
34900
  sortingFn: "basic",
32842
34901
  filterComparators: [
34902
+ TableFilterComparator.Contains,
34903
+ TableFilterComparator.DoesNotContain,
32843
34904
  TableFilterComparator.IsEqualTo,
32844
34905
  TableFilterComparator.IsNotEqualTo,
32845
34906
  TableFilterComparator.IsGreaterThan,
@@ -32851,10 +34912,6 @@ function createNumberDataType(align, defaultOptions2) {
32851
34912
  TableFilterComparator.IsNotEmpty
32852
34913
  ],
32853
34914
  getDisplayValue: (value, row, options) => {
32854
- var _a, _b;
32855
- if (value === void 0) {
32856
- return "";
32857
- }
32858
34915
  const dataTypeOptions = typeof (options == null ? void 0 : options.dataTypeOptions) === "function" ? options == null ? void 0 : options.dataTypeOptions(row) : options == null ? void 0 : options.dataTypeOptions;
32859
34916
  const numberFormatOptions = {
32860
34917
  // format
@@ -32870,20 +34927,14 @@ function createNumberDataType(align, defaultOptions2) {
32870
34927
  numberFormatOptions.currency = dataTypeOptions.currency;
32871
34928
  numberFormatOptions.currencyDisplay = "code";
32872
34929
  }
32873
- let localisedValue = new Intl.NumberFormat((_a = options == null ? void 0 : options.localization) == null ? void 0 : _a.locale, numberFormatOptions).format(Number(value));
32874
- if (!numberFormatOptions.useGrouping) {
32875
- return localisedValue;
32876
- }
32877
- let localisedValueWithoutThousandsSeperator = new Intl.NumberFormat((_b = options == null ? void 0 : options.localization) == null ? void 0 : _b.locale, {
34930
+ const localisedValue = NumericDataType.format(value, options == null ? void 0 : options.localization.locale, numberFormatOptions);
34931
+ const localisedValueWithoutThousandsSeperator = NumericDataType.format(value, options == null ? void 0 : options.localization.locale, {
32878
34932
  ...numberFormatOptions,
32879
34933
  useGrouping: false
32880
- }).format(Number(value));
32881
- if (numberFormatOptions.style === "percent" || numberFormatOptions.style === "currency") {
32882
- localisedValue = localisedValue.replace(/\u00A0/g, " ");
32883
- localisedValueWithoutThousandsSeperator = localisedValueWithoutThousandsSeperator.replace(/\u00A0/g, " ");
32884
- }
34934
+ });
32885
34935
  return [localisedValue, localisedValueWithoutThousandsSeperator];
32886
- }
34936
+ },
34937
+ parse: (value, locale2) => NumericDataType.parse(value, locale2)
32887
34938
  };
32888
34939
  }
32889
34940
  function getDataTypeProperties(dataType) {
@@ -32901,103 +34952,121 @@ function getSortingFn(dataType, customFnOrBuiltIn) {
32901
34952
  const toLowerCase = (value) => String(value ?? "").toLocaleLowerCase();
32902
34953
  const isWeakContains = (left, right) => toLowerCase(left).includes(toLowerCase(right));
32903
34954
  const isWeakEqual = (left, right) => toLowerCase(left) === toLowerCase(right);
32904
- function columnFilterFn(value, filter2) {
34955
+ function columnFilterFn(row, cellValue, meta, filter2, localization) {
32905
34956
  try {
34957
+ const query = filter2.value;
34958
+ const { dataType, dataTypeOptions } = meta ?? {};
32906
34959
  if (filter2.comparator === TableFilterComparator.IsEmpty || filter2.comparator === TableFilterComparator.IsNotEmpty) {
32907
- const isEmpty = value === void 0 || value === null || value === "";
34960
+ const isEmpty = cellValue === void 0 || cellValue === null || cellValue === "";
32908
34961
  return filter2.comparator === TableFilterComparator.IsEmpty ? isEmpty : !isEmpty;
32909
34962
  }
32910
- if (filter2.value === void 0 || filter2.value === null || filter2.value === "") {
34963
+ if (query === void 0 || query === null || query === "") {
32911
34964
  return true;
32912
34965
  }
32913
- const valueAsDate = new Date(value);
34966
+ const evaluate = (matcher) => {
34967
+ return isMatched(query, cellValue, row, dataType, dataTypeOptions, localization, matcher);
34968
+ };
34969
+ const isDateColumn = dataType === "date" || dataType === "datetime";
34970
+ const valueAsDate = new Date(cellValue);
34971
+ const isNumberColumn = dataType === "number" || dataType === "amount";
34972
+ const compareNumbers2 = (fn) => {
34973
+ const input = typeof query === "number" ? query : NumericDataType.parse(query, localization.locale);
34974
+ const value = cellValue;
34975
+ if (input === void 0) {
34976
+ return false;
34977
+ }
34978
+ return fn(input, value);
34979
+ };
32914
34980
  switch (filter2.comparator) {
32915
34981
  case TableFilterComparator.Contains:
32916
- return isWeakContains(value, filter2.value);
34982
+ return evaluate(isWeakContains);
32917
34983
  case TableFilterComparator.DoesNotContain:
32918
- return !isWeakContains(value, filter2.value);
34984
+ return !evaluate(isWeakContains);
32919
34985
  case TableFilterComparator.IsEqualTo: {
32920
- if (isDate(valueAsDate)) {
32921
- return isDate(filter2.value) && isWeakEqual$1(valueAsDate, filter2.value);
32922
- } else if (typeof filter2.value === "boolean") {
32923
- return value === filter2.value;
34986
+ if (dataType === "boolean") {
34987
+ return cellValue === query;
34988
+ } else if (isDateColumn) {
34989
+ return isWeakEqual$1(query, valueAsDate);
32924
34990
  }
32925
- return isWeakEqual(value, filter2.value);
34991
+ return evaluate(isWeakEqual);
32926
34992
  }
32927
34993
  case TableFilterComparator.IsNotEqualTo: {
32928
- if (isDate(valueAsDate)) {
32929
- return isDate(filter2.value) && isWeakEqual$1(valueAsDate, filter2.value) === false;
32930
- } else if (typeof filter2.value === "boolean") {
32931
- return value !== filter2.value;
34994
+ if (dataType === "boolean") {
34995
+ return cellValue !== query;
34996
+ } else if (isDateColumn) {
34997
+ return !isWeakEqual$1(query, valueAsDate);
32932
34998
  }
32933
- return !isWeakEqual(value, filter2.value);
34999
+ return !evaluate(isWeakEqual);
32934
35000
  }
32935
35001
  case TableFilterComparator.IsGreaterThan: {
32936
- if (isDate(valueAsDate)) {
32937
- return isDate(filter2.value) && isAfter(valueAsDate, filter2.value);
32938
- } else {
32939
- const valueAsNumber = parseInt(value);
32940
- return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber > filter2.value;
35002
+ if (isDateColumn) {
35003
+ return query.getTime() < valueAsDate.getTime();
35004
+ } else if (isNumberColumn) {
35005
+ return compareNumbers2((q, v2) => q < v2);
32941
35006
  }
35007
+ return false;
32942
35008
  }
32943
35009
  case TableFilterComparator.IsLessThan: {
32944
- if (isDate(valueAsDate)) {
32945
- return isDate(filter2.value) && isBefore(valueAsDate, filter2.value);
32946
- } else {
32947
- const valueAsNumber = parseInt(value);
32948
- return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber < filter2.value;
35010
+ if (isDateColumn) {
35011
+ return query.getTime() > valueAsDate.getTime();
35012
+ } else if (isNumberColumn) {
35013
+ return compareNumbers2((q, v2) => q > v2);
32949
35014
  }
35015
+ return false;
32950
35016
  }
32951
35017
  case TableFilterComparator.IsLessThanOrEqualTo: {
32952
- if (isDate(valueAsDate)) {
32953
- return isDate(filter2.value) && (isBefore(valueAsDate, filter2.value) || isEqual$2(valueAsDate, filter2.value));
32954
- } else {
32955
- const valueAsNumber = parseInt(value);
32956
- return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber <= filter2.value;
35018
+ if (isDateColumn) {
35019
+ return query.getTime() > valueAsDate.getTime() || isWeakEqual$1(valueAsDate, query);
35020
+ } else if (isNumberColumn) {
35021
+ return compareNumbers2((q, v2) => q >= v2);
32957
35022
  }
35023
+ return false;
32958
35024
  }
32959
35025
  case TableFilterComparator.IsGreaterThanOrEqualTo: {
32960
- if (isDate(valueAsDate)) {
32961
- return isDate(filter2.value) && (isAfter(valueAsDate, filter2.value) || isEqual$2(valueAsDate, filter2.value));
32962
- } else {
32963
- const valueAsNumber = parseInt(value);
32964
- return !isNaN(valueAsNumber) && filter2.value !== void 0 && valueAsNumber >= filter2.value;
35026
+ if (isDateColumn) {
35027
+ return query.getTime() < valueAsDate.getTime() || isWeakEqual$1(valueAsDate, query);
35028
+ } else if (isNumberColumn) {
35029
+ return compareNumbers2((q, v2) => q <= v2);
32965
35030
  }
35031
+ return false;
32966
35032
  }
32967
35033
  case TableFilterComparator.IsBetween: {
32968
- const [fromValue, toValue2] = filter2.value;
32969
- if (isDate(valueAsDate)) {
32970
- if (isDate(fromValue) && isBefore(valueAsDate, fromValue)) {
35034
+ const [fromValue, toValue2] = query;
35035
+ if (isDateColumn) {
35036
+ if (fromValue !== void 0 && valueAsDate.getTime() < fromValue.getTime()) {
32971
35037
  return false;
32972
- } else if (isDate(toValue2) && isAfter(valueAsDate, toValue2)) {
35038
+ } else if (toValue2 !== void 0 && valueAsDate.getTime() > toValue2.getTime()) {
32973
35039
  return false;
32974
35040
  }
32975
35041
  return true;
32976
- } else {
32977
- const valueAsNumber = parseInt(value);
32978
- if (isNaN(valueAsNumber)) {
32979
- return false;
32980
- }
32981
- if (fromValue !== void 0 && valueAsNumber < fromValue) {
35042
+ } else if (isNumberColumn) {
35043
+ if (fromValue !== void 0 && cellValue < fromValue) {
32982
35044
  return false;
32983
- } else if (toValue2 !== void 0 && valueAsNumber > toValue2) {
35045
+ } else if (toValue2 !== void 0 && cellValue > toValue2) {
32984
35046
  return false;
32985
35047
  }
32986
35048
  return true;
32987
35049
  }
35050
+ return false;
32988
35051
  }
32989
35052
  case TableFilterComparator.HasAnyOf:
32990
- return Array.isArray(filter2.value) && Array.isArray(value) ? filter2.value.some((item) => value.includes(item)) : false;
35053
+ return Array.isArray(query) && Array.isArray(cellValue) ? query.some((item) => cellValue.includes(item)) : false;
32991
35054
  case TableFilterComparator.HasNoneOf:
32992
- return Array.isArray(filter2.value) && Array.isArray(value) ? filter2.value.every((item) => value.includes(item) === false) : false;
35055
+ return Array.isArray(query) && Array.isArray(cellValue) ? query.every((item) => cellValue.includes(item) === false) : false;
32993
35056
  case TableFilterComparator.HasAllOf:
32994
- return Array.isArray(filter2.value) && Array.isArray(value) ? filter2.value.filter((v2) => value.includes(v2)).length === filter2.value.length : false;
32995
- case TableFilterComparator.IsOneOf:
32996
- if (!Array.isArray(filter2.value)) return false;
32997
- return filter2.value.some((v2) => isWeakEqual(value, v2));
32998
- case TableFilterComparator.IsNoneOf:
32999
- if (!Array.isArray(filter2.value)) return false;
33000
- return filter2.value.every((v2) => !isWeakEqual(value, v2));
35057
+ return Array.isArray(query) && Array.isArray(cellValue) ? query.filter((v2) => cellValue.includes(v2)).length === query.length : false;
35058
+ case TableFilterComparator.IsOneOf: {
35059
+ if (!Array.isArray(query)) {
35060
+ return false;
35061
+ }
35062
+ return query.some((v2) => isWeakEqual(String(cellValue), v2));
35063
+ }
35064
+ case TableFilterComparator.IsNoneOf: {
35065
+ if (!Array.isArray(query)) {
35066
+ return false;
35067
+ }
35068
+ return query.every((v2) => !isWeakEqual(String(cellValue), v2));
35069
+ }
33001
35070
  }
33002
35071
  return false;
33003
35072
  } catch (e3) {
@@ -33008,12 +35077,12 @@ function columnFilterFn(value, filter2) {
33008
35077
  const flattenCellValue = (cellValue) => {
33009
35078
  return typeof cellValue === "object" ? Object.values(cellValue).map(flattenCellValue) : cellValue;
33010
35079
  };
33011
- function isMatched(searchQuery, cellValue, rowValue, dataType, dataTypeOptions, localization) {
35080
+ function isMatched(query, cellValue, rowValue, dataType, dataTypeOptions, localization, matcher = isWeakContains) {
33012
35081
  if (typeof cellValue === "object") {
33013
- return flattenCellValue(cellValue).flat(Infinity).find((y2) => isWeakContains(y2, searchQuery));
35082
+ return flattenCellValue(cellValue).flat(Infinity).find((y2) => matcher(y2, query));
33014
35083
  } else {
33015
35084
  const cellValueAsString = String(cellValue ?? "");
33016
- if (cellValueAsString !== void 0 && isWeakContains(cellValueAsString, searchQuery)) {
35085
+ if (cellValueAsString !== void 0 && matcher(cellValueAsString, query)) {
33017
35086
  return true;
33018
35087
  } else {
33019
35088
  const dataTypeProperties = getDataTypeProperties(dataType);
@@ -33023,12 +35092,14 @@ function isMatched(searchQuery, cellValue, rowValue, dataType, dataTypeOptions,
33023
35092
  localization
33024
35093
  });
33025
35094
  if (Array.isArray(cellDisplayValue)) {
33026
- for (const displayValue of cellDisplayValue) {
33027
- if (isWeakContains(displayValue, searchQuery)) {
33028
- return true;
33029
- }
33030
- }
33031
- } else if (cellDisplayValue !== void 0 && isWeakContains(cellDisplayValue, searchQuery)) {
35095
+ return cellDisplayValue.some((cdv) => matcher(cdv, query));
35096
+ } else if (cellDisplayValue !== void 0 && isWeakContains(cellDisplayValue, query)) {
35097
+ return true;
35098
+ }
35099
+ }
35100
+ if (typeof query !== typeof cellValue && dataTypeProperties.parse) {
35101
+ const parsedQuery = dataTypeProperties.parse(query, localization.locale);
35102
+ if (parsedQuery !== void 0 && matcher(cellValue, parsedQuery)) {
33032
35103
  return true;
33033
35104
  }
33034
35105
  }
@@ -33474,7 +35545,11 @@ function configureReactTableOptions(options, props, localization) {
33474
35545
  else {
33475
35546
  tableOptions.getFilteredRowModel = getFilteredRowModel();
33476
35547
  tableOptions.filterFns = {
33477
- tacoFilter: (row, columnId, filter2) => columnFilterFn(row.getValue(columnId), filter2)
35548
+ tacoFilter: (row, columnId, filter2) => {
35549
+ var _a;
35550
+ const meta = (_a = row._getAllCellsByColumnId()[columnId]) == null ? void 0 : _a.column.columnDef.meta;
35551
+ return columnFilterFn(row.original, row.getValue(columnId), meta, filter2, localization);
35552
+ }
33478
35553
  };
33479
35554
  }
33480
35555
  }
@@ -33990,8 +36065,10 @@ function useTableRowSelection(isEnabled = false) {
33990
36065
  lastSelectedRowIndex
33991
36066
  };
33992
36067
  }
33993
- function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false) {
33994
- const [enableGlobalFilter, _setEnableGlobalFilter] = React.useState(defaultEnableGlobalFilter);
36068
+ function useTableSearch(isEnabled = false, onChangeSearch, defaultEnableGlobalFilter = false, _experimentalDataLoader2 = false) {
36069
+ const [enableGlobalFilter, _setEnableGlobalFilter] = React.useState(
36070
+ _experimentalDataLoader2 || defaultEnableGlobalFilter
36071
+ );
33995
36072
  function setEnableGlobalFilter(enabled, instance) {
33996
36073
  _setEnableGlobalFilter(enabled);
33997
36074
  const currentFilter = instance.getState().globalFilter;
@@ -34566,7 +36643,12 @@ function useTableManager(props, ref, meta, internalColumns) {
34566
36643
  const rowGroups = useTableRowGroups(props.rowActionsForGroup);
34567
36644
  const rowHeight = useTableRowHeight(options.enableRowHeight, settings.rowHeight);
34568
36645
  const rowSelection = useTableRowSelection(!!options.enableRowSelection);
34569
- const search = useTableSearch(options.enableSearch, props.onChangeSearch, settings.excludeUnmatchedRecordsInSearch);
36646
+ const search = useTableSearch(
36647
+ options.enableSearch,
36648
+ props.onChangeSearch,
36649
+ settings.excludeUnmatchedRecordsInSearch,
36650
+ props._experimentalDataLoader2
36651
+ );
34570
36652
  const server = useTableServerLoading(
34571
36653
  length,
34572
36654
  data,
@@ -34832,10 +36914,11 @@ function useTableGlobalShortcuts(table, tableRef, scrollToIndex, localShortcuts
34832
36914
  const handleKeyDown = (event) => {
34833
36915
  var _a;
34834
36916
  const trigger = event.target;
34835
- if (isElementInsideOverlay(trigger) && !isSiblingElementInsideSameParentOverlay(trigger, tableRef.current) || isElementInteractive(trigger) && !isElementInsideOrTriggeredFromContainer(trigger, tableRef.current)) {
36917
+ if (isElementInsideExternalRelatedOverlay(trigger, tableRef)) {
34836
36918
  return;
34837
36919
  }
34838
- tableMeta.rowActive.handleKeyDown(event, tableMeta.length, scrollToIndex);
36920
+ const reachableRows = tableMeta.length + table.getBottomRows().length;
36921
+ tableMeta.rowActive.handleKeyDown(event, reachableRows, scrollToIndex);
34839
36922
  tableMeta.rowSelection.handleKeyDown(event, table);
34840
36923
  if (tableMeta.rowActive.rowActiveIndex !== void 0) {
34841
36924
  tableMeta.rowClick.handleKeyDown(event, (_a = rows[tableMeta.rowActive.rowActiveIndex]) == null ? void 0 : _a.original);
@@ -35863,15 +37946,43 @@ function useTableRowActiveListener(table, tableRef) {
35863
37946
  }, [tableMeta.rowActive.rowActiveIndex]);
35864
37947
  }
35865
37948
  function Actions(props) {
37949
+ var _a;
35866
37950
  const { actions, actionsLength, data, isActiveRow, rowId, table } = props;
35867
37951
  const { texts } = useLocalization();
35868
37952
  const tableMeta = table.options.meta;
35869
- const visibleActions = actions.map((action) => action(data, rowId, tableMeta.rowActions.handlers["cleanup"], table)).filter((action) => !!action);
35870
- const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
35871
- const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
35872
- const className = clsx(
35873
- "flex justify-end text-right bg-[inherit] shadow-[-6px_0px_6px_var(--table-row-actions-shadow)] print:hidden"
35874
- );
37953
+ const visibleActions = actions.map(
37954
+ (action) => {
37955
+ var _a2;
37956
+ return action(data, {
37957
+ cleanup: tableMeta.rowActions.handlers["cleanup"] ?? (() => void 0),
37958
+ isEditing: ((_a2 = tableMeta.editing) == null ? void 0 : _a2.isEditing) ?? false,
37959
+ rowId,
37960
+ table
37961
+ });
37962
+ }
37963
+ ).filter((action) => !!action);
37964
+ let length = actionsLength;
37965
+ if ((_a = tableMeta.editing) == null ? void 0 : _a.isEditing) {
37966
+ const lengthWithoutEditingItems = visibleActions.length - 1;
37967
+ if (lengthWithoutEditingItems < actionsLength) {
37968
+ length = lengthWithoutEditingItems;
37969
+ }
37970
+ }
37971
+ const handleMenuButtonKeyDown = (event) => {
37972
+ var _a2, _b;
37973
+ const isLastRowActive = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;
37974
+ if (event.key === "Tab" && isLastRowActive && ((_a2 = tableMeta.editing) == null ? void 0 : _a2.isEditing) && ((_b = tableMeta.editing) == null ? void 0 : _b.hasChanges())) {
37975
+ tableMeta.editing.saveChanges(table);
37976
+ }
37977
+ };
37978
+ const handleMenuContentKeyDown = (event) => {
37979
+ if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
37980
+ event.stopPropagation();
37981
+ }
37982
+ };
37983
+ const actionsOnRow = visibleActions.length === length ? visibleActions : visibleActions.slice(0, length - 1);
37984
+ const actionsInMenu = visibleActions.slice(visibleActions.length === length ? length : length - 1);
37985
+ const className = clsx("flex justify-end text-right bg-[inherit] print:hidden");
35875
37986
  return /* @__PURE__ */ React.createElement("span", { className }, actionsOnRow.map((button, index2) => {
35876
37987
  const tooltip = String(button.props.tooltip ?? button.props["aria-label"] ?? "");
35877
37988
  return React.cloneElement(button, {
@@ -35886,8 +37997,17 @@ function Actions(props) {
35886
37997
  appearance: "transparent",
35887
37998
  "aria-label": texts.table.columns.actions.tooltip,
35888
37999
  icon: "more",
38000
+ onKeyDown: handleMenuButtonKeyDown,
35889
38001
  tabIndex: isActiveRow ? 0 : -1,
35890
- menu: (menuProps) => /* @__PURE__ */ React.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React.createElement(Menu$1.Content, null, actionsInMenu.map((action, i2) => /* @__PURE__ */ React.createElement(Menu$1.Item, { key: i2, ...action.props, shortcut: action.props.shortcut }, action.props["aria-label"]))))
38002
+ menu: (menuProps) => /* @__PURE__ */ React.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React.createElement(Menu$1.Content, { onKeyDown: handleMenuContentKeyDown }, actionsInMenu.map((action, i2) => {
38003
+ var _a2;
38004
+ const item = /* @__PURE__ */ React.createElement(Menu$1.Item, { key: i2, ...action.props, shortcut: action.props.shortcut }, action.props["aria-label"]);
38005
+ const isFirstEditingMenuItem = ((_a2 = tableMeta.editing) == null ? void 0 : _a2.isEditing) && actionsInMenu.length > 2 && i2 === actionsInMenu.length - 2;
38006
+ if (isFirstEditingMenuItem) {
38007
+ return /* @__PURE__ */ React.createElement(React.Fragment, { key: i2 }, /* @__PURE__ */ React.createElement(Menu$1.Separator, null), item);
38008
+ }
38009
+ return item;
38010
+ })))
35891
38011
  }
35892
38012
  ) : null);
35893
38013
  }
@@ -35928,7 +38048,8 @@ const renderer$3 = {
35928
38048
  'print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky right-0',
35929
38049
  'group-[[data-row-active="true"][data-selected="false"]]/row:text-grey-200',
35930
38050
  'group-[[data-row-selected="true"]]/row:text-blue-100',
35931
- 'group-[[data-row-selected="false"]:hover]/row:text-grey-100'
38051
+ 'group-[[data-row-selected="false"]:hover]/row:text-grey-100',
38052
+ "shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]"
35932
38053
  ),
35933
38054
  // TODO: remove when table3 is migrated, this satisfies the legacy table3 type
35934
38055
  enableSearch: false,
@@ -36426,7 +38547,7 @@ function DisplayCell(props) {
36426
38547
  } else {
36427
38548
  content = typeof cell.column.columnDef.cell === "function" ? cell.column.columnDef.cell(cell.getContext()) : cell.getValue();
36428
38549
  }
36429
- return /* @__PURE__ */ React.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content);
38550
+ return /* @__PURE__ */ React.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content ?? columnMeta.emptyState);
36430
38551
  }
36431
38552
  const MemoedDisplayCell = React.memo(function MemoedDisplayCell2(props) {
36432
38553
  const { cellRef, children, isTruncated, ...cellAttributes } = props;
@@ -36980,7 +39101,20 @@ function useAugmentedFocusManager() {
36980
39101
  const focusManager = $9bf71ea28793e738$export$10c5169755ce7bd7();
36981
39102
  const focusPrevious = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
36982
39103
  const focusNext = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusNext(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
36983
- const focusFirst = () => focusManager == null ? void 0 : focusManager.focusFirst(FOCUS_MANAGER_OPTIONS_TAB);
39104
+ const focusFirst = () => {
39105
+ return focusManager == null ? void 0 : focusManager.focusFirst({
39106
+ ...FOCUS_MANAGER_OPTIONS_TAB,
39107
+ accept: (element) => {
39108
+ if (!FOCUS_MANAGER_OPTIONS_TAB.accept(element)) {
39109
+ return false;
39110
+ }
39111
+ if (element.closest('[data-taco="cell-control"]')) {
39112
+ return true;
39113
+ }
39114
+ return false;
39115
+ }
39116
+ });
39117
+ };
36984
39118
  const focusLast = () => focusManager == null ? void 0 : focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
36985
39119
  return {
36986
39120
  focusPrevious,
@@ -37000,7 +39134,8 @@ function Body(props) {
37000
39134
  }
37001
39135
  if (tableMeta.rowActive.rowActiveIndex !== void 0) {
37002
39136
  const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;
37003
- const isLastRow = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;
39137
+ const reachableRows = tableMeta.length + table.getBottomRows().length;
39138
+ const isLastRow = tableMeta.rowActive.rowActiveIndex === reachableRows - 1;
37004
39139
  if (event.key === "Tab" || enableHorizontalArrowKeyNavigation && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
37005
39140
  if (event.key === "Tab" && !hasFocusableElement(event.target.closest("tr[data-row-id]"))) {
37006
39141
  return;
@@ -37443,7 +39578,7 @@ function Search$1(props) {
37443
39578
  tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);
37444
39579
  scrollTo2(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);
37445
39580
  };
37446
- const settings = /* @__PURE__ */ React.createElement(
39581
+ const settings = tableMeta.server._experimentalDataLoader2 ? void 0 : /* @__PURE__ */ React.createElement(
37447
39582
  Switch$1,
37448
39583
  {
37449
39584
  label: texts.table.search.excludeUnmatchedResults,
@@ -42353,6 +44488,9 @@ const Search = React.forwardRef(function ListboxSearch(props, ref) {
42353
44488
  if (event.key === " ") {
42354
44489
  return;
42355
44490
  }
44491
+ if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && event.currentTarget.value.length) {
44492
+ event.stopPropagation();
44493
+ }
42356
44494
  if (isAriaSelectionKey(event) || event.key === "ArrowDown" || event.key === "ArrowUp") {
42357
44495
  event.preventDefault();
42358
44496
  (_a = listboxRef == null ? void 0 : listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
@@ -42616,14 +44754,28 @@ const Select22 = React.forwardRef(function Select222(props, ref) {
42616
44754
  }
42617
44755
  (_a = listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
42618
44756
  };
42619
- const shouldFocusNextRef = React.useRef(false);
44757
+ const shouldFocusNextRef = React.useRef(void 0);
44758
+ React.useEffect(() => {
44759
+ const handleKeyDown2 = (event) => {
44760
+ if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
44761
+ shouldFocusNextRef.current = event.key === "ArrowLeft" ? -1 : 1;
44762
+ setOpen(false);
44763
+ }
44764
+ };
44765
+ if (isElementInsideTable3OrReport(internalRef.current)) {
44766
+ document.addEventListener("keydown", handleKeyDown2);
44767
+ }
44768
+ return () => {
44769
+ document.removeEventListener("keydown", handleKeyDown2);
44770
+ };
44771
+ }, []);
42620
44772
  const handleListboxKeyDown = (event) => {
42621
44773
  if (isAriaDirectionKey(event)) {
42622
44774
  setShouldPauseHoverState(true);
42623
44775
  return;
42624
44776
  }
42625
44777
  if (event.key === "Tab") {
42626
- shouldFocusNextRef.current = true;
44778
+ shouldFocusNextRef.current = event.shiftKey ? -1 : 1;
42627
44779
  setOpen(false);
42628
44780
  return;
42629
44781
  }
@@ -42634,11 +44786,11 @@ const Select22 = React.forwardRef(function Select222(props, ref) {
42634
44786
  };
42635
44787
  const handleCloseAutoFocus = (event) => {
42636
44788
  var _a, _b;
42637
- if (shouldFocusNextRef.current) {
44789
+ if (shouldFocusNextRef.current !== void 0) {
42638
44790
  event.preventDefault();
42639
- shouldFocusNextRef.current = false;
42640
44791
  (_a = otherProps.onBlur) == null ? void 0 : _a.call(otherProps, event);
42641
- (_b = getNextFocussableElement(internalRef.current)) == null ? void 0 : _b.focus();
44792
+ (_b = getNextFocussableElement(internalRef.current, shouldFocusNextRef.current)) == null ? void 0 : _b.focus();
44793
+ shouldFocusNextRef.current = void 0;
42642
44794
  return;
42643
44795
  }
42644
44796
  };
@@ -43039,8 +45191,8 @@ function FilterComparator(props) {
43039
45191
  return /* @__PURE__ */ React.createElement(Select22, { ...attributes, className: "!w-32 flex-shrink-0", disabled: !column, onChange: handleChange, value }, validComparators.map((comparator) => /* @__PURE__ */ React.createElement(Select22.Option, { key: comparator, value: comparator }, getComparatorText(comparator, texts, column))));
43040
45192
  }
43041
45193
  function getComparatorText(comparator, texts, column) {
43042
- var _a, _b;
43043
- const isDate2 = ((_b = (_a = column == null ? void 0 : column.columnDef) == null ? void 0 : _a.meta) == null ? void 0 : _b.control) === "datepicker";
45194
+ var _a, _b, _c;
45195
+ const isDate2 = ((_a = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _a.dataType) === "date" || ((_b = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _b.dataType) === "time" || ((_c = column == null ? void 0 : column.columnDef.meta) == null ? void 0 : _c.dataType) === "datetime";
43044
45196
  switch (comparator) {
43045
45197
  case TableFilterComparator.Contains:
43046
45198
  return texts.table.filters.comparators.contains;
@@ -51664,7 +53816,7 @@ function willRowMove(cell, change, rowIndex, localization) {
51664
53816
  const { table } = cell.getContext();
51665
53817
  if (willRowMoveAfterSearch(cell, change, table, localization)) {
51666
53818
  return "search";
51667
- } else if (willRowMoveAfterFilter(cell, change)) {
53819
+ } else if (willRowMoveAfterFilter(cell, change, localization)) {
51668
53820
  return "filter";
51669
53821
  } else if (willRowMoveAfterSorting(cell, change, rowIndex)) {
51670
53822
  return "sorting";
@@ -51679,11 +53831,17 @@ function willRowMoveAfterSearch(cell, change, table, localization) {
51679
53831
  const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };
51680
53832
  return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);
51681
53833
  }
51682
- function willRowMoveAfterFilter(cell, change) {
53834
+ function willRowMoveAfterFilter(cell, change, localization) {
51683
53835
  if (!cell.column.getIsFiltered()) {
51684
53836
  return false;
51685
53837
  }
51686
- return !columnFilterFn(change, cell.column.getFilterValue());
53838
+ return !columnFilterFn(
53839
+ cell.row.original,
53840
+ change,
53841
+ cell.column.columnDef.meta,
53842
+ cell.column.getFilterValue(),
53843
+ localization
53844
+ );
51687
53845
  }
51688
53846
  function willRowMoveAfterSorting(cell, change, rowIndex) {
51689
53847
  var _a;
@@ -51979,8 +54137,8 @@ function requireIsBuffer() {
51979
54137
  var freeExports = exports2 && !exports2.nodeType && exports2;
51980
54138
  var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
51981
54139
  var moduleExports = freeModule && freeModule.exports === freeExports;
51982
- var Buffer = moduleExports ? root.Buffer : void 0;
51983
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
54140
+ var Buffer2 = moduleExports ? root.Buffer : void 0;
54141
+ var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
51984
54142
  var isBuffer2 = nativeIsBuffer || stubFalse;
51985
54143
  module2.exports = isBuffer2;
51986
54144
  })(isBuffer, isBuffer.exports);
@@ -52259,7 +54417,7 @@ function require_cloneBuffer() {
52259
54417
  var freeExports = exports2 && !exports2.nodeType && exports2;
52260
54418
  var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
52261
54419
  var moduleExports = freeModule && freeModule.exports === freeExports;
52262
- var Buffer = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
54420
+ var Buffer2 = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
52263
54421
  function cloneBuffer(buffer, isDeep) {
52264
54422
  if (isDeep) {
52265
54423
  return buffer.slice();
@@ -53110,17 +55268,18 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
53110
55268
  async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
53111
55269
  var _a;
53112
55270
  const changes = nextValue !== void 0 ? { ...state.changes.rows[cell.row.id], [cell.column.id]: nextValue } : { ...state.changes.rows[cell.row.id] };
55271
+ const original = cell.row.original;
53113
55272
  if (!Object.keys(changes).length) {
53114
55273
  return;
53115
55274
  }
53116
55275
  let updatesForOtherCells = {};
53117
55276
  if (typeof handleChange === "function" && shouldRunUpdaters) {
53118
55277
  const previousRowValue = {
53119
- ...state.changes.originals[cell.row.id]
55278
+ ...original
53120
55279
  //...getRowChangeset(updatersRef.current[cell.row.id], rowIdentityAccessor),
53121
55280
  };
53122
55281
  const nextRowValue = {
53123
- ...state.changes.originals[cell.row.id],
55282
+ ...original,
53124
55283
  ...changes
53125
55284
  };
53126
55285
  updatesForOtherCells = await handleChange(
@@ -53134,8 +55293,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
53134
55293
  const nextMoveReasons = { ...state.changes.moveReasons[cell.row.id] };
53135
55294
  const nextCellErrors = { ...(_a = state.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
53136
55295
  let validationErrors = {};
53137
- if (validator && Object.keys(nextChanges).length && state.changes.originals[cell.row.id]) {
53138
- const nextRowValue = { ...state.changes.originals[cell.row.id], ...changes, ...updatesForOtherCells };
55296
+ if (validator && Object.keys(nextChanges).length && original) {
55297
+ const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
53139
55298
  validationErrors = await validator(nextRowValue) ?? {};
53140
55299
  }
53141
55300
  const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
@@ -53164,7 +55323,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
53164
55323
  cellErrors: nextCellErrors,
53165
55324
  index: rowIndex,
53166
55325
  moveReasons: nextMoveReasons,
53167
- value: nextChanges
55326
+ value: nextChanges,
55327
+ original
53168
55328
  }
53169
55329
  });
53170
55330
  }
@@ -53574,6 +55734,7 @@ function EditingControlCell(props) {
53574
55734
  const type = columnMeta.control ?? "input";
53575
55735
  const handleFocus = useEditingCellAutofocus(props);
53576
55736
  const value = cell.getValue();
55737
+ const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
53577
55738
  const hasNonTextControl = React.useMemo(() => {
53578
55739
  var _a;
53579
55740
  return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
@@ -53589,35 +55750,22 @@ function EditingControlCell(props) {
53589
55750
  },
53590
55751
  [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]
53591
55752
  );
53592
- const blur = React.useCallback(
53593
- function blur2() {
53594
- requestAnimationFrame(() => {
53595
- tableMeta.editing.toggleDetailedMode(false);
53596
- tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
53597
- });
53598
- },
53599
- [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex]
53600
- );
53601
55753
  const handleBlur = React.useCallback(
53602
55754
  (event) => {
53603
55755
  if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
53604
55756
  return;
53605
55757
  }
53606
- blur();
55758
+ requestAnimationFrame(() => {
55759
+ tableMeta.editing.toggleDetailedMode(false);
55760
+ tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
55761
+ });
53607
55762
  },
53608
- [blur]
55763
+ [hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
53609
55764
  );
53610
- React.useEffect(() => {
53611
- const ref = cellRef.current;
53612
- return () => {
53613
- if (document.activeElement === ref || isElementInsideOrTriggeredFromContainer(document.activeElement, ref)) {
53614
- blur();
53615
- }
53616
- };
53617
- }, []);
53618
55765
  const error = tableMeta.editing.getCellError(cell);
53619
55766
  const controlProps = {
53620
55767
  dataType: columnMeta.dataType,
55768
+ disabled: tableMeta.editing.getRowStatus(cell.row.id) === "saving",
53621
55769
  fontSize: tableMeta.fontSize.size,
53622
55770
  id: cell.column.id,
53623
55771
  invalid: !!error,
@@ -53645,6 +55793,7 @@ function EditingControlCell(props) {
53645
55793
  const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
53646
55794
  const {
53647
55795
  dataType,
55796
+ disabled,
53648
55797
  fontSize,
53649
55798
  id: id2,
53650
55799
  invalid,
@@ -53662,6 +55811,7 @@ const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
53662
55811
  const controlRef = React.useRef(null);
53663
55812
  const currentValue = row[id2];
53664
55813
  const commonProps = {
55814
+ disabled,
53665
55815
  onBlur,
53666
55816
  ref: controlRef,
53667
55817
  tabIndex
@@ -53839,6 +55989,22 @@ function Cell$1(props) {
53839
55989
  }
53840
55990
  return /* @__PURE__ */ React.createElement(DisplayCell, { ...props });
53841
55991
  }
55992
+ function SaveStatus(props) {
55993
+ const { rowId, table } = props;
55994
+ const { texts } = useLocalization();
55995
+ const tableMeta = table.options.meta;
55996
+ const status = tableMeta.editing.getRowStatus(rowId);
55997
+ const className = clsx(
55998
+ "col-span-full sticky ml-auto right-0 top-0 -mb-[100%] z-10 h-8 bg-[inherit] flex items-center px-1.5 shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]",
55999
+ {
56000
+ "mt-0.5": tableMeta.rowHeight.height === "short",
56001
+ "mt-1": tableMeta.rowHeight.height === "medium",
56002
+ "mt-1.5": tableMeta.rowHeight.height === "tall",
56003
+ "mt-2": tableMeta.rowHeight.height === "extra-tall"
56004
+ }
56005
+ );
56006
+ return /* @__PURE__ */ React.createElement("td", { className: "!contents" }, /* @__PURE__ */ React.createElement("span", { className }, status === "saving" ? /* @__PURE__ */ React.createElement(Tooltip$3, { title: texts.table3.editing.saving.progress }, /* @__PURE__ */ React.createElement(Spinner, { delay: 0, className: "mr-1 !h-5 !w-5" })) : /* @__PURE__ */ React.createElement(Tooltip$3, { title: texts.table3.editing.saving.complete }, /* @__PURE__ */ React.createElement(BadgeIcon, { icon: "tick", color: "green", subtle: true, className: "mr-1" }))));
56007
+ }
53842
56008
  function DiscardChangesConfirmationDialog(props) {
53843
56009
  const { onDiscard: handleDiscard, ...dialogProps } = props;
53844
56010
  const { texts } = useLocalization();
@@ -53862,54 +56028,6 @@ function DiscardChangesConfirmationDialog(props) {
53862
56028
  /* @__PURE__ */ React.createElement(Dialog.Footer, null, /* @__PURE__ */ React.createElement(Group$6, null, /* @__PURE__ */ React.createElement(Dialog.Close, null, /* @__PURE__ */ React.createElement(Button$4, { tabIndex: 0 }, texts.table3.editing.clearChangesConfirmationDialog.cancel)), /* @__PURE__ */ React.createElement(Dialog.Close, null, /* @__PURE__ */ React.createElement(Button$4, { tabIndex: 0, appearance: "primary", onClick: handleDiscard }, texts.table3.editing.clearChangesConfirmationDialog.confirm))))
53863
56029
  ));
53864
56030
  }
53865
- function EditingActionsMenu(props) {
53866
- const { hasChanges, hasErrors, onDiscard: handleDiscard, onEditingSave: handleSave, isLastRow } = props;
53867
- const { texts } = useLocalization();
53868
- const handleKeyDown = (event) => {
53869
- if (isLastRow && hasChanges && event.key === "Tab") {
53870
- handleSave();
53871
- }
53872
- };
53873
- const handleMenuContentKeyDown = (event) => {
53874
- if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
53875
- event.stopPropagation();
53876
- }
53877
- };
53878
- return /* @__PURE__ */ React.createElement(
53879
- IconButton,
53880
- {
53881
- appearance: "transparent",
53882
- "aria-label": texts.table3.editing.actions.tooltip,
53883
- icon: "more",
53884
- onKeyDown: handleKeyDown,
53885
- menu: (menuProps) => /* @__PURE__ */ React.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React.createElement(Menu$1.Content, { onKeyDown: handleMenuContentKeyDown }, /* @__PURE__ */ React.createElement(Menu$1.Item, { icon: "tick", disabled: !hasChanges || hasErrors, onClick: handleSave }, texts.table3.editing.actions.save), /* @__PURE__ */ React.createElement(
53886
- Menu$1.Item,
53887
- {
53888
- icon: "close",
53889
- disabled: !hasChanges,
53890
- dialog: (props2) => /* @__PURE__ */ React.createElement(DiscardChangesConfirmationDialog, { ...props2, onDiscard: handleDiscard })
53891
- },
53892
- texts.table3.editing.actions.clear
53893
- )))
53894
- }
53895
- );
53896
- }
53897
- function SaveStatus(props) {
53898
- const { rowId, table } = props;
53899
- const { texts } = useLocalization();
53900
- const tableMeta = table.options.meta;
53901
- const status = tableMeta.editing.getRowStatus(rowId);
53902
- const className = clsx(
53903
- "col-span-full sticky ml-auto right-0 top-0 -mb-[100%] z-10 h-8 bg-[inherit] flex items-center px-1.5 shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]",
53904
- {
53905
- "mt-0.5": tableMeta.rowHeight.height === "short",
53906
- "mt-1": tableMeta.rowHeight.height === "medium",
53907
- "mt-1.5": tableMeta.rowHeight.height === "tall",
53908
- "mt-2": tableMeta.rowHeight.height === "extra-tall"
53909
- }
53910
- );
53911
- return /* @__PURE__ */ React.createElement("td", { className: "!contents" }, /* @__PURE__ */ React.createElement("span", { className }, status === "saving" ? /* @__PURE__ */ React.createElement(Tooltip$3, { title: texts.table3.editing.saving.progress }, /* @__PURE__ */ React.createElement(Spinner, { delay: 0, className: "mr-1 !h-5 !w-5" })) : /* @__PURE__ */ React.createElement(Tooltip$3, { title: texts.table3.editing.saving.complete }, /* @__PURE__ */ React.createElement(BadgeIcon, { icon: "tick", color: "green", subtle: true, className: "mr-1" }))));
53912
- }
53913
56031
  function Row(props) {
53914
56032
  const { row, index: index2, table } = props;
53915
56033
  const focusManager = useAugmentedFocusManager();
@@ -53980,6 +56098,7 @@ const RENDERERS = {
53980
56098
  cell: Cell$1
53981
56099
  };
53982
56100
  function useTable3(props, ref) {
56101
+ const { texts } = useLocalization();
53983
56102
  const editing = useTableEditing(
53984
56103
  props.enableEditing,
53985
56104
  props.onEditingSave,
@@ -53989,7 +56108,6 @@ function useTable3(props, ref) {
53989
56108
  props.rowIdentityAccessor,
53990
56109
  props.validator
53991
56110
  );
53992
- const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
53993
56111
  const data = React.useMemo(() => {
53994
56112
  if (editing.temporaryRows.length) {
53995
56113
  return (props.data ?? []).concat(editing.temporaryRows);
@@ -54001,31 +56119,42 @@ function useTable3(props, ref) {
54001
56119
  data,
54002
56120
  enableRowActions: editing.isEditing ? true : props.enableRowActions,
54003
56121
  // Display EditingActionMenu instead of row actions while editing
54004
- rowActions: editing.isEditing ? [
54005
- (_, rowId, __, table2) => {
54006
- const tableMeta = table2.options.meta;
54007
- return /* @__PURE__ */ React.createElement(
54008
- EditingActionsMenu,
54009
- {
54010
- hasChanges: editing.hasChanges(rowId),
54011
- hasErrors: editing.hasRowErrors(rowId),
54012
- onDiscard: () => {
54013
- editing.discardChanges(rowId, table2);
54014
- if (editing.temporaryRows.length) {
54015
- requestAnimationFrame(() => {
54016
- var _a;
54017
- return (_a = editing.createRowButtonRef.current) == null ? void 0 : _a.focus();
54018
- });
54019
- }
54020
- },
54021
- onEditingSave: async () => {
54022
- await editing.saveChanges(table2, rowId);
54023
- },
54024
- isLastRow: !creationEnabled && tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1
56122
+ rowActions: editing.isEditing ? (props.rowActions ?? []).concat([
56123
+ (_1, helpers) => /* @__PURE__ */ React.createElement(
56124
+ IconButton,
56125
+ {
56126
+ "aria-label": texts.table3.editing.actions.save,
56127
+ icon: "tick",
56128
+ disabled: !editing.hasChanges(helpers.rowId) || editing.hasRowErrors(helpers.rowId),
56129
+ onClick: async () => {
56130
+ await editing.saveChanges(helpers.table, helpers.rowId);
54025
56131
  }
54026
- );
54027
- }
54028
- ] : props.rowActions
56132
+ }
56133
+ ),
56134
+ (_1, helpers) => /* @__PURE__ */ React.createElement(
56135
+ IconButton,
56136
+ {
56137
+ "aria-label": texts.table3.editing.actions.clear,
56138
+ icon: "close",
56139
+ disabled: !editing.hasChanges(helpers.rowId),
56140
+ dialog: (props2) => /* @__PURE__ */ React.createElement(
56141
+ DiscardChangesConfirmationDialog,
56142
+ {
56143
+ ...props2,
56144
+ onDiscard: () => {
56145
+ editing.discardChanges(helpers.rowId, helpers.table);
56146
+ if (editing.temporaryRows.length) {
56147
+ requestAnimationFrame(() => {
56148
+ var _a;
56149
+ return (_a = editing.createRowButtonRef.current) == null ? void 0 : _a.focus();
56150
+ });
56151
+ }
56152
+ }
56153
+ }
56154
+ )
56155
+ }
56156
+ )
56157
+ ]) : props.rowActions
54029
56158
  };
54030
56159
  const meta = { editing };
54031
56160
  const options = {
@@ -54171,16 +56300,15 @@ function CreateNewRow(props) {
54171
56300
  } else {
54172
56301
  tooltip = /* @__PURE__ */ React.createElement(Shortcut, { keys: shortcut2 });
54173
56302
  }
54174
- const className = clsx("group/row border-grey-300 !sticky z-[21]", {
56303
+ const className = clsx("group/row !sticky z-[21]", {
54175
56304
  "bottom-10": tableMeta.footer.isEnabled,
54176
- "bottom-0": !tableMeta.footer.isEnabled,
54177
- "border-b": !isScrolled
56305
+ "bottom-0": !tableMeta.footer.isEnabled
54178
56306
  });
54179
- return /* @__PURE__ */ React.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React.createElement("td", { className: "!bg-grey-50 col-span-full !border-b-0 !px-1" }, /* @__PURE__ */ React.createElement(
56307
+ return /* @__PURE__ */ React.createElement("tr", { "data-row-create": true, className, tabIndex: -1 }, /* @__PURE__ */ React.createElement("td", { className: "!bg-grey-50 col-span-full !px-1" }, /* @__PURE__ */ React.createElement(
54180
56308
  Button$4,
54181
56309
  {
54182
56310
  appearance: "transparent",
54183
- className: "group-hover:bg-grey-200 sticky left-[4px]",
56311
+ className: "group-hover:bg-grey-200 sticky left-[4px] font-bold",
54184
56312
  disabled: isDisabled,
54185
56313
  onClick: handleCreate,
54186
56314
  ref: buttonRef,
@@ -54191,13 +56319,20 @@ function CreateNewRow(props) {
54191
56319
  texts.table3.editing.buttons.create.label
54192
56320
  )));
54193
56321
  }
56322
+ function TemporaryRows(props) {
56323
+ return props.table.getBottomRows().map((row) => /* @__PURE__ */ React.createElement(TemporaryRow, { key: row.id, row, ...props }));
56324
+ }
54194
56325
  function TemporaryRow(props) {
54195
- const { createRowButtonRef, isScrolled, table, tableMeta, tableRef } = props;
56326
+ const { createRowButtonRef, row, table, tableMeta, tableRef } = props;
54196
56327
  const handleKeyDown = async (event) => {
54197
- var _a, _b;
56328
+ var _a;
56329
+ const target = event.target;
56330
+ if (isAriaDirectionKey(event) && isElementInsideExternalRelatedOverlay(target, tableRef)) {
56331
+ return;
56332
+ }
54198
56333
  if (event.key === "ArrowDown") {
54199
56334
  event.preventDefault();
54200
- if (!isElementTriggeredFromContainer(event.target, event.currentTarget)) {
56335
+ if (!isElementTriggeredFromContainer(target, event.currentTarget)) {
54201
56336
  const saved = await tableMeta.editing.saveChanges(table);
54202
56337
  if (saved) {
54203
56338
  (_a = createRowButtonRef.current) == null ? void 0 : _a.focus();
@@ -54206,28 +56341,15 @@ function TemporaryRow(props) {
54206
56341
  } else if (event.key === "ArrowUp") {
54207
56342
  event.preventDefault();
54208
56343
  event.stopPropagation();
56344
+ const lastIndex = tableMeta.length - 1;
56345
+ tableMeta.rowActive.setRowActiveIndex(lastIndex);
54209
56346
  if (tableRef.current) {
54210
- const availableRows = Array.from(
54211
- tableRef.current.querySelectorAll(`tbody tr:not([data-row-id^='${TEMPORARY_ROW_ID_PREFIX}'])`) ?? []
54212
- );
54213
- const footerHeight = ((_b = tableRef.current.querySelector("tfoot")) == null ? void 0 : _b.getBoundingClientRect().height) ?? 0;
54214
- const newRowHeight = event.currentTarget.getBoundingClientRect().height;
54215
- const visibleHeight = tableRef.current.clientHeight - footerHeight - newRowHeight;
54216
- const tableTopOffset = tableRef.current.getBoundingClientRect().top;
54217
- let nextRowIndex;
54218
- for (let index2 = availableRows.length - 1; index2 >= 0; index2--) {
54219
- const rowRect = availableRows[index2].getBoundingClientRect();
54220
- const topPlusHalfRow = rowRect.top + rowRect.height / 2;
54221
- if (topPlusHalfRow - tableTopOffset <= visibleHeight) {
54222
- nextRowIndex = index2;
54223
- break;
56347
+ tableRef.current.scrollTop = tableRef.current.scrollHeight;
56348
+ requestAnimationFrame(() => {
56349
+ if (tableRef.current) {
56350
+ tableRef.current.scrollTop = tableRef.current.scrollHeight;
54224
56351
  }
54225
- }
54226
- if (nextRowIndex) {
54227
- tableMeta.rowActive.setRowActiveIndex(
54228
- Number(availableRows[nextRowIndex < 0 ? 0 : nextRowIndex].getAttribute("data-row-index"))
54229
- );
54230
- }
56352
+ });
54231
56353
  }
54232
56354
  }
54233
56355
  };
@@ -54242,12 +56364,11 @@ function TemporaryRow(props) {
54242
56364
  }
54243
56365
  }
54244
56366
  };
54245
- const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden", {
54246
- "bottom-[calc(5rem_+_2px)] data-[row-editing-move]:bottom-[calc(5rem_+_2px)]": tableMeta.footer.isEnabled,
54247
- "bottom-[calc(2.5rem_+_2px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_2px)]": !tableMeta.footer.isEnabled,
54248
- "border-t-2 shadow-[0px_-5px_20px_0px_rgba(0,0,0,0.1)] [&>td]:!border-b-0": isScrolled
56367
+ const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden border-t-2", {
56368
+ "bottom-[calc(5rem_+_5px)] data-[row-editing-move]:bottom-[calc(5rem_+_5px)]": tableMeta.footer.isEnabled,
56369
+ "bottom-[calc(2.5rem_+_5px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_5px)]": !tableMeta.footer.isEnabled
54249
56370
  });
54250
- return /* @__PURE__ */ React.createElement(React.Fragment, null, table.getBottomRows().map((row) => /* @__PURE__ */ React.createElement(
56371
+ return /* @__PURE__ */ React.createElement(
54251
56372
  Row$2,
54252
56373
  {
54253
56374
  key: row.id,
@@ -54264,7 +56385,7 @@ function TemporaryRow(props) {
54264
56385
  hideRowActions: !tableMeta.editing.isEditing,
54265
56386
  skipPageLoading: true
54266
56387
  }
54267
- )));
56388
+ );
54268
56389
  }
54269
56390
  const Column = () => null;
54270
56391
  Column.displayName = "Table3Column";
@@ -54317,10 +56438,9 @@ const BaseTable3 = fixedForwardRef(function BaseTable32(props, ref) {
54317
56438
  table: table3
54318
56439
  },
54319
56440
  hasCreateWorkflow ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
54320
- TemporaryRow,
56441
+ TemporaryRows,
54321
56442
  {
54322
56443
  createRowButtonRef: table3.meta.editing.createRowButtonRef,
54323
- isScrolled,
54324
56444
  table: table3.instance,
54325
56445
  tableMeta: table3.meta,
54326
56446
  tableRef: table3.ref
@@ -59148,9 +61268,9 @@ _defineProperty$J(ReactFloater, "propTypes", { autoOpen: PropTypes.bool, callbac
59148
61268
  return !props.component;
59149
61269
  }), debug: PropTypes.bool, disableAnimation: PropTypes.bool, disableFlip: PropTypes.bool, disableHoverToClick: PropTypes.bool, event: PropTypes.oneOf(["hover", "click"]), eventDelay: PropTypes.number, footer: PropTypes.node, getPopper: PropTypes.func, hideArrow: PropTypes.bool, id: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), offset: PropTypes.number, open: PropTypes.bool, options: PropTypes.object, placement: PropTypes.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto", "center"]), showCloseButton: PropTypes.bool, style: PropTypes.object, styles: PropTypes.object, target: PropTypes.oneOfType([PropTypes.object, PropTypes.string]), title: PropTypes.node, wrapperOptions: PropTypes.shape({ offset: PropTypes.number, placement: PropTypes.oneOf(["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end", "auto"]), position: PropTypes.bool }) });
59150
61270
  _defineProperty$J(ReactFloater, "defaultProps", { autoOpen: false, callback: noop$2, debug: false, disableAnimation: false, disableFlip: false, disableHoverToClick: false, event: "click", eventDelay: 0.4, getPopper: noop$2, hideArrow: false, offset: 15, placement: "bottom", showCloseButton: false, styles: {}, target: null, wrapperOptions: { position: false } });
59151
- var __defProp = Object.defineProperty;
59152
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
59153
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
61271
+ var __defProp2 = Object.defineProperty;
61272
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
61273
+ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
59154
61274
  var ACTIONS = {
59155
61275
  INIT: "init",
59156
61276
  START: "start",
@@ -59853,15 +61973,15 @@ var defaultState = {
59853
61973
  var validKeys = objectKeys(omit(defaultState, "controlled", "size"));
59854
61974
  var Store = class {
59855
61975
  constructor(options) {
59856
- __publicField(this, "beaconPopper");
59857
- __publicField(this, "tooltipPopper");
59858
- __publicField(this, "data", /* @__PURE__ */ new Map());
59859
- __publicField(this, "listener");
59860
- __publicField(this, "store", /* @__PURE__ */ new Map());
59861
- __publicField(this, "addListener", (listener) => {
61976
+ __publicField2(this, "beaconPopper");
61977
+ __publicField2(this, "tooltipPopper");
61978
+ __publicField2(this, "data", /* @__PURE__ */ new Map());
61979
+ __publicField2(this, "listener");
61980
+ __publicField2(this, "store", /* @__PURE__ */ new Map());
61981
+ __publicField2(this, "addListener", (listener) => {
59862
61982
  this.listener = listener;
59863
61983
  });
59864
- __publicField(this, "setSteps", (steps3) => {
61984
+ __publicField2(this, "setSteps", (steps3) => {
59865
61985
  const { size: size2, status } = this.getState();
59866
61986
  const state = {
59867
61987
  size: steps3.length,
@@ -59873,24 +61993,24 @@ var Store = class {
59873
61993
  }
59874
61994
  this.setState(state);
59875
61995
  });
59876
- __publicField(this, "getPopper", (name) => {
61996
+ __publicField2(this, "getPopper", (name) => {
59877
61997
  if (name === "beacon") {
59878
61998
  return this.beaconPopper;
59879
61999
  }
59880
62000
  return this.tooltipPopper;
59881
62001
  });
59882
- __publicField(this, "setPopper", (name, popper) => {
62002
+ __publicField2(this, "setPopper", (name, popper) => {
59883
62003
  if (name === "beacon") {
59884
62004
  this.beaconPopper = popper;
59885
62005
  } else {
59886
62006
  this.tooltipPopper = popper;
59887
62007
  }
59888
62008
  });
59889
- __publicField(this, "cleanupPoppers", () => {
62009
+ __publicField2(this, "cleanupPoppers", () => {
59890
62010
  this.beaconPopper = null;
59891
62011
  this.tooltipPopper = null;
59892
62012
  });
59893
- __publicField(this, "close", (origin = null) => {
62013
+ __publicField2(this, "close", (origin = null) => {
59894
62014
  const { index: index2, status } = this.getState();
59895
62015
  if (status !== STATUS.RUNNING) {
59896
62016
  return;
@@ -59899,7 +62019,7 @@ var Store = class {
59899
62019
  ...this.getNextState({ action: ACTIONS.CLOSE, index: index2 + 1, origin })
59900
62020
  });
59901
62021
  });
59902
- __publicField(this, "go", (nextIndex) => {
62022
+ __publicField2(this, "go", (nextIndex) => {
59903
62023
  const { controlled, status } = this.getState();
59904
62024
  if (controlled || status !== STATUS.RUNNING) {
59905
62025
  return;
@@ -59910,15 +62030,15 @@ var Store = class {
59910
62030
  status: step ? status : STATUS.FINISHED
59911
62031
  });
59912
62032
  });
59913
- __publicField(this, "info", () => this.getState());
59914
- __publicField(this, "next", () => {
62033
+ __publicField2(this, "info", () => this.getState());
62034
+ __publicField2(this, "next", () => {
59915
62035
  const { index: index2, status } = this.getState();
59916
62036
  if (status !== STATUS.RUNNING) {
59917
62037
  return;
59918
62038
  }
59919
62039
  this.setState(this.getNextState({ action: ACTIONS.NEXT, index: index2 + 1 }));
59920
62040
  });
59921
- __publicField(this, "open", () => {
62041
+ __publicField2(this, "open", () => {
59922
62042
  const { status } = this.getState();
59923
62043
  if (status !== STATUS.RUNNING) {
59924
62044
  return;
@@ -59927,7 +62047,7 @@ var Store = class {
59927
62047
  ...this.getNextState({ action: ACTIONS.UPDATE, lifecycle: LIFECYCLE.TOOLTIP })
59928
62048
  });
59929
62049
  });
59930
- __publicField(this, "prev", () => {
62050
+ __publicField2(this, "prev", () => {
59931
62051
  const { index: index2, status } = this.getState();
59932
62052
  if (status !== STATUS.RUNNING) {
59933
62053
  return;
@@ -59936,7 +62056,7 @@ var Store = class {
59936
62056
  ...this.getNextState({ action: ACTIONS.PREV, index: index2 - 1 })
59937
62057
  });
59938
62058
  });
59939
- __publicField(this, "reset", (restart = false) => {
62059
+ __publicField2(this, "reset", (restart = false) => {
59940
62060
  const { controlled } = this.getState();
59941
62061
  if (controlled) {
59942
62062
  return;
@@ -59946,7 +62066,7 @@ var Store = class {
59946
62066
  status: restart ? STATUS.RUNNING : STATUS.READY
59947
62067
  });
59948
62068
  });
59949
- __publicField(this, "skip", () => {
62069
+ __publicField2(this, "skip", () => {
59950
62070
  const { status } = this.getState();
59951
62071
  if (status !== STATUS.RUNNING) {
59952
62072
  return;
@@ -59957,7 +62077,7 @@ var Store = class {
59957
62077
  status: STATUS.SKIPPED
59958
62078
  });
59959
62079
  });
59960
- __publicField(this, "start", (nextIndex) => {
62080
+ __publicField2(this, "start", (nextIndex) => {
59961
62081
  const { index: index2, size: size2 } = this.getState();
59962
62082
  this.setState({
59963
62083
  ...this.getNextState(
@@ -59970,7 +62090,7 @@ var Store = class {
59970
62090
  status: size2 ? STATUS.RUNNING : STATUS.WAITING
59971
62091
  });
59972
62092
  });
59973
- __publicField(this, "stop", (advance = false) => {
62093
+ __publicField2(this, "stop", (advance = false) => {
59974
62094
  const { index: index2, status } = this.getState();
59975
62095
  if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {
59976
62096
  return;
@@ -59980,7 +62100,7 @@ var Store = class {
59980
62100
  status: STATUS.PAUSED
59981
62101
  });
59982
62102
  });
59983
- __publicField(this, "update", (state) => {
62103
+ __publicField2(this, "update", (state) => {
59984
62104
  var _a, _b;
59985
62105
  if (!hasValidKeys(state, validKeys)) {
59986
62106
  throw new Error(`State is not valid. Valid keys: ${validKeys.join(", ")}`);
@@ -60111,16 +62231,16 @@ var Spotlight_default = JoyrideSpotlight;
60111
62231
  var JoyrideOverlay = class extends React__namespace.Component {
60112
62232
  constructor() {
60113
62233
  super(...arguments);
60114
- __publicField(this, "isActive", false);
60115
- __publicField(this, "resizeTimeout");
60116
- __publicField(this, "scrollTimeout");
60117
- __publicField(this, "scrollParent");
60118
- __publicField(this, "state", {
62234
+ __publicField2(this, "isActive", false);
62235
+ __publicField2(this, "resizeTimeout");
62236
+ __publicField2(this, "scrollTimeout");
62237
+ __publicField2(this, "scrollParent");
62238
+ __publicField2(this, "state", {
60119
62239
  isScrolling: false,
60120
62240
  mouseOverSpotlight: false,
60121
62241
  showSpotlight: true
60122
62242
  });
60123
- __publicField(this, "hideSpotlight", () => {
62243
+ __publicField2(this, "hideSpotlight", () => {
60124
62244
  const { continuous: continuous2, disableOverlay, lifecycle } = this.props;
60125
62245
  const hiddenLifecycles = [
60126
62246
  LIFECYCLE.INIT,
@@ -60130,7 +62250,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
60130
62250
  ];
60131
62251
  return disableOverlay || (continuous2 ? hiddenLifecycles.includes(lifecycle) : lifecycle !== LIFECYCLE.TOOLTIP);
60132
62252
  });
60133
- __publicField(this, "handleMouseMove", (event) => {
62253
+ __publicField2(this, "handleMouseMove", (event) => {
60134
62254
  const { mouseOverSpotlight } = this.state;
60135
62255
  const { height, left, position, top, width } = this.spotlightStyles;
60136
62256
  const offsetY = position === "fixed" ? event.clientY : event.pageY;
@@ -60142,7 +62262,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
60142
62262
  this.updateState({ mouseOverSpotlight: inSpotlight });
60143
62263
  }
60144
62264
  });
60145
- __publicField(this, "handleScroll", () => {
62265
+ __publicField2(this, "handleScroll", () => {
60146
62266
  const { target } = this.props;
60147
62267
  const element = getElement(target);
60148
62268
  if (this.scrollParent !== document) {
@@ -60158,7 +62278,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
60158
62278
  this.updateState({});
60159
62279
  }
60160
62280
  });
60161
- __publicField(this, "handleResize", () => {
62281
+ __publicField2(this, "handleResize", () => {
60162
62282
  clearTimeout(this.resizeTimeout);
60163
62283
  this.resizeTimeout = window.setTimeout(() => {
60164
62284
  if (!this.isActive) {
@@ -60293,7 +62413,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
60293
62413
  var JoyridePortal = class extends React__namespace.Component {
60294
62414
  constructor() {
60295
62415
  super(...arguments);
60296
- __publicField(this, "node", null);
62416
+ __publicField2(this, "node", null);
60297
62417
  }
60298
62418
  componentDidMount() {
60299
62419
  const { id: id2 } = this.props;
@@ -60355,29 +62475,29 @@ var JoyridePortal = class extends React__namespace.Component {
60355
62475
  };
60356
62476
  var Scope = class {
60357
62477
  constructor(element, options) {
60358
- __publicField(this, "element");
60359
- __publicField(this, "options");
60360
- __publicField(this, "canBeTabbed", (element2) => {
62478
+ __publicField2(this, "element");
62479
+ __publicField2(this, "options");
62480
+ __publicField2(this, "canBeTabbed", (element2) => {
60361
62481
  const { tabIndex } = element2;
60362
62482
  if (tabIndex === null || tabIndex < 0) {
60363
62483
  return false;
60364
62484
  }
60365
62485
  return this.canHaveFocus(element2);
60366
62486
  });
60367
- __publicField(this, "canHaveFocus", (element2) => {
62487
+ __publicField2(this, "canHaveFocus", (element2) => {
60368
62488
  const validTabNodes = /input|select|textarea|button|object/;
60369
62489
  const nodeName = element2.nodeName.toLowerCase();
60370
62490
  const isValid2 = validTabNodes.test(nodeName) && !element2.getAttribute("disabled") || nodeName === "a" && !!element2.getAttribute("href");
60371
62491
  return isValid2 && this.isVisible(element2);
60372
62492
  });
60373
- __publicField(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed));
60374
- __publicField(this, "handleKeyDown", (event) => {
62493
+ __publicField2(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed));
62494
+ __publicField2(this, "handleKeyDown", (event) => {
60375
62495
  const { code = "Tab" } = this.options;
60376
62496
  if (event.code === code) {
60377
62497
  this.interceptTab(event);
60378
62498
  }
60379
62499
  });
60380
- __publicField(this, "interceptTab", (event) => {
62500
+ __publicField2(this, "interceptTab", (event) => {
60381
62501
  event.preventDefault();
60382
62502
  const elements = this.findValidTabElements();
60383
62503
  const { shiftKey } = event;
@@ -60394,7 +62514,7 @@ var Scope = class {
60394
62514
  }
60395
62515
  elements[x2].focus();
60396
62516
  });
60397
- __publicField(this, "isHidden", (element2) => {
62517
+ __publicField2(this, "isHidden", (element2) => {
60398
62518
  const noSize = element2.offsetWidth <= 0 && element2.offsetHeight <= 0;
60399
62519
  const style = window.getComputedStyle(element2);
60400
62520
  if (noSize && !element2.innerHTML) {
@@ -60402,7 +62522,7 @@ var Scope = class {
60402
62522
  }
60403
62523
  return noSize && style.getPropertyValue("overflow") !== "visible" || style.getPropertyValue("display") === "none";
60404
62524
  });
60405
- __publicField(this, "isVisible", (element2) => {
62525
+ __publicField2(this, "isVisible", (element2) => {
60406
62526
  let parentElement = element2;
60407
62527
  while (parentElement) {
60408
62528
  if (parentElement instanceof HTMLElement) {
@@ -60417,16 +62537,16 @@ var Scope = class {
60417
62537
  }
60418
62538
  return true;
60419
62539
  });
60420
- __publicField(this, "removeScope", () => {
62540
+ __publicField2(this, "removeScope", () => {
60421
62541
  window.removeEventListener("keydown", this.handleKeyDown);
60422
62542
  });
60423
- __publicField(this, "checkFocus", (target) => {
62543
+ __publicField2(this, "checkFocus", (target) => {
60424
62544
  if (document.activeElement !== target) {
60425
62545
  target.focus();
60426
62546
  window.requestAnimationFrame(() => this.checkFocus(target));
60427
62547
  }
60428
62548
  });
60429
- __publicField(this, "setFocus", () => {
62549
+ __publicField2(this, "setFocus", () => {
60430
62550
  const { selector } = this.options;
60431
62551
  if (!selector) {
60432
62552
  return;
@@ -60448,8 +62568,8 @@ var Scope = class {
60448
62568
  var JoyrideBeacon = class extends React__namespace.Component {
60449
62569
  constructor(props) {
60450
62570
  super(props);
60451
- __publicField(this, "beacon", null);
60452
- __publicField(this, "setBeaconRef", (c2) => {
62571
+ __publicField2(this, "beacon", null);
62572
+ __publicField2(this, "setBeaconRef", (c2) => {
60453
62573
  this.beacon = c2;
60454
62574
  });
60455
62575
  if (props.beaconComponent) {
@@ -60631,17 +62751,17 @@ var Container_default = JoyrideTooltipContainer;
60631
62751
  var JoyrideTooltip = class extends React__namespace.Component {
60632
62752
  constructor() {
60633
62753
  super(...arguments);
60634
- __publicField(this, "handleClickBack", (event) => {
62754
+ __publicField2(this, "handleClickBack", (event) => {
60635
62755
  event.preventDefault();
60636
62756
  const { helpers } = this.props;
60637
62757
  helpers.prev();
60638
62758
  });
60639
- __publicField(this, "handleClickClose", (event) => {
62759
+ __publicField2(this, "handleClickClose", (event) => {
60640
62760
  event.preventDefault();
60641
62761
  const { helpers } = this.props;
60642
62762
  helpers.close("button_close");
60643
62763
  });
60644
- __publicField(this, "handleClickPrimary", (event) => {
62764
+ __publicField2(this, "handleClickPrimary", (event) => {
60645
62765
  event.preventDefault();
60646
62766
  const { continuous: continuous2, helpers } = this.props;
60647
62767
  if (!continuous2) {
@@ -60650,12 +62770,12 @@ var JoyrideTooltip = class extends React__namespace.Component {
60650
62770
  }
60651
62771
  helpers.next();
60652
62772
  });
60653
- __publicField(this, "handleClickSkip", (event) => {
62773
+ __publicField2(this, "handleClickSkip", (event) => {
60654
62774
  event.preventDefault();
60655
62775
  const { helpers } = this.props;
60656
62776
  helpers.skip();
60657
62777
  });
60658
- __publicField(this, "getElementsProps", () => {
62778
+ __publicField2(this, "getElementsProps", () => {
60659
62779
  const { continuous: continuous2, index: index2, isLastStep, setTooltipRef, size: size2, step } = this.props;
60660
62780
  const { back, close, last: last2, next, nextLabelWithProgress, skip } = step.locale;
60661
62781
  const backText = getReactNodeText(back);
@@ -60757,19 +62877,19 @@ var JoyrideTooltip = class extends React__namespace.Component {
60757
62877
  var JoyrideStep = class extends React__namespace.Component {
60758
62878
  constructor() {
60759
62879
  super(...arguments);
60760
- __publicField(this, "scope", null);
60761
- __publicField(this, "tooltip", null);
60762
- __publicField(this, "handleClickHoverBeacon", (event) => {
62880
+ __publicField2(this, "scope", null);
62881
+ __publicField2(this, "tooltip", null);
62882
+ __publicField2(this, "handleClickHoverBeacon", (event) => {
60763
62883
  const { step, store } = this.props;
60764
62884
  if (event.type === "mouseenter" && step.event !== "hover") {
60765
62885
  return;
60766
62886
  }
60767
62887
  store.update({ lifecycle: LIFECYCLE.TOOLTIP });
60768
62888
  });
60769
- __publicField(this, "setTooltipRef", (element) => {
62889
+ __publicField2(this, "setTooltipRef", (element) => {
60770
62890
  this.tooltip = element;
60771
62891
  });
60772
- __publicField(this, "setPopper", (popper, type) => {
62892
+ __publicField2(this, "setPopper", (popper, type) => {
60773
62893
  var _a;
60774
62894
  const { action, lifecycle, step, store } = this.props;
60775
62895
  if (type === "wrapper") {
@@ -60787,7 +62907,7 @@ var JoyrideStep = class extends React__namespace.Component {
60787
62907
  step.floaterProps.getPopper(popper, type);
60788
62908
  }
60789
62909
  });
60790
- __publicField(this, "renderTooltip", (renderProps) => {
62910
+ __publicField2(this, "renderTooltip", (renderProps) => {
60791
62911
  const { continuous: continuous2, helpers, index: index2, size: size2, step } = this.props;
60792
62912
  return /* @__PURE__ */ React__namespace.createElement(
60793
62913
  JoyrideTooltip,
@@ -60959,15 +63079,15 @@ var JoyrideStep = class extends React__namespace.Component {
60959
63079
  var Joyride = class extends React__namespace.Component {
60960
63080
  constructor(props) {
60961
63081
  super(props);
60962
- __publicField(this, "helpers");
60963
- __publicField(this, "store");
60964
- __publicField(this, "callback", (data) => {
63082
+ __publicField2(this, "helpers");
63083
+ __publicField2(this, "store");
63084
+ __publicField2(this, "callback", (data) => {
60965
63085
  const { callback } = this.props;
60966
63086
  if (src_default.function(callback)) {
60967
63087
  callback(data);
60968
63088
  }
60969
63089
  });
60970
- __publicField(this, "handleKeyboard", (event) => {
63090
+ __publicField2(this, "handleKeyboard", (event) => {
60971
63091
  const { index: index2, lifecycle } = this.state;
60972
63092
  const { steps: steps2 } = this.props;
60973
63093
  const step = steps2[index2];
@@ -60977,7 +63097,7 @@ var Joyride = class extends React__namespace.Component {
60977
63097
  }
60978
63098
  }
60979
63099
  });
60980
- __publicField(this, "handleClickOverlay", () => {
63100
+ __publicField2(this, "handleClickOverlay", () => {
60981
63101
  const { index: index2 } = this.state;
60982
63102
  const { steps: steps2 } = this.props;
60983
63103
  const step = getMergedStep(this.props, steps2[index2]);
@@ -60985,7 +63105,7 @@ var Joyride = class extends React__namespace.Component {
60985
63105
  this.helpers.close("overlay");
60986
63106
  }
60987
63107
  });
60988
- __publicField(this, "syncState", (state) => {
63108
+ __publicField2(this, "syncState", (state) => {
60989
63109
  this.setState(state);
60990
63110
  });
60991
63111
  const { debug: debug2, getHelpers, run = true, stepIndex } = props;
@@ -61235,7 +63355,7 @@ var Joyride = class extends React__namespace.Component {
61235
63355
  return /* @__PURE__ */ React__namespace.createElement("div", { className: "react-joyride" }, content.step, content.overlay);
61236
63356
  }
61237
63357
  };
61238
- __publicField(Joyride, "defaultProps", defaultProps$4);
63358
+ __publicField2(Joyride, "defaultProps", defaultProps$4);
61239
63359
  var components_default = Joyride;
61240
63360
  const Tooltip$2 = ({
61241
63361
  continuous: continuous2,
@@ -86217,7 +88337,7 @@ function getDataKey(sorting, filters, hiddenColumns, search) {
86217
88337
  function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_PAGE_SIZE$1 }) {
86218
88338
  const { pageSize } = options;
86219
88339
  const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
86220
- const length = React.useRef(0);
88340
+ const length = React.useRef(void 0);
86221
88341
  const [data, setData] = React.useState({ rows: [], pages: [], cache: {}, lastFetchedPage: void 0 });
86222
88342
  const _pendingPageRequests = React.useRef({});
86223
88343
  const _lastUsedSorting = React.useRef([]);