@tanstack/react-router 0.0.1-beta.4 → 0.0.1-beta.45

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Tanner Linsley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -16,34 +16,16 @@ function _extends() {
16
16
  _extends = Object.assign ? Object.assign.bind() : function (target) {
17
17
  for (var i = 1; i < arguments.length; i++) {
18
18
  var source = arguments[i];
19
-
20
19
  for (var key in source) {
21
20
  if (Object.prototype.hasOwnProperty.call(source, key)) {
22
21
  target[key] = source[key];
23
22
  }
24
23
  }
25
24
  }
26
-
27
25
  return target;
28
26
  };
29
27
  return _extends.apply(this, arguments);
30
28
  }
31
29
 
32
- function _objectWithoutPropertiesLoose(source, excluded) {
33
- if (source == null) return {};
34
- var target = {};
35
- var sourceKeys = Object.keys(source);
36
- var key, i;
37
-
38
- for (i = 0; i < sourceKeys.length; i++) {
39
- key = sourceKeys[i];
40
- if (excluded.indexOf(key) >= 0) continue;
41
- target[key] = source[key];
42
- }
43
-
44
- return target;
45
- }
46
-
47
30
  exports["extends"] = _extends;
48
- exports.objectWithoutPropertiesLoose = _objectWithoutPropertiesLoose;
49
31
  //# sourceMappingURL=_rollupPluginBabelHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,517 @@
1
+ /**
2
+ * react-router
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ Object.defineProperty(exports, '__esModule', { value: true });
14
+
15
+ var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
16
+ var React = require('react');
17
+ var shim = require('use-sync-external-store/shim');
18
+ var reactivity = require('@solidjs/reactivity');
19
+ var routerCore = require('@tanstack/router-core');
20
+
21
+ function _interopNamespace(e) {
22
+ if (e && e.__esModule) return e;
23
+ var n = Object.create(null);
24
+ if (e) {
25
+ Object.keys(e).forEach(function (k) {
26
+ if (k !== 'default') {
27
+ var d = Object.getOwnPropertyDescriptor(e, k);
28
+ Object.defineProperty(n, k, d.get ? d : {
29
+ enumerable: true,
30
+ get: function () { return e[k]; }
31
+ });
32
+ }
33
+ });
34
+ }
35
+ n["default"] = e;
36
+ return Object.freeze(n);
37
+ }
38
+
39
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
40
+
41
+ function lazy(importer) {
42
+ const lazyComp = /*#__PURE__*/React__namespace.lazy(importer);
43
+ const finalComp = lazyComp;
44
+ finalComp.preload = async () => {
45
+ {
46
+ await importer();
47
+ }
48
+ };
49
+ return finalComp;
50
+ }
51
+ //
52
+
53
+ function useLinkProps(options) {
54
+ const router = useRouter();
55
+ const {
56
+ // custom props
57
+ type,
58
+ children,
59
+ target,
60
+ activeProps = () => ({
61
+ className: 'active'
62
+ }),
63
+ inactiveProps = () => ({}),
64
+ activeOptions,
65
+ disabled,
66
+ // fromCurrent,
67
+ hash,
68
+ search,
69
+ params,
70
+ to,
71
+ preload,
72
+ preloadDelay,
73
+ preloadMaxAge,
74
+ replace,
75
+ // element props
76
+ style,
77
+ className,
78
+ onClick,
79
+ onFocus,
80
+ onMouseEnter,
81
+ onMouseLeave,
82
+ onTouchStart,
83
+ onTouchEnd,
84
+ ...rest
85
+ } = options;
86
+ const linkInfo = router.buildLink(options);
87
+ if (linkInfo.type === 'external') {
88
+ const {
89
+ href
90
+ } = linkInfo;
91
+ return {
92
+ href
93
+ };
94
+ }
95
+ const {
96
+ handleClick,
97
+ handleFocus,
98
+ handleEnter,
99
+ handleLeave,
100
+ isActive,
101
+ next
102
+ } = linkInfo;
103
+ const reactHandleClick = e => {
104
+ if (React__namespace.startTransition) {
105
+ // This is a hack for react < 18
106
+ React__namespace.startTransition(() => {
107
+ handleClick(e);
108
+ });
109
+ } else {
110
+ handleClick(e);
111
+ }
112
+ };
113
+ const composeHandlers = handlers => e => {
114
+ if (e.persist) e.persist();
115
+ handlers.filter(Boolean).forEach(handler => {
116
+ if (e.defaultPrevented) return;
117
+ handler(e);
118
+ });
119
+ };
120
+
121
+ // Get the active props
122
+ const resolvedActiveProps = isActive ? routerCore.functionalUpdate(activeProps, {}) ?? {} : {};
123
+
124
+ // Get the inactive props
125
+ const resolvedInactiveProps = isActive ? {} : routerCore.functionalUpdate(inactiveProps, {}) ?? {};
126
+ return {
127
+ ...resolvedActiveProps,
128
+ ...resolvedInactiveProps,
129
+ ...rest,
130
+ href: disabled ? undefined : next.href,
131
+ onClick: composeHandlers([onClick, reactHandleClick]),
132
+ onFocus: composeHandlers([onFocus, handleFocus]),
133
+ onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),
134
+ onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),
135
+ target,
136
+ style: {
137
+ ...style,
138
+ ...resolvedActiveProps.style,
139
+ ...resolvedInactiveProps.style
140
+ },
141
+ className: [className, resolvedActiveProps.className, resolvedInactiveProps.className].filter(Boolean).join(' ') || undefined,
142
+ ...(disabled ? {
143
+ role: 'link',
144
+ 'aria-disabled': true
145
+ } : undefined),
146
+ ['data-status']: isActive ? 'active' : undefined
147
+ };
148
+ }
149
+ const Link = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
150
+ const linkProps = useLinkProps(props);
151
+ return /*#__PURE__*/React__namespace.createElement("a", _rollupPluginBabelHelpers["extends"]({
152
+ ref: ref
153
+ }, linkProps, {
154
+ children: typeof props.children === 'function' ? props.children({
155
+ isActive: linkProps['data-status'] === 'active'
156
+ }) : props.children
157
+ }));
158
+ });
159
+ const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
160
+ const routerContext = /*#__PURE__*/React__namespace.createContext(null);
161
+ const EMPTY = {};
162
+ const __useStoreValue = (seed, selector) => {
163
+ const valueRef = React__namespace.useRef(EMPTY);
164
+
165
+ // If there is no selector, track the seed
166
+ // If there is a selector, do not track the seed
167
+ const getValue = () => !selector ? seed() : selector(reactivity.untrack(() => seed()));
168
+
169
+ // If empty, initialize the value
170
+ if (valueRef.current === EMPTY) {
171
+ valueRef.current = routerCore.sharedClone(undefined, getValue());
172
+ }
173
+
174
+ // Snapshot should just return the current cached value
175
+ const getSnapshot = React__namespace.useCallback(() => valueRef.current, []);
176
+ const getStore = React__namespace.useCallback(cb => {
177
+ // A root is necessary to track effects
178
+ return reactivity.createRoot(() => {
179
+ reactivity.createEffect(() => {
180
+ // Read and update the value
181
+ // getValue will handle which values are accessed and
182
+ // thus tracked.
183
+ // sharedClone will both recursively track the end result
184
+ // and ensure that the previous value is structurally shared
185
+ // into the new version.
186
+ valueRef.current = reactivity.unwrap(
187
+ // Unwrap the value to get rid of any proxy structures
188
+ routerCore.sharedClone(valueRef.current, getValue()));
189
+ cb();
190
+ });
191
+ });
192
+ }, []);
193
+ return shim.useSyncExternalStore(getStore, getSnapshot, getSnapshot);
194
+ };
195
+ const [store, setStore] = reactivity.createStore({
196
+ foo: 'foo',
197
+ bar: {
198
+ baz: 'baz'
199
+ }
200
+ });
201
+ reactivity.createRoot(() => {
202
+ let prev;
203
+ reactivity.createEffect(() => {
204
+ console.log('effect');
205
+ const next = routerCore.sharedClone(prev, store);
206
+ console.log(next);
207
+ prev = reactivity.untrack(() => next);
208
+ });
209
+ });
210
+ setStore(s => {
211
+ s.foo = '1';
212
+ });
213
+ setStore(s => {
214
+ s.bar.baz = '2';
215
+ });
216
+ function createReactRouter(opts) {
217
+ const coreRouter = routerCore.createRouter({
218
+ ...opts,
219
+ loadComponent: async component => {
220
+ if (component.preload) {
221
+ await component.preload();
222
+ }
223
+ return component;
224
+ }
225
+ });
226
+ return coreRouter;
227
+ }
228
+ function RouterProvider(_ref) {
229
+ let {
230
+ router,
231
+ ...rest
232
+ } = _ref;
233
+ router.update(rest);
234
+ const [,, currentMatches] = __useStoreValue(() => router.store, s => [s.status, s.pendingMatches, s.currentMatches]);
235
+ React__namespace.useEffect(router.mount, [router]);
236
+ console.log('current', currentMatches);
237
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
238
+ value: {
239
+ router: router
240
+ }
241
+ }, /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, {
242
+ value: [undefined, ...currentMatches]
243
+ }, /*#__PURE__*/React__namespace.createElement(Outlet, null))));
244
+ }
245
+ function useRouter() {
246
+ const value = React__namespace.useContext(routerContext);
247
+ routerCore.warning(!value, 'useRouter must be used inside a <Router> component!');
248
+ return value.router;
249
+ }
250
+ function useRouterStore(selector) {
251
+ const router = useRouter();
252
+ return __useStoreValue(() => router.store, selector);
253
+ }
254
+ function useMatches() {
255
+ return React__namespace.useContext(matchesContext);
256
+ }
257
+ function useMatch(opts) {
258
+ const router = useRouter();
259
+ const nearestMatch = useMatches()[0];
260
+ const match = opts != null && opts.from ? router.store.currentMatches.find(d => d.routeId === (opts == null ? void 0 : opts.from)) : nearestMatch;
261
+ routerCore.invariant(match, `Could not find ${opts != null && opts.from ? `an active match from "${opts.from}"` : 'a nearest match!'}`);
262
+ if ((opts == null ? void 0 : opts.strict) ?? true) {
263
+ routerCore.invariant(nearestMatch.routeId == (match == null ? void 0 : match.routeId), `useMatch("${match == null ? void 0 : match.routeId}") is being called in a component that is meant to render the '${nearestMatch.routeId}' route. Did you mean to 'useMatch("${match == null ? void 0 : match.routeId}", { strict: false })' or 'useRoute("${match == null ? void 0 : match.routeId}")' instead?`);
264
+ }
265
+ __useStoreValue(() => match.store);
266
+ return match;
267
+ }
268
+ function useRoute(routeId) {
269
+ const router = useRouter();
270
+ const resolvedRoute = router.getRoute(routeId);
271
+ routerCore.invariant(resolvedRoute, `Could not find a route for route "${routeId}"! Did you forget to add it to your route config?`);
272
+ return resolvedRoute;
273
+ }
274
+ function useLoaderData(opts) {
275
+ const match = useMatch(opts);
276
+ return __useStoreValue(() => match == null ? void 0 : match.store.loaderData, opts == null ? void 0 : opts.select);
277
+ }
278
+ function useSearch(opts) {
279
+ const match = useMatch(opts);
280
+ return __useStoreValue(() => match == null ? void 0 : match.store.search, opts == null ? void 0 : opts.select);
281
+ }
282
+ function useParams(opts) {
283
+ const router = useRouter();
284
+ return __useStoreValue(() => {
285
+ var _last;
286
+ return (_last = routerCore.last(router.store.currentMatches)) == null ? void 0 : _last.params;
287
+ }, opts == null ? void 0 : opts.select);
288
+ }
289
+ function useNavigate(defaultOpts) {
290
+ return opts => {
291
+ const router = useRouter();
292
+ return router.navigate({
293
+ ...defaultOpts,
294
+ ...opts
295
+ });
296
+ };
297
+ }
298
+ function useAction(opts) {
299
+ const route = useRoute(opts.from);
300
+ const action = route.action;
301
+ __useStoreValue(() => action);
302
+ return action;
303
+ }
304
+ function useMatchRoute() {
305
+ const router = useRouter();
306
+ return opts => {
307
+ const {
308
+ pending,
309
+ caseSensitive,
310
+ ...rest
311
+ } = opts;
312
+ return router.matchRoute(rest, {
313
+ pending,
314
+ caseSensitive
315
+ });
316
+ };
317
+ }
318
+ function MatchRoute(props) {
319
+ const matchRoute = useMatchRoute();
320
+ const params = matchRoute(props);
321
+ if (!params) {
322
+ return null;
323
+ }
324
+ return /*#__PURE__*/React__namespace.createElement(typeof props.children === 'function' ? props.children(params) : props.children, props);
325
+ }
326
+ function Outlet() {
327
+ const router = useRouter();
328
+ const matches = useMatches().slice(1);
329
+ const match = matches[0];
330
+ const defaultPending = React__namespace.useCallback(() => null, []);
331
+ __useStoreValue(() => match == null ? void 0 : match.store);
332
+ const Inner = React__namespace.useCallback(props => {
333
+ if (props.match.store.status === 'error') {
334
+ throw props.match.store.error;
335
+ }
336
+ if (props.match.store.status === 'success') {
337
+ return /*#__PURE__*/React__namespace.createElement(props.match.__.component ?? router.options.defaultComponent ?? Outlet);
338
+ }
339
+ if (props.match.store.status === 'loading') {
340
+ throw props.match.__.loadPromise;
341
+ }
342
+ routerCore.invariant(false, 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!');
343
+ }, []);
344
+ if (!match) {
345
+ return null;
346
+ }
347
+ const PendingComponent = match.__.pendingComponent ?? router.options.defaultPendingComponent ?? defaultPending;
348
+ const errorComponent = match.__.errorComponent ?? router.options.defaultErrorComponent;
349
+ return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, {
350
+ value: matches
351
+ }, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
352
+ fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, null)
353
+ }, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
354
+ key: match.routeId,
355
+ errorComponent: errorComponent,
356
+ match: match
357
+ }, /*#__PURE__*/React__namespace.createElement(Inner, {
358
+ match: match
359
+ }))));
360
+ }
361
+ class CatchBoundary extends React__namespace.Component {
362
+ state = {
363
+ error: false,
364
+ info: undefined
365
+ };
366
+ componentDidCatch(error, info) {
367
+ console.error(`Error in route match: ${this.props.match.matchId}`);
368
+ console.error(error);
369
+ this.setState({
370
+ error,
371
+ info
372
+ });
373
+ }
374
+ render() {
375
+ return /*#__PURE__*/React__namespace.createElement(CatchBoundaryInner, _rollupPluginBabelHelpers["extends"]({}, this.props, {
376
+ errorState: this.state,
377
+ reset: () => this.setState({})
378
+ }));
379
+ }
380
+ }
381
+
382
+ // This is the messiest thing ever... I'm either seriously tired (likely) or
383
+ // there has to be a better way to reset error boundaries when the
384
+ // router's location key changes.
385
+ function CatchBoundaryInner(props) {
386
+ const [activeErrorState, setActiveErrorState] = React__namespace.useState(props.errorState);
387
+ const router = useRouter();
388
+ const errorComponent = props.errorComponent ?? DefaultErrorBoundary;
389
+ React__namespace.useEffect(() => {
390
+ if (activeErrorState) {
391
+ let prevKey = router.store.currentLocation.key;
392
+ return reactivity.createRoot(() => reactivity.createEffect(() => {
393
+ if (router.store.currentLocation.key !== prevKey) {
394
+ prevKey = router.store.currentLocation.key;
395
+ setActiveErrorState({});
396
+ }
397
+ }));
398
+ }
399
+ return;
400
+ }, [activeErrorState]);
401
+ React__namespace.useEffect(() => {
402
+ if (props.errorState.error) {
403
+ setActiveErrorState(props.errorState);
404
+ }
405
+ props.reset();
406
+ }, [props.errorState.error]);
407
+ if (props.errorState.error) {
408
+ return /*#__PURE__*/React__namespace.createElement(errorComponent, activeErrorState);
409
+ }
410
+ return props.children;
411
+ }
412
+ function DefaultErrorBoundary(_ref2) {
413
+ let {
414
+ error
415
+ } = _ref2;
416
+ return /*#__PURE__*/React__namespace.createElement("div", {
417
+ style: {
418
+ padding: '.5rem',
419
+ maxWidth: '100%'
420
+ }
421
+ }, /*#__PURE__*/React__namespace.createElement("strong", {
422
+ style: {
423
+ fontSize: '1.2rem'
424
+ }
425
+ }, "Something went wrong!"), /*#__PURE__*/React__namespace.createElement("div", {
426
+ style: {
427
+ height: '.5rem'
428
+ }
429
+ }), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("pre", null, error.message ? /*#__PURE__*/React__namespace.createElement("code", {
430
+ style: {
431
+ fontSize: '.7em',
432
+ border: '1px solid red',
433
+ borderRadius: '.25rem',
434
+ padding: '.5rem',
435
+ color: 'red'
436
+ }
437
+ }, error.message) : null)));
438
+ }
439
+ function usePrompt(message, when) {
440
+ const router = useRouter();
441
+ React__namespace.useEffect(() => {
442
+ if (!when) return;
443
+ let unblock = router.history.block(transition => {
444
+ if (window.confirm(message)) {
445
+ unblock();
446
+ transition.retry();
447
+ } else {
448
+ router.store.currentLocation.pathname = window.location.pathname;
449
+ }
450
+ });
451
+ return unblock;
452
+ }, [when, message]);
453
+ }
454
+ function Prompt(_ref3) {
455
+ let {
456
+ message,
457
+ when,
458
+ children
459
+ } = _ref3;
460
+ usePrompt(message, when ?? true);
461
+ return children ?? null;
462
+ }
463
+
464
+ // function circularStringify(obj: any) {
465
+ // const seen = new Set()
466
+
467
+ // return (
468
+ // JSON.stringify(obj, (_, value) => {
469
+ // if (typeof value === 'function') {
470
+ // return undefined
471
+ // }
472
+ // if (typeof value === 'object' && value !== null) {
473
+ // if (seen.has(value)) return
474
+ // seen.add(value)
475
+ // }
476
+ // return value
477
+ // }) || ''
478
+ // )
479
+ // }
480
+
481
+ exports.DefaultErrorBoundary = DefaultErrorBoundary;
482
+ exports.Link = Link;
483
+ exports.MatchRoute = MatchRoute;
484
+ exports.Outlet = Outlet;
485
+ exports.Prompt = Prompt;
486
+ exports.RouterProvider = RouterProvider;
487
+ exports.__useStoreValue = __useStoreValue;
488
+ exports.createReactRouter = createReactRouter;
489
+ exports.lazy = lazy;
490
+ exports.matchesContext = matchesContext;
491
+ exports.routerContext = routerContext;
492
+ exports.useAction = useAction;
493
+ exports.useLinkProps = useLinkProps;
494
+ exports.useLoaderData = useLoaderData;
495
+ exports.useMatch = useMatch;
496
+ exports.useMatchRoute = useMatchRoute;
497
+ exports.useMatches = useMatches;
498
+ exports.useNavigate = useNavigate;
499
+ exports.useParams = useParams;
500
+ exports.usePrompt = usePrompt;
501
+ exports.useRoute = useRoute;
502
+ exports.useRouter = useRouter;
503
+ exports.useRouterStore = useRouterStore;
504
+ exports.useSearch = useSearch;
505
+ Object.keys(reactivity).forEach(function (k) {
506
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
507
+ enumerable: true,
508
+ get: function () { return reactivity[k]; }
509
+ });
510
+ });
511
+ Object.keys(routerCore).forEach(function (k) {
512
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
513
+ enumerable: true,
514
+ get: function () { return routerCore[k]; }
515
+ });
516
+ });
517
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n// @ts-ignore\n// import { useSyncExternalStore } from './uSES/useSyncExternalStoreShim'\nimport { createEffect, createRoot, untrack, unwrap } from '@solidjs/reactivity'\nimport { createStore } from '@solidjs/reactivity'\n\nimport {\n Route,\n RegisteredAllRouteInfo,\n RegisteredRouter,\n RouterStore,\n last,\n sharedClone,\n Action,\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AllRouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n Router,\n Expand,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\nexport * from '@solidjs/reactivity'\n\ntype ReactNode = any\n\nexport type SyncRouteComponent<TProps = {}> = (props: TProps) => ReactNode\n\nexport type RouteComponent<TProps = {}> = SyncRouteComponent<TProps> & {\n preload?: () => Promise<void>\n}\n\nexport function lazy(\n importer: () => Promise<{ default: SyncRouteComponent }>,\n): RouteComponent {\n const lazyComp = React.lazy(importer as any)\n let preloaded: Promise<SyncRouteComponent>\n\n const finalComp = lazyComp as unknown as RouteComponent\n\n finalComp.preload = async () => {\n if (!preloaded) {\n await importer()\n }\n }\n\n return finalComp\n}\n\nexport type LinkPropsOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = LinkOptions<RegisteredAllRouteInfo, TFrom, TTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n\nexport type MakeUseMatchRouteOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = ToOptions<RegisteredAllRouteInfo, TFrom, TTo> & MatchRouteOptions\n\nexport type MakeMatchRouteOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = ToOptions<RegisteredAllRouteInfo, TFrom, TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | ReactNode\n | ((\n params: RouteInfoByPath<\n RegisteredAllRouteInfo,\n ResolveRelativePath<TFrom, NoInfer<TTo>>\n >['allParams'],\n ) => ReactNode)\n }\n\nexport type MakeLinkPropsOptions<\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n> = LinkPropsOptions<TFrom, TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>\n\nexport type MakeLinkOptions<\n TFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TTo extends string = '.',\n> = LinkPropsOptions<TFrom, TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?: ReactNode | ((state: { isActive: boolean }) => ReactNode)\n }\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Component: RouteComponent\n ErrorComponent: RouteComponent<{\n error: unknown\n info: { componentStack: string }\n }>\n }\n\n interface RouterOptions<TRouteConfig, TRouterContext> {\n // ssrFooter?: () => JSX.Element | Node\n }\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: ReactNode\n}\n\n//\n\nexport function useLinkProps<\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n>(\n options: MakeLinkPropsOptions<TFrom, TTo>,\n): React.AnchorHTMLAttributes<HTMLAnchorElement> {\n const router = useRouter()\n\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = router.buildLink(options as any)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const { handleClick, handleFocus, handleEnter, handleLeave, isActive, next } =\n linkInfo\n\n const reactHandleClick = (e: Event) => {\n if (React.startTransition) {\n // This is a hack for react < 18\n React.startTransition(() => {\n handleClick(e)\n })\n } else {\n handleClick(e)\n }\n }\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n if (e.persist) e.persist()\n handlers.filter(Boolean).forEach((handler) => {\n if (e.defaultPrevented) return\n handler!(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? functionalUpdate(activeProps, {}) ?? {}\n : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps, {}) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled ? undefined : next.href,\n onClick: composeHandlers([onClick, reactHandleClick]),\n onFocus: composeHandlers([onFocus, handleFocus]),\n onMouseEnter: composeHandlers([onMouseEnter, handleEnter]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n}\n\nexport interface LinkFn<\n TDefaultFrom extends RegisteredAllRouteInfo['routePaths'] = '/',\n TDefaultTo extends string = '.',\n> {\n <\n TFrom extends RegisteredAllRouteInfo['routePaths'] = TDefaultFrom,\n TTo extends string = TDefaultTo,\n >(\n props: MakeLinkOptions<TFrom, TTo>,\n ): ReactNode\n}\n\nexport const Link: LinkFn = React.forwardRef((props: any, ref) => {\n const linkProps = useLinkProps(props)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n}) as any\n\ntype MatchesContextValue = RouteMatch[]\n\nexport const matchesContext = React.createContext<MatchesContextValue>(null!)\nexport const routerContext = React.createContext<{ router: RegisteredRouter }>(\n null!,\n)\n\nexport type MatchesProviderProps = {\n value: MatchesContextValue\n children: ReactNode\n}\n\nconst EMPTY = {}\n\nexport const __useStoreValue = <TSeed, TReturn>(\n seed: () => TSeed,\n selector?: (seed: TSeed) => TReturn,\n): TReturn => {\n const valueRef = React.useRef<TReturn>(EMPTY as any)\n\n // If there is no selector, track the seed\n // If there is a selector, do not track the seed\n const getValue = () =>\n (!selector ? seed() : selector(untrack(() => seed()))) as TReturn\n\n // If empty, initialize the value\n if (valueRef.current === EMPTY) {\n valueRef.current = sharedClone(undefined, getValue())\n }\n\n // Snapshot should just return the current cached value\n const getSnapshot = React.useCallback(() => valueRef.current, [])\n\n const getStore = React.useCallback((cb: () => void) => {\n // A root is necessary to track effects\n return createRoot(() => {\n createEffect(() => {\n // Read and update the value\n // getValue will handle which values are accessed and\n // thus tracked.\n // sharedClone will both recursively track the end result\n // and ensure that the previous value is structurally shared\n // into the new version.\n valueRef.current = unwrap(\n // Unwrap the value to get rid of any proxy structures\n sharedClone(valueRef.current, getValue()),\n )\n cb()\n })\n })\n }, [])\n\n return useSyncExternalStore(getStore, getSnapshot, getSnapshot)\n}\n\nconst [store, setStore] = createStore({ foo: 'foo', bar: { baz: 'baz' } })\n\ncreateRoot(() => {\n let prev: any\n\n createEffect(() => {\n console.log('effect')\n const next = sharedClone(prev, store)\n console.log(next)\n prev = untrack(() => next)\n })\n})\n\nsetStore((s) => {\n s.foo = '1'\n})\n\nsetStore((s) => {\n s.bar.baz = '2'\n})\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n TRouterContext = unknown,\n>(\n opts: RouterOptions<TRouteConfig, TRouterContext>,\n): Router<TRouteConfig, TAllRouteInfo, TRouterContext> {\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n loadComponent: async (component) => {\n if (component.preload) {\n await component.preload()\n }\n\n return component as any\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouterContext = unknown,\n> = RouterOptions<TRouteConfig, TRouterContext> & {\n router: Router<TRouteConfig, TAllRouteInfo, TRouterContext>\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouterContext = unknown,\n>({\n router,\n ...rest\n}: RouterProps<TRouteConfig, TAllRouteInfo, TRouterContext>) {\n router.update(rest)\n\n const [, , currentMatches] = __useStoreValue(\n () => router.store,\n (s) => [s.status, s.pendingMatches, s.currentMatches],\n )\n\n React.useEffect(router.mount, [router])\n\n console.log('current', currentMatches)\n\n return (\n <>\n <routerContext.Provider value={{ router: router as any }}>\n <matchesContext.Provider value={[undefined!, ...currentMatches]}>\n <Outlet />\n </matchesContext.Provider>\n </routerContext.Provider>\n </>\n )\n}\n\nexport function useRouter(): RegisteredRouter {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n return value.router\n}\n\nexport function useRouterStore<T = RouterStore>(\n selector?: (state: Router['store']) => T,\n): T {\n const router = useRouter()\n return __useStoreValue(() => router.store, selector)\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useMatch<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n TRouteMatch = RouteMatch<\n RegisteredAllRouteInfo,\n RegisteredAllRouteInfo['routeInfoById'][TFrom]\n >,\n // TSelected = TRouteMatch,\n>(opts?: {\n from: TFrom\n strict?: TStrict\n // select?: (match: TRouteMatch) => TSelected\n}): TStrict extends true ? TRouteMatch : TRouteMatch | undefined {\n const router = useRouter()\n const nearestMatch = useMatches()[0]!\n const match = opts?.from\n ? router.store.currentMatches.find((d) => d.routeId === opts?.from)\n : nearestMatch\n\n invariant(\n match,\n `Could not find ${\n opts?.from ? `an active match from \"${opts.from}\"` : 'a nearest match!'\n }`,\n )\n\n if (opts?.strict ?? true) {\n invariant(\n nearestMatch.routeId == match?.routeId,\n `useMatch(\"${\n match?.routeId as string\n }\") is being called in a component that is meant to render the '${\n nearestMatch.routeId\n }' route. Did you mean to 'useMatch(\"${\n match?.routeId as string\n }\", { strict: false })' or 'useRoute(\"${\n match?.routeId as string\n }\")' instead?`,\n )\n }\n\n __useStoreValue(() => match!.store)\n\n return match as any\n}\n\nexport function useRoute<\n TId extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n>(\n routeId: TId,\n): Route<RegisteredAllRouteInfo, RegisteredAllRouteInfo['routeInfoById'][TId]> {\n const router = useRouter()\n const resolvedRoute = router.getRoute(routeId as any)\n\n invariant(\n resolvedRoute,\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n\n return resolvedRoute as any\n}\n\nexport function useLoaderData<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n TStrict extends boolean = true,\n TLoaderData = RegisteredAllRouteInfo['routeInfoById'][TFrom]['loaderData'],\n TSelected = TLoaderData,\n>(opts?: {\n from: TFrom\n strict?: TStrict\n select?: (loaderData: TLoaderData) => TSelected\n}): TStrict extends true ? TSelected : TSelected | undefined {\n const match = useMatch(opts) as any\n return __useStoreValue(() => match?.store.loaderData, opts?.select)\n}\n\nexport function useSearch<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'],\n TStrict extends boolean = true,\n TSearch = RegisteredAllRouteInfo['routeInfoById'][TFrom]['fullSearchSchema'],\n TSelected = TSearch,\n>(opts?: {\n from: TFrom\n strict?: TStrict\n select?: (search: TSearch) => TSelected\n}): TStrict extends true ? TSelected : TSelected | undefined {\n const match = useMatch(opts)\n return __useStoreValue(() => match?.store.search, opts?.select) as any\n}\n\nexport function useParams<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n TDefaultSelected = Expand<\n RegisteredAllRouteInfo['allParams'] &\n RegisteredAllRouteInfo['routeInfoById'][TFrom]['allParams']\n >,\n TSelected = TDefaultSelected,\n>(opts?: {\n from: TFrom\n select?: (search: TDefaultSelected) => TSelected\n}): TSelected {\n const router = useRouter()\n return __useStoreValue(\n () => last(router.store.currentMatches)?.params as any,\n opts?.select,\n )\n}\n\nexport function useNavigate<\n TDefaultFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n>(defaultOpts: { from?: TDefaultFrom }) {\n return <\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = TDefaultFrom,\n TTo extends string = '.',\n >(\n opts: MakeLinkOptions<TFrom, TTo>,\n ) => {\n const router = useRouter()\n return router.navigate({ ...defaultOpts, ...(opts as any) })\n }\n}\n\nexport function useAction<\n TFrom extends keyof RegisteredAllRouteInfo['routeInfoById'] = '/',\n TFromRoute extends RegisteredAllRouteInfo['routeInfoById'][TFrom] = RegisteredAllRouteInfo['routeInfoById'][TFrom],\n>(opts: {\n from: TFrom\n}): Action<TFromRoute['actionPayload'], TFromRoute['actionResponse']> {\n const route = useRoute(opts.from)\n const action = route.action\n __useStoreValue(() => action)\n return action as any\n}\n\nexport function useMatchRoute() {\n const router = useRouter()\n\n return <\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n >(\n opts: MakeUseMatchRouteOptions<TFrom, TTo>,\n ) => {\n const { pending, caseSensitive, ...rest } = opts\n\n return router.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n }\n}\n\nexport function MatchRoute<\n TFrom extends ValidFromPath<RegisteredAllRouteInfo> = '/',\n TTo extends string = '.',\n>(props: MakeMatchRouteOptions<TFrom, TTo>): any {\n const matchRoute = useMatchRoute()\n const params = matchRoute(props)\n\n if (!params) {\n return null\n }\n\n return React.createElement(\n typeof props.children === 'function'\n ? (props.children as any)(params)\n : props.children,\n props as any,\n )\n}\n\nexport function Outlet() {\n const router = useRouter()\n const matches = useMatches().slice(1)\n const match = matches[0]\n\n const defaultPending = React.useCallback(() => null, [])\n\n __useStoreValue(() => match?.store)\n\n const Inner = React.useCallback((props: { match: RouteMatch }): any => {\n if (props.match.store.status === 'error') {\n throw props.match.store.error\n }\n\n if (props.match.store.status === 'success') {\n return React.createElement(\n (props.match.__.component as any) ??\n router.options.defaultComponent ??\n Outlet,\n )\n }\n\n if (props.match.store.status === 'loading') {\n throw props.match.__.loadPromise\n }\n\n invariant(\n false,\n 'Idle routeMatch status encountered during rendering! You should never see this. File an issue!',\n )\n }, [])\n\n if (!match) {\n return null\n }\n\n const PendingComponent = (match.__.pendingComponent ??\n router.options.defaultPendingComponent ??\n defaultPending) as any\n\n const errorComponent =\n match.__.errorComponent ?? router.options.defaultErrorComponent\n\n return (\n <matchesContext.Provider value={matches}>\n <React.Suspense fallback={<PendingComponent />}>\n <CatchBoundary\n key={match.routeId}\n errorComponent={errorComponent}\n match={match as any}\n >\n <Inner match={match} />\n </CatchBoundary>\n </React.Suspense>\n {/* Provide a suffix suspense boundary to make sure the router is\n ready to be dehydrated on the server */}\n {/* {router.options.ssrFooter && match.matchId === rootRouteId ? (\n <React.Suspense fallback={null}>\n {(() => {\n if (router.store.pending) {\n throw router.navigationPromise\n }\n\n return router.options.ssrFooter()\n })()}\n </React.Suspense>\n ) : null} */}\n </matchesContext.Provider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n errorComponent: any\n match: RouteMatch\n}> {\n state = {\n error: false,\n info: undefined,\n }\n\n componentDidCatch(error: any, info: any) {\n console.error(`Error in route match: ${this.props.match.matchId}`)\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n\n render() {\n return (\n <CatchBoundaryInner\n {...this.props}\n errorState={this.state}\n reset={() => this.setState({})}\n />\n )\n }\n}\n\n// This is the messiest thing ever... I'm either seriously tired (likely) or\n// there has to be a better way to reset error boundaries when the\n// router's location key changes.\nfunction CatchBoundaryInner(props: {\n children: any\n errorComponent: any\n errorState: { error: unknown; info: any }\n reset: () => void\n}) {\n const [activeErrorState, setActiveErrorState] = React.useState(\n props.errorState,\n )\n const router = useRouter()\n const errorComponent = props.errorComponent ?? DefaultErrorBoundary\n\n React.useEffect(() => {\n if (activeErrorState) {\n let prevKey = router.store.currentLocation.key\n return createRoot(() =>\n createEffect(() => {\n if (router.store.currentLocation.key !== prevKey) {\n prevKey = router.store.currentLocation.key\n setActiveErrorState({} as any)\n }\n }),\n )\n }\n\n return\n }, [activeErrorState])\n\n React.useEffect(() => {\n if (props.errorState.error) {\n setActiveErrorState(props.errorState)\n }\n props.reset()\n }, [props.errorState.error])\n\n if (props.errorState.error) {\n return React.createElement(errorComponent, activeErrorState)\n }\n\n return props.children\n}\n\nexport function DefaultErrorBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n </div>\n )\n}\n\nexport function usePrompt(message: string, when: boolean | any): void {\n const router = useRouter()\n\n React.useEffect(() => {\n if (!when) return\n\n let unblock = router.history.block((transition) => {\n if (window.confirm(message)) {\n unblock()\n transition.retry()\n } else {\n router.store.currentLocation.pathname = window.location.pathname\n }\n })\n\n return unblock\n }, [when, message])\n}\n\nexport function Prompt({ message, when, children }: PromptProps) {\n usePrompt(message, when ?? true)\n return (children ?? null) as ReactNode\n}\n\n// function circularStringify(obj: any) {\n// const seen = new Set()\n\n// return (\n// JSON.stringify(obj, (_, value) => {\n// if (typeof value === 'function') {\n// return undefined\n// }\n// if (typeof value === 'object' && value !== null) {\n// if (seen.has(value)) return\n// seen.add(value)\n// }\n// return value\n// }) || ''\n// )\n// }\n"],"names":["lazy","importer","lazyComp","React","finalComp","preload","useLinkProps","options","router","useRouter","type","children","target","activeProps","className","inactiveProps","activeOptions","disabled","hash","search","params","to","preloadDelay","preloadMaxAge","replace","style","onClick","onFocus","onMouseEnter","onMouseLeave","onTouchStart","onTouchEnd","rest","linkInfo","buildLink","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","reactHandleClick","e","startTransition","composeHandlers","handlers","persist","filter","Boolean","forEach","handler","defaultPrevented","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","undefined","join","role","Link","forwardRef","props","ref","linkProps","_extends","matchesContext","createContext","routerContext","EMPTY","__useStoreValue","seed","selector","valueRef","useRef","getValue","untrack","current","sharedClone","getSnapshot","useCallback","getStore","cb","createRoot","createEffect","unwrap","useSyncExternalStore","store","setStore","createStore","foo","bar","baz","prev","console","log","s","createReactRouter","opts","coreRouter","createRouter","loadComponent","component","RouterProvider","update","currentMatches","status","pendingMatches","useEffect","mount","value","useContext","warning","useRouterStore","useMatches","useMatch","nearestMatch","match","from","find","d","routeId","invariant","strict","useRoute","resolvedRoute","getRoute","useLoaderData","loaderData","select","useSearch","useParams","last","useNavigate","defaultOpts","navigate","useAction","route","action","useMatchRoute","pending","caseSensitive","matchRoute","MatchRoute","createElement","Outlet","matches","slice","defaultPending","Inner","error","__","defaultComponent","loadPromise","PendingComponent","pendingComponent","defaultPendingComponent","errorComponent","defaultErrorComponent","CatchBoundary","Component","state","info","componentDidCatch","matchId","setState","render","CatchBoundaryInner","activeErrorState","setActiveErrorState","useState","errorState","DefaultErrorBoundary","prevKey","currentLocation","key","reset","padding","maxWidth","fontSize","height","message","border","borderRadius","color","usePrompt","when","unblock","history","block","transition","window","confirm","retry","pathname","location","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDO,SAASA,IAAI,CAClBC,QAAwD,EACxC;AAChB,EAAA,MAAMC,QAAQ,gBAAGC,gBAAK,CAACH,IAAI,CAACC,QAAQ,CAAQ,CAAA;EAG5C,MAAMG,SAAS,GA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