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