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

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, "'");
15233
+ return constructFrom(referenceDate, date2);
13432
15234
  }
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;
13468
- }
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);
@@ -35866,12 +37949,35 @@ function Actions(props) {
35866
37949
  const { actions, actionsLength, data, isActiveRow, rowId, table } = props;
35867
37950
  const { texts } = useLocalization();
35868
37951
  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
- );
37952
+ const visibleActions = actions.map(
37953
+ (action) => action(data, {
37954
+ cleanup: tableMeta.rowActions.handlers["cleanup"] ?? (() => void 0),
37955
+ isEditing: tableMeta.editing.isEditing,
37956
+ rowId,
37957
+ table
37958
+ })
37959
+ ).filter((action) => !!action);
37960
+ let length = actionsLength;
37961
+ if (tableMeta.editing.isEditing) {
37962
+ const lengthWithoutEditingItems = visibleActions.length - 1;
37963
+ if (lengthWithoutEditingItems < actionsLength) {
37964
+ length = lengthWithoutEditingItems;
37965
+ }
37966
+ }
37967
+ const handleMenuButtonKeyDown = (event) => {
37968
+ const isLastRowActive = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;
37969
+ if (event.key === "Tab" && isLastRowActive && tableMeta.editing.isEditing && tableMeta.editing.hasChanges()) {
37970
+ tableMeta.editing.saveChanges(table);
37971
+ }
37972
+ };
37973
+ const handleMenuContentKeyDown = (event) => {
37974
+ if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
37975
+ event.stopPropagation();
37976
+ }
37977
+ };
37978
+ const actionsOnRow = visibleActions.length === length ? visibleActions : visibleActions.slice(0, length - 1);
37979
+ const actionsInMenu = visibleActions.slice(visibleActions.length === length ? length : length - 1);
37980
+ const className = clsx("flex justify-end text-right bg-[inherit] print:hidden");
35875
37981
  return /* @__PURE__ */ React.createElement("span", { className }, actionsOnRow.map((button, index2) => {
35876
37982
  const tooltip = String(button.props.tooltip ?? button.props["aria-label"] ?? "");
35877
37983
  return React.cloneElement(button, {
@@ -35886,8 +37992,16 @@ function Actions(props) {
35886
37992
  appearance: "transparent",
35887
37993
  "aria-label": texts.table.columns.actions.tooltip,
35888
37994
  icon: "more",
37995
+ onKeyDown: handleMenuButtonKeyDown,
35889
37996
  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"]))))
37997
+ menu: (menuProps) => /* @__PURE__ */ React.createElement(Menu$1, { ...menuProps }, /* @__PURE__ */ React.createElement(Menu$1.Content, { onKeyDown: handleMenuContentKeyDown }, actionsInMenu.map((action, i2) => {
37998
+ const item = /* @__PURE__ */ React.createElement(Menu$1.Item, { key: i2, ...action.props, shortcut: action.props.shortcut }, action.props["aria-label"]);
37999
+ const isFirstEditingMenuItem = tableMeta.editing.isEditing && actionsInMenu.length > 2 && i2 === actionsInMenu.length - 2;
38000
+ if (isFirstEditingMenuItem) {
38001
+ return /* @__PURE__ */ React.createElement(React.Fragment, { key: i2 }, /* @__PURE__ */ React.createElement(Menu$1.Separator, null), item);
38002
+ }
38003
+ return item;
38004
+ })))
35891
38005
  }
35892
38006
  ) : null);
35893
38007
  }
@@ -35928,7 +38042,8 @@ const renderer$3 = {
35928
38042
  'print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky right-0',
35929
38043
  'group-[[data-row-active="true"][data-selected="false"]]/row:text-grey-200',
35930
38044
  'group-[[data-row-selected="true"]]/row:text-blue-100',
35931
- 'group-[[data-row-selected="false"]:hover]/row:text-grey-100'
38045
+ 'group-[[data-row-selected="false"]:hover]/row:text-grey-100',
38046
+ "shadow-[-6px_0px_6px_var(--table-row-actions-shadow)]"
35932
38047
  ),
35933
38048
  // TODO: remove when table3 is migrated, this satisfies the legacy table3 type
35934
38049
  enableSearch: false,
@@ -36426,7 +38541,7 @@ function DisplayCell(props) {
36426
38541
  } else {
36427
38542
  content = typeof cell.column.columnDef.cell === "function" ? cell.column.columnDef.cell(cell.getContext()) : cell.getValue();
36428
38543
  }
36429
- return /* @__PURE__ */ React.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content);
38544
+ return /* @__PURE__ */ React.createElement(MemoedDisplayCell, { ...cellAttributes, ...attributes, cellRef, isTruncated }, content ?? columnMeta.emptyState);
36430
38545
  }
36431
38546
  const MemoedDisplayCell = React.memo(function MemoedDisplayCell2(props) {
36432
38547
  const { cellRef, children, isTruncated, ...cellAttributes } = props;
@@ -36980,7 +39095,20 @@ function useAugmentedFocusManager() {
36980
39095
  const focusManager = $9bf71ea28793e738$export$10c5169755ce7bd7();
36981
39096
  const focusPrevious = (arrowNavigation = false) => focusManager == null ? void 0 : focusManager.focusPrevious(arrowNavigation ? FOCUS_MANAGER_OPTIONS_ARROW_KEYS : FOCUS_MANAGER_OPTIONS_TAB);
36982
39097
  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);
39098
+ const focusFirst = () => {
39099
+ return focusManager == null ? void 0 : focusManager.focusFirst({
39100
+ ...FOCUS_MANAGER_OPTIONS_TAB,
39101
+ accept: (element) => {
39102
+ if (!FOCUS_MANAGER_OPTIONS_TAB.accept(element)) {
39103
+ return false;
39104
+ }
39105
+ if (element.closest('[data-taco="cell-control"]')) {
39106
+ return true;
39107
+ }
39108
+ return false;
39109
+ }
39110
+ });
39111
+ };
36984
39112
  const focusLast = () => focusManager == null ? void 0 : focusManager.focusLast(FOCUS_MANAGER_OPTIONS_TAB);
36985
39113
  return {
36986
39114
  focusPrevious,
@@ -37000,7 +39128,8 @@ function Body(props) {
37000
39128
  }
37001
39129
  if (tableMeta.rowActive.rowActiveIndex !== void 0) {
37002
39130
  const isFirstRow = tableMeta.rowActive.rowActiveIndex === 0;
37003
- const isLastRow = tableMeta.rowActive.rowActiveIndex === tableMeta.length - 1;
39131
+ const reachableRows = tableMeta.length + table.getBottomRows().length;
39132
+ const isLastRow = tableMeta.rowActive.rowActiveIndex === reachableRows - 1;
37004
39133
  if (event.key === "Tab" || enableHorizontalArrowKeyNavigation && (event.key === "ArrowLeft" || event.key === "ArrowRight")) {
37005
39134
  if (event.key === "Tab" && !hasFocusableElement(event.target.closest("tr[data-row-id]"))) {
37006
39135
  return;
@@ -37443,7 +39572,7 @@ function Search$1(props) {
37443
39572
  tableMeta.search.setCurrentHighlightColumnIndex(nextIndex);
37444
39573
  scrollTo2(tableMeta.search.highlightedColumnIndexes[nextIndex][0]);
37445
39574
  };
37446
- const settings = /* @__PURE__ */ React.createElement(
39575
+ const settings = tableMeta.server._experimentalDataLoader2 ? void 0 : /* @__PURE__ */ React.createElement(
37447
39576
  Switch$1,
37448
39577
  {
37449
39578
  label: texts.table.search.excludeUnmatchedResults,
@@ -42353,6 +44482,9 @@ const Search = React.forwardRef(function ListboxSearch(props, ref) {
42353
44482
  if (event.key === " ") {
42354
44483
  return;
42355
44484
  }
44485
+ if ((event.key === "ArrowLeft" || event.key === "ArrowRight") && event.currentTarget.value.length) {
44486
+ event.stopPropagation();
44487
+ }
42356
44488
  if (isAriaSelectionKey(event) || event.key === "ArrowDown" || event.key === "ArrowUp") {
42357
44489
  event.preventDefault();
42358
44490
  (_a = listboxRef == null ? void 0 : listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
@@ -42616,14 +44748,28 @@ const Select22 = React.forwardRef(function Select222(props, ref) {
42616
44748
  }
42617
44749
  (_a = listboxRef.current) == null ? void 0 : _a.dispatchEvent(createCustomKeyboardEvent(event));
42618
44750
  };
42619
- const shouldFocusNextRef = React.useRef(false);
44751
+ const shouldFocusNextRef = React.useRef(void 0);
44752
+ React.useEffect(() => {
44753
+ const handleKeyDown2 = (event) => {
44754
+ if (event.key === "ArrowLeft" || event.key === "ArrowRight") {
44755
+ shouldFocusNextRef.current = event.key === "ArrowLeft" ? -1 : 1;
44756
+ setOpen(false);
44757
+ }
44758
+ };
44759
+ if (isElementInsideTable3OrReport(internalRef.current)) {
44760
+ document.addEventListener("keydown", handleKeyDown2);
44761
+ }
44762
+ return () => {
44763
+ document.removeEventListener("keydown", handleKeyDown2);
44764
+ };
44765
+ }, []);
42620
44766
  const handleListboxKeyDown = (event) => {
42621
44767
  if (isAriaDirectionKey(event)) {
42622
44768
  setShouldPauseHoverState(true);
42623
44769
  return;
42624
44770
  }
42625
44771
  if (event.key === "Tab") {
42626
- shouldFocusNextRef.current = true;
44772
+ shouldFocusNextRef.current = event.shiftKey ? -1 : 1;
42627
44773
  setOpen(false);
42628
44774
  return;
42629
44775
  }
@@ -42634,11 +44780,11 @@ const Select22 = React.forwardRef(function Select222(props, ref) {
42634
44780
  };
42635
44781
  const handleCloseAutoFocus = (event) => {
42636
44782
  var _a, _b;
42637
- if (shouldFocusNextRef.current) {
44783
+ if (shouldFocusNextRef.current !== void 0) {
42638
44784
  event.preventDefault();
42639
- shouldFocusNextRef.current = false;
42640
44785
  (_a = otherProps.onBlur) == null ? void 0 : _a.call(otherProps, event);
42641
- (_b = getNextFocussableElement(internalRef.current)) == null ? void 0 : _b.focus();
44786
+ (_b = getNextFocussableElement(internalRef.current, shouldFocusNextRef.current)) == null ? void 0 : _b.focus();
44787
+ shouldFocusNextRef.current = void 0;
42642
44788
  return;
42643
44789
  }
42644
44790
  };
@@ -43039,8 +45185,8 @@ function FilterComparator(props) {
43039
45185
  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
45186
  }
43041
45187
  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";
45188
+ var _a, _b, _c;
45189
+ 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
45190
  switch (comparator) {
43045
45191
  case TableFilterComparator.Contains:
43046
45192
  return texts.table.filters.comparators.contains;
@@ -51664,7 +53810,7 @@ function willRowMove(cell, change, rowIndex, localization) {
51664
53810
  const { table } = cell.getContext();
51665
53811
  if (willRowMoveAfterSearch(cell, change, table, localization)) {
51666
53812
  return "search";
51667
- } else if (willRowMoveAfterFilter(cell, change)) {
53813
+ } else if (willRowMoveAfterFilter(cell, change, localization)) {
51668
53814
  return "filter";
51669
53815
  } else if (willRowMoveAfterSorting(cell, change, rowIndex)) {
51670
53816
  return "sorting";
@@ -51679,11 +53825,17 @@ function willRowMoveAfterSearch(cell, change, table, localization) {
51679
53825
  const rowWithChange = { ...cell.row, original: { ...cell.row.original, [cell.column.id]: change } };
51680
53826
  return !globalFilterFn(rowWithChange, cell.column.id, searchQuery, localization);
51681
53827
  }
51682
- function willRowMoveAfterFilter(cell, change) {
53828
+ function willRowMoveAfterFilter(cell, change, localization) {
51683
53829
  if (!cell.column.getIsFiltered()) {
51684
53830
  return false;
51685
53831
  }
51686
- return !columnFilterFn(change, cell.column.getFilterValue());
53832
+ return !columnFilterFn(
53833
+ cell.row.original,
53834
+ change,
53835
+ cell.column.columnDef.meta,
53836
+ cell.column.getFilterValue(),
53837
+ localization
53838
+ );
51687
53839
  }
51688
53840
  function willRowMoveAfterSorting(cell, change, rowIndex) {
51689
53841
  var _a;
@@ -51979,8 +54131,8 @@ function requireIsBuffer() {
51979
54131
  var freeExports = exports2 && !exports2.nodeType && exports2;
51980
54132
  var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
51981
54133
  var moduleExports = freeModule && freeModule.exports === freeExports;
51982
- var Buffer = moduleExports ? root.Buffer : void 0;
51983
- var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
54134
+ var Buffer2 = moduleExports ? root.Buffer : void 0;
54135
+ var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
51984
54136
  var isBuffer2 = nativeIsBuffer || stubFalse;
51985
54137
  module2.exports = isBuffer2;
51986
54138
  })(isBuffer, isBuffer.exports);
@@ -52259,7 +54411,7 @@ function require_cloneBuffer() {
52259
54411
  var freeExports = exports2 && !exports2.nodeType && exports2;
52260
54412
  var freeModule = freeExports && true && module2 && !module2.nodeType && module2;
52261
54413
  var moduleExports = freeModule && freeModule.exports === freeExports;
52262
- var Buffer = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
54414
+ var Buffer2 = moduleExports ? root.Buffer : void 0, allocUnsafe = Buffer2 ? Buffer2.allocUnsafe : void 0;
52263
54415
  function cloneBuffer(buffer, isDeep) {
52264
54416
  if (isDeep) {
52265
54417
  return buffer.slice();
@@ -53110,17 +55262,18 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
53110
55262
  async function onCellChanged(cell, rowIndex, nextValue, shouldRunUpdaters = true) {
53111
55263
  var _a;
53112
55264
  const changes = nextValue !== void 0 ? { ...state.changes.rows[cell.row.id], [cell.column.id]: nextValue } : { ...state.changes.rows[cell.row.id] };
55265
+ const original = cell.row.original;
53113
55266
  if (!Object.keys(changes).length) {
53114
55267
  return;
53115
55268
  }
53116
55269
  let updatesForOtherCells = {};
53117
55270
  if (typeof handleChange === "function" && shouldRunUpdaters) {
53118
55271
  const previousRowValue = {
53119
- ...state.changes.originals[cell.row.id]
55272
+ ...original
53120
55273
  //...getRowChangeset(updatersRef.current[cell.row.id], rowIdentityAccessor),
53121
55274
  };
53122
55275
  const nextRowValue = {
53123
- ...state.changes.originals[cell.row.id],
55276
+ ...original,
53124
55277
  ...changes
53125
55278
  };
53126
55279
  updatesForOtherCells = await handleChange(
@@ -53134,8 +55287,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
53134
55287
  const nextMoveReasons = { ...state.changes.moveReasons[cell.row.id] };
53135
55288
  const nextCellErrors = { ...(_a = state.changes.errors[cell.row.id]) == null ? void 0 : _a.cells };
53136
55289
  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 };
55290
+ if (validator && Object.keys(nextChanges).length && original) {
55291
+ const nextRowValue = { ...original, ...changes, ...updatesForOtherCells };
53139
55292
  validationErrors = await validator(nextRowValue) ?? {};
53140
55293
  }
53141
55294
  const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
@@ -53164,7 +55317,8 @@ function usePendingChangesState(handleSave, handleChange, handleDiscard, rowIden
53164
55317
  cellErrors: nextCellErrors,
53165
55318
  index: rowIndex,
53166
55319
  moveReasons: nextMoveReasons,
53167
- value: nextChanges
55320
+ value: nextChanges,
55321
+ original
53168
55322
  }
53169
55323
  });
53170
55324
  }
@@ -53574,6 +55728,7 @@ function EditingControlCell(props) {
53574
55728
  const type = columnMeta.control ?? "input";
53575
55729
  const handleFocus = useEditingCellAutofocus(props);
53576
55730
  const value = cell.getValue();
55731
+ const rowChanges = tableMeta.editing.getRowValue(cell.row.id);
53577
55732
  const hasNonTextControl = React.useMemo(() => {
53578
55733
  var _a;
53579
55734
  return typeof type === "function" && !!((_a = cellRef.current) == null ? void 0 : _a.querySelector('[data-taco="Select2"],[data-taco="switch"],[data-taco="checkbox"]'));
@@ -53589,35 +55744,22 @@ function EditingControlCell(props) {
53589
55744
  },
53590
55745
  [hasNonTextControl, cell.row.id, cell.column.id, cell.row.original, rowIndex, value]
53591
55746
  );
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
55747
  const handleBlur = React.useCallback(
53602
55748
  (event) => {
53603
55749
  if (isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
53604
55750
  return;
53605
55751
  }
53606
- blur();
55752
+ requestAnimationFrame(() => {
55753
+ tableMeta.editing.toggleDetailedMode(false);
55754
+ tableMeta.editing.onCellChanged(cell, rowIndex, void 0, !hasNonTextControl);
55755
+ });
53607
55756
  },
53608
- [blur]
55757
+ [hasNonTextControl, cell.row.id, JSON.stringify(rowChanges), rowIndex, cell.column.id, cell.row.original]
53609
55758
  );
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
55759
  const error = tableMeta.editing.getCellError(cell);
53619
55760
  const controlProps = {
53620
55761
  dataType: columnMeta.dataType,
55762
+ disabled: tableMeta.editing.getRowStatus(cell.row.id) === "saving",
53621
55763
  fontSize: tableMeta.fontSize.size,
53622
55764
  id: cell.column.id,
53623
55765
  invalid: !!error,
@@ -53645,6 +55787,7 @@ function EditingControlCell(props) {
53645
55787
  const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
53646
55788
  const {
53647
55789
  dataType,
55790
+ disabled,
53648
55791
  fontSize,
53649
55792
  id: id2,
53650
55793
  invalid,
@@ -53662,6 +55805,7 @@ const MemoedEditingCell = React.memo(function MemoedEditingCell2(props) {
53662
55805
  const controlRef = React.useRef(null);
53663
55806
  const currentValue = row[id2];
53664
55807
  const commonProps = {
55808
+ disabled,
53665
55809
  onBlur,
53666
55810
  ref: controlRef,
53667
55811
  tabIndex
@@ -53839,6 +55983,22 @@ function Cell$1(props) {
53839
55983
  }
53840
55984
  return /* @__PURE__ */ React.createElement(DisplayCell, { ...props });
53841
55985
  }
55986
+ function SaveStatus(props) {
55987
+ const { rowId, table } = props;
55988
+ const { texts } = useLocalization();
55989
+ const tableMeta = table.options.meta;
55990
+ const status = tableMeta.editing.getRowStatus(rowId);
55991
+ const className = clsx(
55992
+ "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)]",
55993
+ {
55994
+ "mt-0.5": tableMeta.rowHeight.height === "short",
55995
+ "mt-1": tableMeta.rowHeight.height === "medium",
55996
+ "mt-1.5": tableMeta.rowHeight.height === "tall",
55997
+ "mt-2": tableMeta.rowHeight.height === "extra-tall"
55998
+ }
55999
+ );
56000
+ 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" }))));
56001
+ }
53842
56002
  function DiscardChangesConfirmationDialog(props) {
53843
56003
  const { onDiscard: handleDiscard, ...dialogProps } = props;
53844
56004
  const { texts } = useLocalization();
@@ -53862,54 +56022,6 @@ function DiscardChangesConfirmationDialog(props) {
53862
56022
  /* @__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
56023
  ));
53864
56024
  }
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
56025
  function Row(props) {
53914
56026
  const { row, index: index2, table } = props;
53915
56027
  const focusManager = useAugmentedFocusManager();
@@ -53980,6 +56092,7 @@ const RENDERERS = {
53980
56092
  cell: Cell$1
53981
56093
  };
53982
56094
  function useTable3(props, ref) {
56095
+ const { texts } = useLocalization();
53983
56096
  const editing = useTableEditing(
53984
56097
  props.enableEditing,
53985
56098
  props.onEditingSave,
@@ -53989,7 +56102,6 @@ function useTable3(props, ref) {
53989
56102
  props.rowIdentityAccessor,
53990
56103
  props.validator
53991
56104
  );
53992
- const creationEnabled = editing.isEnabled && !!props.onEditingCreate;
53993
56105
  const data = React.useMemo(() => {
53994
56106
  if (editing.temporaryRows.length) {
53995
56107
  return (props.data ?? []).concat(editing.temporaryRows);
@@ -54001,31 +56113,42 @@ function useTable3(props, ref) {
54001
56113
  data,
54002
56114
  enableRowActions: editing.isEditing ? true : props.enableRowActions,
54003
56115
  // 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
56116
+ rowActions: editing.isEditing ? (props.rowActions ?? []).concat([
56117
+ (_1, helpers) => /* @__PURE__ */ React.createElement(
56118
+ IconButton,
56119
+ {
56120
+ "aria-label": texts.table3.editing.actions.save,
56121
+ icon: "tick",
56122
+ disabled: !editing.hasChanges(helpers.rowId) || editing.hasRowErrors(helpers.rowId),
56123
+ onClick: async () => {
56124
+ await editing.saveChanges(helpers.table, helpers.rowId);
54025
56125
  }
54026
- );
54027
- }
54028
- ] : props.rowActions
56126
+ }
56127
+ ),
56128
+ (_1, helpers) => /* @__PURE__ */ React.createElement(
56129
+ IconButton,
56130
+ {
56131
+ "aria-label": texts.table3.editing.actions.clear,
56132
+ icon: "close",
56133
+ disabled: !editing.hasChanges(helpers.rowId),
56134
+ dialog: (props2) => /* @__PURE__ */ React.createElement(
56135
+ DiscardChangesConfirmationDialog,
56136
+ {
56137
+ ...props2,
56138
+ onDiscard: () => {
56139
+ editing.discardChanges(helpers.rowId, helpers.table);
56140
+ if (editing.temporaryRows.length) {
56141
+ requestAnimationFrame(() => {
56142
+ var _a;
56143
+ return (_a = editing.createRowButtonRef.current) == null ? void 0 : _a.focus();
56144
+ });
56145
+ }
56146
+ }
56147
+ }
56148
+ )
56149
+ }
56150
+ )
56151
+ ]) : props.rowActions
54029
56152
  };
54030
56153
  const meta = { editing };
54031
56154
  const options = {
@@ -54171,16 +56294,15 @@ function CreateNewRow(props) {
54171
56294
  } else {
54172
56295
  tooltip = /* @__PURE__ */ React.createElement(Shortcut, { keys: shortcut2 });
54173
56296
  }
54174
- const className = clsx("group/row border-grey-300 !sticky z-[21]", {
56297
+ const className = clsx("group/row !sticky z-[21]", {
54175
56298
  "bottom-10": tableMeta.footer.isEnabled,
54176
- "bottom-0": !tableMeta.footer.isEnabled,
54177
- "border-b": !isScrolled
56299
+ "bottom-0": !tableMeta.footer.isEnabled
54178
56300
  });
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(
56301
+ 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
56302
  Button$4,
54181
56303
  {
54182
56304
  appearance: "transparent",
54183
- className: "group-hover:bg-grey-200 sticky left-[4px]",
56305
+ className: "group-hover:bg-grey-200 sticky left-[4px] font-bold",
54184
56306
  disabled: isDisabled,
54185
56307
  onClick: handleCreate,
54186
56308
  ref: buttonRef,
@@ -54191,13 +56313,20 @@ function CreateNewRow(props) {
54191
56313
  texts.table3.editing.buttons.create.label
54192
56314
  )));
54193
56315
  }
56316
+ function TemporaryRows(props) {
56317
+ return props.table.getBottomRows().map((row) => /* @__PURE__ */ React.createElement(TemporaryRow, { key: row.id, row, ...props }));
56318
+ }
54194
56319
  function TemporaryRow(props) {
54195
- const { createRowButtonRef, isScrolled, table, tableMeta, tableRef } = props;
56320
+ const { createRowButtonRef, row, table, tableMeta, tableRef } = props;
54196
56321
  const handleKeyDown = async (event) => {
54197
- var _a, _b;
56322
+ var _a;
56323
+ const target = event.target;
56324
+ if (isAriaDirectionKey(event) && isElementInsideExternalRelatedOverlay(target, tableRef)) {
56325
+ return;
56326
+ }
54198
56327
  if (event.key === "ArrowDown") {
54199
56328
  event.preventDefault();
54200
- if (!isElementTriggeredFromContainer(event.target, event.currentTarget)) {
56329
+ if (!isElementTriggeredFromContainer(target, event.currentTarget)) {
54201
56330
  const saved = await tableMeta.editing.saveChanges(table);
54202
56331
  if (saved) {
54203
56332
  (_a = createRowButtonRef.current) == null ? void 0 : _a.focus();
@@ -54206,28 +56335,15 @@ function TemporaryRow(props) {
54206
56335
  } else if (event.key === "ArrowUp") {
54207
56336
  event.preventDefault();
54208
56337
  event.stopPropagation();
56338
+ const lastIndex = tableMeta.length - 1;
56339
+ tableMeta.rowActive.setRowActiveIndex(lastIndex);
54209
56340
  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;
56341
+ tableRef.current.scrollTop = tableRef.current.scrollHeight;
56342
+ requestAnimationFrame(() => {
56343
+ if (tableRef.current) {
56344
+ tableRef.current.scrollTop = tableRef.current.scrollHeight;
54224
56345
  }
54225
- }
54226
- if (nextRowIndex) {
54227
- tableMeta.rowActive.setRowActiveIndex(
54228
- Number(availableRows[nextRowIndex < 0 ? 0 : nextRowIndex].getAttribute("data-row-index"))
54229
- );
54230
- }
56346
+ });
54231
56347
  }
54232
56348
  }
54233
56349
  };
@@ -54242,12 +56358,11 @@ function TemporaryRow(props) {
54242
56358
  }
54243
56359
  }
54244
56360
  };
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
56361
+ const className = clsx("group/row border-grey-300 !sticky z-[22] print:hidden border-t-2", {
56362
+ "bottom-[calc(5rem_+_5px)] data-[row-editing-move]:bottom-[calc(5rem_+_5px)]": tableMeta.footer.isEnabled,
56363
+ "bottom-[calc(2.5rem_+_5px)] data-[row-editing-move]:bottom-[calc(2.5rem_+_5px)]": !tableMeta.footer.isEnabled
54249
56364
  });
54250
- return /* @__PURE__ */ React.createElement(React.Fragment, null, table.getBottomRows().map((row) => /* @__PURE__ */ React.createElement(
56365
+ return /* @__PURE__ */ React.createElement(
54251
56366
  Row$2,
54252
56367
  {
54253
56368
  key: row.id,
@@ -54264,7 +56379,7 @@ function TemporaryRow(props) {
54264
56379
  hideRowActions: !tableMeta.editing.isEditing,
54265
56380
  skipPageLoading: true
54266
56381
  }
54267
- )));
56382
+ );
54268
56383
  }
54269
56384
  const Column = () => null;
54270
56385
  Column.displayName = "Table3Column";
@@ -54317,10 +56432,9 @@ const BaseTable3 = fixedForwardRef(function BaseTable32(props, ref) {
54317
56432
  table: table3
54318
56433
  },
54319
56434
  hasCreateWorkflow ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
54320
- TemporaryRow,
56435
+ TemporaryRows,
54321
56436
  {
54322
56437
  createRowButtonRef: table3.meta.editing.createRowButtonRef,
54323
- isScrolled,
54324
56438
  table: table3.instance,
54325
56439
  tableMeta: table3.meta,
54326
56440
  tableRef: table3.ref
@@ -59148,9 +61262,9 @@ _defineProperty$J(ReactFloater, "propTypes", { autoOpen: PropTypes.bool, callbac
59148
61262
  return !props.component;
59149
61263
  }), 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
61264
  _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);
61265
+ var __defProp2 = Object.defineProperty;
61266
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
61267
+ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
59154
61268
  var ACTIONS = {
59155
61269
  INIT: "init",
59156
61270
  START: "start",
@@ -59853,15 +61967,15 @@ var defaultState = {
59853
61967
  var validKeys = objectKeys(omit(defaultState, "controlled", "size"));
59854
61968
  var Store = class {
59855
61969
  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) => {
61970
+ __publicField2(this, "beaconPopper");
61971
+ __publicField2(this, "tooltipPopper");
61972
+ __publicField2(this, "data", /* @__PURE__ */ new Map());
61973
+ __publicField2(this, "listener");
61974
+ __publicField2(this, "store", /* @__PURE__ */ new Map());
61975
+ __publicField2(this, "addListener", (listener) => {
59862
61976
  this.listener = listener;
59863
61977
  });
59864
- __publicField(this, "setSteps", (steps3) => {
61978
+ __publicField2(this, "setSteps", (steps3) => {
59865
61979
  const { size: size2, status } = this.getState();
59866
61980
  const state = {
59867
61981
  size: steps3.length,
@@ -59873,24 +61987,24 @@ var Store = class {
59873
61987
  }
59874
61988
  this.setState(state);
59875
61989
  });
59876
- __publicField(this, "getPopper", (name) => {
61990
+ __publicField2(this, "getPopper", (name) => {
59877
61991
  if (name === "beacon") {
59878
61992
  return this.beaconPopper;
59879
61993
  }
59880
61994
  return this.tooltipPopper;
59881
61995
  });
59882
- __publicField(this, "setPopper", (name, popper) => {
61996
+ __publicField2(this, "setPopper", (name, popper) => {
59883
61997
  if (name === "beacon") {
59884
61998
  this.beaconPopper = popper;
59885
61999
  } else {
59886
62000
  this.tooltipPopper = popper;
59887
62001
  }
59888
62002
  });
59889
- __publicField(this, "cleanupPoppers", () => {
62003
+ __publicField2(this, "cleanupPoppers", () => {
59890
62004
  this.beaconPopper = null;
59891
62005
  this.tooltipPopper = null;
59892
62006
  });
59893
- __publicField(this, "close", (origin = null) => {
62007
+ __publicField2(this, "close", (origin = null) => {
59894
62008
  const { index: index2, status } = this.getState();
59895
62009
  if (status !== STATUS.RUNNING) {
59896
62010
  return;
@@ -59899,7 +62013,7 @@ var Store = class {
59899
62013
  ...this.getNextState({ action: ACTIONS.CLOSE, index: index2 + 1, origin })
59900
62014
  });
59901
62015
  });
59902
- __publicField(this, "go", (nextIndex) => {
62016
+ __publicField2(this, "go", (nextIndex) => {
59903
62017
  const { controlled, status } = this.getState();
59904
62018
  if (controlled || status !== STATUS.RUNNING) {
59905
62019
  return;
@@ -59910,15 +62024,15 @@ var Store = class {
59910
62024
  status: step ? status : STATUS.FINISHED
59911
62025
  });
59912
62026
  });
59913
- __publicField(this, "info", () => this.getState());
59914
- __publicField(this, "next", () => {
62027
+ __publicField2(this, "info", () => this.getState());
62028
+ __publicField2(this, "next", () => {
59915
62029
  const { index: index2, status } = this.getState();
59916
62030
  if (status !== STATUS.RUNNING) {
59917
62031
  return;
59918
62032
  }
59919
62033
  this.setState(this.getNextState({ action: ACTIONS.NEXT, index: index2 + 1 }));
59920
62034
  });
59921
- __publicField(this, "open", () => {
62035
+ __publicField2(this, "open", () => {
59922
62036
  const { status } = this.getState();
59923
62037
  if (status !== STATUS.RUNNING) {
59924
62038
  return;
@@ -59927,7 +62041,7 @@ var Store = class {
59927
62041
  ...this.getNextState({ action: ACTIONS.UPDATE, lifecycle: LIFECYCLE.TOOLTIP })
59928
62042
  });
59929
62043
  });
59930
- __publicField(this, "prev", () => {
62044
+ __publicField2(this, "prev", () => {
59931
62045
  const { index: index2, status } = this.getState();
59932
62046
  if (status !== STATUS.RUNNING) {
59933
62047
  return;
@@ -59936,7 +62050,7 @@ var Store = class {
59936
62050
  ...this.getNextState({ action: ACTIONS.PREV, index: index2 - 1 })
59937
62051
  });
59938
62052
  });
59939
- __publicField(this, "reset", (restart = false) => {
62053
+ __publicField2(this, "reset", (restart = false) => {
59940
62054
  const { controlled } = this.getState();
59941
62055
  if (controlled) {
59942
62056
  return;
@@ -59946,7 +62060,7 @@ var Store = class {
59946
62060
  status: restart ? STATUS.RUNNING : STATUS.READY
59947
62061
  });
59948
62062
  });
59949
- __publicField(this, "skip", () => {
62063
+ __publicField2(this, "skip", () => {
59950
62064
  const { status } = this.getState();
59951
62065
  if (status !== STATUS.RUNNING) {
59952
62066
  return;
@@ -59957,7 +62071,7 @@ var Store = class {
59957
62071
  status: STATUS.SKIPPED
59958
62072
  });
59959
62073
  });
59960
- __publicField(this, "start", (nextIndex) => {
62074
+ __publicField2(this, "start", (nextIndex) => {
59961
62075
  const { index: index2, size: size2 } = this.getState();
59962
62076
  this.setState({
59963
62077
  ...this.getNextState(
@@ -59970,7 +62084,7 @@ var Store = class {
59970
62084
  status: size2 ? STATUS.RUNNING : STATUS.WAITING
59971
62085
  });
59972
62086
  });
59973
- __publicField(this, "stop", (advance = false) => {
62087
+ __publicField2(this, "stop", (advance = false) => {
59974
62088
  const { index: index2, status } = this.getState();
59975
62089
  if ([STATUS.FINISHED, STATUS.SKIPPED].includes(status)) {
59976
62090
  return;
@@ -59980,7 +62094,7 @@ var Store = class {
59980
62094
  status: STATUS.PAUSED
59981
62095
  });
59982
62096
  });
59983
- __publicField(this, "update", (state) => {
62097
+ __publicField2(this, "update", (state) => {
59984
62098
  var _a, _b;
59985
62099
  if (!hasValidKeys(state, validKeys)) {
59986
62100
  throw new Error(`State is not valid. Valid keys: ${validKeys.join(", ")}`);
@@ -60111,16 +62225,16 @@ var Spotlight_default = JoyrideSpotlight;
60111
62225
  var JoyrideOverlay = class extends React__namespace.Component {
60112
62226
  constructor() {
60113
62227
  super(...arguments);
60114
- __publicField(this, "isActive", false);
60115
- __publicField(this, "resizeTimeout");
60116
- __publicField(this, "scrollTimeout");
60117
- __publicField(this, "scrollParent");
60118
- __publicField(this, "state", {
62228
+ __publicField2(this, "isActive", false);
62229
+ __publicField2(this, "resizeTimeout");
62230
+ __publicField2(this, "scrollTimeout");
62231
+ __publicField2(this, "scrollParent");
62232
+ __publicField2(this, "state", {
60119
62233
  isScrolling: false,
60120
62234
  mouseOverSpotlight: false,
60121
62235
  showSpotlight: true
60122
62236
  });
60123
- __publicField(this, "hideSpotlight", () => {
62237
+ __publicField2(this, "hideSpotlight", () => {
60124
62238
  const { continuous: continuous2, disableOverlay, lifecycle } = this.props;
60125
62239
  const hiddenLifecycles = [
60126
62240
  LIFECYCLE.INIT,
@@ -60130,7 +62244,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
60130
62244
  ];
60131
62245
  return disableOverlay || (continuous2 ? hiddenLifecycles.includes(lifecycle) : lifecycle !== LIFECYCLE.TOOLTIP);
60132
62246
  });
60133
- __publicField(this, "handleMouseMove", (event) => {
62247
+ __publicField2(this, "handleMouseMove", (event) => {
60134
62248
  const { mouseOverSpotlight } = this.state;
60135
62249
  const { height, left, position, top, width } = this.spotlightStyles;
60136
62250
  const offsetY = position === "fixed" ? event.clientY : event.pageY;
@@ -60142,7 +62256,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
60142
62256
  this.updateState({ mouseOverSpotlight: inSpotlight });
60143
62257
  }
60144
62258
  });
60145
- __publicField(this, "handleScroll", () => {
62259
+ __publicField2(this, "handleScroll", () => {
60146
62260
  const { target } = this.props;
60147
62261
  const element = getElement(target);
60148
62262
  if (this.scrollParent !== document) {
@@ -60158,7 +62272,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
60158
62272
  this.updateState({});
60159
62273
  }
60160
62274
  });
60161
- __publicField(this, "handleResize", () => {
62275
+ __publicField2(this, "handleResize", () => {
60162
62276
  clearTimeout(this.resizeTimeout);
60163
62277
  this.resizeTimeout = window.setTimeout(() => {
60164
62278
  if (!this.isActive) {
@@ -60293,7 +62407,7 @@ var JoyrideOverlay = class extends React__namespace.Component {
60293
62407
  var JoyridePortal = class extends React__namespace.Component {
60294
62408
  constructor() {
60295
62409
  super(...arguments);
60296
- __publicField(this, "node", null);
62410
+ __publicField2(this, "node", null);
60297
62411
  }
60298
62412
  componentDidMount() {
60299
62413
  const { id: id2 } = this.props;
@@ -60355,29 +62469,29 @@ var JoyridePortal = class extends React__namespace.Component {
60355
62469
  };
60356
62470
  var Scope = class {
60357
62471
  constructor(element, options) {
60358
- __publicField(this, "element");
60359
- __publicField(this, "options");
60360
- __publicField(this, "canBeTabbed", (element2) => {
62472
+ __publicField2(this, "element");
62473
+ __publicField2(this, "options");
62474
+ __publicField2(this, "canBeTabbed", (element2) => {
60361
62475
  const { tabIndex } = element2;
60362
62476
  if (tabIndex === null || tabIndex < 0) {
60363
62477
  return false;
60364
62478
  }
60365
62479
  return this.canHaveFocus(element2);
60366
62480
  });
60367
- __publicField(this, "canHaveFocus", (element2) => {
62481
+ __publicField2(this, "canHaveFocus", (element2) => {
60368
62482
  const validTabNodes = /input|select|textarea|button|object/;
60369
62483
  const nodeName = element2.nodeName.toLowerCase();
60370
62484
  const isValid2 = validTabNodes.test(nodeName) && !element2.getAttribute("disabled") || nodeName === "a" && !!element2.getAttribute("href");
60371
62485
  return isValid2 && this.isVisible(element2);
60372
62486
  });
60373
- __publicField(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed));
60374
- __publicField(this, "handleKeyDown", (event) => {
62487
+ __publicField2(this, "findValidTabElements", () => [].slice.call(this.element.querySelectorAll("*"), 0).filter(this.canBeTabbed));
62488
+ __publicField2(this, "handleKeyDown", (event) => {
60375
62489
  const { code = "Tab" } = this.options;
60376
62490
  if (event.code === code) {
60377
62491
  this.interceptTab(event);
60378
62492
  }
60379
62493
  });
60380
- __publicField(this, "interceptTab", (event) => {
62494
+ __publicField2(this, "interceptTab", (event) => {
60381
62495
  event.preventDefault();
60382
62496
  const elements = this.findValidTabElements();
60383
62497
  const { shiftKey } = event;
@@ -60394,7 +62508,7 @@ var Scope = class {
60394
62508
  }
60395
62509
  elements[x2].focus();
60396
62510
  });
60397
- __publicField(this, "isHidden", (element2) => {
62511
+ __publicField2(this, "isHidden", (element2) => {
60398
62512
  const noSize = element2.offsetWidth <= 0 && element2.offsetHeight <= 0;
60399
62513
  const style = window.getComputedStyle(element2);
60400
62514
  if (noSize && !element2.innerHTML) {
@@ -60402,7 +62516,7 @@ var Scope = class {
60402
62516
  }
60403
62517
  return noSize && style.getPropertyValue("overflow") !== "visible" || style.getPropertyValue("display") === "none";
60404
62518
  });
60405
- __publicField(this, "isVisible", (element2) => {
62519
+ __publicField2(this, "isVisible", (element2) => {
60406
62520
  let parentElement = element2;
60407
62521
  while (parentElement) {
60408
62522
  if (parentElement instanceof HTMLElement) {
@@ -60417,16 +62531,16 @@ var Scope = class {
60417
62531
  }
60418
62532
  return true;
60419
62533
  });
60420
- __publicField(this, "removeScope", () => {
62534
+ __publicField2(this, "removeScope", () => {
60421
62535
  window.removeEventListener("keydown", this.handleKeyDown);
60422
62536
  });
60423
- __publicField(this, "checkFocus", (target) => {
62537
+ __publicField2(this, "checkFocus", (target) => {
60424
62538
  if (document.activeElement !== target) {
60425
62539
  target.focus();
60426
62540
  window.requestAnimationFrame(() => this.checkFocus(target));
60427
62541
  }
60428
62542
  });
60429
- __publicField(this, "setFocus", () => {
62543
+ __publicField2(this, "setFocus", () => {
60430
62544
  const { selector } = this.options;
60431
62545
  if (!selector) {
60432
62546
  return;
@@ -60448,8 +62562,8 @@ var Scope = class {
60448
62562
  var JoyrideBeacon = class extends React__namespace.Component {
60449
62563
  constructor(props) {
60450
62564
  super(props);
60451
- __publicField(this, "beacon", null);
60452
- __publicField(this, "setBeaconRef", (c2) => {
62565
+ __publicField2(this, "beacon", null);
62566
+ __publicField2(this, "setBeaconRef", (c2) => {
60453
62567
  this.beacon = c2;
60454
62568
  });
60455
62569
  if (props.beaconComponent) {
@@ -60631,17 +62745,17 @@ var Container_default = JoyrideTooltipContainer;
60631
62745
  var JoyrideTooltip = class extends React__namespace.Component {
60632
62746
  constructor() {
60633
62747
  super(...arguments);
60634
- __publicField(this, "handleClickBack", (event) => {
62748
+ __publicField2(this, "handleClickBack", (event) => {
60635
62749
  event.preventDefault();
60636
62750
  const { helpers } = this.props;
60637
62751
  helpers.prev();
60638
62752
  });
60639
- __publicField(this, "handleClickClose", (event) => {
62753
+ __publicField2(this, "handleClickClose", (event) => {
60640
62754
  event.preventDefault();
60641
62755
  const { helpers } = this.props;
60642
62756
  helpers.close("button_close");
60643
62757
  });
60644
- __publicField(this, "handleClickPrimary", (event) => {
62758
+ __publicField2(this, "handleClickPrimary", (event) => {
60645
62759
  event.preventDefault();
60646
62760
  const { continuous: continuous2, helpers } = this.props;
60647
62761
  if (!continuous2) {
@@ -60650,12 +62764,12 @@ var JoyrideTooltip = class extends React__namespace.Component {
60650
62764
  }
60651
62765
  helpers.next();
60652
62766
  });
60653
- __publicField(this, "handleClickSkip", (event) => {
62767
+ __publicField2(this, "handleClickSkip", (event) => {
60654
62768
  event.preventDefault();
60655
62769
  const { helpers } = this.props;
60656
62770
  helpers.skip();
60657
62771
  });
60658
- __publicField(this, "getElementsProps", () => {
62772
+ __publicField2(this, "getElementsProps", () => {
60659
62773
  const { continuous: continuous2, index: index2, isLastStep, setTooltipRef, size: size2, step } = this.props;
60660
62774
  const { back, close, last: last2, next, nextLabelWithProgress, skip } = step.locale;
60661
62775
  const backText = getReactNodeText(back);
@@ -60757,19 +62871,19 @@ var JoyrideTooltip = class extends React__namespace.Component {
60757
62871
  var JoyrideStep = class extends React__namespace.Component {
60758
62872
  constructor() {
60759
62873
  super(...arguments);
60760
- __publicField(this, "scope", null);
60761
- __publicField(this, "tooltip", null);
60762
- __publicField(this, "handleClickHoverBeacon", (event) => {
62874
+ __publicField2(this, "scope", null);
62875
+ __publicField2(this, "tooltip", null);
62876
+ __publicField2(this, "handleClickHoverBeacon", (event) => {
60763
62877
  const { step, store } = this.props;
60764
62878
  if (event.type === "mouseenter" && step.event !== "hover") {
60765
62879
  return;
60766
62880
  }
60767
62881
  store.update({ lifecycle: LIFECYCLE.TOOLTIP });
60768
62882
  });
60769
- __publicField(this, "setTooltipRef", (element) => {
62883
+ __publicField2(this, "setTooltipRef", (element) => {
60770
62884
  this.tooltip = element;
60771
62885
  });
60772
- __publicField(this, "setPopper", (popper, type) => {
62886
+ __publicField2(this, "setPopper", (popper, type) => {
60773
62887
  var _a;
60774
62888
  const { action, lifecycle, step, store } = this.props;
60775
62889
  if (type === "wrapper") {
@@ -60787,7 +62901,7 @@ var JoyrideStep = class extends React__namespace.Component {
60787
62901
  step.floaterProps.getPopper(popper, type);
60788
62902
  }
60789
62903
  });
60790
- __publicField(this, "renderTooltip", (renderProps) => {
62904
+ __publicField2(this, "renderTooltip", (renderProps) => {
60791
62905
  const { continuous: continuous2, helpers, index: index2, size: size2, step } = this.props;
60792
62906
  return /* @__PURE__ */ React__namespace.createElement(
60793
62907
  JoyrideTooltip,
@@ -60959,15 +63073,15 @@ var JoyrideStep = class extends React__namespace.Component {
60959
63073
  var Joyride = class extends React__namespace.Component {
60960
63074
  constructor(props) {
60961
63075
  super(props);
60962
- __publicField(this, "helpers");
60963
- __publicField(this, "store");
60964
- __publicField(this, "callback", (data) => {
63076
+ __publicField2(this, "helpers");
63077
+ __publicField2(this, "store");
63078
+ __publicField2(this, "callback", (data) => {
60965
63079
  const { callback } = this.props;
60966
63080
  if (src_default.function(callback)) {
60967
63081
  callback(data);
60968
63082
  }
60969
63083
  });
60970
- __publicField(this, "handleKeyboard", (event) => {
63084
+ __publicField2(this, "handleKeyboard", (event) => {
60971
63085
  const { index: index2, lifecycle } = this.state;
60972
63086
  const { steps: steps2 } = this.props;
60973
63087
  const step = steps2[index2];
@@ -60977,7 +63091,7 @@ var Joyride = class extends React__namespace.Component {
60977
63091
  }
60978
63092
  }
60979
63093
  });
60980
- __publicField(this, "handleClickOverlay", () => {
63094
+ __publicField2(this, "handleClickOverlay", () => {
60981
63095
  const { index: index2 } = this.state;
60982
63096
  const { steps: steps2 } = this.props;
60983
63097
  const step = getMergedStep(this.props, steps2[index2]);
@@ -60985,7 +63099,7 @@ var Joyride = class extends React__namespace.Component {
60985
63099
  this.helpers.close("overlay");
60986
63100
  }
60987
63101
  });
60988
- __publicField(this, "syncState", (state) => {
63102
+ __publicField2(this, "syncState", (state) => {
60989
63103
  this.setState(state);
60990
63104
  });
60991
63105
  const { debug: debug2, getHelpers, run = true, stepIndex } = props;
@@ -61235,7 +63349,7 @@ var Joyride = class extends React__namespace.Component {
61235
63349
  return /* @__PURE__ */ React__namespace.createElement("div", { className: "react-joyride" }, content.step, content.overlay);
61236
63350
  }
61237
63351
  };
61238
- __publicField(Joyride, "defaultProps", defaultProps$4);
63352
+ __publicField2(Joyride, "defaultProps", defaultProps$4);
61239
63353
  var components_default = Joyride;
61240
63354
  const Tooltip$2 = ({
61241
63355
  continuous: continuous2,
@@ -86217,7 +88331,7 @@ function getDataKey(sorting, filters, hiddenColumns, search) {
86217
88331
  function useTableDataLoader2(fetchPage, fetchAll, options = { pageSize: DEFAULT_PAGE_SIZE$1 }) {
86218
88332
  const { pageSize } = options;
86219
88333
  const DATASET_SIZE = DATASET_SIZE_MULTIPLIER * pageSize;
86220
- const length = React.useRef(0);
88334
+ const length = React.useRef(void 0);
86221
88335
  const [data, setData] = React.useState({ rows: [], pages: [], cache: {}, lastFetchedPage: void 0 });
86222
88336
  const _pendingPageRequests = React.useRef({});
86223
88337
  const _lastUsedSorting = React.useRef([]);