kiban-design-system 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -9110,10 +9110,18 @@ class Locale {
9110
9110
 
9111
9111
  months(length, format = false) {
9112
9112
  return listStuff(this, length, months, () => {
9113
+ // Workaround for "ja" locale: formatToParts does not label all parts of the month
9114
+ // as "month" and for this locale there is no difference between "format" and "non-format".
9115
+ // As such, just use format() instead of formatToParts() and take the whole string
9116
+ const monthSpecialCase = this.intl === "ja" || this.intl.startsWith("ja-");
9117
+ format &= !monthSpecialCase;
9113
9118
  const intl = format ? { month: length, day: "numeric" } : { month: length },
9114
9119
  formatStr = format ? "format" : "standalone";
9115
9120
  if (!this.monthsCache[formatStr][length]) {
9116
- this.monthsCache[formatStr][length] = mapMonths((dt) => this.extract(dt, intl, "month"));
9121
+ const mapper = !monthSpecialCase
9122
+ ? (dt) => this.extract(dt, intl, "month")
9123
+ : (dt) => this.dtFormatter(dt, intl).format();
9124
+ this.monthsCache[formatStr][length] = mapMonths(mapper);
9117
9125
  }
9118
9126
  return this.monthsCache[formatStr][length];
9119
9127
  });
@@ -10099,10 +10107,24 @@ function parseMillis(fraction) {
10099
10107
  }
10100
10108
  }
10101
10109
 
10102
- function roundTo(number, digits, towardZero = false) {
10103
- const factor = 10 ** digits,
10104
- rounder = towardZero ? Math.trunc : Math.round;
10105
- return rounder(number * factor) / factor;
10110
+ function roundTo(number, digits, rounding = "round") {
10111
+ const factor = 10 ** digits;
10112
+ switch (rounding) {
10113
+ case "expand":
10114
+ return number > 0
10115
+ ? Math.ceil(number * factor) / factor
10116
+ : Math.floor(number * factor) / factor;
10117
+ case "trunc":
10118
+ return Math.trunc(number * factor) / factor;
10119
+ case "round":
10120
+ return Math.round(number * factor) / factor;
10121
+ case "floor":
10122
+ return Math.floor(number * factor) / factor;
10123
+ case "ceil":
10124
+ return Math.ceil(number * factor) / factor;
10125
+ default:
10126
+ throw new RangeError(`Value rounding ${rounding} is out of range`);
10127
+ }
10106
10128
  }
10107
10129
 
10108
10130
  // DATE BASICS
@@ -10210,7 +10232,7 @@ function signedOffset(offHourStr, offMinuteStr) {
10210
10232
 
10211
10233
  function asNumber(value) {
10212
10234
  const numericValue = Number(value);
10213
- if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue))
10235
+ if (typeof value === "boolean" || value === "" || !Number.isFinite(numericValue))
10214
10236
  throw new InvalidArgumentError(`Invalid unit value ${value}`);
10215
10237
  return numericValue;
10216
10238
  }
@@ -10469,8 +10491,12 @@ class Formatter {
10469
10491
  for (let i = 0; i < fmt.length; i++) {
10470
10492
  const c = fmt.charAt(i);
10471
10493
  if (c === "'") {
10472
- if (currentFull.length > 0) {
10473
- splits.push({ literal: bracketed || /^\s+$/.test(currentFull), val: currentFull });
10494
+ // turn '' into a literal signal quote instead of just skipping the empty literal
10495
+ if (currentFull.length > 0 || bracketed) {
10496
+ splits.push({
10497
+ literal: bracketed || /^\s+$/.test(currentFull),
10498
+ val: currentFull === "" ? "'" : currentFull,
10499
+ });
10474
10500
  }
10475
10501
  current = null;
10476
10502
  currentFull = "";
@@ -10534,7 +10560,7 @@ class Formatter {
10534
10560
  return this.dtFormatter(dt, opts).resolvedOptions();
10535
10561
  }
10536
10562
 
10537
- num(n, p = 0) {
10563
+ num(n, p = 0, signDisplay = undefined) {
10538
10564
  // we get some perf out of doing this here, annoyingly
10539
10565
  if (this.opts.forceSimple) {
10540
10566
  return padStart(n, p);
@@ -10545,6 +10571,9 @@ class Formatter {
10545
10571
  if (p > 0) {
10546
10572
  opts.padTo = p;
10547
10573
  }
10574
+ if (signDisplay) {
10575
+ opts.signDisplay = signDisplay;
10576
+ }
10548
10577
 
10549
10578
  return this.loc.numberFormatter(opts).format(n);
10550
10579
  }
@@ -10780,32 +10809,44 @@ class Formatter {
10780
10809
  }
10781
10810
 
10782
10811
  formatDurationFromString(dur, fmt) {
10812
+ const invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1;
10783
10813
  const tokenToField = (token) => {
10784
10814
  switch (token[0]) {
10785
10815
  case "S":
10786
- return "millisecond";
10816
+ return "milliseconds";
10787
10817
  case "s":
10788
- return "second";
10818
+ return "seconds";
10789
10819
  case "m":
10790
- return "minute";
10820
+ return "minutes";
10791
10821
  case "h":
10792
- return "hour";
10822
+ return "hours";
10793
10823
  case "d":
10794
- return "day";
10824
+ return "days";
10795
10825
  case "w":
10796
- return "week";
10826
+ return "weeks";
10797
10827
  case "M":
10798
- return "month";
10828
+ return "months";
10799
10829
  case "y":
10800
- return "year";
10830
+ return "years";
10801
10831
  default:
10802
10832
  return null;
10803
10833
  }
10804
10834
  },
10805
- tokenToString = (lildur) => (token) => {
10835
+ tokenToString = (lildur, info) => (token) => {
10806
10836
  const mapped = tokenToField(token);
10807
10837
  if (mapped) {
10808
- return this.num(lildur.get(mapped), token.length);
10838
+ const inversionFactor =
10839
+ info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;
10840
+ let signDisplay;
10841
+ if (this.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) {
10842
+ signDisplay = "never";
10843
+ } else if (this.opts.signMode === "all") {
10844
+ signDisplay = "always";
10845
+ } else {
10846
+ // "auto" and "negative" are the same, but "auto" has better support
10847
+ signDisplay = "auto";
10848
+ }
10849
+ return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);
10809
10850
  } else {
10810
10851
  return token;
10811
10852
  }
@@ -10815,8 +10856,14 @@ class Formatter {
10815
10856
  (found, { literal, val }) => (literal ? found : found.concat(val)),
10816
10857
  []
10817
10858
  ),
10818
- collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t));
10819
- return stringifyTokens(tokens, tokenToString(collapsed));
10859
+ collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t)),
10860
+ durationInfo = {
10861
+ isNegativeDuration: collapsed < 0,
10862
+ // this relies on "collapsed" being based on "shiftTo", which builds up the object
10863
+ // in order
10864
+ largestUnit: Object.keys(collapsed.values)[0],
10865
+ };
10866
+ return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));
10820
10867
  }
10821
10868
  }
10822
10869
 
@@ -10877,11 +10924,11 @@ function simpleParse(...keys) {
10877
10924
  }
10878
10925
 
10879
10926
  // ISO and SQL parsing
10880
- const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
10927
+ const offsetRegex = /(?:([Zz])|([+-]\d\d)(?::?(\d\d))?)/;
10881
10928
  const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
10882
10929
  const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
10883
10930
  const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
10884
- const isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`);
10931
+ const isoTimeExtensionRegex = RegExp(`(?:[Tt]${isoTimeRegex.source})?`);
10885
10932
  const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
10886
10933
  const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
10887
10934
  const isoOrdinalRegex = /(\d{4})-?(\d{3})/;
@@ -11596,9 +11643,13 @@ class Duration {
11596
11643
  * @param {string} fmt - the format string
11597
11644
  * @param {Object} opts - options
11598
11645
  * @param {boolean} [opts.floor=true] - floor numerical values
11646
+ * @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs
11599
11647
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2"
11600
11648
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002"
11601
11649
  * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000"
11650
+ * @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat("d s", { signMode: "all" }) //=> "+6 +2"
11651
+ * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "all" }) //=> "-6 -2"
11652
+ * @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "negativeLargestOnly" }) //=> "-6 2"
11602
11653
  * @return {string}
11603
11654
  */
11604
11655
  toFormat(fmt, opts = {}) {
@@ -11618,21 +11669,25 @@ class Duration {
11618
11669
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
11619
11670
  * @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
11620
11671
  * @param {string} [opts.listStyle='narrow'] - How to format the merged list. Corresponds to the `style` property of the options parameter of the native `Intl.ListFormat` constructor.
11672
+ * @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero
11621
11673
  * @example
11622
11674
  * ```js
11623
- * var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
11624
- * dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
11625
- * dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
11626
- * dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
11675
+ * var dur = Duration.fromObject({ months: 1, weeks: 0, hours: 5, minutes: 6 })
11676
+ * dur.toHuman() //=> '1 month, 0 weeks, 5 hours, 6 minutes'
11677
+ * dur.toHuman({ listStyle: "long" }) //=> '1 month, 0 weeks, 5 hours, and 6 minutes'
11678
+ * dur.toHuman({ unitDisplay: "short" }) //=> '1 mth, 0 wks, 5 hr, 6 min'
11679
+ * dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes'
11627
11680
  * ```
11628
11681
  */
11629
11682
  toHuman(opts = {}) {
11630
11683
  if (!this.isValid) return INVALID$2;
11631
11684
 
11685
+ const showZeros = opts.showZeros !== false;
11686
+
11632
11687
  const l = orderedUnits$1
11633
11688
  .map((unit) => {
11634
11689
  const val = this.values[unit];
11635
- if (isUndefined(val)) {
11690
+ if (isUndefined(val) || (val === 0 && !showZeros)) {
11636
11691
  return null;
11637
11692
  }
11638
11693
  return this.loc
@@ -11992,6 +12047,17 @@ class Duration {
11992
12047
  return clone$2(this, { values: negated }, true);
11993
12048
  }
11994
12049
 
12050
+ /**
12051
+ * Removes all units with values equal to 0 from this Duration.
12052
+ * @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 }
12053
+ * @return {Duration}
12054
+ */
12055
+ removeZeros() {
12056
+ if (!this.isValid) return this;
12057
+ const vals = removeZeroes(this.values);
12058
+ return clone$2(this, { values: vals }, true);
12059
+ }
12060
+
11995
12061
  /**
11996
12062
  * Get the years.
11997
12063
  * @type {number}
@@ -12302,7 +12368,8 @@ class Interval {
12302
12368
  }
12303
12369
 
12304
12370
  /**
12305
- * Returns the end of the Interval
12371
+ * Returns the end of the Interval. This is the first instant which is not part of the interval
12372
+ * (Interval is half-open).
12306
12373
  * @type {DateTime}
12307
12374
  */
12308
12375
  get end() {
@@ -13733,21 +13800,22 @@ function toTechFormat(dt, format, allowZ = true) {
13733
13800
  : null;
13734
13801
  }
13735
13802
 
13736
- function toISODate(o, extended) {
13803
+ function toISODate(o, extended, precision) {
13737
13804
  const longFormat = o.c.year > 9999 || o.c.year < 0;
13738
13805
  let c = "";
13739
13806
  if (longFormat && o.c.year >= 0) c += "+";
13740
13807
  c += padStart(o.c.year, longFormat ? 6 : 4);
13741
-
13808
+ if (precision === "year") return c;
13742
13809
  if (extended) {
13743
13810
  c += "-";
13744
13811
  c += padStart(o.c.month);
13812
+ if (precision === "month") return c;
13745
13813
  c += "-";
13746
- c += padStart(o.c.day);
13747
13814
  } else {
13748
13815
  c += padStart(o.c.month);
13749
- c += padStart(o.c.day);
13816
+ if (precision === "month") return c;
13750
13817
  }
13818
+ c += padStart(o.c.day);
13751
13819
  return c;
13752
13820
  }
13753
13821
 
@@ -13757,26 +13825,39 @@ function toISOTime(
13757
13825
  suppressSeconds,
13758
13826
  suppressMilliseconds,
13759
13827
  includeOffset,
13760
- extendedZone
13828
+ extendedZone,
13829
+ precision
13761
13830
  ) {
13762
- let c = padStart(o.c.hour);
13763
- if (extended) {
13764
- c += ":";
13765
- c += padStart(o.c.minute);
13766
- if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
13767
- c += ":";
13768
- }
13769
- } else {
13770
- c += padStart(o.c.minute);
13771
- }
13772
-
13773
- if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
13774
- c += padStart(o.c.second);
13775
-
13776
- if (o.c.millisecond !== 0 || !suppressMilliseconds) {
13777
- c += ".";
13778
- c += padStart(o.c.millisecond, 3);
13779
- }
13831
+ let showSeconds = !suppressSeconds || o.c.millisecond !== 0 || o.c.second !== 0,
13832
+ c = "";
13833
+ switch (precision) {
13834
+ case "day":
13835
+ case "month":
13836
+ case "year":
13837
+ break;
13838
+ default:
13839
+ c += padStart(o.c.hour);
13840
+ if (precision === "hour") break;
13841
+ if (extended) {
13842
+ c += ":";
13843
+ c += padStart(o.c.minute);
13844
+ if (precision === "minute") break;
13845
+ if (showSeconds) {
13846
+ c += ":";
13847
+ c += padStart(o.c.second);
13848
+ }
13849
+ } else {
13850
+ c += padStart(o.c.minute);
13851
+ if (precision === "minute") break;
13852
+ if (showSeconds) {
13853
+ c += padStart(o.c.second);
13854
+ }
13855
+ }
13856
+ if (precision === "second") break;
13857
+ if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {
13858
+ c += ".";
13859
+ c += padStart(o.c.millisecond, 3);
13860
+ }
13780
13861
  }
13781
13862
 
13782
13863
  if (includeOffset) {
@@ -13968,8 +14049,9 @@ function quickDT(obj, opts) {
13968
14049
 
13969
14050
  function diffRelative(start, end, opts) {
13970
14051
  const round = isUndefined(opts.round) ? true : opts.round,
14052
+ rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding,
13971
14053
  format = (c, unit) => {
13972
- c = roundTo(c, round || opts.calendary ? 0 : 2, true);
14054
+ c = roundTo(c, round || opts.calendary ? 0 : 2, opts.calendary ? "round" : rounding);
13973
14055
  const formatter = end.loc.clone(opts).relFormatter(opts);
13974
14056
  return formatter.format(c, unit);
13975
14057
  },
@@ -15348,10 +15430,13 @@ class DateTime {
15348
15430
  * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
15349
15431
  * @param {boolean} [opts.extendedZone=false] - add the time zone format extension
15350
15432
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
15433
+ * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'years', 'months', 'days', 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.
15351
15434
  * @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
15352
15435
  * @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
15353
15436
  * @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
15354
15437
  * @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
15438
+ * @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z'
15439
+ * @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z'
15355
15440
  * @return {string|null}
15356
15441
  */
15357
15442
  toISO({
@@ -15360,16 +15445,26 @@ class DateTime {
15360
15445
  suppressMilliseconds = false,
15361
15446
  includeOffset = true,
15362
15447
  extendedZone = false,
15448
+ precision = "milliseconds",
15363
15449
  } = {}) {
15364
15450
  if (!this.isValid) {
15365
15451
  return null;
15366
15452
  }
15367
15453
 
15454
+ precision = normalizeUnit(precision);
15368
15455
  const ext = format === "extended";
15369
15456
 
15370
- let c = toISODate(this, ext);
15371
- c += "T";
15372
- c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
15457
+ let c = toISODate(this, ext, precision);
15458
+ if (orderedUnits.indexOf(precision) >= 3) c += "T";
15459
+ c += toISOTime(
15460
+ this,
15461
+ ext,
15462
+ suppressSeconds,
15463
+ suppressMilliseconds,
15464
+ includeOffset,
15465
+ extendedZone,
15466
+ precision
15467
+ );
15373
15468
  return c;
15374
15469
  }
15375
15470
 
@@ -15377,16 +15472,17 @@ class DateTime {
15377
15472
  * Returns an ISO 8601-compliant string representation of this DateTime's date component
15378
15473
  * @param {Object} opts - options
15379
15474
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
15475
+ * @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'.
15380
15476
  * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
15381
15477
  * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
15478
+ * @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'
15382
15479
  * @return {string|null}
15383
15480
  */
15384
- toISODate({ format = "extended" } = {}) {
15481
+ toISODate({ format = "extended", precision = "day" } = {}) {
15385
15482
  if (!this.isValid) {
15386
15483
  return null;
15387
15484
  }
15388
-
15389
- return toISODate(this, format === "extended");
15485
+ return toISODate(this, format === "extended", normalizeUnit(precision));
15390
15486
  }
15391
15487
 
15392
15488
  /**
@@ -15407,10 +15503,12 @@ class DateTime {
15407
15503
  * @param {boolean} [opts.extendedZone=true] - add the time zone format extension
15408
15504
  * @param {boolean} [opts.includePrefix=false] - include the `T` prefix
15409
15505
  * @param {string} [opts.format='extended'] - choose between the basic and extended format
15506
+ * @param {string} [opts.precision='milliseconds'] - truncate output to desired presicion: 'hours', 'minutes', 'seconds' or 'milliseconds'. When precision and suppressSeconds or suppressMilliseconds are used together, precision sets the maximum unit shown in the output, however seconds or milliseconds will still be suppressed if they are 0.
15410
15507
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
15411
15508
  * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'
15412
15509
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'
15413
15510
  * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
15511
+ * @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z'
15414
15512
  * @return {string}
15415
15513
  */
15416
15514
  toISOTime({
@@ -15420,12 +15518,14 @@ class DateTime {
15420
15518
  includePrefix = false,
15421
15519
  extendedZone = false,
15422
15520
  format = "extended",
15521
+ precision = "milliseconds",
15423
15522
  } = {}) {
15424
15523
  if (!this.isValid) {
15425
15524
  return null;
15426
15525
  }
15427
15526
 
15428
- let c = includePrefix ? "T" : "";
15527
+ precision = normalizeUnit(precision);
15528
+ let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : "";
15429
15529
  return (
15430
15530
  c +
15431
15531
  toISOTime(
@@ -15434,7 +15534,8 @@ class DateTime {
15434
15534
  suppressSeconds,
15435
15535
  suppressMilliseconds,
15436
15536
  includeOffset,
15437
- extendedZone
15537
+ extendedZone,
15538
+ precision
15438
15539
  )
15439
15540
  );
15440
15541
  }
@@ -15712,12 +15813,13 @@ class DateTime {
15712
15813
 
15713
15814
  /**
15714
15815
  * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your
15715
- * platform supports Intl.RelativeTimeFormat. Rounds down by default.
15816
+ * platform supports Intl.RelativeTimeFormat. Rounds towards zero by default.
15716
15817
  * @param {Object} options - options that affect the output
15717
15818
  * @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
15718
15819
  * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow"
15719
15820
  * @param {string|string[]} options.unit - use a specific unit or array of units; if omitted, or an array, the method will pick the best unit. Use an array or one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds"
15720
15821
  * @param {boolean} [options.round=true] - whether to round the numbers in the output.
15822
+ * @param {string} [options.rounding="trunc"] - rounding method to use when rounding the numbers in the output. Can be "trunc" (toward zero), "expand" (away from zero), "round", "floor", or "ceil".
15721
15823
  * @param {number} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding.
15722
15824
  * @param {string} options.locale - override the locale of this DateTime
15723
15825
  * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
@@ -37398,493 +37500,8 @@ const Header$1 = ({
37398
37500
  });
37399
37501
  };
37400
37502
 
37401
- var dist = {};
37402
-
37403
- var hasRequiredDist;
37404
-
37405
- function requireDist () {
37406
- if (hasRequiredDist) return dist;
37407
- hasRequiredDist = 1;
37408
- Object.defineProperty(dist, "__esModule", { value: true });
37409
- dist.parse = parse;
37410
- dist.serialize = serialize;
37411
- /**
37412
- * RegExp to match cookie-name in RFC 6265 sec 4.1.1
37413
- * This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
37414
- * which has been replaced by the token definition in RFC 7230 appendix B.
37415
- *
37416
- * cookie-name = token
37417
- * token = 1*tchar
37418
- * tchar = "!" / "#" / "$" / "%" / "&" / "'" /
37419
- * "*" / "+" / "-" / "." / "^" / "_" /
37420
- * "`" / "|" / "~" / DIGIT / ALPHA
37421
- *
37422
- * Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
37423
- * Allow same range as cookie value, except `=`, which delimits end of name.
37424
- */
37425
- const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
37426
- /**
37427
- * RegExp to match cookie-value in RFC 6265 sec 4.1.1
37428
- *
37429
- * cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
37430
- * cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
37431
- * ; US-ASCII characters excluding CTLs,
37432
- * ; whitespace DQUOTE, comma, semicolon,
37433
- * ; and backslash
37434
- *
37435
- * Allowing more characters: https://github.com/jshttp/cookie/issues/191
37436
- * Comma, backslash, and DQUOTE are not part of the parsing algorithm.
37437
- */
37438
- const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
37439
- /**
37440
- * RegExp to match domain-value in RFC 6265 sec 4.1.1
37441
- *
37442
- * domain-value = <subdomain>
37443
- * ; defined in [RFC1034], Section 3.5, as
37444
- * ; enhanced by [RFC1123], Section 2.1
37445
- * <subdomain> = <label> | <subdomain> "." <label>
37446
- * <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
37447
- * Labels must be 63 characters or less.
37448
- * 'let-dig' not 'letter' in the first char, per RFC1123
37449
- * <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
37450
- * <let-dig-hyp> = <let-dig> | "-"
37451
- * <let-dig> = <letter> | <digit>
37452
- * <letter> = any one of the 52 alphabetic characters A through Z in
37453
- * upper case and a through z in lower case
37454
- * <digit> = any one of the ten digits 0 through 9
37455
- *
37456
- * Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
37457
- *
37458
- * > (Note that a leading %x2E ("."), if present, is ignored even though that
37459
- * character is not permitted, but a trailing %x2E ("."), if present, will
37460
- * cause the user agent to ignore the attribute.)
37461
- */
37462
- const domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
37463
- /**
37464
- * RegExp to match path-value in RFC 6265 sec 4.1.1
37465
- *
37466
- * path-value = <any CHAR except CTLs or ";">
37467
- * CHAR = %x01-7F
37468
- * ; defined in RFC 5234 appendix B.1
37469
- */
37470
- const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
37471
- const __toString = Object.prototype.toString;
37472
- const NullObject = /* @__PURE__ */ (() => {
37473
- const C = function () { };
37474
- C.prototype = Object.create(null);
37475
- return C;
37476
- })();
37477
- /**
37478
- * Parse a cookie header.
37479
- *
37480
- * Parse the given cookie header string into an object
37481
- * The object has the various cookies as keys(names) => values
37482
- */
37483
- function parse(str, options) {
37484
- const obj = new NullObject();
37485
- const len = str.length;
37486
- // RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
37487
- if (len < 2)
37488
- return obj;
37489
- const dec = options?.decode || decode;
37490
- let index = 0;
37491
- do {
37492
- const eqIdx = str.indexOf("=", index);
37493
- if (eqIdx === -1)
37494
- break; // No more cookie pairs.
37495
- const colonIdx = str.indexOf(";", index);
37496
- const endIdx = colonIdx === -1 ? len : colonIdx;
37497
- if (eqIdx > endIdx) {
37498
- // backtrack on prior semicolon
37499
- index = str.lastIndexOf(";", eqIdx - 1) + 1;
37500
- continue;
37501
- }
37502
- const keyStartIdx = startIndex(str, index, eqIdx);
37503
- const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
37504
- const key = str.slice(keyStartIdx, keyEndIdx);
37505
- // only assign once
37506
- if (obj[key] === undefined) {
37507
- let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
37508
- let valEndIdx = endIndex(str, endIdx, valStartIdx);
37509
- const value = dec(str.slice(valStartIdx, valEndIdx));
37510
- obj[key] = value;
37511
- }
37512
- index = endIdx + 1;
37513
- } while (index < len);
37514
- return obj;
37515
- }
37516
- function startIndex(str, index, max) {
37517
- do {
37518
- const code = str.charCodeAt(index);
37519
- if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
37520
- return index;
37521
- } while (++index < max);
37522
- return max;
37523
- }
37524
- function endIndex(str, index, min) {
37525
- while (index > min) {
37526
- const code = str.charCodeAt(--index);
37527
- if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
37528
- return index + 1;
37529
- }
37530
- return min;
37531
- }
37532
- /**
37533
- * Serialize data into a cookie header.
37534
- *
37535
- * Serialize a name value pair into a cookie string suitable for
37536
- * http headers. An optional options object specifies cookie parameters.
37537
- *
37538
- * serialize('foo', 'bar', { httpOnly: true })
37539
- * => "foo=bar; httpOnly"
37540
- */
37541
- function serialize(name, val, options) {
37542
- const enc = options?.encode || encodeURIComponent;
37543
- if (!cookieNameRegExp.test(name)) {
37544
- throw new TypeError(`argument name is invalid: ${name}`);
37545
- }
37546
- const value = enc(val);
37547
- if (!cookieValueRegExp.test(value)) {
37548
- throw new TypeError(`argument val is invalid: ${val}`);
37549
- }
37550
- let str = name + "=" + value;
37551
- if (!options)
37552
- return str;
37553
- if (options.maxAge !== undefined) {
37554
- if (!Number.isInteger(options.maxAge)) {
37555
- throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
37556
- }
37557
- str += "; Max-Age=" + options.maxAge;
37558
- }
37559
- if (options.domain) {
37560
- if (!domainValueRegExp.test(options.domain)) {
37561
- throw new TypeError(`option domain is invalid: ${options.domain}`);
37562
- }
37563
- str += "; Domain=" + options.domain;
37564
- }
37565
- if (options.path) {
37566
- if (!pathValueRegExp.test(options.path)) {
37567
- throw new TypeError(`option path is invalid: ${options.path}`);
37568
- }
37569
- str += "; Path=" + options.path;
37570
- }
37571
- if (options.expires) {
37572
- if (!isDate(options.expires) ||
37573
- !Number.isFinite(options.expires.valueOf())) {
37574
- throw new TypeError(`option expires is invalid: ${options.expires}`);
37575
- }
37576
- str += "; Expires=" + options.expires.toUTCString();
37577
- }
37578
- if (options.httpOnly) {
37579
- str += "; HttpOnly";
37580
- }
37581
- if (options.secure) {
37582
- str += "; Secure";
37583
- }
37584
- if (options.partitioned) {
37585
- str += "; Partitioned";
37586
- }
37587
- if (options.priority) {
37588
- const priority = typeof options.priority === "string"
37589
- ? options.priority.toLowerCase()
37590
- : undefined;
37591
- switch (priority) {
37592
- case "low":
37593
- str += "; Priority=Low";
37594
- break;
37595
- case "medium":
37596
- str += "; Priority=Medium";
37597
- break;
37598
- case "high":
37599
- str += "; Priority=High";
37600
- break;
37601
- default:
37602
- throw new TypeError(`option priority is invalid: ${options.priority}`);
37603
- }
37604
- }
37605
- if (options.sameSite) {
37606
- const sameSite = typeof options.sameSite === "string"
37607
- ? options.sameSite.toLowerCase()
37608
- : options.sameSite;
37609
- switch (sameSite) {
37610
- case true:
37611
- case "strict":
37612
- str += "; SameSite=Strict";
37613
- break;
37614
- case "lax":
37615
- str += "; SameSite=Lax";
37616
- break;
37617
- case "none":
37618
- str += "; SameSite=None";
37619
- break;
37620
- default:
37621
- throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
37622
- }
37623
- }
37624
- return str;
37625
- }
37626
- /**
37627
- * URL-decode string value. Optimized to skip native call when no %.
37628
- */
37629
- function decode(str) {
37630
- if (str.indexOf("%") === -1)
37631
- return str;
37632
- try {
37633
- return decodeURIComponent(str);
37634
- }
37635
- catch (e) {
37636
- return str;
37637
- }
37638
- }
37639
- /**
37640
- * Determine if value is a Date.
37641
- */
37642
- function isDate(val) {
37643
- return __toString.call(val) === "[object Date]";
37644
- }
37645
-
37646
- return dist;
37647
- }
37648
-
37649
- requireDist();
37650
-
37651
- var setCookie = {exports: {}};
37652
-
37653
- var hasRequiredSetCookie;
37654
-
37655
- function requireSetCookie () {
37656
- if (hasRequiredSetCookie) return setCookie.exports;
37657
- hasRequiredSetCookie = 1;
37658
-
37659
- var defaultParseOptions = {
37660
- decodeValues: true,
37661
- map: false,
37662
- silent: false,
37663
- };
37664
-
37665
- function isNonEmptyString(str) {
37666
- return typeof str === "string" && !!str.trim();
37667
- }
37668
-
37669
- function parseString(setCookieValue, options) {
37670
- var parts = setCookieValue.split(";").filter(isNonEmptyString);
37671
-
37672
- var nameValuePairStr = parts.shift();
37673
- var parsed = parseNameValuePair(nameValuePairStr);
37674
- var name = parsed.name;
37675
- var value = parsed.value;
37676
-
37677
- options = options
37678
- ? Object.assign({}, defaultParseOptions, options)
37679
- : defaultParseOptions;
37680
-
37681
- try {
37682
- value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value
37683
- } catch (e) {
37684
- console.error(
37685
- "set-cookie-parser encountered an error while decoding a cookie with value '" +
37686
- value +
37687
- "'. Set options.decodeValues to false to disable this feature.",
37688
- e
37689
- );
37690
- }
37691
-
37692
- var cookie = {
37693
- name: name,
37694
- value: value,
37695
- };
37696
-
37697
- parts.forEach(function (part) {
37698
- var sides = part.split("=");
37699
- var key = sides.shift().trimLeft().toLowerCase();
37700
- var value = sides.join("=");
37701
- if (key === "expires") {
37702
- cookie.expires = new Date(value);
37703
- } else if (key === "max-age") {
37704
- cookie.maxAge = parseInt(value, 10);
37705
- } else if (key === "secure") {
37706
- cookie.secure = true;
37707
- } else if (key === "httponly") {
37708
- cookie.httpOnly = true;
37709
- } else if (key === "samesite") {
37710
- cookie.sameSite = value;
37711
- } else if (key === "partitioned") {
37712
- cookie.partitioned = true;
37713
- } else {
37714
- cookie[key] = value;
37715
- }
37716
- });
37717
-
37718
- return cookie;
37719
- }
37720
-
37721
- function parseNameValuePair(nameValuePairStr) {
37722
- // Parses name-value-pair according to rfc6265bis draft
37723
-
37724
- var name = "";
37725
- var value = "";
37726
- var nameValueArr = nameValuePairStr.split("=");
37727
- if (nameValueArr.length > 1) {
37728
- name = nameValueArr.shift();
37729
- value = nameValueArr.join("="); // everything after the first =, joined by a "=" if there was more than one part
37730
- } else {
37731
- value = nameValuePairStr;
37732
- }
37733
-
37734
- return { name: name, value: value };
37735
- }
37736
-
37737
- function parse(input, options) {
37738
- options = options
37739
- ? Object.assign({}, defaultParseOptions, options)
37740
- : defaultParseOptions;
37741
-
37742
- if (!input) {
37743
- if (!options.map) {
37744
- return [];
37745
- } else {
37746
- return {};
37747
- }
37748
- }
37749
-
37750
- if (input.headers) {
37751
- if (typeof input.headers.getSetCookie === "function") {
37752
- // for fetch responses - they combine headers of the same type in the headers array,
37753
- // but getSetCookie returns an uncombined array
37754
- input = input.headers.getSetCookie();
37755
- } else if (input.headers["set-cookie"]) {
37756
- // fast-path for node.js (which automatically normalizes header names to lower-case
37757
- input = input.headers["set-cookie"];
37758
- } else {
37759
- // slow-path for other environments - see #25
37760
- var sch =
37761
- input.headers[
37762
- Object.keys(input.headers).find(function (key) {
37763
- return key.toLowerCase() === "set-cookie";
37764
- })
37765
- ];
37766
- // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36
37767
- if (!sch && input.headers.cookie && !options.silent) {
37768
- console.warn(
37769
- "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."
37770
- );
37771
- }
37772
- input = sch;
37773
- }
37774
- }
37775
- if (!Array.isArray(input)) {
37776
- input = [input];
37777
- }
37778
-
37779
- if (!options.map) {
37780
- return input.filter(isNonEmptyString).map(function (str) {
37781
- return parseString(str, options);
37782
- });
37783
- } else {
37784
- var cookies = {};
37785
- return input.filter(isNonEmptyString).reduce(function (cookies, str) {
37786
- var cookie = parseString(str, options);
37787
- cookies[cookie.name] = cookie;
37788
- return cookies;
37789
- }, cookies);
37790
- }
37791
- }
37792
-
37793
- /*
37794
- Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas
37795
- that are within a single set-cookie field-value, such as in the Expires portion.
37796
-
37797
- This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2
37798
- Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128
37799
- React Native's fetch does this for *every* header, including set-cookie.
37800
-
37801
- Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25
37802
- Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation
37803
- */
37804
- function splitCookiesString(cookiesString) {
37805
- if (Array.isArray(cookiesString)) {
37806
- return cookiesString;
37807
- }
37808
- if (typeof cookiesString !== "string") {
37809
- return [];
37810
- }
37811
-
37812
- var cookiesStrings = [];
37813
- var pos = 0;
37814
- var start;
37815
- var ch;
37816
- var lastComma;
37817
- var nextStart;
37818
- var cookiesSeparatorFound;
37819
-
37820
- function skipWhitespace() {
37821
- while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {
37822
- pos += 1;
37823
- }
37824
- return pos < cookiesString.length;
37825
- }
37826
-
37827
- function notSpecialChar() {
37828
- ch = cookiesString.charAt(pos);
37829
-
37830
- return ch !== "=" && ch !== ";" && ch !== ",";
37831
- }
37832
-
37833
- while (pos < cookiesString.length) {
37834
- start = pos;
37835
- cookiesSeparatorFound = false;
37836
-
37837
- while (skipWhitespace()) {
37838
- ch = cookiesString.charAt(pos);
37839
- if (ch === ",") {
37840
- // ',' is a cookie separator if we have later first '=', not ';' or ','
37841
- lastComma = pos;
37842
- pos += 1;
37843
-
37844
- skipWhitespace();
37845
- nextStart = pos;
37846
-
37847
- while (pos < cookiesString.length && notSpecialChar()) {
37848
- pos += 1;
37849
- }
37850
-
37851
- // currently special character
37852
- if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {
37853
- // we found cookies separator
37854
- cookiesSeparatorFound = true;
37855
- // pos is inside the next cookie, so back up and return it.
37856
- pos = nextStart;
37857
- cookiesStrings.push(cookiesString.substring(start, lastComma));
37858
- start = pos;
37859
- } else {
37860
- // in param ',' or param separator ';',
37861
- // we continue from that comma
37862
- pos = lastComma + 1;
37863
- }
37864
- } else {
37865
- pos += 1;
37866
- }
37867
- }
37868
-
37869
- if (!cookiesSeparatorFound || pos >= cookiesString.length) {
37870
- cookiesStrings.push(cookiesString.substring(start, cookiesString.length));
37871
- }
37872
- }
37873
-
37874
- return cookiesStrings;
37875
- }
37876
-
37877
- setCookie.exports = parse;
37878
- setCookie.exports.parse = parse;
37879
- setCookie.exports.parseString = parseString;
37880
- setCookie.exports.splitCookiesString = splitCookiesString;
37881
- return setCookie.exports;
37882
- }
37883
-
37884
- requireSetCookie();
37885
-
37886
37503
  /**
37887
- * react-router v7.6.2
37504
+ * react-router v7.8.1
37888
37505
  *
37889
37506
  * Copyright (c) Remix Software Inc.
37890
37507
  *
@@ -38083,12 +37700,12 @@ function createBrowserURLImpl(to, isAbsolute = false) {
38083
37700
  base = window.location.origin !== "null" ? window.location.origin : window.location.href;
38084
37701
  }
38085
37702
  invariant(base, "No window.location.(origin|href) available to create URL");
38086
- let href2 = typeof to === "string" ? to : createPath(to);
38087
- href2 = href2.replace(/ $/, "%20");
38088
- if (!isAbsolute && href2.startsWith("//")) {
38089
- href2 = base + href2;
37703
+ let href = typeof to === "string" ? to : createPath(to);
37704
+ href = href.replace(/ $/, "%20");
37705
+ if (!isAbsolute && href.startsWith("//")) {
37706
+ href = base + href;
38090
37707
  }
38091
- return new URL(href2, base);
37708
+ return new URL(href, base);
38092
37709
  }
38093
37710
  function matchRoutes(routes, locationArg, basename = "/") {
38094
37711
  return matchRoutesImpl(routes, locationArg, basename, false);
@@ -38112,8 +37729,8 @@ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
38112
37729
  }
38113
37730
  return matches;
38114
37731
  }
38115
- function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
38116
- let flattenRoute = (route, index, relativePath) => {
37732
+ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
37733
+ let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
38117
37734
  let meta = {
38118
37735
  relativePath: relativePath === void 0 ? route.path || "" : relativePath,
38119
37736
  caseSensitive: route.caseSensitive === true,
@@ -38121,6 +37738,9 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
38121
37738
  route
38122
37739
  };
38123
37740
  if (meta.relativePath.startsWith("/")) {
37741
+ if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
37742
+ return;
37743
+ }
38124
37744
  invariant(
38125
37745
  meta.relativePath.startsWith(parentPath),
38126
37746
  `Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
@@ -38136,7 +37756,13 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
38136
37756
  route.index !== true,
38137
37757
  `Index routes must not have child routes. Please remove all child routes from route path "${path}".`
38138
37758
  );
38139
- flattenRoutes(route.children, branches, routesMeta, path);
37759
+ flattenRoutes(
37760
+ route.children,
37761
+ branches,
37762
+ routesMeta,
37763
+ path,
37764
+ hasParentOptionalSegments
37765
+ );
38140
37766
  }
38141
37767
  if (route.path == null && !route.index) {
38142
37768
  return;
@@ -38152,7 +37778,7 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "")
38152
37778
  flattenRoute(route, index);
38153
37779
  } else {
38154
37780
  for (let exploded of explodeOptionalSegments(route.path)) {
38155
- flattenRoute(route, index, exploded);
37781
+ flattenRoute(route, index, true, exploded);
38156
37782
  }
38157
37783
  }
38158
37784
  });
@@ -38316,7 +37942,7 @@ function compilePath(path, caseSensitive = false, end = true) {
38316
37942
  params.push({ paramName, isOptional: isOptional != null });
38317
37943
  return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
38318
37944
  }
38319
- );
37945
+ ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
38320
37946
  if (path.endsWith("*")) {
38321
37947
  params.push({ paramName: "*" });
38322
37948
  regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
@@ -38463,6 +38089,7 @@ var DataRouterContext = React2__namespace.createContext(null);
38463
38089
  DataRouterContext.displayName = "DataRouter";
38464
38090
  var DataRouterStateContext = React2__namespace.createContext(null);
38465
38091
  DataRouterStateContext.displayName = "DataRouterState";
38092
+ React2__namespace.createContext(false);
38466
38093
  var ViewTransitionContext = React2__namespace.createContext({
38467
38094
  isTransitioning: false
38468
38095
  });
@@ -38781,68 +38408,71 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, fut
38781
38408
  }
38782
38409
  }
38783
38410
  }
38784
- return renderedMatches.reduceRight((outlet, match, index) => {
38785
- let error;
38786
- let shouldRenderHydrateFallback = false;
38787
- let errorElement = null;
38788
- let hydrateFallbackElement = null;
38789
- if (dataRouterState) {
38790
- error = errors && match.route.id ? errors[match.route.id] : void 0;
38791
- errorElement = match.route.errorElement || defaultErrorElement;
38792
- if (renderFallback) {
38793
- if (fallbackIndex < 0 && index === 0) {
38794
- warningOnce(
38795
- "route-fallback",
38796
- false,
38797
- "No `HydrateFallback` element provided to render during initial hydration"
38798
- );
38799
- shouldRenderHydrateFallback = true;
38800
- hydrateFallbackElement = null;
38801
- } else if (fallbackIndex === index) {
38802
- shouldRenderHydrateFallback = true;
38803
- hydrateFallbackElement = match.route.hydrateFallbackElement || null;
38411
+ return renderedMatches.reduceRight(
38412
+ (outlet, match, index) => {
38413
+ let error;
38414
+ let shouldRenderHydrateFallback = false;
38415
+ let errorElement = null;
38416
+ let hydrateFallbackElement = null;
38417
+ if (dataRouterState) {
38418
+ error = errors && match.route.id ? errors[match.route.id] : void 0;
38419
+ errorElement = match.route.errorElement || defaultErrorElement;
38420
+ if (renderFallback) {
38421
+ if (fallbackIndex < 0 && index === 0) {
38422
+ warningOnce(
38423
+ "route-fallback",
38424
+ false,
38425
+ "No `HydrateFallback` element provided to render during initial hydration"
38426
+ );
38427
+ shouldRenderHydrateFallback = true;
38428
+ hydrateFallbackElement = null;
38429
+ } else if (fallbackIndex === index) {
38430
+ shouldRenderHydrateFallback = true;
38431
+ hydrateFallbackElement = match.route.hydrateFallbackElement || null;
38432
+ }
38804
38433
  }
38805
38434
  }
38806
- }
38807
- let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
38808
- let getChildren = () => {
38809
- let children;
38810
- if (error) {
38811
- children = errorElement;
38812
- } else if (shouldRenderHydrateFallback) {
38813
- children = hydrateFallbackElement;
38814
- } else if (match.route.Component) {
38815
- children = /* @__PURE__ */ React2__namespace.createElement(match.route.Component, null);
38816
- } else if (match.route.element) {
38817
- children = match.route.element;
38818
- } else {
38819
- children = outlet;
38820
- }
38821
- return /* @__PURE__ */ React2__namespace.createElement(
38822
- RenderedRoute,
38435
+ let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
38436
+ let getChildren = () => {
38437
+ let children;
38438
+ if (error) {
38439
+ children = errorElement;
38440
+ } else if (shouldRenderHydrateFallback) {
38441
+ children = hydrateFallbackElement;
38442
+ } else if (match.route.Component) {
38443
+ children = /* @__PURE__ */ React2__namespace.createElement(match.route.Component, null);
38444
+ } else if (match.route.element) {
38445
+ children = match.route.element;
38446
+ } else {
38447
+ children = outlet;
38448
+ }
38449
+ return /* @__PURE__ */ React2__namespace.createElement(
38450
+ RenderedRoute,
38451
+ {
38452
+ match,
38453
+ routeContext: {
38454
+ outlet,
38455
+ matches: matches2,
38456
+ isDataRoute: dataRouterState != null
38457
+ },
38458
+ children
38459
+ }
38460
+ );
38461
+ };
38462
+ return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React2__namespace.createElement(
38463
+ RenderErrorBoundary,
38823
38464
  {
38824
- match,
38825
- routeContext: {
38826
- outlet,
38827
- matches: matches2,
38828
- isDataRoute: dataRouterState != null
38829
- },
38830
- children
38465
+ location: dataRouterState.location,
38466
+ revalidation: dataRouterState.revalidation,
38467
+ component: errorElement,
38468
+ error,
38469
+ children: getChildren(),
38470
+ routeContext: { outlet: null, matches: matches2, isDataRoute: true }
38831
38471
  }
38832
- );
38833
- };
38834
- return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React2__namespace.createElement(
38835
- RenderErrorBoundary,
38836
- {
38837
- location: dataRouterState.location,
38838
- revalidation: dataRouterState.revalidation,
38839
- component: errorElement,
38840
- error,
38841
- children: getChildren(),
38842
- routeContext: { outlet: null, matches: matches2, isDataRoute: true }
38843
- }
38844
- ) : getChildren();
38845
- }, null);
38472
+ ) : getChildren();
38473
+ },
38474
+ null
38475
+ );
38846
38476
  }
38847
38477
  function getDataRouterConsoleError(hookName) {
38848
38478
  return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
@@ -39081,6 +38711,7 @@ function getFormSubmissionInfo(target, basename) {
39081
38711
  }
39082
38712
  return { action, method: method.toLowerCase(), encType, formData, body };
39083
38713
  }
38714
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
39084
38715
 
39085
38716
  // lib/dom/ssr/invariant.ts
39086
38717
  function invariant2(value, message) {
@@ -39088,6 +38719,22 @@ function invariant2(value, message) {
39088
38719
  throw new Error(message);
39089
38720
  }
39090
38721
  }
38722
+ function singleFetchUrl(reqUrl, basename, extension) {
38723
+ let url = typeof reqUrl === "string" ? new URL(
38724
+ reqUrl,
38725
+ // This can be called during the SSR flow via PrefetchPageLinksImpl so
38726
+ // don't assume window is available
38727
+ typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
38728
+ ) : reqUrl;
38729
+ if (url.pathname === "/") {
38730
+ url.pathname = `_root.${extension}`;
38731
+ } else if (basename && stripBasename(url.pathname, basename) === "/") {
38732
+ url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
38733
+ } else {
38734
+ url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
38735
+ }
38736
+ return url;
38737
+ }
39091
38738
 
39092
38739
  // lib/dom/ssr/routeModules.ts
39093
38740
  async function loadRouteModule(route, routeModulesCache) {
@@ -39234,24 +38881,6 @@ function dedupeLinkDescriptors(descriptors, preloads) {
39234
38881
  return deduped;
39235
38882
  }, []);
39236
38883
  }
39237
- Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
39238
- var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
39239
- function singleFetchUrl(reqUrl, basename) {
39240
- let url = typeof reqUrl === "string" ? new URL(
39241
- reqUrl,
39242
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
39243
- // don't assume window is available
39244
- typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
39245
- ) : reqUrl;
39246
- if (url.pathname === "/") {
39247
- url.pathname = "_root.data";
39248
- } else if (basename && stripBasename(url.pathname, basename) === "/") {
39249
- url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
39250
- } else {
39251
- url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
39252
- }
39253
- return url;
39254
- }
39255
38884
 
39256
38885
  // lib/dom/ssr/components.tsx
39257
38886
  function useDataRouterContext2() {
@@ -39346,10 +38975,7 @@ function composeEventHandlers(theirHandler, ourHandler) {
39346
38975
  }
39347
38976
  };
39348
38977
  }
39349
- function PrefetchPageLinks({
39350
- page,
39351
- ...dataLinkProps
39352
- }) {
38978
+ function PrefetchPageLinks({ page, ...linkProps }) {
39353
38979
  let { router } = useDataRouterContext2();
39354
38980
  let matches = React2__namespace.useMemo(
39355
38981
  () => matchRoutes(router.routes, page, router.basename),
@@ -39358,7 +38984,7 @@ function PrefetchPageLinks({
39358
38984
  if (!matches) {
39359
38985
  return null;
39360
38986
  }
39361
- return /* @__PURE__ */ React2__namespace.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
38987
+ return /* @__PURE__ */ React2__namespace.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
39362
38988
  }
39363
38989
  function useKeyedPrefetchLinks(matches) {
39364
38990
  let { manifest, routeModules } = useFrameworkContext();
@@ -39431,7 +39057,7 @@ function PrefetchPageLinksImpl({
39431
39057
  if (routesParams.size === 0) {
39432
39058
  return [];
39433
39059
  }
39434
- let url = singleFetchUrl(page, basename);
39060
+ let url = singleFetchUrl(page, basename, "data");
39435
39061
  if (foundOptOutRoute && routesParams.size > 0) {
39436
39062
  url.searchParams.set(
39437
39063
  "_routes",
@@ -39454,10 +39080,10 @@ function PrefetchPageLinksImpl({
39454
39080
  [newMatchesForAssets, manifest]
39455
39081
  );
39456
39082
  let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
39457
- return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React2__namespace.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React2__namespace.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
39083
+ return /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React2__namespace.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React2__namespace.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
39458
39084
  // these don't spread `linkProps` because they are full link descriptors
39459
39085
  // already with their own props
39460
- /* @__PURE__ */ React2__namespace.createElement("link", { key, ...link })
39086
+ /* @__PURE__ */ React2__namespace.createElement("link", { key, nonce: linkProps.nonce, ...link })
39461
39087
  )));
39462
39088
  }
39463
39089
  function mergeRefs(...refs) {
@@ -39471,12 +39097,11 @@ function mergeRefs(...refs) {
39471
39097
  });
39472
39098
  };
39473
39099
  }
39474
-
39475
- // lib/dom/lib.tsx
39476
39100
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
39477
39101
  try {
39478
39102
  if (isBrowser) {
39479
- window.__reactRouterVersion = "7.6.2";
39103
+ window.__reactRouterVersion = // @ts-expect-error
39104
+ "7.8.1";
39480
39105
  }
39481
39106
  } catch (e) {
39482
39107
  }
@@ -39552,7 +39177,7 @@ var Link$1 = React2__namespace.forwardRef(
39552
39177
  }
39553
39178
  }
39554
39179
  }
39555
- let href2 = useHref(to, { relative });
39180
+ let href = useHref(to, { relative });
39556
39181
  let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
39557
39182
  prefetch,
39558
39183
  rest
@@ -39578,7 +39203,7 @@ var Link$1 = React2__namespace.forwardRef(
39578
39203
  {
39579
39204
  ...rest,
39580
39205
  ...prefetchHandlers,
39581
- href: absoluteHref || href2,
39206
+ href: absoluteHref || href,
39582
39207
  onClick: isExternal || reloadDocument ? onClick : handleClick,
39583
39208
  ref: mergeRefs(forwardedRef, prefetchRef),
39584
39209
  target,
@@ -39586,7 +39211,7 @@ var Link$1 = React2__namespace.forwardRef(
39586
39211
  }
39587
39212
  )
39588
39213
  );
39589
- return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, link, /* @__PURE__ */ React2__namespace.createElement(PrefetchPageLinks, { page: href2 })) : link;
39214
+ return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2__namespace.createElement(React2__namespace.Fragment, null, link, /* @__PURE__ */ React2__namespace.createElement(PrefetchPageLinks, { page: href })) : link;
39590
39215
  }
39591
39216
  );
39592
39217
  Link$1.displayName = "Link";
@@ -39822,7 +39447,7 @@ function useFormAction(action, { relative } = {}) {
39822
39447
  }
39823
39448
  return createPath(path);
39824
39449
  }
39825
- function useViewTransitionState(to, opts = {}) {
39450
+ function useViewTransitionState(to, { relative } = {}) {
39826
39451
  let vtContext = React2__namespace.useContext(ViewTransitionContext);
39827
39452
  invariant(
39828
39453
  vtContext != null,
@@ -39831,7 +39456,7 @@ function useViewTransitionState(to, opts = {}) {
39831
39456
  let { basename } = useDataRouterContext3(
39832
39457
  "useViewTransitionState" /* useViewTransitionState */
39833
39458
  );
39834
- let path = useResolvedPath(to, { relative: opts.relative });
39459
+ let path = useResolvedPath(to, { relative });
39835
39460
  if (!vtContext.isTransitioning) {
39836
39461
  return false;
39837
39462
  }
@@ -39840,12 +39465,6 @@ function useViewTransitionState(to, opts = {}) {
39840
39465
  return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
39841
39466
  }
39842
39467
 
39843
- // lib/server-runtime/single-fetch.ts
39844
- /* @__PURE__ */ new Set([
39845
- ...NO_BODY_STATUS_CODES,
39846
- 304
39847
- ]);
39848
-
39849
39468
  const Section = ({
39850
39469
  items,
39851
39470
  title,