react-router 7.9.4 → 7.9.6
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/CHANGELOG.md +70 -0
- package/dist/development/browser-BbBXFHbO.d.ts +310 -0
- package/dist/development/browser-C07r42Tt.d.mts +310 -0
- package/dist/development/{chunk-OIYGIGL5.mjs → chunk-4WY6JWTD.mjs} +458 -43
- package/dist/development/{chunk-DI2QHYMJ.js → chunk-AMVS5XVJ.js} +1314 -138
- package/dist/development/{chunk-WY5IRSCW.mjs → chunk-G3INQAYP.mjs} +197 -857
- package/dist/development/chunk-O4JVZSOY.js +1310 -0
- package/dist/development/chunk-PZWDWJAY.js +188 -0
- package/dist/development/dom-export.d.mts +103 -6
- package/dist/development/dom-export.d.ts +103 -4
- package/dist/development/dom-export.js +708 -20
- package/dist/development/dom-export.mjs +692 -11
- package/dist/{production/index-react-server-client-BbRcBjrA.d.ts → development/index-react-server-client-Da3kmxNd.d.ts} +195 -135
- package/dist/{production/index-react-server-client-BIz4AUNd.d.mts → development/index-react-server-client-rcoGPJhU.d.mts} +137 -78
- package/dist/development/index-react-server-client.d.mts +2 -3
- package/dist/development/index-react-server-client.d.ts +2 -2
- package/dist/development/index-react-server-client.js +4 -4
- package/dist/development/index-react-server-client.mjs +2 -2
- package/dist/development/index-react-server.d.mts +107 -3
- package/dist/development/index-react-server.d.ts +107 -3
- package/dist/development/index-react-server.js +259 -13
- package/dist/development/index-react-server.mjs +259 -13
- package/dist/development/index.d.mts +14 -320
- package/dist/development/index.d.ts +14 -362
- package/dist/development/index.js +146 -962
- package/dist/development/index.mjs +3 -9
- package/dist/development/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
- package/dist/development/lib/types/internal.d.mts +2 -3
- package/dist/development/lib/types/internal.d.ts +2 -2
- package/dist/development/lib/types/internal.js +1 -1
- package/dist/development/lib/types/internal.mjs +1 -1
- package/dist/{production/register-C34pU-in.d.ts → development/register-BpU9rFBJ.d.ts} +1 -1
- package/dist/development/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/{production/context-DSyS5mLj.d.mts → development/router-CAvh_Drx.d.mts} +1877 -1254
- package/dist/production/browser-BbBXFHbO.d.ts +310 -0
- package/dist/production/browser-C07r42Tt.d.mts +310 -0
- package/dist/production/{chunk-4E5LHRQP.js → chunk-EAIF67OW.js} +1314 -138
- package/dist/production/{chunk-FR6HSPLK.mjs → chunk-FDUMZGKM.mjs} +197 -857
- package/dist/production/{chunk-3TADTUL4.mjs → chunk-FUSXQSWG.mjs} +458 -43
- package/dist/production/chunk-G5A35OQU.js +188 -0
- package/dist/production/chunk-QN64DHI4.js +1310 -0
- package/dist/production/dom-export.d.mts +103 -6
- package/dist/production/dom-export.d.ts +103 -4
- package/dist/production/dom-export.js +708 -20
- package/dist/production/dom-export.mjs +692 -11
- package/dist/{development/index-react-server-client-BIz4AUNd.d.mts → production/index-react-server-client-Da3kmxNd.d.ts} +137 -78
- package/dist/{development/index-react-server-client-BbRcBjrA.d.ts → production/index-react-server-client-rcoGPJhU.d.mts} +195 -135
- package/dist/production/index-react-server-client.d.mts +2 -3
- package/dist/production/index-react-server-client.d.ts +2 -2
- package/dist/production/index-react-server-client.js +4 -4
- package/dist/production/index-react-server-client.mjs +2 -2
- package/dist/production/index-react-server.d.mts +107 -3
- package/dist/production/index-react-server.d.ts +107 -3
- package/dist/production/index-react-server.js +259 -13
- package/dist/production/index-react-server.mjs +259 -13
- package/dist/production/index.d.mts +14 -320
- package/dist/production/index.d.ts +14 -362
- package/dist/production/index.js +146 -962
- package/dist/production/index.mjs +3 -9
- package/dist/production/{routeModules-D5iJ6JYT.d.ts → instrumentation-Unc20tLk.d.ts} +178 -25
- package/dist/production/lib/types/internal.d.mts +2 -3
- package/dist/production/lib/types/internal.d.ts +2 -2
- package/dist/production/lib/types/internal.js +1 -1
- package/dist/production/lib/types/internal.mjs +1 -1
- package/dist/{development/register-C34pU-in.d.ts → production/register-BpU9rFBJ.d.ts} +1 -1
- package/dist/production/{register-CI4bTprK.d.mts → register-QkB3HGjm.d.mts} +1 -1
- package/dist/{development/context-DSyS5mLj.d.mts → production/router-CAvh_Drx.d.mts} +1877 -1254
- package/package.json +1 -1
- package/dist/development/browser-z32v5KVN.d.mts +0 -46
- package/dist/development/chunk-72XNTZCV.js +0 -2089
- package/dist/development/route-data-DZQOUSqV.d.mts +0 -473
- package/dist/production/browser-z32v5KVN.d.mts +0 -46
- package/dist/production/chunk-WNLQ53P5.js +0 -2089
- package/dist/production/route-data-DZQOUSqV.d.mts +0 -473
|
@@ -0,0 +1,1310 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
|
|
2
|
+
* react-router v7.9.6
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) Remix Software Inc.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
8
|
+
*
|
|
9
|
+
* @license MIT
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
var _chunkAMVS5XVJjs = require('./chunk-AMVS5XVJ.js');
|
|
52
|
+
|
|
53
|
+
// lib/dom/dom.ts
|
|
54
|
+
var defaultMethod = "get";
|
|
55
|
+
var defaultEncType = "application/x-www-form-urlencoded";
|
|
56
|
+
function isHtmlElement(object) {
|
|
57
|
+
return object != null && typeof object.tagName === "string";
|
|
58
|
+
}
|
|
59
|
+
function isButtonElement(object) {
|
|
60
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
|
|
61
|
+
}
|
|
62
|
+
function isFormElement(object) {
|
|
63
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
|
|
64
|
+
}
|
|
65
|
+
function isInputElement(object) {
|
|
66
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
|
|
67
|
+
}
|
|
68
|
+
function isModifiedEvent(event) {
|
|
69
|
+
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
70
|
+
}
|
|
71
|
+
function shouldProcessLinkClick(event, target) {
|
|
72
|
+
return event.button === 0 && // Ignore everything but left clicks
|
|
73
|
+
(!target || target === "_self") && // Let browser handle "target=_blank" etc.
|
|
74
|
+
!isModifiedEvent(event);
|
|
75
|
+
}
|
|
76
|
+
function createSearchParams(init = "") {
|
|
77
|
+
return new URLSearchParams(
|
|
78
|
+
typeof init === "string" || Array.isArray(init) || init instanceof URLSearchParams ? init : Object.keys(init).reduce((memo, key) => {
|
|
79
|
+
let value = init[key];
|
|
80
|
+
return memo.concat(
|
|
81
|
+
Array.isArray(value) ? value.map((v) => [key, v]) : [[key, value]]
|
|
82
|
+
);
|
|
83
|
+
}, [])
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
function getSearchParamsForLocation(locationSearch, defaultSearchParams) {
|
|
87
|
+
let searchParams = createSearchParams(locationSearch);
|
|
88
|
+
if (defaultSearchParams) {
|
|
89
|
+
defaultSearchParams.forEach((_, key) => {
|
|
90
|
+
if (!searchParams.has(key)) {
|
|
91
|
+
defaultSearchParams.getAll(key).forEach((value) => {
|
|
92
|
+
searchParams.append(key, value);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return searchParams;
|
|
98
|
+
}
|
|
99
|
+
var _formDataSupportsSubmitter = null;
|
|
100
|
+
function isFormDataSubmitterSupported() {
|
|
101
|
+
if (_formDataSupportsSubmitter === null) {
|
|
102
|
+
try {
|
|
103
|
+
new FormData(
|
|
104
|
+
document.createElement("form"),
|
|
105
|
+
// @ts-expect-error if FormData supports the submitter parameter, this will throw
|
|
106
|
+
0
|
|
107
|
+
);
|
|
108
|
+
_formDataSupportsSubmitter = false;
|
|
109
|
+
} catch (e) {
|
|
110
|
+
_formDataSupportsSubmitter = true;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return _formDataSupportsSubmitter;
|
|
114
|
+
}
|
|
115
|
+
var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
116
|
+
"application/x-www-form-urlencoded",
|
|
117
|
+
"multipart/form-data",
|
|
118
|
+
"text/plain"
|
|
119
|
+
]);
|
|
120
|
+
function getFormEncType(encType) {
|
|
121
|
+
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
122
|
+
_chunkAMVS5XVJjs.warning.call(void 0,
|
|
123
|
+
false,
|
|
124
|
+
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
125
|
+
);
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
return encType;
|
|
129
|
+
}
|
|
130
|
+
function getFormSubmissionInfo(target, basename) {
|
|
131
|
+
let method;
|
|
132
|
+
let action;
|
|
133
|
+
let encType;
|
|
134
|
+
let formData;
|
|
135
|
+
let body;
|
|
136
|
+
if (isFormElement(target)) {
|
|
137
|
+
let attr = target.getAttribute("action");
|
|
138
|
+
action = attr ? _chunkAMVS5XVJjs.stripBasename.call(void 0, attr, basename) : null;
|
|
139
|
+
method = target.getAttribute("method") || defaultMethod;
|
|
140
|
+
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
141
|
+
formData = new FormData(target);
|
|
142
|
+
} else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
|
|
143
|
+
let form = target.form;
|
|
144
|
+
if (form == null) {
|
|
145
|
+
throw new Error(
|
|
146
|
+
`Cannot submit a <button> or <input type="submit"> without a <form>`
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
150
|
+
action = attr ? _chunkAMVS5XVJjs.stripBasename.call(void 0, attr, basename) : null;
|
|
151
|
+
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
152
|
+
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
153
|
+
formData = new FormData(form, target);
|
|
154
|
+
if (!isFormDataSubmitterSupported()) {
|
|
155
|
+
let { name, type, value } = target;
|
|
156
|
+
if (type === "image") {
|
|
157
|
+
let prefix = name ? `${name}.` : "";
|
|
158
|
+
formData.append(`${prefix}x`, "0");
|
|
159
|
+
formData.append(`${prefix}y`, "0");
|
|
160
|
+
} else if (name) {
|
|
161
|
+
formData.append(name, value);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
} else if (isHtmlElement(target)) {
|
|
165
|
+
throw new Error(
|
|
166
|
+
`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
|
|
167
|
+
);
|
|
168
|
+
} else {
|
|
169
|
+
method = defaultMethod;
|
|
170
|
+
action = null;
|
|
171
|
+
encType = defaultEncType;
|
|
172
|
+
body = target;
|
|
173
|
+
}
|
|
174
|
+
if (formData && encType === "text/plain") {
|
|
175
|
+
body = formData;
|
|
176
|
+
formData = void 0;
|
|
177
|
+
}
|
|
178
|
+
return { action, method: method.toLowerCase(), encType, formData, body };
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// lib/dom/lib.tsx
|
|
182
|
+
var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_react);
|
|
183
|
+
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
184
|
+
try {
|
|
185
|
+
if (isBrowser) {
|
|
186
|
+
window.__reactRouterVersion = // @ts-expect-error
|
|
187
|
+
"7.9.6";
|
|
188
|
+
}
|
|
189
|
+
} catch (e) {
|
|
190
|
+
}
|
|
191
|
+
function createBrowserRouter(routes, opts) {
|
|
192
|
+
return _chunkAMVS5XVJjs.createRouter.call(void 0, {
|
|
193
|
+
basename: _optionalChain([opts, 'optionalAccess', _2 => _2.basename]),
|
|
194
|
+
getContext: _optionalChain([opts, 'optionalAccess', _3 => _3.getContext]),
|
|
195
|
+
future: _optionalChain([opts, 'optionalAccess', _4 => _4.future]),
|
|
196
|
+
history: _chunkAMVS5XVJjs.createBrowserHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _5 => _5.window]) }),
|
|
197
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _6 => _6.hydrationData]) || parseHydrationData(),
|
|
198
|
+
routes,
|
|
199
|
+
mapRouteProperties: _chunkAMVS5XVJjs.mapRouteProperties,
|
|
200
|
+
hydrationRouteProperties: _chunkAMVS5XVJjs.hydrationRouteProperties,
|
|
201
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _7 => _7.dataStrategy]),
|
|
202
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _8 => _8.patchRoutesOnNavigation]),
|
|
203
|
+
window: _optionalChain([opts, 'optionalAccess', _9 => _9.window]),
|
|
204
|
+
unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _10 => _10.unstable_instrumentations])
|
|
205
|
+
}).initialize();
|
|
206
|
+
}
|
|
207
|
+
function createHashRouter(routes, opts) {
|
|
208
|
+
return _chunkAMVS5XVJjs.createRouter.call(void 0, {
|
|
209
|
+
basename: _optionalChain([opts, 'optionalAccess', _11 => _11.basename]),
|
|
210
|
+
getContext: _optionalChain([opts, 'optionalAccess', _12 => _12.getContext]),
|
|
211
|
+
future: _optionalChain([opts, 'optionalAccess', _13 => _13.future]),
|
|
212
|
+
history: _chunkAMVS5XVJjs.createHashHistory.call(void 0, { window: _optionalChain([opts, 'optionalAccess', _14 => _14.window]) }),
|
|
213
|
+
hydrationData: _optionalChain([opts, 'optionalAccess', _15 => _15.hydrationData]) || parseHydrationData(),
|
|
214
|
+
routes,
|
|
215
|
+
mapRouteProperties: _chunkAMVS5XVJjs.mapRouteProperties,
|
|
216
|
+
hydrationRouteProperties: _chunkAMVS5XVJjs.hydrationRouteProperties,
|
|
217
|
+
dataStrategy: _optionalChain([opts, 'optionalAccess', _16 => _16.dataStrategy]),
|
|
218
|
+
patchRoutesOnNavigation: _optionalChain([opts, 'optionalAccess', _17 => _17.patchRoutesOnNavigation]),
|
|
219
|
+
window: _optionalChain([opts, 'optionalAccess', _18 => _18.window]),
|
|
220
|
+
unstable_instrumentations: _optionalChain([opts, 'optionalAccess', _19 => _19.unstable_instrumentations])
|
|
221
|
+
}).initialize();
|
|
222
|
+
}
|
|
223
|
+
function parseHydrationData() {
|
|
224
|
+
let state = _optionalChain([window, 'optionalAccess', _20 => _20.__staticRouterHydrationData]);
|
|
225
|
+
if (state && state.errors) {
|
|
226
|
+
state = {
|
|
227
|
+
...state,
|
|
228
|
+
errors: deserializeErrors(state.errors)
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return state;
|
|
232
|
+
}
|
|
233
|
+
function deserializeErrors(errors) {
|
|
234
|
+
if (!errors) return null;
|
|
235
|
+
let entries = Object.entries(errors);
|
|
236
|
+
let serialized = {};
|
|
237
|
+
for (let [key, val] of entries) {
|
|
238
|
+
if (val && val.__type === "RouteErrorResponse") {
|
|
239
|
+
serialized[key] = new (0, _chunkAMVS5XVJjs.ErrorResponseImpl)(
|
|
240
|
+
val.status,
|
|
241
|
+
val.statusText,
|
|
242
|
+
val.data,
|
|
243
|
+
val.internal === true
|
|
244
|
+
);
|
|
245
|
+
} else if (val && val.__type === "Error") {
|
|
246
|
+
if (val.__subType) {
|
|
247
|
+
let ErrorConstructor = window[val.__subType];
|
|
248
|
+
if (typeof ErrorConstructor === "function") {
|
|
249
|
+
try {
|
|
250
|
+
let error = new ErrorConstructor(val.message);
|
|
251
|
+
error.stack = "";
|
|
252
|
+
serialized[key] = error;
|
|
253
|
+
} catch (e) {
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
if (serialized[key] == null) {
|
|
258
|
+
let error = new Error(val.message);
|
|
259
|
+
error.stack = "";
|
|
260
|
+
serialized[key] = error;
|
|
261
|
+
}
|
|
262
|
+
} else {
|
|
263
|
+
serialized[key] = val;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return serialized;
|
|
267
|
+
}
|
|
268
|
+
function BrowserRouter({
|
|
269
|
+
basename,
|
|
270
|
+
children,
|
|
271
|
+
window: window2
|
|
272
|
+
}) {
|
|
273
|
+
let historyRef = React.useRef();
|
|
274
|
+
if (historyRef.current == null) {
|
|
275
|
+
historyRef.current = _chunkAMVS5XVJjs.createBrowserHistory.call(void 0, { window: window2, v5Compat: true });
|
|
276
|
+
}
|
|
277
|
+
let history = historyRef.current;
|
|
278
|
+
let [state, setStateImpl] = React.useState({
|
|
279
|
+
action: history.action,
|
|
280
|
+
location: history.location
|
|
281
|
+
});
|
|
282
|
+
let setState = React.useCallback(
|
|
283
|
+
(newState) => {
|
|
284
|
+
React.startTransition(() => setStateImpl(newState));
|
|
285
|
+
},
|
|
286
|
+
[setStateImpl]
|
|
287
|
+
);
|
|
288
|
+
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
289
|
+
return /* @__PURE__ */ React.createElement(
|
|
290
|
+
_chunkAMVS5XVJjs.Router,
|
|
291
|
+
{
|
|
292
|
+
basename,
|
|
293
|
+
children,
|
|
294
|
+
location: state.location,
|
|
295
|
+
navigationType: state.action,
|
|
296
|
+
navigator: history
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
function HashRouter({ basename, children, window: window2 }) {
|
|
301
|
+
let historyRef = React.useRef();
|
|
302
|
+
if (historyRef.current == null) {
|
|
303
|
+
historyRef.current = _chunkAMVS5XVJjs.createHashHistory.call(void 0, { window: window2, v5Compat: true });
|
|
304
|
+
}
|
|
305
|
+
let history = historyRef.current;
|
|
306
|
+
let [state, setStateImpl] = React.useState({
|
|
307
|
+
action: history.action,
|
|
308
|
+
location: history.location
|
|
309
|
+
});
|
|
310
|
+
let setState = React.useCallback(
|
|
311
|
+
(newState) => {
|
|
312
|
+
React.startTransition(() => setStateImpl(newState));
|
|
313
|
+
},
|
|
314
|
+
[setStateImpl]
|
|
315
|
+
);
|
|
316
|
+
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
317
|
+
return /* @__PURE__ */ React.createElement(
|
|
318
|
+
_chunkAMVS5XVJjs.Router,
|
|
319
|
+
{
|
|
320
|
+
basename,
|
|
321
|
+
children,
|
|
322
|
+
location: state.location,
|
|
323
|
+
navigationType: state.action,
|
|
324
|
+
navigator: history
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
function HistoryRouter({
|
|
329
|
+
basename,
|
|
330
|
+
children,
|
|
331
|
+
history
|
|
332
|
+
}) {
|
|
333
|
+
let [state, setStateImpl] = React.useState({
|
|
334
|
+
action: history.action,
|
|
335
|
+
location: history.location
|
|
336
|
+
});
|
|
337
|
+
let setState = React.useCallback(
|
|
338
|
+
(newState) => {
|
|
339
|
+
React.startTransition(() => setStateImpl(newState));
|
|
340
|
+
},
|
|
341
|
+
[setStateImpl]
|
|
342
|
+
);
|
|
343
|
+
React.useLayoutEffect(() => history.listen(setState), [history, setState]);
|
|
344
|
+
return /* @__PURE__ */ React.createElement(
|
|
345
|
+
_chunkAMVS5XVJjs.Router,
|
|
346
|
+
{
|
|
347
|
+
basename,
|
|
348
|
+
children,
|
|
349
|
+
location: state.location,
|
|
350
|
+
navigationType: state.action,
|
|
351
|
+
navigator: history
|
|
352
|
+
}
|
|
353
|
+
);
|
|
354
|
+
}
|
|
355
|
+
HistoryRouter.displayName = "unstable_HistoryRouter";
|
|
356
|
+
var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
357
|
+
var Link = React.forwardRef(
|
|
358
|
+
function LinkWithRef({
|
|
359
|
+
onClick,
|
|
360
|
+
discover = "render",
|
|
361
|
+
prefetch = "none",
|
|
362
|
+
relative,
|
|
363
|
+
reloadDocument,
|
|
364
|
+
replace,
|
|
365
|
+
state,
|
|
366
|
+
target,
|
|
367
|
+
to,
|
|
368
|
+
preventScrollReset,
|
|
369
|
+
viewTransition,
|
|
370
|
+
...rest
|
|
371
|
+
}, forwardedRef) {
|
|
372
|
+
let { basename } = React.useContext(_chunkAMVS5XVJjs.NavigationContext);
|
|
373
|
+
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX.test(to);
|
|
374
|
+
let absoluteHref;
|
|
375
|
+
let isExternal = false;
|
|
376
|
+
if (typeof to === "string" && isAbsolute) {
|
|
377
|
+
absoluteHref = to;
|
|
378
|
+
if (isBrowser) {
|
|
379
|
+
try {
|
|
380
|
+
let currentUrl = new URL(window.location.href);
|
|
381
|
+
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
382
|
+
let path = _chunkAMVS5XVJjs.stripBasename.call(void 0, targetUrl.pathname, basename);
|
|
383
|
+
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
384
|
+
to = path + targetUrl.search + targetUrl.hash;
|
|
385
|
+
} else {
|
|
386
|
+
isExternal = true;
|
|
387
|
+
}
|
|
388
|
+
} catch (e) {
|
|
389
|
+
_chunkAMVS5XVJjs.warning.call(void 0,
|
|
390
|
+
false,
|
|
391
|
+
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
let href = _chunkAMVS5XVJjs.useHref.call(void 0, to, { relative });
|
|
397
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = _chunkAMVS5XVJjs.usePrefetchBehavior.call(void 0,
|
|
398
|
+
prefetch,
|
|
399
|
+
rest
|
|
400
|
+
);
|
|
401
|
+
let internalOnClick = useLinkClickHandler(to, {
|
|
402
|
+
replace,
|
|
403
|
+
state,
|
|
404
|
+
target,
|
|
405
|
+
preventScrollReset,
|
|
406
|
+
relative,
|
|
407
|
+
viewTransition
|
|
408
|
+
});
|
|
409
|
+
function handleClick(event) {
|
|
410
|
+
if (onClick) onClick(event);
|
|
411
|
+
if (!event.defaultPrevented) {
|
|
412
|
+
internalOnClick(event);
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
let link = (
|
|
416
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
417
|
+
/* @__PURE__ */ React.createElement(
|
|
418
|
+
"a",
|
|
419
|
+
{
|
|
420
|
+
...rest,
|
|
421
|
+
...prefetchHandlers,
|
|
422
|
+
href: absoluteHref || href,
|
|
423
|
+
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
424
|
+
ref: _chunkAMVS5XVJjs.mergeRefs.call(void 0, forwardedRef, prefetchRef),
|
|
425
|
+
target,
|
|
426
|
+
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
427
|
+
}
|
|
428
|
+
)
|
|
429
|
+
);
|
|
430
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React.createElement(React.Fragment, null, link, /* @__PURE__ */ React.createElement(_chunkAMVS5XVJjs.PrefetchPageLinks, { page: href })) : link;
|
|
431
|
+
}
|
|
432
|
+
);
|
|
433
|
+
Link.displayName = "Link";
|
|
434
|
+
var NavLink = React.forwardRef(
|
|
435
|
+
function NavLinkWithRef({
|
|
436
|
+
"aria-current": ariaCurrentProp = "page",
|
|
437
|
+
caseSensitive = false,
|
|
438
|
+
className: classNameProp = "",
|
|
439
|
+
end = false,
|
|
440
|
+
style: styleProp,
|
|
441
|
+
to,
|
|
442
|
+
viewTransition,
|
|
443
|
+
children,
|
|
444
|
+
...rest
|
|
445
|
+
}, ref) {
|
|
446
|
+
let path = _chunkAMVS5XVJjs.useResolvedPath.call(void 0, to, { relative: rest.relative });
|
|
447
|
+
let location = _chunkAMVS5XVJjs.useLocation.call(void 0, );
|
|
448
|
+
let routerState = React.useContext(_chunkAMVS5XVJjs.DataRouterStateContext);
|
|
449
|
+
let { navigator, basename } = React.useContext(_chunkAMVS5XVJjs.NavigationContext);
|
|
450
|
+
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
451
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
452
|
+
useViewTransitionState(path) && viewTransition === true;
|
|
453
|
+
let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
|
|
454
|
+
let locationPathname = location.pathname;
|
|
455
|
+
let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
|
|
456
|
+
if (!caseSensitive) {
|
|
457
|
+
locationPathname = locationPathname.toLowerCase();
|
|
458
|
+
nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
|
|
459
|
+
toPathname = toPathname.toLowerCase();
|
|
460
|
+
}
|
|
461
|
+
if (nextLocationPathname && basename) {
|
|
462
|
+
nextLocationPathname = _chunkAMVS5XVJjs.stripBasename.call(void 0, nextLocationPathname, basename) || nextLocationPathname;
|
|
463
|
+
}
|
|
464
|
+
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
465
|
+
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
466
|
+
let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
|
|
467
|
+
let renderProps = {
|
|
468
|
+
isActive,
|
|
469
|
+
isPending,
|
|
470
|
+
isTransitioning
|
|
471
|
+
};
|
|
472
|
+
let ariaCurrent = isActive ? ariaCurrentProp : void 0;
|
|
473
|
+
let className;
|
|
474
|
+
if (typeof classNameProp === "function") {
|
|
475
|
+
className = classNameProp(renderProps);
|
|
476
|
+
} else {
|
|
477
|
+
className = [
|
|
478
|
+
classNameProp,
|
|
479
|
+
isActive ? "active" : null,
|
|
480
|
+
isPending ? "pending" : null,
|
|
481
|
+
isTransitioning ? "transitioning" : null
|
|
482
|
+
].filter(Boolean).join(" ");
|
|
483
|
+
}
|
|
484
|
+
let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
|
|
485
|
+
return /* @__PURE__ */ React.createElement(
|
|
486
|
+
Link,
|
|
487
|
+
{
|
|
488
|
+
...rest,
|
|
489
|
+
"aria-current": ariaCurrent,
|
|
490
|
+
className,
|
|
491
|
+
ref,
|
|
492
|
+
style,
|
|
493
|
+
to,
|
|
494
|
+
viewTransition
|
|
495
|
+
},
|
|
496
|
+
typeof children === "function" ? children(renderProps) : children
|
|
497
|
+
);
|
|
498
|
+
}
|
|
499
|
+
);
|
|
500
|
+
NavLink.displayName = "NavLink";
|
|
501
|
+
var Form = React.forwardRef(
|
|
502
|
+
({
|
|
503
|
+
discover = "render",
|
|
504
|
+
fetcherKey,
|
|
505
|
+
navigate,
|
|
506
|
+
reloadDocument,
|
|
507
|
+
replace,
|
|
508
|
+
state,
|
|
509
|
+
method = defaultMethod,
|
|
510
|
+
action,
|
|
511
|
+
onSubmit,
|
|
512
|
+
relative,
|
|
513
|
+
preventScrollReset,
|
|
514
|
+
viewTransition,
|
|
515
|
+
...props
|
|
516
|
+
}, forwardedRef) => {
|
|
517
|
+
let submit = useSubmit();
|
|
518
|
+
let formAction = useFormAction(action, { relative });
|
|
519
|
+
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
520
|
+
let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX.test(action);
|
|
521
|
+
let submitHandler = (event) => {
|
|
522
|
+
onSubmit && onSubmit(event);
|
|
523
|
+
if (event.defaultPrevented) return;
|
|
524
|
+
event.preventDefault();
|
|
525
|
+
let submitter = event.nativeEvent.submitter;
|
|
526
|
+
let submitMethod = _optionalChain([submitter, 'optionalAccess', _21 => _21.getAttribute, 'call', _22 => _22("formmethod")]) || method;
|
|
527
|
+
submit(submitter || event.currentTarget, {
|
|
528
|
+
fetcherKey,
|
|
529
|
+
method: submitMethod,
|
|
530
|
+
navigate,
|
|
531
|
+
replace,
|
|
532
|
+
state,
|
|
533
|
+
relative,
|
|
534
|
+
preventScrollReset,
|
|
535
|
+
viewTransition
|
|
536
|
+
});
|
|
537
|
+
};
|
|
538
|
+
return /* @__PURE__ */ React.createElement(
|
|
539
|
+
"form",
|
|
540
|
+
{
|
|
541
|
+
ref: forwardedRef,
|
|
542
|
+
method: formMethod,
|
|
543
|
+
action: formAction,
|
|
544
|
+
onSubmit: reloadDocument ? onSubmit : submitHandler,
|
|
545
|
+
...props,
|
|
546
|
+
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
547
|
+
}
|
|
548
|
+
);
|
|
549
|
+
}
|
|
550
|
+
);
|
|
551
|
+
Form.displayName = "Form";
|
|
552
|
+
function ScrollRestoration({
|
|
553
|
+
getKey,
|
|
554
|
+
storageKey,
|
|
555
|
+
...props
|
|
556
|
+
}) {
|
|
557
|
+
let remixContext = React.useContext(_chunkAMVS5XVJjs.FrameworkContext);
|
|
558
|
+
let { basename } = React.useContext(_chunkAMVS5XVJjs.NavigationContext);
|
|
559
|
+
let location = _chunkAMVS5XVJjs.useLocation.call(void 0, );
|
|
560
|
+
let matches = _chunkAMVS5XVJjs.useMatches.call(void 0, );
|
|
561
|
+
useScrollRestoration({ getKey, storageKey });
|
|
562
|
+
let ssrKey = React.useMemo(
|
|
563
|
+
() => {
|
|
564
|
+
if (!remixContext || !getKey) return null;
|
|
565
|
+
let userKey = getScrollRestorationKey(
|
|
566
|
+
location,
|
|
567
|
+
matches,
|
|
568
|
+
basename,
|
|
569
|
+
getKey
|
|
570
|
+
);
|
|
571
|
+
return userKey !== location.key ? userKey : null;
|
|
572
|
+
},
|
|
573
|
+
// Nah, we only need this the first time for the SSR render
|
|
574
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
575
|
+
[]
|
|
576
|
+
);
|
|
577
|
+
if (!remixContext || remixContext.isSpaMode) {
|
|
578
|
+
return null;
|
|
579
|
+
}
|
|
580
|
+
let restoreScroll = ((storageKey2, restoreKey) => {
|
|
581
|
+
if (!window.history.state || !window.history.state.key) {
|
|
582
|
+
let key = Math.random().toString(32).slice(2);
|
|
583
|
+
window.history.replaceState({ key }, "");
|
|
584
|
+
}
|
|
585
|
+
try {
|
|
586
|
+
let positions = JSON.parse(sessionStorage.getItem(storageKey2) || "{}");
|
|
587
|
+
let storedY = positions[restoreKey || window.history.state.key];
|
|
588
|
+
if (typeof storedY === "number") {
|
|
589
|
+
window.scrollTo(0, storedY);
|
|
590
|
+
}
|
|
591
|
+
} catch (error) {
|
|
592
|
+
console.error(error);
|
|
593
|
+
sessionStorage.removeItem(storageKey2);
|
|
594
|
+
}
|
|
595
|
+
}).toString();
|
|
596
|
+
return /* @__PURE__ */ React.createElement(
|
|
597
|
+
"script",
|
|
598
|
+
{
|
|
599
|
+
...props,
|
|
600
|
+
suppressHydrationWarning: true,
|
|
601
|
+
dangerouslySetInnerHTML: {
|
|
602
|
+
__html: `(${restoreScroll})(${JSON.stringify(
|
|
603
|
+
storageKey || SCROLL_RESTORATION_STORAGE_KEY
|
|
604
|
+
)}, ${JSON.stringify(ssrKey)})`
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
}
|
|
609
|
+
ScrollRestoration.displayName = "ScrollRestoration";
|
|
610
|
+
function getDataRouterConsoleError(hookName) {
|
|
611
|
+
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
612
|
+
}
|
|
613
|
+
function useDataRouterContext(hookName) {
|
|
614
|
+
let ctx = React.useContext(_chunkAMVS5XVJjs.DataRouterContext);
|
|
615
|
+
_chunkAMVS5XVJjs.invariant.call(void 0, ctx, getDataRouterConsoleError(hookName));
|
|
616
|
+
return ctx;
|
|
617
|
+
}
|
|
618
|
+
function useDataRouterState(hookName) {
|
|
619
|
+
let state = React.useContext(_chunkAMVS5XVJjs.DataRouterStateContext);
|
|
620
|
+
_chunkAMVS5XVJjs.invariant.call(void 0, state, getDataRouterConsoleError(hookName));
|
|
621
|
+
return state;
|
|
622
|
+
}
|
|
623
|
+
function useLinkClickHandler(to, {
|
|
624
|
+
target,
|
|
625
|
+
replace: replaceProp,
|
|
626
|
+
state,
|
|
627
|
+
preventScrollReset,
|
|
628
|
+
relative,
|
|
629
|
+
viewTransition
|
|
630
|
+
} = {}) {
|
|
631
|
+
let navigate = _chunkAMVS5XVJjs.useNavigate.call(void 0, );
|
|
632
|
+
let location = _chunkAMVS5XVJjs.useLocation.call(void 0, );
|
|
633
|
+
let path = _chunkAMVS5XVJjs.useResolvedPath.call(void 0, to, { relative });
|
|
634
|
+
return React.useCallback(
|
|
635
|
+
(event) => {
|
|
636
|
+
if (shouldProcessLinkClick(event, target)) {
|
|
637
|
+
event.preventDefault();
|
|
638
|
+
let replace = replaceProp !== void 0 ? replaceProp : _chunkAMVS5XVJjs.createPath.call(void 0, location) === _chunkAMVS5XVJjs.createPath.call(void 0, path);
|
|
639
|
+
navigate(to, {
|
|
640
|
+
replace,
|
|
641
|
+
state,
|
|
642
|
+
preventScrollReset,
|
|
643
|
+
relative,
|
|
644
|
+
viewTransition
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
},
|
|
648
|
+
[
|
|
649
|
+
location,
|
|
650
|
+
navigate,
|
|
651
|
+
path,
|
|
652
|
+
replaceProp,
|
|
653
|
+
state,
|
|
654
|
+
target,
|
|
655
|
+
to,
|
|
656
|
+
preventScrollReset,
|
|
657
|
+
relative,
|
|
658
|
+
viewTransition
|
|
659
|
+
]
|
|
660
|
+
);
|
|
661
|
+
}
|
|
662
|
+
function useSearchParams(defaultInit) {
|
|
663
|
+
_chunkAMVS5XVJjs.warning.call(void 0,
|
|
664
|
+
typeof URLSearchParams !== "undefined",
|
|
665
|
+
`You cannot use the \`useSearchParams\` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.`
|
|
666
|
+
);
|
|
667
|
+
let defaultSearchParamsRef = React.useRef(createSearchParams(defaultInit));
|
|
668
|
+
let hasSetSearchParamsRef = React.useRef(false);
|
|
669
|
+
let location = _chunkAMVS5XVJjs.useLocation.call(void 0, );
|
|
670
|
+
let searchParams = React.useMemo(
|
|
671
|
+
() => (
|
|
672
|
+
// Only merge in the defaults if we haven't yet called setSearchParams.
|
|
673
|
+
// Once we call that we want those to take precedence, otherwise you can't
|
|
674
|
+
// remove a param with setSearchParams({}) if it has an initial value
|
|
675
|
+
getSearchParamsForLocation(
|
|
676
|
+
location.search,
|
|
677
|
+
hasSetSearchParamsRef.current ? null : defaultSearchParamsRef.current
|
|
678
|
+
)
|
|
679
|
+
),
|
|
680
|
+
[location.search]
|
|
681
|
+
);
|
|
682
|
+
let navigate = _chunkAMVS5XVJjs.useNavigate.call(void 0, );
|
|
683
|
+
let setSearchParams = React.useCallback(
|
|
684
|
+
(nextInit, navigateOptions) => {
|
|
685
|
+
const newSearchParams = createSearchParams(
|
|
686
|
+
typeof nextInit === "function" ? nextInit(new URLSearchParams(searchParams)) : nextInit
|
|
687
|
+
);
|
|
688
|
+
hasSetSearchParamsRef.current = true;
|
|
689
|
+
navigate("?" + newSearchParams, navigateOptions);
|
|
690
|
+
},
|
|
691
|
+
[navigate, searchParams]
|
|
692
|
+
);
|
|
693
|
+
return [searchParams, setSearchParams];
|
|
694
|
+
}
|
|
695
|
+
var fetcherId = 0;
|
|
696
|
+
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
697
|
+
function useSubmit() {
|
|
698
|
+
let { router } = useDataRouterContext("useSubmit" /* UseSubmit */);
|
|
699
|
+
let { basename } = React.useContext(_chunkAMVS5XVJjs.NavigationContext);
|
|
700
|
+
let currentRouteId = _chunkAMVS5XVJjs.useRouteId.call(void 0, );
|
|
701
|
+
return React.useCallback(
|
|
702
|
+
async (target, options = {}) => {
|
|
703
|
+
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
704
|
+
target,
|
|
705
|
+
basename
|
|
706
|
+
);
|
|
707
|
+
if (options.navigate === false) {
|
|
708
|
+
let key = options.fetcherKey || getUniqueFetcherId();
|
|
709
|
+
await router.fetch(key, currentRouteId, options.action || action, {
|
|
710
|
+
preventScrollReset: options.preventScrollReset,
|
|
711
|
+
formData,
|
|
712
|
+
body,
|
|
713
|
+
formMethod: options.method || method,
|
|
714
|
+
formEncType: options.encType || encType,
|
|
715
|
+
flushSync: options.flushSync
|
|
716
|
+
});
|
|
717
|
+
} else {
|
|
718
|
+
await router.navigate(options.action || action, {
|
|
719
|
+
preventScrollReset: options.preventScrollReset,
|
|
720
|
+
formData,
|
|
721
|
+
body,
|
|
722
|
+
formMethod: options.method || method,
|
|
723
|
+
formEncType: options.encType || encType,
|
|
724
|
+
replace: options.replace,
|
|
725
|
+
state: options.state,
|
|
726
|
+
fromRouteId: currentRouteId,
|
|
727
|
+
flushSync: options.flushSync,
|
|
728
|
+
viewTransition: options.viewTransition
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
[router, basename, currentRouteId]
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
function useFormAction(action, { relative } = {}) {
|
|
736
|
+
let { basename } = React.useContext(_chunkAMVS5XVJjs.NavigationContext);
|
|
737
|
+
let routeContext = React.useContext(_chunkAMVS5XVJjs.RouteContext);
|
|
738
|
+
_chunkAMVS5XVJjs.invariant.call(void 0, routeContext, "useFormAction must be used inside a RouteContext");
|
|
739
|
+
let [match] = routeContext.matches.slice(-1);
|
|
740
|
+
let path = { ..._chunkAMVS5XVJjs.useResolvedPath.call(void 0, action ? action : ".", { relative }) };
|
|
741
|
+
let location = _chunkAMVS5XVJjs.useLocation.call(void 0, );
|
|
742
|
+
if (action == null) {
|
|
743
|
+
path.search = location.search;
|
|
744
|
+
let params = new URLSearchParams(path.search);
|
|
745
|
+
let indexValues = params.getAll("index");
|
|
746
|
+
let hasNakedIndexParam = indexValues.some((v) => v === "");
|
|
747
|
+
if (hasNakedIndexParam) {
|
|
748
|
+
params.delete("index");
|
|
749
|
+
indexValues.filter((v) => v).forEach((v) => params.append("index", v));
|
|
750
|
+
let qs = params.toString();
|
|
751
|
+
path.search = qs ? `?${qs}` : "";
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
if ((!action || action === ".") && match.route.index) {
|
|
755
|
+
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
756
|
+
}
|
|
757
|
+
if (basename !== "/") {
|
|
758
|
+
path.pathname = path.pathname === "/" ? basename : _chunkAMVS5XVJjs.joinPaths.call(void 0, [basename, path.pathname]);
|
|
759
|
+
}
|
|
760
|
+
return _chunkAMVS5XVJjs.createPath.call(void 0, path);
|
|
761
|
+
}
|
|
762
|
+
function useFetcher({
|
|
763
|
+
key
|
|
764
|
+
} = {}) {
|
|
765
|
+
let { router } = useDataRouterContext("useFetcher" /* UseFetcher */);
|
|
766
|
+
let state = useDataRouterState("useFetcher" /* UseFetcher */);
|
|
767
|
+
let fetcherData = React.useContext(_chunkAMVS5XVJjs.FetchersContext);
|
|
768
|
+
let route = React.useContext(_chunkAMVS5XVJjs.RouteContext);
|
|
769
|
+
let routeId = _optionalChain([route, 'access', _23 => _23.matches, 'access', _24 => _24[route.matches.length - 1], 'optionalAccess', _25 => _25.route, 'access', _26 => _26.id]);
|
|
770
|
+
_chunkAMVS5XVJjs.invariant.call(void 0, fetcherData, `useFetcher must be used inside a FetchersContext`);
|
|
771
|
+
_chunkAMVS5XVJjs.invariant.call(void 0, route, `useFetcher must be used inside a RouteContext`);
|
|
772
|
+
_chunkAMVS5XVJjs.invariant.call(void 0,
|
|
773
|
+
routeId != null,
|
|
774
|
+
`useFetcher can only be used on routes that contain a unique "id"`
|
|
775
|
+
);
|
|
776
|
+
let defaultKey = React.useId();
|
|
777
|
+
let [fetcherKey, setFetcherKey] = React.useState(key || defaultKey);
|
|
778
|
+
if (key && key !== fetcherKey) {
|
|
779
|
+
setFetcherKey(key);
|
|
780
|
+
}
|
|
781
|
+
React.useEffect(() => {
|
|
782
|
+
router.getFetcher(fetcherKey);
|
|
783
|
+
return () => router.deleteFetcher(fetcherKey);
|
|
784
|
+
}, [router, fetcherKey]);
|
|
785
|
+
let load = React.useCallback(
|
|
786
|
+
async (href, opts) => {
|
|
787
|
+
_chunkAMVS5XVJjs.invariant.call(void 0, routeId, "No routeId available for fetcher.load()");
|
|
788
|
+
await router.fetch(fetcherKey, routeId, href, opts);
|
|
789
|
+
},
|
|
790
|
+
[fetcherKey, routeId, router]
|
|
791
|
+
);
|
|
792
|
+
let submitImpl = useSubmit();
|
|
793
|
+
let submit = React.useCallback(
|
|
794
|
+
async (target, opts) => {
|
|
795
|
+
await submitImpl(target, {
|
|
796
|
+
...opts,
|
|
797
|
+
navigate: false,
|
|
798
|
+
fetcherKey
|
|
799
|
+
});
|
|
800
|
+
},
|
|
801
|
+
[fetcherKey, submitImpl]
|
|
802
|
+
);
|
|
803
|
+
let unstable_reset = React.useCallback((opts) => router.resetFetcher(fetcherKey, opts), [router, fetcherKey]);
|
|
804
|
+
let FetcherForm = React.useMemo(() => {
|
|
805
|
+
let FetcherForm2 = React.forwardRef(
|
|
806
|
+
(props, ref) => {
|
|
807
|
+
return /* @__PURE__ */ React.createElement(Form, { ...props, navigate: false, fetcherKey, ref });
|
|
808
|
+
}
|
|
809
|
+
);
|
|
810
|
+
FetcherForm2.displayName = "fetcher.Form";
|
|
811
|
+
return FetcherForm2;
|
|
812
|
+
}, [fetcherKey]);
|
|
813
|
+
let fetcher = state.fetchers.get(fetcherKey) || _chunkAMVS5XVJjs.IDLE_FETCHER;
|
|
814
|
+
let data = fetcherData.get(fetcherKey);
|
|
815
|
+
let fetcherWithComponents = React.useMemo(
|
|
816
|
+
() => ({
|
|
817
|
+
Form: FetcherForm,
|
|
818
|
+
submit,
|
|
819
|
+
load,
|
|
820
|
+
unstable_reset,
|
|
821
|
+
...fetcher,
|
|
822
|
+
data
|
|
823
|
+
}),
|
|
824
|
+
[FetcherForm, submit, load, unstable_reset, fetcher, data]
|
|
825
|
+
);
|
|
826
|
+
return fetcherWithComponents;
|
|
827
|
+
}
|
|
828
|
+
function useFetchers() {
|
|
829
|
+
let state = useDataRouterState("useFetchers" /* UseFetchers */);
|
|
830
|
+
return Array.from(state.fetchers.entries()).map(([key, fetcher]) => ({
|
|
831
|
+
...fetcher,
|
|
832
|
+
key
|
|
833
|
+
}));
|
|
834
|
+
}
|
|
835
|
+
var SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
|
|
836
|
+
var savedScrollPositions = {};
|
|
837
|
+
function getScrollRestorationKey(location, matches, basename, getKey) {
|
|
838
|
+
let key = null;
|
|
839
|
+
if (getKey) {
|
|
840
|
+
if (basename !== "/") {
|
|
841
|
+
key = getKey(
|
|
842
|
+
{
|
|
843
|
+
...location,
|
|
844
|
+
pathname: _chunkAMVS5XVJjs.stripBasename.call(void 0, location.pathname, basename) || location.pathname
|
|
845
|
+
},
|
|
846
|
+
matches
|
|
847
|
+
);
|
|
848
|
+
} else {
|
|
849
|
+
key = getKey(location, matches);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
if (key == null) {
|
|
853
|
+
key = location.key;
|
|
854
|
+
}
|
|
855
|
+
return key;
|
|
856
|
+
}
|
|
857
|
+
function useScrollRestoration({
|
|
858
|
+
getKey,
|
|
859
|
+
storageKey
|
|
860
|
+
} = {}) {
|
|
861
|
+
let { router } = useDataRouterContext("useScrollRestoration" /* UseScrollRestoration */);
|
|
862
|
+
let { restoreScrollPosition, preventScrollReset } = useDataRouterState(
|
|
863
|
+
"useScrollRestoration" /* UseScrollRestoration */
|
|
864
|
+
);
|
|
865
|
+
let { basename } = React.useContext(_chunkAMVS5XVJjs.NavigationContext);
|
|
866
|
+
let location = _chunkAMVS5XVJjs.useLocation.call(void 0, );
|
|
867
|
+
let matches = _chunkAMVS5XVJjs.useMatches.call(void 0, );
|
|
868
|
+
let navigation = _chunkAMVS5XVJjs.useNavigation.call(void 0, );
|
|
869
|
+
React.useEffect(() => {
|
|
870
|
+
window.history.scrollRestoration = "manual";
|
|
871
|
+
return () => {
|
|
872
|
+
window.history.scrollRestoration = "auto";
|
|
873
|
+
};
|
|
874
|
+
}, []);
|
|
875
|
+
usePageHide(
|
|
876
|
+
React.useCallback(() => {
|
|
877
|
+
if (navigation.state === "idle") {
|
|
878
|
+
let key = getScrollRestorationKey(location, matches, basename, getKey);
|
|
879
|
+
savedScrollPositions[key] = window.scrollY;
|
|
880
|
+
}
|
|
881
|
+
try {
|
|
882
|
+
sessionStorage.setItem(
|
|
883
|
+
storageKey || SCROLL_RESTORATION_STORAGE_KEY,
|
|
884
|
+
JSON.stringify(savedScrollPositions)
|
|
885
|
+
);
|
|
886
|
+
} catch (error) {
|
|
887
|
+
_chunkAMVS5XVJjs.warning.call(void 0,
|
|
888
|
+
false,
|
|
889
|
+
`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${error}).`
|
|
890
|
+
);
|
|
891
|
+
}
|
|
892
|
+
window.history.scrollRestoration = "auto";
|
|
893
|
+
}, [navigation.state, getKey, basename, location, matches, storageKey])
|
|
894
|
+
);
|
|
895
|
+
if (typeof document !== "undefined") {
|
|
896
|
+
React.useLayoutEffect(() => {
|
|
897
|
+
try {
|
|
898
|
+
let sessionPositions = sessionStorage.getItem(
|
|
899
|
+
storageKey || SCROLL_RESTORATION_STORAGE_KEY
|
|
900
|
+
);
|
|
901
|
+
if (sessionPositions) {
|
|
902
|
+
savedScrollPositions = JSON.parse(sessionPositions);
|
|
903
|
+
}
|
|
904
|
+
} catch (e) {
|
|
905
|
+
}
|
|
906
|
+
}, [storageKey]);
|
|
907
|
+
React.useLayoutEffect(() => {
|
|
908
|
+
let disableScrollRestoration = _optionalChain([router, 'optionalAccess', _27 => _27.enableScrollRestoration, 'call', _28 => _28(
|
|
909
|
+
savedScrollPositions,
|
|
910
|
+
() => window.scrollY,
|
|
911
|
+
getKey ? (location2, matches2) => getScrollRestorationKey(location2, matches2, basename, getKey) : void 0
|
|
912
|
+
)]);
|
|
913
|
+
return () => disableScrollRestoration && disableScrollRestoration();
|
|
914
|
+
}, [router, basename, getKey]);
|
|
915
|
+
React.useLayoutEffect(() => {
|
|
916
|
+
if (restoreScrollPosition === false) {
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
919
|
+
if (typeof restoreScrollPosition === "number") {
|
|
920
|
+
window.scrollTo(0, restoreScrollPosition);
|
|
921
|
+
return;
|
|
922
|
+
}
|
|
923
|
+
try {
|
|
924
|
+
if (location.hash) {
|
|
925
|
+
let el = document.getElementById(
|
|
926
|
+
decodeURIComponent(location.hash.slice(1))
|
|
927
|
+
);
|
|
928
|
+
if (el) {
|
|
929
|
+
el.scrollIntoView();
|
|
930
|
+
return;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
} catch (e2) {
|
|
934
|
+
_chunkAMVS5XVJjs.warning.call(void 0,
|
|
935
|
+
false,
|
|
936
|
+
`"${location.hash.slice(
|
|
937
|
+
1
|
|
938
|
+
)}" is not a decodable element ID. The view will not scroll to it.`
|
|
939
|
+
);
|
|
940
|
+
}
|
|
941
|
+
if (preventScrollReset === true) {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
window.scrollTo(0, 0);
|
|
945
|
+
}, [location, restoreScrollPosition, preventScrollReset]);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
function useBeforeUnload(callback, options) {
|
|
949
|
+
let { capture } = options || {};
|
|
950
|
+
React.useEffect(() => {
|
|
951
|
+
let opts = capture != null ? { capture } : void 0;
|
|
952
|
+
window.addEventListener("beforeunload", callback, opts);
|
|
953
|
+
return () => {
|
|
954
|
+
window.removeEventListener("beforeunload", callback, opts);
|
|
955
|
+
};
|
|
956
|
+
}, [callback, capture]);
|
|
957
|
+
}
|
|
958
|
+
function usePageHide(callback, options) {
|
|
959
|
+
let { capture } = options || {};
|
|
960
|
+
React.useEffect(() => {
|
|
961
|
+
let opts = capture != null ? { capture } : void 0;
|
|
962
|
+
window.addEventListener("pagehide", callback, opts);
|
|
963
|
+
return () => {
|
|
964
|
+
window.removeEventListener("pagehide", callback, opts);
|
|
965
|
+
};
|
|
966
|
+
}, [callback, capture]);
|
|
967
|
+
}
|
|
968
|
+
function usePrompt({
|
|
969
|
+
when,
|
|
970
|
+
message
|
|
971
|
+
}) {
|
|
972
|
+
let blocker = _chunkAMVS5XVJjs.useBlocker.call(void 0, when);
|
|
973
|
+
React.useEffect(() => {
|
|
974
|
+
if (blocker.state === "blocked") {
|
|
975
|
+
let proceed = window.confirm(message);
|
|
976
|
+
if (proceed) {
|
|
977
|
+
setTimeout(blocker.proceed, 0);
|
|
978
|
+
} else {
|
|
979
|
+
blocker.reset();
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
}, [blocker, message]);
|
|
983
|
+
React.useEffect(() => {
|
|
984
|
+
if (blocker.state === "blocked" && !when) {
|
|
985
|
+
blocker.reset();
|
|
986
|
+
}
|
|
987
|
+
}, [blocker, when]);
|
|
988
|
+
}
|
|
989
|
+
function useViewTransitionState(to, { relative } = {}) {
|
|
990
|
+
let vtContext = React.useContext(_chunkAMVS5XVJjs.ViewTransitionContext);
|
|
991
|
+
_chunkAMVS5XVJjs.invariant.call(void 0,
|
|
992
|
+
vtContext != null,
|
|
993
|
+
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
994
|
+
);
|
|
995
|
+
let { basename } = useDataRouterContext(
|
|
996
|
+
"useViewTransitionState" /* useViewTransitionState */
|
|
997
|
+
);
|
|
998
|
+
let path = _chunkAMVS5XVJjs.useResolvedPath.call(void 0, to, { relative });
|
|
999
|
+
if (!vtContext.isTransitioning) {
|
|
1000
|
+
return false;
|
|
1001
|
+
}
|
|
1002
|
+
let currentPath = _chunkAMVS5XVJjs.stripBasename.call(void 0, vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
1003
|
+
let nextPath = _chunkAMVS5XVJjs.stripBasename.call(void 0, vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
1004
|
+
return _chunkAMVS5XVJjs.matchPath.call(void 0, path.pathname, nextPath) != null || _chunkAMVS5XVJjs.matchPath.call(void 0, path.pathname, currentPath) != null;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// lib/dom/server.tsx
|
|
1008
|
+
|
|
1009
|
+
function StaticRouter({
|
|
1010
|
+
basename,
|
|
1011
|
+
children,
|
|
1012
|
+
location: locationProp = "/"
|
|
1013
|
+
}) {
|
|
1014
|
+
if (typeof locationProp === "string") {
|
|
1015
|
+
locationProp = _chunkAMVS5XVJjs.parsePath.call(void 0, locationProp);
|
|
1016
|
+
}
|
|
1017
|
+
let action = "POP" /* Pop */;
|
|
1018
|
+
let location = {
|
|
1019
|
+
pathname: locationProp.pathname || "/",
|
|
1020
|
+
search: locationProp.search || "",
|
|
1021
|
+
hash: locationProp.hash || "",
|
|
1022
|
+
state: locationProp.state != null ? locationProp.state : null,
|
|
1023
|
+
key: locationProp.key || "default"
|
|
1024
|
+
};
|
|
1025
|
+
let staticNavigator = getStatelessNavigator();
|
|
1026
|
+
return /* @__PURE__ */ React2.createElement(
|
|
1027
|
+
_chunkAMVS5XVJjs.Router,
|
|
1028
|
+
{
|
|
1029
|
+
basename,
|
|
1030
|
+
children,
|
|
1031
|
+
location,
|
|
1032
|
+
navigationType: action,
|
|
1033
|
+
navigator: staticNavigator,
|
|
1034
|
+
static: true
|
|
1035
|
+
}
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
function StaticRouterProvider({
|
|
1039
|
+
context,
|
|
1040
|
+
router,
|
|
1041
|
+
hydrate = true,
|
|
1042
|
+
nonce
|
|
1043
|
+
}) {
|
|
1044
|
+
_chunkAMVS5XVJjs.invariant.call(void 0,
|
|
1045
|
+
router && context,
|
|
1046
|
+
"You must provide `router` and `context` to <StaticRouterProvider>"
|
|
1047
|
+
);
|
|
1048
|
+
let dataRouterContext = {
|
|
1049
|
+
router,
|
|
1050
|
+
navigator: getStatelessNavigator(),
|
|
1051
|
+
static: true,
|
|
1052
|
+
staticContext: context,
|
|
1053
|
+
basename: context.basename || "/"
|
|
1054
|
+
};
|
|
1055
|
+
let fetchersContext = /* @__PURE__ */ new Map();
|
|
1056
|
+
let hydrateScript = "";
|
|
1057
|
+
if (hydrate !== false) {
|
|
1058
|
+
let data = {
|
|
1059
|
+
loaderData: context.loaderData,
|
|
1060
|
+
actionData: context.actionData,
|
|
1061
|
+
errors: serializeErrors(context.errors)
|
|
1062
|
+
};
|
|
1063
|
+
let json = htmlEscape(JSON.stringify(JSON.stringify(data)));
|
|
1064
|
+
hydrateScript = `window.__staticRouterHydrationData = JSON.parse(${json});`;
|
|
1065
|
+
}
|
|
1066
|
+
let { state } = dataRouterContext.router;
|
|
1067
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(_chunkAMVS5XVJjs.DataRouterContext.Provider, { value: dataRouterContext }, /* @__PURE__ */ React2.createElement(_chunkAMVS5XVJjs.DataRouterStateContext.Provider, { value: state }, /* @__PURE__ */ React2.createElement(_chunkAMVS5XVJjs.FetchersContext.Provider, { value: fetchersContext }, /* @__PURE__ */ React2.createElement(_chunkAMVS5XVJjs.ViewTransitionContext.Provider, { value: { isTransitioning: false } }, /* @__PURE__ */ React2.createElement(
|
|
1068
|
+
_chunkAMVS5XVJjs.Router,
|
|
1069
|
+
{
|
|
1070
|
+
basename: dataRouterContext.basename,
|
|
1071
|
+
location: state.location,
|
|
1072
|
+
navigationType: state.historyAction,
|
|
1073
|
+
navigator: dataRouterContext.navigator,
|
|
1074
|
+
static: dataRouterContext.static
|
|
1075
|
+
},
|
|
1076
|
+
/* @__PURE__ */ React2.createElement(
|
|
1077
|
+
DataRoutes,
|
|
1078
|
+
{
|
|
1079
|
+
routes: router.routes,
|
|
1080
|
+
future: router.future,
|
|
1081
|
+
state
|
|
1082
|
+
}
|
|
1083
|
+
)
|
|
1084
|
+
))))), hydrateScript ? /* @__PURE__ */ React2.createElement(
|
|
1085
|
+
"script",
|
|
1086
|
+
{
|
|
1087
|
+
suppressHydrationWarning: true,
|
|
1088
|
+
nonce,
|
|
1089
|
+
dangerouslySetInnerHTML: { __html: hydrateScript }
|
|
1090
|
+
}
|
|
1091
|
+
) : null);
|
|
1092
|
+
}
|
|
1093
|
+
function DataRoutes({
|
|
1094
|
+
routes,
|
|
1095
|
+
future,
|
|
1096
|
+
state
|
|
1097
|
+
}) {
|
|
1098
|
+
return _chunkAMVS5XVJjs.useRoutesImpl.call(void 0, routes, void 0, state, void 0, future);
|
|
1099
|
+
}
|
|
1100
|
+
function serializeErrors(errors) {
|
|
1101
|
+
if (!errors) return null;
|
|
1102
|
+
let entries = Object.entries(errors);
|
|
1103
|
+
let serialized = {};
|
|
1104
|
+
for (let [key, val] of entries) {
|
|
1105
|
+
if (_chunkAMVS5XVJjs.isRouteErrorResponse.call(void 0, val)) {
|
|
1106
|
+
serialized[key] = { ...val, __type: "RouteErrorResponse" };
|
|
1107
|
+
} else if (val instanceof Error) {
|
|
1108
|
+
serialized[key] = {
|
|
1109
|
+
message: val.message,
|
|
1110
|
+
__type: "Error",
|
|
1111
|
+
// If this is a subclass (i.e., ReferenceError), send up the type so we
|
|
1112
|
+
// can re-create the same type during hydration.
|
|
1113
|
+
...val.name !== "Error" ? {
|
|
1114
|
+
__subType: val.name
|
|
1115
|
+
} : {}
|
|
1116
|
+
};
|
|
1117
|
+
} else {
|
|
1118
|
+
serialized[key] = val;
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
return serialized;
|
|
1122
|
+
}
|
|
1123
|
+
function getStatelessNavigator() {
|
|
1124
|
+
return {
|
|
1125
|
+
createHref,
|
|
1126
|
+
encodeLocation,
|
|
1127
|
+
push(to) {
|
|
1128
|
+
throw new Error(
|
|
1129
|
+
`You cannot use navigator.push() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)})\` somewhere in your app.`
|
|
1130
|
+
);
|
|
1131
|
+
},
|
|
1132
|
+
replace(to) {
|
|
1133
|
+
throw new Error(
|
|
1134
|
+
`You cannot use navigator.replace() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${JSON.stringify(to)}, { replace: true })\` somewhere in your app.`
|
|
1135
|
+
);
|
|
1136
|
+
},
|
|
1137
|
+
go(delta) {
|
|
1138
|
+
throw new Error(
|
|
1139
|
+
`You cannot use navigator.go() on the server because it is a stateless environment. This error was probably triggered when you did a \`navigate(${delta})\` somewhere in your app.`
|
|
1140
|
+
);
|
|
1141
|
+
},
|
|
1142
|
+
back() {
|
|
1143
|
+
throw new Error(
|
|
1144
|
+
`You cannot use navigator.back() on the server because it is a stateless environment.`
|
|
1145
|
+
);
|
|
1146
|
+
},
|
|
1147
|
+
forward() {
|
|
1148
|
+
throw new Error(
|
|
1149
|
+
`You cannot use navigator.forward() on the server because it is a stateless environment.`
|
|
1150
|
+
);
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
}
|
|
1154
|
+
function createStaticHandler2(routes, opts) {
|
|
1155
|
+
return _chunkAMVS5XVJjs.createStaticHandler.call(void 0, routes, {
|
|
1156
|
+
...opts,
|
|
1157
|
+
mapRouteProperties: _chunkAMVS5XVJjs.mapRouteProperties
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
function createStaticRouter(routes, context, opts = {}) {
|
|
1161
|
+
let manifest = {};
|
|
1162
|
+
let dataRoutes = _chunkAMVS5XVJjs.convertRoutesToDataRoutes.call(void 0,
|
|
1163
|
+
routes,
|
|
1164
|
+
_chunkAMVS5XVJjs.mapRouteProperties,
|
|
1165
|
+
void 0,
|
|
1166
|
+
manifest
|
|
1167
|
+
);
|
|
1168
|
+
let matches = context.matches.map((match) => {
|
|
1169
|
+
let route = manifest[match.route.id] || match.route;
|
|
1170
|
+
return {
|
|
1171
|
+
...match,
|
|
1172
|
+
route
|
|
1173
|
+
};
|
|
1174
|
+
});
|
|
1175
|
+
let msg = (method) => `You cannot use router.${method}() on the server because it is a stateless environment`;
|
|
1176
|
+
return {
|
|
1177
|
+
get basename() {
|
|
1178
|
+
return context.basename;
|
|
1179
|
+
},
|
|
1180
|
+
get future() {
|
|
1181
|
+
return {
|
|
1182
|
+
v8_middleware: false,
|
|
1183
|
+
..._optionalChain([opts, 'optionalAccess', _29 => _29.future])
|
|
1184
|
+
};
|
|
1185
|
+
},
|
|
1186
|
+
get state() {
|
|
1187
|
+
return {
|
|
1188
|
+
historyAction: "POP" /* Pop */,
|
|
1189
|
+
location: context.location,
|
|
1190
|
+
matches,
|
|
1191
|
+
loaderData: context.loaderData,
|
|
1192
|
+
actionData: context.actionData,
|
|
1193
|
+
errors: context.errors,
|
|
1194
|
+
initialized: true,
|
|
1195
|
+
navigation: _chunkAMVS5XVJjs.IDLE_NAVIGATION,
|
|
1196
|
+
restoreScrollPosition: null,
|
|
1197
|
+
preventScrollReset: false,
|
|
1198
|
+
revalidation: "idle",
|
|
1199
|
+
fetchers: /* @__PURE__ */ new Map(),
|
|
1200
|
+
blockers: /* @__PURE__ */ new Map()
|
|
1201
|
+
};
|
|
1202
|
+
},
|
|
1203
|
+
get routes() {
|
|
1204
|
+
return dataRoutes;
|
|
1205
|
+
},
|
|
1206
|
+
get window() {
|
|
1207
|
+
return void 0;
|
|
1208
|
+
},
|
|
1209
|
+
initialize() {
|
|
1210
|
+
throw msg("initialize");
|
|
1211
|
+
},
|
|
1212
|
+
subscribe() {
|
|
1213
|
+
throw msg("subscribe");
|
|
1214
|
+
},
|
|
1215
|
+
enableScrollRestoration() {
|
|
1216
|
+
throw msg("enableScrollRestoration");
|
|
1217
|
+
},
|
|
1218
|
+
navigate() {
|
|
1219
|
+
throw msg("navigate");
|
|
1220
|
+
},
|
|
1221
|
+
fetch() {
|
|
1222
|
+
throw msg("fetch");
|
|
1223
|
+
},
|
|
1224
|
+
revalidate() {
|
|
1225
|
+
throw msg("revalidate");
|
|
1226
|
+
},
|
|
1227
|
+
createHref,
|
|
1228
|
+
encodeLocation,
|
|
1229
|
+
getFetcher() {
|
|
1230
|
+
return _chunkAMVS5XVJjs.IDLE_FETCHER;
|
|
1231
|
+
},
|
|
1232
|
+
deleteFetcher() {
|
|
1233
|
+
throw msg("deleteFetcher");
|
|
1234
|
+
},
|
|
1235
|
+
resetFetcher() {
|
|
1236
|
+
throw msg("resetFetcher");
|
|
1237
|
+
},
|
|
1238
|
+
dispose() {
|
|
1239
|
+
throw msg("dispose");
|
|
1240
|
+
},
|
|
1241
|
+
getBlocker() {
|
|
1242
|
+
return _chunkAMVS5XVJjs.IDLE_BLOCKER;
|
|
1243
|
+
},
|
|
1244
|
+
deleteBlocker() {
|
|
1245
|
+
throw msg("deleteBlocker");
|
|
1246
|
+
},
|
|
1247
|
+
patchRoutes() {
|
|
1248
|
+
throw msg("patchRoutes");
|
|
1249
|
+
},
|
|
1250
|
+
_internalFetchControllers: /* @__PURE__ */ new Map(),
|
|
1251
|
+
_internalSetRoutes() {
|
|
1252
|
+
throw msg("_internalSetRoutes");
|
|
1253
|
+
},
|
|
1254
|
+
_internalSetStateDoNotUseOrYouWillBreakYourApp() {
|
|
1255
|
+
throw msg("_internalSetStateDoNotUseOrYouWillBreakYourApp");
|
|
1256
|
+
}
|
|
1257
|
+
};
|
|
1258
|
+
}
|
|
1259
|
+
function createHref(to) {
|
|
1260
|
+
return typeof to === "string" ? to : _chunkAMVS5XVJjs.createPath.call(void 0, to);
|
|
1261
|
+
}
|
|
1262
|
+
function encodeLocation(to) {
|
|
1263
|
+
let href = typeof to === "string" ? to : _chunkAMVS5XVJjs.createPath.call(void 0, to);
|
|
1264
|
+
href = href.replace(/ $/, "%20");
|
|
1265
|
+
let encoded = ABSOLUTE_URL_REGEX2.test(href) ? new URL(href) : new URL(href, "http://localhost");
|
|
1266
|
+
return {
|
|
1267
|
+
pathname: encoded.pathname,
|
|
1268
|
+
search: encoded.search,
|
|
1269
|
+
hash: encoded.hash
|
|
1270
|
+
};
|
|
1271
|
+
}
|
|
1272
|
+
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
1273
|
+
var ESCAPE_LOOKUP = {
|
|
1274
|
+
"&": "\\u0026",
|
|
1275
|
+
">": "\\u003e",
|
|
1276
|
+
"<": "\\u003c",
|
|
1277
|
+
"\u2028": "\\u2028",
|
|
1278
|
+
"\u2029": "\\u2029"
|
|
1279
|
+
};
|
|
1280
|
+
var ESCAPE_REGEX = /[&><\u2028\u2029]/g;
|
|
1281
|
+
function htmlEscape(str) {
|
|
1282
|
+
return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
exports.createSearchParams = createSearchParams; exports.createBrowserRouter = createBrowserRouter; exports.createHashRouter = createHashRouter; exports.BrowserRouter = BrowserRouter; exports.HashRouter = HashRouter; exports.HistoryRouter = HistoryRouter; exports.Link = Link; exports.NavLink = NavLink; exports.Form = Form; exports.ScrollRestoration = ScrollRestoration; exports.useLinkClickHandler = useLinkClickHandler; exports.useSearchParams = useSearchParams; exports.useSubmit = useSubmit; exports.useFormAction = useFormAction; exports.useFetcher = useFetcher; exports.useFetchers = useFetchers; exports.useScrollRestoration = useScrollRestoration; exports.useBeforeUnload = useBeforeUnload; exports.usePrompt = usePrompt; exports.useViewTransitionState = useViewTransitionState; exports.StaticRouter = StaticRouter; exports.StaticRouterProvider = StaticRouterProvider; exports.createStaticHandler = createStaticHandler2; exports.createStaticRouter = createStaticRouter;
|