hookery 1.0.0 → 1.0.1

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.
Files changed (98) hide show
  1. package/README.md +28 -26
  2. package/dist/index.d.ts +147 -1
  3. package/dist/index.js +10 -4304
  4. package/dist/index.mjs +10 -4164
  5. package/package.json +10 -81
  6. package/dist/bridges/auth0.d.mts +0 -16
  7. package/dist/bridges/auth0.d.ts +0 -16
  8. package/dist/bridges/auth0.js +0 -3015
  9. package/dist/bridges/auth0.js.map +0 -1
  10. package/dist/bridges/auth0.mjs +0 -2977
  11. package/dist/bridges/auth0.mjs.map +0 -1
  12. package/dist/bridges/axios.d.mts +0 -17
  13. package/dist/bridges/axios.d.ts +0 -17
  14. package/dist/bridges/axios.js +0 -15351
  15. package/dist/bridges/axios.js.map +0 -1
  16. package/dist/bridges/axios.mjs +0 -15347
  17. package/dist/bridges/axios.mjs.map +0 -1
  18. package/dist/bridges/clerk.d.mts +0 -1
  19. package/dist/bridges/clerk.d.ts +0 -1
  20. package/dist/bridges/clerk.js +0 -5991
  21. package/dist/bridges/clerk.js.map +0 -1
  22. package/dist/bridges/clerk.mjs +0 -5985
  23. package/dist/bridges/clerk.mjs.map +0 -1
  24. package/dist/bridges/firebase.d.mts +0 -14
  25. package/dist/bridges/firebase.d.ts +0 -14
  26. package/dist/bridges/firebase.js +0 -52
  27. package/dist/bridges/firebase.js.map +0 -1
  28. package/dist/bridges/firebase.mjs +0 -25
  29. package/dist/bridges/firebase.mjs.map +0 -1
  30. package/dist/bridges/jotai.d.mts +0 -11
  31. package/dist/bridges/jotai.d.ts +0 -11
  32. package/dist/bridges/jotai.js +0 -870
  33. package/dist/bridges/jotai.js.map +0 -1
  34. package/dist/bridges/jotai.mjs +0 -827
  35. package/dist/bridges/jotai.mjs.map +0 -1
  36. package/dist/bridges/motion.d.mts +0 -6
  37. package/dist/bridges/motion.d.ts +0 -6
  38. package/dist/bridges/motion.js +0 -3752
  39. package/dist/bridges/motion.js.map +0 -1
  40. package/dist/bridges/motion.mjs +0 -3721
  41. package/dist/bridges/motion.mjs.map +0 -1
  42. package/dist/bridges/next.d.mts +0 -10
  43. package/dist/bridges/next.d.ts +0 -10
  44. package/dist/bridges/next.js +0 -2588
  45. package/dist/bridges/next.js.map +0 -1
  46. package/dist/bridges/next.mjs +0 -2582
  47. package/dist/bridges/next.mjs.map +0 -1
  48. package/dist/bridges/redux.d.mts +0 -15
  49. package/dist/bridges/redux.d.ts +0 -15
  50. package/dist/bridges/redux.js +0 -410
  51. package/dist/bridges/redux.js.map +0 -1
  52. package/dist/bridges/redux.mjs +0 -402
  53. package/dist/bridges/redux.mjs.map +0 -1
  54. package/dist/bridges/remix.d.mts +0 -1
  55. package/dist/bridges/remix.d.ts +0 -1
  56. package/dist/bridges/remix.js +0 -2215
  57. package/dist/bridges/remix.js.map +0 -1
  58. package/dist/bridges/remix.mjs +0 -2174
  59. package/dist/bridges/remix.mjs.map +0 -1
  60. package/dist/bridges/stripe.d.mts +0 -15
  61. package/dist/bridges/stripe.d.ts +0 -15
  62. package/dist/bridges/stripe.js +0 -1572
  63. package/dist/bridges/stripe.js.map +0 -1
  64. package/dist/bridges/stripe.mjs +0 -1556
  65. package/dist/bridges/stripe.mjs.map +0 -1
  66. package/dist/bridges/supabase.d.mts +0 -13
  67. package/dist/bridges/supabase.d.ts +0 -13
  68. package/dist/bridges/supabase.js +0 -51
  69. package/dist/bridges/supabase.js.map +0 -1
  70. package/dist/bridges/supabase.mjs +0 -24
  71. package/dist/bridges/supabase.mjs.map +0 -1
  72. package/dist/bridges/tanstack.d.mts +0 -3
  73. package/dist/bridges/tanstack.d.ts +0 -3
  74. package/dist/bridges/tanstack.js +0 -1319
  75. package/dist/bridges/tanstack.js.map +0 -1
  76. package/dist/bridges/tanstack.mjs +0 -1281
  77. package/dist/bridges/tanstack.mjs.map +0 -1
  78. package/dist/bridges/yup.d.mts +0 -16
  79. package/dist/bridges/yup.d.ts +0 -16
  80. package/dist/bridges/yup.js +0 -80
  81. package/dist/bridges/yup.js.map +0 -1
  82. package/dist/bridges/yup.mjs +0 -43
  83. package/dist/bridges/yup.mjs.map +0 -1
  84. package/dist/bridges/zod.d.mts +0 -19
  85. package/dist/bridges/zod.d.ts +0 -19
  86. package/dist/bridges/zod.js +0 -66
  87. package/dist/bridges/zod.js.map +0 -1
  88. package/dist/bridges/zod.mjs +0 -39
  89. package/dist/bridges/zod.mjs.map +0 -1
  90. package/dist/bridges/zustand.d.mts +0 -14
  91. package/dist/bridges/zustand.d.ts +0 -14
  92. package/dist/bridges/zustand.js +0 -58
  93. package/dist/bridges/zustand.js.map +0 -1
  94. package/dist/bridges/zustand.mjs +0 -21
  95. package/dist/bridges/zustand.mjs.map +0 -1
  96. package/dist/index.d.mts +0 -3130
  97. package/dist/index.js.map +0 -1
  98. package/dist/index.mjs.map +0 -1
@@ -1,2215 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __esm = (fn, res) => function __init() {
9
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
- };
11
- var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
14
- };
15
- var __copyProps = (to, from, except, desc) => {
16
- if (from && typeof from === "object" || typeof from === "function") {
17
- for (let key of __getOwnPropNames(from))
18
- if (!__hasOwnProp.call(to, key) && key !== except)
19
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
- }
21
- return to;
22
- };
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
-
33
- // node_modules/@remix-run/router/dist/router.js
34
- function _extends() {
35
- _extends = Object.assign ? Object.assign.bind() : function(target) {
36
- for (var i = 1; i < arguments.length; i++) {
37
- var source = arguments[i];
38
- for (var key in source) {
39
- if (Object.prototype.hasOwnProperty.call(source, key)) {
40
- target[key] = source[key];
41
- }
42
- }
43
- }
44
- return target;
45
- };
46
- return _extends.apply(this, arguments);
47
- }
48
- function invariant(value, message) {
49
- if (value === false || value === null || typeof value === "undefined") {
50
- throw new Error(message);
51
- }
52
- }
53
- function warning(cond, message) {
54
- if (!cond) {
55
- if (typeof console !== "undefined") console.warn(message);
56
- try {
57
- throw new Error(message);
58
- } catch (e) {
59
- }
60
- }
61
- }
62
- function createPath(_ref) {
63
- let {
64
- pathname = "/",
65
- search = "",
66
- hash = ""
67
- } = _ref;
68
- if (search && search !== "?") pathname += search.charAt(0) === "?" ? search : "?" + search;
69
- if (hash && hash !== "#") pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
70
- return pathname;
71
- }
72
- function parsePath(path) {
73
- let parsedPath = {};
74
- if (path) {
75
- let hashIndex = path.indexOf("#");
76
- if (hashIndex >= 0) {
77
- parsedPath.hash = path.substr(hashIndex);
78
- path = path.substr(0, hashIndex);
79
- }
80
- let searchIndex = path.indexOf("?");
81
- if (searchIndex >= 0) {
82
- parsedPath.search = path.substr(searchIndex);
83
- path = path.substr(0, searchIndex);
84
- }
85
- if (path) {
86
- parsedPath.pathname = path;
87
- }
88
- }
89
- return parsedPath;
90
- }
91
- function matchRoutes(routes, locationArg, basename) {
92
- if (basename === void 0) {
93
- basename = "/";
94
- }
95
- return matchRoutesImpl(routes, locationArg, basename, false);
96
- }
97
- function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
98
- let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
99
- let pathname = stripBasename(location.pathname || "/", basename);
100
- if (pathname == null) {
101
- return null;
102
- }
103
- let branches = flattenRoutes(routes);
104
- rankRouteBranches(branches);
105
- let matches = null;
106
- for (let i = 0; matches == null && i < branches.length; ++i) {
107
- let decoded = decodePath(pathname);
108
- matches = matchRouteBranch(branches[i], decoded, allowPartial);
109
- }
110
- return matches;
111
- }
112
- function convertRouteMatchToUiMatch(match, loaderData) {
113
- let {
114
- route,
115
- pathname,
116
- params
117
- } = match;
118
- return {
119
- id: route.id,
120
- pathname,
121
- params,
122
- data: loaderData[route.id],
123
- handle: route.handle
124
- };
125
- }
126
- function flattenRoutes(routes, branches, parentsMeta, parentPath) {
127
- if (branches === void 0) {
128
- branches = [];
129
- }
130
- if (parentsMeta === void 0) {
131
- parentsMeta = [];
132
- }
133
- if (parentPath === void 0) {
134
- parentPath = "";
135
- }
136
- let flattenRoute = (route, index, relativePath) => {
137
- let meta = {
138
- relativePath: relativePath === void 0 ? route.path || "" : relativePath,
139
- caseSensitive: route.caseSensitive === true,
140
- childrenIndex: index,
141
- route
142
- };
143
- if (meta.relativePath.startsWith("/")) {
144
- invariant(meta.relativePath.startsWith(parentPath), 'Absolute route path "' + meta.relativePath + '" nested under path ' + ('"' + parentPath + '" is not valid. An absolute child route path ') + "must start with the combined path of all its parent routes.");
145
- meta.relativePath = meta.relativePath.slice(parentPath.length);
146
- }
147
- let path = joinPaths([parentPath, meta.relativePath]);
148
- let routesMeta = parentsMeta.concat(meta);
149
- if (route.children && route.children.length > 0) {
150
- invariant(
151
- // Our types know better, but runtime JS may not!
152
- // @ts-expect-error
153
- route.index !== true,
154
- "Index routes must not have child routes. Please remove " + ('all child routes from route path "' + path + '".')
155
- );
156
- flattenRoutes(route.children, branches, routesMeta, path);
157
- }
158
- if (route.path == null && !route.index) {
159
- return;
160
- }
161
- branches.push({
162
- path,
163
- score: computeScore(path, route.index),
164
- routesMeta
165
- });
166
- };
167
- routes.forEach((route, index) => {
168
- var _route$path;
169
- if (route.path === "" || !((_route$path = route.path) != null && _route$path.includes("?"))) {
170
- flattenRoute(route, index);
171
- } else {
172
- for (let exploded of explodeOptionalSegments(route.path)) {
173
- flattenRoute(route, index, exploded);
174
- }
175
- }
176
- });
177
- return branches;
178
- }
179
- function explodeOptionalSegments(path) {
180
- let segments = path.split("/");
181
- if (segments.length === 0) return [];
182
- let [first, ...rest] = segments;
183
- let isOptional = first.endsWith("?");
184
- let required = first.replace(/\?$/, "");
185
- if (rest.length === 0) {
186
- return isOptional ? [required, ""] : [required];
187
- }
188
- let restExploded = explodeOptionalSegments(rest.join("/"));
189
- let result = [];
190
- result.push(...restExploded.map((subpath) => subpath === "" ? required : [required, subpath].join("/")));
191
- if (isOptional) {
192
- result.push(...restExploded);
193
- }
194
- return result.map((exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded);
195
- }
196
- function rankRouteBranches(branches) {
197
- branches.sort((a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(a.routesMeta.map((meta) => meta.childrenIndex), b.routesMeta.map((meta) => meta.childrenIndex)));
198
- }
199
- function computeScore(path, index) {
200
- let segments = path.split("/");
201
- let initialScore = segments.length;
202
- if (segments.some(isSplat)) {
203
- initialScore += splatPenalty;
204
- }
205
- if (index) {
206
- initialScore += indexRouteValue;
207
- }
208
- return segments.filter((s) => !isSplat(s)).reduce((score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue), initialScore);
209
- }
210
- function compareIndexes(a, b) {
211
- let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
212
- return siblings ? (
213
- // If two routes are siblings, we should try to match the earlier sibling
214
- // first. This allows people to have fine-grained control over the matching
215
- // behavior by simply putting routes with identical paths in the order they
216
- // want them tried.
217
- a[a.length - 1] - b[b.length - 1]
218
- ) : (
219
- // Otherwise, it doesn't really make sense to rank non-siblings by index,
220
- // so they sort equally.
221
- 0
222
- );
223
- }
224
- function matchRouteBranch(branch, pathname, allowPartial) {
225
- if (allowPartial === void 0) {
226
- allowPartial = false;
227
- }
228
- let {
229
- routesMeta
230
- } = branch;
231
- let matchedParams = {};
232
- let matchedPathname = "/";
233
- let matches = [];
234
- for (let i = 0; i < routesMeta.length; ++i) {
235
- let meta = routesMeta[i];
236
- let end = i === routesMeta.length - 1;
237
- let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
238
- let match = matchPath({
239
- path: meta.relativePath,
240
- caseSensitive: meta.caseSensitive,
241
- end
242
- }, remainingPathname);
243
- let route = meta.route;
244
- if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
245
- match = matchPath({
246
- path: meta.relativePath,
247
- caseSensitive: meta.caseSensitive,
248
- end: false
249
- }, remainingPathname);
250
- }
251
- if (!match) {
252
- return null;
253
- }
254
- Object.assign(matchedParams, match.params);
255
- matches.push({
256
- // TODO: Can this as be avoided?
257
- params: matchedParams,
258
- pathname: joinPaths([matchedPathname, match.pathname]),
259
- pathnameBase: normalizePathname(joinPaths([matchedPathname, match.pathnameBase])),
260
- route
261
- });
262
- if (match.pathnameBase !== "/") {
263
- matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
264
- }
265
- }
266
- return matches;
267
- }
268
- function matchPath(pattern, pathname) {
269
- if (typeof pattern === "string") {
270
- pattern = {
271
- path: pattern,
272
- caseSensitive: false,
273
- end: true
274
- };
275
- }
276
- let [matcher, compiledParams] = compilePath(pattern.path, pattern.caseSensitive, pattern.end);
277
- let match = pathname.match(matcher);
278
- if (!match) return null;
279
- let matchedPathname = match[0];
280
- let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
281
- let captureGroups = match.slice(1);
282
- let params = compiledParams.reduce((memo2, _ref, index) => {
283
- let {
284
- paramName,
285
- isOptional
286
- } = _ref;
287
- if (paramName === "*") {
288
- let splatValue = captureGroups[index] || "";
289
- pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
290
- }
291
- const value = captureGroups[index];
292
- if (isOptional && !value) {
293
- memo2[paramName] = void 0;
294
- } else {
295
- memo2[paramName] = (value || "").replace(/%2F/g, "/");
296
- }
297
- return memo2;
298
- }, {});
299
- return {
300
- params,
301
- pathname: matchedPathname,
302
- pathnameBase,
303
- pattern
304
- };
305
- }
306
- function compilePath(path, caseSensitive, end) {
307
- if (caseSensitive === void 0) {
308
- caseSensitive = false;
309
- }
310
- if (end === void 0) {
311
- end = true;
312
- }
313
- warning(path === "*" || !path.endsWith("*") || path.endsWith("/*"), 'Route path "' + path + '" will be treated as if it were ' + ('"' + path.replace(/\*$/, "/*") + '" because the `*` character must ') + "always follow a `/` in the pattern. To get rid of this warning, " + ('please change the route path to "' + path.replace(/\*$/, "/*") + '".'));
314
- let params = [];
315
- let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(/\/:([\w-]+)(\?)?/g, (_, paramName, isOptional) => {
316
- params.push({
317
- paramName,
318
- isOptional: isOptional != null
319
- });
320
- return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
321
- });
322
- if (path.endsWith("*")) {
323
- params.push({
324
- paramName: "*"
325
- });
326
- regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
327
- } else if (end) {
328
- regexpSource += "\\/*$";
329
- } else if (path !== "" && path !== "/") {
330
- regexpSource += "(?:(?=\\/|$))";
331
- } else ;
332
- let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
333
- return [matcher, params];
334
- }
335
- function decodePath(value) {
336
- try {
337
- return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
338
- } catch (error) {
339
- warning(false, 'The URL path "' + value + '" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent ' + ("encoding (" + error + ")."));
340
- return value;
341
- }
342
- }
343
- function stripBasename(pathname, basename) {
344
- if (basename === "/") return pathname;
345
- if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
346
- return null;
347
- }
348
- let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
349
- let nextChar = pathname.charAt(startIndex);
350
- if (nextChar && nextChar !== "/") {
351
- return null;
352
- }
353
- return pathname.slice(startIndex) || "/";
354
- }
355
- function resolvePath(to, fromPathname) {
356
- if (fromPathname === void 0) {
357
- fromPathname = "/";
358
- }
359
- let {
360
- pathname: toPathname,
361
- search = "",
362
- hash = ""
363
- } = typeof to === "string" ? parsePath(to) : to;
364
- let pathname;
365
- if (toPathname) {
366
- if (isAbsoluteUrl(toPathname)) {
367
- pathname = toPathname;
368
- } else {
369
- if (toPathname.includes("//")) {
370
- let oldPathname = toPathname;
371
- toPathname = toPathname.replace(/\/\/+/g, "/");
372
- warning(false, "Pathnames cannot have embedded double slashes - normalizing " + (oldPathname + " -> " + toPathname));
373
- }
374
- if (toPathname.startsWith("/")) {
375
- pathname = resolvePathname(toPathname.substring(1), "/");
376
- } else {
377
- pathname = resolvePathname(toPathname, fromPathname);
378
- }
379
- }
380
- } else {
381
- pathname = fromPathname;
382
- }
383
- return {
384
- pathname,
385
- search: normalizeSearch(search),
386
- hash: normalizeHash(hash)
387
- };
388
- }
389
- function resolvePathname(relativePath, fromPathname) {
390
- let segments = fromPathname.replace(/\/+$/, "").split("/");
391
- let relativeSegments = relativePath.split("/");
392
- relativeSegments.forEach((segment) => {
393
- if (segment === "..") {
394
- if (segments.length > 1) segments.pop();
395
- } else if (segment !== ".") {
396
- segments.push(segment);
397
- }
398
- });
399
- return segments.length > 1 ? segments.join("/") : "/";
400
- }
401
- function getInvalidPathError(char, field, dest, path) {
402
- return "Cannot include a '" + char + "' character in a manually specified " + ("`to." + field + "` field [" + JSON.stringify(path) + "]. Please separate it out to the ") + ("`to." + dest + "` field. Alternatively you may provide the full path as ") + 'a string in <Link to="..."> and the router will parse it for you.';
403
- }
404
- function getPathContributingMatches(matches) {
405
- return matches.filter((match, index) => index === 0 || match.route.path && match.route.path.length > 0);
406
- }
407
- function getResolveToMatches(matches, v7_relativeSplatPath) {
408
- let pathMatches = getPathContributingMatches(matches);
409
- if (v7_relativeSplatPath) {
410
- return pathMatches.map((match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase);
411
- }
412
- return pathMatches.map((match) => match.pathnameBase);
413
- }
414
- function resolveTo(toArg, routePathnames, locationPathname, isPathRelative) {
415
- if (isPathRelative === void 0) {
416
- isPathRelative = false;
417
- }
418
- let to;
419
- if (typeof toArg === "string") {
420
- to = parsePath(toArg);
421
- } else {
422
- to = _extends({}, toArg);
423
- invariant(!to.pathname || !to.pathname.includes("?"), getInvalidPathError("?", "pathname", "search", to));
424
- invariant(!to.pathname || !to.pathname.includes("#"), getInvalidPathError("#", "pathname", "hash", to));
425
- invariant(!to.search || !to.search.includes("#"), getInvalidPathError("#", "search", "hash", to));
426
- }
427
- let isEmptyPath = toArg === "" || to.pathname === "";
428
- let toPathname = isEmptyPath ? "/" : to.pathname;
429
- let from;
430
- if (toPathname == null) {
431
- from = locationPathname;
432
- } else {
433
- let routePathnameIndex = routePathnames.length - 1;
434
- if (!isPathRelative && toPathname.startsWith("..")) {
435
- let toSegments = toPathname.split("/");
436
- while (toSegments[0] === "..") {
437
- toSegments.shift();
438
- routePathnameIndex -= 1;
439
- }
440
- to.pathname = toSegments.join("/");
441
- }
442
- from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
443
- }
444
- let path = resolvePath(to, from);
445
- let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
446
- let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
447
- if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
448
- path.pathname += "/";
449
- }
450
- return path;
451
- }
452
- var Action, ResultType, paramRe, dynamicSegmentValue, indexRouteValue, emptySegmentValue, staticSegmentValue, splatPenalty, isSplat, ABSOLUTE_URL_REGEX$1, isAbsoluteUrl, joinPaths, normalizePathname, normalizeSearch, normalizeHash, validMutationMethodsArr, validMutationMethods, validRequestMethodsArr, validRequestMethods, IDLE_FETCHER;
453
- var init_router = __esm({
454
- "node_modules/@remix-run/router/dist/router.js"() {
455
- "use strict";
456
- (function(Action2) {
457
- Action2["Pop"] = "POP";
458
- Action2["Push"] = "PUSH";
459
- Action2["Replace"] = "REPLACE";
460
- })(Action || (Action = {}));
461
- (function(ResultType2) {
462
- ResultType2["data"] = "data";
463
- ResultType2["deferred"] = "deferred";
464
- ResultType2["redirect"] = "redirect";
465
- ResultType2["error"] = "error";
466
- })(ResultType || (ResultType = {}));
467
- paramRe = /^:[\w-]+$/;
468
- dynamicSegmentValue = 3;
469
- indexRouteValue = 2;
470
- emptySegmentValue = 1;
471
- staticSegmentValue = 10;
472
- splatPenalty = -2;
473
- isSplat = (s) => s === "*";
474
- ABSOLUTE_URL_REGEX$1 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
475
- isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX$1.test(url);
476
- joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
477
- normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
478
- normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
479
- normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
480
- validMutationMethodsArr = ["post", "put", "patch", "delete"];
481
- validMutationMethods = new Set(validMutationMethodsArr);
482
- validRequestMethodsArr = ["get", ...validMutationMethodsArr];
483
- validRequestMethods = new Set(validRequestMethodsArr);
484
- IDLE_FETCHER = {
485
- state: "idle",
486
- data: void 0,
487
- formMethod: void 0,
488
- formAction: void 0,
489
- formEncType: void 0,
490
- formData: void 0,
491
- json: void 0,
492
- text: void 0
493
- };
494
- }
495
- });
496
-
497
- // node_modules/react-router/dist/index.js
498
- function _extends2() {
499
- _extends2 = Object.assign ? Object.assign.bind() : function(target) {
500
- for (var i = 1; i < arguments.length; i++) {
501
- var source = arguments[i];
502
- for (var key in source) {
503
- if (Object.prototype.hasOwnProperty.call(source, key)) {
504
- target[key] = source[key];
505
- }
506
- }
507
- }
508
- return target;
509
- };
510
- return _extends2.apply(this, arguments);
511
- }
512
- function useHref(to, _temp) {
513
- let {
514
- relative
515
- } = _temp === void 0 ? {} : _temp;
516
- !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(
517
- false,
518
- // TODO: This error is probably because they somehow have 2 versions of the
519
- // router loaded. We can help them understand how to avoid that.
520
- "useHref() may be used only in the context of a <Router> component."
521
- ) : invariant(false) : void 0;
522
- let {
523
- basename,
524
- navigator
525
- } = React.useContext(NavigationContext);
526
- let {
527
- hash,
528
- pathname,
529
- search
530
- } = useResolvedPath(to, {
531
- relative
532
- });
533
- let joinedPathname = pathname;
534
- if (basename !== "/") {
535
- joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
536
- }
537
- return navigator.createHref({
538
- pathname: joinedPathname,
539
- search,
540
- hash
541
- });
542
- }
543
- function useInRouterContext() {
544
- return React.useContext(LocationContext) != null;
545
- }
546
- function useLocation() {
547
- !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(
548
- false,
549
- // TODO: This error is probably because they somehow have 2 versions of the
550
- // router loaded. We can help them understand how to avoid that.
551
- "useLocation() may be used only in the context of a <Router> component."
552
- ) : invariant(false) : void 0;
553
- return React.useContext(LocationContext).location;
554
- }
555
- function useIsomorphicLayoutEffect(cb) {
556
- let isStatic = React.useContext(NavigationContext).static;
557
- if (!isStatic) {
558
- React.useLayoutEffect(cb);
559
- }
560
- }
561
- function useNavigate() {
562
- let {
563
- isDataRoute
564
- } = React.useContext(RouteContext);
565
- return isDataRoute ? useNavigateStable() : useNavigateUnstable();
566
- }
567
- function useNavigateUnstable() {
568
- !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(
569
- false,
570
- // TODO: This error is probably because they somehow have 2 versions of the
571
- // router loaded. We can help them understand how to avoid that.
572
- "useNavigate() may be used only in the context of a <Router> component."
573
- ) : invariant(false) : void 0;
574
- let dataRouterContext = React.useContext(DataRouterContext);
575
- let {
576
- basename,
577
- future,
578
- navigator
579
- } = React.useContext(NavigationContext);
580
- let {
581
- matches
582
- } = React.useContext(RouteContext);
583
- let {
584
- pathname: locationPathname
585
- } = useLocation();
586
- let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
587
- let activeRef = React.useRef(false);
588
- useIsomorphicLayoutEffect(() => {
589
- activeRef.current = true;
590
- });
591
- let navigate = React.useCallback(function(to, options) {
592
- if (options === void 0) {
593
- options = {};
594
- }
595
- process.env.NODE_ENV !== "production" ? warning(activeRef.current, navigateEffectWarning) : void 0;
596
- if (!activeRef.current) return;
597
- if (typeof to === "number") {
598
- navigator.go(to);
599
- return;
600
- }
601
- let path = resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, options.relative === "path");
602
- if (dataRouterContext == null && basename !== "/") {
603
- path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
604
- }
605
- (!!options.replace ? navigator.replace : navigator.push)(path, options.state, options);
606
- }, [basename, navigator, routePathnamesJson, locationPathname, dataRouterContext]);
607
- return navigate;
608
- }
609
- function useResolvedPath(to, _temp2) {
610
- let {
611
- relative
612
- } = _temp2 === void 0 ? {} : _temp2;
613
- let {
614
- future
615
- } = React.useContext(NavigationContext);
616
- let {
617
- matches
618
- } = React.useContext(RouteContext);
619
- let {
620
- pathname: locationPathname
621
- } = useLocation();
622
- let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
623
- return React.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
624
- }
625
- function getDataRouterConsoleError(hookName) {
626
- return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
627
- }
628
- function useDataRouterContext(hookName) {
629
- let ctx = React.useContext(DataRouterContext);
630
- !ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
631
- return ctx;
632
- }
633
- function useDataRouterState(hookName) {
634
- let state = React.useContext(DataRouterStateContext);
635
- !state ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
636
- return state;
637
- }
638
- function useRouteContext(hookName) {
639
- let route = React.useContext(RouteContext);
640
- !route ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
641
- return route;
642
- }
643
- function useCurrentRouteId(hookName) {
644
- let route = useRouteContext(hookName);
645
- let thisRoute = route.matches[route.matches.length - 1];
646
- !thisRoute.route.id ? process.env.NODE_ENV !== "production" ? invariant(false, hookName + ' can only be used on routes that contain a unique "id"') : invariant(false) : void 0;
647
- return thisRoute.route.id;
648
- }
649
- function useRouteId() {
650
- return useCurrentRouteId(DataRouterStateHook.UseRouteId);
651
- }
652
- function useNavigation() {
653
- let state = useDataRouterState(DataRouterStateHook.UseNavigation);
654
- return state.navigation;
655
- }
656
- function useMatches() {
657
- let {
658
- matches,
659
- loaderData
660
- } = useDataRouterState(DataRouterStateHook.UseMatches);
661
- return React.useMemo(() => matches.map((m) => convertRouteMatchToUiMatch(m, loaderData)), [matches, loaderData]);
662
- }
663
- function useLoaderData() {
664
- let state = useDataRouterState(DataRouterStateHook.UseLoaderData);
665
- let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);
666
- if (state.errors && state.errors[routeId] != null) {
667
- console.error("You cannot `useLoaderData` in an errorElement (routeId: " + routeId + ")");
668
- return void 0;
669
- }
670
- return state.loaderData[routeId];
671
- }
672
- function useActionData() {
673
- let state = useDataRouterState(DataRouterStateHook.UseActionData);
674
- let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);
675
- return state.actionData ? state.actionData[routeId] : void 0;
676
- }
677
- function useNavigateStable() {
678
- let {
679
- router
680
- } = useDataRouterContext(DataRouterHook.UseNavigateStable);
681
- let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);
682
- let activeRef = React.useRef(false);
683
- useIsomorphicLayoutEffect(() => {
684
- activeRef.current = true;
685
- });
686
- let navigate = React.useCallback(function(to, options) {
687
- if (options === void 0) {
688
- options = {};
689
- }
690
- process.env.NODE_ENV !== "production" ? warning(activeRef.current, navigateEffectWarning) : void 0;
691
- if (!activeRef.current) return;
692
- if (typeof to === "number") {
693
- router.navigate(to);
694
- } else {
695
- router.navigate(to, _extends2({
696
- fromRouteId: id
697
- }, options));
698
- }
699
- }, [router, id]);
700
- return navigate;
701
- }
702
- function warnOnce(key, message) {
703
- if (process.env.NODE_ENV !== "production" && !alreadyWarned[message]) {
704
- alreadyWarned[message] = true;
705
- console.warn(message);
706
- }
707
- }
708
- function logV6DeprecationWarnings(renderFuture, routerFuture) {
709
- if ((renderFuture == null ? void 0 : renderFuture.v7_startTransition) === void 0) {
710
- logDeprecation("v7_startTransition", "React Router will begin wrapping state updates in `React.startTransition` in v7", "https://reactrouter.com/v6/upgrading/future#v7_starttransition");
711
- }
712
- if ((renderFuture == null ? void 0 : renderFuture.v7_relativeSplatPath) === void 0 && (!routerFuture || routerFuture.v7_relativeSplatPath === void 0)) {
713
- logDeprecation("v7_relativeSplatPath", "Relative route resolution within Splat routes is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath");
714
- }
715
- if (routerFuture) {
716
- if (routerFuture.v7_fetcherPersist === void 0) {
717
- logDeprecation("v7_fetcherPersist", "The persistence behavior of fetchers is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist");
718
- }
719
- if (routerFuture.v7_normalizeFormMethod === void 0) {
720
- logDeprecation("v7_normalizeFormMethod", "Casing of `formMethod` fields is being normalized to uppercase in v7", "https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod");
721
- }
722
- if (routerFuture.v7_partialHydration === void 0) {
723
- logDeprecation("v7_partialHydration", "`RouterProvider` hydration behavior is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_partialhydration");
724
- }
725
- if (routerFuture.v7_skipActionErrorRevalidation === void 0) {
726
- logDeprecation("v7_skipActionErrorRevalidation", "The revalidation behavior after 4xx/5xx `action` responses is changing in v7", "https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation");
727
- }
728
- }
729
- }
730
- function Router(_ref5) {
731
- let {
732
- basename: basenameProp = "/",
733
- children = null,
734
- location: locationProp,
735
- navigationType = Action.Pop,
736
- navigator,
737
- static: staticProp = false,
738
- future
739
- } = _ref5;
740
- !!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, "You cannot render a <Router> inside another <Router>. You should never have more than one in your app.") : invariant(false) : void 0;
741
- let basename = basenameProp.replace(/^\/*/, "/");
742
- let navigationContext = React.useMemo(() => ({
743
- basename,
744
- navigator,
745
- static: staticProp,
746
- future: _extends2({
747
- v7_relativeSplatPath: false
748
- }, future)
749
- }), [basename, future, navigator, staticProp]);
750
- if (typeof locationProp === "string") {
751
- locationProp = parsePath(locationProp);
752
- }
753
- let {
754
- pathname = "/",
755
- search = "",
756
- hash = "",
757
- state = null,
758
- key = "default"
759
- } = locationProp;
760
- let locationContext = React.useMemo(() => {
761
- let trailingPathname = stripBasename(pathname, basename);
762
- if (trailingPathname == null) {
763
- return null;
764
- }
765
- return {
766
- location: {
767
- pathname: trailingPathname,
768
- search,
769
- hash,
770
- state,
771
- key
772
- },
773
- navigationType
774
- };
775
- }, [basename, pathname, search, hash, state, key, navigationType]);
776
- process.env.NODE_ENV !== "production" ? warning(locationContext != null, '<Router basename="' + basename + '"> is not able to match the URL ' + ('"' + pathname + search + hash + '" because it does not start with the ') + "basename, so the <Router> won't render anything.") : void 0;
777
- if (locationContext == null) {
778
- return null;
779
- }
780
- return /* @__PURE__ */ React.createElement(NavigationContext.Provider, {
781
- value: navigationContext
782
- }, /* @__PURE__ */ React.createElement(LocationContext.Provider, {
783
- children,
784
- value: locationContext
785
- }));
786
- }
787
- var React, DataRouterContext, DataRouterStateContext, AwaitContext, NavigationContext, LocationContext, RouteContext, RouteErrorContext, navigateEffectWarning, DataRouterHook, DataRouterStateHook, alreadyWarned, logDeprecation, START_TRANSITION, startTransitionImpl, neverSettledPromise;
788
- var init_dist = __esm({
789
- "node_modules/react-router/dist/index.js"() {
790
- "use strict";
791
- React = __toESM(require("react"));
792
- init_router();
793
- init_router();
794
- DataRouterContext = /* @__PURE__ */ React.createContext(null);
795
- if (process.env.NODE_ENV !== "production") {
796
- DataRouterContext.displayName = "DataRouter";
797
- }
798
- DataRouterStateContext = /* @__PURE__ */ React.createContext(null);
799
- if (process.env.NODE_ENV !== "production") {
800
- DataRouterStateContext.displayName = "DataRouterState";
801
- }
802
- AwaitContext = /* @__PURE__ */ React.createContext(null);
803
- if (process.env.NODE_ENV !== "production") {
804
- AwaitContext.displayName = "Await";
805
- }
806
- NavigationContext = /* @__PURE__ */ React.createContext(null);
807
- if (process.env.NODE_ENV !== "production") {
808
- NavigationContext.displayName = "Navigation";
809
- }
810
- LocationContext = /* @__PURE__ */ React.createContext(null);
811
- if (process.env.NODE_ENV !== "production") {
812
- LocationContext.displayName = "Location";
813
- }
814
- RouteContext = /* @__PURE__ */ React.createContext({
815
- outlet: null,
816
- matches: [],
817
- isDataRoute: false
818
- });
819
- if (process.env.NODE_ENV !== "production") {
820
- RouteContext.displayName = "Route";
821
- }
822
- RouteErrorContext = /* @__PURE__ */ React.createContext(null);
823
- if (process.env.NODE_ENV !== "production") {
824
- RouteErrorContext.displayName = "RouteError";
825
- }
826
- navigateEffectWarning = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
827
- DataRouterHook = /* @__PURE__ */ (function(DataRouterHook3) {
828
- DataRouterHook3["UseBlocker"] = "useBlocker";
829
- DataRouterHook3["UseRevalidator"] = "useRevalidator";
830
- DataRouterHook3["UseNavigateStable"] = "useNavigate";
831
- return DataRouterHook3;
832
- })(DataRouterHook || {});
833
- DataRouterStateHook = /* @__PURE__ */ (function(DataRouterStateHook3) {
834
- DataRouterStateHook3["UseBlocker"] = "useBlocker";
835
- DataRouterStateHook3["UseLoaderData"] = "useLoaderData";
836
- DataRouterStateHook3["UseActionData"] = "useActionData";
837
- DataRouterStateHook3["UseRouteError"] = "useRouteError";
838
- DataRouterStateHook3["UseNavigation"] = "useNavigation";
839
- DataRouterStateHook3["UseRouteLoaderData"] = "useRouteLoaderData";
840
- DataRouterStateHook3["UseMatches"] = "useMatches";
841
- DataRouterStateHook3["UseRevalidator"] = "useRevalidator";
842
- DataRouterStateHook3["UseNavigateStable"] = "useNavigate";
843
- DataRouterStateHook3["UseRouteId"] = "useRouteId";
844
- return DataRouterStateHook3;
845
- })(DataRouterStateHook || {});
846
- alreadyWarned = {};
847
- logDeprecation = (flag, msg, link) => warnOnce(flag, "\u26A0\uFE0F React Router Future Flag Warning: " + msg + ". " + ("You can use the `" + flag + "` future flag to opt-in early. ") + ("For more information, see " + link + "."));
848
- START_TRANSITION = "startTransition";
849
- startTransitionImpl = React[START_TRANSITION];
850
- neverSettledPromise = new Promise(() => {
851
- });
852
- }
853
- });
854
-
855
- // node_modules/react-router-dom/dist/index.js
856
- function _extends3() {
857
- _extends3 = Object.assign ? Object.assign.bind() : function(target) {
858
- for (var i = 1; i < arguments.length; i++) {
859
- var source = arguments[i];
860
- for (var key in source) {
861
- if (Object.prototype.hasOwnProperty.call(source, key)) {
862
- target[key] = source[key];
863
- }
864
- }
865
- }
866
- return target;
867
- };
868
- return _extends3.apply(this, arguments);
869
- }
870
- function _objectWithoutPropertiesLoose(source, excluded) {
871
- if (source == null) return {};
872
- var target = {};
873
- var sourceKeys = Object.keys(source);
874
- var key, i;
875
- for (i = 0; i < sourceKeys.length; i++) {
876
- key = sourceKeys[i];
877
- if (excluded.indexOf(key) >= 0) continue;
878
- target[key] = source[key];
879
- }
880
- return target;
881
- }
882
- function isHtmlElement(object) {
883
- return object != null && typeof object.tagName === "string";
884
- }
885
- function isButtonElement(object) {
886
- return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
887
- }
888
- function isFormElement(object) {
889
- return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
890
- }
891
- function isInputElement(object) {
892
- return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
893
- }
894
- function isModifiedEvent(event) {
895
- return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
896
- }
897
- function shouldProcessLinkClick(event, target) {
898
- return event.button === 0 && // Ignore everything but left clicks
899
- (!target || target === "_self") && // Let browser handle "target=_blank" etc.
900
- !isModifiedEvent(event);
901
- }
902
- function isFormDataSubmitterSupported() {
903
- if (_formDataSupportsSubmitter === null) {
904
- try {
905
- new FormData(
906
- document.createElement("form"),
907
- // @ts-expect-error if FormData supports the submitter parameter, this will throw
908
- 0
909
- );
910
- _formDataSupportsSubmitter = false;
911
- } catch (e) {
912
- _formDataSupportsSubmitter = true;
913
- }
914
- }
915
- return _formDataSupportsSubmitter;
916
- }
917
- function getFormEncType(encType) {
918
- if (encType != null && !supportedFormEncTypes.has(encType)) {
919
- process.env.NODE_ENV !== "production" ? warning(false, '"' + encType + '" is not a valid `encType` for `<Form>`/`<fetcher.Form>` ' + ('and will default to "' + defaultEncType + '"')) : void 0;
920
- return null;
921
- }
922
- return encType;
923
- }
924
- function getFormSubmissionInfo(target, basename) {
925
- let method;
926
- let action;
927
- let encType;
928
- let formData;
929
- let body;
930
- if (isFormElement(target)) {
931
- let attr = target.getAttribute("action");
932
- action = attr ? stripBasename(attr, basename) : null;
933
- method = target.getAttribute("method") || defaultMethod;
934
- encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
935
- formData = new FormData(target);
936
- } else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
937
- let form = target.form;
938
- if (form == null) {
939
- throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');
940
- }
941
- let attr = target.getAttribute("formaction") || form.getAttribute("action");
942
- action = attr ? stripBasename(attr, basename) : null;
943
- method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
944
- encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
945
- formData = new FormData(form, target);
946
- if (!isFormDataSubmitterSupported()) {
947
- let {
948
- name,
949
- type,
950
- value
951
- } = target;
952
- if (type === "image") {
953
- let prefix = name ? name + "." : "";
954
- formData.append(prefix + "x", "0");
955
- formData.append(prefix + "y", "0");
956
- } else if (name) {
957
- formData.append(name, value);
958
- }
959
- }
960
- } else if (isHtmlElement(target)) {
961
- throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');
962
- } else {
963
- method = defaultMethod;
964
- action = null;
965
- encType = defaultEncType;
966
- body = target;
967
- }
968
- if (formData && encType === "text/plain") {
969
- body = formData;
970
- formData = void 0;
971
- }
972
- return {
973
- action,
974
- method: method.toLowerCase(),
975
- encType,
976
- formData,
977
- body
978
- };
979
- }
980
- function HistoryRouter(_ref6) {
981
- let {
982
- basename,
983
- children,
984
- future,
985
- history
986
- } = _ref6;
987
- let [state, setStateImpl] = React2.useState({
988
- action: history.action,
989
- location: history.location
990
- });
991
- let {
992
- v7_startTransition
993
- } = future || {};
994
- let setState = React2.useCallback((newState) => {
995
- v7_startTransition && startTransitionImpl2 ? startTransitionImpl2(() => setStateImpl(newState)) : setStateImpl(newState);
996
- }, [setStateImpl, v7_startTransition]);
997
- React2.useLayoutEffect(() => history.listen(setState), [history, setState]);
998
- React2.useEffect(() => logV6DeprecationWarnings(future), [future]);
999
- return /* @__PURE__ */ React2.createElement(Router, {
1000
- basename,
1001
- children,
1002
- location: state.location,
1003
- navigationType: state.action,
1004
- navigator: history,
1005
- future
1006
- });
1007
- }
1008
- function ScrollRestoration(_ref10) {
1009
- let {
1010
- getKey,
1011
- storageKey
1012
- } = _ref10;
1013
- useScrollRestoration({
1014
- getKey,
1015
- storageKey
1016
- });
1017
- return null;
1018
- }
1019
- function getDataRouterConsoleError2(hookName) {
1020
- return hookName + " must be used within a data router. See https://reactrouter.com/v6/routers/picking-a-router.";
1021
- }
1022
- function useDataRouterContext2(hookName) {
1023
- let ctx = React2.useContext(DataRouterContext);
1024
- !ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError2(hookName)) : invariant(false) : void 0;
1025
- return ctx;
1026
- }
1027
- function useDataRouterState2(hookName) {
1028
- let state = React2.useContext(DataRouterStateContext);
1029
- !state ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError2(hookName)) : invariant(false) : void 0;
1030
- return state;
1031
- }
1032
- function useLinkClickHandler(to, _temp) {
1033
- let {
1034
- target,
1035
- replace: replaceProp,
1036
- state,
1037
- preventScrollReset,
1038
- relative,
1039
- viewTransition
1040
- } = _temp === void 0 ? {} : _temp;
1041
- let navigate = useNavigate();
1042
- let location = useLocation();
1043
- let path = useResolvedPath(to, {
1044
- relative
1045
- });
1046
- return React2.useCallback((event) => {
1047
- if (shouldProcessLinkClick(event, target)) {
1048
- event.preventDefault();
1049
- let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
1050
- navigate(to, {
1051
- replace: replace2,
1052
- state,
1053
- preventScrollReset,
1054
- relative,
1055
- viewTransition
1056
- });
1057
- }
1058
- }, [location, navigate, path, replaceProp, state, target, to, preventScrollReset, relative, viewTransition]);
1059
- }
1060
- function validateClientSideSubmission() {
1061
- if (typeof document === "undefined") {
1062
- throw new Error("You are calling submit during the server render. Try calling submit within a `useEffect` or callback instead.");
1063
- }
1064
- }
1065
- function useSubmit() {
1066
- let {
1067
- router
1068
- } = useDataRouterContext2(DataRouterHook2.UseSubmit);
1069
- let {
1070
- basename
1071
- } = React2.useContext(NavigationContext);
1072
- let currentRouteId = useRouteId();
1073
- return React2.useCallback(function(target, options) {
1074
- if (options === void 0) {
1075
- options = {};
1076
- }
1077
- validateClientSideSubmission();
1078
- let {
1079
- action,
1080
- method,
1081
- encType,
1082
- formData,
1083
- body
1084
- } = getFormSubmissionInfo(target, basename);
1085
- if (options.navigate === false) {
1086
- let key = options.fetcherKey || getUniqueFetcherId();
1087
- router.fetch(key, currentRouteId, options.action || action, {
1088
- preventScrollReset: options.preventScrollReset,
1089
- formData,
1090
- body,
1091
- formMethod: options.method || method,
1092
- formEncType: options.encType || encType,
1093
- flushSync: options.flushSync
1094
- });
1095
- } else {
1096
- router.navigate(options.action || action, {
1097
- preventScrollReset: options.preventScrollReset,
1098
- formData,
1099
- body,
1100
- formMethod: options.method || method,
1101
- formEncType: options.encType || encType,
1102
- replace: options.replace,
1103
- state: options.state,
1104
- fromRouteId: currentRouteId,
1105
- flushSync: options.flushSync,
1106
- viewTransition: options.viewTransition
1107
- });
1108
- }
1109
- }, [router, basename, currentRouteId]);
1110
- }
1111
- function useFormAction(action, _temp2) {
1112
- let {
1113
- relative
1114
- } = _temp2 === void 0 ? {} : _temp2;
1115
- let {
1116
- basename
1117
- } = React2.useContext(NavigationContext);
1118
- let routeContext = React2.useContext(RouteContext);
1119
- !routeContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useFormAction must be used inside a RouteContext") : invariant(false) : void 0;
1120
- let [match] = routeContext.matches.slice(-1);
1121
- let path = _extends3({}, useResolvedPath(action ? action : ".", {
1122
- relative
1123
- }));
1124
- let location = useLocation();
1125
- if (action == null) {
1126
- path.search = location.search;
1127
- let params = new URLSearchParams(path.search);
1128
- let indexValues = params.getAll("index");
1129
- let hasNakedIndexParam = indexValues.some((v) => v === "");
1130
- if (hasNakedIndexParam) {
1131
- params.delete("index");
1132
- indexValues.filter((v) => v).forEach((v) => params.append("index", v));
1133
- let qs = params.toString();
1134
- path.search = qs ? "?" + qs : "";
1135
- }
1136
- }
1137
- if ((!action || action === ".") && match.route.index) {
1138
- path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
1139
- }
1140
- if (basename !== "/") {
1141
- path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
1142
- }
1143
- return createPath(path);
1144
- }
1145
- function useFetcher(_temp3) {
1146
- var _route$matches;
1147
- let {
1148
- key
1149
- } = _temp3 === void 0 ? {} : _temp3;
1150
- let {
1151
- router
1152
- } = useDataRouterContext2(DataRouterHook2.UseFetcher);
1153
- let state = useDataRouterState2(DataRouterStateHook2.UseFetcher);
1154
- let fetcherData = React2.useContext(FetchersContext);
1155
- let route = React2.useContext(RouteContext);
1156
- let routeId = (_route$matches = route.matches[route.matches.length - 1]) == null ? void 0 : _route$matches.route.id;
1157
- !fetcherData ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetcher must be used inside a FetchersContext") : invariant(false) : void 0;
1158
- !route ? process.env.NODE_ENV !== "production" ? invariant(false, "useFetcher must be used inside a RouteContext") : invariant(false) : void 0;
1159
- !(routeId != null) ? process.env.NODE_ENV !== "production" ? invariant(false, 'useFetcher can only be used on routes that contain a unique "id"') : invariant(false) : void 0;
1160
- let defaultKey = useIdImpl ? useIdImpl() : "";
1161
- let [fetcherKey, setFetcherKey] = React2.useState(key || defaultKey);
1162
- if (key && key !== fetcherKey) {
1163
- setFetcherKey(key);
1164
- } else if (!fetcherKey) {
1165
- setFetcherKey(getUniqueFetcherId());
1166
- }
1167
- React2.useEffect(() => {
1168
- router.getFetcher(fetcherKey);
1169
- return () => {
1170
- router.deleteFetcher(fetcherKey);
1171
- };
1172
- }, [router, fetcherKey]);
1173
- let load = React2.useCallback((href, opts) => {
1174
- !routeId ? process.env.NODE_ENV !== "production" ? invariant(false, "No routeId available for fetcher.load()") : invariant(false) : void 0;
1175
- router.fetch(fetcherKey, routeId, href, opts);
1176
- }, [fetcherKey, routeId, router]);
1177
- let submitImpl = useSubmit();
1178
- let submit = React2.useCallback((target, opts) => {
1179
- submitImpl(target, _extends3({}, opts, {
1180
- navigate: false,
1181
- fetcherKey
1182
- }));
1183
- }, [fetcherKey, submitImpl]);
1184
- let FetcherForm = React2.useMemo(() => {
1185
- let FetcherForm2 = /* @__PURE__ */ React2.forwardRef((props, ref) => {
1186
- return /* @__PURE__ */ React2.createElement(Form, _extends3({}, props, {
1187
- navigate: false,
1188
- fetcherKey,
1189
- ref
1190
- }));
1191
- });
1192
- if (process.env.NODE_ENV !== "production") {
1193
- FetcherForm2.displayName = "fetcher.Form";
1194
- }
1195
- return FetcherForm2;
1196
- }, [fetcherKey]);
1197
- let fetcher = state.fetchers.get(fetcherKey) || IDLE_FETCHER;
1198
- let data = fetcherData.get(fetcherKey);
1199
- let fetcherWithComponents = React2.useMemo(() => _extends3({
1200
- Form: FetcherForm,
1201
- submit,
1202
- load
1203
- }, fetcher, {
1204
- data
1205
- }), [FetcherForm, submit, load, fetcher, data]);
1206
- return fetcherWithComponents;
1207
- }
1208
- function useScrollRestoration(_temp4) {
1209
- let {
1210
- getKey,
1211
- storageKey
1212
- } = _temp4 === void 0 ? {} : _temp4;
1213
- let {
1214
- router
1215
- } = useDataRouterContext2(DataRouterHook2.UseScrollRestoration);
1216
- let {
1217
- restoreScrollPosition,
1218
- preventScrollReset
1219
- } = useDataRouterState2(DataRouterStateHook2.UseScrollRestoration);
1220
- let {
1221
- basename
1222
- } = React2.useContext(NavigationContext);
1223
- let location = useLocation();
1224
- let matches = useMatches();
1225
- let navigation = useNavigation();
1226
- React2.useEffect(() => {
1227
- window.history.scrollRestoration = "manual";
1228
- return () => {
1229
- window.history.scrollRestoration = "auto";
1230
- };
1231
- }, []);
1232
- usePageHide(React2.useCallback(() => {
1233
- if (navigation.state === "idle") {
1234
- let key = (getKey ? getKey(location, matches) : null) || location.key;
1235
- savedScrollPositions[key] = window.scrollY;
1236
- }
1237
- try {
1238
- sessionStorage.setItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY, JSON.stringify(savedScrollPositions));
1239
- } catch (error) {
1240
- process.env.NODE_ENV !== "production" ? warning(false, "Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (" + error + ").") : void 0;
1241
- }
1242
- window.history.scrollRestoration = "auto";
1243
- }, [storageKey, getKey, navigation.state, location, matches]));
1244
- if (typeof document !== "undefined") {
1245
- React2.useLayoutEffect(() => {
1246
- try {
1247
- let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);
1248
- if (sessionPositions) {
1249
- savedScrollPositions = JSON.parse(sessionPositions);
1250
- }
1251
- } catch (e) {
1252
- }
1253
- }, [storageKey]);
1254
- React2.useLayoutEffect(() => {
1255
- let getKeyWithoutBasename = getKey && basename !== "/" ? (location2, matches2) => getKey(
1256
- // Strip the basename to match useLocation()
1257
- _extends3({}, location2, {
1258
- pathname: stripBasename(location2.pathname, basename) || location2.pathname
1259
- }),
1260
- matches2
1261
- ) : getKey;
1262
- let disableScrollRestoration = router == null ? void 0 : router.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKeyWithoutBasename);
1263
- return () => disableScrollRestoration && disableScrollRestoration();
1264
- }, [router, basename, getKey]);
1265
- React2.useLayoutEffect(() => {
1266
- if (restoreScrollPosition === false) {
1267
- return;
1268
- }
1269
- if (typeof restoreScrollPosition === "number") {
1270
- window.scrollTo(0, restoreScrollPosition);
1271
- return;
1272
- }
1273
- if (location.hash) {
1274
- let el = document.getElementById(decodeURIComponent(location.hash.slice(1)));
1275
- if (el) {
1276
- el.scrollIntoView();
1277
- return;
1278
- }
1279
- }
1280
- if (preventScrollReset === true) {
1281
- return;
1282
- }
1283
- window.scrollTo(0, 0);
1284
- }, [location, restoreScrollPosition, preventScrollReset]);
1285
- }
1286
- }
1287
- function usePageHide(callback, options) {
1288
- let {
1289
- capture
1290
- } = options || {};
1291
- React2.useEffect(() => {
1292
- let opts = capture != null ? {
1293
- capture
1294
- } : void 0;
1295
- window.addEventListener("pagehide", callback, opts);
1296
- return () => {
1297
- window.removeEventListener("pagehide", callback, opts);
1298
- };
1299
- }, [callback, capture]);
1300
- }
1301
- function useViewTransitionState(to, opts) {
1302
- if (opts === void 0) {
1303
- opts = {};
1304
- }
1305
- let vtContext = React2.useContext(ViewTransitionContext);
1306
- !(vtContext != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?") : invariant(false) : void 0;
1307
- let {
1308
- basename
1309
- } = useDataRouterContext2(DataRouterHook2.useViewTransitionState);
1310
- let path = useResolvedPath(to, {
1311
- relative: opts.relative
1312
- });
1313
- if (!vtContext.isTransitioning) {
1314
- return false;
1315
- }
1316
- let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
1317
- let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
1318
- return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
1319
- }
1320
- var React2, ReactDOM, defaultMethod, defaultEncType, _formDataSupportsSubmitter, supportedFormEncTypes, _excluded, _excluded2, _excluded3, REACT_ROUTER_VERSION, ViewTransitionContext, FetchersContext, START_TRANSITION2, startTransitionImpl2, FLUSH_SYNC, flushSyncImpl, USE_ID, useIdImpl, isBrowser, ABSOLUTE_URL_REGEX, Link, NavLink, Form, DataRouterHook2, DataRouterStateHook2, fetcherId, getUniqueFetcherId, SCROLL_RESTORATION_STORAGE_KEY, savedScrollPositions;
1321
- var init_dist2 = __esm({
1322
- "node_modules/react-router-dom/dist/index.js"() {
1323
- "use strict";
1324
- React2 = __toESM(require("react"));
1325
- ReactDOM = __toESM(require("react-dom"));
1326
- init_dist();
1327
- init_dist();
1328
- init_router();
1329
- defaultMethod = "get";
1330
- defaultEncType = "application/x-www-form-urlencoded";
1331
- _formDataSupportsSubmitter = null;
1332
- supportedFormEncTypes = /* @__PURE__ */ new Set(["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"]);
1333
- _excluded = ["onClick", "relative", "reloadDocument", "replace", "state", "target", "to", "preventScrollReset", "viewTransition"];
1334
- _excluded2 = ["aria-current", "caseSensitive", "className", "end", "style", "to", "viewTransition", "children"];
1335
- _excluded3 = ["fetcherKey", "navigate", "reloadDocument", "replace", "state", "method", "action", "onSubmit", "relative", "preventScrollReset", "viewTransition"];
1336
- REACT_ROUTER_VERSION = "6";
1337
- try {
1338
- window.__reactRouterVersion = REACT_ROUTER_VERSION;
1339
- } catch (e) {
1340
- }
1341
- ViewTransitionContext = /* @__PURE__ */ React2.createContext({
1342
- isTransitioning: false
1343
- });
1344
- if (process.env.NODE_ENV !== "production") {
1345
- ViewTransitionContext.displayName = "ViewTransition";
1346
- }
1347
- FetchersContext = /* @__PURE__ */ React2.createContext(/* @__PURE__ */ new Map());
1348
- if (process.env.NODE_ENV !== "production") {
1349
- FetchersContext.displayName = "Fetchers";
1350
- }
1351
- START_TRANSITION2 = "startTransition";
1352
- startTransitionImpl2 = React2[START_TRANSITION2];
1353
- FLUSH_SYNC = "flushSync";
1354
- flushSyncImpl = ReactDOM[FLUSH_SYNC];
1355
- USE_ID = "useId";
1356
- useIdImpl = React2[USE_ID];
1357
- if (process.env.NODE_ENV !== "production") {
1358
- HistoryRouter.displayName = "unstable_HistoryRouter";
1359
- }
1360
- isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
1361
- ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1362
- Link = /* @__PURE__ */ React2.forwardRef(function LinkWithRef(_ref7, ref) {
1363
- let {
1364
- onClick,
1365
- relative,
1366
- reloadDocument,
1367
- replace: replace2,
1368
- state,
1369
- target,
1370
- to,
1371
- preventScrollReset,
1372
- viewTransition
1373
- } = _ref7, rest = _objectWithoutPropertiesLoose(_ref7, _excluded);
1374
- let {
1375
- basename
1376
- } = React2.useContext(NavigationContext);
1377
- let absoluteHref;
1378
- let isExternal = false;
1379
- if (typeof to === "string" && ABSOLUTE_URL_REGEX.test(to)) {
1380
- absoluteHref = to;
1381
- if (isBrowser) {
1382
- try {
1383
- let currentUrl = new URL(window.location.href);
1384
- let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
1385
- let path = stripBasename(targetUrl.pathname, basename);
1386
- if (targetUrl.origin === currentUrl.origin && path != null) {
1387
- to = path + targetUrl.search + targetUrl.hash;
1388
- } else {
1389
- isExternal = true;
1390
- }
1391
- } catch (e) {
1392
- process.env.NODE_ENV !== "production" ? warning(false, '<Link to="' + to + '"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.') : void 0;
1393
- }
1394
- }
1395
- }
1396
- let href = useHref(to, {
1397
- relative
1398
- });
1399
- let internalOnClick = useLinkClickHandler(to, {
1400
- replace: replace2,
1401
- state,
1402
- target,
1403
- preventScrollReset,
1404
- relative,
1405
- viewTransition
1406
- });
1407
- function handleClick(event) {
1408
- if (onClick) onClick(event);
1409
- if (!event.defaultPrevented) {
1410
- internalOnClick(event);
1411
- }
1412
- }
1413
- return (
1414
- // eslint-disable-next-line jsx-a11y/anchor-has-content
1415
- /* @__PURE__ */ React2.createElement("a", _extends3({}, rest, {
1416
- href: absoluteHref || href,
1417
- onClick: isExternal || reloadDocument ? onClick : handleClick,
1418
- ref,
1419
- target
1420
- }))
1421
- );
1422
- });
1423
- if (process.env.NODE_ENV !== "production") {
1424
- Link.displayName = "Link";
1425
- }
1426
- NavLink = /* @__PURE__ */ React2.forwardRef(function NavLinkWithRef(_ref8, ref) {
1427
- let {
1428
- "aria-current": ariaCurrentProp = "page",
1429
- caseSensitive = false,
1430
- className: classNameProp = "",
1431
- end = false,
1432
- style: styleProp,
1433
- to,
1434
- viewTransition,
1435
- children
1436
- } = _ref8, rest = _objectWithoutPropertiesLoose(_ref8, _excluded2);
1437
- let path = useResolvedPath(to, {
1438
- relative: rest.relative
1439
- });
1440
- let location = useLocation();
1441
- let routerState = React2.useContext(DataRouterStateContext);
1442
- let {
1443
- navigator,
1444
- basename
1445
- } = React2.useContext(NavigationContext);
1446
- let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
1447
- // eslint-disable-next-line react-hooks/rules-of-hooks
1448
- useViewTransitionState(path) && viewTransition === true;
1449
- let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
1450
- let locationPathname = location.pathname;
1451
- let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
1452
- if (!caseSensitive) {
1453
- locationPathname = locationPathname.toLowerCase();
1454
- nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
1455
- toPathname = toPathname.toLowerCase();
1456
- }
1457
- if (nextLocationPathname && basename) {
1458
- nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
1459
- }
1460
- const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
1461
- let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
1462
- let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
1463
- let renderProps = {
1464
- isActive,
1465
- isPending,
1466
- isTransitioning
1467
- };
1468
- let ariaCurrent = isActive ? ariaCurrentProp : void 0;
1469
- let className;
1470
- if (typeof classNameProp === "function") {
1471
- className = classNameProp(renderProps);
1472
- } else {
1473
- className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null, isTransitioning ? "transitioning" : null].filter(Boolean).join(" ");
1474
- }
1475
- let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
1476
- return /* @__PURE__ */ React2.createElement(Link, _extends3({}, rest, {
1477
- "aria-current": ariaCurrent,
1478
- className,
1479
- ref,
1480
- style,
1481
- to,
1482
- viewTransition
1483
- }), typeof children === "function" ? children(renderProps) : children);
1484
- });
1485
- if (process.env.NODE_ENV !== "production") {
1486
- NavLink.displayName = "NavLink";
1487
- }
1488
- Form = /* @__PURE__ */ React2.forwardRef((_ref9, forwardedRef) => {
1489
- let {
1490
- fetcherKey,
1491
- navigate,
1492
- reloadDocument,
1493
- replace: replace2,
1494
- state,
1495
- method = defaultMethod,
1496
- action,
1497
- onSubmit,
1498
- relative,
1499
- preventScrollReset,
1500
- viewTransition
1501
- } = _ref9, props = _objectWithoutPropertiesLoose(_ref9, _excluded3);
1502
- let submit = useSubmit();
1503
- let formAction = useFormAction(action, {
1504
- relative
1505
- });
1506
- let formMethod = method.toLowerCase() === "get" ? "get" : "post";
1507
- let submitHandler = (event) => {
1508
- onSubmit && onSubmit(event);
1509
- if (event.defaultPrevented) return;
1510
- event.preventDefault();
1511
- let submitter = event.nativeEvent.submitter;
1512
- let submitMethod = (submitter == null ? void 0 : submitter.getAttribute("formmethod")) || method;
1513
- submit(submitter || event.currentTarget, {
1514
- fetcherKey,
1515
- method: submitMethod,
1516
- navigate,
1517
- replace: replace2,
1518
- state,
1519
- relative,
1520
- preventScrollReset,
1521
- viewTransition
1522
- });
1523
- };
1524
- return /* @__PURE__ */ React2.createElement("form", _extends3({
1525
- ref: forwardedRef,
1526
- method: formMethod,
1527
- action: formAction,
1528
- onSubmit: reloadDocument ? onSubmit : submitHandler
1529
- }, props));
1530
- });
1531
- if (process.env.NODE_ENV !== "production") {
1532
- Form.displayName = "Form";
1533
- }
1534
- if (process.env.NODE_ENV !== "production") {
1535
- ScrollRestoration.displayName = "ScrollRestoration";
1536
- }
1537
- (function(DataRouterHook3) {
1538
- DataRouterHook3["UseScrollRestoration"] = "useScrollRestoration";
1539
- DataRouterHook3["UseSubmit"] = "useSubmit";
1540
- DataRouterHook3["UseSubmitFetcher"] = "useSubmitFetcher";
1541
- DataRouterHook3["UseFetcher"] = "useFetcher";
1542
- DataRouterHook3["useViewTransitionState"] = "useViewTransitionState";
1543
- })(DataRouterHook2 || (DataRouterHook2 = {}));
1544
- (function(DataRouterStateHook3) {
1545
- DataRouterStateHook3["UseFetcher"] = "useFetcher";
1546
- DataRouterStateHook3["UseFetchers"] = "useFetchers";
1547
- DataRouterStateHook3["UseScrollRestoration"] = "useScrollRestoration";
1548
- })(DataRouterStateHook2 || (DataRouterStateHook2 = {}));
1549
- fetcherId = 0;
1550
- getUniqueFetcherId = () => "__" + String(++fetcherId) + "__";
1551
- SCROLL_RESTORATION_STORAGE_KEY = "react-router-scroll-positions";
1552
- savedScrollPositions = {};
1553
- }
1554
- });
1555
-
1556
- // src/bridges/remix/index.ts
1557
- var remix_exports = {};
1558
- __export(remix_exports, {
1559
- useActionData: () => useActionData2,
1560
- useFetcher: () => useFetcher2,
1561
- useLoaderData: () => useLoaderData2,
1562
- useNavigation: () => useNavigation,
1563
- useSubmit: () => useSubmit
1564
- });
1565
- module.exports = __toCommonJS(remix_exports);
1566
-
1567
- // node_modules/@remix-run/react/dist/esm/index.js
1568
- init_dist2();
1569
-
1570
- // node_modules/@remix-run/react/dist/esm/_virtual/_rollupPluginBabelHelpers.js
1571
- function _extends4() {
1572
- _extends4 = Object.assign ? Object.assign.bind() : function(target) {
1573
- for (var i = 1; i < arguments.length; i++) {
1574
- var source = arguments[i];
1575
- for (var key in source) {
1576
- if (Object.prototype.hasOwnProperty.call(source, key)) {
1577
- target[key] = source[key];
1578
- }
1579
- }
1580
- }
1581
- return target;
1582
- };
1583
- return _extends4.apply(this, arguments);
1584
- }
1585
-
1586
- // node_modules/@remix-run/react/dist/esm/components.js
1587
- var React4 = __toESM(require("react"));
1588
- init_dist2();
1589
-
1590
- // node_modules/@remix-run/react/dist/esm/invariant.js
1591
- function invariant2(value, message) {
1592
- if (value === false || value === null || typeof value === "undefined") {
1593
- throw new Error(message);
1594
- }
1595
- }
1596
-
1597
- // node_modules/@remix-run/react/dist/esm/links.js
1598
- init_dist2();
1599
-
1600
- // node_modules/@remix-run/react/dist/esm/routeModules.js
1601
- var import_meta = {};
1602
- async function loadRouteModule(route, routeModulesCache) {
1603
- if (route.id in routeModulesCache) {
1604
- return routeModulesCache[route.id];
1605
- }
1606
- try {
1607
- let routeModule = await import(
1608
- /* webpackIgnore: true */
1609
- route.module
1610
- );
1611
- routeModulesCache[route.id] = routeModule;
1612
- return routeModule;
1613
- } catch (error) {
1614
- console.error(`Error loading route module \`${route.module}\`, reloading page...`);
1615
- console.error(error);
1616
- if (window.__remixContext.isSpaMode && // @ts-expect-error
1617
- typeof import_meta.hot !== "undefined") {
1618
- throw error;
1619
- }
1620
- window.location.reload();
1621
- return new Promise(() => {
1622
- });
1623
- }
1624
- }
1625
-
1626
- // node_modules/@remix-run/react/dist/esm/links.js
1627
- function isPageLinkDescriptor(object) {
1628
- return object != null && typeof object.page === "string";
1629
- }
1630
- function isHtmlLinkDescriptor(object) {
1631
- if (object == null) {
1632
- return false;
1633
- }
1634
- if (object.href == null) {
1635
- return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
1636
- }
1637
- return typeof object.rel === "string" && typeof object.href === "string";
1638
- }
1639
- async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
1640
- let links = await Promise.all(matches.map(async (match) => {
1641
- let mod = await loadRouteModule(manifest.routes[match.route.id], routeModules);
1642
- return mod.links ? mod.links() : [];
1643
- }));
1644
- return dedupeLinkDescriptors(links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map((link) => link.rel === "stylesheet" ? {
1645
- ...link,
1646
- rel: "prefetch",
1647
- as: "style"
1648
- } : {
1649
- ...link,
1650
- rel: "prefetch"
1651
- }));
1652
- }
1653
- function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, future, mode) {
1654
- let path = parsePathPatch(page);
1655
- let isNew = (match, index) => {
1656
- if (!currentMatches[index]) return true;
1657
- return match.route.id !== currentMatches[index].route.id;
1658
- };
1659
- let matchPathChanged = (match, index) => {
1660
- var _currentMatches$index;
1661
- return (
1662
- // param change, /users/123 -> /users/456
1663
- currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
1664
- // e.g. /files/images/avatar.jpg -> files/finances.xls
1665
- ((_currentMatches$index = currentMatches[index].route.path) === null || _currentMatches$index === void 0 ? void 0 : _currentMatches$index.endsWith("*")) && currentMatches[index].params["*"] !== match.params["*"]
1666
- );
1667
- };
1668
- let newMatches = mode === "data" && (future.v3_singleFetch || location.search !== path.search) ? (
1669
- // this is really similar to stuff in transition.ts, maybe somebody smarter
1670
- // than me (or in less of a hurry) can share some of it. You're the best.
1671
- nextMatches.filter((match, index) => {
1672
- let manifestRoute = manifest.routes[match.route.id];
1673
- if (!manifestRoute.hasLoader) {
1674
- return false;
1675
- }
1676
- if (isNew(match, index) || matchPathChanged(match, index)) {
1677
- return true;
1678
- }
1679
- let defaultShouldRevalidate = future.v3_singleFetch || location.search !== path.search;
1680
- if (match.route.shouldRevalidate) {
1681
- var _currentMatches$;
1682
- let routeChoice = match.route.shouldRevalidate({
1683
- currentUrl: new URL(location.pathname + location.search + location.hash, window.origin),
1684
- currentParams: ((_currentMatches$ = currentMatches[0]) === null || _currentMatches$ === void 0 ? void 0 : _currentMatches$.params) || {},
1685
- nextUrl: new URL(page, window.origin),
1686
- nextParams: match.params,
1687
- defaultShouldRevalidate
1688
- });
1689
- if (typeof routeChoice === "boolean") {
1690
- return routeChoice;
1691
- }
1692
- }
1693
- return defaultShouldRevalidate;
1694
- })
1695
- ) : nextMatches.filter((match, index) => {
1696
- let manifestRoute = manifest.routes[match.route.id];
1697
- return (mode === "assets" || manifestRoute.hasLoader) && (isNew(match, index) || matchPathChanged(match, index));
1698
- });
1699
- return newMatches;
1700
- }
1701
- function getDataLinkHrefs(page, matches, manifest) {
1702
- let path = parsePathPatch(page);
1703
- return dedupeHrefs(matches.filter((match) => manifest.routes[match.route.id].hasLoader && !manifest.routes[match.route.id].hasClientLoader).map((match) => {
1704
- let {
1705
- pathname,
1706
- search
1707
- } = path;
1708
- let searchParams = new URLSearchParams(search);
1709
- searchParams.set("_data", match.route.id);
1710
- return `${pathname}?${searchParams}`;
1711
- }));
1712
- }
1713
- function getModuleLinkHrefs(matches, manifestPatch) {
1714
- return dedupeHrefs(matches.map((match) => {
1715
- let route = manifestPatch.routes[match.route.id];
1716
- let hrefs = [route.module];
1717
- if (route.imports) {
1718
- hrefs = hrefs.concat(route.imports);
1719
- }
1720
- return hrefs;
1721
- }).flat(1));
1722
- }
1723
- function dedupeHrefs(hrefs) {
1724
- return [...new Set(hrefs)];
1725
- }
1726
- function sortKeys(obj) {
1727
- let sorted = {};
1728
- let keys = Object.keys(obj).sort();
1729
- for (let key of keys) {
1730
- sorted[key] = obj[key];
1731
- }
1732
- return sorted;
1733
- }
1734
- function dedupeLinkDescriptors(descriptors, preloads) {
1735
- let set = /* @__PURE__ */ new Set();
1736
- let preloadsSet = new Set(preloads);
1737
- return descriptors.reduce((deduped, descriptor) => {
1738
- let alreadyModulePreload = preloads && !isPageLinkDescriptor(descriptor) && descriptor.as === "script" && descriptor.href && preloadsSet.has(descriptor.href);
1739
- if (alreadyModulePreload) {
1740
- return deduped;
1741
- }
1742
- let key = JSON.stringify(sortKeys(descriptor));
1743
- if (!set.has(key)) {
1744
- set.add(key);
1745
- deduped.push({
1746
- key,
1747
- link: descriptor
1748
- });
1749
- }
1750
- return deduped;
1751
- }, []);
1752
- }
1753
- function parsePathPatch(href) {
1754
- let path = parsePath(href);
1755
- if (path.search === void 0) path.search = "";
1756
- return path;
1757
- }
1758
-
1759
- // node_modules/@remix-run/react/dist/esm/single-fetch.js
1760
- var React3 = __toESM(require("react"));
1761
- function singleFetchUrl(reqUrl) {
1762
- let url = typeof reqUrl === "string" ? new URL(
1763
- reqUrl,
1764
- // This can be called during the SSR flow via PrefetchPageLinksImpl so
1765
- // don't assume window is available
1766
- typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
1767
- ) : reqUrl;
1768
- if (url.pathname === "/") {
1769
- url.pathname = "_root.data";
1770
- } else {
1771
- url.pathname = `${url.pathname.replace(/\/$/, "")}.data`;
1772
- }
1773
- return url;
1774
- }
1775
-
1776
- // node_modules/@remix-run/react/dist/esm/components.js
1777
- var import_meta2 = {};
1778
- function useDataRouterContext3() {
1779
- let context = React4.useContext(DataRouterContext);
1780
- invariant2(context, "You must render this element inside a <DataRouterContext.Provider> element");
1781
- return context;
1782
- }
1783
- function useDataRouterStateContext() {
1784
- let context = React4.useContext(DataRouterStateContext);
1785
- invariant2(context, "You must render this element inside a <DataRouterStateContext.Provider> element");
1786
- return context;
1787
- }
1788
- var RemixContext = /* @__PURE__ */ React4.createContext(void 0);
1789
- RemixContext.displayName = "Remix";
1790
- function useRemixContext() {
1791
- let context = React4.useContext(RemixContext);
1792
- invariant2(context, "You must render this element inside a <Remix> element");
1793
- return context;
1794
- }
1795
- function usePrefetchBehavior(prefetch, theirElementProps) {
1796
- let [maybePrefetch, setMaybePrefetch] = React4.useState(false);
1797
- let [shouldPrefetch, setShouldPrefetch] = React4.useState(false);
1798
- let {
1799
- onFocus,
1800
- onBlur,
1801
- onMouseEnter,
1802
- onMouseLeave,
1803
- onTouchStart
1804
- } = theirElementProps;
1805
- let ref = React4.useRef(null);
1806
- React4.useEffect(() => {
1807
- if (prefetch === "render") {
1808
- setShouldPrefetch(true);
1809
- }
1810
- if (prefetch === "viewport") {
1811
- let callback = (entries) => {
1812
- entries.forEach((entry) => {
1813
- setShouldPrefetch(entry.isIntersecting);
1814
- });
1815
- };
1816
- let observer = new IntersectionObserver(callback, {
1817
- threshold: 0.5
1818
- });
1819
- if (ref.current) observer.observe(ref.current);
1820
- return () => {
1821
- observer.disconnect();
1822
- };
1823
- }
1824
- }, [prefetch]);
1825
- let setIntent = () => {
1826
- if (prefetch === "intent") {
1827
- setMaybePrefetch(true);
1828
- }
1829
- };
1830
- let cancelIntent = () => {
1831
- if (prefetch === "intent") {
1832
- setMaybePrefetch(false);
1833
- setShouldPrefetch(false);
1834
- }
1835
- };
1836
- React4.useEffect(() => {
1837
- if (maybePrefetch) {
1838
- let id = setTimeout(() => {
1839
- setShouldPrefetch(true);
1840
- }, 100);
1841
- return () => {
1842
- clearTimeout(id);
1843
- };
1844
- }
1845
- }, [maybePrefetch]);
1846
- return [shouldPrefetch, ref, {
1847
- onFocus: composeEventHandlers(onFocus, setIntent),
1848
- onBlur: composeEventHandlers(onBlur, cancelIntent),
1849
- onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
1850
- onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
1851
- onTouchStart: composeEventHandlers(onTouchStart, setIntent)
1852
- }];
1853
- }
1854
- var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
1855
- function getDiscoverAttr(discover, isAbsolute, reloadDocument) {
1856
- return discover === "render" && !isAbsolute && !reloadDocument ? "true" : void 0;
1857
- }
1858
- var NavLink2 = /* @__PURE__ */ React4.forwardRef(({
1859
- to,
1860
- prefetch = "none",
1861
- discover = "render",
1862
- ...props
1863
- }, forwardedRef) => {
1864
- let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
1865
- let href = useHref(to);
1866
- let [shouldPrefetch, ref, prefetchHandlers] = usePrefetchBehavior(prefetch, props);
1867
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(NavLink, _extends4({}, props, prefetchHandlers, {
1868
- ref: mergeRefs(forwardedRef, ref),
1869
- to,
1870
- "data-discover": getDiscoverAttr(discover, isAbsolute, props.reloadDocument)
1871
- })), shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React4.createElement(PrefetchPageLinks, {
1872
- page: href
1873
- }) : null);
1874
- });
1875
- NavLink2.displayName = "NavLink";
1876
- var Link2 = /* @__PURE__ */ React4.forwardRef(({
1877
- to,
1878
- prefetch = "none",
1879
- discover = "render",
1880
- ...props
1881
- }, forwardedRef) => {
1882
- let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
1883
- let href = useHref(to);
1884
- let [shouldPrefetch, ref, prefetchHandlers] = usePrefetchBehavior(prefetch, props);
1885
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, /* @__PURE__ */ React4.createElement(Link, _extends4({}, props, prefetchHandlers, {
1886
- ref: mergeRefs(forwardedRef, ref),
1887
- to,
1888
- "data-discover": getDiscoverAttr(discover, isAbsolute, props.reloadDocument)
1889
- })), shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React4.createElement(PrefetchPageLinks, {
1890
- page: href
1891
- }) : null);
1892
- });
1893
- Link2.displayName = "Link";
1894
- var Form2 = /* @__PURE__ */ React4.forwardRef(({
1895
- discover = "render",
1896
- ...props
1897
- }, forwardedRef) => {
1898
- let isAbsolute = typeof props.action === "string" && ABSOLUTE_URL_REGEX2.test(props.action);
1899
- return /* @__PURE__ */ React4.createElement(Form, _extends4({}, props, {
1900
- ref: forwardedRef,
1901
- "data-discover": getDiscoverAttr(discover, isAbsolute, props.reloadDocument)
1902
- }));
1903
- });
1904
- Form2.displayName = "Form";
1905
- function composeEventHandlers(theirHandler, ourHandler) {
1906
- return (event) => {
1907
- theirHandler && theirHandler(event);
1908
- if (!event.defaultPrevented) {
1909
- ourHandler(event);
1910
- }
1911
- };
1912
- }
1913
- function PrefetchPageLinks({
1914
- page,
1915
- ...dataLinkProps
1916
- }) {
1917
- let {
1918
- router
1919
- } = useDataRouterContext3();
1920
- let matches = React4.useMemo(() => matchRoutes(router.routes, page, router.basename), [router.routes, page, router.basename]);
1921
- if (!matches) {
1922
- console.warn(`Tried to prefetch ${page} but no routes matched.`);
1923
- return null;
1924
- }
1925
- return /* @__PURE__ */ React4.createElement(PrefetchPageLinksImpl, _extends4({
1926
- page,
1927
- matches
1928
- }, dataLinkProps));
1929
- }
1930
- function useKeyedPrefetchLinks(matches) {
1931
- let {
1932
- manifest,
1933
- routeModules
1934
- } = useRemixContext();
1935
- let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React4.useState([]);
1936
- React4.useEffect(() => {
1937
- let interrupted = false;
1938
- void getKeyedPrefetchLinks(matches, manifest, routeModules).then((links) => {
1939
- if (!interrupted) {
1940
- setKeyedPrefetchLinks(links);
1941
- }
1942
- });
1943
- return () => {
1944
- interrupted = true;
1945
- };
1946
- }, [matches, manifest, routeModules]);
1947
- return keyedPrefetchLinks;
1948
- }
1949
- function PrefetchPageLinksImpl({
1950
- page,
1951
- matches: nextMatches,
1952
- ...linkProps
1953
- }) {
1954
- let location = useLocation();
1955
- let {
1956
- future,
1957
- manifest,
1958
- routeModules
1959
- } = useRemixContext();
1960
- let {
1961
- loaderData,
1962
- matches
1963
- } = useDataRouterStateContext();
1964
- let newMatchesForData = React4.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, manifest, location, future, "data"), [page, nextMatches, matches, manifest, location, future]);
1965
- let dataHrefs = React4.useMemo(() => {
1966
- if (!future.v3_singleFetch) {
1967
- return getDataLinkHrefs(page, newMatchesForData, manifest);
1968
- }
1969
- if (page === location.pathname + location.search + location.hash) {
1970
- return [];
1971
- }
1972
- let routesParams = /* @__PURE__ */ new Set();
1973
- let foundOptOutRoute = false;
1974
- nextMatches.forEach((m) => {
1975
- var _routeModules$m$route;
1976
- if (!manifest.routes[m.route.id].hasLoader) {
1977
- return;
1978
- }
1979
- if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && (_routeModules$m$route = routeModules[m.route.id]) !== null && _routeModules$m$route !== void 0 && _routeModules$m$route.shouldRevalidate) {
1980
- foundOptOutRoute = true;
1981
- } else if (manifest.routes[m.route.id].hasClientLoader) {
1982
- foundOptOutRoute = true;
1983
- } else {
1984
- routesParams.add(m.route.id);
1985
- }
1986
- });
1987
- if (routesParams.size === 0) {
1988
- return [];
1989
- }
1990
- let url = singleFetchUrl(page);
1991
- if (foundOptOutRoute && routesParams.size > 0) {
1992
- url.searchParams.set("_routes", nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(","));
1993
- }
1994
- return [url.pathname + url.search];
1995
- }, [future.v3_singleFetch, loaderData, location, manifest, newMatchesForData, nextMatches, page, routeModules]);
1996
- let newMatchesForAssets = React4.useMemo(() => getNewMatchesForLinks(page, nextMatches, matches, manifest, location, future, "assets"), [page, nextMatches, matches, manifest, location, future]);
1997
- let moduleHrefs = React4.useMemo(() => getModuleLinkHrefs(newMatchesForAssets, manifest), [newMatchesForAssets, manifest]);
1998
- let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
1999
- return /* @__PURE__ */ React4.createElement(React4.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React4.createElement("link", _extends4({
2000
- key: href,
2001
- rel: "prefetch",
2002
- as: "fetch",
2003
- href
2004
- }, linkProps))), moduleHrefs.map((href) => /* @__PURE__ */ React4.createElement("link", _extends4({
2005
- key: href,
2006
- rel: "modulepreload",
2007
- href
2008
- }, linkProps))), keyedPrefetchLinks.map(({
2009
- key,
2010
- link
2011
- }) => (
2012
- // these don't spread `linkProps` because they are full link descriptors
2013
- // already with their own props
2014
- /* @__PURE__ */ React4.createElement("link", _extends4({
2015
- key
2016
- }, link))
2017
- )));
2018
- }
2019
- function useLoaderData2() {
2020
- return useLoaderData();
2021
- }
2022
- function useActionData2() {
2023
- return useActionData();
2024
- }
2025
- function useFetcher2(opts = {}) {
2026
- return useFetcher(opts);
2027
- }
2028
- var LiveReload = (
2029
- // Dead Code Elimination magic for production builds.
2030
- // This way devs don't have to worry about doing the NODE_ENV check themselves.
2031
- process.env.NODE_ENV !== "development" ? () => null : function LiveReload2({
2032
- origin,
2033
- port,
2034
- timeoutMs = 1e3,
2035
- nonce = void 0
2036
- }) {
2037
- let isViteClient = import_meta2 && import_meta2.env !== void 0;
2038
- if (isViteClient) {
2039
- console.warn(["`<LiveReload />` is obsolete when using Vite and can conflict with Vite's built-in HMR runtime.", "", "Remove `<LiveReload />` from your code and instead only use `<Scripts />`.", "Then refresh the page to remove lingering scripts from `<LiveReload />`."].join("\n"));
2040
- return null;
2041
- }
2042
- origin ?? (origin = process.env.REMIX_DEV_ORIGIN);
2043
- let js = String.raw;
2044
- return /* @__PURE__ */ React4.createElement("script", {
2045
- nonce,
2046
- suppressHydrationWarning: true,
2047
- dangerouslySetInnerHTML: {
2048
- __html: js`
2049
- function remixLiveReloadConnect(config) {
2050
- let LIVE_RELOAD_ORIGIN = ${JSON.stringify(origin)};
2051
- let protocol =
2052
- LIVE_RELOAD_ORIGIN ? new URL(LIVE_RELOAD_ORIGIN).protocol.replace(/^http/, "ws") :
2053
- location.protocol === "https:" ? "wss:" : "ws:"; // remove in v2?
2054
- let hostname = LIVE_RELOAD_ORIGIN ? new URL(LIVE_RELOAD_ORIGIN).hostname : location.hostname;
2055
- let url = new URL(protocol + "//" + hostname + "/socket");
2056
-
2057
- url.port =
2058
- ${port} ||
2059
- (LIVE_RELOAD_ORIGIN ? new URL(LIVE_RELOAD_ORIGIN).port : 8002);
2060
-
2061
- let ws = new WebSocket(url.href);
2062
- ws.onmessage = async (message) => {
2063
- let event = JSON.parse(message.data);
2064
- if (event.type === "LOG") {
2065
- console.log(event.message);
2066
- }
2067
- if (event.type === "RELOAD") {
2068
- console.log("💿 Reloading window ...");
2069
- window.location.reload();
2070
- }
2071
- if (event.type === "HMR") {
2072
- if (!window.__hmr__ || !window.__hmr__.contexts) {
2073
- console.log("💿 [HMR] No HMR context, reloading window ...");
2074
- window.location.reload();
2075
- return;
2076
- }
2077
- if (!event.updates || !event.updates.length) return;
2078
- let updateAccepted = false;
2079
- let needsRevalidation = new Set();
2080
- for (let update of event.updates) {
2081
- console.log("[HMR] " + update.reason + " [" + update.id +"]")
2082
- if (update.revalidate) {
2083
- needsRevalidation.add(update.routeId);
2084
- console.log("[HMR] Revalidating [" + update.routeId + "]");
2085
- }
2086
- let imported = await import(update.url + '?t=' + event.assetsManifest.hmr.timestamp);
2087
- if (window.__hmr__.contexts[update.id]) {
2088
- let accepted = window.__hmr__.contexts[update.id].emit(
2089
- imported
2090
- );
2091
- if (accepted) {
2092
- console.log("[HMR] Update accepted by", update.id);
2093
- updateAccepted = true;
2094
- }
2095
- }
2096
- }
2097
- if (event.assetsManifest && window.__hmr__.contexts["remix:manifest"]) {
2098
- let accepted = window.__hmr__.contexts["remix:manifest"].emit(
2099
- { needsRevalidation, assetsManifest: event.assetsManifest }
2100
- );
2101
- if (accepted) {
2102
- console.log("[HMR] Update accepted by", "remix:manifest");
2103
- updateAccepted = true;
2104
- }
2105
- }
2106
- if (!updateAccepted) {
2107
- console.log("[HMR] Update rejected, reloading...");
2108
- window.location.reload();
2109
- }
2110
- }
2111
- };
2112
- ws.onopen = () => {
2113
- if (config && typeof config.onOpen === "function") {
2114
- config.onOpen();
2115
- }
2116
- };
2117
- ws.onclose = (event) => {
2118
- if (event.code === 1006) {
2119
- console.log("Remix dev asset server web socket closed. Reconnecting...");
2120
- setTimeout(
2121
- () =>
2122
- remixLiveReloadConnect({
2123
- onOpen: () => window.location.reload(),
2124
- }),
2125
- ${String(timeoutMs)}
2126
- );
2127
- }
2128
- };
2129
- ws.onerror = (error) => {
2130
- console.log("Remix dev asset server web socket error:");
2131
- console.error(error);
2132
- };
2133
- }
2134
- remixLiveReloadConnect();
2135
- `
2136
- }
2137
- });
2138
- }
2139
- );
2140
- function mergeRefs(...refs) {
2141
- return (value) => {
2142
- refs.forEach((ref) => {
2143
- if (typeof ref === "function") {
2144
- ref(value);
2145
- } else if (ref != null) {
2146
- ref.current = value;
2147
- }
2148
- });
2149
- };
2150
- }
2151
- // Annotate the CommonJS export names for ESM import in node:
2152
- 0 && (module.exports = {
2153
- useActionData,
2154
- useFetcher,
2155
- useLoaderData,
2156
- useNavigation,
2157
- useSubmit
2158
- });
2159
- /*! Bundled license information:
2160
-
2161
- @remix-run/router/dist/router.js:
2162
- (**
2163
- * @remix-run/router v1.23.2
2164
- *
2165
- * Copyright (c) Remix Software Inc.
2166
- *
2167
- * This source code is licensed under the MIT license found in the
2168
- * LICENSE.md file in the root directory of this source tree.
2169
- *
2170
- * @license MIT
2171
- *)
2172
-
2173
- react-router/dist/index.js:
2174
- (**
2175
- * React Router v6.30.3
2176
- *
2177
- * Copyright (c) Remix Software Inc.
2178
- *
2179
- * This source code is licensed under the MIT license found in the
2180
- * LICENSE.md file in the root directory of this source tree.
2181
- *
2182
- * @license MIT
2183
- *)
2184
-
2185
- react-router-dom/dist/index.js:
2186
- (**
2187
- * React Router DOM v6.30.3
2188
- *
2189
- * Copyright (c) Remix Software Inc.
2190
- *
2191
- * This source code is licensed under the MIT license found in the
2192
- * LICENSE.md file in the root directory of this source tree.
2193
- *
2194
- * @license MIT
2195
- *)
2196
-
2197
- @remix-run/react/dist/esm/_virtual/_rollupPluginBabelHelpers.js:
2198
- @remix-run/react/dist/esm/invariant.js:
2199
- @remix-run/react/dist/esm/routeModules.js:
2200
- @remix-run/react/dist/esm/links.js:
2201
- @remix-run/react/dist/esm/single-fetch.js:
2202
- @remix-run/react/dist/esm/components.js:
2203
- @remix-run/react/dist/esm/index.js:
2204
- (**
2205
- * @remix-run/react v2.17.4
2206
- *
2207
- * Copyright (c) Remix Software Inc.
2208
- *
2209
- * This source code is licensed under the MIT license found in the
2210
- * LICENSE.md file in the root directory of this source tree.
2211
- *
2212
- * @license MIT
2213
- *)
2214
- */
2215
- //# sourceMappingURL=remix.js.map