astro-md-editor 0.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.
- package/.output/nitro.json +17 -0
- package/.output/public/assets/index-Cc7yKB0o.js +19 -0
- package/.output/public/assets/inter-cyrillic-ext-wght-normal-BOeWTOD4.woff2 +0 -0
- package/.output/public/assets/inter-cyrillic-wght-normal-DqGufNeO.woff2 +0 -0
- package/.output/public/assets/inter-greek-ext-wght-normal-DlzME5K_.woff2 +0 -0
- package/.output/public/assets/inter-greek-wght-normal-CkhJZR-_.woff2 +0 -0
- package/.output/public/assets/inter-latin-ext-wght-normal-DO1Apj_S.woff2 +0 -0
- package/.output/public/assets/inter-latin-wght-normal-Dx4kXJAl.woff2 +0 -0
- package/.output/public/assets/inter-vietnamese-wght-normal-CBcvBZtf.woff2 +0 -0
- package/.output/public/assets/main-DDBjVFnt.js +17 -0
- package/.output/public/assets/styles-ggfdUHMo.css +1 -0
- package/.output/public/favicon.ico +0 -0
- package/.output/public/logo192.png +0 -0
- package/.output/public/logo512.png +0 -0
- package/.output/public/manifest.json +25 -0
- package/.output/public/robots.txt +3 -0
- package/.output/server/__root-C09LBXMv.mjs +40 -0
- package/.output/server/_chunks/ssr-renderer.mjs +21 -0
- package/.output/server/_libs/ajv-formats.mjs +330 -0
- package/.output/server/_libs/ajv.mjs +5484 -0
- package/.output/server/_libs/base-ui__react.mjs +8712 -0
- package/.output/server/_libs/base-ui__utils.mjs +980 -0
- package/.output/server/_libs/class-variance-authority.mjs +44 -0
- package/.output/server/_libs/clsx.mjs +16 -0
- package/.output/server/_libs/cookie-es.mjs +58 -0
- package/.output/server/_libs/croner.mjs +1 -0
- package/.output/server/_libs/crossws.mjs +1 -0
- package/.output/server/_libs/date-fns.mjs +1716 -0
- package/.output/server/_libs/date-fns__tz.mjs +217 -0
- package/.output/server/_libs/extend-shallow.mjs +35 -0
- package/.output/server/_libs/fast-deep-equal.mjs +38 -0
- package/.output/server/_libs/fast-uri.mjs +725 -0
- package/.output/server/_libs/floating-ui__core.mjs +663 -0
- package/.output/server/_libs/floating-ui__dom.mjs +624 -0
- package/.output/server/_libs/floating-ui__react-dom.mjs +279 -0
- package/.output/server/_libs/floating-ui__utils.mjs +322 -0
- package/.output/server/_libs/gray-matter.mjs +393 -0
- package/.output/server/_libs/h3-v2.mjs +276 -0
- package/.output/server/_libs/h3.mjs +400 -0
- package/.output/server/_libs/hookable.mjs +1 -0
- package/.output/server/_libs/is-extendable.mjs +13 -0
- package/.output/server/_libs/isbot.mjs +20 -0
- package/.output/server/_libs/js-yaml.mjs +2822 -0
- package/.output/server/_libs/json-schema-traverse.mjs +91 -0
- package/.output/server/_libs/kind-of.mjs +125 -0
- package/.output/server/_libs/lucide-react.mjs +177 -0
- package/.output/server/_libs/ohash.mjs +1 -0
- package/.output/server/_libs/react-day-picker.mjs +2216 -0
- package/.output/server/_libs/react-dom.mjs +10779 -0
- package/.output/server/_libs/react-resizable-panels.mjs +2024 -0
- package/.output/server/_libs/react.mjs +513 -0
- package/.output/server/_libs/reselect.mjs +326 -0
- package/.output/server/_libs/rou3.mjs +8 -0
- package/.output/server/_libs/section-matter.mjs +112 -0
- package/.output/server/_libs/seroval-plugins.mjs +58 -0
- package/.output/server/_libs/seroval.mjs +1765 -0
- package/.output/server/_libs/srvx.mjs +736 -0
- package/.output/server/_libs/strip-bom-string.mjs +16 -0
- package/.output/server/_libs/tabbable.mjs +342 -0
- package/.output/server/_libs/tailwind-merge.mjs +3175 -0
- package/.output/server/_libs/tanstack__history.mjs +217 -0
- package/.output/server/_libs/tanstack__react-router.mjs +1464 -0
- package/.output/server/_libs/tanstack__react-store.mjs +1 -0
- package/.output/server/_libs/tanstack__router-core.mjs +4912 -0
- package/.output/server/_libs/tanstack__store.mjs +1 -0
- package/.output/server/_libs/tiny-invariant.mjs +12 -0
- package/.output/server/_libs/tiny-warning.mjs +5 -0
- package/.output/server/_libs/ufo.mjs +54 -0
- package/.output/server/_libs/unctx.mjs +1 -0
- package/.output/server/_libs/unstorage.mjs +1 -0
- package/.output/server/_libs/use-sync-external-store.mjs +139 -0
- package/.output/server/_libs/zod.mjs +3634 -0
- package/.output/server/_libs/zustand.mjs +43 -0
- package/.output/server/_ssr/RightSidebar-RSY9M7XF.mjs +218 -0
- package/.output/server/_ssr/collections.server-D6U2tEsT.mjs +120 -0
- package/.output/server/_ssr/createServerRpc-29xaFZcb.mjs +12 -0
- package/.output/server/_ssr/index-BaqV4cZC.mjs +2083 -0
- package/.output/server/_ssr/index-sQBM6rwN.mjs +115 -0
- package/.output/server/_ssr/index.mjs +1448 -0
- package/.output/server/_ssr/router-D4G1DGr3.mjs +155 -0
- package/.output/server/_ssr/start-HYkvq4Ni.mjs +4 -0
- package/.output/server/_tanstack-start-manifest_v-CYEHh_qB.mjs +4 -0
- package/.output/server/index.mjs +451 -0
- package/README.md +118 -0
- package/index.mjs +21 -0
- package/package.json +86 -0
- package/scripts/bootstrap-collections.mjs +1201 -0
|
@@ -0,0 +1,1464 @@
|
|
|
1
|
+
import { j as jsxRuntimeExports, r as reactExports, R as React, a as React$1 } from "./react.mjs";
|
|
2
|
+
import { i as isNotFound, d as defaultGetScrollRestorationKey, r as restoreScroll, e as escapeHtml, s as storageKey, a as rootRouteId, b as isRedirect, g as getLocationChangeInfo, t as transformReadableStreamWithRouter, c as transformPipeableStreamWithRouter, f as isDangerousProtocol, h as exactPathTest, j as removeTrailingSlash, k as deepEqual, l as functionalUpdate, B as BaseRootRoute, m as BaseRoute, n as isModuleNotFoundError, R as RouterCore } from "./tanstack__router-core.mjs";
|
|
3
|
+
import { i as invariant } from "./tiny-invariant.mjs";
|
|
4
|
+
import { PassThrough } from "node:stream";
|
|
5
|
+
import { R as ReactDOMServer } from "./react-dom.mjs";
|
|
6
|
+
import { i as isbot } from "./isbot.mjs";
|
|
7
|
+
import { w as warning } from "./tiny-warning.mjs";
|
|
8
|
+
function CatchBoundary(props) {
|
|
9
|
+
const errorComponent = props.errorComponent ?? ErrorComponent;
|
|
10
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
11
|
+
CatchBoundaryImpl,
|
|
12
|
+
{
|
|
13
|
+
getResetKey: props.getResetKey,
|
|
14
|
+
onCatch: props.onCatch,
|
|
15
|
+
children: ({ error, reset }) => {
|
|
16
|
+
if (error) {
|
|
17
|
+
return reactExports.createElement(errorComponent, {
|
|
18
|
+
error,
|
|
19
|
+
reset
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return props.children;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
class CatchBoundaryImpl extends reactExports.Component {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.state = { error: null };
|
|
31
|
+
}
|
|
32
|
+
static getDerivedStateFromProps(props) {
|
|
33
|
+
return { resetKey: props.getResetKey() };
|
|
34
|
+
}
|
|
35
|
+
static getDerivedStateFromError(error) {
|
|
36
|
+
return { error };
|
|
37
|
+
}
|
|
38
|
+
reset() {
|
|
39
|
+
this.setState({ error: null });
|
|
40
|
+
}
|
|
41
|
+
componentDidUpdate(prevProps, prevState) {
|
|
42
|
+
if (prevState.error && prevState.resetKey !== this.state.resetKey) {
|
|
43
|
+
this.reset();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
componentDidCatch(error, errorInfo) {
|
|
47
|
+
if (this.props.onCatch) {
|
|
48
|
+
this.props.onCatch(error, errorInfo);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
render() {
|
|
52
|
+
return this.props.children({
|
|
53
|
+
error: this.state.resetKey !== this.props.getResetKey() ? null : this.state.error,
|
|
54
|
+
reset: () => {
|
|
55
|
+
this.reset();
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function ErrorComponent({ error }) {
|
|
61
|
+
const [show, setShow] = reactExports.useState(false);
|
|
62
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { padding: ".5rem", maxWidth: "100%" }, children: [
|
|
63
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", alignItems: "center", gap: ".5rem" }, children: [
|
|
64
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("strong", { style: { fontSize: "1rem" }, children: "Something went wrong!" }),
|
|
65
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
66
|
+
"button",
|
|
67
|
+
{
|
|
68
|
+
style: {
|
|
69
|
+
appearance: "none",
|
|
70
|
+
fontSize: ".6em",
|
|
71
|
+
border: "1px solid currentColor",
|
|
72
|
+
padding: ".1rem .2rem",
|
|
73
|
+
fontWeight: "bold",
|
|
74
|
+
borderRadius: ".25rem"
|
|
75
|
+
},
|
|
76
|
+
onClick: () => setShow((d) => !d),
|
|
77
|
+
children: show ? "Hide Error" : "Show Error"
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { height: ".25rem" } }),
|
|
82
|
+
show ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
83
|
+
"pre",
|
|
84
|
+
{
|
|
85
|
+
style: {
|
|
86
|
+
fontSize: ".7em",
|
|
87
|
+
border: "1px solid red",
|
|
88
|
+
borderRadius: ".25rem",
|
|
89
|
+
padding: ".3rem",
|
|
90
|
+
color: "red",
|
|
91
|
+
overflow: "auto"
|
|
92
|
+
},
|
|
93
|
+
children: error.message ? /* @__PURE__ */ jsxRuntimeExports.jsx("code", { children: error.message }) : null
|
|
94
|
+
}
|
|
95
|
+
) }) : null
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
const routerContext = reactExports.createContext(null);
|
|
99
|
+
function useRouter(opts) {
|
|
100
|
+
const value = reactExports.useContext(routerContext);
|
|
101
|
+
warning(
|
|
102
|
+
!((opts?.warn ?? true) && !value)
|
|
103
|
+
);
|
|
104
|
+
return value;
|
|
105
|
+
}
|
|
106
|
+
function useRouterState(opts) {
|
|
107
|
+
const contextRouter = useRouter({
|
|
108
|
+
warn: opts?.router === void 0
|
|
109
|
+
});
|
|
110
|
+
const router = opts?.router || contextRouter;
|
|
111
|
+
{
|
|
112
|
+
const state = router.state;
|
|
113
|
+
return opts?.select ? opts.select(state) : state;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
const REACT_USE = "use";
|
|
117
|
+
const reactUse = React[REACT_USE];
|
|
118
|
+
function useForwardedRef(ref) {
|
|
119
|
+
const innerRef = reactExports.useRef(null);
|
|
120
|
+
reactExports.useImperativeHandle(ref, () => innerRef.current, []);
|
|
121
|
+
return innerRef;
|
|
122
|
+
}
|
|
123
|
+
const matchContext = reactExports.createContext(void 0);
|
|
124
|
+
const dummyMatchContext = reactExports.createContext(
|
|
125
|
+
void 0
|
|
126
|
+
);
|
|
127
|
+
function CatchNotFound(props) {
|
|
128
|
+
const resetKey = useRouterState({
|
|
129
|
+
select: (s) => `not-found-${s.location.pathname}-${s.status}`
|
|
130
|
+
});
|
|
131
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
132
|
+
CatchBoundary,
|
|
133
|
+
{
|
|
134
|
+
getResetKey: () => resetKey,
|
|
135
|
+
onCatch: (error, errorInfo) => {
|
|
136
|
+
if (isNotFound(error)) {
|
|
137
|
+
props.onCatch?.(error, errorInfo);
|
|
138
|
+
} else {
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
errorComponent: ({ error }) => {
|
|
143
|
+
if (isNotFound(error)) {
|
|
144
|
+
return props.fallback?.(error);
|
|
145
|
+
} else {
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
children: props.children
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function DefaultGlobalNotFound() {
|
|
154
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Not Found" });
|
|
155
|
+
}
|
|
156
|
+
function SafeFragment(props) {
|
|
157
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: props.children });
|
|
158
|
+
}
|
|
159
|
+
function renderRouteNotFound(router, route, data) {
|
|
160
|
+
if (!route.options.notFoundComponent) {
|
|
161
|
+
if (router.options.defaultNotFoundComponent) {
|
|
162
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.defaultNotFoundComponent, { ...data });
|
|
163
|
+
}
|
|
164
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultGlobalNotFound, {});
|
|
165
|
+
}
|
|
166
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(route.options.notFoundComponent, { ...data });
|
|
167
|
+
}
|
|
168
|
+
function ScriptOnce({ children }) {
|
|
169
|
+
const router = useRouter();
|
|
170
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
171
|
+
"script",
|
|
172
|
+
{
|
|
173
|
+
nonce: router.options.ssr?.nonce,
|
|
174
|
+
dangerouslySetInnerHTML: {
|
|
175
|
+
__html: children + ";document.currentScript.remove()"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
function ScrollRestoration() {
|
|
181
|
+
const router = useRouter();
|
|
182
|
+
if (!router.isScrollRestoring || false) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
if (typeof router.options.scrollRestoration === "function") {
|
|
186
|
+
const shouldRestore = router.options.scrollRestoration({
|
|
187
|
+
location: router.latestLocation
|
|
188
|
+
});
|
|
189
|
+
if (!shouldRestore) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const getKey = router.options.getScrollRestorationKey || defaultGetScrollRestorationKey;
|
|
194
|
+
const userKey = getKey(router.latestLocation);
|
|
195
|
+
const resolvedKey = userKey !== defaultGetScrollRestorationKey(router.latestLocation) ? userKey : void 0;
|
|
196
|
+
const restoreScrollOptions = {
|
|
197
|
+
storageKey,
|
|
198
|
+
shouldScrollRestoration: true
|
|
199
|
+
};
|
|
200
|
+
if (resolvedKey) {
|
|
201
|
+
restoreScrollOptions.key = resolvedKey;
|
|
202
|
+
}
|
|
203
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
204
|
+
ScriptOnce,
|
|
205
|
+
{
|
|
206
|
+
children: `(${restoreScroll.toString()})(${escapeHtml(JSON.stringify(restoreScrollOptions))})`
|
|
207
|
+
}
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
function ClientOnly({ children, fallback = null }) {
|
|
211
|
+
return useHydrated() ? /* @__PURE__ */ jsxRuntimeExports.jsx(React$1.Fragment, { children }) : /* @__PURE__ */ jsxRuntimeExports.jsx(React$1.Fragment, { children: fallback });
|
|
212
|
+
}
|
|
213
|
+
function useHydrated() {
|
|
214
|
+
return React$1.useSyncExternalStore(
|
|
215
|
+
subscribe,
|
|
216
|
+
() => true,
|
|
217
|
+
() => false
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
function subscribe() {
|
|
221
|
+
return () => {
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
const Match = reactExports.memo(function MatchImpl({
|
|
225
|
+
matchId
|
|
226
|
+
}) {
|
|
227
|
+
const router = useRouter();
|
|
228
|
+
const matchState = useRouterState({
|
|
229
|
+
select: (s) => {
|
|
230
|
+
const matchIndex = s.matches.findIndex((d) => d.id === matchId);
|
|
231
|
+
const match = s.matches[matchIndex];
|
|
232
|
+
invariant(
|
|
233
|
+
match
|
|
234
|
+
);
|
|
235
|
+
return {
|
|
236
|
+
routeId: match.routeId,
|
|
237
|
+
ssr: match.ssr,
|
|
238
|
+
_displayPending: match._displayPending,
|
|
239
|
+
resetKey: s.loadedAt,
|
|
240
|
+
parentRouteId: s.matches[matchIndex - 1]?.routeId
|
|
241
|
+
};
|
|
242
|
+
},
|
|
243
|
+
structuralSharing: true
|
|
244
|
+
});
|
|
245
|
+
const route = router.routesById[matchState.routeId];
|
|
246
|
+
const PendingComponent = route.options.pendingComponent ?? router.options.defaultPendingComponent;
|
|
247
|
+
const pendingElement = PendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(PendingComponent, {}) : null;
|
|
248
|
+
const routeErrorComponent = route.options.errorComponent ?? router.options.defaultErrorComponent;
|
|
249
|
+
const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch;
|
|
250
|
+
const routeNotFoundComponent = route.isRoot ? (
|
|
251
|
+
// If it's the root route, use the globalNotFound option, with fallback to the notFoundRoute's component
|
|
252
|
+
route.options.notFoundComponent ?? router.options.notFoundRoute?.options.component
|
|
253
|
+
) : route.options.notFoundComponent;
|
|
254
|
+
const resolvedNoSsr = matchState.ssr === false || matchState.ssr === "data-only";
|
|
255
|
+
const ResolvedSuspenseBoundary = (
|
|
256
|
+
// If we're on the root route, allow forcefully wrapping in suspense
|
|
257
|
+
(!route.isRoot || route.options.wrapInSuspense || resolvedNoSsr) && (route.options.wrapInSuspense ?? PendingComponent ?? (route.options.errorComponent?.preload || resolvedNoSsr)) ? reactExports.Suspense : SafeFragment
|
|
258
|
+
);
|
|
259
|
+
const ResolvedCatchBoundary = routeErrorComponent ? CatchBoundary : SafeFragment;
|
|
260
|
+
const ResolvedNotFoundBoundary = routeNotFoundComponent ? CatchNotFound : SafeFragment;
|
|
261
|
+
const ShellComponent = route.isRoot ? route.options.shellComponent ?? SafeFragment : SafeFragment;
|
|
262
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(ShellComponent, { children: [
|
|
263
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(matchContext.Provider, { value: matchId, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResolvedSuspenseBoundary, { fallback: pendingElement, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
264
|
+
ResolvedCatchBoundary,
|
|
265
|
+
{
|
|
266
|
+
getResetKey: () => matchState.resetKey,
|
|
267
|
+
errorComponent: routeErrorComponent || ErrorComponent,
|
|
268
|
+
onCatch: (error, errorInfo) => {
|
|
269
|
+
if (isNotFound(error)) throw error;
|
|
270
|
+
routeOnCatch?.(error, errorInfo);
|
|
271
|
+
},
|
|
272
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
273
|
+
ResolvedNotFoundBoundary,
|
|
274
|
+
{
|
|
275
|
+
fallback: (error) => {
|
|
276
|
+
if (!routeNotFoundComponent || error.routeId && error.routeId !== matchState.routeId || !error.routeId && !route.isRoot)
|
|
277
|
+
throw error;
|
|
278
|
+
return reactExports.createElement(routeNotFoundComponent, error);
|
|
279
|
+
},
|
|
280
|
+
children: resolvedNoSsr || matchState._displayPending ? /* @__PURE__ */ jsxRuntimeExports.jsx(ClientOnly, { fallback: pendingElement, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MatchInner, { matchId }) }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MatchInner, { matchId })
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
) }) }),
|
|
285
|
+
matchState.parentRouteId === rootRouteId && router.options.scrollRestoration ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
286
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(OnRendered, {}),
|
|
287
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(ScrollRestoration, {})
|
|
288
|
+
] }) : null
|
|
289
|
+
] });
|
|
290
|
+
});
|
|
291
|
+
function OnRendered() {
|
|
292
|
+
const router = useRouter();
|
|
293
|
+
const prevLocationRef = reactExports.useRef(
|
|
294
|
+
void 0
|
|
295
|
+
);
|
|
296
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
297
|
+
"script",
|
|
298
|
+
{
|
|
299
|
+
suppressHydrationWarning: true,
|
|
300
|
+
ref: (el) => {
|
|
301
|
+
if (el && (prevLocationRef.current === void 0 || prevLocationRef.current.href !== router.latestLocation.href)) {
|
|
302
|
+
router.emit({
|
|
303
|
+
type: "onRendered",
|
|
304
|
+
...getLocationChangeInfo(router.state)
|
|
305
|
+
});
|
|
306
|
+
prevLocationRef.current = router.latestLocation;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
router.latestLocation.state.__TSR_key
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
const MatchInner = reactExports.memo(function MatchInnerImpl({
|
|
314
|
+
matchId
|
|
315
|
+
}) {
|
|
316
|
+
const router = useRouter();
|
|
317
|
+
const { match, key, routeId } = useRouterState({
|
|
318
|
+
select: (s) => {
|
|
319
|
+
const match2 = s.matches.find((d) => d.id === matchId);
|
|
320
|
+
const routeId2 = match2.routeId;
|
|
321
|
+
const remountFn = router.routesById[routeId2].options.remountDeps ?? router.options.defaultRemountDeps;
|
|
322
|
+
const remountDeps = remountFn?.({
|
|
323
|
+
routeId: routeId2,
|
|
324
|
+
loaderDeps: match2.loaderDeps,
|
|
325
|
+
params: match2._strictParams,
|
|
326
|
+
search: match2._strictSearch
|
|
327
|
+
});
|
|
328
|
+
const key2 = remountDeps ? JSON.stringify(remountDeps) : void 0;
|
|
329
|
+
return {
|
|
330
|
+
key: key2,
|
|
331
|
+
routeId: routeId2,
|
|
332
|
+
match: {
|
|
333
|
+
id: match2.id,
|
|
334
|
+
status: match2.status,
|
|
335
|
+
error: match2.error,
|
|
336
|
+
invalid: match2.invalid,
|
|
337
|
+
_forcePending: match2._forcePending,
|
|
338
|
+
_displayPending: match2._displayPending
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
},
|
|
342
|
+
structuralSharing: true
|
|
343
|
+
});
|
|
344
|
+
const route = router.routesById[routeId];
|
|
345
|
+
const out = reactExports.useMemo(() => {
|
|
346
|
+
const Comp = route.options.component ?? router.options.defaultComponent;
|
|
347
|
+
if (Comp) {
|
|
348
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Comp, {}, key);
|
|
349
|
+
}
|
|
350
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Outlet, {});
|
|
351
|
+
}, [key, route.options.component, router.options.defaultComponent]);
|
|
352
|
+
if (match._displayPending) {
|
|
353
|
+
throw router.getMatch(match.id)?._nonReactive.displayPendingPromise;
|
|
354
|
+
}
|
|
355
|
+
if (match._forcePending) {
|
|
356
|
+
throw router.getMatch(match.id)?._nonReactive.minPendingPromise;
|
|
357
|
+
}
|
|
358
|
+
if (match.status === "pending") {
|
|
359
|
+
const pendingMinMs = route.options.pendingMinMs ?? router.options.defaultPendingMinMs;
|
|
360
|
+
if (pendingMinMs) {
|
|
361
|
+
const routerMatch = router.getMatch(match.id);
|
|
362
|
+
if (routerMatch && !routerMatch._nonReactive.minPendingPromise) ;
|
|
363
|
+
}
|
|
364
|
+
throw router.getMatch(match.id)?._nonReactive.loadPromise;
|
|
365
|
+
}
|
|
366
|
+
if (match.status === "notFound") {
|
|
367
|
+
invariant(isNotFound(match.error));
|
|
368
|
+
return renderRouteNotFound(router, route, match.error);
|
|
369
|
+
}
|
|
370
|
+
if (match.status === "redirected") {
|
|
371
|
+
invariant(isRedirect(match.error));
|
|
372
|
+
throw router.getMatch(match.id)?._nonReactive.loadPromise;
|
|
373
|
+
}
|
|
374
|
+
if (match.status === "error") {
|
|
375
|
+
{
|
|
376
|
+
const RouteErrorComponent = (route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent;
|
|
377
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
378
|
+
RouteErrorComponent,
|
|
379
|
+
{
|
|
380
|
+
error: match.error,
|
|
381
|
+
reset: void 0,
|
|
382
|
+
info: {
|
|
383
|
+
componentStack: ""
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return out;
|
|
390
|
+
});
|
|
391
|
+
const Outlet = reactExports.memo(function OutletImpl() {
|
|
392
|
+
const router = useRouter();
|
|
393
|
+
const matchId = reactExports.useContext(matchContext);
|
|
394
|
+
const routeId = useRouterState({
|
|
395
|
+
select: (s) => s.matches.find((d) => d.id === matchId)?.routeId
|
|
396
|
+
});
|
|
397
|
+
const route = router.routesById[routeId];
|
|
398
|
+
const parentGlobalNotFound = useRouterState({
|
|
399
|
+
select: (s) => {
|
|
400
|
+
const matches = s.matches;
|
|
401
|
+
const parentMatch = matches.find((d) => d.id === matchId);
|
|
402
|
+
invariant(
|
|
403
|
+
parentMatch
|
|
404
|
+
);
|
|
405
|
+
return parentMatch.globalNotFound;
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
const childMatchId = useRouterState({
|
|
409
|
+
select: (s) => {
|
|
410
|
+
const matches = s.matches;
|
|
411
|
+
const index = matches.findIndex((d) => d.id === matchId);
|
|
412
|
+
return matches[index + 1]?.id;
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
const pendingElement = router.options.defaultPendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.defaultPendingComponent, {}) : null;
|
|
416
|
+
if (parentGlobalNotFound) {
|
|
417
|
+
return renderRouteNotFound(router, route, void 0);
|
|
418
|
+
}
|
|
419
|
+
if (!childMatchId) {
|
|
420
|
+
return null;
|
|
421
|
+
}
|
|
422
|
+
const nextMatch = /* @__PURE__ */ jsxRuntimeExports.jsx(Match, { matchId: childMatchId });
|
|
423
|
+
if (routeId === rootRouteId) {
|
|
424
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: pendingElement, children: nextMatch });
|
|
425
|
+
}
|
|
426
|
+
return nextMatch;
|
|
427
|
+
});
|
|
428
|
+
function Matches() {
|
|
429
|
+
const router = useRouter();
|
|
430
|
+
const rootRoute = router.routesById[rootRouteId];
|
|
431
|
+
const PendingComponent = rootRoute.options.pendingComponent ?? router.options.defaultPendingComponent;
|
|
432
|
+
const pendingElement = PendingComponent ? /* @__PURE__ */ jsxRuntimeExports.jsx(PendingComponent, {}) : null;
|
|
433
|
+
const ResolvedSuspense = SafeFragment;
|
|
434
|
+
const inner = /* @__PURE__ */ jsxRuntimeExports.jsxs(ResolvedSuspense, { fallback: pendingElement, children: [
|
|
435
|
+
false,
|
|
436
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MatchesInner, {})
|
|
437
|
+
] });
|
|
438
|
+
return router.options.InnerWrap ? /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.InnerWrap, { children: inner }) : inner;
|
|
439
|
+
}
|
|
440
|
+
function MatchesInner() {
|
|
441
|
+
const router = useRouter();
|
|
442
|
+
const matchId = useRouterState({
|
|
443
|
+
select: (s) => {
|
|
444
|
+
return s.matches[0]?.id;
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
const resetKey = useRouterState({
|
|
448
|
+
select: (s) => s.loadedAt
|
|
449
|
+
});
|
|
450
|
+
const matchComponent = matchId ? /* @__PURE__ */ jsxRuntimeExports.jsx(Match, { matchId }) : null;
|
|
451
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(matchContext.Provider, { value: matchId, children: router.options.disableGlobalCatchBoundary ? matchComponent : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
452
|
+
CatchBoundary,
|
|
453
|
+
{
|
|
454
|
+
getResetKey: () => resetKey,
|
|
455
|
+
errorComponent: ErrorComponent,
|
|
456
|
+
onCatch: void 0,
|
|
457
|
+
children: matchComponent
|
|
458
|
+
}
|
|
459
|
+
) });
|
|
460
|
+
}
|
|
461
|
+
function RouterContextProvider({
|
|
462
|
+
router,
|
|
463
|
+
children,
|
|
464
|
+
...rest
|
|
465
|
+
}) {
|
|
466
|
+
if (Object.keys(rest).length > 0) {
|
|
467
|
+
router.update({
|
|
468
|
+
...router.options,
|
|
469
|
+
...rest,
|
|
470
|
+
context: {
|
|
471
|
+
...router.options.context,
|
|
472
|
+
...rest.context
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
const provider = /* @__PURE__ */ jsxRuntimeExports.jsx(routerContext.Provider, { value: router, children });
|
|
477
|
+
if (router.options.Wrap) {
|
|
478
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(router.options.Wrap, { children: provider });
|
|
479
|
+
}
|
|
480
|
+
return provider;
|
|
481
|
+
}
|
|
482
|
+
function RouterProvider({ router, ...rest }) {
|
|
483
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(RouterContextProvider, { router, ...rest, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Matches, {}) });
|
|
484
|
+
}
|
|
485
|
+
const renderRouterToStream = async ({
|
|
486
|
+
request,
|
|
487
|
+
router,
|
|
488
|
+
responseHeaders,
|
|
489
|
+
children
|
|
490
|
+
}) => {
|
|
491
|
+
if (typeof ReactDOMServer.renderToReadableStream === "function") {
|
|
492
|
+
const stream = await ReactDOMServer.renderToReadableStream(children, {
|
|
493
|
+
signal: request.signal,
|
|
494
|
+
nonce: router.options.ssr?.nonce,
|
|
495
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY
|
|
496
|
+
});
|
|
497
|
+
if (isbot(request.headers.get("User-Agent"))) {
|
|
498
|
+
await stream.allReady;
|
|
499
|
+
}
|
|
500
|
+
const responseStream = transformReadableStreamWithRouter(
|
|
501
|
+
router,
|
|
502
|
+
stream
|
|
503
|
+
);
|
|
504
|
+
return new Response(responseStream, {
|
|
505
|
+
status: router.state.statusCode,
|
|
506
|
+
headers: responseHeaders
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
if (typeof ReactDOMServer.renderToPipeableStream === "function") {
|
|
510
|
+
const reactAppPassthrough = new PassThrough();
|
|
511
|
+
try {
|
|
512
|
+
const pipeable = ReactDOMServer.renderToPipeableStream(children, {
|
|
513
|
+
nonce: router.options.ssr?.nonce,
|
|
514
|
+
progressiveChunkSize: Number.POSITIVE_INFINITY,
|
|
515
|
+
...isbot(request.headers.get("User-Agent")) ? {
|
|
516
|
+
onAllReady() {
|
|
517
|
+
pipeable.pipe(reactAppPassthrough);
|
|
518
|
+
}
|
|
519
|
+
} : {
|
|
520
|
+
onShellReady() {
|
|
521
|
+
pipeable.pipe(reactAppPassthrough);
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
onError: (error, info) => {
|
|
525
|
+
console.error("Error in renderToPipeableStream:", error, info);
|
|
526
|
+
if (!reactAppPassthrough.destroyed) {
|
|
527
|
+
reactAppPassthrough.destroy(
|
|
528
|
+
error instanceof Error ? error : new Error(String(error))
|
|
529
|
+
);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
} catch (e) {
|
|
534
|
+
console.error("Error in renderToPipeableStream:", e);
|
|
535
|
+
reactAppPassthrough.destroy(e instanceof Error ? e : new Error(String(e)));
|
|
536
|
+
}
|
|
537
|
+
const responseStream = transformPipeableStreamWithRouter(
|
|
538
|
+
router,
|
|
539
|
+
reactAppPassthrough
|
|
540
|
+
);
|
|
541
|
+
return new Response(responseStream, {
|
|
542
|
+
status: router.state.statusCode,
|
|
543
|
+
headers: responseHeaders
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
throw new Error(
|
|
547
|
+
"No renderToReadableStream or renderToPipeableStream found in react-dom/server. Ensure you are using a version of react-dom that supports streaming."
|
|
548
|
+
);
|
|
549
|
+
};
|
|
550
|
+
function useMatch(opts) {
|
|
551
|
+
const nearestMatchId = reactExports.useContext(
|
|
552
|
+
opts.from ? dummyMatchContext : matchContext
|
|
553
|
+
);
|
|
554
|
+
const matchSelection = useRouterState({
|
|
555
|
+
select: (state) => {
|
|
556
|
+
const match = state.matches.find(
|
|
557
|
+
(d) => opts.from ? opts.from === d.routeId : d.id === nearestMatchId
|
|
558
|
+
);
|
|
559
|
+
invariant(
|
|
560
|
+
!((opts.shouldThrow ?? true) && !match),
|
|
561
|
+
`Could not find ${opts.from ? `an active match from "${opts.from}"` : "a nearest match!"}`
|
|
562
|
+
);
|
|
563
|
+
if (match === void 0) {
|
|
564
|
+
return void 0;
|
|
565
|
+
}
|
|
566
|
+
return opts.select ? opts.select(match) : match;
|
|
567
|
+
},
|
|
568
|
+
structuralSharing: opts.structuralSharing
|
|
569
|
+
});
|
|
570
|
+
return matchSelection;
|
|
571
|
+
}
|
|
572
|
+
function useLoaderData(opts) {
|
|
573
|
+
return useMatch({
|
|
574
|
+
from: opts.from,
|
|
575
|
+
strict: opts.strict,
|
|
576
|
+
structuralSharing: opts.structuralSharing,
|
|
577
|
+
select: (s) => {
|
|
578
|
+
return opts.select ? opts.select(s.loaderData) : s.loaderData;
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
function useLoaderDeps(opts) {
|
|
583
|
+
const { select, ...rest } = opts;
|
|
584
|
+
return useMatch({
|
|
585
|
+
...rest,
|
|
586
|
+
select: (s) => {
|
|
587
|
+
return select ? select(s.loaderDeps) : s.loaderDeps;
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
}
|
|
591
|
+
function useParams(opts) {
|
|
592
|
+
return useMatch({
|
|
593
|
+
from: opts.from,
|
|
594
|
+
shouldThrow: opts.shouldThrow,
|
|
595
|
+
structuralSharing: opts.structuralSharing,
|
|
596
|
+
strict: opts.strict,
|
|
597
|
+
select: (match) => {
|
|
598
|
+
const params = opts.strict === false ? match.params : match._strictParams;
|
|
599
|
+
return opts.select ? opts.select(params) : params;
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
function useSearch(opts) {
|
|
604
|
+
return useMatch({
|
|
605
|
+
from: opts.from,
|
|
606
|
+
strict: opts.strict,
|
|
607
|
+
shouldThrow: opts.shouldThrow,
|
|
608
|
+
structuralSharing: opts.structuralSharing,
|
|
609
|
+
select: (match) => {
|
|
610
|
+
return opts.select ? opts.select(match.search) : match.search;
|
|
611
|
+
}
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
function useNavigate(_defaultOpts) {
|
|
615
|
+
const router = useRouter();
|
|
616
|
+
return reactExports.useCallback(
|
|
617
|
+
(options) => {
|
|
618
|
+
return router.navigate({
|
|
619
|
+
...options,
|
|
620
|
+
from: options.from ?? _defaultOpts?.from
|
|
621
|
+
});
|
|
622
|
+
},
|
|
623
|
+
[_defaultOpts?.from, router]
|
|
624
|
+
);
|
|
625
|
+
}
|
|
626
|
+
function useLinkProps(options, forwardedRef) {
|
|
627
|
+
const router = useRouter();
|
|
628
|
+
const innerRef = useForwardedRef(forwardedRef);
|
|
629
|
+
const {
|
|
630
|
+
// custom props
|
|
631
|
+
activeProps,
|
|
632
|
+
inactiveProps,
|
|
633
|
+
activeOptions,
|
|
634
|
+
to,
|
|
635
|
+
preload: userPreload,
|
|
636
|
+
preloadDelay: userPreloadDelay,
|
|
637
|
+
hashScrollIntoView,
|
|
638
|
+
replace,
|
|
639
|
+
startTransition,
|
|
640
|
+
resetScroll,
|
|
641
|
+
viewTransition,
|
|
642
|
+
// element props
|
|
643
|
+
children,
|
|
644
|
+
target,
|
|
645
|
+
disabled,
|
|
646
|
+
style,
|
|
647
|
+
className,
|
|
648
|
+
onClick,
|
|
649
|
+
onBlur,
|
|
650
|
+
onFocus,
|
|
651
|
+
onMouseEnter,
|
|
652
|
+
onMouseLeave,
|
|
653
|
+
onTouchStart,
|
|
654
|
+
ignoreBlocker,
|
|
655
|
+
// prevent these from being returned
|
|
656
|
+
params: _params,
|
|
657
|
+
search: _search,
|
|
658
|
+
hash: _hash,
|
|
659
|
+
state: _state,
|
|
660
|
+
mask: _mask,
|
|
661
|
+
reloadDocument: _reloadDocument,
|
|
662
|
+
unsafeRelative: _unsafeRelative,
|
|
663
|
+
from: _from,
|
|
664
|
+
_fromLocation,
|
|
665
|
+
...propsSafeToSpread
|
|
666
|
+
} = options;
|
|
667
|
+
{
|
|
668
|
+
const safeInternal = isSafeInternal(to);
|
|
669
|
+
if (typeof to === "string" && !safeInternal && // Quick checks to avoid `new URL` in common internal-like cases
|
|
670
|
+
to.indexOf(":") > -1) {
|
|
671
|
+
try {
|
|
672
|
+
new URL(to);
|
|
673
|
+
if (isDangerousProtocol(to, router.protocolAllowlist)) {
|
|
674
|
+
if (false) ;
|
|
675
|
+
return {
|
|
676
|
+
...propsSafeToSpread,
|
|
677
|
+
ref: innerRef,
|
|
678
|
+
href: void 0,
|
|
679
|
+
...children && { children },
|
|
680
|
+
...target && { target },
|
|
681
|
+
...disabled && { disabled },
|
|
682
|
+
...style && { style },
|
|
683
|
+
...className && { className }
|
|
684
|
+
};
|
|
685
|
+
}
|
|
686
|
+
return {
|
|
687
|
+
...propsSafeToSpread,
|
|
688
|
+
ref: innerRef,
|
|
689
|
+
href: to,
|
|
690
|
+
...children && { children },
|
|
691
|
+
...target && { target },
|
|
692
|
+
...disabled && { disabled },
|
|
693
|
+
...style && { style },
|
|
694
|
+
...className && { className }
|
|
695
|
+
};
|
|
696
|
+
} catch {
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
const next2 = router.buildLocation({ ...options, from: options.from });
|
|
700
|
+
const hrefOptionPublicHref2 = next2.maskedLocation ? next2.maskedLocation.publicHref : next2.publicHref;
|
|
701
|
+
const hrefOptionExternal2 = next2.maskedLocation ? next2.maskedLocation.external : next2.external;
|
|
702
|
+
const hrefOption2 = getHrefOption(
|
|
703
|
+
hrefOptionPublicHref2,
|
|
704
|
+
hrefOptionExternal2,
|
|
705
|
+
router.history,
|
|
706
|
+
disabled
|
|
707
|
+
);
|
|
708
|
+
const externalLink2 = (() => {
|
|
709
|
+
if (hrefOption2?.external) {
|
|
710
|
+
if (isDangerousProtocol(hrefOption2.href, router.protocolAllowlist)) {
|
|
711
|
+
return void 0;
|
|
712
|
+
}
|
|
713
|
+
return hrefOption2.href;
|
|
714
|
+
}
|
|
715
|
+
if (safeInternal) return void 0;
|
|
716
|
+
if (typeof to === "string" && to.indexOf(":") > -1) {
|
|
717
|
+
try {
|
|
718
|
+
new URL(to);
|
|
719
|
+
if (isDangerousProtocol(to, router.protocolAllowlist)) {
|
|
720
|
+
if (false) ;
|
|
721
|
+
return void 0;
|
|
722
|
+
}
|
|
723
|
+
return to;
|
|
724
|
+
} catch {
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
return void 0;
|
|
728
|
+
})();
|
|
729
|
+
const isActive2 = (() => {
|
|
730
|
+
if (externalLink2) return false;
|
|
731
|
+
const currentLocation = router.state.location;
|
|
732
|
+
const exact = activeOptions?.exact ?? false;
|
|
733
|
+
if (exact) {
|
|
734
|
+
const testExact = exactPathTest(
|
|
735
|
+
currentLocation.pathname,
|
|
736
|
+
next2.pathname,
|
|
737
|
+
router.basepath
|
|
738
|
+
);
|
|
739
|
+
if (!testExact) {
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
} else {
|
|
743
|
+
const currentPathSplit = removeTrailingSlash(
|
|
744
|
+
currentLocation.pathname,
|
|
745
|
+
router.basepath
|
|
746
|
+
);
|
|
747
|
+
const nextPathSplit = removeTrailingSlash(
|
|
748
|
+
next2.pathname,
|
|
749
|
+
router.basepath
|
|
750
|
+
);
|
|
751
|
+
const pathIsFuzzyEqual = currentPathSplit.startsWith(nextPathSplit) && (currentPathSplit.length === nextPathSplit.length || currentPathSplit[nextPathSplit.length] === "/");
|
|
752
|
+
if (!pathIsFuzzyEqual) {
|
|
753
|
+
return false;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
const includeSearch = activeOptions?.includeSearch ?? true;
|
|
757
|
+
if (includeSearch) {
|
|
758
|
+
if (currentLocation.search !== next2.search) {
|
|
759
|
+
const currentSearchEmpty = !currentLocation.search || typeof currentLocation.search === "object" && Object.keys(currentLocation.search).length === 0;
|
|
760
|
+
const nextSearchEmpty = !next2.search || typeof next2.search === "object" && Object.keys(next2.search).length === 0;
|
|
761
|
+
if (!(currentSearchEmpty && nextSearchEmpty)) {
|
|
762
|
+
const searchTest = deepEqual(currentLocation.search, next2.search, {
|
|
763
|
+
partial: !exact,
|
|
764
|
+
ignoreUndefined: !activeOptions?.explicitUndefined
|
|
765
|
+
});
|
|
766
|
+
if (!searchTest) {
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
if (activeOptions?.includeHash) {
|
|
773
|
+
return false;
|
|
774
|
+
}
|
|
775
|
+
return true;
|
|
776
|
+
})();
|
|
777
|
+
if (externalLink2) {
|
|
778
|
+
return {
|
|
779
|
+
...propsSafeToSpread,
|
|
780
|
+
ref: innerRef,
|
|
781
|
+
href: externalLink2,
|
|
782
|
+
...children && { children },
|
|
783
|
+
...target && { target },
|
|
784
|
+
...disabled && { disabled },
|
|
785
|
+
...style && { style },
|
|
786
|
+
...className && { className }
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
const resolvedActiveProps2 = isActive2 ? functionalUpdate(activeProps, {}) ?? STATIC_ACTIVE_OBJECT : STATIC_EMPTY_OBJECT;
|
|
790
|
+
const resolvedInactiveProps2 = isActive2 ? STATIC_EMPTY_OBJECT : functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT;
|
|
791
|
+
const resolvedStyle2 = (() => {
|
|
792
|
+
const baseStyle = style;
|
|
793
|
+
const activeStyle = resolvedActiveProps2.style;
|
|
794
|
+
const inactiveStyle = resolvedInactiveProps2.style;
|
|
795
|
+
if (!baseStyle && !activeStyle && !inactiveStyle) {
|
|
796
|
+
return void 0;
|
|
797
|
+
}
|
|
798
|
+
if (baseStyle && !activeStyle && !inactiveStyle) {
|
|
799
|
+
return baseStyle;
|
|
800
|
+
}
|
|
801
|
+
if (!baseStyle && activeStyle && !inactiveStyle) {
|
|
802
|
+
return activeStyle;
|
|
803
|
+
}
|
|
804
|
+
if (!baseStyle && !activeStyle && inactiveStyle) {
|
|
805
|
+
return inactiveStyle;
|
|
806
|
+
}
|
|
807
|
+
return {
|
|
808
|
+
...baseStyle,
|
|
809
|
+
...activeStyle,
|
|
810
|
+
...inactiveStyle
|
|
811
|
+
};
|
|
812
|
+
})();
|
|
813
|
+
const resolvedClassName2 = (() => {
|
|
814
|
+
const baseClassName = className;
|
|
815
|
+
const activeClassName = resolvedActiveProps2.className;
|
|
816
|
+
const inactiveClassName = resolvedInactiveProps2.className;
|
|
817
|
+
if (!baseClassName && !activeClassName && !inactiveClassName) {
|
|
818
|
+
return "";
|
|
819
|
+
}
|
|
820
|
+
let out = "";
|
|
821
|
+
if (baseClassName) {
|
|
822
|
+
out = baseClassName;
|
|
823
|
+
}
|
|
824
|
+
if (activeClassName) {
|
|
825
|
+
out = out ? `${out} ${activeClassName}` : activeClassName;
|
|
826
|
+
}
|
|
827
|
+
if (inactiveClassName) {
|
|
828
|
+
out = out ? `${out} ${inactiveClassName}` : inactiveClassName;
|
|
829
|
+
}
|
|
830
|
+
return out;
|
|
831
|
+
})();
|
|
832
|
+
return {
|
|
833
|
+
...propsSafeToSpread,
|
|
834
|
+
...resolvedActiveProps2,
|
|
835
|
+
...resolvedInactiveProps2,
|
|
836
|
+
href: hrefOption2?.href,
|
|
837
|
+
ref: innerRef,
|
|
838
|
+
disabled: !!disabled,
|
|
839
|
+
target,
|
|
840
|
+
...resolvedStyle2 && { style: resolvedStyle2 },
|
|
841
|
+
...resolvedClassName2 && { className: resolvedClassName2 },
|
|
842
|
+
...disabled && STATIC_DISABLED_PROPS,
|
|
843
|
+
...isActive2 && STATIC_ACTIVE_PROPS
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
const STATIC_EMPTY_OBJECT = {};
|
|
848
|
+
const STATIC_ACTIVE_OBJECT = { className: "active" };
|
|
849
|
+
const STATIC_DISABLED_PROPS = { role: "link", "aria-disabled": true };
|
|
850
|
+
const STATIC_ACTIVE_PROPS = { "data-status": "active", "aria-current": "page" };
|
|
851
|
+
function getHrefOption(publicHref, external, history, disabled) {
|
|
852
|
+
if (disabled) return void 0;
|
|
853
|
+
if (external) {
|
|
854
|
+
return { href: publicHref, external: true };
|
|
855
|
+
}
|
|
856
|
+
return {
|
|
857
|
+
href: history.createHref(publicHref) || "/",
|
|
858
|
+
external: false
|
|
859
|
+
};
|
|
860
|
+
}
|
|
861
|
+
function isSafeInternal(to) {
|
|
862
|
+
if (typeof to !== "string") return false;
|
|
863
|
+
const zero = to.charCodeAt(0);
|
|
864
|
+
if (zero === 47) return to.charCodeAt(1) !== 47;
|
|
865
|
+
return zero === 46;
|
|
866
|
+
}
|
|
867
|
+
const Link = reactExports.forwardRef(
|
|
868
|
+
(props, ref) => {
|
|
869
|
+
const { _asChild, ...rest } = props;
|
|
870
|
+
const { type: _type, ...linkProps } = useLinkProps(rest, ref);
|
|
871
|
+
const children = typeof rest.children === "function" ? rest.children({
|
|
872
|
+
isActive: linkProps["data-status"] === "active"
|
|
873
|
+
}) : rest.children;
|
|
874
|
+
if (!_asChild) {
|
|
875
|
+
const { disabled: _, ...rest2 } = linkProps;
|
|
876
|
+
return reactExports.createElement("a", rest2, children);
|
|
877
|
+
}
|
|
878
|
+
return reactExports.createElement(_asChild, linkProps, children);
|
|
879
|
+
}
|
|
880
|
+
);
|
|
881
|
+
class Route extends BaseRoute {
|
|
882
|
+
/**
|
|
883
|
+
* @deprecated Use the `createRoute` function instead.
|
|
884
|
+
*/
|
|
885
|
+
constructor(options) {
|
|
886
|
+
super(options);
|
|
887
|
+
this.useMatch = (opts) => {
|
|
888
|
+
return useMatch({
|
|
889
|
+
select: opts?.select,
|
|
890
|
+
from: this.id,
|
|
891
|
+
structuralSharing: opts?.structuralSharing
|
|
892
|
+
});
|
|
893
|
+
};
|
|
894
|
+
this.useRouteContext = (opts) => {
|
|
895
|
+
return useMatch({
|
|
896
|
+
...opts,
|
|
897
|
+
from: this.id,
|
|
898
|
+
select: (d) => opts?.select ? opts.select(d.context) : d.context
|
|
899
|
+
});
|
|
900
|
+
};
|
|
901
|
+
this.useSearch = (opts) => {
|
|
902
|
+
return useSearch({
|
|
903
|
+
select: opts?.select,
|
|
904
|
+
structuralSharing: opts?.structuralSharing,
|
|
905
|
+
from: this.id
|
|
906
|
+
});
|
|
907
|
+
};
|
|
908
|
+
this.useParams = (opts) => {
|
|
909
|
+
return useParams({
|
|
910
|
+
select: opts?.select,
|
|
911
|
+
structuralSharing: opts?.structuralSharing,
|
|
912
|
+
from: this.id
|
|
913
|
+
});
|
|
914
|
+
};
|
|
915
|
+
this.useLoaderDeps = (opts) => {
|
|
916
|
+
return useLoaderDeps({ ...opts, from: this.id });
|
|
917
|
+
};
|
|
918
|
+
this.useLoaderData = (opts) => {
|
|
919
|
+
return useLoaderData({ ...opts, from: this.id });
|
|
920
|
+
};
|
|
921
|
+
this.useNavigate = () => {
|
|
922
|
+
return useNavigate({ from: this.fullPath });
|
|
923
|
+
};
|
|
924
|
+
this.Link = React$1.forwardRef(
|
|
925
|
+
(props, ref) => {
|
|
926
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ref, from: this.fullPath, ...props });
|
|
927
|
+
}
|
|
928
|
+
);
|
|
929
|
+
this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
function createRoute(options) {
|
|
933
|
+
return new Route(
|
|
934
|
+
// TODO: Help us TypeChris, you're our only hope!
|
|
935
|
+
options
|
|
936
|
+
);
|
|
937
|
+
}
|
|
938
|
+
class RootRoute extends BaseRootRoute {
|
|
939
|
+
/**
|
|
940
|
+
* @deprecated `RootRoute` is now an internal implementation detail. Use `createRootRoute()` instead.
|
|
941
|
+
*/
|
|
942
|
+
constructor(options) {
|
|
943
|
+
super(options);
|
|
944
|
+
this.useMatch = (opts) => {
|
|
945
|
+
return useMatch({
|
|
946
|
+
select: opts?.select,
|
|
947
|
+
from: this.id,
|
|
948
|
+
structuralSharing: opts?.structuralSharing
|
|
949
|
+
});
|
|
950
|
+
};
|
|
951
|
+
this.useRouteContext = (opts) => {
|
|
952
|
+
return useMatch({
|
|
953
|
+
...opts,
|
|
954
|
+
from: this.id,
|
|
955
|
+
select: (d) => opts?.select ? opts.select(d.context) : d.context
|
|
956
|
+
});
|
|
957
|
+
};
|
|
958
|
+
this.useSearch = (opts) => {
|
|
959
|
+
return useSearch({
|
|
960
|
+
select: opts?.select,
|
|
961
|
+
structuralSharing: opts?.structuralSharing,
|
|
962
|
+
from: this.id
|
|
963
|
+
});
|
|
964
|
+
};
|
|
965
|
+
this.useParams = (opts) => {
|
|
966
|
+
return useParams({
|
|
967
|
+
select: opts?.select,
|
|
968
|
+
structuralSharing: opts?.structuralSharing,
|
|
969
|
+
from: this.id
|
|
970
|
+
});
|
|
971
|
+
};
|
|
972
|
+
this.useLoaderDeps = (opts) => {
|
|
973
|
+
return useLoaderDeps({ ...opts, from: this.id });
|
|
974
|
+
};
|
|
975
|
+
this.useLoaderData = (opts) => {
|
|
976
|
+
return useLoaderData({ ...opts, from: this.id });
|
|
977
|
+
};
|
|
978
|
+
this.useNavigate = () => {
|
|
979
|
+
return useNavigate({ from: this.fullPath });
|
|
980
|
+
};
|
|
981
|
+
this.Link = React$1.forwardRef(
|
|
982
|
+
(props, ref) => {
|
|
983
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Link, { ref, from: this.fullPath, ...props });
|
|
984
|
+
}
|
|
985
|
+
);
|
|
986
|
+
this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
function createRootRoute(options) {
|
|
990
|
+
return new RootRoute(options);
|
|
991
|
+
}
|
|
992
|
+
function createFileRoute(path) {
|
|
993
|
+
if (typeof path === "object") {
|
|
994
|
+
return new FileRoute(path, {
|
|
995
|
+
silent: true
|
|
996
|
+
}).createRoute(path);
|
|
997
|
+
}
|
|
998
|
+
return new FileRoute(path, {
|
|
999
|
+
silent: true
|
|
1000
|
+
}).createRoute;
|
|
1001
|
+
}
|
|
1002
|
+
class FileRoute {
|
|
1003
|
+
constructor(path, _opts) {
|
|
1004
|
+
this.path = path;
|
|
1005
|
+
this.createRoute = (options) => {
|
|
1006
|
+
const route = createRoute(options);
|
|
1007
|
+
route.isRoot = false;
|
|
1008
|
+
return route;
|
|
1009
|
+
};
|
|
1010
|
+
this.silent = _opts?.silent;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
class LazyRoute {
|
|
1014
|
+
constructor(opts) {
|
|
1015
|
+
this.useMatch = (opts2) => {
|
|
1016
|
+
return useMatch({
|
|
1017
|
+
select: opts2?.select,
|
|
1018
|
+
from: this.options.id,
|
|
1019
|
+
structuralSharing: opts2?.structuralSharing
|
|
1020
|
+
});
|
|
1021
|
+
};
|
|
1022
|
+
this.useRouteContext = (opts2) => {
|
|
1023
|
+
return useMatch({
|
|
1024
|
+
from: this.options.id,
|
|
1025
|
+
select: (d) => opts2?.select ? opts2.select(d.context) : d.context
|
|
1026
|
+
});
|
|
1027
|
+
};
|
|
1028
|
+
this.useSearch = (opts2) => {
|
|
1029
|
+
return useSearch({
|
|
1030
|
+
select: opts2?.select,
|
|
1031
|
+
structuralSharing: opts2?.structuralSharing,
|
|
1032
|
+
from: this.options.id
|
|
1033
|
+
});
|
|
1034
|
+
};
|
|
1035
|
+
this.useParams = (opts2) => {
|
|
1036
|
+
return useParams({
|
|
1037
|
+
select: opts2?.select,
|
|
1038
|
+
structuralSharing: opts2?.structuralSharing,
|
|
1039
|
+
from: this.options.id
|
|
1040
|
+
});
|
|
1041
|
+
};
|
|
1042
|
+
this.useLoaderDeps = (opts2) => {
|
|
1043
|
+
return useLoaderDeps({ ...opts2, from: this.options.id });
|
|
1044
|
+
};
|
|
1045
|
+
this.useLoaderData = (opts2) => {
|
|
1046
|
+
return useLoaderData({ ...opts2, from: this.options.id });
|
|
1047
|
+
};
|
|
1048
|
+
this.useNavigate = () => {
|
|
1049
|
+
const router = useRouter();
|
|
1050
|
+
return useNavigate({ from: router.routesById[this.options.id].fullPath });
|
|
1051
|
+
};
|
|
1052
|
+
this.options = opts;
|
|
1053
|
+
this.$$typeof = /* @__PURE__ */ Symbol.for("react.memo");
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
function createLazyFileRoute(id) {
|
|
1057
|
+
if (typeof id === "object") {
|
|
1058
|
+
return new LazyRoute(id);
|
|
1059
|
+
}
|
|
1060
|
+
return (opts) => new LazyRoute({ id, ...opts });
|
|
1061
|
+
}
|
|
1062
|
+
function lazyRouteComponent(importer, exportName) {
|
|
1063
|
+
let loadPromise;
|
|
1064
|
+
let comp;
|
|
1065
|
+
let error;
|
|
1066
|
+
let reload;
|
|
1067
|
+
const load = () => {
|
|
1068
|
+
if (!loadPromise) {
|
|
1069
|
+
loadPromise = importer().then((res) => {
|
|
1070
|
+
loadPromise = void 0;
|
|
1071
|
+
comp = res[exportName];
|
|
1072
|
+
}).catch((err) => {
|
|
1073
|
+
error = err;
|
|
1074
|
+
if (isModuleNotFoundError(error)) {
|
|
1075
|
+
if (error instanceof Error && typeof window !== "undefined" && typeof sessionStorage !== "undefined") {
|
|
1076
|
+
const storageKey2 = `tanstack_router_reload:${error.message}`;
|
|
1077
|
+
if (!sessionStorage.getItem(storageKey2)) {
|
|
1078
|
+
sessionStorage.setItem(storageKey2, "1");
|
|
1079
|
+
reload = true;
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
return loadPromise;
|
|
1086
|
+
};
|
|
1087
|
+
const lazyComp = function Lazy(props) {
|
|
1088
|
+
if (reload) {
|
|
1089
|
+
window.location.reload();
|
|
1090
|
+
throw new Promise(() => {
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
if (error) {
|
|
1094
|
+
throw error;
|
|
1095
|
+
}
|
|
1096
|
+
if (!comp) {
|
|
1097
|
+
if (reactUse) {
|
|
1098
|
+
reactUse(load());
|
|
1099
|
+
} else {
|
|
1100
|
+
throw load();
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
return reactExports.createElement(comp, props);
|
|
1104
|
+
};
|
|
1105
|
+
lazyComp.preload = load;
|
|
1106
|
+
return lazyComp;
|
|
1107
|
+
}
|
|
1108
|
+
const createRouter = (options) => {
|
|
1109
|
+
return new Router(options);
|
|
1110
|
+
};
|
|
1111
|
+
class Router extends RouterCore {
|
|
1112
|
+
constructor(options) {
|
|
1113
|
+
super(options);
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
if (typeof globalThis !== "undefined") {
|
|
1117
|
+
globalThis.createFileRoute = createFileRoute;
|
|
1118
|
+
globalThis.createLazyFileRoute = createLazyFileRoute;
|
|
1119
|
+
} else if (typeof window !== "undefined") {
|
|
1120
|
+
window.createFileRoute = createFileRoute;
|
|
1121
|
+
window.createLazyFileRoute = createLazyFileRoute;
|
|
1122
|
+
}
|
|
1123
|
+
function Asset({
|
|
1124
|
+
tag,
|
|
1125
|
+
attrs,
|
|
1126
|
+
children,
|
|
1127
|
+
nonce
|
|
1128
|
+
}) {
|
|
1129
|
+
switch (tag) {
|
|
1130
|
+
case "title":
|
|
1131
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("title", { ...attrs, suppressHydrationWarning: true, children });
|
|
1132
|
+
case "meta":
|
|
1133
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("meta", { ...attrs, suppressHydrationWarning: true });
|
|
1134
|
+
case "link":
|
|
1135
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("link", { ...attrs, nonce, suppressHydrationWarning: true });
|
|
1136
|
+
case "style":
|
|
1137
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1138
|
+
"style",
|
|
1139
|
+
{
|
|
1140
|
+
...attrs,
|
|
1141
|
+
dangerouslySetInnerHTML: { __html: children },
|
|
1142
|
+
nonce
|
|
1143
|
+
}
|
|
1144
|
+
);
|
|
1145
|
+
case "script":
|
|
1146
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Script, { attrs, children });
|
|
1147
|
+
default:
|
|
1148
|
+
return null;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
function Script({
|
|
1152
|
+
attrs,
|
|
1153
|
+
children
|
|
1154
|
+
}) {
|
|
1155
|
+
useRouter();
|
|
1156
|
+
useHydrated();
|
|
1157
|
+
const dataScript = typeof attrs?.type === "string" && attrs.type !== "" && attrs.type !== "text/javascript" && attrs.type !== "module";
|
|
1158
|
+
reactExports.useEffect(() => {
|
|
1159
|
+
if (dataScript) return;
|
|
1160
|
+
if (attrs?.src) {
|
|
1161
|
+
const normSrc = (() => {
|
|
1162
|
+
try {
|
|
1163
|
+
const base = document.baseURI || window.location.href;
|
|
1164
|
+
return new URL(attrs.src, base).href;
|
|
1165
|
+
} catch {
|
|
1166
|
+
return attrs.src;
|
|
1167
|
+
}
|
|
1168
|
+
})();
|
|
1169
|
+
const existingScript = Array.from(
|
|
1170
|
+
document.querySelectorAll("script[src]")
|
|
1171
|
+
).find((el) => el.src === normSrc);
|
|
1172
|
+
if (existingScript) {
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
const script = document.createElement("script");
|
|
1176
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
1177
|
+
if (key !== "suppressHydrationWarning" && value !== void 0 && value !== false) {
|
|
1178
|
+
script.setAttribute(
|
|
1179
|
+
key,
|
|
1180
|
+
typeof value === "boolean" ? "" : String(value)
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
document.head.appendChild(script);
|
|
1185
|
+
return () => {
|
|
1186
|
+
if (script.parentNode) {
|
|
1187
|
+
script.parentNode.removeChild(script);
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
}
|
|
1191
|
+
if (typeof children === "string") {
|
|
1192
|
+
const typeAttr = typeof attrs?.type === "string" ? attrs.type : "text/javascript";
|
|
1193
|
+
const nonceAttr = typeof attrs?.nonce === "string" ? attrs.nonce : void 0;
|
|
1194
|
+
const existingScript = Array.from(
|
|
1195
|
+
document.querySelectorAll("script:not([src])")
|
|
1196
|
+
).find((el) => {
|
|
1197
|
+
if (!(el instanceof HTMLScriptElement)) return false;
|
|
1198
|
+
const sType = el.getAttribute("type") ?? "text/javascript";
|
|
1199
|
+
const sNonce = el.getAttribute("nonce") ?? void 0;
|
|
1200
|
+
return el.textContent === children && sType === typeAttr && sNonce === nonceAttr;
|
|
1201
|
+
});
|
|
1202
|
+
if (existingScript) {
|
|
1203
|
+
return;
|
|
1204
|
+
}
|
|
1205
|
+
const script = document.createElement("script");
|
|
1206
|
+
script.textContent = children;
|
|
1207
|
+
if (attrs) {
|
|
1208
|
+
for (const [key, value] of Object.entries(attrs)) {
|
|
1209
|
+
if (key !== "suppressHydrationWarning" && value !== void 0 && value !== false) {
|
|
1210
|
+
script.setAttribute(
|
|
1211
|
+
key,
|
|
1212
|
+
typeof value === "boolean" ? "" : String(value)
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
document.head.appendChild(script);
|
|
1218
|
+
return () => {
|
|
1219
|
+
if (script.parentNode) {
|
|
1220
|
+
script.parentNode.removeChild(script);
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
return void 0;
|
|
1225
|
+
}, [attrs, children, dataScript]);
|
|
1226
|
+
{
|
|
1227
|
+
if (attrs?.src) {
|
|
1228
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("script", { ...attrs, suppressHydrationWarning: true });
|
|
1229
|
+
}
|
|
1230
|
+
if (typeof children === "string") {
|
|
1231
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
1232
|
+
"script",
|
|
1233
|
+
{
|
|
1234
|
+
...attrs,
|
|
1235
|
+
dangerouslySetInnerHTML: { __html: children },
|
|
1236
|
+
suppressHydrationWarning: true
|
|
1237
|
+
}
|
|
1238
|
+
);
|
|
1239
|
+
}
|
|
1240
|
+
return null;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
const useTags = () => {
|
|
1244
|
+
const router = useRouter();
|
|
1245
|
+
const nonce = router.options.ssr?.nonce;
|
|
1246
|
+
const routeMeta = useRouterState({
|
|
1247
|
+
select: (state) => {
|
|
1248
|
+
return state.matches.map((match) => match.meta).filter(Boolean);
|
|
1249
|
+
}
|
|
1250
|
+
});
|
|
1251
|
+
const meta = reactExports.useMemo(() => {
|
|
1252
|
+
const resultMeta = [];
|
|
1253
|
+
const metaByAttribute = {};
|
|
1254
|
+
let title;
|
|
1255
|
+
for (let i = routeMeta.length - 1; i >= 0; i--) {
|
|
1256
|
+
const metas = routeMeta[i];
|
|
1257
|
+
for (let j = metas.length - 1; j >= 0; j--) {
|
|
1258
|
+
const m = metas[j];
|
|
1259
|
+
if (!m) continue;
|
|
1260
|
+
if (m.title) {
|
|
1261
|
+
if (!title) {
|
|
1262
|
+
title = {
|
|
1263
|
+
tag: "title",
|
|
1264
|
+
children: m.title
|
|
1265
|
+
};
|
|
1266
|
+
}
|
|
1267
|
+
} else if ("script:ld+json" in m) {
|
|
1268
|
+
try {
|
|
1269
|
+
const json = JSON.stringify(m["script:ld+json"]);
|
|
1270
|
+
resultMeta.push({
|
|
1271
|
+
tag: "script",
|
|
1272
|
+
attrs: {
|
|
1273
|
+
type: "application/ld+json"
|
|
1274
|
+
},
|
|
1275
|
+
children: escapeHtml(json)
|
|
1276
|
+
});
|
|
1277
|
+
} catch {
|
|
1278
|
+
}
|
|
1279
|
+
} else {
|
|
1280
|
+
const attribute = m.name ?? m.property;
|
|
1281
|
+
if (attribute) {
|
|
1282
|
+
if (metaByAttribute[attribute]) {
|
|
1283
|
+
continue;
|
|
1284
|
+
} else {
|
|
1285
|
+
metaByAttribute[attribute] = true;
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
resultMeta.push({
|
|
1289
|
+
tag: "meta",
|
|
1290
|
+
attrs: {
|
|
1291
|
+
...m,
|
|
1292
|
+
nonce
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
if (title) {
|
|
1299
|
+
resultMeta.push(title);
|
|
1300
|
+
}
|
|
1301
|
+
if (nonce) {
|
|
1302
|
+
resultMeta.push({
|
|
1303
|
+
tag: "meta",
|
|
1304
|
+
attrs: {
|
|
1305
|
+
property: "csp-nonce",
|
|
1306
|
+
content: nonce
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
resultMeta.reverse();
|
|
1311
|
+
return resultMeta;
|
|
1312
|
+
}, [routeMeta, nonce]);
|
|
1313
|
+
const links = useRouterState({
|
|
1314
|
+
select: (state) => {
|
|
1315
|
+
const constructed = state.matches.map((match) => match.links).filter(Boolean).flat(1).map((link) => ({
|
|
1316
|
+
tag: "link",
|
|
1317
|
+
attrs: {
|
|
1318
|
+
...link,
|
|
1319
|
+
nonce
|
|
1320
|
+
}
|
|
1321
|
+
}));
|
|
1322
|
+
const manifest = router.ssr?.manifest;
|
|
1323
|
+
const assets = state.matches.map((match) => manifest?.routes[match.routeId]?.assets ?? []).filter(Boolean).flat(1).filter((asset) => asset.tag === "link").map(
|
|
1324
|
+
(asset) => ({
|
|
1325
|
+
tag: "link",
|
|
1326
|
+
attrs: {
|
|
1327
|
+
...asset.attrs,
|
|
1328
|
+
suppressHydrationWarning: true,
|
|
1329
|
+
nonce
|
|
1330
|
+
}
|
|
1331
|
+
})
|
|
1332
|
+
);
|
|
1333
|
+
return [...constructed, ...assets];
|
|
1334
|
+
},
|
|
1335
|
+
structuralSharing: true
|
|
1336
|
+
});
|
|
1337
|
+
const preloadLinks = useRouterState({
|
|
1338
|
+
select: (state) => {
|
|
1339
|
+
const preloadLinks2 = [];
|
|
1340
|
+
state.matches.map((match) => router.looseRoutesById[match.routeId]).forEach(
|
|
1341
|
+
(route) => router.ssr?.manifest?.routes[route.id]?.preloads?.filter(Boolean).forEach((preload) => {
|
|
1342
|
+
preloadLinks2.push({
|
|
1343
|
+
tag: "link",
|
|
1344
|
+
attrs: {
|
|
1345
|
+
rel: "modulepreload",
|
|
1346
|
+
href: preload,
|
|
1347
|
+
nonce
|
|
1348
|
+
}
|
|
1349
|
+
});
|
|
1350
|
+
})
|
|
1351
|
+
);
|
|
1352
|
+
return preloadLinks2;
|
|
1353
|
+
},
|
|
1354
|
+
structuralSharing: true
|
|
1355
|
+
});
|
|
1356
|
+
const styles = useRouterState({
|
|
1357
|
+
select: (state) => state.matches.map((match) => match.styles).flat(1).filter(Boolean).map(({ children, ...attrs }) => ({
|
|
1358
|
+
tag: "style",
|
|
1359
|
+
attrs: {
|
|
1360
|
+
...attrs,
|
|
1361
|
+
nonce
|
|
1362
|
+
},
|
|
1363
|
+
children
|
|
1364
|
+
})),
|
|
1365
|
+
structuralSharing: true
|
|
1366
|
+
});
|
|
1367
|
+
const headScripts = useRouterState({
|
|
1368
|
+
select: (state) => state.matches.map((match) => match.headScripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
|
|
1369
|
+
tag: "script",
|
|
1370
|
+
attrs: {
|
|
1371
|
+
...script,
|
|
1372
|
+
nonce
|
|
1373
|
+
},
|
|
1374
|
+
children
|
|
1375
|
+
})),
|
|
1376
|
+
structuralSharing: true
|
|
1377
|
+
});
|
|
1378
|
+
return uniqBy(
|
|
1379
|
+
[
|
|
1380
|
+
...meta,
|
|
1381
|
+
...preloadLinks,
|
|
1382
|
+
...links,
|
|
1383
|
+
...styles,
|
|
1384
|
+
...headScripts
|
|
1385
|
+
],
|
|
1386
|
+
(d) => {
|
|
1387
|
+
return JSON.stringify(d);
|
|
1388
|
+
}
|
|
1389
|
+
);
|
|
1390
|
+
};
|
|
1391
|
+
function uniqBy(arr, fn) {
|
|
1392
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1393
|
+
return arr.filter((item) => {
|
|
1394
|
+
const key = fn(item);
|
|
1395
|
+
if (seen.has(key)) {
|
|
1396
|
+
return false;
|
|
1397
|
+
}
|
|
1398
|
+
seen.add(key);
|
|
1399
|
+
return true;
|
|
1400
|
+
});
|
|
1401
|
+
}
|
|
1402
|
+
function HeadContent() {
|
|
1403
|
+
const tags = useTags();
|
|
1404
|
+
const router = useRouter();
|
|
1405
|
+
const nonce = router.options.ssr?.nonce;
|
|
1406
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: tags.map((tag) => /* @__PURE__ */ reactExports.createElement(Asset, { ...tag, key: `tsr-meta-${JSON.stringify(tag)}`, nonce })) });
|
|
1407
|
+
}
|
|
1408
|
+
const Scripts = () => {
|
|
1409
|
+
const router = useRouter();
|
|
1410
|
+
const nonce = router.options.ssr?.nonce;
|
|
1411
|
+
const assetScripts = useRouterState({
|
|
1412
|
+
select: (state) => {
|
|
1413
|
+
const assetScripts2 = [];
|
|
1414
|
+
const manifest = router.ssr?.manifest;
|
|
1415
|
+
if (!manifest) {
|
|
1416
|
+
return [];
|
|
1417
|
+
}
|
|
1418
|
+
state.matches.map((match) => router.looseRoutesById[match.routeId]).forEach(
|
|
1419
|
+
(route) => manifest.routes[route.id]?.assets?.filter((d) => d.tag === "script").forEach((asset) => {
|
|
1420
|
+
assetScripts2.push({
|
|
1421
|
+
tag: "script",
|
|
1422
|
+
attrs: { ...asset.attrs, nonce },
|
|
1423
|
+
children: asset.children
|
|
1424
|
+
});
|
|
1425
|
+
})
|
|
1426
|
+
);
|
|
1427
|
+
return assetScripts2;
|
|
1428
|
+
},
|
|
1429
|
+
structuralSharing: true
|
|
1430
|
+
});
|
|
1431
|
+
const { scripts } = useRouterState({
|
|
1432
|
+
select: (state) => ({
|
|
1433
|
+
scripts: state.matches.map((match) => match.scripts).flat(1).filter(Boolean).map(({ children, ...script }) => ({
|
|
1434
|
+
tag: "script",
|
|
1435
|
+
attrs: {
|
|
1436
|
+
...script,
|
|
1437
|
+
suppressHydrationWarning: true,
|
|
1438
|
+
nonce
|
|
1439
|
+
},
|
|
1440
|
+
children
|
|
1441
|
+
}))
|
|
1442
|
+
}),
|
|
1443
|
+
structuralSharing: true
|
|
1444
|
+
});
|
|
1445
|
+
let serverBufferedScript = void 0;
|
|
1446
|
+
if (router.serverSsr) {
|
|
1447
|
+
serverBufferedScript = router.serverSsr.takeBufferedScripts();
|
|
1448
|
+
}
|
|
1449
|
+
const allScripts = [...scripts, ...assetScripts];
|
|
1450
|
+
if (serverBufferedScript) {
|
|
1451
|
+
allScripts.unshift(serverBufferedScript);
|
|
1452
|
+
}
|
|
1453
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: allScripts.map((asset, i) => /* @__PURE__ */ reactExports.createElement(Asset, { ...asset, key: `tsr-scripts-${asset.tag}-${i}` })) });
|
|
1454
|
+
};
|
|
1455
|
+
export {
|
|
1456
|
+
HeadContent as H,
|
|
1457
|
+
RouterProvider as R,
|
|
1458
|
+
Scripts as S,
|
|
1459
|
+
createRootRoute as a,
|
|
1460
|
+
createFileRoute as b,
|
|
1461
|
+
createRouter as c,
|
|
1462
|
+
lazyRouteComponent as l,
|
|
1463
|
+
renderRouterToStream as r
|
|
1464
|
+
};
|