kiban-design-system 1.1.3 → 1.1.4
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 +729 -589
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +6 -6
- package/dist/index.css.map +1 -1
- package/dist/index.esm.js +514 -374
- package/dist/index.esm.js.map +1 -1
- package/package.json +43 -41
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React2 from 'react';
|
|
2
|
+
import React2__default, { createElement, createContext, useState, useEffect, useContext, isValidElement, Fragment as Fragment$1, useRef, useCallback, memo, useMemo, Children, cloneElement } from 'react';
|
|
3
3
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
|
|
@@ -9090,18 +9090,10 @@ class Locale {
|
|
|
9090
9090
|
|
|
9091
9091
|
months(length, format = false) {
|
|
9092
9092
|
return listStuff(this, length, months, () => {
|
|
9093
|
-
// Workaround for "ja" locale: formatToParts does not label all parts of the month
|
|
9094
|
-
// as "month" and for this locale there is no difference between "format" and "non-format".
|
|
9095
|
-
// As such, just use format() instead of formatToParts() and take the whole string
|
|
9096
|
-
const monthSpecialCase = this.intl === "ja" || this.intl.startsWith("ja-");
|
|
9097
|
-
format &= !monthSpecialCase;
|
|
9098
9093
|
const intl = format ? { month: length, day: "numeric" } : { month: length },
|
|
9099
9094
|
formatStr = format ? "format" : "standalone";
|
|
9100
9095
|
if (!this.monthsCache[formatStr][length]) {
|
|
9101
|
-
|
|
9102
|
-
? (dt) => this.extract(dt, intl, "month")
|
|
9103
|
-
: (dt) => this.dtFormatter(dt, intl).format();
|
|
9104
|
-
this.monthsCache[formatStr][length] = mapMonths(mapper);
|
|
9096
|
+
this.monthsCache[formatStr][length] = mapMonths((dt) => this.extract(dt, intl, "month"));
|
|
9105
9097
|
}
|
|
9106
9098
|
return this.monthsCache[formatStr][length];
|
|
9107
9099
|
});
|
|
@@ -10087,24 +10079,10 @@ function parseMillis(fraction) {
|
|
|
10087
10079
|
}
|
|
10088
10080
|
}
|
|
10089
10081
|
|
|
10090
|
-
function roundTo(number, digits,
|
|
10091
|
-
const factor = 10 ** digits
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
return number > 0
|
|
10095
|
-
? Math.ceil(number * factor) / factor
|
|
10096
|
-
: Math.floor(number * factor) / factor;
|
|
10097
|
-
case "trunc":
|
|
10098
|
-
return Math.trunc(number * factor) / factor;
|
|
10099
|
-
case "round":
|
|
10100
|
-
return Math.round(number * factor) / factor;
|
|
10101
|
-
case "floor":
|
|
10102
|
-
return Math.floor(number * factor) / factor;
|
|
10103
|
-
case "ceil":
|
|
10104
|
-
return Math.ceil(number * factor) / factor;
|
|
10105
|
-
default:
|
|
10106
|
-
throw new RangeError(`Value rounding ${rounding} is out of range`);
|
|
10107
|
-
}
|
|
10082
|
+
function roundTo(number, digits, towardZero = false) {
|
|
10083
|
+
const factor = 10 ** digits,
|
|
10084
|
+
rounder = towardZero ? Math.trunc : Math.round;
|
|
10085
|
+
return rounder(number * factor) / factor;
|
|
10108
10086
|
}
|
|
10109
10087
|
|
|
10110
10088
|
// DATE BASICS
|
|
@@ -10212,7 +10190,7 @@ function signedOffset(offHourStr, offMinuteStr) {
|
|
|
10212
10190
|
|
|
10213
10191
|
function asNumber(value) {
|
|
10214
10192
|
const numericValue = Number(value);
|
|
10215
|
-
if (typeof value === "boolean" || value === "" ||
|
|
10193
|
+
if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue))
|
|
10216
10194
|
throw new InvalidArgumentError(`Invalid unit value ${value}`);
|
|
10217
10195
|
return numericValue;
|
|
10218
10196
|
}
|
|
@@ -10471,12 +10449,8 @@ class Formatter {
|
|
|
10471
10449
|
for (let i = 0; i < fmt.length; i++) {
|
|
10472
10450
|
const c = fmt.charAt(i);
|
|
10473
10451
|
if (c === "'") {
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
splits.push({
|
|
10477
|
-
literal: bracketed || /^\s+$/.test(currentFull),
|
|
10478
|
-
val: currentFull === "" ? "'" : currentFull,
|
|
10479
|
-
});
|
|
10452
|
+
if (currentFull.length > 0) {
|
|
10453
|
+
splits.push({ literal: bracketed || /^\s+$/.test(currentFull), val: currentFull });
|
|
10480
10454
|
}
|
|
10481
10455
|
current = null;
|
|
10482
10456
|
currentFull = "";
|
|
@@ -10540,7 +10514,7 @@ class Formatter {
|
|
|
10540
10514
|
return this.dtFormatter(dt, opts).resolvedOptions();
|
|
10541
10515
|
}
|
|
10542
10516
|
|
|
10543
|
-
num(n, p = 0
|
|
10517
|
+
num(n, p = 0) {
|
|
10544
10518
|
// we get some perf out of doing this here, annoyingly
|
|
10545
10519
|
if (this.opts.forceSimple) {
|
|
10546
10520
|
return padStart(n, p);
|
|
@@ -10551,9 +10525,6 @@ class Formatter {
|
|
|
10551
10525
|
if (p > 0) {
|
|
10552
10526
|
opts.padTo = p;
|
|
10553
10527
|
}
|
|
10554
|
-
if (signDisplay) {
|
|
10555
|
-
opts.signDisplay = signDisplay;
|
|
10556
|
-
}
|
|
10557
10528
|
|
|
10558
10529
|
return this.loc.numberFormatter(opts).format(n);
|
|
10559
10530
|
}
|
|
@@ -10789,44 +10760,32 @@ class Formatter {
|
|
|
10789
10760
|
}
|
|
10790
10761
|
|
|
10791
10762
|
formatDurationFromString(dur, fmt) {
|
|
10792
|
-
const invertLargest = this.opts.signMode === "negativeLargestOnly" ? -1 : 1;
|
|
10793
10763
|
const tokenToField = (token) => {
|
|
10794
10764
|
switch (token[0]) {
|
|
10795
10765
|
case "S":
|
|
10796
|
-
return "
|
|
10766
|
+
return "millisecond";
|
|
10797
10767
|
case "s":
|
|
10798
|
-
return "
|
|
10768
|
+
return "second";
|
|
10799
10769
|
case "m":
|
|
10800
|
-
return "
|
|
10770
|
+
return "minute";
|
|
10801
10771
|
case "h":
|
|
10802
|
-
return "
|
|
10772
|
+
return "hour";
|
|
10803
10773
|
case "d":
|
|
10804
|
-
return "
|
|
10774
|
+
return "day";
|
|
10805
10775
|
case "w":
|
|
10806
|
-
return "
|
|
10776
|
+
return "week";
|
|
10807
10777
|
case "M":
|
|
10808
|
-
return "
|
|
10778
|
+
return "month";
|
|
10809
10779
|
case "y":
|
|
10810
|
-
return "
|
|
10780
|
+
return "year";
|
|
10811
10781
|
default:
|
|
10812
10782
|
return null;
|
|
10813
10783
|
}
|
|
10814
10784
|
},
|
|
10815
|
-
tokenToString = (lildur
|
|
10785
|
+
tokenToString = (lildur) => (token) => {
|
|
10816
10786
|
const mapped = tokenToField(token);
|
|
10817
10787
|
if (mapped) {
|
|
10818
|
-
|
|
10819
|
-
info.isNegativeDuration && mapped !== info.largestUnit ? invertLargest : 1;
|
|
10820
|
-
let signDisplay;
|
|
10821
|
-
if (this.opts.signMode === "negativeLargestOnly" && mapped !== info.largestUnit) {
|
|
10822
|
-
signDisplay = "never";
|
|
10823
|
-
} else if (this.opts.signMode === "all") {
|
|
10824
|
-
signDisplay = "always";
|
|
10825
|
-
} else {
|
|
10826
|
-
// "auto" and "negative" are the same, but "auto" has better support
|
|
10827
|
-
signDisplay = "auto";
|
|
10828
|
-
}
|
|
10829
|
-
return this.num(lildur.get(mapped) * inversionFactor, token.length, signDisplay);
|
|
10788
|
+
return this.num(lildur.get(mapped), token.length);
|
|
10830
10789
|
} else {
|
|
10831
10790
|
return token;
|
|
10832
10791
|
}
|
|
@@ -10836,14 +10795,8 @@ class Formatter {
|
|
|
10836
10795
|
(found, { literal, val }) => (literal ? found : found.concat(val)),
|
|
10837
10796
|
[]
|
|
10838
10797
|
),
|
|
10839
|
-
collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t))
|
|
10840
|
-
|
|
10841
|
-
isNegativeDuration: collapsed < 0,
|
|
10842
|
-
// this relies on "collapsed" being based on "shiftTo", which builds up the object
|
|
10843
|
-
// in order
|
|
10844
|
-
largestUnit: Object.keys(collapsed.values)[0],
|
|
10845
|
-
};
|
|
10846
|
-
return stringifyTokens(tokens, tokenToString(collapsed, durationInfo));
|
|
10798
|
+
collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t));
|
|
10799
|
+
return stringifyTokens(tokens, tokenToString(collapsed));
|
|
10847
10800
|
}
|
|
10848
10801
|
}
|
|
10849
10802
|
|
|
@@ -10904,11 +10857,11 @@ function simpleParse(...keys) {
|
|
|
10904
10857
|
}
|
|
10905
10858
|
|
|
10906
10859
|
// ISO and SQL parsing
|
|
10907
|
-
const offsetRegex = /(?:(
|
|
10860
|
+
const offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
|
|
10908
10861
|
const isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
|
|
10909
10862
|
const isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
|
|
10910
10863
|
const isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
|
|
10911
|
-
const isoTimeExtensionRegex = RegExp(`(?:
|
|
10864
|
+
const isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`);
|
|
10912
10865
|
const isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
|
|
10913
10866
|
const isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
|
|
10914
10867
|
const isoOrdinalRegex = /(\d{4})-?(\d{3})/;
|
|
@@ -11623,13 +11576,9 @@ class Duration {
|
|
|
11623
11576
|
* @param {string} fmt - the format string
|
|
11624
11577
|
* @param {Object} opts - options
|
|
11625
11578
|
* @param {boolean} [opts.floor=true] - floor numerical values
|
|
11626
|
-
* @param {'negative'|'all'|'negativeLargestOnly'} [opts.signMode=negative] - How to handle signs
|
|
11627
11579
|
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2"
|
|
11628
11580
|
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002"
|
|
11629
11581
|
* @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000"
|
|
11630
|
-
* @example Duration.fromObject({ days: 6, seconds: 2 }).toFormat("d s", { signMode: "all" }) //=> "+6 +2"
|
|
11631
|
-
* @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "all" }) //=> "-6 -2"
|
|
11632
|
-
* @example Duration.fromObject({ days: -6, seconds: -2 }).toFormat("d s", { signMode: "negativeLargestOnly" }) //=> "-6 2"
|
|
11633
11582
|
* @return {string}
|
|
11634
11583
|
*/
|
|
11635
11584
|
toFormat(fmt, opts = {}) {
|
|
@@ -11649,25 +11598,21 @@ class Duration {
|
|
|
11649
11598
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options
|
|
11650
11599
|
* @param {Object} opts - Formatting options. Accepts the same keys as the options parameter of the native `Intl.NumberFormat` constructor, as well as `listStyle`.
|
|
11651
11600
|
* @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.
|
|
11652
|
-
* @param {boolean} [opts.showZeros=true] - Show all units previously used by the duration even if they are zero
|
|
11653
11601
|
* @example
|
|
11654
11602
|
* ```js
|
|
11655
|
-
* var dur = Duration.fromObject({
|
|
11656
|
-
* dur.toHuman() //=> '1
|
|
11657
|
-
* dur.toHuman({ listStyle: "long" }) //=> '1
|
|
11658
|
-
* dur.toHuman({ unitDisplay: "short" }) //=> '1
|
|
11659
|
-
* dur.toHuman({ showZeros: false }) //=> '1 month, 5 hours, 6 minutes'
|
|
11603
|
+
* var dur = Duration.fromObject({ days: 1, hours: 5, minutes: 6 })
|
|
11604
|
+
* dur.toHuman() //=> '1 day, 5 hours, 6 minutes'
|
|
11605
|
+
* dur.toHuman({ listStyle: "long" }) //=> '1 day, 5 hours, and 6 minutes'
|
|
11606
|
+
* dur.toHuman({ unitDisplay: "short" }) //=> '1 day, 5 hr, 6 min'
|
|
11660
11607
|
* ```
|
|
11661
11608
|
*/
|
|
11662
11609
|
toHuman(opts = {}) {
|
|
11663
11610
|
if (!this.isValid) return INVALID$2;
|
|
11664
11611
|
|
|
11665
|
-
const showZeros = opts.showZeros !== false;
|
|
11666
|
-
|
|
11667
11612
|
const l = orderedUnits$1
|
|
11668
11613
|
.map((unit) => {
|
|
11669
11614
|
const val = this.values[unit];
|
|
11670
|
-
if (isUndefined(val)
|
|
11615
|
+
if (isUndefined(val)) {
|
|
11671
11616
|
return null;
|
|
11672
11617
|
}
|
|
11673
11618
|
return this.loc
|
|
@@ -12027,17 +11972,6 @@ class Duration {
|
|
|
12027
11972
|
return clone$2(this, { values: negated }, true);
|
|
12028
11973
|
}
|
|
12029
11974
|
|
|
12030
|
-
/**
|
|
12031
|
-
* Removes all units with values equal to 0 from this Duration.
|
|
12032
|
-
* @example Duration.fromObject({ years: 2, days: 0, hours: 0, minutes: 0 }).removeZeros().toObject() //=> { years: 2 }
|
|
12033
|
-
* @return {Duration}
|
|
12034
|
-
*/
|
|
12035
|
-
removeZeros() {
|
|
12036
|
-
if (!this.isValid) return this;
|
|
12037
|
-
const vals = removeZeroes(this.values);
|
|
12038
|
-
return clone$2(this, { values: vals }, true);
|
|
12039
|
-
}
|
|
12040
|
-
|
|
12041
11975
|
/**
|
|
12042
11976
|
* Get the years.
|
|
12043
11977
|
* @type {number}
|
|
@@ -12348,8 +12282,7 @@ class Interval {
|
|
|
12348
12282
|
}
|
|
12349
12283
|
|
|
12350
12284
|
/**
|
|
12351
|
-
* Returns the end of the Interval
|
|
12352
|
-
* (Interval is half-open).
|
|
12285
|
+
* Returns the end of the Interval
|
|
12353
12286
|
* @type {DateTime}
|
|
12354
12287
|
*/
|
|
12355
12288
|
get end() {
|
|
@@ -13780,22 +13713,21 @@ function toTechFormat(dt, format, allowZ = true) {
|
|
|
13780
13713
|
: null;
|
|
13781
13714
|
}
|
|
13782
13715
|
|
|
13783
|
-
function toISODate(o, extended
|
|
13716
|
+
function toISODate(o, extended) {
|
|
13784
13717
|
const longFormat = o.c.year > 9999 || o.c.year < 0;
|
|
13785
13718
|
let c = "";
|
|
13786
13719
|
if (longFormat && o.c.year >= 0) c += "+";
|
|
13787
13720
|
c += padStart(o.c.year, longFormat ? 6 : 4);
|
|
13788
|
-
|
|
13721
|
+
|
|
13789
13722
|
if (extended) {
|
|
13790
13723
|
c += "-";
|
|
13791
13724
|
c += padStart(o.c.month);
|
|
13792
|
-
if (precision === "month") return c;
|
|
13793
13725
|
c += "-";
|
|
13726
|
+
c += padStart(o.c.day);
|
|
13794
13727
|
} else {
|
|
13795
13728
|
c += padStart(o.c.month);
|
|
13796
|
-
|
|
13729
|
+
c += padStart(o.c.day);
|
|
13797
13730
|
}
|
|
13798
|
-
c += padStart(o.c.day);
|
|
13799
13731
|
return c;
|
|
13800
13732
|
}
|
|
13801
13733
|
|
|
@@ -13805,39 +13737,26 @@ function toISOTime(
|
|
|
13805
13737
|
suppressSeconds,
|
|
13806
13738
|
suppressMilliseconds,
|
|
13807
13739
|
includeOffset,
|
|
13808
|
-
extendedZone
|
|
13809
|
-
precision
|
|
13740
|
+
extendedZone
|
|
13810
13741
|
) {
|
|
13811
|
-
let
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13815
|
-
|
|
13816
|
-
|
|
13817
|
-
|
|
13818
|
-
|
|
13819
|
-
|
|
13820
|
-
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13827
|
-
|
|
13828
|
-
|
|
13829
|
-
} else {
|
|
13830
|
-
c += padStart(o.c.minute);
|
|
13831
|
-
if (precision === "minute") break;
|
|
13832
|
-
if (showSeconds) {
|
|
13833
|
-
c += padStart(o.c.second);
|
|
13834
|
-
}
|
|
13835
|
-
}
|
|
13836
|
-
if (precision === "second") break;
|
|
13837
|
-
if (showSeconds && (!suppressMilliseconds || o.c.millisecond !== 0)) {
|
|
13838
|
-
c += ".";
|
|
13839
|
-
c += padStart(o.c.millisecond, 3);
|
|
13840
|
-
}
|
|
13742
|
+
let c = padStart(o.c.hour);
|
|
13743
|
+
if (extended) {
|
|
13744
|
+
c += ":";
|
|
13745
|
+
c += padStart(o.c.minute);
|
|
13746
|
+
if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
|
|
13747
|
+
c += ":";
|
|
13748
|
+
}
|
|
13749
|
+
} else {
|
|
13750
|
+
c += padStart(o.c.minute);
|
|
13751
|
+
}
|
|
13752
|
+
|
|
13753
|
+
if (o.c.millisecond !== 0 || o.c.second !== 0 || !suppressSeconds) {
|
|
13754
|
+
c += padStart(o.c.second);
|
|
13755
|
+
|
|
13756
|
+
if (o.c.millisecond !== 0 || !suppressMilliseconds) {
|
|
13757
|
+
c += ".";
|
|
13758
|
+
c += padStart(o.c.millisecond, 3);
|
|
13759
|
+
}
|
|
13841
13760
|
}
|
|
13842
13761
|
|
|
13843
13762
|
if (includeOffset) {
|
|
@@ -14029,9 +13948,8 @@ function quickDT(obj, opts) {
|
|
|
14029
13948
|
|
|
14030
13949
|
function diffRelative(start, end, opts) {
|
|
14031
13950
|
const round = isUndefined(opts.round) ? true : opts.round,
|
|
14032
|
-
rounding = isUndefined(opts.rounding) ? "trunc" : opts.rounding,
|
|
14033
13951
|
format = (c, unit) => {
|
|
14034
|
-
c = roundTo(c, round || opts.calendary ? 0 : 2,
|
|
13952
|
+
c = roundTo(c, round || opts.calendary ? 0 : 2, true);
|
|
14035
13953
|
const formatter = end.loc.clone(opts).relFormatter(opts);
|
|
14036
13954
|
return formatter.format(c, unit);
|
|
14037
13955
|
},
|
|
@@ -15410,13 +15328,10 @@ class DateTime {
|
|
|
15410
15328
|
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
|
|
15411
15329
|
* @param {boolean} [opts.extendedZone=false] - add the time zone format extension
|
|
15412
15330
|
* @param {string} [opts.format='extended'] - choose between the basic and extended format
|
|
15413
|
-
* @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.
|
|
15414
15331
|
* @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
|
|
15415
15332
|
* @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
|
|
15416
15333
|
* @example DateTime.now().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335'
|
|
15417
15334
|
* @example DateTime.now().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400'
|
|
15418
|
-
* @example DateTime.now().toISO({ precision: 'day' }) //=> '2017-04-22Z'
|
|
15419
|
-
* @example DateTime.now().toISO({ precision: 'minute' }) //=> '2017-04-22T20:47Z'
|
|
15420
15335
|
* @return {string|null}
|
|
15421
15336
|
*/
|
|
15422
15337
|
toISO({
|
|
@@ -15425,26 +15340,16 @@ class DateTime {
|
|
|
15425
15340
|
suppressMilliseconds = false,
|
|
15426
15341
|
includeOffset = true,
|
|
15427
15342
|
extendedZone = false,
|
|
15428
|
-
precision = "milliseconds",
|
|
15429
15343
|
} = {}) {
|
|
15430
15344
|
if (!this.isValid) {
|
|
15431
15345
|
return null;
|
|
15432
15346
|
}
|
|
15433
15347
|
|
|
15434
|
-
precision = normalizeUnit(precision);
|
|
15435
15348
|
const ext = format === "extended";
|
|
15436
15349
|
|
|
15437
|
-
let c = toISODate(this, ext
|
|
15438
|
-
|
|
15439
|
-
c += toISOTime(
|
|
15440
|
-
this,
|
|
15441
|
-
ext,
|
|
15442
|
-
suppressSeconds,
|
|
15443
|
-
suppressMilliseconds,
|
|
15444
|
-
includeOffset,
|
|
15445
|
-
extendedZone,
|
|
15446
|
-
precision
|
|
15447
|
-
);
|
|
15350
|
+
let c = toISODate(this, ext);
|
|
15351
|
+
c += "T";
|
|
15352
|
+
c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
|
|
15448
15353
|
return c;
|
|
15449
15354
|
}
|
|
15450
15355
|
|
|
@@ -15452,17 +15357,16 @@ class DateTime {
|
|
|
15452
15357
|
* Returns an ISO 8601-compliant string representation of this DateTime's date component
|
|
15453
15358
|
* @param {Object} opts - options
|
|
15454
15359
|
* @param {string} [opts.format='extended'] - choose between the basic and extended format
|
|
15455
|
-
* @param {string} [opts.precision='day'] - truncate output to desired precision: 'years', 'months', or 'days'.
|
|
15456
15360
|
* @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25'
|
|
15457
15361
|
* @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525'
|
|
15458
|
-
* @example DateTime.utc(1982, 5, 25).toISODate({ precision: 'month' }) //=> '1982-05'
|
|
15459
15362
|
* @return {string|null}
|
|
15460
15363
|
*/
|
|
15461
|
-
toISODate({ format = "extended"
|
|
15364
|
+
toISODate({ format = "extended" } = {}) {
|
|
15462
15365
|
if (!this.isValid) {
|
|
15463
15366
|
return null;
|
|
15464
15367
|
}
|
|
15465
|
-
|
|
15368
|
+
|
|
15369
|
+
return toISODate(this, format === "extended");
|
|
15466
15370
|
}
|
|
15467
15371
|
|
|
15468
15372
|
/**
|
|
@@ -15483,12 +15387,10 @@ class DateTime {
|
|
|
15483
15387
|
* @param {boolean} [opts.extendedZone=true] - add the time zone format extension
|
|
15484
15388
|
* @param {boolean} [opts.includePrefix=false] - include the `T` prefix
|
|
15485
15389
|
* @param {string} [opts.format='extended'] - choose between the basic and extended format
|
|
15486
|
-
* @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.
|
|
15487
15390
|
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z'
|
|
15488
15391
|
* @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z'
|
|
15489
15392
|
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z'
|
|
15490
15393
|
* @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ includePrefix: true }) //=> 'T07:34:19.361Z'
|
|
15491
|
-
* @example DateTime.utc().set({ hour: 7, minute: 34, second: 56 }).toISOTime({ precision: 'minute' }) //=> '07:34Z'
|
|
15492
15394
|
* @return {string}
|
|
15493
15395
|
*/
|
|
15494
15396
|
toISOTime({
|
|
@@ -15498,14 +15400,12 @@ class DateTime {
|
|
|
15498
15400
|
includePrefix = false,
|
|
15499
15401
|
extendedZone = false,
|
|
15500
15402
|
format = "extended",
|
|
15501
|
-
precision = "milliseconds",
|
|
15502
15403
|
} = {}) {
|
|
15503
15404
|
if (!this.isValid) {
|
|
15504
15405
|
return null;
|
|
15505
15406
|
}
|
|
15506
15407
|
|
|
15507
|
-
|
|
15508
|
-
let c = includePrefix && orderedUnits.indexOf(precision) >= 3 ? "T" : "";
|
|
15408
|
+
let c = includePrefix ? "T" : "";
|
|
15509
15409
|
return (
|
|
15510
15410
|
c +
|
|
15511
15411
|
toISOTime(
|
|
@@ -15514,8 +15414,7 @@ class DateTime {
|
|
|
15514
15414
|
suppressSeconds,
|
|
15515
15415
|
suppressMilliseconds,
|
|
15516
15416
|
includeOffset,
|
|
15517
|
-
extendedZone
|
|
15518
|
-
precision
|
|
15417
|
+
extendedZone
|
|
15519
15418
|
)
|
|
15520
15419
|
);
|
|
15521
15420
|
}
|
|
@@ -15793,13 +15692,12 @@ class DateTime {
|
|
|
15793
15692
|
|
|
15794
15693
|
/**
|
|
15795
15694
|
* Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your
|
|
15796
|
-
* platform supports Intl.RelativeTimeFormat. Rounds
|
|
15695
|
+
* platform supports Intl.RelativeTimeFormat. Rounds down by default.
|
|
15797
15696
|
* @param {Object} options - options that affect the output
|
|
15798
15697
|
* @param {DateTime} [options.base=DateTime.now()] - the DateTime to use as the basis to which this time is compared. Defaults to now.
|
|
15799
15698
|
* @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow"
|
|
15800
15699
|
* @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"
|
|
15801
15700
|
* @param {boolean} [options.round=true] - whether to round the numbers in the output.
|
|
15802
|
-
* @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".
|
|
15803
15701
|
* @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.
|
|
15804
15702
|
* @param {string} options.locale - override the locale of this DateTime
|
|
15805
15703
|
* @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this
|
|
@@ -32598,7 +32496,7 @@ var hasRequiredLib;
|
|
|
32598
32496
|
function requireLib () {
|
|
32599
32497
|
if (hasRequiredLib) return lib;
|
|
32600
32498
|
hasRequiredLib = 1;
|
|
32601
|
-
lib=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:false,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=true,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:true,get:n});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:true});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:true,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=9)}([function(e,t){e.exports=
|
|
32499
|
+
lib=function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:false,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=true,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:true,get:n});},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:true});},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:true,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=9)}([function(e,t){e.exports=React2__default;},function(e,t,r){var n;
|
|
32602
32500
|
/*!
|
|
32603
32501
|
Copyright (c) 2017 Jed Watson.
|
|
32604
32502
|
Licensed under the MIT License (MIT), see
|
|
@@ -37481,8 +37379,258 @@ const Header$1 = ({
|
|
|
37481
37379
|
});
|
|
37482
37380
|
};
|
|
37483
37381
|
|
|
37382
|
+
var dist = {};
|
|
37383
|
+
|
|
37384
|
+
var hasRequiredDist;
|
|
37385
|
+
|
|
37386
|
+
function requireDist () {
|
|
37387
|
+
if (hasRequiredDist) return dist;
|
|
37388
|
+
hasRequiredDist = 1;
|
|
37389
|
+
Object.defineProperty(dist, "__esModule", { value: true });
|
|
37390
|
+
dist.parse = parse;
|
|
37391
|
+
dist.serialize = serialize;
|
|
37392
|
+
/**
|
|
37393
|
+
* RegExp to match cookie-name in RFC 6265 sec 4.1.1
|
|
37394
|
+
* This refers out to the obsoleted definition of token in RFC 2616 sec 2.2
|
|
37395
|
+
* which has been replaced by the token definition in RFC 7230 appendix B.
|
|
37396
|
+
*
|
|
37397
|
+
* cookie-name = token
|
|
37398
|
+
* token = 1*tchar
|
|
37399
|
+
* tchar = "!" / "#" / "$" / "%" / "&" / "'" /
|
|
37400
|
+
* "*" / "+" / "-" / "." / "^" / "_" /
|
|
37401
|
+
* "`" / "|" / "~" / DIGIT / ALPHA
|
|
37402
|
+
*
|
|
37403
|
+
* Note: Allowing more characters - https://github.com/jshttp/cookie/issues/191
|
|
37404
|
+
* Allow same range as cookie value, except `=`, which delimits end of name.
|
|
37405
|
+
*/
|
|
37406
|
+
const cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
37407
|
+
/**
|
|
37408
|
+
* RegExp to match cookie-value in RFC 6265 sec 4.1.1
|
|
37409
|
+
*
|
|
37410
|
+
* cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
|
|
37411
|
+
* cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
|
|
37412
|
+
* ; US-ASCII characters excluding CTLs,
|
|
37413
|
+
* ; whitespace DQUOTE, comma, semicolon,
|
|
37414
|
+
* ; and backslash
|
|
37415
|
+
*
|
|
37416
|
+
* Allowing more characters: https://github.com/jshttp/cookie/issues/191
|
|
37417
|
+
* Comma, backslash, and DQUOTE are not part of the parsing algorithm.
|
|
37418
|
+
*/
|
|
37419
|
+
const cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
37420
|
+
/**
|
|
37421
|
+
* RegExp to match domain-value in RFC 6265 sec 4.1.1
|
|
37422
|
+
*
|
|
37423
|
+
* domain-value = <subdomain>
|
|
37424
|
+
* ; defined in [RFC1034], Section 3.5, as
|
|
37425
|
+
* ; enhanced by [RFC1123], Section 2.1
|
|
37426
|
+
* <subdomain> = <label> | <subdomain> "." <label>
|
|
37427
|
+
* <label> = <let-dig> [ [ <ldh-str> ] <let-dig> ]
|
|
37428
|
+
* Labels must be 63 characters or less.
|
|
37429
|
+
* 'let-dig' not 'letter' in the first char, per RFC1123
|
|
37430
|
+
* <ldh-str> = <let-dig-hyp> | <let-dig-hyp> <ldh-str>
|
|
37431
|
+
* <let-dig-hyp> = <let-dig> | "-"
|
|
37432
|
+
* <let-dig> = <letter> | <digit>
|
|
37433
|
+
* <letter> = any one of the 52 alphabetic characters A through Z in
|
|
37434
|
+
* upper case and a through z in lower case
|
|
37435
|
+
* <digit> = any one of the ten digits 0 through 9
|
|
37436
|
+
*
|
|
37437
|
+
* Keep support for leading dot: https://github.com/jshttp/cookie/issues/173
|
|
37438
|
+
*
|
|
37439
|
+
* > (Note that a leading %x2E ("."), if present, is ignored even though that
|
|
37440
|
+
* character is not permitted, but a trailing %x2E ("."), if present, will
|
|
37441
|
+
* cause the user agent to ignore the attribute.)
|
|
37442
|
+
*/
|
|
37443
|
+
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;
|
|
37444
|
+
/**
|
|
37445
|
+
* RegExp to match path-value in RFC 6265 sec 4.1.1
|
|
37446
|
+
*
|
|
37447
|
+
* path-value = <any CHAR except CTLs or ";">
|
|
37448
|
+
* CHAR = %x01-7F
|
|
37449
|
+
* ; defined in RFC 5234 appendix B.1
|
|
37450
|
+
*/
|
|
37451
|
+
const pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
37452
|
+
const __toString = Object.prototype.toString;
|
|
37453
|
+
const NullObject = /* @__PURE__ */ (() => {
|
|
37454
|
+
const C = function () { };
|
|
37455
|
+
C.prototype = Object.create(null);
|
|
37456
|
+
return C;
|
|
37457
|
+
})();
|
|
37458
|
+
/**
|
|
37459
|
+
* Parse a cookie header.
|
|
37460
|
+
*
|
|
37461
|
+
* Parse the given cookie header string into an object
|
|
37462
|
+
* The object has the various cookies as keys(names) => values
|
|
37463
|
+
*/
|
|
37464
|
+
function parse(str, options) {
|
|
37465
|
+
const obj = new NullObject();
|
|
37466
|
+
const len = str.length;
|
|
37467
|
+
// RFC 6265 sec 4.1.1, RFC 2616 2.2 defines a cookie name consists of one char minimum, plus '='.
|
|
37468
|
+
if (len < 2)
|
|
37469
|
+
return obj;
|
|
37470
|
+
const dec = options?.decode || decode;
|
|
37471
|
+
let index = 0;
|
|
37472
|
+
do {
|
|
37473
|
+
const eqIdx = str.indexOf("=", index);
|
|
37474
|
+
if (eqIdx === -1)
|
|
37475
|
+
break; // No more cookie pairs.
|
|
37476
|
+
const colonIdx = str.indexOf(";", index);
|
|
37477
|
+
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
37478
|
+
if (eqIdx > endIdx) {
|
|
37479
|
+
// backtrack on prior semicolon
|
|
37480
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
37481
|
+
continue;
|
|
37482
|
+
}
|
|
37483
|
+
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
37484
|
+
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
37485
|
+
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
37486
|
+
// only assign once
|
|
37487
|
+
if (obj[key] === undefined) {
|
|
37488
|
+
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
37489
|
+
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
37490
|
+
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
37491
|
+
obj[key] = value;
|
|
37492
|
+
}
|
|
37493
|
+
index = endIdx + 1;
|
|
37494
|
+
} while (index < len);
|
|
37495
|
+
return obj;
|
|
37496
|
+
}
|
|
37497
|
+
function startIndex(str, index, max) {
|
|
37498
|
+
do {
|
|
37499
|
+
const code = str.charCodeAt(index);
|
|
37500
|
+
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
|
|
37501
|
+
return index;
|
|
37502
|
+
} while (++index < max);
|
|
37503
|
+
return max;
|
|
37504
|
+
}
|
|
37505
|
+
function endIndex(str, index, min) {
|
|
37506
|
+
while (index > min) {
|
|
37507
|
+
const code = str.charCodeAt(--index);
|
|
37508
|
+
if (code !== 0x20 /* */ && code !== 0x09 /* \t */)
|
|
37509
|
+
return index + 1;
|
|
37510
|
+
}
|
|
37511
|
+
return min;
|
|
37512
|
+
}
|
|
37513
|
+
/**
|
|
37514
|
+
* Serialize data into a cookie header.
|
|
37515
|
+
*
|
|
37516
|
+
* Serialize a name value pair into a cookie string suitable for
|
|
37517
|
+
* http headers. An optional options object specifies cookie parameters.
|
|
37518
|
+
*
|
|
37519
|
+
* serialize('foo', 'bar', { httpOnly: true })
|
|
37520
|
+
* => "foo=bar; httpOnly"
|
|
37521
|
+
*/
|
|
37522
|
+
function serialize(name, val, options) {
|
|
37523
|
+
const enc = options?.encode || encodeURIComponent;
|
|
37524
|
+
if (!cookieNameRegExp.test(name)) {
|
|
37525
|
+
throw new TypeError(`argument name is invalid: ${name}`);
|
|
37526
|
+
}
|
|
37527
|
+
const value = enc(val);
|
|
37528
|
+
if (!cookieValueRegExp.test(value)) {
|
|
37529
|
+
throw new TypeError(`argument val is invalid: ${val}`);
|
|
37530
|
+
}
|
|
37531
|
+
let str = name + "=" + value;
|
|
37532
|
+
if (!options)
|
|
37533
|
+
return str;
|
|
37534
|
+
if (options.maxAge !== undefined) {
|
|
37535
|
+
if (!Number.isInteger(options.maxAge)) {
|
|
37536
|
+
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
37537
|
+
}
|
|
37538
|
+
str += "; Max-Age=" + options.maxAge;
|
|
37539
|
+
}
|
|
37540
|
+
if (options.domain) {
|
|
37541
|
+
if (!domainValueRegExp.test(options.domain)) {
|
|
37542
|
+
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
37543
|
+
}
|
|
37544
|
+
str += "; Domain=" + options.domain;
|
|
37545
|
+
}
|
|
37546
|
+
if (options.path) {
|
|
37547
|
+
if (!pathValueRegExp.test(options.path)) {
|
|
37548
|
+
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
37549
|
+
}
|
|
37550
|
+
str += "; Path=" + options.path;
|
|
37551
|
+
}
|
|
37552
|
+
if (options.expires) {
|
|
37553
|
+
if (!isDate(options.expires) ||
|
|
37554
|
+
!Number.isFinite(options.expires.valueOf())) {
|
|
37555
|
+
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
37556
|
+
}
|
|
37557
|
+
str += "; Expires=" + options.expires.toUTCString();
|
|
37558
|
+
}
|
|
37559
|
+
if (options.httpOnly) {
|
|
37560
|
+
str += "; HttpOnly";
|
|
37561
|
+
}
|
|
37562
|
+
if (options.secure) {
|
|
37563
|
+
str += "; Secure";
|
|
37564
|
+
}
|
|
37565
|
+
if (options.partitioned) {
|
|
37566
|
+
str += "; Partitioned";
|
|
37567
|
+
}
|
|
37568
|
+
if (options.priority) {
|
|
37569
|
+
const priority = typeof options.priority === "string"
|
|
37570
|
+
? options.priority.toLowerCase()
|
|
37571
|
+
: undefined;
|
|
37572
|
+
switch (priority) {
|
|
37573
|
+
case "low":
|
|
37574
|
+
str += "; Priority=Low";
|
|
37575
|
+
break;
|
|
37576
|
+
case "medium":
|
|
37577
|
+
str += "; Priority=Medium";
|
|
37578
|
+
break;
|
|
37579
|
+
case "high":
|
|
37580
|
+
str += "; Priority=High";
|
|
37581
|
+
break;
|
|
37582
|
+
default:
|
|
37583
|
+
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
37584
|
+
}
|
|
37585
|
+
}
|
|
37586
|
+
if (options.sameSite) {
|
|
37587
|
+
const sameSite = typeof options.sameSite === "string"
|
|
37588
|
+
? options.sameSite.toLowerCase()
|
|
37589
|
+
: options.sameSite;
|
|
37590
|
+
switch (sameSite) {
|
|
37591
|
+
case true:
|
|
37592
|
+
case "strict":
|
|
37593
|
+
str += "; SameSite=Strict";
|
|
37594
|
+
break;
|
|
37595
|
+
case "lax":
|
|
37596
|
+
str += "; SameSite=Lax";
|
|
37597
|
+
break;
|
|
37598
|
+
case "none":
|
|
37599
|
+
str += "; SameSite=None";
|
|
37600
|
+
break;
|
|
37601
|
+
default:
|
|
37602
|
+
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
37603
|
+
}
|
|
37604
|
+
}
|
|
37605
|
+
return str;
|
|
37606
|
+
}
|
|
37607
|
+
/**
|
|
37608
|
+
* URL-decode string value. Optimized to skip native call when no %.
|
|
37609
|
+
*/
|
|
37610
|
+
function decode(str) {
|
|
37611
|
+
if (str.indexOf("%") === -1)
|
|
37612
|
+
return str;
|
|
37613
|
+
try {
|
|
37614
|
+
return decodeURIComponent(str);
|
|
37615
|
+
}
|
|
37616
|
+
catch (e) {
|
|
37617
|
+
return str;
|
|
37618
|
+
}
|
|
37619
|
+
}
|
|
37620
|
+
/**
|
|
37621
|
+
* Determine if value is a Date.
|
|
37622
|
+
*/
|
|
37623
|
+
function isDate(val) {
|
|
37624
|
+
return __toString.call(val) === "[object Date]";
|
|
37625
|
+
}
|
|
37626
|
+
|
|
37627
|
+
return dist;
|
|
37628
|
+
}
|
|
37629
|
+
|
|
37630
|
+
requireDist();
|
|
37631
|
+
|
|
37484
37632
|
/**
|
|
37485
|
-
* react-router v7.
|
|
37633
|
+
* react-router v7.6.2
|
|
37486
37634
|
*
|
|
37487
37635
|
* Copyright (c) Remix Software Inc.
|
|
37488
37636
|
*
|
|
@@ -37681,12 +37829,12 @@ function createBrowserURLImpl(to, isAbsolute = false) {
|
|
|
37681
37829
|
base = window.location.origin !== "null" ? window.location.origin : window.location.href;
|
|
37682
37830
|
}
|
|
37683
37831
|
invariant(base, "No window.location.(origin|href) available to create URL");
|
|
37684
|
-
let
|
|
37685
|
-
|
|
37686
|
-
if (!isAbsolute &&
|
|
37687
|
-
|
|
37832
|
+
let href2 = typeof to === "string" ? to : createPath(to);
|
|
37833
|
+
href2 = href2.replace(/ $/, "%20");
|
|
37834
|
+
if (!isAbsolute && href2.startsWith("//")) {
|
|
37835
|
+
href2 = base + href2;
|
|
37688
37836
|
}
|
|
37689
|
-
return new URL(
|
|
37837
|
+
return new URL(href2, base);
|
|
37690
37838
|
}
|
|
37691
37839
|
function matchRoutes(routes, locationArg, basename = "/") {
|
|
37692
37840
|
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
@@ -37710,8 +37858,8 @@ function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
|
|
37710
37858
|
}
|
|
37711
37859
|
return matches;
|
|
37712
37860
|
}
|
|
37713
|
-
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = ""
|
|
37714
|
-
let flattenRoute = (route, index,
|
|
37861
|
+
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "") {
|
|
37862
|
+
let flattenRoute = (route, index, relativePath) => {
|
|
37715
37863
|
let meta = {
|
|
37716
37864
|
relativePath: relativePath === void 0 ? route.path || "" : relativePath,
|
|
37717
37865
|
caseSensitive: route.caseSensitive === true,
|
|
@@ -37719,9 +37867,6 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "",
|
|
|
37719
37867
|
route
|
|
37720
37868
|
};
|
|
37721
37869
|
if (meta.relativePath.startsWith("/")) {
|
|
37722
|
-
if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
|
|
37723
|
-
return;
|
|
37724
|
-
}
|
|
37725
37870
|
invariant(
|
|
37726
37871
|
meta.relativePath.startsWith(parentPath),
|
|
37727
37872
|
`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.`
|
|
@@ -37737,13 +37882,7 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "",
|
|
|
37737
37882
|
route.index !== true,
|
|
37738
37883
|
`Index routes must not have child routes. Please remove all child routes from route path "${path}".`
|
|
37739
37884
|
);
|
|
37740
|
-
flattenRoutes(
|
|
37741
|
-
route.children,
|
|
37742
|
-
branches,
|
|
37743
|
-
routesMeta,
|
|
37744
|
-
path,
|
|
37745
|
-
hasParentOptionalSegments
|
|
37746
|
-
);
|
|
37885
|
+
flattenRoutes(route.children, branches, routesMeta, path);
|
|
37747
37886
|
}
|
|
37748
37887
|
if (route.path == null && !route.index) {
|
|
37749
37888
|
return;
|
|
@@ -37759,7 +37898,7 @@ function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "",
|
|
|
37759
37898
|
flattenRoute(route, index);
|
|
37760
37899
|
} else {
|
|
37761
37900
|
for (let exploded of explodeOptionalSegments(route.path)) {
|
|
37762
|
-
flattenRoute(route, index,
|
|
37901
|
+
flattenRoute(route, index, exploded);
|
|
37763
37902
|
}
|
|
37764
37903
|
}
|
|
37765
37904
|
});
|
|
@@ -37923,7 +38062,7 @@ function compilePath(path, caseSensitive = false, end = true) {
|
|
|
37923
38062
|
params.push({ paramName, isOptional: isOptional != null });
|
|
37924
38063
|
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
|
|
37925
38064
|
}
|
|
37926
|
-
)
|
|
38065
|
+
);
|
|
37927
38066
|
if (path.endsWith("*")) {
|
|
37928
38067
|
params.push({ paramName: "*" });
|
|
37929
38068
|
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
@@ -38066,36 +38205,35 @@ var validRequestMethodsArr = [
|
|
|
38066
38205
|
...validMutationMethodsArr
|
|
38067
38206
|
];
|
|
38068
38207
|
new Set(validRequestMethodsArr);
|
|
38069
|
-
var DataRouterContext =
|
|
38208
|
+
var DataRouterContext = React2.createContext(null);
|
|
38070
38209
|
DataRouterContext.displayName = "DataRouter";
|
|
38071
|
-
var DataRouterStateContext =
|
|
38210
|
+
var DataRouterStateContext = React2.createContext(null);
|
|
38072
38211
|
DataRouterStateContext.displayName = "DataRouterState";
|
|
38073
|
-
|
|
38074
|
-
var ViewTransitionContext = React3.createContext({
|
|
38212
|
+
var ViewTransitionContext = React2.createContext({
|
|
38075
38213
|
isTransitioning: false
|
|
38076
38214
|
});
|
|
38077
38215
|
ViewTransitionContext.displayName = "ViewTransition";
|
|
38078
|
-
var FetchersContext =
|
|
38216
|
+
var FetchersContext = React2.createContext(
|
|
38079
38217
|
/* @__PURE__ */ new Map()
|
|
38080
38218
|
);
|
|
38081
38219
|
FetchersContext.displayName = "Fetchers";
|
|
38082
|
-
var AwaitContext =
|
|
38220
|
+
var AwaitContext = React2.createContext(null);
|
|
38083
38221
|
AwaitContext.displayName = "Await";
|
|
38084
|
-
var NavigationContext =
|
|
38222
|
+
var NavigationContext = React2.createContext(
|
|
38085
38223
|
null
|
|
38086
38224
|
);
|
|
38087
38225
|
NavigationContext.displayName = "Navigation";
|
|
38088
|
-
var LocationContext =
|
|
38226
|
+
var LocationContext = React2.createContext(
|
|
38089
38227
|
null
|
|
38090
38228
|
);
|
|
38091
38229
|
LocationContext.displayName = "Location";
|
|
38092
|
-
var RouteContext =
|
|
38230
|
+
var RouteContext = React2.createContext({
|
|
38093
38231
|
outlet: null,
|
|
38094
38232
|
matches: [],
|
|
38095
38233
|
isDataRoute: false
|
|
38096
38234
|
});
|
|
38097
38235
|
RouteContext.displayName = "Route";
|
|
38098
|
-
var RouteErrorContext =
|
|
38236
|
+
var RouteErrorContext = React2.createContext(null);
|
|
38099
38237
|
RouteErrorContext.displayName = "RouteError";
|
|
38100
38238
|
function useHref(to, { relative } = {}) {
|
|
38101
38239
|
invariant(
|
|
@@ -38104,7 +38242,7 @@ function useHref(to, { relative } = {}) {
|
|
|
38104
38242
|
// router loaded. We can help them understand how to avoid that.
|
|
38105
38243
|
`useHref() may be used only in the context of a <Router> component.`
|
|
38106
38244
|
);
|
|
38107
|
-
let { basename, navigator } =
|
|
38245
|
+
let { basename, navigator } = React2.useContext(NavigationContext);
|
|
38108
38246
|
let { hash, pathname, search } = useResolvedPath(to, { relative });
|
|
38109
38247
|
let joinedPathname = pathname;
|
|
38110
38248
|
if (basename !== "/") {
|
|
@@ -38113,7 +38251,7 @@ function useHref(to, { relative } = {}) {
|
|
|
38113
38251
|
return navigator.createHref({ pathname: joinedPathname, search, hash });
|
|
38114
38252
|
}
|
|
38115
38253
|
function useInRouterContext() {
|
|
38116
|
-
return
|
|
38254
|
+
return React2.useContext(LocationContext) != null;
|
|
38117
38255
|
}
|
|
38118
38256
|
function useLocation() {
|
|
38119
38257
|
invariant(
|
|
@@ -38122,17 +38260,17 @@ function useLocation() {
|
|
|
38122
38260
|
// router loaded. We can help them understand how to avoid that.
|
|
38123
38261
|
`useLocation() may be used only in the context of a <Router> component.`
|
|
38124
38262
|
);
|
|
38125
|
-
return
|
|
38263
|
+
return React2.useContext(LocationContext).location;
|
|
38126
38264
|
}
|
|
38127
38265
|
var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
|
|
38128
38266
|
function useIsomorphicLayoutEffect(cb) {
|
|
38129
|
-
let isStatic =
|
|
38267
|
+
let isStatic = React2.useContext(NavigationContext).static;
|
|
38130
38268
|
if (!isStatic) {
|
|
38131
|
-
|
|
38269
|
+
React2.useLayoutEffect(cb);
|
|
38132
38270
|
}
|
|
38133
38271
|
}
|
|
38134
38272
|
function useNavigate() {
|
|
38135
|
-
let { isDataRoute } =
|
|
38273
|
+
let { isDataRoute } = React2.useContext(RouteContext);
|
|
38136
38274
|
return isDataRoute ? useNavigateStable() : useNavigateUnstable();
|
|
38137
38275
|
}
|
|
38138
38276
|
function useNavigateUnstable() {
|
|
@@ -38142,16 +38280,16 @@ function useNavigateUnstable() {
|
|
|
38142
38280
|
// router loaded. We can help them understand how to avoid that.
|
|
38143
38281
|
`useNavigate() may be used only in the context of a <Router> component.`
|
|
38144
38282
|
);
|
|
38145
|
-
let dataRouterContext =
|
|
38146
|
-
let { basename, navigator } =
|
|
38147
|
-
let { matches } =
|
|
38283
|
+
let dataRouterContext = React2.useContext(DataRouterContext);
|
|
38284
|
+
let { basename, navigator } = React2.useContext(NavigationContext);
|
|
38285
|
+
let { matches } = React2.useContext(RouteContext);
|
|
38148
38286
|
let { pathname: locationPathname } = useLocation();
|
|
38149
38287
|
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
38150
|
-
let activeRef =
|
|
38288
|
+
let activeRef = React2.useRef(false);
|
|
38151
38289
|
useIsomorphicLayoutEffect(() => {
|
|
38152
38290
|
activeRef.current = true;
|
|
38153
38291
|
});
|
|
38154
|
-
let navigate =
|
|
38292
|
+
let navigate = React2.useCallback(
|
|
38155
38293
|
(to, options = {}) => {
|
|
38156
38294
|
warning(activeRef.current, navigateEffectWarning);
|
|
38157
38295
|
if (!activeRef.current) return;
|
|
@@ -38184,12 +38322,12 @@ function useNavigateUnstable() {
|
|
|
38184
38322
|
);
|
|
38185
38323
|
return navigate;
|
|
38186
38324
|
}
|
|
38187
|
-
|
|
38325
|
+
React2.createContext(null);
|
|
38188
38326
|
function useResolvedPath(to, { relative } = {}) {
|
|
38189
|
-
let { matches } =
|
|
38327
|
+
let { matches } = React2.useContext(RouteContext);
|
|
38190
38328
|
let { pathname: locationPathname } = useLocation();
|
|
38191
38329
|
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
38192
|
-
return
|
|
38330
|
+
return React2.useMemo(
|
|
38193
38331
|
() => resolveTo(
|
|
38194
38332
|
to,
|
|
38195
38333
|
JSON.parse(routePathnamesJson),
|
|
@@ -38199,15 +38337,15 @@ function useResolvedPath(to, { relative } = {}) {
|
|
|
38199
38337
|
[to, routePathnamesJson, locationPathname, relative]
|
|
38200
38338
|
);
|
|
38201
38339
|
}
|
|
38202
|
-
function useRoutesImpl(routes, locationArg, dataRouterState,
|
|
38340
|
+
function useRoutesImpl(routes, locationArg, dataRouterState, future) {
|
|
38203
38341
|
invariant(
|
|
38204
38342
|
useInRouterContext(),
|
|
38205
38343
|
// TODO: This error is probably because they somehow have 2 versions of the
|
|
38206
38344
|
// router loaded. We can help them understand how to avoid that.
|
|
38207
38345
|
`useRoutes() may be used only in the context of a <Router> component.`
|
|
38208
38346
|
);
|
|
38209
|
-
let { navigator } =
|
|
38210
|
-
let { matches: parentMatches } =
|
|
38347
|
+
let { navigator } = React2.useContext(NavigationContext);
|
|
38348
|
+
let { matches: parentMatches } = React2.useContext(RouteContext);
|
|
38211
38349
|
let routeMatch = parentMatches[parentMatches.length - 1];
|
|
38212
38350
|
let parentParams = routeMatch ? routeMatch.params : {};
|
|
38213
38351
|
let parentPathname = routeMatch ? routeMatch.pathname : "/";
|
|
@@ -38264,7 +38402,6 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
|
|
|
38264
38402
|
),
|
|
38265
38403
|
parentMatches,
|
|
38266
38404
|
dataRouterState,
|
|
38267
|
-
unstable_onError,
|
|
38268
38405
|
future
|
|
38269
38406
|
);
|
|
38270
38407
|
return renderedMatches;
|
|
@@ -38282,12 +38419,12 @@ function DefaultErrorComponent() {
|
|
|
38282
38419
|
"Error handled by React Router default ErrorBoundary:",
|
|
38283
38420
|
error
|
|
38284
38421
|
);
|
|
38285
|
-
devInfo = /* @__PURE__ */
|
|
38422
|
+
devInfo = /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("p", null, "\u{1F4BF} Hey developer \u{1F44B}"), /* @__PURE__ */ React2.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ React2.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ React2.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
|
|
38286
38423
|
}
|
|
38287
|
-
return /* @__PURE__ */
|
|
38424
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ React2.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ React2.createElement("pre", { style: preStyles }, stack) : null, devInfo);
|
|
38288
38425
|
}
|
|
38289
|
-
var defaultErrorElement = /* @__PURE__ */
|
|
38290
|
-
var RenderErrorBoundary = class extends
|
|
38426
|
+
var defaultErrorElement = /* @__PURE__ */ React2.createElement(DefaultErrorComponent, null);
|
|
38427
|
+
var RenderErrorBoundary = class extends React2.Component {
|
|
38291
38428
|
constructor(props) {
|
|
38292
38429
|
super(props);
|
|
38293
38430
|
this.state = {
|
|
@@ -38314,17 +38451,14 @@ var RenderErrorBoundary = class extends React3.Component {
|
|
|
38314
38451
|
};
|
|
38315
38452
|
}
|
|
38316
38453
|
componentDidCatch(error, errorInfo) {
|
|
38317
|
-
|
|
38318
|
-
|
|
38319
|
-
|
|
38320
|
-
|
|
38321
|
-
|
|
38322
|
-
error
|
|
38323
|
-
);
|
|
38324
|
-
}
|
|
38454
|
+
console.error(
|
|
38455
|
+
"React Router caught the following error during render",
|
|
38456
|
+
error,
|
|
38457
|
+
errorInfo
|
|
38458
|
+
);
|
|
38325
38459
|
}
|
|
38326
38460
|
render() {
|
|
38327
|
-
return this.state.error !== void 0 ? /* @__PURE__ */
|
|
38461
|
+
return this.state.error !== void 0 ? /* @__PURE__ */ React2.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React2.createElement(
|
|
38328
38462
|
RouteErrorContext.Provider,
|
|
38329
38463
|
{
|
|
38330
38464
|
value: this.state.error,
|
|
@@ -38334,13 +38468,13 @@ var RenderErrorBoundary = class extends React3.Component {
|
|
|
38334
38468
|
}
|
|
38335
38469
|
};
|
|
38336
38470
|
function RenderedRoute({ routeContext, match, children }) {
|
|
38337
|
-
let dataRouterContext =
|
|
38471
|
+
let dataRouterContext = React2.useContext(DataRouterContext);
|
|
38338
38472
|
if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
|
|
38339
38473
|
dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
|
|
38340
38474
|
}
|
|
38341
|
-
return /* @__PURE__ */
|
|
38475
|
+
return /* @__PURE__ */ React2.createElement(RouteContext.Provider, { value: routeContext }, children);
|
|
38342
38476
|
}
|
|
38343
|
-
function _renderMatches(matches, parentMatches = [], dataRouterState = null,
|
|
38477
|
+
function _renderMatches(matches, parentMatches = [], dataRouterState = null, future = null) {
|
|
38344
38478
|
if (matches == null) {
|
|
38345
38479
|
if (!dataRouterState) {
|
|
38346
38480
|
return null;
|
|
@@ -38393,88 +38527,84 @@ function _renderMatches(matches, parentMatches = [], dataRouterState = null, uns
|
|
|
38393
38527
|
}
|
|
38394
38528
|
}
|
|
38395
38529
|
}
|
|
38396
|
-
return renderedMatches.reduceRight(
|
|
38397
|
-
|
|
38398
|
-
|
|
38399
|
-
|
|
38400
|
-
|
|
38401
|
-
|
|
38402
|
-
|
|
38403
|
-
|
|
38404
|
-
|
|
38405
|
-
if (
|
|
38406
|
-
|
|
38407
|
-
|
|
38408
|
-
|
|
38409
|
-
|
|
38410
|
-
|
|
38411
|
-
|
|
38412
|
-
|
|
38413
|
-
|
|
38414
|
-
|
|
38415
|
-
|
|
38416
|
-
hydrateFallbackElement = match.route.hydrateFallbackElement || null;
|
|
38417
|
-
}
|
|
38530
|
+
return renderedMatches.reduceRight((outlet, match, index) => {
|
|
38531
|
+
let error;
|
|
38532
|
+
let shouldRenderHydrateFallback = false;
|
|
38533
|
+
let errorElement = null;
|
|
38534
|
+
let hydrateFallbackElement = null;
|
|
38535
|
+
if (dataRouterState) {
|
|
38536
|
+
error = errors && match.route.id ? errors[match.route.id] : void 0;
|
|
38537
|
+
errorElement = match.route.errorElement || defaultErrorElement;
|
|
38538
|
+
if (renderFallback) {
|
|
38539
|
+
if (fallbackIndex < 0 && index === 0) {
|
|
38540
|
+
warningOnce(
|
|
38541
|
+
"route-fallback",
|
|
38542
|
+
false,
|
|
38543
|
+
"No `HydrateFallback` element provided to render during initial hydration"
|
|
38544
|
+
);
|
|
38545
|
+
shouldRenderHydrateFallback = true;
|
|
38546
|
+
hydrateFallbackElement = null;
|
|
38547
|
+
} else if (fallbackIndex === index) {
|
|
38548
|
+
shouldRenderHydrateFallback = true;
|
|
38549
|
+
hydrateFallbackElement = match.route.hydrateFallbackElement || null;
|
|
38418
38550
|
}
|
|
38419
38551
|
}
|
|
38420
|
-
|
|
38421
|
-
|
|
38422
|
-
|
|
38423
|
-
|
|
38424
|
-
|
|
38425
|
-
|
|
38426
|
-
|
|
38427
|
-
|
|
38428
|
-
|
|
38429
|
-
|
|
38430
|
-
|
|
38431
|
-
|
|
38432
|
-
|
|
38433
|
-
|
|
38434
|
-
|
|
38435
|
-
|
|
38436
|
-
|
|
38437
|
-
match,
|
|
38438
|
-
routeContext: {
|
|
38439
|
-
outlet,
|
|
38440
|
-
matches: matches2,
|
|
38441
|
-
isDataRoute: dataRouterState != null
|
|
38442
|
-
},
|
|
38443
|
-
children
|
|
38444
|
-
}
|
|
38445
|
-
);
|
|
38446
|
-
};
|
|
38447
|
-
return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3.createElement(
|
|
38448
|
-
RenderErrorBoundary,
|
|
38552
|
+
}
|
|
38553
|
+
let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
|
|
38554
|
+
let getChildren = () => {
|
|
38555
|
+
let children;
|
|
38556
|
+
if (error) {
|
|
38557
|
+
children = errorElement;
|
|
38558
|
+
} else if (shouldRenderHydrateFallback) {
|
|
38559
|
+
children = hydrateFallbackElement;
|
|
38560
|
+
} else if (match.route.Component) {
|
|
38561
|
+
children = /* @__PURE__ */ React2.createElement(match.route.Component, null);
|
|
38562
|
+
} else if (match.route.element) {
|
|
38563
|
+
children = match.route.element;
|
|
38564
|
+
} else {
|
|
38565
|
+
children = outlet;
|
|
38566
|
+
}
|
|
38567
|
+
return /* @__PURE__ */ React2.createElement(
|
|
38568
|
+
RenderedRoute,
|
|
38449
38569
|
{
|
|
38450
|
-
|
|
38451
|
-
|
|
38452
|
-
|
|
38453
|
-
|
|
38454
|
-
|
|
38455
|
-
|
|
38456
|
-
|
|
38570
|
+
match,
|
|
38571
|
+
routeContext: {
|
|
38572
|
+
outlet,
|
|
38573
|
+
matches: matches2,
|
|
38574
|
+
isDataRoute: dataRouterState != null
|
|
38575
|
+
},
|
|
38576
|
+
children
|
|
38457
38577
|
}
|
|
38458
|
-
)
|
|
38459
|
-
}
|
|
38460
|
-
|
|
38461
|
-
|
|
38578
|
+
);
|
|
38579
|
+
};
|
|
38580
|
+
return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React2.createElement(
|
|
38581
|
+
RenderErrorBoundary,
|
|
38582
|
+
{
|
|
38583
|
+
location: dataRouterState.location,
|
|
38584
|
+
revalidation: dataRouterState.revalidation,
|
|
38585
|
+
component: errorElement,
|
|
38586
|
+
error,
|
|
38587
|
+
children: getChildren(),
|
|
38588
|
+
routeContext: { outlet: null, matches: matches2, isDataRoute: true }
|
|
38589
|
+
}
|
|
38590
|
+
) : getChildren();
|
|
38591
|
+
}, null);
|
|
38462
38592
|
}
|
|
38463
38593
|
function getDataRouterConsoleError(hookName) {
|
|
38464
38594
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
38465
38595
|
}
|
|
38466
38596
|
function useDataRouterContext(hookName) {
|
|
38467
|
-
let ctx =
|
|
38597
|
+
let ctx = React2.useContext(DataRouterContext);
|
|
38468
38598
|
invariant(ctx, getDataRouterConsoleError(hookName));
|
|
38469
38599
|
return ctx;
|
|
38470
38600
|
}
|
|
38471
38601
|
function useDataRouterState(hookName) {
|
|
38472
|
-
let state =
|
|
38602
|
+
let state = React2.useContext(DataRouterStateContext);
|
|
38473
38603
|
invariant(state, getDataRouterConsoleError(hookName));
|
|
38474
38604
|
return state;
|
|
38475
38605
|
}
|
|
38476
38606
|
function useRouteContext(hookName) {
|
|
38477
|
-
let route =
|
|
38607
|
+
let route = React2.useContext(RouteContext);
|
|
38478
38608
|
invariant(route, getDataRouterConsoleError(hookName));
|
|
38479
38609
|
return route;
|
|
38480
38610
|
}
|
|
@@ -38491,7 +38621,7 @@ function useRouteId() {
|
|
|
38491
38621
|
return useCurrentRouteId("useRouteId" /* UseRouteId */);
|
|
38492
38622
|
}
|
|
38493
38623
|
function useRouteError() {
|
|
38494
|
-
let error =
|
|
38624
|
+
let error = React2.useContext(RouteErrorContext);
|
|
38495
38625
|
let state = useDataRouterState("useRouteError" /* UseRouteError */);
|
|
38496
38626
|
let routeId = useCurrentRouteId("useRouteError" /* UseRouteError */);
|
|
38497
38627
|
if (error !== void 0) {
|
|
@@ -38502,11 +38632,11 @@ function useRouteError() {
|
|
|
38502
38632
|
function useNavigateStable() {
|
|
38503
38633
|
let { router } = useDataRouterContext("useNavigate" /* UseNavigateStable */);
|
|
38504
38634
|
let id = useCurrentRouteId("useNavigate" /* UseNavigateStable */);
|
|
38505
|
-
let activeRef =
|
|
38635
|
+
let activeRef = React2.useRef(false);
|
|
38506
38636
|
useIsomorphicLayoutEffect(() => {
|
|
38507
38637
|
activeRef.current = true;
|
|
38508
38638
|
});
|
|
38509
|
-
let navigate =
|
|
38639
|
+
let navigate = React2.useCallback(
|
|
38510
38640
|
async (to, options = {}) => {
|
|
38511
38641
|
warning(activeRef.current, navigateEffectWarning);
|
|
38512
38642
|
if (!activeRef.current) return;
|
|
@@ -38527,14 +38657,13 @@ function warningOnce(key, cond, message) {
|
|
|
38527
38657
|
warning(false, message);
|
|
38528
38658
|
}
|
|
38529
38659
|
}
|
|
38530
|
-
|
|
38660
|
+
React2.memo(DataRoutes);
|
|
38531
38661
|
function DataRoutes({
|
|
38532
38662
|
routes,
|
|
38533
38663
|
future,
|
|
38534
|
-
state
|
|
38535
|
-
unstable_onError
|
|
38664
|
+
state
|
|
38536
38665
|
}) {
|
|
38537
|
-
return useRoutesImpl(routes, void 0, state,
|
|
38666
|
+
return useRoutesImpl(routes, void 0, state, future);
|
|
38538
38667
|
}
|
|
38539
38668
|
function Router({
|
|
38540
38669
|
basename: basenameProp = "/",
|
|
@@ -38549,7 +38678,7 @@ function Router({
|
|
|
38549
38678
|
`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`
|
|
38550
38679
|
);
|
|
38551
38680
|
let basename = basenameProp.replace(/^\/*/, "/");
|
|
38552
|
-
let navigationContext =
|
|
38681
|
+
let navigationContext = React2.useMemo(
|
|
38553
38682
|
() => ({
|
|
38554
38683
|
basename,
|
|
38555
38684
|
navigator,
|
|
@@ -38568,7 +38697,7 @@ function Router({
|
|
|
38568
38697
|
state = null,
|
|
38569
38698
|
key = "default"
|
|
38570
38699
|
} = locationProp;
|
|
38571
|
-
let locationContext =
|
|
38700
|
+
let locationContext = React2.useMemo(() => {
|
|
38572
38701
|
let trailingPathname = stripBasename(pathname, basename);
|
|
38573
38702
|
if (trailingPathname == null) {
|
|
38574
38703
|
return null;
|
|
@@ -38591,7 +38720,7 @@ function Router({
|
|
|
38591
38720
|
if (locationContext == null) {
|
|
38592
38721
|
return null;
|
|
38593
38722
|
}
|
|
38594
|
-
return /* @__PURE__ */
|
|
38723
|
+
return /* @__PURE__ */ React2.createElement(NavigationContext.Provider, { value: navigationContext }, /* @__PURE__ */ React2.createElement(LocationContext.Provider, { children, value: locationContext }));
|
|
38595
38724
|
}
|
|
38596
38725
|
|
|
38597
38726
|
// lib/dom/dom.ts
|
|
@@ -38698,7 +38827,6 @@ function getFormSubmissionInfo(target, basename) {
|
|
|
38698
38827
|
}
|
|
38699
38828
|
return { action, method: method.toLowerCase(), encType, formData, body };
|
|
38700
38829
|
}
|
|
38701
|
-
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
38702
38830
|
|
|
38703
38831
|
// lib/dom/ssr/invariant.ts
|
|
38704
38832
|
function invariant2(value, message) {
|
|
@@ -38706,22 +38834,6 @@ function invariant2(value, message) {
|
|
|
38706
38834
|
throw new Error(message);
|
|
38707
38835
|
}
|
|
38708
38836
|
}
|
|
38709
|
-
function singleFetchUrl(reqUrl, basename, extension) {
|
|
38710
|
-
let url = typeof reqUrl === "string" ? new URL(
|
|
38711
|
-
reqUrl,
|
|
38712
|
-
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
38713
|
-
// don't assume window is available
|
|
38714
|
-
typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
|
|
38715
|
-
) : reqUrl;
|
|
38716
|
-
if (url.pathname === "/") {
|
|
38717
|
-
url.pathname = `_root.${extension}`;
|
|
38718
|
-
} else if (basename && stripBasename(url.pathname, basename) === "/") {
|
|
38719
|
-
url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
|
|
38720
|
-
} else {
|
|
38721
|
-
url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
|
|
38722
|
-
}
|
|
38723
|
-
return url;
|
|
38724
|
-
}
|
|
38725
38837
|
|
|
38726
38838
|
// lib/dom/ssr/routeModules.ts
|
|
38727
38839
|
async function loadRouteModule(route, routeModulesCache) {
|
|
@@ -38868,10 +38980,28 @@ function dedupeLinkDescriptors(descriptors, preloads) {
|
|
|
38868
38980
|
return deduped;
|
|
38869
38981
|
}, []);
|
|
38870
38982
|
}
|
|
38983
|
+
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
38984
|
+
var NO_BODY_STATUS_CODES = /* @__PURE__ */ new Set([100, 101, 204, 205]);
|
|
38985
|
+
function singleFetchUrl(reqUrl, basename) {
|
|
38986
|
+
let url = typeof reqUrl === "string" ? new URL(
|
|
38987
|
+
reqUrl,
|
|
38988
|
+
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
38989
|
+
// don't assume window is available
|
|
38990
|
+
typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
|
|
38991
|
+
) : reqUrl;
|
|
38992
|
+
if (url.pathname === "/") {
|
|
38993
|
+
url.pathname = "_root.data";
|
|
38994
|
+
} else if (basename && stripBasename(url.pathname, basename) === "/") {
|
|
38995
|
+
url.pathname = `${basename.replace(/\/$/, "")}/_root.data`;
|
|
38996
|
+
} else {
|
|
38997
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
|
|
38998
|
+
}
|
|
38999
|
+
return url;
|
|
39000
|
+
}
|
|
38871
39001
|
|
|
38872
39002
|
// lib/dom/ssr/components.tsx
|
|
38873
39003
|
function useDataRouterContext2() {
|
|
38874
|
-
let context =
|
|
39004
|
+
let context = React2.useContext(DataRouterContext);
|
|
38875
39005
|
invariant2(
|
|
38876
39006
|
context,
|
|
38877
39007
|
"You must render this element inside a <DataRouterContext.Provider> element"
|
|
@@ -38879,17 +39009,17 @@ function useDataRouterContext2() {
|
|
|
38879
39009
|
return context;
|
|
38880
39010
|
}
|
|
38881
39011
|
function useDataRouterStateContext() {
|
|
38882
|
-
let context =
|
|
39012
|
+
let context = React2.useContext(DataRouterStateContext);
|
|
38883
39013
|
invariant2(
|
|
38884
39014
|
context,
|
|
38885
39015
|
"You must render this element inside a <DataRouterStateContext.Provider> element"
|
|
38886
39016
|
);
|
|
38887
39017
|
return context;
|
|
38888
39018
|
}
|
|
38889
|
-
var FrameworkContext =
|
|
39019
|
+
var FrameworkContext = React2.createContext(void 0);
|
|
38890
39020
|
FrameworkContext.displayName = "FrameworkContext";
|
|
38891
39021
|
function useFrameworkContext() {
|
|
38892
|
-
let context =
|
|
39022
|
+
let context = React2.useContext(FrameworkContext);
|
|
38893
39023
|
invariant2(
|
|
38894
39024
|
context,
|
|
38895
39025
|
"You must render this element inside a <HydratedRouter> element"
|
|
@@ -38897,12 +39027,12 @@ function useFrameworkContext() {
|
|
|
38897
39027
|
return context;
|
|
38898
39028
|
}
|
|
38899
39029
|
function usePrefetchBehavior(prefetch, theirElementProps) {
|
|
38900
|
-
let frameworkContext =
|
|
38901
|
-
let [maybePrefetch, setMaybePrefetch] =
|
|
38902
|
-
let [shouldPrefetch, setShouldPrefetch] =
|
|
39030
|
+
let frameworkContext = React2.useContext(FrameworkContext);
|
|
39031
|
+
let [maybePrefetch, setMaybePrefetch] = React2.useState(false);
|
|
39032
|
+
let [shouldPrefetch, setShouldPrefetch] = React2.useState(false);
|
|
38903
39033
|
let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
|
|
38904
|
-
let ref =
|
|
38905
|
-
|
|
39034
|
+
let ref = React2.useRef(null);
|
|
39035
|
+
React2.useEffect(() => {
|
|
38906
39036
|
if (prefetch === "render") {
|
|
38907
39037
|
setShouldPrefetch(true);
|
|
38908
39038
|
}
|
|
@@ -38919,7 +39049,7 @@ function usePrefetchBehavior(prefetch, theirElementProps) {
|
|
|
38919
39049
|
};
|
|
38920
39050
|
}
|
|
38921
39051
|
}, [prefetch]);
|
|
38922
|
-
|
|
39052
|
+
React2.useEffect(() => {
|
|
38923
39053
|
if (maybePrefetch) {
|
|
38924
39054
|
let id = setTimeout(() => {
|
|
38925
39055
|
setShouldPrefetch(true);
|
|
@@ -38962,21 +39092,24 @@ function composeEventHandlers(theirHandler, ourHandler) {
|
|
|
38962
39092
|
}
|
|
38963
39093
|
};
|
|
38964
39094
|
}
|
|
38965
|
-
function PrefetchPageLinks({
|
|
39095
|
+
function PrefetchPageLinks({
|
|
39096
|
+
page,
|
|
39097
|
+
...dataLinkProps
|
|
39098
|
+
}) {
|
|
38966
39099
|
let { router } = useDataRouterContext2();
|
|
38967
|
-
let matches =
|
|
39100
|
+
let matches = React2.useMemo(
|
|
38968
39101
|
() => matchRoutes(router.routes, page, router.basename),
|
|
38969
39102
|
[router.routes, page, router.basename]
|
|
38970
39103
|
);
|
|
38971
39104
|
if (!matches) {
|
|
38972
39105
|
return null;
|
|
38973
39106
|
}
|
|
38974
|
-
return /* @__PURE__ */
|
|
39107
|
+
return /* @__PURE__ */ React2.createElement(PrefetchPageLinksImpl, { page, matches, ...dataLinkProps });
|
|
38975
39108
|
}
|
|
38976
39109
|
function useKeyedPrefetchLinks(matches) {
|
|
38977
39110
|
let { manifest, routeModules } = useFrameworkContext();
|
|
38978
|
-
let [keyedPrefetchLinks, setKeyedPrefetchLinks] =
|
|
38979
|
-
|
|
39111
|
+
let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React2.useState([]);
|
|
39112
|
+
React2.useEffect(() => {
|
|
38980
39113
|
let interrupted = false;
|
|
38981
39114
|
void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
|
|
38982
39115
|
(links) => {
|
|
@@ -39000,7 +39133,7 @@ function PrefetchPageLinksImpl({
|
|
|
39000
39133
|
let { manifest, routeModules } = useFrameworkContext();
|
|
39001
39134
|
let { basename } = useDataRouterContext2();
|
|
39002
39135
|
let { loaderData, matches } = useDataRouterStateContext();
|
|
39003
|
-
let newMatchesForData =
|
|
39136
|
+
let newMatchesForData = React2.useMemo(
|
|
39004
39137
|
() => getNewMatchesForLinks(
|
|
39005
39138
|
page,
|
|
39006
39139
|
nextMatches,
|
|
@@ -39011,7 +39144,7 @@ function PrefetchPageLinksImpl({
|
|
|
39011
39144
|
),
|
|
39012
39145
|
[page, nextMatches, matches, manifest, location]
|
|
39013
39146
|
);
|
|
39014
|
-
let newMatchesForAssets =
|
|
39147
|
+
let newMatchesForAssets = React2.useMemo(
|
|
39015
39148
|
() => getNewMatchesForLinks(
|
|
39016
39149
|
page,
|
|
39017
39150
|
nextMatches,
|
|
@@ -39022,7 +39155,7 @@ function PrefetchPageLinksImpl({
|
|
|
39022
39155
|
),
|
|
39023
39156
|
[page, nextMatches, matches, manifest, location]
|
|
39024
39157
|
);
|
|
39025
|
-
let dataHrefs =
|
|
39158
|
+
let dataHrefs = React2.useMemo(() => {
|
|
39026
39159
|
if (page === location.pathname + location.search + location.hash) {
|
|
39027
39160
|
return [];
|
|
39028
39161
|
}
|
|
@@ -39044,7 +39177,7 @@ function PrefetchPageLinksImpl({
|
|
|
39044
39177
|
if (routesParams.size === 0) {
|
|
39045
39178
|
return [];
|
|
39046
39179
|
}
|
|
39047
|
-
let url = singleFetchUrl(page, basename
|
|
39180
|
+
let url = singleFetchUrl(page, basename);
|
|
39048
39181
|
if (foundOptOutRoute && routesParams.size > 0) {
|
|
39049
39182
|
url.searchParams.set(
|
|
39050
39183
|
"_routes",
|
|
@@ -39062,15 +39195,15 @@ function PrefetchPageLinksImpl({
|
|
|
39062
39195
|
page,
|
|
39063
39196
|
routeModules
|
|
39064
39197
|
]);
|
|
39065
|
-
let moduleHrefs =
|
|
39198
|
+
let moduleHrefs = React2.useMemo(
|
|
39066
39199
|
() => getModuleLinkHrefs(newMatchesForAssets, manifest),
|
|
39067
39200
|
[newMatchesForAssets, manifest]
|
|
39068
39201
|
);
|
|
39069
39202
|
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
39070
|
-
return /* @__PURE__ */
|
|
39203
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, dataHrefs.map((href2) => /* @__PURE__ */ React2.createElement("link", { key: href2, rel: "prefetch", as: "fetch", href: href2, ...linkProps })), moduleHrefs.map((href2) => /* @__PURE__ */ React2.createElement("link", { key: href2, rel: "modulepreload", href: href2, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
|
|
39071
39204
|
// these don't spread `linkProps` because they are full link descriptors
|
|
39072
39205
|
// already with their own props
|
|
39073
|
-
/* @__PURE__ */
|
|
39206
|
+
/* @__PURE__ */ React2.createElement("link", { key, ...link })
|
|
39074
39207
|
)));
|
|
39075
39208
|
}
|
|
39076
39209
|
function mergeRefs(...refs) {
|
|
@@ -39084,11 +39217,12 @@ function mergeRefs(...refs) {
|
|
|
39084
39217
|
});
|
|
39085
39218
|
};
|
|
39086
39219
|
}
|
|
39220
|
+
|
|
39221
|
+
// lib/dom/lib.tsx
|
|
39087
39222
|
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
39088
39223
|
try {
|
|
39089
39224
|
if (isBrowser) {
|
|
39090
|
-
window.__reactRouterVersion =
|
|
39091
|
-
"7.8.2";
|
|
39225
|
+
window.__reactRouterVersion = "7.6.2";
|
|
39092
39226
|
}
|
|
39093
39227
|
} catch (e) {
|
|
39094
39228
|
}
|
|
@@ -39097,23 +39231,23 @@ function BrowserRouter({
|
|
|
39097
39231
|
children,
|
|
39098
39232
|
window: window2
|
|
39099
39233
|
}) {
|
|
39100
|
-
let historyRef =
|
|
39234
|
+
let historyRef = React2.useRef();
|
|
39101
39235
|
if (historyRef.current == null) {
|
|
39102
39236
|
historyRef.current = createBrowserHistory({ window: window2, v5Compat: true });
|
|
39103
39237
|
}
|
|
39104
39238
|
let history = historyRef.current;
|
|
39105
|
-
let [state, setStateImpl] =
|
|
39239
|
+
let [state, setStateImpl] = React2.useState({
|
|
39106
39240
|
action: history.action,
|
|
39107
39241
|
location: history.location
|
|
39108
39242
|
});
|
|
39109
|
-
let setState =
|
|
39243
|
+
let setState = React2.useCallback(
|
|
39110
39244
|
(newState) => {
|
|
39111
|
-
|
|
39245
|
+
React2.startTransition(() => setStateImpl(newState));
|
|
39112
39246
|
},
|
|
39113
39247
|
[setStateImpl]
|
|
39114
39248
|
);
|
|
39115
|
-
|
|
39116
|
-
return /* @__PURE__ */
|
|
39249
|
+
React2.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
39250
|
+
return /* @__PURE__ */ React2.createElement(
|
|
39117
39251
|
Router,
|
|
39118
39252
|
{
|
|
39119
39253
|
basename,
|
|
@@ -39125,7 +39259,7 @@ function BrowserRouter({
|
|
|
39125
39259
|
);
|
|
39126
39260
|
}
|
|
39127
39261
|
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
39128
|
-
var Link$1 =
|
|
39262
|
+
var Link$1 = React2.forwardRef(
|
|
39129
39263
|
function LinkWithRef({
|
|
39130
39264
|
onClick,
|
|
39131
39265
|
discover = "render",
|
|
@@ -39140,7 +39274,7 @@ var Link$1 = React3.forwardRef(
|
|
|
39140
39274
|
viewTransition,
|
|
39141
39275
|
...rest
|
|
39142
39276
|
}, forwardedRef) {
|
|
39143
|
-
let { basename } =
|
|
39277
|
+
let { basename } = React2.useContext(NavigationContext);
|
|
39144
39278
|
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
|
|
39145
39279
|
let absoluteHref;
|
|
39146
39280
|
let isExternal = false;
|
|
@@ -39164,7 +39298,7 @@ var Link$1 = React3.forwardRef(
|
|
|
39164
39298
|
}
|
|
39165
39299
|
}
|
|
39166
39300
|
}
|
|
39167
|
-
let
|
|
39301
|
+
let href2 = useHref(to, { relative });
|
|
39168
39302
|
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
39169
39303
|
prefetch,
|
|
39170
39304
|
rest
|
|
@@ -39185,12 +39319,12 @@ var Link$1 = React3.forwardRef(
|
|
|
39185
39319
|
}
|
|
39186
39320
|
let link = (
|
|
39187
39321
|
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
39188
|
-
/* @__PURE__ */
|
|
39322
|
+
/* @__PURE__ */ React2.createElement(
|
|
39189
39323
|
"a",
|
|
39190
39324
|
{
|
|
39191
39325
|
...rest,
|
|
39192
39326
|
...prefetchHandlers,
|
|
39193
|
-
href: absoluteHref ||
|
|
39327
|
+
href: absoluteHref || href2,
|
|
39194
39328
|
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
39195
39329
|
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
39196
39330
|
target,
|
|
@@ -39198,11 +39332,11 @@ var Link$1 = React3.forwardRef(
|
|
|
39198
39332
|
}
|
|
39199
39333
|
)
|
|
39200
39334
|
);
|
|
39201
|
-
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */
|
|
39335
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, link, /* @__PURE__ */ React2.createElement(PrefetchPageLinks, { page: href2 })) : link;
|
|
39202
39336
|
}
|
|
39203
39337
|
);
|
|
39204
39338
|
Link$1.displayName = "Link";
|
|
39205
|
-
var NavLink =
|
|
39339
|
+
var NavLink = React2.forwardRef(
|
|
39206
39340
|
function NavLinkWithRef({
|
|
39207
39341
|
"aria-current": ariaCurrentProp = "page",
|
|
39208
39342
|
caseSensitive = false,
|
|
@@ -39216,8 +39350,8 @@ var NavLink = React3.forwardRef(
|
|
|
39216
39350
|
}, ref) {
|
|
39217
39351
|
let path = useResolvedPath(to, { relative: rest.relative });
|
|
39218
39352
|
let location = useLocation();
|
|
39219
|
-
let routerState =
|
|
39220
|
-
let { navigator, basename } =
|
|
39353
|
+
let routerState = React2.useContext(DataRouterStateContext);
|
|
39354
|
+
let { navigator, basename } = React2.useContext(NavigationContext);
|
|
39221
39355
|
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
39222
39356
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
39223
39357
|
useViewTransitionState(path) && viewTransition === true;
|
|
@@ -39253,7 +39387,7 @@ var NavLink = React3.forwardRef(
|
|
|
39253
39387
|
].filter(Boolean).join(" ");
|
|
39254
39388
|
}
|
|
39255
39389
|
let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
|
|
39256
|
-
return /* @__PURE__ */
|
|
39390
|
+
return /* @__PURE__ */ React2.createElement(
|
|
39257
39391
|
Link$1,
|
|
39258
39392
|
{
|
|
39259
39393
|
...rest,
|
|
@@ -39269,7 +39403,7 @@ var NavLink = React3.forwardRef(
|
|
|
39269
39403
|
}
|
|
39270
39404
|
);
|
|
39271
39405
|
NavLink.displayName = "NavLink";
|
|
39272
|
-
var Form =
|
|
39406
|
+
var Form = React2.forwardRef(
|
|
39273
39407
|
({
|
|
39274
39408
|
discover = "render",
|
|
39275
39409
|
fetcherKey,
|
|
@@ -39306,7 +39440,7 @@ var Form = React3.forwardRef(
|
|
|
39306
39440
|
viewTransition
|
|
39307
39441
|
});
|
|
39308
39442
|
};
|
|
39309
|
-
return /* @__PURE__ */
|
|
39443
|
+
return /* @__PURE__ */ React2.createElement(
|
|
39310
39444
|
"form",
|
|
39311
39445
|
{
|
|
39312
39446
|
ref: forwardedRef,
|
|
@@ -39324,7 +39458,7 @@ function getDataRouterConsoleError2(hookName) {
|
|
|
39324
39458
|
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
39325
39459
|
}
|
|
39326
39460
|
function useDataRouterContext3(hookName) {
|
|
39327
|
-
let ctx =
|
|
39461
|
+
let ctx = React2.useContext(DataRouterContext);
|
|
39328
39462
|
invariant(ctx, getDataRouterConsoleError2(hookName));
|
|
39329
39463
|
return ctx;
|
|
39330
39464
|
}
|
|
@@ -39339,7 +39473,7 @@ function useLinkClickHandler(to, {
|
|
|
39339
39473
|
let navigate = useNavigate();
|
|
39340
39474
|
let location = useLocation();
|
|
39341
39475
|
let path = useResolvedPath(to, { relative });
|
|
39342
|
-
return
|
|
39476
|
+
return React2.useCallback(
|
|
39343
39477
|
(event) => {
|
|
39344
39478
|
if (shouldProcessLinkClick(event, target)) {
|
|
39345
39479
|
event.preventDefault();
|
|
@@ -39371,9 +39505,9 @@ var fetcherId = 0;
|
|
|
39371
39505
|
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
39372
39506
|
function useSubmit() {
|
|
39373
39507
|
let { router } = useDataRouterContext3("useSubmit" /* UseSubmit */);
|
|
39374
|
-
let { basename } =
|
|
39508
|
+
let { basename } = React2.useContext(NavigationContext);
|
|
39375
39509
|
let currentRouteId = useRouteId();
|
|
39376
|
-
return
|
|
39510
|
+
return React2.useCallback(
|
|
39377
39511
|
async (target, options = {}) => {
|
|
39378
39512
|
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
39379
39513
|
target,
|
|
@@ -39408,8 +39542,8 @@ function useSubmit() {
|
|
|
39408
39542
|
);
|
|
39409
39543
|
}
|
|
39410
39544
|
function useFormAction(action, { relative } = {}) {
|
|
39411
|
-
let { basename } =
|
|
39412
|
-
let routeContext =
|
|
39545
|
+
let { basename } = React2.useContext(NavigationContext);
|
|
39546
|
+
let routeContext = React2.useContext(RouteContext);
|
|
39413
39547
|
invariant(routeContext, "useFormAction must be used inside a RouteContext");
|
|
39414
39548
|
let [match] = routeContext.matches.slice(-1);
|
|
39415
39549
|
let path = { ...useResolvedPath(action ? action : ".", { relative }) };
|
|
@@ -39434,8 +39568,8 @@ function useFormAction(action, { relative } = {}) {
|
|
|
39434
39568
|
}
|
|
39435
39569
|
return createPath(path);
|
|
39436
39570
|
}
|
|
39437
|
-
function useViewTransitionState(to,
|
|
39438
|
-
let vtContext =
|
|
39571
|
+
function useViewTransitionState(to, opts = {}) {
|
|
39572
|
+
let vtContext = React2.useContext(ViewTransitionContext);
|
|
39439
39573
|
invariant(
|
|
39440
39574
|
vtContext != null,
|
|
39441
39575
|
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
@@ -39443,7 +39577,7 @@ function useViewTransitionState(to, { relative } = {}) {
|
|
|
39443
39577
|
let { basename } = useDataRouterContext3(
|
|
39444
39578
|
"useViewTransitionState" /* useViewTransitionState */
|
|
39445
39579
|
);
|
|
39446
|
-
let path = useResolvedPath(to, { relative });
|
|
39580
|
+
let path = useResolvedPath(to, { relative: opts.relative });
|
|
39447
39581
|
if (!vtContext.isTransitioning) {
|
|
39448
39582
|
return false;
|
|
39449
39583
|
}
|
|
@@ -39452,6 +39586,12 @@ function useViewTransitionState(to, { relative } = {}) {
|
|
|
39452
39586
|
return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
|
|
39453
39587
|
}
|
|
39454
39588
|
|
|
39589
|
+
// lib/server-runtime/single-fetch.ts
|
|
39590
|
+
/* @__PURE__ */ new Set([
|
|
39591
|
+
...NO_BODY_STATUS_CODES,
|
|
39592
|
+
304
|
|
39593
|
+
]);
|
|
39594
|
+
|
|
39455
39595
|
const Section = ({
|
|
39456
39596
|
items,
|
|
39457
39597
|
title,
|