zudoku 0.3.0-dev.21 → 0.3.0-dev.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/config.d.ts +1 -1
- package/dist/lib/authentication/authentication.d.ts +1 -1
- package/dist/lib/plugins/api-keys/index.js +1 -0
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.js +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +1 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +1 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -1
- package/dist/lib/plugins/openapi/Route.d.ts +6 -0
- package/dist/lib/plugins/openapi/Route.js +8 -0
- package/dist/lib/plugins/openapi/Route.js.map +1 -0
- package/dist/lib/plugins/openapi/context.d.ts +5 -0
- package/dist/lib/plugins/openapi/context.js +11 -0
- package/dist/lib/plugins/openapi/context.js.map +1 -0
- package/dist/lib/plugins/openapi/index.d.ts +1 -19
- package/dist/lib/plugins/openapi/index.js +17 -18
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +15 -0
- package/dist/lib/plugins/openapi/interfaces.js +2 -0
- package/dist/lib/plugins/openapi/interfaces.js.map +1 -0
- package/dist/vite/config.js +5 -1
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugin-api-keys.js +3 -4
- package/dist/vite/plugin-api-keys.js.map +1 -1
- package/dist/vite/plugin-api.js +3 -7
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-auth.js +2 -3
- package/dist/vite/plugin-auth.js.map +1 -1
- package/dist/vite/plugin-config.d.ts +0 -1
- package/dist/vite/plugin-config.js +11 -6
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-redirect.js +2 -5
- package/dist/vite/plugin-redirect.js.map +1 -1
- package/lib/{util-voKLTRDG.js → AnchorLink-DIUlXlf0.js} +149 -184
- package/lib/DevPortalProvider-gzyAGqHT.js +1080 -0
- package/lib/{Markdown-5LmPZyLV.js → Markdown-BjA7peYW.js} +3 -3
- package/lib/{MdxComponents-DYD_QPVF.js → MdxComponents-W-fE1ISO.js} +130 -129
- package/lib/MdxPage-DQ7lZBzE.js +216 -0
- package/lib/OperationList-DuIBqFNA.js +5545 -0
- package/lib/Route-B98Y2MdH.js +13 -0
- package/lib/{Select-DR3PiqjV.js → Select-DczD5e29.js} +24 -22
- package/lib/{Spinner-DjQ2eBxC.js → Spinner-CSoij67T.js} +3 -3
- package/lib/cn-DpqTslo9.js +2341 -0
- package/lib/context-_fYfJFgk.js +13 -0
- package/lib/{hook-FCY9-FHO.js → hook-CBXxHulF.js} +1 -1
- package/lib/{index-By9bEW57.js → index-C7O9D7f6.js} +15 -15
- package/lib/index-CKvOcM7w.js +712 -0
- package/lib/index-Cg6lXS1z.js +709 -0
- package/lib/index-ClDDiRmC.js +463 -0
- package/lib/router-DibNxKUP.js +3008 -0
- package/lib/util-CaVongBq.js +40 -0
- package/lib/zudoku.auth-openid.js +7 -6
- package/lib/zudoku.components.js +73 -69
- package/lib/zudoku.plugin-api-keys.js +26 -23
- package/lib/zudoku.plugin-markdown.js +33 -237
- package/lib/zudoku.plugin-openapi.js +5 -6238
- package/lib/zudoku.plugin-redirect.js +7 -6
- package/package.json +1 -1
- package/src/lib/authentication/authentication.ts +1 -1
- package/src/lib/plugins/api-keys/index.tsx +1 -0
- package/src/lib/plugins/markdown/generateRoutes.tsx +2 -2
- package/src/lib/plugins/openapi/OperationList.tsx +1 -1
- package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +1 -1
- package/src/lib/plugins/openapi/Route.tsx +21 -0
- package/src/lib/plugins/openapi/context.tsx +16 -0
- package/src/lib/plugins/openapi/index.tsx +19 -46
- package/src/lib/plugins/openapi/interfaces.ts +9 -0
- package/lib/DevPortalProvider-CRKuwoXc.js +0 -4123
- package/lib/index-PyGcnQFX.js +0 -3462
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import * as n from "react";
|
|
2
|
+
import { i as c, a as D, g as U, w as g, r as F, e as Y, A as W, p as z, s as H, f as q } from "./router-DibNxKUP.js";
|
|
3
|
+
/**
|
|
4
|
+
* React Router v6.24.1
|
|
5
|
+
*
|
|
6
|
+
* Copyright (c) Remix Software Inc.
|
|
7
|
+
*
|
|
8
|
+
* This source code is licensed under the MIT license found in the
|
|
9
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
10
|
+
*
|
|
11
|
+
* @license MIT
|
|
12
|
+
*/
|
|
13
|
+
function _() {
|
|
14
|
+
return _ = Object.assign ? Object.assign.bind() : function(e) {
|
|
15
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
16
|
+
var r = arguments[t];
|
|
17
|
+
for (var a in r)
|
|
18
|
+
Object.prototype.hasOwnProperty.call(r, a) && (e[a] = r[a]);
|
|
19
|
+
}
|
|
20
|
+
return e;
|
|
21
|
+
}, _.apply(this, arguments);
|
|
22
|
+
}
|
|
23
|
+
const P = /* @__PURE__ */ n.createContext(null);
|
|
24
|
+
process.env.NODE_ENV !== "production" && (P.displayName = "DataRouter");
|
|
25
|
+
const M = /* @__PURE__ */ n.createContext(null);
|
|
26
|
+
process.env.NODE_ENV !== "production" && (M.displayName = "DataRouterState");
|
|
27
|
+
const X = /* @__PURE__ */ n.createContext(null);
|
|
28
|
+
process.env.NODE_ENV !== "production" && (X.displayName = "Await");
|
|
29
|
+
const C = /* @__PURE__ */ n.createContext(null);
|
|
30
|
+
process.env.NODE_ENV !== "production" && (C.displayName = "Navigation");
|
|
31
|
+
const V = /* @__PURE__ */ n.createContext(null);
|
|
32
|
+
process.env.NODE_ENV !== "production" && (V.displayName = "Location");
|
|
33
|
+
const y = /* @__PURE__ */ n.createContext({
|
|
34
|
+
outlet: null,
|
|
35
|
+
matches: [],
|
|
36
|
+
isDataRoute: !1
|
|
37
|
+
});
|
|
38
|
+
process.env.NODE_ENV !== "production" && (y.displayName = "Route");
|
|
39
|
+
const k = /* @__PURE__ */ n.createContext(null);
|
|
40
|
+
process.env.NODE_ENV !== "production" && (k.displayName = "RouteError");
|
|
41
|
+
function de(e, t) {
|
|
42
|
+
let {
|
|
43
|
+
relative: r
|
|
44
|
+
} = t === void 0 ? {} : t;
|
|
45
|
+
R() || (process.env.NODE_ENV !== "production" ? c(
|
|
46
|
+
!1,
|
|
47
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
48
|
+
// router loaded. We can help them understand how to avoid that.
|
|
49
|
+
"useHref() may be used only in the context of a <Router> component."
|
|
50
|
+
) : c(!1));
|
|
51
|
+
let {
|
|
52
|
+
basename: a,
|
|
53
|
+
navigator: i
|
|
54
|
+
} = n.useContext(C), {
|
|
55
|
+
hash: u,
|
|
56
|
+
pathname: o,
|
|
57
|
+
search: f
|
|
58
|
+
} = Z(e, {
|
|
59
|
+
relative: r
|
|
60
|
+
}), m = o;
|
|
61
|
+
return a !== "/" && (m = o === "/" ? a : D([a, o])), i.createHref({
|
|
62
|
+
pathname: m,
|
|
63
|
+
search: f,
|
|
64
|
+
hash: u
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function R() {
|
|
68
|
+
return n.useContext(V) != null;
|
|
69
|
+
}
|
|
70
|
+
function B() {
|
|
71
|
+
return R() || (process.env.NODE_ENV !== "production" ? c(
|
|
72
|
+
!1,
|
|
73
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
74
|
+
// router loaded. We can help them understand how to avoid that.
|
|
75
|
+
"useLocation() may be used only in the context of a <Router> component."
|
|
76
|
+
) : c(!1)), n.useContext(V).location;
|
|
77
|
+
}
|
|
78
|
+
const S = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
|
|
79
|
+
function J(e) {
|
|
80
|
+
n.useContext(C).static || n.useLayoutEffect(e);
|
|
81
|
+
}
|
|
82
|
+
function $() {
|
|
83
|
+
let {
|
|
84
|
+
isDataRoute: e
|
|
85
|
+
} = n.useContext(y);
|
|
86
|
+
return e ? ue() : G();
|
|
87
|
+
}
|
|
88
|
+
function G() {
|
|
89
|
+
R() || (process.env.NODE_ENV !== "production" ? c(
|
|
90
|
+
!1,
|
|
91
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
92
|
+
// router loaded. We can help them understand how to avoid that.
|
|
93
|
+
"useNavigate() may be used only in the context of a <Router> component."
|
|
94
|
+
) : c(!1));
|
|
95
|
+
let e = n.useContext(P), {
|
|
96
|
+
basename: t,
|
|
97
|
+
future: r,
|
|
98
|
+
navigator: a
|
|
99
|
+
} = n.useContext(C), {
|
|
100
|
+
matches: i
|
|
101
|
+
} = n.useContext(y), {
|
|
102
|
+
pathname: u
|
|
103
|
+
} = B(), o = JSON.stringify(U(i, r.v7_relativeSplatPath)), f = n.useRef(!1);
|
|
104
|
+
return J(() => {
|
|
105
|
+
f.current = !0;
|
|
106
|
+
}), n.useCallback(function(d, s) {
|
|
107
|
+
if (s === void 0 && (s = {}), process.env.NODE_ENV !== "production" && g(f.current, S), !f.current) return;
|
|
108
|
+
if (typeof d == "number") {
|
|
109
|
+
a.go(d);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
let l = F(d, JSON.parse(o), u, s.relative === "path");
|
|
113
|
+
e == null && t !== "/" && (l.pathname = l.pathname === "/" ? t : D([t, l.pathname])), (s.replace ? a.replace : a.push)(l, s.state, s);
|
|
114
|
+
}, [t, a, o, u, e]);
|
|
115
|
+
}
|
|
116
|
+
const K = /* @__PURE__ */ n.createContext(null);
|
|
117
|
+
function Q(e) {
|
|
118
|
+
let t = n.useContext(y).outlet;
|
|
119
|
+
return t && /* @__PURE__ */ n.createElement(K.Provider, {
|
|
120
|
+
value: e
|
|
121
|
+
}, t);
|
|
122
|
+
}
|
|
123
|
+
function Z(e, t) {
|
|
124
|
+
let {
|
|
125
|
+
relative: r
|
|
126
|
+
} = t === void 0 ? {} : t, {
|
|
127
|
+
future: a
|
|
128
|
+
} = n.useContext(C), {
|
|
129
|
+
matches: i
|
|
130
|
+
} = n.useContext(y), {
|
|
131
|
+
pathname: u
|
|
132
|
+
} = B(), o = JSON.stringify(U(i, a.v7_relativeSplatPath));
|
|
133
|
+
return n.useMemo(() => F(e, JSON.parse(o), u, r === "path"), [e, o, u, r]);
|
|
134
|
+
}
|
|
135
|
+
function fe(e, t, r, a) {
|
|
136
|
+
R() || (process.env.NODE_ENV !== "production" ? c(
|
|
137
|
+
!1,
|
|
138
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
139
|
+
// router loaded. We can help them understand how to avoid that.
|
|
140
|
+
"useRoutes() may be used only in the context of a <Router> component."
|
|
141
|
+
) : c(!1));
|
|
142
|
+
let {
|
|
143
|
+
navigator: i
|
|
144
|
+
} = n.useContext(C), {
|
|
145
|
+
matches: u
|
|
146
|
+
} = n.useContext(y), o = u[u.length - 1], f = o ? o.params : {}, m = o ? o.pathname : "/", d = o ? o.pathnameBase : "/", s = o && o.route;
|
|
147
|
+
if (process.env.NODE_ENV !== "production") {
|
|
148
|
+
let v = s && s.path || "";
|
|
149
|
+
T(m, !s || v.endsWith("*"), "You rendered descendant <Routes> (or called `useRoutes()`) at " + ('"' + m + '" (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.
|
|
150
|
+
|
|
151
|
+
` + ('Please change the parent <Route path="' + v + '"> to <Route ') + ('path="' + (v === "/" ? "*" : v + "/*") + '">.'));
|
|
152
|
+
}
|
|
153
|
+
let l = B(), p;
|
|
154
|
+
p = l;
|
|
155
|
+
let E = p.pathname || "/", N = E;
|
|
156
|
+
if (d !== "/") {
|
|
157
|
+
let v = d.replace(/^\//, "").split("/");
|
|
158
|
+
N = "/" + E.replace(/^\//, "").split("/").slice(v.length).join("/");
|
|
159
|
+
}
|
|
160
|
+
let h = Y(e, {
|
|
161
|
+
pathname: N
|
|
162
|
+
});
|
|
163
|
+
return process.env.NODE_ENV !== "production" && (process.env.NODE_ENV !== "production" && g(s || h != null, 'No routes matched location "' + p.pathname + p.search + p.hash + '" '), process.env.NODE_ENV !== "production" && g(h == null || h[h.length - 1].route.element !== void 0 || h[h.length - 1].route.Component !== void 0 || h[h.length - 1].route.lazy !== void 0, '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.')), oe(h && h.map((v) => Object.assign({}, v, {
|
|
164
|
+
params: Object.assign({}, f, v.params),
|
|
165
|
+
pathname: D([
|
|
166
|
+
d,
|
|
167
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
168
|
+
i.encodeLocation ? i.encodeLocation(v.pathname).pathname : v.pathname
|
|
169
|
+
]),
|
|
170
|
+
pathnameBase: v.pathnameBase === "/" ? d : D([
|
|
171
|
+
d,
|
|
172
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
173
|
+
i.encodeLocation ? i.encodeLocation(v.pathnameBase).pathname : v.pathnameBase
|
|
174
|
+
])
|
|
175
|
+
})), u, r, a);
|
|
176
|
+
}
|
|
177
|
+
function ee() {
|
|
178
|
+
let e = se(), t = q(e) ? e.status + " " + e.statusText : e instanceof Error ? e.message : JSON.stringify(e), r = e instanceof Error ? e.stack : null, a = "rgba(200,200,200, 0.5)", i = {
|
|
179
|
+
padding: "0.5rem",
|
|
180
|
+
backgroundColor: a
|
|
181
|
+
}, u = {
|
|
182
|
+
padding: "2px 4px",
|
|
183
|
+
backgroundColor: a
|
|
184
|
+
}, o = null;
|
|
185
|
+
return process.env.NODE_ENV !== "production" && (console.error("Error handled by React Router default ErrorBoundary:", e), o = /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ n.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ n.createElement("code", {
|
|
186
|
+
style: u
|
|
187
|
+
}, "ErrorBoundary"), " or", " ", /* @__PURE__ */ n.createElement("code", {
|
|
188
|
+
style: u
|
|
189
|
+
}, "errorElement"), " prop on your route."))), /* @__PURE__ */ n.createElement(n.Fragment, null, /* @__PURE__ */ n.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ n.createElement("h3", {
|
|
190
|
+
style: {
|
|
191
|
+
fontStyle: "italic"
|
|
192
|
+
}
|
|
193
|
+
}, t), r ? /* @__PURE__ */ n.createElement("pre", {
|
|
194
|
+
style: i
|
|
195
|
+
}, r) : null, o);
|
|
196
|
+
}
|
|
197
|
+
const te = /* @__PURE__ */ n.createElement(ee, null);
|
|
198
|
+
class ne extends n.Component {
|
|
199
|
+
constructor(t) {
|
|
200
|
+
super(t), this.state = {
|
|
201
|
+
location: t.location,
|
|
202
|
+
revalidation: t.revalidation,
|
|
203
|
+
error: t.error
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
static getDerivedStateFromError(t) {
|
|
207
|
+
return {
|
|
208
|
+
error: t
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
static getDerivedStateFromProps(t, r) {
|
|
212
|
+
return r.location !== t.location || r.revalidation !== "idle" && t.revalidation === "idle" ? {
|
|
213
|
+
error: t.error,
|
|
214
|
+
location: t.location,
|
|
215
|
+
revalidation: t.revalidation
|
|
216
|
+
} : {
|
|
217
|
+
error: t.error !== void 0 ? t.error : r.error,
|
|
218
|
+
location: r.location,
|
|
219
|
+
revalidation: t.revalidation || r.revalidation
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
componentDidCatch(t, r) {
|
|
223
|
+
console.error("React Router caught the following error during render", t, r);
|
|
224
|
+
}
|
|
225
|
+
render() {
|
|
226
|
+
return this.state.error !== void 0 ? /* @__PURE__ */ n.createElement(y.Provider, {
|
|
227
|
+
value: this.props.routeContext
|
|
228
|
+
}, /* @__PURE__ */ n.createElement(k.Provider, {
|
|
229
|
+
value: this.state.error,
|
|
230
|
+
children: this.props.component
|
|
231
|
+
})) : this.props.children;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
function re(e) {
|
|
235
|
+
let {
|
|
236
|
+
routeContext: t,
|
|
237
|
+
match: r,
|
|
238
|
+
children: a
|
|
239
|
+
} = e, i = n.useContext(P);
|
|
240
|
+
return i && i.static && i.staticContext && (r.route.errorElement || r.route.ErrorBoundary) && (i.staticContext._deepestRenderedBoundaryId = r.route.id), /* @__PURE__ */ n.createElement(y.Provider, {
|
|
241
|
+
value: t
|
|
242
|
+
}, a);
|
|
243
|
+
}
|
|
244
|
+
function oe(e, t, r, a) {
|
|
245
|
+
var i;
|
|
246
|
+
if (t === void 0 && (t = []), r === void 0 && (r = null), a === void 0 && (a = null), e == null) {
|
|
247
|
+
var u;
|
|
248
|
+
if ((u = r) != null && u.errors)
|
|
249
|
+
e = r.matches;
|
|
250
|
+
else
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
let o = e, f = (i = r) == null ? void 0 : i.errors;
|
|
254
|
+
if (f != null) {
|
|
255
|
+
let s = o.findIndex((l) => l.route.id && (f == null ? void 0 : f[l.route.id]) !== void 0);
|
|
256
|
+
s >= 0 || (process.env.NODE_ENV !== "production" ? c(!1, "Could not find a matching route for errors on route IDs: " + Object.keys(f).join(",")) : c(!1)), o = o.slice(0, Math.min(o.length, s + 1));
|
|
257
|
+
}
|
|
258
|
+
let m = !1, d = -1;
|
|
259
|
+
if (r && a && a.v7_partialHydration)
|
|
260
|
+
for (let s = 0; s < o.length; s++) {
|
|
261
|
+
let l = o[s];
|
|
262
|
+
if ((l.route.HydrateFallback || l.route.hydrateFallbackElement) && (d = s), l.route.id) {
|
|
263
|
+
let {
|
|
264
|
+
loaderData: p,
|
|
265
|
+
errors: E
|
|
266
|
+
} = r, N = l.route.loader && p[l.route.id] === void 0 && (!E || E[l.route.id] === void 0);
|
|
267
|
+
if (l.route.lazy || N) {
|
|
268
|
+
m = !0, d >= 0 ? o = o.slice(0, d + 1) : o = [o[0]];
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return o.reduceRight((s, l, p) => {
|
|
274
|
+
let E, N = !1, h = null, b = null;
|
|
275
|
+
r && (E = f && l.route.id ? f[l.route.id] : void 0, h = l.route.errorElement || te, m && (d < 0 && p === 0 ? (T("route-fallback", !1, "No `HydrateFallback` element provided to render during initial hydration"), N = !0, b = null) : d === p && (N = !0, b = l.route.hydrateFallbackElement || null)));
|
|
276
|
+
let v = t.concat(o.slice(0, p + 1)), w = () => {
|
|
277
|
+
let x;
|
|
278
|
+
return E ? x = h : N ? x = b : l.route.Component ? x = /* @__PURE__ */ n.createElement(l.route.Component, null) : l.route.element ? x = l.route.element : x = s, /* @__PURE__ */ n.createElement(re, {
|
|
279
|
+
match: l,
|
|
280
|
+
routeContext: {
|
|
281
|
+
outlet: s,
|
|
282
|
+
matches: v,
|
|
283
|
+
isDataRoute: r != null
|
|
284
|
+
},
|
|
285
|
+
children: x
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
return r && (l.route.ErrorBoundary || l.route.errorElement || p === 0) ? /* @__PURE__ */ n.createElement(ne, {
|
|
289
|
+
location: r.location,
|
|
290
|
+
revalidation: r.revalidation,
|
|
291
|
+
component: h,
|
|
292
|
+
error: E,
|
|
293
|
+
children: w(),
|
|
294
|
+
routeContext: {
|
|
295
|
+
outlet: null,
|
|
296
|
+
matches: v,
|
|
297
|
+
isDataRoute: !0
|
|
298
|
+
}
|
|
299
|
+
}) : w();
|
|
300
|
+
}, null);
|
|
301
|
+
}
|
|
302
|
+
var A = /* @__PURE__ */ function(e) {
|
|
303
|
+
return e.UseBlocker = "useBlocker", e.UseRevalidator = "useRevalidator", e.UseNavigateStable = "useNavigate", e;
|
|
304
|
+
}(A || {}), O = /* @__PURE__ */ function(e) {
|
|
305
|
+
return e.UseBlocker = "useBlocker", e.UseLoaderData = "useLoaderData", e.UseActionData = "useActionData", e.UseRouteError = "useRouteError", e.UseNavigation = "useNavigation", e.UseRouteLoaderData = "useRouteLoaderData", e.UseMatches = "useMatches", e.UseRevalidator = "useRevalidator", e.UseNavigateStable = "useNavigate", e.UseRouteId = "useRouteId", e;
|
|
306
|
+
}(O || {});
|
|
307
|
+
function I(e) {
|
|
308
|
+
return e + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
|
|
309
|
+
}
|
|
310
|
+
function ae(e) {
|
|
311
|
+
let t = n.useContext(P);
|
|
312
|
+
return t || (process.env.NODE_ENV !== "production" ? c(!1, I(e)) : c(!1)), t;
|
|
313
|
+
}
|
|
314
|
+
function le(e) {
|
|
315
|
+
let t = n.useContext(M);
|
|
316
|
+
return t || (process.env.NODE_ENV !== "production" ? c(!1, I(e)) : c(!1)), t;
|
|
317
|
+
}
|
|
318
|
+
function ie(e) {
|
|
319
|
+
let t = n.useContext(y);
|
|
320
|
+
return t || (process.env.NODE_ENV !== "production" ? c(!1, I(e)) : c(!1)), t;
|
|
321
|
+
}
|
|
322
|
+
function L(e) {
|
|
323
|
+
let t = ie(e), r = t.matches[t.matches.length - 1];
|
|
324
|
+
return r.route.id || (process.env.NODE_ENV !== "production" ? c(!1, e + ' can only be used on routes that contain a unique "id"') : c(!1)), r.route.id;
|
|
325
|
+
}
|
|
326
|
+
function pe() {
|
|
327
|
+
return L(O.UseRouteId);
|
|
328
|
+
}
|
|
329
|
+
function se() {
|
|
330
|
+
var e;
|
|
331
|
+
let t = n.useContext(k), r = le(O.UseRouteError), a = L(O.UseRouteError);
|
|
332
|
+
return t !== void 0 ? t : (e = r.errors) == null ? void 0 : e[a];
|
|
333
|
+
}
|
|
334
|
+
function ue() {
|
|
335
|
+
let {
|
|
336
|
+
router: e
|
|
337
|
+
} = ae(A.UseNavigateStable), t = L(O.UseNavigateStable), r = n.useRef(!1);
|
|
338
|
+
return J(() => {
|
|
339
|
+
r.current = !0;
|
|
340
|
+
}), n.useCallback(function(i, u) {
|
|
341
|
+
u === void 0 && (u = {}), process.env.NODE_ENV !== "production" && g(r.current, S), r.current && (typeof i == "number" ? e.navigate(i) : e.navigate(i, _({
|
|
342
|
+
fromRouteId: t
|
|
343
|
+
}, u)));
|
|
344
|
+
}, [e, t]);
|
|
345
|
+
}
|
|
346
|
+
const j = {};
|
|
347
|
+
function T(e, t, r) {
|
|
348
|
+
!t && !j[e] && (j[e] = !0, process.env.NODE_ENV !== "production" && g(!1, r));
|
|
349
|
+
}
|
|
350
|
+
function he(e) {
|
|
351
|
+
let {
|
|
352
|
+
to: t,
|
|
353
|
+
replace: r,
|
|
354
|
+
state: a,
|
|
355
|
+
relative: i
|
|
356
|
+
} = e;
|
|
357
|
+
R() || (process.env.NODE_ENV !== "production" ? c(
|
|
358
|
+
!1,
|
|
359
|
+
// TODO: This error is probably because they somehow have 2 versions of
|
|
360
|
+
// the router loaded. We can help them understand how to avoid that.
|
|
361
|
+
"<Navigate> may be used only in the context of a <Router> component."
|
|
362
|
+
) : c(!1));
|
|
363
|
+
let {
|
|
364
|
+
future: u,
|
|
365
|
+
static: o
|
|
366
|
+
} = n.useContext(C);
|
|
367
|
+
process.env.NODE_ENV !== "production" && g(!o, "<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.");
|
|
368
|
+
let {
|
|
369
|
+
matches: f
|
|
370
|
+
} = n.useContext(y), {
|
|
371
|
+
pathname: m
|
|
372
|
+
} = B(), d = $(), s = F(t, U(f, u.v7_relativeSplatPath), m, i === "path"), l = JSON.stringify(s);
|
|
373
|
+
return n.useEffect(() => d(JSON.parse(l), {
|
|
374
|
+
replace: r,
|
|
375
|
+
state: a,
|
|
376
|
+
relative: i
|
|
377
|
+
}), [d, l, i, r, a]), null;
|
|
378
|
+
}
|
|
379
|
+
function ve(e) {
|
|
380
|
+
return Q(e.context);
|
|
381
|
+
}
|
|
382
|
+
function me(e) {
|
|
383
|
+
let {
|
|
384
|
+
basename: t = "/",
|
|
385
|
+
children: r = null,
|
|
386
|
+
location: a,
|
|
387
|
+
navigationType: i = W.Pop,
|
|
388
|
+
navigator: u,
|
|
389
|
+
static: o = !1,
|
|
390
|
+
future: f
|
|
391
|
+
} = e;
|
|
392
|
+
R() && (process.env.NODE_ENV !== "production" ? c(!1, "You cannot render a <Router> inside another <Router>. You should never have more than one in your app.") : c(!1));
|
|
393
|
+
let m = t.replace(/^\/*/, "/"), d = n.useMemo(() => ({
|
|
394
|
+
basename: m,
|
|
395
|
+
navigator: u,
|
|
396
|
+
static: o,
|
|
397
|
+
future: _({
|
|
398
|
+
v7_relativeSplatPath: !1
|
|
399
|
+
}, f)
|
|
400
|
+
}), [m, f, u, o]);
|
|
401
|
+
typeof a == "string" && (a = z(a));
|
|
402
|
+
let {
|
|
403
|
+
pathname: s = "/",
|
|
404
|
+
search: l = "",
|
|
405
|
+
hash: p = "",
|
|
406
|
+
state: E = null,
|
|
407
|
+
key: N = "default"
|
|
408
|
+
} = a, h = n.useMemo(() => {
|
|
409
|
+
let b = H(s, m);
|
|
410
|
+
return b == null ? null : {
|
|
411
|
+
location: {
|
|
412
|
+
pathname: b,
|
|
413
|
+
search: l,
|
|
414
|
+
hash: p,
|
|
415
|
+
state: E,
|
|
416
|
+
key: N
|
|
417
|
+
},
|
|
418
|
+
navigationType: i
|
|
419
|
+
};
|
|
420
|
+
}, [m, s, l, p, E, N, i]);
|
|
421
|
+
return process.env.NODE_ENV !== "production" && g(h != null, '<Router basename="' + m + '"> is not able to match the URL ' + ('"' + s + l + p + '" because it does not start with the ') + "basename, so the <Router> won't render anything."), h == null ? null : /* @__PURE__ */ n.createElement(C.Provider, {
|
|
422
|
+
value: d
|
|
423
|
+
}, /* @__PURE__ */ n.createElement(V.Provider, {
|
|
424
|
+
children: r,
|
|
425
|
+
value: h
|
|
426
|
+
}));
|
|
427
|
+
}
|
|
428
|
+
new Promise(() => {
|
|
429
|
+
});
|
|
430
|
+
function Ee(e) {
|
|
431
|
+
let t = {
|
|
432
|
+
// Note: this check also occurs in createRoutesFromChildren so update
|
|
433
|
+
// there if you change this -- please and thank you!
|
|
434
|
+
hasErrorBoundary: e.ErrorBoundary != null || e.errorElement != null
|
|
435
|
+
};
|
|
436
|
+
return e.Component && (process.env.NODE_ENV !== "production" && e.element && process.env.NODE_ENV !== "production" && g(!1, "You should not include both `Component` and `element` on your route - `Component` will be used."), Object.assign(t, {
|
|
437
|
+
element: /* @__PURE__ */ n.createElement(e.Component),
|
|
438
|
+
Component: void 0
|
|
439
|
+
})), e.HydrateFallback && (process.env.NODE_ENV !== "production" && e.hydrateFallbackElement && process.env.NODE_ENV !== "production" && g(!1, "You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."), Object.assign(t, {
|
|
440
|
+
hydrateFallbackElement: /* @__PURE__ */ n.createElement(e.HydrateFallback),
|
|
441
|
+
HydrateFallback: void 0
|
|
442
|
+
})), e.ErrorBoundary && (process.env.NODE_ENV !== "production" && e.errorElement && process.env.NODE_ENV !== "production" && g(!1, "You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."), Object.assign(t, {
|
|
443
|
+
errorElement: /* @__PURE__ */ n.createElement(e.ErrorBoundary),
|
|
444
|
+
ErrorBoundary: void 0
|
|
445
|
+
})), t;
|
|
446
|
+
}
|
|
447
|
+
export {
|
|
448
|
+
M as D,
|
|
449
|
+
he as N,
|
|
450
|
+
ve as O,
|
|
451
|
+
y as R,
|
|
452
|
+
$ as a,
|
|
453
|
+
se as b,
|
|
454
|
+
C as c,
|
|
455
|
+
de as d,
|
|
456
|
+
Z as e,
|
|
457
|
+
pe as f,
|
|
458
|
+
P as g,
|
|
459
|
+
me as h,
|
|
460
|
+
fe as i,
|
|
461
|
+
Ee as m,
|
|
462
|
+
B as u
|
|
463
|
+
};
|