react-ecosistema-unp 0.6.3 → 0.6.5

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