@konstructio/ui 0.0.2 → 0.0.3
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/{AlertDialogTrigger-BIbxXexQ.js → AlertDialogTrigger-lenvKoGF.js} +4 -4
- package/dist/Modal-Bg9UG35z.js +909 -0
- package/dist/{chevron-up-Cmu1oXfj.js → chevron-up-CvquEaNg.js} +1 -1
- package/dist/clsx-OuTLNxxd.js +16 -0
- package/dist/components/AlertDialog/AlertDialog.js +1 -1
- package/dist/components/AlertDialog/AlertDialog.variants.d.ts +1 -1
- package/dist/components/AlertDialog/AlertDialog.variants.js +4 -5
- package/dist/components/AlertDialog/components/AlertDialogTrigger.js +1 -1
- package/dist/components/AlertDialog/components/index.js +1 -1
- package/dist/components/Autocomplete/Autocomplete.variants.d.ts +2 -2
- package/dist/components/Autocomplete/Autocomplete.variants.js +8 -8
- package/dist/components/Autocomplete/components/List.types.d.ts +3 -3
- package/dist/components/Autocomplete/components/List.variants.d.ts +4 -4
- package/dist/components/Autocomplete/components/List.variants.js +13 -13
- package/dist/components/Autocomplete/hooks/useAutocomplete.d.ts +4 -4
- package/dist/components/Autocomplete/hooks/useNavigationList.d.ts +4 -4
- package/dist/components/Breadcrumb/Breadcrumb.js +57 -412
- package/dist/components/Breadcrumb/Breadcrumb.variants.d.ts +3 -3
- package/dist/components/Breadcrumb/Breadcrumb.variants.js +12 -12
- package/dist/components/Breadcrumb/hooks/useBreadcrumb.js +1 -1
- package/dist/components/Button/Button.js +23 -21
- package/dist/components/Button/Button.variants.d.ts +2 -1
- package/dist/components/Button/Button.variants.js +122 -23
- package/dist/components/Checkbox/Checkbox.js +4 -4
- package/dist/components/Checkbox/Checkbox.variants.d.ts +2 -2
- package/dist/components/Checkbox/Checkbox.variants.js +7 -16
- package/dist/components/Dropdown/Dropdown.js +5 -5
- package/dist/components/Dropdown/Dropdown.types.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.variants.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.variants.js +5 -9
- package/dist/components/Dropdown/components/List/List.d.ts +2 -2
- package/dist/components/Dropdown/components/List/List.types.d.ts +3 -3
- package/dist/components/Dropdown/components/List/List.variants.d.ts +1 -1
- package/dist/components/Dropdown/components/List/List.variants.js +3 -3
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.d.ts +1 -1
- package/dist/components/Dropdown/components/ListItem/ListItem.variants.js +3 -3
- package/dist/components/Dropdown/components/Wrapper.d.ts +2 -2
- package/dist/components/Dropdown/components/Wrapper.js +1 -1
- package/dist/components/Dropdown/contexts/dropdown.provider.d.ts +4 -1
- package/dist/components/Dropdown/contexts/dropdown.provider.js +19 -8
- package/dist/components/Dropdown/hooks/useDropdown.d.ts +4 -4
- package/dist/components/Dropdown/hooks/useNavigationList.d.ts +4 -4
- package/dist/components/Input/Input.js +1 -1
- package/dist/components/Input/Input.variants.d.ts +1 -1
- package/dist/components/Input/Input.variants.js +3 -3
- package/dist/components/Modal/Modal.js +2 -2
- package/dist/components/Modal/components/Body/Body.js +1 -1
- package/dist/components/Modal/components/Footer/Footer.js +1 -1
- package/dist/components/Modal/components/Header/Header.js +1 -1
- package/dist/components/Modal/components/Wrapper/Wrapper.js +4 -3
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.d.ts +2 -2
- package/dist/components/Modal/components/Wrapper/Wrapper.variants.js +10 -10
- package/dist/components/Modal/components/index.js +1 -1
- package/dist/components/Modal/hooks/useModal.d.ts +1 -1
- package/dist/components/NumberInput/NumberInput.js +96 -87
- package/dist/components/NumberInput/NumberInput.variants.d.ts +3 -3
- package/dist/components/NumberInput/NumberInput.variants.js +14 -21
- package/dist/components/ProgressBar/ProgressBar.variants.d.ts +2 -2
- package/dist/components/ProgressBar/ProgressBar.variants.js +7 -12
- package/dist/components/Radio/Radio.variants.d.ts +1 -1
- package/dist/components/Radio/Radio.variants.js +4 -7
- package/dist/components/RadioGroup/RadioGroup.js +1 -1
- package/dist/components/Range/Range.js +1 -1
- package/dist/components/Range/Range.variants.d.ts +4 -4
- package/dist/components/Range/Range.variants.js +18 -18
- package/dist/components/Slider/Slider.js +1 -1
- package/dist/components/Slider/Slider.variants.d.ts +3 -3
- package/dist/components/Slider/Slider.variants.js +12 -12
- package/dist/components/Switch/Switch.js +2 -2
- package/dist/components/Switch/Switch.variants.d.ts +2 -2
- package/dist/components/Switch/Switch.variants.js +6 -6
- package/dist/components/Tag/Tag.variants.js +1 -1
- package/dist/components/TagSelect/TagSelect.js +1 -1
- package/dist/components/TagSelect/TagSelect.variants.d.ts +3 -3
- package/dist/components/TagSelect/TagSelect.variants.js +11 -14
- package/dist/components/TagSelect/hooks/useTagSelect.d.ts +1 -1
- package/dist/components/TextArea/TextArea.variants.d.ts +1 -1
- package/dist/components/TextArea/TextArea.variants.js +5 -5
- package/dist/components/Toast/Toast.js +104 -101
- package/dist/components/Toast/Toast.variants.d.ts +3 -3
- package/dist/components/Toast/Toast.variants.js +12 -12
- package/dist/components/Tooltip/Tooltip.js +1 -1
- package/dist/components/Tooltip/Tooltip.variants.d.ts +2 -2
- package/dist/components/Tooltip/Tooltip.variants.js +9 -9
- package/dist/components/Tooltip/hooks/useTooltip.d.ts +1 -1
- package/dist/components/index.js +1 -1
- package/dist/contexts/theme.context.d.ts +1 -1
- package/dist/contexts/theme.hook.js +3 -6
- package/dist/contexts/theme.provider.d.ts +2 -3
- package/dist/contexts/theme.provider.js +4 -1
- package/dist/index-BBjak_0p.js +47 -0
- package/dist/index-BNmRGtA6.js +34 -0
- package/dist/{index-DFbnnPzA.js → index-Ci9Yg4G1.js} +5 -5
- package/dist/{index-B_GWswUP.js → index-D4Q2rMby.js} +1 -1
- package/dist/{index-DQMInta3.js → index-D68N8v8R.js} +214 -209
- package/dist/index-DoOsnuB6.js +72 -0
- package/dist/{index-2K8qjK4R.js → index-O3j1K921.js} +36 -37
- package/dist/index-OOfdXoxx.js +423 -0
- package/dist/index-ffjBR8Av.js +32 -0
- package/dist/index.js +1 -1
- package/dist/package.json +38 -38
- package/dist/plugins/konstruct.js +61 -50
- package/dist/plugins/utils/colors.d.ts +127 -10
- package/dist/plugins/utils/colors.js +210 -510
- package/dist/styles.css +1 -1
- package/dist/useBreadcrumb-tyxjV-a1.js +1398 -0
- package/dist/utils/index.js +150 -162
- package/dist/x-CRBgmX1Q.js +62 -0
- package/package.json +38 -38
- package/dist/Modal-CO0_SnXD.js +0 -909
- package/dist/index-2hJuj4UN.js +0 -19069
- package/dist/index-4qm4jAkj.js +0 -92
- package/dist/index-BJ7FQg17.js +0 -35
- package/dist/index-BqM_XclQ.js +0 -94
- package/dist/index-BwYCDOHZ.js +0 -44
- package/dist/index-CCavb-1K.js +0 -57
- package/dist/useBreadcrumb-BSMnc4Fu.js +0 -341
|
@@ -0,0 +1,1398 @@
|
|
|
1
|
+
import * as u from "react";
|
|
2
|
+
import { useContext as Ee } from "react";
|
|
3
|
+
var O = {}, ne;
|
|
4
|
+
function Re() {
|
|
5
|
+
if (ne) return O;
|
|
6
|
+
ne = 1, Object.defineProperty(O, "__esModule", { value: !0 }), O.parse = s, O.serialize = o;
|
|
7
|
+
const e = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/, t = /^[\u0021-\u003A\u003C-\u007E]*$/, r = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i, a = /^[\u0020-\u003A\u003D-\u007E]*$/, n = Object.prototype.toString, i = /* @__PURE__ */ (() => {
|
|
8
|
+
const f = function() {
|
|
9
|
+
};
|
|
10
|
+
return f.prototype = /* @__PURE__ */ Object.create(null), f;
|
|
11
|
+
})();
|
|
12
|
+
function s(f, p) {
|
|
13
|
+
const d = new i(), y = f.length;
|
|
14
|
+
if (y < 2)
|
|
15
|
+
return d;
|
|
16
|
+
const v = (p == null ? void 0 : p.decode) || m;
|
|
17
|
+
let h = 0;
|
|
18
|
+
do {
|
|
19
|
+
const w = f.indexOf("=", h);
|
|
20
|
+
if (w === -1)
|
|
21
|
+
break;
|
|
22
|
+
const x = f.indexOf(";", h), E = x === -1 ? y : x;
|
|
23
|
+
if (w > E) {
|
|
24
|
+
h = f.lastIndexOf(";", w - 1) + 1;
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
const b = c(f, h, w), F = l(f, w, b), $ = f.slice(b, F);
|
|
28
|
+
if (d[$] === void 0) {
|
|
29
|
+
let T = c(f, w + 1, E), R = l(f, E, T);
|
|
30
|
+
const I = v(f.slice(T, R));
|
|
31
|
+
d[$] = I;
|
|
32
|
+
}
|
|
33
|
+
h = E + 1;
|
|
34
|
+
} while (h < y);
|
|
35
|
+
return d;
|
|
36
|
+
}
|
|
37
|
+
function c(f, p, d) {
|
|
38
|
+
do {
|
|
39
|
+
const y = f.charCodeAt(p);
|
|
40
|
+
if (y !== 32 && y !== 9)
|
|
41
|
+
return p;
|
|
42
|
+
} while (++p < d);
|
|
43
|
+
return d;
|
|
44
|
+
}
|
|
45
|
+
function l(f, p, d) {
|
|
46
|
+
for (; p > d; ) {
|
|
47
|
+
const y = f.charCodeAt(--p);
|
|
48
|
+
if (y !== 32 && y !== 9)
|
|
49
|
+
return p + 1;
|
|
50
|
+
}
|
|
51
|
+
return d;
|
|
52
|
+
}
|
|
53
|
+
function o(f, p, d) {
|
|
54
|
+
const y = (d == null ? void 0 : d.encode) || encodeURIComponent;
|
|
55
|
+
if (!e.test(f))
|
|
56
|
+
throw new TypeError(`argument name is invalid: ${f}`);
|
|
57
|
+
const v = y(p);
|
|
58
|
+
if (!t.test(v))
|
|
59
|
+
throw new TypeError(`argument val is invalid: ${p}`);
|
|
60
|
+
let h = f + "=" + v;
|
|
61
|
+
if (!d)
|
|
62
|
+
return h;
|
|
63
|
+
if (d.maxAge !== void 0) {
|
|
64
|
+
if (!Number.isInteger(d.maxAge))
|
|
65
|
+
throw new TypeError(`option maxAge is invalid: ${d.maxAge}`);
|
|
66
|
+
h += "; Max-Age=" + d.maxAge;
|
|
67
|
+
}
|
|
68
|
+
if (d.domain) {
|
|
69
|
+
if (!r.test(d.domain))
|
|
70
|
+
throw new TypeError(`option domain is invalid: ${d.domain}`);
|
|
71
|
+
h += "; Domain=" + d.domain;
|
|
72
|
+
}
|
|
73
|
+
if (d.path) {
|
|
74
|
+
if (!a.test(d.path))
|
|
75
|
+
throw new TypeError(`option path is invalid: ${d.path}`);
|
|
76
|
+
h += "; Path=" + d.path;
|
|
77
|
+
}
|
|
78
|
+
if (d.expires) {
|
|
79
|
+
if (!g(d.expires) || !Number.isFinite(d.expires.valueOf()))
|
|
80
|
+
throw new TypeError(`option expires is invalid: ${d.expires}`);
|
|
81
|
+
h += "; Expires=" + d.expires.toUTCString();
|
|
82
|
+
}
|
|
83
|
+
if (d.httpOnly && (h += "; HttpOnly"), d.secure && (h += "; Secure"), d.partitioned && (h += "; Partitioned"), d.priority)
|
|
84
|
+
switch (typeof d.priority == "string" ? d.priority.toLowerCase() : void 0) {
|
|
85
|
+
case "low":
|
|
86
|
+
h += "; Priority=Low";
|
|
87
|
+
break;
|
|
88
|
+
case "medium":
|
|
89
|
+
h += "; Priority=Medium";
|
|
90
|
+
break;
|
|
91
|
+
case "high":
|
|
92
|
+
h += "; Priority=High";
|
|
93
|
+
break;
|
|
94
|
+
default:
|
|
95
|
+
throw new TypeError(`option priority is invalid: ${d.priority}`);
|
|
96
|
+
}
|
|
97
|
+
if (d.sameSite)
|
|
98
|
+
switch (typeof d.sameSite == "string" ? d.sameSite.toLowerCase() : d.sameSite) {
|
|
99
|
+
case !0:
|
|
100
|
+
case "strict":
|
|
101
|
+
h += "; SameSite=Strict";
|
|
102
|
+
break;
|
|
103
|
+
case "lax":
|
|
104
|
+
h += "; SameSite=Lax";
|
|
105
|
+
break;
|
|
106
|
+
case "none":
|
|
107
|
+
h += "; SameSite=None";
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
throw new TypeError(`option sameSite is invalid: ${d.sameSite}`);
|
|
111
|
+
}
|
|
112
|
+
return h;
|
|
113
|
+
}
|
|
114
|
+
function m(f) {
|
|
115
|
+
if (f.indexOf("%") === -1)
|
|
116
|
+
return f;
|
|
117
|
+
try {
|
|
118
|
+
return decodeURIComponent(f);
|
|
119
|
+
} catch {
|
|
120
|
+
return f;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function g(f) {
|
|
124
|
+
return n.call(f) === "[object Date]";
|
|
125
|
+
}
|
|
126
|
+
return O;
|
|
127
|
+
}
|
|
128
|
+
Re();
|
|
129
|
+
/**
|
|
130
|
+
* react-router v7.0.2
|
|
131
|
+
*
|
|
132
|
+
* Copyright (c) Remix Software Inc.
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the MIT license found in the
|
|
135
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
136
|
+
*
|
|
137
|
+
* @license MIT
|
|
138
|
+
*/
|
|
139
|
+
function C(e, t) {
|
|
140
|
+
if (e === !1 || e === null || typeof e > "u")
|
|
141
|
+
throw new Error(t);
|
|
142
|
+
}
|
|
143
|
+
function k(e, t) {
|
|
144
|
+
if (!e) {
|
|
145
|
+
typeof console < "u" && console.warn(t);
|
|
146
|
+
try {
|
|
147
|
+
throw new Error(t);
|
|
148
|
+
} catch {
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function q({
|
|
153
|
+
pathname: e = "/",
|
|
154
|
+
search: t = "",
|
|
155
|
+
hash: r = ""
|
|
156
|
+
}) {
|
|
157
|
+
return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), r && r !== "#" && (e += r.charAt(0) === "#" ? r : "#" + r), e;
|
|
158
|
+
}
|
|
159
|
+
function Y(e) {
|
|
160
|
+
let t = {};
|
|
161
|
+
if (e) {
|
|
162
|
+
let r = e.indexOf("#");
|
|
163
|
+
r >= 0 && (t.hash = e.substring(r), e = e.substring(0, r));
|
|
164
|
+
let a = e.indexOf("?");
|
|
165
|
+
a >= 0 && (t.search = e.substring(a), e = e.substring(0, a)), e && (t.pathname = e);
|
|
166
|
+
}
|
|
167
|
+
return t;
|
|
168
|
+
}
|
|
169
|
+
function le(e, t, r = "/") {
|
|
170
|
+
return be(e, t, r, !1);
|
|
171
|
+
}
|
|
172
|
+
function be(e, t, r, a) {
|
|
173
|
+
let n = typeof t == "string" ? Y(t) : t, i = D(n.pathname || "/", r);
|
|
174
|
+
if (i == null)
|
|
175
|
+
return null;
|
|
176
|
+
let s = ue(e);
|
|
177
|
+
Se(s);
|
|
178
|
+
let c = null;
|
|
179
|
+
for (let l = 0; c == null && l < s.length; ++l) {
|
|
180
|
+
let o = Oe(i);
|
|
181
|
+
c = Fe(
|
|
182
|
+
s[l],
|
|
183
|
+
o,
|
|
184
|
+
a
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return c;
|
|
188
|
+
}
|
|
189
|
+
function ue(e, t = [], r = [], a = "") {
|
|
190
|
+
let n = (i, s, c) => {
|
|
191
|
+
let l = {
|
|
192
|
+
relativePath: c === void 0 ? i.path || "" : c,
|
|
193
|
+
caseSensitive: i.caseSensitive === !0,
|
|
194
|
+
childrenIndex: s,
|
|
195
|
+
route: i
|
|
196
|
+
};
|
|
197
|
+
l.relativePath.startsWith("/") && (C(
|
|
198
|
+
l.relativePath.startsWith(a),
|
|
199
|
+
`Absolute route path "${l.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
200
|
+
), l.relativePath = l.relativePath.slice(a.length));
|
|
201
|
+
let o = P([a, l.relativePath]), m = r.concat(l);
|
|
202
|
+
i.children && i.children.length > 0 && (C(
|
|
203
|
+
// Our types know better, but runtime JS may not!
|
|
204
|
+
// @ts-expect-error
|
|
205
|
+
i.index !== !0,
|
|
206
|
+
`Index routes must not have child routes. Please remove all child routes from route path "${o}".`
|
|
207
|
+
), ue(i.children, t, m, o)), !(i.path == null && !i.index) && t.push({
|
|
208
|
+
path: o,
|
|
209
|
+
score: De(o, i.index),
|
|
210
|
+
routesMeta: m
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
return e.forEach((i, s) => {
|
|
214
|
+
var c;
|
|
215
|
+
if (i.path === "" || !((c = i.path) != null && c.includes("?")))
|
|
216
|
+
n(i, s);
|
|
217
|
+
else
|
|
218
|
+
for (let l of se(i.path))
|
|
219
|
+
n(i, s, l);
|
|
220
|
+
}), t;
|
|
221
|
+
}
|
|
222
|
+
function se(e) {
|
|
223
|
+
let t = e.split("/");
|
|
224
|
+
if (t.length === 0) return [];
|
|
225
|
+
let [r, ...a] = t, n = r.endsWith("?"), i = r.replace(/\?$/, "");
|
|
226
|
+
if (a.length === 0)
|
|
227
|
+
return n ? [i, ""] : [i];
|
|
228
|
+
let s = se(a.join("/")), c = [];
|
|
229
|
+
return c.push(
|
|
230
|
+
...s.map(
|
|
231
|
+
(l) => l === "" ? i : [i, l].join("/")
|
|
232
|
+
)
|
|
233
|
+
), n && c.push(...s), c.map(
|
|
234
|
+
(l) => e.startsWith("/") && l === "" ? "/" : l
|
|
235
|
+
);
|
|
236
|
+
}
|
|
237
|
+
function Se(e) {
|
|
238
|
+
e.sort(
|
|
239
|
+
(t, r) => t.score !== r.score ? r.score - t.score : Ne(
|
|
240
|
+
t.routesMeta.map((a) => a.childrenIndex),
|
|
241
|
+
r.routesMeta.map((a) => a.childrenIndex)
|
|
242
|
+
)
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
var Pe = /^:[\w-]+$/, ke = 3, Le = 2, $e = 1, Ie = 10, Te = -2, ae = (e) => e === "*";
|
|
246
|
+
function De(e, t) {
|
|
247
|
+
let r = e.split("/"), a = r.length;
|
|
248
|
+
return r.some(ae) && (a += Te), t && (a += Le), r.filter((n) => !ae(n)).reduce(
|
|
249
|
+
(n, i) => n + (Pe.test(i) ? ke : i === "" ? $e : Ie),
|
|
250
|
+
a
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
function Ne(e, t) {
|
|
254
|
+
return e.length === t.length && e.slice(0, -1).every((a, n) => a === t[n]) ? (
|
|
255
|
+
// If two routes are siblings, we should try to match the earlier sibling
|
|
256
|
+
// first. This allows people to have fine-grained control over the matching
|
|
257
|
+
// behavior by simply putting routes with identical paths in the order they
|
|
258
|
+
// want them tried.
|
|
259
|
+
e[e.length - 1] - t[t.length - 1]
|
|
260
|
+
) : (
|
|
261
|
+
// Otherwise, it doesn't really make sense to rank non-siblings by index,
|
|
262
|
+
// so they sort equally.
|
|
263
|
+
0
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
function Fe(e, t, r = !1) {
|
|
267
|
+
let { routesMeta: a } = e, n = {}, i = "/", s = [];
|
|
268
|
+
for (let c = 0; c < a.length; ++c) {
|
|
269
|
+
let l = a[c], o = c === a.length - 1, m = i === "/" ? t : t.slice(i.length) || "/", g = H(
|
|
270
|
+
{ path: l.relativePath, caseSensitive: l.caseSensitive, end: o },
|
|
271
|
+
m
|
|
272
|
+
), f = l.route;
|
|
273
|
+
if (!g && o && r && !a[a.length - 1].route.index && (g = H(
|
|
274
|
+
{
|
|
275
|
+
path: l.relativePath,
|
|
276
|
+
caseSensitive: l.caseSensitive,
|
|
277
|
+
end: !1
|
|
278
|
+
},
|
|
279
|
+
m
|
|
280
|
+
)), !g)
|
|
281
|
+
return null;
|
|
282
|
+
Object.assign(n, g.params), s.push({
|
|
283
|
+
// TODO: Can this as be avoided?
|
|
284
|
+
params: n,
|
|
285
|
+
pathname: P([i, g.pathname]),
|
|
286
|
+
pathnameBase: Ue(
|
|
287
|
+
P([i, g.pathnameBase])
|
|
288
|
+
),
|
|
289
|
+
route: f
|
|
290
|
+
}), g.pathnameBase !== "/" && (i = P([i, g.pathnameBase]));
|
|
291
|
+
}
|
|
292
|
+
return s;
|
|
293
|
+
}
|
|
294
|
+
function H(e, t) {
|
|
295
|
+
typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
|
|
296
|
+
let [r, a] = Ae(
|
|
297
|
+
e.path,
|
|
298
|
+
e.caseSensitive,
|
|
299
|
+
e.end
|
|
300
|
+
), n = t.match(r);
|
|
301
|
+
if (!n) return null;
|
|
302
|
+
let i = n[0], s = i.replace(/(.)\/+$/, "$1"), c = n.slice(1);
|
|
303
|
+
return {
|
|
304
|
+
params: a.reduce(
|
|
305
|
+
(o, { paramName: m, isOptional: g }, f) => {
|
|
306
|
+
if (m === "*") {
|
|
307
|
+
let d = c[f] || "";
|
|
308
|
+
s = i.slice(0, i.length - d.length).replace(/(.)\/+$/, "$1");
|
|
309
|
+
}
|
|
310
|
+
const p = c[f];
|
|
311
|
+
return g && !p ? o[m] = void 0 : o[m] = (p || "").replace(/%2F/g, "/"), o;
|
|
312
|
+
},
|
|
313
|
+
{}
|
|
314
|
+
),
|
|
315
|
+
pathname: i,
|
|
316
|
+
pathnameBase: s,
|
|
317
|
+
pattern: e
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function Ae(e, t = !1, r = !0) {
|
|
321
|
+
k(
|
|
322
|
+
e === "*" || !e.endsWith("*") || e.endsWith("/*"),
|
|
323
|
+
`Route path "${e}" will be treated as if it were "${e.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/, "/*")}".`
|
|
324
|
+
);
|
|
325
|
+
let a = [], n = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
|
|
326
|
+
/\/:([\w-]+)(\?)?/g,
|
|
327
|
+
(s, c, l) => (a.push({ paramName: c, isOptional: l != null }), l ? "/?([^\\/]+)?" : "/([^\\/]+)")
|
|
328
|
+
);
|
|
329
|
+
return e.endsWith("*") ? (a.push({ paramName: "*" }), n += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : r ? n += "\\/*$" : e !== "" && e !== "/" && (n += "(?:(?=\\/|$))"), [new RegExp(n, t ? void 0 : "i"), a];
|
|
330
|
+
}
|
|
331
|
+
function Oe(e) {
|
|
332
|
+
try {
|
|
333
|
+
return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
|
|
334
|
+
} catch (t) {
|
|
335
|
+
return k(
|
|
336
|
+
!1,
|
|
337
|
+
`The URL path "${e}" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`
|
|
338
|
+
), e;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function D(e, t) {
|
|
342
|
+
if (t === "/") return e;
|
|
343
|
+
if (!e.toLowerCase().startsWith(t.toLowerCase()))
|
|
344
|
+
return null;
|
|
345
|
+
let r = t.endsWith("/") ? t.length - 1 : t.length, a = e.charAt(r);
|
|
346
|
+
return a && a !== "/" ? null : e.slice(r) || "/";
|
|
347
|
+
}
|
|
348
|
+
function Me(e, t = "/") {
|
|
349
|
+
let {
|
|
350
|
+
pathname: r,
|
|
351
|
+
search: a = "",
|
|
352
|
+
hash: n = ""
|
|
353
|
+
} = typeof e == "string" ? Y(e) : e;
|
|
354
|
+
return {
|
|
355
|
+
pathname: r ? r.startsWith("/") ? r : Be(r, t) : t,
|
|
356
|
+
search: _e(a),
|
|
357
|
+
hash: He(n)
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
function Be(e, t) {
|
|
361
|
+
let r = t.replace(/\/+$/, "").split("/");
|
|
362
|
+
return e.split("/").forEach((n) => {
|
|
363
|
+
n === ".." ? r.length > 1 && r.pop() : n !== "." && r.push(n);
|
|
364
|
+
}), r.length > 1 ? r.join("/") : "/";
|
|
365
|
+
}
|
|
366
|
+
function J(e, t, r, a) {
|
|
367
|
+
return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
|
|
368
|
+
a
|
|
369
|
+
)}]. Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
|
|
370
|
+
}
|
|
371
|
+
function We(e) {
|
|
372
|
+
return e.filter(
|
|
373
|
+
(t, r) => r === 0 || t.route.path && t.route.path.length > 0
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
function ce(e) {
|
|
377
|
+
let t = We(e);
|
|
378
|
+
return t.map(
|
|
379
|
+
(r, a) => a === t.length - 1 ? r.pathname : r.pathnameBase
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
function fe(e, t, r, a = !1) {
|
|
383
|
+
let n;
|
|
384
|
+
typeof e == "string" ? n = Y(e) : (n = { ...e }, C(
|
|
385
|
+
!n.pathname || !n.pathname.includes("?"),
|
|
386
|
+
J("?", "pathname", "search", n)
|
|
387
|
+
), C(
|
|
388
|
+
!n.pathname || !n.pathname.includes("#"),
|
|
389
|
+
J("#", "pathname", "hash", n)
|
|
390
|
+
), C(
|
|
391
|
+
!n.search || !n.search.includes("#"),
|
|
392
|
+
J("#", "search", "hash", n)
|
|
393
|
+
));
|
|
394
|
+
let i = e === "" || n.pathname === "", s = i ? "/" : n.pathname, c;
|
|
395
|
+
if (s == null)
|
|
396
|
+
c = r;
|
|
397
|
+
else {
|
|
398
|
+
let g = t.length - 1;
|
|
399
|
+
if (!a && s.startsWith("..")) {
|
|
400
|
+
let f = s.split("/");
|
|
401
|
+
for (; f[0] === ".."; )
|
|
402
|
+
f.shift(), g -= 1;
|
|
403
|
+
n.pathname = f.join("/");
|
|
404
|
+
}
|
|
405
|
+
c = g >= 0 ? t[g] : "/";
|
|
406
|
+
}
|
|
407
|
+
let l = Me(n, c), o = s && s !== "/" && s.endsWith("/"), m = (i || s === ".") && r.endsWith("/");
|
|
408
|
+
return !l.pathname.endsWith("/") && (o || m) && (l.pathname += "/"), l;
|
|
409
|
+
}
|
|
410
|
+
var P = (e) => e.join("/").replace(/\/\/+/g, "/"), Ue = (e) => e.replace(/\/+$/, "").replace(/^\/*/, "/"), _e = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, He = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e;
|
|
411
|
+
function ze(e) {
|
|
412
|
+
return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
|
|
413
|
+
}
|
|
414
|
+
var de = [
|
|
415
|
+
"POST",
|
|
416
|
+
"PUT",
|
|
417
|
+
"PATCH",
|
|
418
|
+
"DELETE"
|
|
419
|
+
];
|
|
420
|
+
new Set(
|
|
421
|
+
de
|
|
422
|
+
);
|
|
423
|
+
var Ve = [
|
|
424
|
+
"GET",
|
|
425
|
+
...de
|
|
426
|
+
];
|
|
427
|
+
new Set(Ve);
|
|
428
|
+
var A = u.createContext(null);
|
|
429
|
+
A.displayName = "DataRouter";
|
|
430
|
+
var z = u.createContext(null);
|
|
431
|
+
z.displayName = "DataRouterState";
|
|
432
|
+
var he = u.createContext({
|
|
433
|
+
isTransitioning: !1
|
|
434
|
+
});
|
|
435
|
+
he.displayName = "ViewTransition";
|
|
436
|
+
var je = u.createContext(
|
|
437
|
+
/* @__PURE__ */ new Map()
|
|
438
|
+
);
|
|
439
|
+
je.displayName = "Fetchers";
|
|
440
|
+
var Je = u.createContext(null);
|
|
441
|
+
Je.displayName = "Await";
|
|
442
|
+
var L = u.createContext(
|
|
443
|
+
null
|
|
444
|
+
);
|
|
445
|
+
L.displayName = "Navigation";
|
|
446
|
+
var G = u.createContext(
|
|
447
|
+
null
|
|
448
|
+
);
|
|
449
|
+
G.displayName = "Location";
|
|
450
|
+
var S = u.createContext({
|
|
451
|
+
outlet: null,
|
|
452
|
+
matches: [],
|
|
453
|
+
isDataRoute: !1
|
|
454
|
+
});
|
|
455
|
+
S.displayName = "Route";
|
|
456
|
+
var X = u.createContext(null);
|
|
457
|
+
X.displayName = "RouteError";
|
|
458
|
+
function Ke(e, { relative: t } = {}) {
|
|
459
|
+
C(
|
|
460
|
+
V(),
|
|
461
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
462
|
+
// router loaded. We can help them understand how to avoid that.
|
|
463
|
+
"useHref() may be used only in the context of a <Router> component."
|
|
464
|
+
);
|
|
465
|
+
let { basename: r, navigator: a } = u.useContext(L), { hash: n, pathname: i, search: s } = B(e, { relative: t }), c = i;
|
|
466
|
+
return r !== "/" && (c = i === "/" ? r : P([r, i])), a.createHref({ pathname: c, search: s, hash: n });
|
|
467
|
+
}
|
|
468
|
+
function V() {
|
|
469
|
+
return u.useContext(G) != null;
|
|
470
|
+
}
|
|
471
|
+
function N() {
|
|
472
|
+
return C(
|
|
473
|
+
V(),
|
|
474
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
475
|
+
// router loaded. We can help them understand how to avoid that.
|
|
476
|
+
"useLocation() may be used only in the context of a <Router> component."
|
|
477
|
+
), u.useContext(G).location;
|
|
478
|
+
}
|
|
479
|
+
var me = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
|
|
480
|
+
function pe(e) {
|
|
481
|
+
u.useContext(L).static || u.useLayoutEffect(e);
|
|
482
|
+
}
|
|
483
|
+
function qe() {
|
|
484
|
+
let { isDataRoute: e } = u.useContext(S);
|
|
485
|
+
return e ? lt() : Ye();
|
|
486
|
+
}
|
|
487
|
+
function Ye() {
|
|
488
|
+
C(
|
|
489
|
+
V(),
|
|
490
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
491
|
+
// router loaded. We can help them understand how to avoid that.
|
|
492
|
+
"useNavigate() may be used only in the context of a <Router> component."
|
|
493
|
+
);
|
|
494
|
+
let e = u.useContext(A), { basename: t, navigator: r } = u.useContext(L), { matches: a } = u.useContext(S), { pathname: n } = N(), i = JSON.stringify(ce(a)), s = u.useRef(!1);
|
|
495
|
+
return pe(() => {
|
|
496
|
+
s.current = !0;
|
|
497
|
+
}), u.useCallback(
|
|
498
|
+
(l, o = {}) => {
|
|
499
|
+
if (k(s.current, me), !s.current) return;
|
|
500
|
+
if (typeof l == "number") {
|
|
501
|
+
r.go(l);
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
let m = fe(
|
|
505
|
+
l,
|
|
506
|
+
JSON.parse(i),
|
|
507
|
+
n,
|
|
508
|
+
o.relative === "path"
|
|
509
|
+
);
|
|
510
|
+
e == null && t !== "/" && (m.pathname = m.pathname === "/" ? t : P([t, m.pathname])), (o.replace ? r.replace : r.push)(
|
|
511
|
+
m,
|
|
512
|
+
o.state,
|
|
513
|
+
o
|
|
514
|
+
);
|
|
515
|
+
},
|
|
516
|
+
[
|
|
517
|
+
t,
|
|
518
|
+
r,
|
|
519
|
+
i,
|
|
520
|
+
n,
|
|
521
|
+
e
|
|
522
|
+
]
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
u.createContext(null);
|
|
526
|
+
function B(e, { relative: t } = {}) {
|
|
527
|
+
let { matches: r } = u.useContext(S), { pathname: a } = N(), n = JSON.stringify(ce(r));
|
|
528
|
+
return u.useMemo(
|
|
529
|
+
() => fe(
|
|
530
|
+
e,
|
|
531
|
+
JSON.parse(n),
|
|
532
|
+
a,
|
|
533
|
+
t === "path"
|
|
534
|
+
),
|
|
535
|
+
[e, n, a, t]
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
function Ge(e, t, r, a) {
|
|
539
|
+
C(
|
|
540
|
+
V(),
|
|
541
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
542
|
+
// router loaded. We can help them understand how to avoid that.
|
|
543
|
+
"useRoutes() may be used only in the context of a <Router> component."
|
|
544
|
+
);
|
|
545
|
+
let { navigator: n } = u.useContext(L), { matches: i } = u.useContext(S), s = i[i.length - 1], c = s ? s.params : {}, l = s ? s.pathname : "/", o = s ? s.pathnameBase : "/", m = s && s.route;
|
|
546
|
+
{
|
|
547
|
+
let h = m && m.path || "";
|
|
548
|
+
ge(
|
|
549
|
+
l,
|
|
550
|
+
!m || h.endsWith("*") || h.endsWith("*?"),
|
|
551
|
+
`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${h}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
552
|
+
|
|
553
|
+
Please change the parent <Route path="${h}"> to <Route path="${h === "/" ? "*" : `${h}/*`}">.`
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
let g = N(), f;
|
|
557
|
+
f = g;
|
|
558
|
+
let p = f.pathname || "/", d = p;
|
|
559
|
+
if (o !== "/") {
|
|
560
|
+
let h = o.replace(/^\//, "").split("/");
|
|
561
|
+
d = "/" + p.replace(/^\//, "").split("/").slice(h.length).join("/");
|
|
562
|
+
}
|
|
563
|
+
let y = le(e, { pathname: d });
|
|
564
|
+
return k(
|
|
565
|
+
m || y != null,
|
|
566
|
+
`No routes matched location "${f.pathname}${f.search}${f.hash}" `
|
|
567
|
+
), k(
|
|
568
|
+
y == null || y[y.length - 1].route.element !== void 0 || y[y.length - 1].route.Component !== void 0 || y[y.length - 1].route.lazy !== void 0,
|
|
569
|
+
`Matched leaf route at location "${f.pathname}${f.search}${f.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
|
|
570
|
+
), tt(
|
|
571
|
+
y && y.map(
|
|
572
|
+
(h) => Object.assign({}, h, {
|
|
573
|
+
params: Object.assign({}, c, h.params),
|
|
574
|
+
pathname: P([
|
|
575
|
+
o,
|
|
576
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
577
|
+
n.encodeLocation ? n.encodeLocation(h.pathname).pathname : h.pathname
|
|
578
|
+
]),
|
|
579
|
+
pathnameBase: h.pathnameBase === "/" ? o : P([
|
|
580
|
+
o,
|
|
581
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
582
|
+
n.encodeLocation ? n.encodeLocation(h.pathnameBase).pathname : h.pathnameBase
|
|
583
|
+
])
|
|
584
|
+
})
|
|
585
|
+
),
|
|
586
|
+
i,
|
|
587
|
+
r,
|
|
588
|
+
a
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
function Xe() {
|
|
592
|
+
let e = ot(), t = ze(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), r = e instanceof Error ? e.stack : null, a = "rgba(200,200,200, 0.5)", n = { padding: "0.5rem", backgroundColor: a }, i = { padding: "2px 4px", backgroundColor: a }, s = null;
|
|
593
|
+
return console.error(
|
|
594
|
+
"Error handled by React Router default ErrorBoundary:",
|
|
595
|
+
e
|
|
596
|
+
), s = /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ u.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ u.createElement("code", { style: i }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ u.createElement("code", { style: i }, "errorElement"), " prop on your route.")), /* @__PURE__ */ u.createElement(u.Fragment, null, /* @__PURE__ */ u.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ u.createElement("h3", { style: { fontStyle: "italic" } }, t), r ? /* @__PURE__ */ u.createElement("pre", { style: n }, r) : null, s);
|
|
597
|
+
}
|
|
598
|
+
var Qe = /* @__PURE__ */ u.createElement(Xe, null), Ze = class extends u.Component {
|
|
599
|
+
constructor(e) {
|
|
600
|
+
super(e), this.state = {
|
|
601
|
+
location: e.location,
|
|
602
|
+
revalidation: e.revalidation,
|
|
603
|
+
error: e.error
|
|
604
|
+
};
|
|
605
|
+
}
|
|
606
|
+
static getDerivedStateFromError(e) {
|
|
607
|
+
return { error: e };
|
|
608
|
+
}
|
|
609
|
+
static getDerivedStateFromProps(e, t) {
|
|
610
|
+
return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
|
|
611
|
+
error: e.error,
|
|
612
|
+
location: e.location,
|
|
613
|
+
revalidation: e.revalidation
|
|
614
|
+
} : {
|
|
615
|
+
error: e.error !== void 0 ? e.error : t.error,
|
|
616
|
+
location: t.location,
|
|
617
|
+
revalidation: e.revalidation || t.revalidation
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
componentDidCatch(e, t) {
|
|
621
|
+
console.error(
|
|
622
|
+
"React Router caught the following error during render",
|
|
623
|
+
e,
|
|
624
|
+
t
|
|
625
|
+
);
|
|
626
|
+
}
|
|
627
|
+
render() {
|
|
628
|
+
return this.state.error !== void 0 ? /* @__PURE__ */ u.createElement(S.Provider, { value: this.props.routeContext }, /* @__PURE__ */ u.createElement(
|
|
629
|
+
X.Provider,
|
|
630
|
+
{
|
|
631
|
+
value: this.state.error,
|
|
632
|
+
children: this.props.component
|
|
633
|
+
}
|
|
634
|
+
)) : this.props.children;
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
function et({ routeContext: e, match: t, children: r }) {
|
|
638
|
+
let a = u.useContext(A);
|
|
639
|
+
return a && a.static && a.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (a.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ u.createElement(S.Provider, { value: e }, r);
|
|
640
|
+
}
|
|
641
|
+
function tt(e, t = [], r = null, a = null) {
|
|
642
|
+
if (e == null) {
|
|
643
|
+
if (!r)
|
|
644
|
+
return null;
|
|
645
|
+
if (r.errors)
|
|
646
|
+
e = r.matches;
|
|
647
|
+
else if (t.length === 0 && !r.initialized && r.matches.length > 0)
|
|
648
|
+
e = r.matches;
|
|
649
|
+
else
|
|
650
|
+
return null;
|
|
651
|
+
}
|
|
652
|
+
let n = e, i = r == null ? void 0 : r.errors;
|
|
653
|
+
if (i != null) {
|
|
654
|
+
let l = n.findIndex(
|
|
655
|
+
(o) => o.route.id && (i == null ? void 0 : i[o.route.id]) !== void 0
|
|
656
|
+
);
|
|
657
|
+
C(
|
|
658
|
+
l >= 0,
|
|
659
|
+
`Could not find a matching route for errors on route IDs: ${Object.keys(
|
|
660
|
+
i
|
|
661
|
+
).join(",")}`
|
|
662
|
+
), n = n.slice(
|
|
663
|
+
0,
|
|
664
|
+
Math.min(n.length, l + 1)
|
|
665
|
+
);
|
|
666
|
+
}
|
|
667
|
+
let s = !1, c = -1;
|
|
668
|
+
if (r)
|
|
669
|
+
for (let l = 0; l < n.length; l++) {
|
|
670
|
+
let o = n[l];
|
|
671
|
+
if ((o.route.HydrateFallback || o.route.hydrateFallbackElement) && (c = l), o.route.id) {
|
|
672
|
+
let { loaderData: m, errors: g } = r, f = o.route.loader && !m.hasOwnProperty(o.route.id) && (!g || g[o.route.id] === void 0);
|
|
673
|
+
if (o.route.lazy || f) {
|
|
674
|
+
s = !0, c >= 0 ? n = n.slice(0, c + 1) : n = [n[0]];
|
|
675
|
+
break;
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
return n.reduceRight((l, o, m) => {
|
|
680
|
+
let g, f = !1, p = null, d = null;
|
|
681
|
+
r && (g = i && o.route.id ? i[o.route.id] : void 0, p = o.route.errorElement || Qe, s && (c < 0 && m === 0 ? (ge(
|
|
682
|
+
"route-fallback",
|
|
683
|
+
!1,
|
|
684
|
+
"No `HydrateFallback` element provided to render during initial hydration"
|
|
685
|
+
), f = !0, d = null) : c === m && (f = !0, d = o.route.hydrateFallbackElement || null)));
|
|
686
|
+
let y = t.concat(n.slice(0, m + 1)), v = () => {
|
|
687
|
+
let h;
|
|
688
|
+
return g ? h = p : f ? h = d : o.route.Component ? h = /* @__PURE__ */ u.createElement(o.route.Component, null) : o.route.element ? h = o.route.element : h = l, /* @__PURE__ */ u.createElement(
|
|
689
|
+
et,
|
|
690
|
+
{
|
|
691
|
+
match: o,
|
|
692
|
+
routeContext: {
|
|
693
|
+
outlet: l,
|
|
694
|
+
matches: y,
|
|
695
|
+
isDataRoute: r != null
|
|
696
|
+
},
|
|
697
|
+
children: h
|
|
698
|
+
}
|
|
699
|
+
);
|
|
700
|
+
};
|
|
701
|
+
return r && (o.route.ErrorBoundary || o.route.errorElement || m === 0) ? /* @__PURE__ */ u.createElement(
|
|
702
|
+
Ze,
|
|
703
|
+
{
|
|
704
|
+
location: r.location,
|
|
705
|
+
revalidation: r.revalidation,
|
|
706
|
+
component: p,
|
|
707
|
+
error: g,
|
|
708
|
+
children: v(),
|
|
709
|
+
routeContext: { outlet: null, matches: y, isDataRoute: !0 }
|
|
710
|
+
}
|
|
711
|
+
) : v();
|
|
712
|
+
}, null);
|
|
713
|
+
}
|
|
714
|
+
function Q(e) {
|
|
715
|
+
return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
716
|
+
}
|
|
717
|
+
function rt(e) {
|
|
718
|
+
let t = u.useContext(A);
|
|
719
|
+
return C(t, Q(e)), t;
|
|
720
|
+
}
|
|
721
|
+
function nt(e) {
|
|
722
|
+
let t = u.useContext(z);
|
|
723
|
+
return C(t, Q(e)), t;
|
|
724
|
+
}
|
|
725
|
+
function at(e) {
|
|
726
|
+
let t = u.useContext(S);
|
|
727
|
+
return C(t, Q(e)), t;
|
|
728
|
+
}
|
|
729
|
+
function Z(e) {
|
|
730
|
+
let t = at(e), r = t.matches[t.matches.length - 1];
|
|
731
|
+
return C(
|
|
732
|
+
r.route.id,
|
|
733
|
+
`${e} can only be used on routes that contain a unique "id"`
|
|
734
|
+
), r.route.id;
|
|
735
|
+
}
|
|
736
|
+
function it() {
|
|
737
|
+
return Z(
|
|
738
|
+
"useRouteId"
|
|
739
|
+
/* UseRouteId */
|
|
740
|
+
);
|
|
741
|
+
}
|
|
742
|
+
function ot() {
|
|
743
|
+
var a;
|
|
744
|
+
let e = u.useContext(X), t = nt(
|
|
745
|
+
"useRouteError"
|
|
746
|
+
/* UseRouteError */
|
|
747
|
+
), r = Z(
|
|
748
|
+
"useRouteError"
|
|
749
|
+
/* UseRouteError */
|
|
750
|
+
);
|
|
751
|
+
return e !== void 0 ? e : (a = t.errors) == null ? void 0 : a[r];
|
|
752
|
+
}
|
|
753
|
+
function lt() {
|
|
754
|
+
let { router: e } = rt(
|
|
755
|
+
"useNavigate"
|
|
756
|
+
/* UseNavigateStable */
|
|
757
|
+
), t = Z(
|
|
758
|
+
"useNavigate"
|
|
759
|
+
/* UseNavigateStable */
|
|
760
|
+
), r = u.useRef(!1);
|
|
761
|
+
return pe(() => {
|
|
762
|
+
r.current = !0;
|
|
763
|
+
}), u.useCallback(
|
|
764
|
+
async (n, i = {}) => {
|
|
765
|
+
k(r.current, me), r.current && (typeof n == "number" ? e.navigate(n) : await e.navigate(n, { fromRouteId: t, ...i }));
|
|
766
|
+
},
|
|
767
|
+
[e, t]
|
|
768
|
+
);
|
|
769
|
+
}
|
|
770
|
+
var ie = {};
|
|
771
|
+
function ge(e, t, r) {
|
|
772
|
+
!t && !ie[e] && (ie[e] = !0, k(!1, r));
|
|
773
|
+
}
|
|
774
|
+
u.memo(ut);
|
|
775
|
+
function ut({
|
|
776
|
+
routes: e,
|
|
777
|
+
future: t,
|
|
778
|
+
state: r
|
|
779
|
+
}) {
|
|
780
|
+
return Ge(e, void 0, r, t);
|
|
781
|
+
}
|
|
782
|
+
var U = "get", _ = "application/x-www-form-urlencoded";
|
|
783
|
+
function j(e) {
|
|
784
|
+
return e != null && typeof e.tagName == "string";
|
|
785
|
+
}
|
|
786
|
+
function st(e) {
|
|
787
|
+
return j(e) && e.tagName.toLowerCase() === "button";
|
|
788
|
+
}
|
|
789
|
+
function ct(e) {
|
|
790
|
+
return j(e) && e.tagName.toLowerCase() === "form";
|
|
791
|
+
}
|
|
792
|
+
function ft(e) {
|
|
793
|
+
return j(e) && e.tagName.toLowerCase() === "input";
|
|
794
|
+
}
|
|
795
|
+
function dt(e) {
|
|
796
|
+
return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
797
|
+
}
|
|
798
|
+
function ht(e, t) {
|
|
799
|
+
return e.button === 0 && // Ignore everything but left clicks
|
|
800
|
+
(!t || t === "_self") && // Let browser handle "target=_blank" etc.
|
|
801
|
+
!dt(e);
|
|
802
|
+
}
|
|
803
|
+
var W = null;
|
|
804
|
+
function mt() {
|
|
805
|
+
if (W === null)
|
|
806
|
+
try {
|
|
807
|
+
new FormData(
|
|
808
|
+
document.createElement("form"),
|
|
809
|
+
// @ts-expect-error if FormData supports the submitter parameter, this will throw
|
|
810
|
+
0
|
|
811
|
+
), W = !1;
|
|
812
|
+
} catch {
|
|
813
|
+
W = !0;
|
|
814
|
+
}
|
|
815
|
+
return W;
|
|
816
|
+
}
|
|
817
|
+
var pt = /* @__PURE__ */ new Set([
|
|
818
|
+
"application/x-www-form-urlencoded",
|
|
819
|
+
"multipart/form-data",
|
|
820
|
+
"text/plain"
|
|
821
|
+
]);
|
|
822
|
+
function K(e) {
|
|
823
|
+
return e != null && !pt.has(e) ? (k(
|
|
824
|
+
!1,
|
|
825
|
+
`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_}"`
|
|
826
|
+
), null) : e;
|
|
827
|
+
}
|
|
828
|
+
function gt(e, t) {
|
|
829
|
+
let r, a, n, i, s;
|
|
830
|
+
if (ct(e)) {
|
|
831
|
+
let c = e.getAttribute("action");
|
|
832
|
+
a = c ? D(c, t) : null, r = e.getAttribute("method") || U, n = K(e.getAttribute("enctype")) || _, i = new FormData(e);
|
|
833
|
+
} else if (st(e) || ft(e) && (e.type === "submit" || e.type === "image")) {
|
|
834
|
+
let c = e.form;
|
|
835
|
+
if (c == null)
|
|
836
|
+
throw new Error(
|
|
837
|
+
'Cannot submit a <button> or <input type="submit"> without a <form>'
|
|
838
|
+
);
|
|
839
|
+
let l = e.getAttribute("formaction") || c.getAttribute("action");
|
|
840
|
+
if (a = l ? D(l, t) : null, r = e.getAttribute("formmethod") || c.getAttribute("method") || U, n = K(e.getAttribute("formenctype")) || K(c.getAttribute("enctype")) || _, i = new FormData(c, e), !mt()) {
|
|
841
|
+
let { name: o, type: m, value: g } = e;
|
|
842
|
+
if (m === "image") {
|
|
843
|
+
let f = o ? `${o}.` : "";
|
|
844
|
+
i.append(`${f}x`, "0"), i.append(`${f}y`, "0");
|
|
845
|
+
} else o && i.append(o, g);
|
|
846
|
+
}
|
|
847
|
+
} else {
|
|
848
|
+
if (j(e))
|
|
849
|
+
throw new Error(
|
|
850
|
+
'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
|
|
851
|
+
);
|
|
852
|
+
r = U, a = null, n = _, s = e;
|
|
853
|
+
}
|
|
854
|
+
return i && n === "text/plain" && (s = i, i = void 0), { action: a, method: r.toLowerCase(), encType: n, formData: i, body: s };
|
|
855
|
+
}
|
|
856
|
+
function ee(e, t) {
|
|
857
|
+
if (e === !1 || e === null || typeof e > "u")
|
|
858
|
+
throw new Error(t);
|
|
859
|
+
}
|
|
860
|
+
async function yt(e, t) {
|
|
861
|
+
if (e.id in t)
|
|
862
|
+
return t[e.id];
|
|
863
|
+
try {
|
|
864
|
+
let r = await import(
|
|
865
|
+
/* @vite-ignore */
|
|
866
|
+
/* webpackIgnore: true */
|
|
867
|
+
e.module
|
|
868
|
+
);
|
|
869
|
+
return t[e.id] = r, r;
|
|
870
|
+
} catch (r) {
|
|
871
|
+
return console.error(
|
|
872
|
+
`Error loading route module \`${e.module}\`, reloading page...`
|
|
873
|
+
), console.error(r), window.__reactRouterContext && window.__reactRouterContext.isSpaMode, window.location.reload(), new Promise(() => {
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
function vt(e) {
|
|
878
|
+
return e == null ? !1 : e.href == null ? e.rel === "preload" && typeof e.imageSrcSet == "string" && typeof e.imageSizes == "string" : typeof e.rel == "string" && typeof e.href == "string";
|
|
879
|
+
}
|
|
880
|
+
async function wt(e, t, r) {
|
|
881
|
+
let a = await Promise.all(
|
|
882
|
+
e.map(async (n) => {
|
|
883
|
+
let i = t.routes[n.route.id];
|
|
884
|
+
if (i) {
|
|
885
|
+
let s = await yt(i, r);
|
|
886
|
+
return s.links ? s.links() : [];
|
|
887
|
+
}
|
|
888
|
+
return [];
|
|
889
|
+
})
|
|
890
|
+
);
|
|
891
|
+
return Rt(
|
|
892
|
+
a.flat(1).filter(vt).filter((n) => n.rel === "stylesheet" || n.rel === "preload").map(
|
|
893
|
+
(n) => n.rel === "stylesheet" ? { ...n, rel: "prefetch", as: "style" } : { ...n, rel: "prefetch" }
|
|
894
|
+
)
|
|
895
|
+
);
|
|
896
|
+
}
|
|
897
|
+
function oe(e, t, r, a, n, i) {
|
|
898
|
+
let s = (l, o) => r[o] ? l.route.id !== r[o].route.id : !0, c = (l, o) => {
|
|
899
|
+
var m;
|
|
900
|
+
return (
|
|
901
|
+
// param change, /users/123 -> /users/456
|
|
902
|
+
r[o].pathname !== l.pathname || // splat param changed, which is not present in match.path
|
|
903
|
+
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
904
|
+
((m = r[o].route.path) == null ? void 0 : m.endsWith("*")) && r[o].params["*"] !== l.params["*"]
|
|
905
|
+
);
|
|
906
|
+
};
|
|
907
|
+
return i === "assets" ? t.filter(
|
|
908
|
+
(l, o) => s(l, o) || c(l, o)
|
|
909
|
+
) : i === "data" ? t.filter((l, o) => {
|
|
910
|
+
var g;
|
|
911
|
+
let m = a.routes[l.route.id];
|
|
912
|
+
if (!m || !m.hasLoader)
|
|
913
|
+
return !1;
|
|
914
|
+
if (s(l, o) || c(l, o))
|
|
915
|
+
return !0;
|
|
916
|
+
if (l.route.shouldRevalidate) {
|
|
917
|
+
let f = l.route.shouldRevalidate({
|
|
918
|
+
currentUrl: new URL(
|
|
919
|
+
n.pathname + n.search + n.hash,
|
|
920
|
+
window.origin
|
|
921
|
+
),
|
|
922
|
+
currentParams: ((g = r[0]) == null ? void 0 : g.params) || {},
|
|
923
|
+
nextUrl: new URL(e, window.origin),
|
|
924
|
+
nextParams: l.params,
|
|
925
|
+
defaultShouldRevalidate: !0
|
|
926
|
+
});
|
|
927
|
+
if (typeof f == "boolean")
|
|
928
|
+
return f;
|
|
929
|
+
}
|
|
930
|
+
return !0;
|
|
931
|
+
}) : [];
|
|
932
|
+
}
|
|
933
|
+
function xt(e, t) {
|
|
934
|
+
return Ct(
|
|
935
|
+
e.map((r) => {
|
|
936
|
+
let a = t.routes[r.route.id];
|
|
937
|
+
if (!a) return [];
|
|
938
|
+
let n = [a.module];
|
|
939
|
+
return a.imports && (n = n.concat(a.imports)), n;
|
|
940
|
+
}).flat(1)
|
|
941
|
+
);
|
|
942
|
+
}
|
|
943
|
+
function Ct(e) {
|
|
944
|
+
return [...new Set(e)];
|
|
945
|
+
}
|
|
946
|
+
function Et(e) {
|
|
947
|
+
let t = {}, r = Object.keys(e).sort();
|
|
948
|
+
for (let a of r)
|
|
949
|
+
t[a] = e[a];
|
|
950
|
+
return t;
|
|
951
|
+
}
|
|
952
|
+
function Rt(e, t) {
|
|
953
|
+
let r = /* @__PURE__ */ new Set();
|
|
954
|
+
return new Set(t), e.reduce((a, n) => {
|
|
955
|
+
let i = JSON.stringify(Et(n));
|
|
956
|
+
return r.has(i) || (r.add(i), a.push({ key: i, link: n })), a;
|
|
957
|
+
}, []);
|
|
958
|
+
}
|
|
959
|
+
function bt(e) {
|
|
960
|
+
let t = typeof e == "string" ? new URL(
|
|
961
|
+
e,
|
|
962
|
+
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
963
|
+
// don't assume window is available
|
|
964
|
+
typeof window > "u" ? "server://singlefetch/" : window.location.origin
|
|
965
|
+
) : e;
|
|
966
|
+
return t.pathname === "/" ? t.pathname = "_root.data" : t.pathname = `${t.pathname.replace(/\/$/, "")}.data`, t;
|
|
967
|
+
}
|
|
968
|
+
function St() {
|
|
969
|
+
let e = u.useContext(A);
|
|
970
|
+
return ee(
|
|
971
|
+
e,
|
|
972
|
+
"You must render this element inside a <DataRouterContext.Provider> element"
|
|
973
|
+
), e;
|
|
974
|
+
}
|
|
975
|
+
function Pt() {
|
|
976
|
+
let e = u.useContext(z);
|
|
977
|
+
return ee(
|
|
978
|
+
e,
|
|
979
|
+
"You must render this element inside a <DataRouterStateContext.Provider> element"
|
|
980
|
+
), e;
|
|
981
|
+
}
|
|
982
|
+
var te = u.createContext(void 0);
|
|
983
|
+
te.displayName = "FrameworkContext";
|
|
984
|
+
function ye() {
|
|
985
|
+
let e = u.useContext(te);
|
|
986
|
+
return ee(
|
|
987
|
+
e,
|
|
988
|
+
"You must render this element inside a <HydratedRouter> element"
|
|
989
|
+
), e;
|
|
990
|
+
}
|
|
991
|
+
function kt(e, t) {
|
|
992
|
+
let r = u.useContext(te), [a, n] = u.useState(!1), [i, s] = u.useState(!1), { onFocus: c, onBlur: l, onMouseEnter: o, onMouseLeave: m, onTouchStart: g } = t, f = u.useRef(null);
|
|
993
|
+
u.useEffect(() => {
|
|
994
|
+
if (e === "render" && s(!0), e === "viewport") {
|
|
995
|
+
let y = (h) => {
|
|
996
|
+
h.forEach((w) => {
|
|
997
|
+
s(w.isIntersecting);
|
|
998
|
+
});
|
|
999
|
+
}, v = new IntersectionObserver(y, { threshold: 0.5 });
|
|
1000
|
+
return f.current && v.observe(f.current), () => {
|
|
1001
|
+
v.disconnect();
|
|
1002
|
+
};
|
|
1003
|
+
}
|
|
1004
|
+
}, [e]), u.useEffect(() => {
|
|
1005
|
+
if (a) {
|
|
1006
|
+
let y = setTimeout(() => {
|
|
1007
|
+
s(!0);
|
|
1008
|
+
}, 100);
|
|
1009
|
+
return () => {
|
|
1010
|
+
clearTimeout(y);
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
}, [a]);
|
|
1014
|
+
let p = () => {
|
|
1015
|
+
n(!0);
|
|
1016
|
+
}, d = () => {
|
|
1017
|
+
n(!1), s(!1);
|
|
1018
|
+
};
|
|
1019
|
+
return r ? e !== "intent" ? [i, f, {}] : [
|
|
1020
|
+
i,
|
|
1021
|
+
f,
|
|
1022
|
+
{
|
|
1023
|
+
onFocus: M(c, p),
|
|
1024
|
+
onBlur: M(l, d),
|
|
1025
|
+
onMouseEnter: M(o, p),
|
|
1026
|
+
onMouseLeave: M(m, d),
|
|
1027
|
+
onTouchStart: M(g, p)
|
|
1028
|
+
}
|
|
1029
|
+
] : [!1, f, {}];
|
|
1030
|
+
}
|
|
1031
|
+
function M(e, t) {
|
|
1032
|
+
return (r) => {
|
|
1033
|
+
e && e(r), r.defaultPrevented || t(r);
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
function Lt({
|
|
1037
|
+
page: e,
|
|
1038
|
+
...t
|
|
1039
|
+
}) {
|
|
1040
|
+
let { router: r } = St(), a = u.useMemo(
|
|
1041
|
+
() => le(r.routes, e, r.basename),
|
|
1042
|
+
[r.routes, e, r.basename]
|
|
1043
|
+
);
|
|
1044
|
+
return a ? /* @__PURE__ */ u.createElement(It, { page: e, matches: a, ...t }) : (console.warn(`Tried to prefetch ${e} but no routes matched.`), null);
|
|
1045
|
+
}
|
|
1046
|
+
function $t(e) {
|
|
1047
|
+
let { manifest: t, routeModules: r } = ye(), [a, n] = u.useState([]);
|
|
1048
|
+
return u.useEffect(() => {
|
|
1049
|
+
let i = !1;
|
|
1050
|
+
return wt(e, t, r).then(
|
|
1051
|
+
(s) => {
|
|
1052
|
+
i || n(s);
|
|
1053
|
+
}
|
|
1054
|
+
), () => {
|
|
1055
|
+
i = !0;
|
|
1056
|
+
};
|
|
1057
|
+
}, [e, t, r]), a;
|
|
1058
|
+
}
|
|
1059
|
+
function It({
|
|
1060
|
+
page: e,
|
|
1061
|
+
matches: t,
|
|
1062
|
+
...r
|
|
1063
|
+
}) {
|
|
1064
|
+
let a = N(), { manifest: n, routeModules: i } = ye(), { loaderData: s, matches: c } = Pt(), l = u.useMemo(
|
|
1065
|
+
() => oe(
|
|
1066
|
+
e,
|
|
1067
|
+
t,
|
|
1068
|
+
c,
|
|
1069
|
+
n,
|
|
1070
|
+
a,
|
|
1071
|
+
"data"
|
|
1072
|
+
),
|
|
1073
|
+
[e, t, c, n, a]
|
|
1074
|
+
), o = u.useMemo(
|
|
1075
|
+
() => oe(
|
|
1076
|
+
e,
|
|
1077
|
+
t,
|
|
1078
|
+
c,
|
|
1079
|
+
n,
|
|
1080
|
+
a,
|
|
1081
|
+
"assets"
|
|
1082
|
+
),
|
|
1083
|
+
[e, t, c, n, a]
|
|
1084
|
+
), m = u.useMemo(() => {
|
|
1085
|
+
if (e === a.pathname + a.search + a.hash)
|
|
1086
|
+
return [];
|
|
1087
|
+
let p = /* @__PURE__ */ new Set(), d = !1;
|
|
1088
|
+
if (t.forEach((v) => {
|
|
1089
|
+
var w;
|
|
1090
|
+
let h = n.routes[v.route.id];
|
|
1091
|
+
!h || !h.hasLoader || (!l.some((x) => x.route.id === v.route.id) && v.route.id in s && ((w = i[v.route.id]) != null && w.shouldRevalidate) || h.hasClientLoader ? d = !0 : p.add(v.route.id));
|
|
1092
|
+
}), p.size === 0)
|
|
1093
|
+
return [];
|
|
1094
|
+
let y = bt(e);
|
|
1095
|
+
return d && p.size > 0 && y.searchParams.set(
|
|
1096
|
+
"_routes",
|
|
1097
|
+
t.filter((v) => p.has(v.route.id)).map((v) => v.route.id).join(",")
|
|
1098
|
+
), [y.pathname + y.search];
|
|
1099
|
+
}, [
|
|
1100
|
+
s,
|
|
1101
|
+
a,
|
|
1102
|
+
n,
|
|
1103
|
+
l,
|
|
1104
|
+
t,
|
|
1105
|
+
e,
|
|
1106
|
+
i
|
|
1107
|
+
]), g = u.useMemo(
|
|
1108
|
+
() => xt(o, n),
|
|
1109
|
+
[o, n]
|
|
1110
|
+
), f = $t(o);
|
|
1111
|
+
return /* @__PURE__ */ u.createElement(u.Fragment, null, m.map((p) => /* @__PURE__ */ u.createElement("link", { key: p, rel: "prefetch", as: "fetch", href: p, ...r })), g.map((p) => /* @__PURE__ */ u.createElement("link", { key: p, rel: "modulepreload", href: p, ...r })), f.map(({ key: p, link: d }) => (
|
|
1112
|
+
// these don't spread `linkProps` because they are full link descriptors
|
|
1113
|
+
// already with their own props
|
|
1114
|
+
/* @__PURE__ */ u.createElement("link", { key: p, ...d })
|
|
1115
|
+
)));
|
|
1116
|
+
}
|
|
1117
|
+
function Tt(...e) {
|
|
1118
|
+
return (t) => {
|
|
1119
|
+
e.forEach((r) => {
|
|
1120
|
+
typeof r == "function" ? r(t) : r != null && (r.current = t);
|
|
1121
|
+
});
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
var ve = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
|
|
1125
|
+
try {
|
|
1126
|
+
ve && (window.__reactRouterVersion = "7.0.2");
|
|
1127
|
+
} catch {
|
|
1128
|
+
}
|
|
1129
|
+
var we = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, xe = u.forwardRef(
|
|
1130
|
+
function({
|
|
1131
|
+
onClick: t,
|
|
1132
|
+
discover: r = "render",
|
|
1133
|
+
prefetch: a = "none",
|
|
1134
|
+
relative: n,
|
|
1135
|
+
reloadDocument: i,
|
|
1136
|
+
replace: s,
|
|
1137
|
+
state: c,
|
|
1138
|
+
target: l,
|
|
1139
|
+
to: o,
|
|
1140
|
+
preventScrollReset: m,
|
|
1141
|
+
viewTransition: g,
|
|
1142
|
+
...f
|
|
1143
|
+
}, p) {
|
|
1144
|
+
let { basename: d } = u.useContext(L), y = typeof o == "string" && we.test(o), v, h = !1;
|
|
1145
|
+
if (typeof o == "string" && y && (v = o, ve))
|
|
1146
|
+
try {
|
|
1147
|
+
let R = new URL(window.location.href), I = o.startsWith("//") ? new URL(R.protocol + o) : new URL(o), re = D(I.pathname, d);
|
|
1148
|
+
I.origin === R.origin && re != null ? o = re + I.search + I.hash : h = !0;
|
|
1149
|
+
} catch {
|
|
1150
|
+
k(
|
|
1151
|
+
!1,
|
|
1152
|
+
`<Link to="${o}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
1153
|
+
);
|
|
1154
|
+
}
|
|
1155
|
+
let w = Ke(o, { relative: n }), [x, E, b] = kt(
|
|
1156
|
+
a,
|
|
1157
|
+
f
|
|
1158
|
+
), F = At(o, {
|
|
1159
|
+
replace: s,
|
|
1160
|
+
state: c,
|
|
1161
|
+
target: l,
|
|
1162
|
+
preventScrollReset: m,
|
|
1163
|
+
relative: n,
|
|
1164
|
+
viewTransition: g
|
|
1165
|
+
});
|
|
1166
|
+
function $(R) {
|
|
1167
|
+
t && t(R), R.defaultPrevented || F(R);
|
|
1168
|
+
}
|
|
1169
|
+
let T = (
|
|
1170
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
1171
|
+
/* @__PURE__ */ u.createElement(
|
|
1172
|
+
"a",
|
|
1173
|
+
{
|
|
1174
|
+
...f,
|
|
1175
|
+
...b,
|
|
1176
|
+
href: v || w,
|
|
1177
|
+
onClick: h || i ? t : $,
|
|
1178
|
+
ref: Tt(p, E),
|
|
1179
|
+
target: l,
|
|
1180
|
+
"data-discover": !y && r === "render" ? "true" : void 0
|
|
1181
|
+
}
|
|
1182
|
+
)
|
|
1183
|
+
);
|
|
1184
|
+
return x && !y ? /* @__PURE__ */ u.createElement(u.Fragment, null, T, /* @__PURE__ */ u.createElement(Lt, { page: w })) : T;
|
|
1185
|
+
}
|
|
1186
|
+
);
|
|
1187
|
+
xe.displayName = "Link";
|
|
1188
|
+
var Dt = u.forwardRef(
|
|
1189
|
+
function({
|
|
1190
|
+
"aria-current": t = "page",
|
|
1191
|
+
caseSensitive: r = !1,
|
|
1192
|
+
className: a = "",
|
|
1193
|
+
end: n = !1,
|
|
1194
|
+
style: i,
|
|
1195
|
+
to: s,
|
|
1196
|
+
viewTransition: c,
|
|
1197
|
+
children: l,
|
|
1198
|
+
...o
|
|
1199
|
+
}, m) {
|
|
1200
|
+
let g = B(s, { relative: o.relative }), f = N(), p = u.useContext(z), { navigator: d, basename: y } = u.useContext(L), v = p != null && // Conditional usage is OK here because the usage of a data router is static
|
|
1201
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
1202
|
+
Ut(g) && c === !0, h = d.encodeLocation ? d.encodeLocation(g).pathname : g.pathname, w = f.pathname, x = p && p.navigation && p.navigation.location ? p.navigation.location.pathname : null;
|
|
1203
|
+
r || (w = w.toLowerCase(), x = x ? x.toLowerCase() : null, h = h.toLowerCase()), x && y && (x = D(x, y) || x);
|
|
1204
|
+
const E = h !== "/" && h.endsWith("/") ? h.length - 1 : h.length;
|
|
1205
|
+
let b = w === h || !n && w.startsWith(h) && w.charAt(E) === "/", F = x != null && (x === h || !n && x.startsWith(h) && x.charAt(h.length) === "/"), $ = {
|
|
1206
|
+
isActive: b,
|
|
1207
|
+
isPending: F,
|
|
1208
|
+
isTransitioning: v
|
|
1209
|
+
}, T = b ? t : void 0, R;
|
|
1210
|
+
typeof a == "function" ? R = a($) : R = [
|
|
1211
|
+
a,
|
|
1212
|
+
b ? "active" : null,
|
|
1213
|
+
F ? "pending" : null,
|
|
1214
|
+
v ? "transitioning" : null
|
|
1215
|
+
].filter(Boolean).join(" ");
|
|
1216
|
+
let I = typeof i == "function" ? i($) : i;
|
|
1217
|
+
return /* @__PURE__ */ u.createElement(
|
|
1218
|
+
xe,
|
|
1219
|
+
{
|
|
1220
|
+
...o,
|
|
1221
|
+
"aria-current": T,
|
|
1222
|
+
className: R,
|
|
1223
|
+
ref: m,
|
|
1224
|
+
style: I,
|
|
1225
|
+
to: s,
|
|
1226
|
+
viewTransition: c
|
|
1227
|
+
},
|
|
1228
|
+
typeof l == "function" ? l($) : l
|
|
1229
|
+
);
|
|
1230
|
+
}
|
|
1231
|
+
);
|
|
1232
|
+
Dt.displayName = "NavLink";
|
|
1233
|
+
var Nt = u.forwardRef(
|
|
1234
|
+
({
|
|
1235
|
+
discover: e = "render",
|
|
1236
|
+
fetcherKey: t,
|
|
1237
|
+
navigate: r,
|
|
1238
|
+
reloadDocument: a,
|
|
1239
|
+
replace: n,
|
|
1240
|
+
state: i,
|
|
1241
|
+
method: s = U,
|
|
1242
|
+
action: c,
|
|
1243
|
+
onSubmit: l,
|
|
1244
|
+
relative: o,
|
|
1245
|
+
preventScrollReset: m,
|
|
1246
|
+
viewTransition: g,
|
|
1247
|
+
...f
|
|
1248
|
+
}, p) => {
|
|
1249
|
+
let d = Bt(), y = Wt(c, { relative: o }), v = s.toLowerCase() === "get" ? "get" : "post", h = typeof c == "string" && we.test(c), w = (x) => {
|
|
1250
|
+
if (l && l(x), x.defaultPrevented) return;
|
|
1251
|
+
x.preventDefault();
|
|
1252
|
+
let E = x.nativeEvent.submitter, b = (E == null ? void 0 : E.getAttribute("formmethod")) || s;
|
|
1253
|
+
d(E || x.currentTarget, {
|
|
1254
|
+
fetcherKey: t,
|
|
1255
|
+
method: b,
|
|
1256
|
+
navigate: r,
|
|
1257
|
+
replace: n,
|
|
1258
|
+
state: i,
|
|
1259
|
+
relative: o,
|
|
1260
|
+
preventScrollReset: m,
|
|
1261
|
+
viewTransition: g
|
|
1262
|
+
});
|
|
1263
|
+
};
|
|
1264
|
+
return /* @__PURE__ */ u.createElement(
|
|
1265
|
+
"form",
|
|
1266
|
+
{
|
|
1267
|
+
ref: p,
|
|
1268
|
+
method: v,
|
|
1269
|
+
action: y,
|
|
1270
|
+
onSubmit: a ? l : w,
|
|
1271
|
+
...f,
|
|
1272
|
+
"data-discover": !h && e === "render" ? "true" : void 0
|
|
1273
|
+
}
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
);
|
|
1277
|
+
Nt.displayName = "Form";
|
|
1278
|
+
function Ft(e) {
|
|
1279
|
+
return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
1280
|
+
}
|
|
1281
|
+
function Ce(e) {
|
|
1282
|
+
let t = u.useContext(A);
|
|
1283
|
+
return C(t, Ft(e)), t;
|
|
1284
|
+
}
|
|
1285
|
+
function At(e, {
|
|
1286
|
+
target: t,
|
|
1287
|
+
replace: r,
|
|
1288
|
+
state: a,
|
|
1289
|
+
preventScrollReset: n,
|
|
1290
|
+
relative: i,
|
|
1291
|
+
viewTransition: s
|
|
1292
|
+
} = {}) {
|
|
1293
|
+
let c = qe(), l = N(), o = B(e, { relative: i });
|
|
1294
|
+
return u.useCallback(
|
|
1295
|
+
(m) => {
|
|
1296
|
+
if (ht(m, t)) {
|
|
1297
|
+
m.preventDefault();
|
|
1298
|
+
let g = r !== void 0 ? r : q(l) === q(o);
|
|
1299
|
+
c(e, {
|
|
1300
|
+
replace: g,
|
|
1301
|
+
state: a,
|
|
1302
|
+
preventScrollReset: n,
|
|
1303
|
+
relative: i,
|
|
1304
|
+
viewTransition: s
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
},
|
|
1308
|
+
[
|
|
1309
|
+
l,
|
|
1310
|
+
c,
|
|
1311
|
+
o,
|
|
1312
|
+
r,
|
|
1313
|
+
a,
|
|
1314
|
+
t,
|
|
1315
|
+
e,
|
|
1316
|
+
n,
|
|
1317
|
+
i,
|
|
1318
|
+
s
|
|
1319
|
+
]
|
|
1320
|
+
);
|
|
1321
|
+
}
|
|
1322
|
+
var Ot = 0, Mt = () => `__${String(++Ot)}__`;
|
|
1323
|
+
function Bt() {
|
|
1324
|
+
let { router: e } = Ce(
|
|
1325
|
+
"useSubmit"
|
|
1326
|
+
/* UseSubmit */
|
|
1327
|
+
), { basename: t } = u.useContext(L), r = it();
|
|
1328
|
+
return u.useCallback(
|
|
1329
|
+
async (a, n = {}) => {
|
|
1330
|
+
let { action: i, method: s, encType: c, formData: l, body: o } = gt(
|
|
1331
|
+
a,
|
|
1332
|
+
t
|
|
1333
|
+
);
|
|
1334
|
+
if (n.navigate === !1) {
|
|
1335
|
+
let m = n.fetcherKey || Mt();
|
|
1336
|
+
await e.fetch(m, r, n.action || i, {
|
|
1337
|
+
preventScrollReset: n.preventScrollReset,
|
|
1338
|
+
formData: l,
|
|
1339
|
+
body: o,
|
|
1340
|
+
formMethod: n.method || s,
|
|
1341
|
+
formEncType: n.encType || c,
|
|
1342
|
+
flushSync: n.flushSync
|
|
1343
|
+
});
|
|
1344
|
+
} else
|
|
1345
|
+
await e.navigate(n.action || i, {
|
|
1346
|
+
preventScrollReset: n.preventScrollReset,
|
|
1347
|
+
formData: l,
|
|
1348
|
+
body: o,
|
|
1349
|
+
formMethod: n.method || s,
|
|
1350
|
+
formEncType: n.encType || c,
|
|
1351
|
+
replace: n.replace,
|
|
1352
|
+
state: n.state,
|
|
1353
|
+
fromRouteId: r,
|
|
1354
|
+
flushSync: n.flushSync,
|
|
1355
|
+
viewTransition: n.viewTransition
|
|
1356
|
+
});
|
|
1357
|
+
},
|
|
1358
|
+
[e, t, r]
|
|
1359
|
+
);
|
|
1360
|
+
}
|
|
1361
|
+
function Wt(e, { relative: t } = {}) {
|
|
1362
|
+
let { basename: r } = u.useContext(L), a = u.useContext(S);
|
|
1363
|
+
C(a, "useFormAction must be used inside a RouteContext");
|
|
1364
|
+
let [n] = a.matches.slice(-1), i = { ...B(e || ".", { relative: t }) }, s = N();
|
|
1365
|
+
if (e == null) {
|
|
1366
|
+
i.search = s.search;
|
|
1367
|
+
let c = new URLSearchParams(i.search), l = c.getAll("index");
|
|
1368
|
+
if (l.some((m) => m === "")) {
|
|
1369
|
+
c.delete("index"), l.filter((g) => g).forEach((g) => c.append("index", g));
|
|
1370
|
+
let m = c.toString();
|
|
1371
|
+
i.search = m ? `?${m}` : "";
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
return (!e || e === ".") && n.route.index && (i.search = i.search ? i.search.replace(/^\?/, "?index&") : "?index"), r !== "/" && (i.pathname = i.pathname === "/" ? r : P([r, i.pathname])), q(i);
|
|
1375
|
+
}
|
|
1376
|
+
function Ut(e, t = {}) {
|
|
1377
|
+
let r = u.useContext(he);
|
|
1378
|
+
C(
|
|
1379
|
+
r != null,
|
|
1380
|
+
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
1381
|
+
);
|
|
1382
|
+
let { basename: a } = Ce(
|
|
1383
|
+
"useViewTransitionState"
|
|
1384
|
+
/* useViewTransitionState */
|
|
1385
|
+
), n = B(e, { relative: t.relative });
|
|
1386
|
+
if (!r.isTransitioning)
|
|
1387
|
+
return !1;
|
|
1388
|
+
let i = D(r.currentLocation.pathname, a) || r.currentLocation.pathname, s = D(r.nextLocation.pathname, a) || r.nextLocation.pathname;
|
|
1389
|
+
return H(n.pathname, s) != null || H(n.pathname, i) != null;
|
|
1390
|
+
}
|
|
1391
|
+
new TextEncoder();
|
|
1392
|
+
const Ht = () => ({
|
|
1393
|
+
isInsideRouter: Ee(S).outlet !== null
|
|
1394
|
+
});
|
|
1395
|
+
export {
|
|
1396
|
+
xe as L,
|
|
1397
|
+
Ht as u
|
|
1398
|
+
};
|