@tanstack/react-router 0.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2737 @@
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
+ (function (global, factory) {
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('use-sync-external-store/shim')) :
13
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'use-sync-external-store/shim'], factory) :
14
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactLocation = {}, global.React, global.shim));
15
+ })(this, (function (exports, React, shim) { 'use strict';
16
+
17
+ function _interopNamespace(e) {
18
+ if (e && e.__esModule) return e;
19
+ var n = Object.create(null);
20
+ if (e) {
21
+ Object.keys(e).forEach(function (k) {
22
+ if (k !== 'default') {
23
+ var d = Object.getOwnPropertyDescriptor(e, k);
24
+ Object.defineProperty(n, k, d.get ? d : {
25
+ enumerable: true,
26
+ get: function () { return e[k]; }
27
+ });
28
+ }
29
+ });
30
+ }
31
+ n["default"] = e;
32
+ return Object.freeze(n);
33
+ }
34
+
35
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
36
+
37
+ function _extends$2() {
38
+ _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
39
+ for (var i = 1; i < arguments.length; i++) {
40
+ var source = arguments[i];
41
+
42
+ for (var key in source) {
43
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
44
+ target[key] = source[key];
45
+ }
46
+ }
47
+ }
48
+
49
+ return target;
50
+ };
51
+ return _extends$2.apply(this, arguments);
52
+ }
53
+
54
+ function _objectWithoutPropertiesLoose(source, excluded) {
55
+ if (source == null) return {};
56
+ var target = {};
57
+ var sourceKeys = Object.keys(source);
58
+ var key, i;
59
+
60
+ for (i = 0; i < sourceKeys.length; i++) {
61
+ key = sourceKeys[i];
62
+ if (excluded.indexOf(key) >= 0) continue;
63
+ target[key] = source[key];
64
+ }
65
+
66
+ return target;
67
+ }
68
+
69
+ /**
70
+ * router-core
71
+ *
72
+ * Copyright (c) TanStack
73
+ *
74
+ * This source code is licensed under the MIT license found in the
75
+ * LICENSE.md file in the root directory of this source tree.
76
+ *
77
+ * @license MIT
78
+ */
79
+ function _extends$1() {
80
+ _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
81
+ for (var i = 1; i < arguments.length; i++) {
82
+ var source = arguments[i];
83
+
84
+ for (var key in source) {
85
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
86
+ target[key] = source[key];
87
+ }
88
+ }
89
+ }
90
+
91
+ return target;
92
+ };
93
+ return _extends$1.apply(this, arguments);
94
+ }
95
+
96
+ function _extends() {
97
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
98
+ for (var i = 1; i < arguments.length; i++) {
99
+ var source = arguments[i];
100
+
101
+ for (var key in source) {
102
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
103
+ target[key] = source[key];
104
+ }
105
+ }
106
+ }
107
+
108
+ return target;
109
+ };
110
+ return _extends.apply(this, arguments);
111
+ }
112
+
113
+ /**
114
+ * Actions represent the type of change to a location value.
115
+ *
116
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action
117
+ */
118
+ var Action;
119
+
120
+ (function (Action) {
121
+ /**
122
+ * A POP indicates a change to an arbitrary index in the history stack, such
123
+ * as a back or forward navigation. It does not describe the direction of the
124
+ * navigation, only that the current index changed.
125
+ *
126
+ * Note: This is the default action for newly created history objects.
127
+ */
128
+ Action["Pop"] = "POP";
129
+ /**
130
+ * A PUSH indicates a new entry being added to the history stack, such as when
131
+ * a link is clicked and a new page loads. When this happens, all subsequent
132
+ * entries in the stack are lost.
133
+ */
134
+
135
+ Action["Push"] = "PUSH";
136
+ /**
137
+ * A REPLACE indicates the entry at the current index in the history stack
138
+ * being replaced by a new one.
139
+ */
140
+
141
+ Action["Replace"] = "REPLACE";
142
+ })(Action || (Action = {}));
143
+
144
+ var readOnly = function (obj) {
145
+ return Object.freeze(obj);
146
+ } ;
147
+
148
+ function warning$1(cond, message) {
149
+ if (!cond) {
150
+ // eslint-disable-next-line no-console
151
+ if (typeof console !== 'undefined') console.warn(message);
152
+
153
+ try {
154
+ // Welcome to debugging history!
155
+ //
156
+ // This error is thrown as a convenience so you can more easily
157
+ // find the source for a warning that appears in the console by
158
+ // enabling "pause on exceptions" in your JavaScript debugger.
159
+ throw new Error(message); // eslint-disable-next-line no-empty
160
+ } catch (e) {}
161
+ }
162
+ }
163
+
164
+ var BeforeUnloadEventType = 'beforeunload';
165
+ var HashChangeEventType = 'hashchange';
166
+ var PopStateEventType = 'popstate';
167
+ /**
168
+ * Browser history stores the location in regular URLs. This is the standard for
169
+ * most web apps, but it requires some configuration on the server to ensure you
170
+ * serve the same app at multiple URLs.
171
+ *
172
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory
173
+ */
174
+
175
+ function createBrowserHistory(options) {
176
+ if (options === void 0) {
177
+ options = {};
178
+ }
179
+
180
+ var _options = options,
181
+ _options$window = _options.window,
182
+ window = _options$window === void 0 ? document.defaultView : _options$window;
183
+ var globalHistory = window.history;
184
+
185
+ function getIndexAndLocation() {
186
+ var _window$location = window.location,
187
+ pathname = _window$location.pathname,
188
+ search = _window$location.search,
189
+ hash = _window$location.hash;
190
+ var state = globalHistory.state || {};
191
+ return [state.idx, readOnly({
192
+ pathname: pathname,
193
+ search: search,
194
+ hash: hash,
195
+ state: state.usr || null,
196
+ key: state.key || 'default'
197
+ })];
198
+ }
199
+
200
+ var blockedPopTx = null;
201
+
202
+ function handlePop() {
203
+ if (blockedPopTx) {
204
+ blockers.call(blockedPopTx);
205
+ blockedPopTx = null;
206
+ } else {
207
+ var nextAction = Action.Pop;
208
+
209
+ var _getIndexAndLocation = getIndexAndLocation(),
210
+ nextIndex = _getIndexAndLocation[0],
211
+ nextLocation = _getIndexAndLocation[1];
212
+
213
+ if (blockers.length) {
214
+ if (nextIndex != null) {
215
+ var delta = index - nextIndex;
216
+
217
+ if (delta) {
218
+ // Revert the POP
219
+ blockedPopTx = {
220
+ action: nextAction,
221
+ location: nextLocation,
222
+ retry: function retry() {
223
+ go(delta * -1);
224
+ }
225
+ };
226
+ go(delta);
227
+ }
228
+ } else {
229
+ // Trying to POP to a location with no index. We did not create
230
+ // this location, so we can't effectively block the navigation.
231
+ warning$1(false, // TODO: Write up a doc that explains our blocking strategy in
232
+ // detail and link to it here so people can understand better what
233
+ // is going on and how to avoid it.
234
+ "You are trying to block a POP navigation to a location that was not " + "created by the history library. The block will fail silently in " + "production, but in general you should do all navigation with the " + "history library (instead of using window.history.pushState directly) " + "to avoid this situation.") ;
235
+ }
236
+ } else {
237
+ applyTx(nextAction);
238
+ }
239
+ }
240
+ }
241
+
242
+ window.addEventListener(PopStateEventType, handlePop);
243
+ var action = Action.Pop;
244
+
245
+ var _getIndexAndLocation2 = getIndexAndLocation(),
246
+ index = _getIndexAndLocation2[0],
247
+ location = _getIndexAndLocation2[1];
248
+
249
+ var listeners = createEvents();
250
+ var blockers = createEvents();
251
+
252
+ if (index == null) {
253
+ index = 0;
254
+ globalHistory.replaceState(_extends({}, globalHistory.state, {
255
+ idx: index
256
+ }), '');
257
+ }
258
+
259
+ function createHref(to) {
260
+ return typeof to === 'string' ? to : createPath(to);
261
+ } // state defaults to `null` because `window.history.state` does
262
+
263
+
264
+ function getNextLocation(to, state) {
265
+ if (state === void 0) {
266
+ state = null;
267
+ }
268
+
269
+ return readOnly(_extends({
270
+ pathname: location.pathname,
271
+ hash: '',
272
+ search: ''
273
+ }, typeof to === 'string' ? parsePath(to) : to, {
274
+ state: state,
275
+ key: createKey()
276
+ }));
277
+ }
278
+
279
+ function getHistoryStateAndUrl(nextLocation, index) {
280
+ return [{
281
+ usr: nextLocation.state,
282
+ key: nextLocation.key,
283
+ idx: index
284
+ }, createHref(nextLocation)];
285
+ }
286
+
287
+ function allowTx(action, location, retry) {
288
+ return !blockers.length || (blockers.call({
289
+ action: action,
290
+ location: location,
291
+ retry: retry
292
+ }), false);
293
+ }
294
+
295
+ function applyTx(nextAction) {
296
+ action = nextAction;
297
+
298
+ var _getIndexAndLocation3 = getIndexAndLocation();
299
+
300
+ index = _getIndexAndLocation3[0];
301
+ location = _getIndexAndLocation3[1];
302
+ listeners.call({
303
+ action: action,
304
+ location: location
305
+ });
306
+ }
307
+
308
+ function push(to, state) {
309
+ var nextAction = Action.Push;
310
+ var nextLocation = getNextLocation(to, state);
311
+
312
+ function retry() {
313
+ push(to, state);
314
+ }
315
+
316
+ if (allowTx(nextAction, nextLocation, retry)) {
317
+ var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),
318
+ historyState = _getHistoryStateAndUr[0],
319
+ url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading
320
+ // try...catch because iOS limits us to 100 pushState calls :/
321
+
322
+
323
+ try {
324
+ globalHistory.pushState(historyState, '', url);
325
+ } catch (error) {
326
+ // They are going to lose state here, but there is no real
327
+ // way to warn them about it since the page will refresh...
328
+ window.location.assign(url);
329
+ }
330
+
331
+ applyTx(nextAction);
332
+ }
333
+ }
334
+
335
+ function replace(to, state) {
336
+ var nextAction = Action.Replace;
337
+ var nextLocation = getNextLocation(to, state);
338
+
339
+ function retry() {
340
+ replace(to, state);
341
+ }
342
+
343
+ if (allowTx(nextAction, nextLocation, retry)) {
344
+ var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),
345
+ historyState = _getHistoryStateAndUr2[0],
346
+ url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading
347
+
348
+
349
+ globalHistory.replaceState(historyState, '', url);
350
+ applyTx(nextAction);
351
+ }
352
+ }
353
+
354
+ function go(delta) {
355
+ globalHistory.go(delta);
356
+ }
357
+
358
+ var history = {
359
+ get action() {
360
+ return action;
361
+ },
362
+
363
+ get location() {
364
+ return location;
365
+ },
366
+
367
+ createHref: createHref,
368
+ push: push,
369
+ replace: replace,
370
+ go: go,
371
+ back: function back() {
372
+ go(-1);
373
+ },
374
+ forward: function forward() {
375
+ go(1);
376
+ },
377
+ listen: function listen(listener) {
378
+ return listeners.push(listener);
379
+ },
380
+ block: function block(blocker) {
381
+ var unblock = blockers.push(blocker);
382
+
383
+ if (blockers.length === 1) {
384
+ window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
385
+ }
386
+
387
+ return function () {
388
+ unblock(); // Remove the beforeunload listener so the document may
389
+ // still be salvageable in the pagehide event.
390
+ // See https://html.spec.whatwg.org/#unloading-documents
391
+
392
+ if (!blockers.length) {
393
+ window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
394
+ }
395
+ };
396
+ }
397
+ };
398
+ return history;
399
+ }
400
+ /**
401
+ * Hash history stores the location in window.location.hash. This makes it ideal
402
+ * for situations where you don't want to send the location to the server for
403
+ * some reason, either because you do cannot configure it or the URL space is
404
+ * reserved for something else.
405
+ *
406
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory
407
+ */
408
+
409
+ function createHashHistory(options) {
410
+ if (options === void 0) {
411
+ options = {};
412
+ }
413
+
414
+ var _options2 = options,
415
+ _options2$window = _options2.window,
416
+ window = _options2$window === void 0 ? document.defaultView : _options2$window;
417
+ var globalHistory = window.history;
418
+
419
+ function getIndexAndLocation() {
420
+ var _parsePath = parsePath(window.location.hash.substr(1)),
421
+ _parsePath$pathname = _parsePath.pathname,
422
+ pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,
423
+ _parsePath$search = _parsePath.search,
424
+ search = _parsePath$search === void 0 ? '' : _parsePath$search,
425
+ _parsePath$hash = _parsePath.hash,
426
+ hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;
427
+
428
+ var state = globalHistory.state || {};
429
+ return [state.idx, readOnly({
430
+ pathname: pathname,
431
+ search: search,
432
+ hash: hash,
433
+ state: state.usr || null,
434
+ key: state.key || 'default'
435
+ })];
436
+ }
437
+
438
+ var blockedPopTx = null;
439
+
440
+ function handlePop() {
441
+ if (blockedPopTx) {
442
+ blockers.call(blockedPopTx);
443
+ blockedPopTx = null;
444
+ } else {
445
+ var nextAction = Action.Pop;
446
+
447
+ var _getIndexAndLocation4 = getIndexAndLocation(),
448
+ nextIndex = _getIndexAndLocation4[0],
449
+ nextLocation = _getIndexAndLocation4[1];
450
+
451
+ if (blockers.length) {
452
+ if (nextIndex != null) {
453
+ var delta = index - nextIndex;
454
+
455
+ if (delta) {
456
+ // Revert the POP
457
+ blockedPopTx = {
458
+ action: nextAction,
459
+ location: nextLocation,
460
+ retry: function retry() {
461
+ go(delta * -1);
462
+ }
463
+ };
464
+ go(delta);
465
+ }
466
+ } else {
467
+ // Trying to POP to a location with no index. We did not create
468
+ // this location, so we can't effectively block the navigation.
469
+ warning$1(false, // TODO: Write up a doc that explains our blocking strategy in
470
+ // detail and link to it here so people can understand better
471
+ // what is going on and how to avoid it.
472
+ "You are trying to block a POP navigation to a location that was not " + "created by the history library. The block will fail silently in " + "production, but in general you should do all navigation with the " + "history library (instead of using window.history.pushState directly) " + "to avoid this situation.") ;
473
+ }
474
+ } else {
475
+ applyTx(nextAction);
476
+ }
477
+ }
478
+ }
479
+
480
+ window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge
481
+ // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event
482
+
483
+ window.addEventListener(HashChangeEventType, function () {
484
+ var _getIndexAndLocation5 = getIndexAndLocation(),
485
+ nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.
486
+
487
+
488
+ if (createPath(nextLocation) !== createPath(location)) {
489
+ handlePop();
490
+ }
491
+ });
492
+ var action = Action.Pop;
493
+
494
+ var _getIndexAndLocation6 = getIndexAndLocation(),
495
+ index = _getIndexAndLocation6[0],
496
+ location = _getIndexAndLocation6[1];
497
+
498
+ var listeners = createEvents();
499
+ var blockers = createEvents();
500
+
501
+ if (index == null) {
502
+ index = 0;
503
+ globalHistory.replaceState(_extends({}, globalHistory.state, {
504
+ idx: index
505
+ }), '');
506
+ }
507
+
508
+ function getBaseHref() {
509
+ var base = document.querySelector('base');
510
+ var href = '';
511
+
512
+ if (base && base.getAttribute('href')) {
513
+ var url = window.location.href;
514
+ var hashIndex = url.indexOf('#');
515
+ href = hashIndex === -1 ? url : url.slice(0, hashIndex);
516
+ }
517
+
518
+ return href;
519
+ }
520
+
521
+ function createHref(to) {
522
+ return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));
523
+ }
524
+
525
+ function getNextLocation(to, state) {
526
+ if (state === void 0) {
527
+ state = null;
528
+ }
529
+
530
+ return readOnly(_extends({
531
+ pathname: location.pathname,
532
+ hash: '',
533
+ search: ''
534
+ }, typeof to === 'string' ? parsePath(to) : to, {
535
+ state: state,
536
+ key: createKey()
537
+ }));
538
+ }
539
+
540
+ function getHistoryStateAndUrl(nextLocation, index) {
541
+ return [{
542
+ usr: nextLocation.state,
543
+ key: nextLocation.key,
544
+ idx: index
545
+ }, createHref(nextLocation)];
546
+ }
547
+
548
+ function allowTx(action, location, retry) {
549
+ return !blockers.length || (blockers.call({
550
+ action: action,
551
+ location: location,
552
+ retry: retry
553
+ }), false);
554
+ }
555
+
556
+ function applyTx(nextAction) {
557
+ action = nextAction;
558
+
559
+ var _getIndexAndLocation7 = getIndexAndLocation();
560
+
561
+ index = _getIndexAndLocation7[0];
562
+ location = _getIndexAndLocation7[1];
563
+ listeners.call({
564
+ action: action,
565
+ location: location
566
+ });
567
+ }
568
+
569
+ function push(to, state) {
570
+ var nextAction = Action.Push;
571
+ var nextLocation = getNextLocation(to, state);
572
+
573
+ function retry() {
574
+ push(to, state);
575
+ }
576
+
577
+ warning$1(nextLocation.pathname.charAt(0) === '/', "Relative pathnames are not supported in hash history.push(" + JSON.stringify(to) + ")") ;
578
+
579
+ if (allowTx(nextAction, nextLocation, retry)) {
580
+ var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),
581
+ historyState = _getHistoryStateAndUr3[0],
582
+ url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading
583
+ // try...catch because iOS limits us to 100 pushState calls :/
584
+
585
+
586
+ try {
587
+ globalHistory.pushState(historyState, '', url);
588
+ } catch (error) {
589
+ // They are going to lose state here, but there is no real
590
+ // way to warn them about it since the page will refresh...
591
+ window.location.assign(url);
592
+ }
593
+
594
+ applyTx(nextAction);
595
+ }
596
+ }
597
+
598
+ function replace(to, state) {
599
+ var nextAction = Action.Replace;
600
+ var nextLocation = getNextLocation(to, state);
601
+
602
+ function retry() {
603
+ replace(to, state);
604
+ }
605
+
606
+ warning$1(nextLocation.pathname.charAt(0) === '/', "Relative pathnames are not supported in hash history.replace(" + JSON.stringify(to) + ")") ;
607
+
608
+ if (allowTx(nextAction, nextLocation, retry)) {
609
+ var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),
610
+ historyState = _getHistoryStateAndUr4[0],
611
+ url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading
612
+
613
+
614
+ globalHistory.replaceState(historyState, '', url);
615
+ applyTx(nextAction);
616
+ }
617
+ }
618
+
619
+ function go(delta) {
620
+ globalHistory.go(delta);
621
+ }
622
+
623
+ var history = {
624
+ get action() {
625
+ return action;
626
+ },
627
+
628
+ get location() {
629
+ return location;
630
+ },
631
+
632
+ createHref: createHref,
633
+ push: push,
634
+ replace: replace,
635
+ go: go,
636
+ back: function back() {
637
+ go(-1);
638
+ },
639
+ forward: function forward() {
640
+ go(1);
641
+ },
642
+ listen: function listen(listener) {
643
+ return listeners.push(listener);
644
+ },
645
+ block: function block(blocker) {
646
+ var unblock = blockers.push(blocker);
647
+
648
+ if (blockers.length === 1) {
649
+ window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);
650
+ }
651
+
652
+ return function () {
653
+ unblock(); // Remove the beforeunload listener so the document may
654
+ // still be salvageable in the pagehide event.
655
+ // See https://html.spec.whatwg.org/#unloading-documents
656
+
657
+ if (!blockers.length) {
658
+ window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);
659
+ }
660
+ };
661
+ }
662
+ };
663
+ return history;
664
+ }
665
+ /**
666
+ * Memory history stores the current location in memory. It is designed for use
667
+ * in stateful non-browser environments like tests and React Native.
668
+ *
669
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory
670
+ */
671
+
672
+ function createMemoryHistory(options) {
673
+ if (options === void 0) {
674
+ options = {};
675
+ }
676
+
677
+ var _options3 = options,
678
+ _options3$initialEntr = _options3.initialEntries,
679
+ initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,
680
+ initialIndex = _options3.initialIndex;
681
+ var entries = initialEntries.map(function (entry) {
682
+ var location = readOnly(_extends({
683
+ pathname: '/',
684
+ search: '',
685
+ hash: '',
686
+ state: null,
687
+ key: createKey()
688
+ }, typeof entry === 'string' ? parsePath(entry) : entry));
689
+ warning$1(location.pathname.charAt(0) === '/', "Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: " + JSON.stringify(entry) + ")") ;
690
+ return location;
691
+ });
692
+ var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);
693
+ var action = Action.Pop;
694
+ var location = entries[index];
695
+ var listeners = createEvents();
696
+ var blockers = createEvents();
697
+
698
+ function createHref(to) {
699
+ return typeof to === 'string' ? to : createPath(to);
700
+ }
701
+
702
+ function getNextLocation(to, state) {
703
+ if (state === void 0) {
704
+ state = null;
705
+ }
706
+
707
+ return readOnly(_extends({
708
+ pathname: location.pathname,
709
+ search: '',
710
+ hash: ''
711
+ }, typeof to === 'string' ? parsePath(to) : to, {
712
+ state: state,
713
+ key: createKey()
714
+ }));
715
+ }
716
+
717
+ function allowTx(action, location, retry) {
718
+ return !blockers.length || (blockers.call({
719
+ action: action,
720
+ location: location,
721
+ retry: retry
722
+ }), false);
723
+ }
724
+
725
+ function applyTx(nextAction, nextLocation) {
726
+ action = nextAction;
727
+ location = nextLocation;
728
+ listeners.call({
729
+ action: action,
730
+ location: location
731
+ });
732
+ }
733
+
734
+ function push(to, state) {
735
+ var nextAction = Action.Push;
736
+ var nextLocation = getNextLocation(to, state);
737
+
738
+ function retry() {
739
+ push(to, state);
740
+ }
741
+
742
+ warning$1(location.pathname.charAt(0) === '/', "Relative pathnames are not supported in memory history.push(" + JSON.stringify(to) + ")") ;
743
+
744
+ if (allowTx(nextAction, nextLocation, retry)) {
745
+ index += 1;
746
+ entries.splice(index, entries.length, nextLocation);
747
+ applyTx(nextAction, nextLocation);
748
+ }
749
+ }
750
+
751
+ function replace(to, state) {
752
+ var nextAction = Action.Replace;
753
+ var nextLocation = getNextLocation(to, state);
754
+
755
+ function retry() {
756
+ replace(to, state);
757
+ }
758
+
759
+ warning$1(location.pathname.charAt(0) === '/', "Relative pathnames are not supported in memory history.replace(" + JSON.stringify(to) + ")") ;
760
+
761
+ if (allowTx(nextAction, nextLocation, retry)) {
762
+ entries[index] = nextLocation;
763
+ applyTx(nextAction, nextLocation);
764
+ }
765
+ }
766
+
767
+ function go(delta) {
768
+ var nextIndex = clamp(index + delta, 0, entries.length - 1);
769
+ var nextAction = Action.Pop;
770
+ var nextLocation = entries[nextIndex];
771
+
772
+ function retry() {
773
+ go(delta);
774
+ }
775
+
776
+ if (allowTx(nextAction, nextLocation, retry)) {
777
+ index = nextIndex;
778
+ applyTx(nextAction, nextLocation);
779
+ }
780
+ }
781
+
782
+ var history = {
783
+ get index() {
784
+ return index;
785
+ },
786
+
787
+ get action() {
788
+ return action;
789
+ },
790
+
791
+ get location() {
792
+ return location;
793
+ },
794
+
795
+ createHref: createHref,
796
+ push: push,
797
+ replace: replace,
798
+ go: go,
799
+ back: function back() {
800
+ go(-1);
801
+ },
802
+ forward: function forward() {
803
+ go(1);
804
+ },
805
+ listen: function listen(listener) {
806
+ return listeners.push(listener);
807
+ },
808
+ block: function block(blocker) {
809
+ return blockers.push(blocker);
810
+ }
811
+ };
812
+ return history;
813
+ } ////////////////////////////////////////////////////////////////////////////////
814
+ // UTILS
815
+ ////////////////////////////////////////////////////////////////////////////////
816
+
817
+ function clamp(n, lowerBound, upperBound) {
818
+ return Math.min(Math.max(n, lowerBound), upperBound);
819
+ }
820
+
821
+ function promptBeforeUnload(event) {
822
+ // Cancel the event.
823
+ event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.
824
+
825
+ event.returnValue = '';
826
+ }
827
+
828
+ function createEvents() {
829
+ var handlers = [];
830
+ return {
831
+ get length() {
832
+ return handlers.length;
833
+ },
834
+
835
+ push: function push(fn) {
836
+ handlers.push(fn);
837
+ return function () {
838
+ handlers = handlers.filter(function (handler) {
839
+ return handler !== fn;
840
+ });
841
+ };
842
+ },
843
+ call: function call(arg) {
844
+ handlers.forEach(function (fn) {
845
+ return fn && fn(arg);
846
+ });
847
+ }
848
+ };
849
+ }
850
+
851
+ function createKey() {
852
+ return Math.random().toString(36).substr(2, 8);
853
+ }
854
+ /**
855
+ * Creates a string URL path from the given pathname, search, and hash components.
856
+ *
857
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath
858
+ */
859
+
860
+
861
+ function createPath(_ref) {
862
+ var _ref$pathname = _ref.pathname,
863
+ pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,
864
+ _ref$search = _ref.search,
865
+ search = _ref$search === void 0 ? '' : _ref$search,
866
+ _ref$hash = _ref.hash,
867
+ hash = _ref$hash === void 0 ? '' : _ref$hash;
868
+ if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;
869
+ if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;
870
+ return pathname;
871
+ }
872
+ /**
873
+ * Parses a string URL path into its separate pathname, search, and hash components.
874
+ *
875
+ * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath
876
+ */
877
+
878
+ function parsePath(path) {
879
+ var parsedPath = {};
880
+
881
+ if (path) {
882
+ var hashIndex = path.indexOf('#');
883
+
884
+ if (hashIndex >= 0) {
885
+ parsedPath.hash = path.substr(hashIndex);
886
+ path = path.substr(0, hashIndex);
887
+ }
888
+
889
+ var searchIndex = path.indexOf('?');
890
+
891
+ if (searchIndex >= 0) {
892
+ parsedPath.search = path.substr(searchIndex);
893
+ path = path.substr(0, searchIndex);
894
+ }
895
+
896
+ if (path) {
897
+ parsedPath.pathname = path;
898
+ }
899
+ }
900
+
901
+ return parsedPath;
902
+ }
903
+
904
+ // @ts-nocheck
905
+ // We're inlining qss here for compression's sake, but we've included it as a hard dependency for the MIT license it requires.
906
+ function encode(obj, pfx) {
907
+ var k,
908
+ i,
909
+ tmp,
910
+ str = '';
911
+
912
+ for (k in obj) {
913
+ if ((tmp = obj[k]) !== void 0) {
914
+ if (Array.isArray(tmp)) {
915
+ for (i = 0; i < tmp.length; i++) {
916
+ str && (str += '&');
917
+ str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp[i]);
918
+ }
919
+ } else {
920
+ str && (str += '&');
921
+ str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp);
922
+ }
923
+ }
924
+ }
925
+
926
+ return (pfx || '') + str;
927
+ }
928
+
929
+ function toValue(mix) {
930
+ if (!mix) return '';
931
+ var str = decodeURIComponent(mix);
932
+ if (str === 'false') return false;
933
+ if (str === 'true') return true;
934
+ return +str * 0 === 0 ? +str : str;
935
+ }
936
+
937
+ function decode(str) {
938
+ var tmp,
939
+ k,
940
+ out = {},
941
+ arr = str.split('&');
942
+
943
+ while (tmp = arr.shift()) {
944
+ tmp = tmp.split('=');
945
+ k = tmp.shift();
946
+
947
+ if (out[k] !== void 0) {
948
+ out[k] = [].concat(out[k], toValue(tmp.shift()));
949
+ } else {
950
+ out[k] = toValue(tmp.shift());
951
+ }
952
+ }
953
+
954
+ return out;
955
+ }
956
+
957
+ const createRouteConfig = function createRouteConfig(options, children, isRoot, parentId) {
958
+ if (options === void 0) {
959
+ options = {};
960
+ }
961
+
962
+ if (isRoot === void 0) {
963
+ isRoot = true;
964
+ }
965
+
966
+ if (isRoot) {
967
+ options.path = rootRouteId;
968
+ } else {
969
+ warning(!options.path, 'Routes must have a path property.');
970
+ } // Strip the root from parentIds
971
+
972
+
973
+ if (parentId === rootRouteId) {
974
+ parentId = '';
975
+ }
976
+
977
+ let path = String(isRoot ? rootRouteId : options.path); // If the path is anything other than an index path, trim it up
978
+
979
+ if (path !== '/') {
980
+ path = trimPath(path);
981
+ }
982
+
983
+ let id = joinPaths([parentId, path]);
984
+
985
+ if (path === rootRouteId) {
986
+ path = '/';
987
+ }
988
+
989
+ if (id !== rootRouteId) {
990
+ id = joinPaths(['/', id]);
991
+ }
992
+
993
+ const fullPath = id === rootRouteId ? '/' : trimPathRight(id);
994
+ return {
995
+ id: id,
996
+ path: path,
997
+ fullPath: fullPath,
998
+ options: options,
999
+ children,
1000
+ addChildren: cb => createRouteConfig(options, cb(childOptions => createRouteConfig(childOptions, undefined, false, id)), false, parentId)
1001
+ };
1002
+ };
1003
+ const rootRouteId = '__root__';
1004
+ // Source
1005
+ // Detect if we're in the DOM
1006
+ const isDOM$1 = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement); // This is the default history object if none is defined
1007
+
1008
+ const createDefaultHistory = () => isDOM$1 ? createBrowserHistory() : createMemoryHistory();
1009
+
1010
+ function createRouter(userOptions) {
1011
+ var _userOptions$stringif, _userOptions$parseSea;
1012
+
1013
+ const history = (userOptions == null ? void 0 : userOptions.history) || createDefaultHistory();
1014
+
1015
+ const originalOptions = _extends$1({}, userOptions, {
1016
+ stringifySearch: (_userOptions$stringif = userOptions == null ? void 0 : userOptions.stringifySearch) != null ? _userOptions$stringif : defaultStringifySearch,
1017
+ parseSearch: (_userOptions$parseSea = userOptions == null ? void 0 : userOptions.parseSearch) != null ? _userOptions$parseSea : defaultParseSearch
1018
+ });
1019
+
1020
+ let router = {
1021
+ options: originalOptions,
1022
+ listeners: [],
1023
+ // Resolved after construction
1024
+ basepath: '',
1025
+ routeTree: undefined,
1026
+ routesById: {},
1027
+ location: undefined,
1028
+ allRouteInfo: undefined,
1029
+ //
1030
+ navigationPromise: Promise.resolve(),
1031
+ resolveNavigation: () => {},
1032
+ preloadCache: {},
1033
+ state: {
1034
+ status: 'idle',
1035
+ location: null,
1036
+ matches: [],
1037
+ actions: {},
1038
+ loaderData: {},
1039
+ lastUpdated: Date.now()
1040
+ },
1041
+ startedLoadingAt: Date.now(),
1042
+ subscribe: listener => {
1043
+ router.listeners.push(listener);
1044
+ return () => {
1045
+ router.listeners = router.listeners.filter(x => x !== listener);
1046
+ };
1047
+ },
1048
+ getRoute: id => {
1049
+ return router.routesById[id];
1050
+ },
1051
+ notify: () => {
1052
+ router.state = _extends$1({}, router.state);
1053
+ router.listeners.forEach(listener => listener());
1054
+ },
1055
+ mount: () => {
1056
+ const next = router.buildLocation({
1057
+ to: '.',
1058
+ search: true,
1059
+ hash: true
1060
+ }); // If the current location isn't updated, trigger a navigation
1061
+ // to the current location. Otherwise, load the current location.
1062
+
1063
+ if (next.href !== router.location.href) {
1064
+ return router.commitLocation(next, true);
1065
+ } else {
1066
+ return router.loadLocation();
1067
+ }
1068
+ },
1069
+ update: opts => {
1070
+ Object.assign(router.options, opts);
1071
+ const {
1072
+ basepath,
1073
+ routeConfig
1074
+ } = router.options;
1075
+ router.basepath = cleanPath("/" + (basepath != null ? basepath : ''));
1076
+
1077
+ if (routeConfig) {
1078
+ router.routesById = {};
1079
+ router.routeTree = router.buildRouteTree(routeConfig);
1080
+ }
1081
+
1082
+ return router;
1083
+ },
1084
+ destroy: history.listen(event => {
1085
+ router.loadLocation(router.parseLocation(event.location, router.location));
1086
+ }),
1087
+ buildRouteTree: rootRouteConfig => {
1088
+ const recurseRoutes = (routeConfigs, parent) => {
1089
+ return routeConfigs.map(routeConfig => {
1090
+ const routeOptions = routeConfig.options;
1091
+ const route = createRoute(routeConfig, routeOptions, parent, router); // {
1092
+ // pendingMs: routeOptions.pendingMs ?? router.defaultPendingMs,
1093
+ // pendingMinMs: routeOptions.pendingMinMs ?? router.defaultPendingMinMs,
1094
+ // }
1095
+
1096
+ const existingRoute = router.routesById[route.routeId];
1097
+
1098
+ if (existingRoute) {
1099
+ {
1100
+ console.warn("Duplicate routes found with id: " + String(route.routeId), router.routesById, route);
1101
+ }
1102
+
1103
+ throw new Error();
1104
+ }
1105
+ router.routesById[route.routeId] = route;
1106
+ const children = routeConfig.children;
1107
+ route.childRoutes = children != null && children.length ? recurseRoutes(children, route) : undefined;
1108
+ return route;
1109
+ });
1110
+ };
1111
+
1112
+ const routes = recurseRoutes([rootRouteConfig]);
1113
+ return routes[0];
1114
+ },
1115
+ parseLocation: (location, previousLocation) => {
1116
+ var _location$hash$split$;
1117
+
1118
+ const parsedSearch = router.options.parseSearch(location.search);
1119
+ return {
1120
+ pathname: location.pathname,
1121
+ searchStr: location.search,
1122
+ search: replaceEqualDeep(previousLocation == null ? void 0 : previousLocation.search, parsedSearch),
1123
+ hash: (_location$hash$split$ = location.hash.split('#').reverse()[0]) != null ? _location$hash$split$ : '',
1124
+ href: "" + location.pathname + location.search + location.hash,
1125
+ state: location.state,
1126
+ key: location.key
1127
+ };
1128
+ },
1129
+ buildLocation: function buildLocation(dest) {
1130
+ var _dest$from, _router$basepath, _dest$to, _last, _dest$params, _dest$__preSearchFilt, _functionalUpdate, _dest$__preSearchFilt2, _dest$__postSearchFil;
1131
+
1132
+ if (dest === void 0) {
1133
+ dest = {};
1134
+ }
1135
+
1136
+ // const resolvedFrom: Location = {
1137
+ // ...router.location,
1138
+ const fromPathname = dest.fromCurrent ? router.location.pathname : (_dest$from = dest.from) != null ? _dest$from : router.location.pathname;
1139
+
1140
+ let pathname = _resolvePath((_router$basepath = router.basepath) != null ? _router$basepath : '/', fromPathname, "" + ((_dest$to = dest.to) != null ? _dest$to : '.'));
1141
+
1142
+ const fromMatches = router.matchRoutes(router.location.pathname, {
1143
+ strictParseParams: true
1144
+ });
1145
+ const toMatches = router.matchRoutes(pathname);
1146
+ const prevParams = (_last = last(fromMatches)) == null ? void 0 : _last.params;
1147
+ let nextParams = ((_dest$params = dest.params) != null ? _dest$params : true) === true ? prevParams : functionalUpdate(dest.params, prevParams);
1148
+
1149
+ if (nextParams) {
1150
+ toMatches.map(d => d.options.stringifyParams).filter(Boolean).forEach(fn => {
1151
+ Object.assign(nextParams, fn(nextParams));
1152
+ });
1153
+ }
1154
+
1155
+ pathname = interpolatePath(pathname, nextParams != null ? nextParams : {}); // Pre filters first
1156
+
1157
+ const preFilteredSearch = (_dest$__preSearchFilt = dest.__preSearchFilters) != null && _dest$__preSearchFilt.length ? dest.__preSearchFilters.reduce((prev, next) => next(prev), router.location.search) : router.location.search; // Then the link/navigate function
1158
+
1159
+ const destSearch = dest.search === true ? preFilteredSearch // Preserve resolvedFrom true
1160
+ : dest.search ? (_functionalUpdate = functionalUpdate(dest.search, preFilteredSearch)) != null ? _functionalUpdate : {} // Updater
1161
+ : (_dest$__preSearchFilt2 = dest.__preSearchFilters) != null && _dest$__preSearchFilt2.length ? preFilteredSearch // Preserve resolvedFrom filters
1162
+ : {}; // Then post filters
1163
+
1164
+ const postFilteredSearch = (_dest$__postSearchFil = dest.__postSearchFilters) != null && _dest$__postSearchFil.length ? dest.__postSearchFilters.reduce((prev, next) => next(prev), destSearch) : destSearch;
1165
+ const search = replaceEqualDeep(router.location.search, postFilteredSearch);
1166
+ const searchStr = router.options.stringifySearch(search);
1167
+ let hash = dest.hash === true ? router.location.hash : functionalUpdate(dest.hash, router.location.hash);
1168
+ hash = hash ? "#" + hash : '';
1169
+ return {
1170
+ pathname,
1171
+ search,
1172
+ searchStr,
1173
+ state: router.location.state,
1174
+ hash,
1175
+ href: "" + pathname + searchStr + hash,
1176
+ key: dest.key
1177
+ };
1178
+ },
1179
+ commitLocation: (next, replace) => {
1180
+ const id = '' + Date.now() + Math.random();
1181
+ if (router.navigateTimeout) clearTimeout(router.navigateTimeout);
1182
+ let nextAction = 'replace';
1183
+
1184
+ if (!replace) {
1185
+ nextAction = 'push';
1186
+ }
1187
+
1188
+ const isSameUrl = router.parseLocation(history.location).href === next.href;
1189
+
1190
+ if (isSameUrl && !next.key) {
1191
+ nextAction = 'replace';
1192
+ }
1193
+
1194
+ if (nextAction === 'replace') {
1195
+ history.replace({
1196
+ pathname: next.pathname,
1197
+ hash: next.hash,
1198
+ search: next.searchStr
1199
+ }, {
1200
+ id
1201
+ });
1202
+ } else {
1203
+ history.push({
1204
+ pathname: next.pathname,
1205
+ hash: next.hash,
1206
+ search: next.searchStr
1207
+ }, {
1208
+ id
1209
+ });
1210
+ }
1211
+
1212
+ router.navigationPromise = new Promise(resolve => {
1213
+ const previousNavigationResolve = router.resolveNavigation;
1214
+
1215
+ router.resolveNavigation = () => {
1216
+ previousNavigationResolve();
1217
+ resolve();
1218
+ };
1219
+ });
1220
+ return router.navigationPromise;
1221
+ },
1222
+ buildNext: opts => {
1223
+ const next = router.buildLocation(opts);
1224
+ const matches = router.matchRoutes(next.pathname);
1225
+
1226
+ const __preSearchFilters = matches.map(match => {
1227
+ var _match$options$preSea;
1228
+
1229
+ return (_match$options$preSea = match.options.preSearchFilters) != null ? _match$options$preSea : [];
1230
+ }).flat().filter(Boolean);
1231
+
1232
+ const __postSearchFilters = matches.map(match => {
1233
+ var _match$options$postSe;
1234
+
1235
+ return (_match$options$postSe = match.options.postSearchFilters) != null ? _match$options$postSe : [];
1236
+ }).flat().filter(Boolean);
1237
+
1238
+ return router.buildLocation(_extends$1({}, opts, {
1239
+ __preSearchFilters,
1240
+ __postSearchFilters
1241
+ }));
1242
+ },
1243
+ cancelMatches: () => {
1244
+ var _router$state$pending, _router$state$pending2;
1245
+ [...router.state.matches, ...((_router$state$pending = (_router$state$pending2 = router.state.pending) == null ? void 0 : _router$state$pending2.matches) != null ? _router$state$pending : [])].forEach(match => {
1246
+ match.cancel();
1247
+ });
1248
+ },
1249
+ loadLocation: async next => {
1250
+ const id = Math.random();
1251
+ router.startedLoadingAt = id;
1252
+
1253
+ if (next) {
1254
+ // Ingest the new location
1255
+ router.location = next;
1256
+ } // Cancel any pending matches
1257
+
1258
+
1259
+ router.cancelMatches(); // Match the routes
1260
+
1261
+ const unloadedMatches = router.matchRoutes(location.pathname, {
1262
+ strictParseParams: true
1263
+ });
1264
+ unloadedMatches.forEach((match, index) => {
1265
+ const parent = unloadedMatches[index - 1];
1266
+ const child = unloadedMatches[index + 1];
1267
+ if (parent) match.__.setParentMatch(parent);
1268
+ if (child) match.__.addChildMatch(child);
1269
+ });
1270
+ router.state = _extends$1({}, router.state, {
1271
+ pending: {
1272
+ matches: unloadedMatches,
1273
+ location: router.location
1274
+ }
1275
+ });
1276
+ router.notify(); // Load the matches
1277
+
1278
+ const matches = await router.loadMatches(unloadedMatches, {
1279
+ withPending: true
1280
+ });
1281
+
1282
+ if (router.startedLoadingAt !== id) {
1283
+ // Ignore side-effects of match loading
1284
+ return router.navigationPromise;
1285
+ }
1286
+
1287
+ const previousMatches = router.state.matches;
1288
+ previousMatches.filter(d => {
1289
+ return !matches.find(dd => dd.matchId === d.matchId);
1290
+ }).forEach(d => {
1291
+ d.__.onExit == null ? void 0 : d.__.onExit({
1292
+ params: d.params,
1293
+ search: d.routeSearch
1294
+ });
1295
+ });
1296
+ previousMatches.filter(d => {
1297
+ return matches.find(dd => dd.matchId === d.matchId);
1298
+ }).forEach(d => {
1299
+ d.options.onTransition == null ? void 0 : d.options.onTransition({
1300
+ params: d.params,
1301
+ search: d.routeSearch
1302
+ });
1303
+ });
1304
+ matches.filter(d => {
1305
+ return !previousMatches.find(dd => dd.matchId === d.matchId);
1306
+ }).forEach(d => {
1307
+ d.__.onExit = d.options.onMatch == null ? void 0 : d.options.onMatch({
1308
+ params: d.params,
1309
+ search: d.search
1310
+ });
1311
+ });
1312
+ router.state = _extends$1({}, router.state, {
1313
+ location: router.location,
1314
+ matches,
1315
+ pending: undefined
1316
+ });
1317
+
1318
+ if (matches.some(d => d.status === 'loading')) {
1319
+ router.notify();
1320
+ await Promise.all(matches.map(d => d.__.loaderPromise || Promise.resolve()));
1321
+ }
1322
+
1323
+ if (router.startedLoadingAt !== id) {
1324
+ // Ignore side-effects of match loading
1325
+ return;
1326
+ }
1327
+
1328
+ router.notify();
1329
+ router.resolveNavigation();
1330
+ },
1331
+ cleanPreloadCache: () => {
1332
+ const now = Date.now();
1333
+ Object.keys(router.preloadCache).forEach(matchId => {
1334
+ const entry = router.preloadCache[matchId]; // Don't remove loading matches
1335
+
1336
+ if (entry.match.status === 'loading') {
1337
+ return;
1338
+ } // Do not remove successful matches that are still valid
1339
+
1340
+
1341
+ if (entry.match.updatedAt && entry.match.updatedAt + entry.maxAge > now) {
1342
+ return;
1343
+ } // Everything else gets removed
1344
+
1345
+
1346
+ delete router.preloadCache[matchId];
1347
+ });
1348
+ },
1349
+ loadRoute: async function loadRoute(navigateOpts, loaderOpts) {
1350
+ if (navigateOpts === void 0) {
1351
+ navigateOpts = router.location;
1352
+ }
1353
+
1354
+ const next = router.buildNext(navigateOpts);
1355
+ const matches = router.matchRoutes(next.pathname, {
1356
+ strictParseParams: true
1357
+ });
1358
+ await router.loadMatches(matches, {
1359
+ preload: true,
1360
+ maxAge: loaderOpts.maxAge
1361
+ });
1362
+ return matches;
1363
+ },
1364
+ matchRoutes: (pathname, opts) => {
1365
+ var _router$state$pending3, _router$state$pending4;
1366
+
1367
+ router.cleanPreloadCache();
1368
+ const matches = [];
1369
+
1370
+ if (!router.routeTree) {
1371
+ return matches;
1372
+ }
1373
+
1374
+ const existingMatches = [...router.state.matches, ...((_router$state$pending3 = (_router$state$pending4 = router.state.pending) == null ? void 0 : _router$state$pending4.matches) != null ? _router$state$pending3 : [])];
1375
+
1376
+ const recurse = async (routes, parentMatch) => {
1377
+ var _parentMatch$params, _router$options$filte, _router$preloadCache$, _route$childRoutes2;
1378
+
1379
+ let params = (_parentMatch$params = parentMatch == null ? void 0 : parentMatch.params) != null ? _parentMatch$params : {};
1380
+ const filteredRoutes = (_router$options$filte = router.options.filterRoutes == null ? void 0 : router.options.filterRoutes(routes)) != null ? _router$options$filte : routes;
1381
+ const route = filteredRoutes == null ? void 0 : filteredRoutes.find(route => {
1382
+ var _route$childRoutes, _route$options$caseSe;
1383
+
1384
+ const fuzzy = !!(route.routePath !== '/' || (_route$childRoutes = route.childRoutes) != null && _route$childRoutes.length);
1385
+ const matchParams = matchPathname(pathname, {
1386
+ to: route.fullPath,
1387
+ fuzzy,
1388
+ caseSensitive: (_route$options$caseSe = route.options.caseSensitive) != null ? _route$options$caseSe : router.options.caseSensitive
1389
+ });
1390
+
1391
+ if (matchParams) {
1392
+ let parsedParams;
1393
+
1394
+ try {
1395
+ var _route$options$parseP;
1396
+
1397
+ parsedParams = (_route$options$parseP = route.options.parseParams == null ? void 0 : route.options.parseParams(matchParams)) != null ? _route$options$parseP : matchParams;
1398
+ } catch (err) {
1399
+ if (opts != null && opts.strictParseParams) {
1400
+ throw err;
1401
+ }
1402
+ }
1403
+
1404
+ params = _extends$1({}, params, parsedParams);
1405
+ }
1406
+
1407
+ return !!matchParams;
1408
+ });
1409
+
1410
+ if (!route) {
1411
+ return;
1412
+ }
1413
+
1414
+ const interpolatedPath = interpolatePath(route.routePath, params);
1415
+ const matchId = interpolatePath(route.routeId, params, true);
1416
+ const match = existingMatches.find(d => d.matchId === matchId) || ((_router$preloadCache$ = router.preloadCache[matchId]) == null ? void 0 : _router$preloadCache$.match) || createRouteMatch(router, route, {
1417
+ matchId,
1418
+ params,
1419
+ pathname: joinPaths([pathname, interpolatedPath])
1420
+ });
1421
+ matches.push(match);
1422
+
1423
+ if ((_route$childRoutes2 = route.childRoutes) != null && _route$childRoutes2.length) {
1424
+ recurse(route.childRoutes, match);
1425
+ }
1426
+ };
1427
+
1428
+ recurse([router.routeTree]);
1429
+ return matches;
1430
+ },
1431
+ loadMatches: async (resolvedMatches, loaderOpts) => {
1432
+ const matchPromises = resolvedMatches.map(async match => {
1433
+ // Validate the match (loads search params etc)
1434
+ match.__.validate(); // If this is a preload, add it to the preload cache
1435
+
1436
+
1437
+ if (loaderOpts != null && loaderOpts.preload) {
1438
+ router.preloadCache[match.matchId] = {
1439
+ maxAge: loaderOpts == null ? void 0 : loaderOpts.maxAge,
1440
+ match
1441
+ };
1442
+ } // If the match is invalid, errored or idle, trigger it to load
1443
+
1444
+
1445
+ if (match.status === 'success' && match.isInvalid || match.status === 'error' || match.status === 'idle') {
1446
+ match.load();
1447
+ } // If requested, start the pending timers
1448
+
1449
+
1450
+ if (loaderOpts != null && loaderOpts.withPending) match.__.startPending(); // Wait for the first sign of activity from the match
1451
+ // This might be completion, error, or a pending state
1452
+
1453
+ await match.__.loadPromise;
1454
+ });
1455
+ router.notify();
1456
+ await Promise.all(matchPromises);
1457
+ return resolvedMatches;
1458
+ },
1459
+ invalidateRoute: opts => {
1460
+ var _router$state$pending5, _router$state$pending6;
1461
+
1462
+ const next = router.buildNext(opts);
1463
+ const unloadedMatchIds = router.matchRoutes(next.pathname).map(d => d.matchId);
1464
+ [...router.state.matches, ...((_router$state$pending5 = (_router$state$pending6 = router.state.pending) == null ? void 0 : _router$state$pending6.matches) != null ? _router$state$pending5 : [])].forEach(match => {
1465
+ if (unloadedMatchIds.includes(match.matchId)) {
1466
+ match.isInvalid = true;
1467
+ }
1468
+ });
1469
+ },
1470
+ reload: () => router._navigate({
1471
+ fromCurrent: true,
1472
+ replace: true,
1473
+ search: true
1474
+ }),
1475
+ resolvePath: (from, path) => {
1476
+ return _resolvePath(router.basepath, from, cleanPath(path));
1477
+ },
1478
+ matchRoute: (location, opts) => {
1479
+ var _location$from;
1480
+
1481
+ // const location = router.buildNext(opts)
1482
+ location = _extends$1({}, location, {
1483
+ to: location.to ? router.resolvePath((_location$from = location.from) != null ? _location$from : '', location.to) : undefined
1484
+ });
1485
+ const next = router.buildNext(location);
1486
+
1487
+ if (opts != null && opts.pending) {
1488
+ var _router$state$pending7;
1489
+
1490
+ if (!((_router$state$pending7 = router.state.pending) != null && _router$state$pending7.location)) {
1491
+ return false;
1492
+ }
1493
+
1494
+ return !!matchPathname(router.state.pending.location.pathname, _extends$1({}, opts, {
1495
+ to: next.pathname
1496
+ }));
1497
+ }
1498
+
1499
+ return !!matchPathname(router.state.location.pathname, _extends$1({}, opts, {
1500
+ to: next.pathname
1501
+ }));
1502
+ },
1503
+ _navigate: location => {
1504
+ const next = router.buildNext(location);
1505
+ return router.commitLocation(next, location.replace);
1506
+ },
1507
+ navigate: async _ref => {
1508
+ let {
1509
+ from,
1510
+ to = '.',
1511
+ search,
1512
+ hash,
1513
+ replace
1514
+ } = _ref;
1515
+ // If this link simply reloads the current route,
1516
+ // make sure it has a new key so it will trigger a data refresh
1517
+ // If this `to` is a valid external URL, return
1518
+ // null for LinkUtils
1519
+ const toString = String(to);
1520
+ const fromString = String(from);
1521
+ let isExternal;
1522
+
1523
+ try {
1524
+ new URL("" + toString);
1525
+ isExternal = true;
1526
+ } catch (e) {}
1527
+
1528
+ if (isExternal) {
1529
+ {
1530
+ throw new Error('Attempting to navigate to external url with router.navigate!');
1531
+ }
1532
+ }
1533
+
1534
+ return router._navigate({
1535
+ from: fromString,
1536
+ to: toString,
1537
+ search,
1538
+ hash
1539
+ });
1540
+ },
1541
+ buildLink: _ref2 => {
1542
+ var _preload, _ref3, _ref4;
1543
+
1544
+ let {
1545
+ from,
1546
+ to = '.',
1547
+ search,
1548
+ params,
1549
+ hash,
1550
+ target,
1551
+ replace,
1552
+ activeOptions,
1553
+ preload,
1554
+ preloadMaxAge: userPreloadMaxAge,
1555
+ preloadDelay: userPreloadDelay,
1556
+ disabled
1557
+ } = _ref2;
1558
+
1559
+ // If this link simply reloads the current route,
1560
+ // make sure it has a new key so it will trigger a data refresh
1561
+ // If this `to` is a valid external URL, return
1562
+ // null for LinkUtils
1563
+ try {
1564
+ new URL("" + to);
1565
+ return {
1566
+ type: 'external',
1567
+ href: to
1568
+ };
1569
+ } catch (e) {}
1570
+
1571
+ const nextOpts = {
1572
+ from,
1573
+ to,
1574
+ search,
1575
+ params,
1576
+ hash,
1577
+ replace
1578
+ };
1579
+ const next = router.buildNext(nextOpts);
1580
+ preload = (_preload = preload) != null ? _preload : router.options.defaultLinkPreload;
1581
+ const preloadMaxAge = (_ref3 = userPreloadMaxAge != null ? userPreloadMaxAge : router.options.defaultLinkPreloadMaxAge) != null ? _ref3 : 2000;
1582
+ const preloadDelay = (_ref4 = userPreloadDelay != null ? userPreloadDelay : router.options.defaultLinkPreloadDelay) != null ? _ref4 : 50; // Compare path/hash for matches
1583
+
1584
+ const pathIsEqual = router.state.location.pathname === next.pathname;
1585
+ const currentPathSplit = router.state.location.pathname.split('/');
1586
+ const nextPathSplit = next.pathname.split('/');
1587
+ const pathIsFuzzyEqual = nextPathSplit.every((d, i) => d === currentPathSplit[i]);
1588
+ const hashIsEqual = router.state.location.hash === next.hash; // Combine the matches based on user options
1589
+
1590
+ const pathTest = activeOptions != null && activeOptions.exact ? pathIsEqual : pathIsFuzzyEqual;
1591
+ const hashTest = activeOptions != null && activeOptions.includeHash ? hashIsEqual : true; // The final "active" test
1592
+
1593
+ const isActive = pathTest && hashTest; // The click handler
1594
+
1595
+ const handleClick = e => {
1596
+ if (!disabled && !isCtrlEvent(e) && !e.defaultPrevented && (!target || target === '_self') && e.button === 0) {
1597
+ e.preventDefault();
1598
+
1599
+ if (pathIsEqual && !search && !hash) {
1600
+ router.invalidateRoute(nextOpts);
1601
+ } // All is well? Navigate!)
1602
+
1603
+
1604
+ router._navigate(nextOpts);
1605
+ }
1606
+ }; // The click handler
1607
+
1608
+
1609
+ const handleFocus = e => {
1610
+ if (preload && preloadMaxAge > 0) {
1611
+ router.loadRoute(nextOpts, {
1612
+ maxAge: preloadMaxAge
1613
+ });
1614
+ }
1615
+ };
1616
+
1617
+ const handleEnter = e => {
1618
+ const target = e.target || {};
1619
+
1620
+ if (preload && preloadMaxAge > 0) {
1621
+ if (target.preloadTimeout) {
1622
+ return;
1623
+ }
1624
+
1625
+ target.preloadTimeout = setTimeout(() => {
1626
+ target.preloadTimeout = null;
1627
+ router.loadRoute(nextOpts, {
1628
+ maxAge: preloadMaxAge
1629
+ });
1630
+ }, preloadDelay);
1631
+ }
1632
+ };
1633
+
1634
+ const handleLeave = e => {
1635
+ const target = e.target || {};
1636
+
1637
+ if (target.preloadTimeout) {
1638
+ clearTimeout(target.preloadTimeout);
1639
+ target.preloadTimeout = null;
1640
+ }
1641
+ };
1642
+
1643
+ return {
1644
+ type: 'internal',
1645
+ next,
1646
+ handleFocus,
1647
+ handleClick,
1648
+ handleEnter,
1649
+ handleLeave,
1650
+ isActive,
1651
+ disabled
1652
+ };
1653
+ },
1654
+ __experimental__createSnapshot: () => {
1655
+ return _extends$1({}, router.state, {
1656
+ matches: router.state.matches.map(_ref5 => {
1657
+ let {
1658
+ routeLoaderData: loaderData,
1659
+ matchId
1660
+ } = _ref5;
1661
+ return {
1662
+ matchId,
1663
+ loaderData
1664
+ };
1665
+ })
1666
+ });
1667
+ }
1668
+ };
1669
+ router.location = router.parseLocation(history.location); // router.state.location = __experimental__snapshot?.location ?? router.location
1670
+
1671
+ router.state.location = router.location;
1672
+ router.update(userOptions); // Allow frameworks to hook into the router creation
1673
+
1674
+ router.options.createRouter == null ? void 0 : router.options.createRouter(router); // router.mount()
1675
+
1676
+ return router;
1677
+ }
1678
+ function createRoute(routeConfig, options, parent, router) {
1679
+ // const id = (
1680
+ // options.path === rootRouteId
1681
+ // ? rootRouteId
1682
+ // : joinPaths([
1683
+ // parent!.id,
1684
+ // `${options.path?.replace(/(.)\/$/, '$1')}`,
1685
+ // ]).replace(new RegExp(`^${rootRouteId}`), '')
1686
+ // ) as TRouteInfo['id']
1687
+ const {
1688
+ id: routeId,
1689
+ path: routePath,
1690
+ fullPath
1691
+ } = routeConfig;
1692
+
1693
+ const action = router.state.actions[routeId] || (() => {
1694
+ router.state.actions[routeId] = {
1695
+ pending: [],
1696
+ submit: async (submission, actionOpts) => {
1697
+ var _actionOpts$invalidat;
1698
+
1699
+ if (!route) {
1700
+ return;
1701
+ }
1702
+
1703
+ const invalidate = (_actionOpts$invalidat = actionOpts == null ? void 0 : actionOpts.invalidate) != null ? _actionOpts$invalidat : true;
1704
+ const actionState = {
1705
+ submittedAt: Date.now(),
1706
+ status: 'pending',
1707
+ submission
1708
+ };
1709
+ action.latest = actionState;
1710
+ action.pending.push(actionState);
1711
+ router.state = _extends$1({}, router.state, {
1712
+ action: actionState
1713
+ });
1714
+ router.notify();
1715
+
1716
+ try {
1717
+ const res = await (route.options.action == null ? void 0 : route.options.action(submission));
1718
+ actionState.data = res;
1719
+
1720
+ if (invalidate) {
1721
+ router.invalidateRoute({
1722
+ to: '.',
1723
+ fromCurrent: true
1724
+ });
1725
+ await router.reload();
1726
+ }
1727
+
1728
+ actionState.status = 'success';
1729
+ return res;
1730
+ } catch (err) {
1731
+ console.error(err);
1732
+ actionState.error = err;
1733
+ actionState.status = 'error';
1734
+ } finally {
1735
+ action.pending = action.pending.filter(d => d !== actionState);
1736
+
1737
+ if (actionState === router.state.action) {
1738
+ router.state.action = undefined;
1739
+ }
1740
+
1741
+ router.notify();
1742
+ }
1743
+ }
1744
+ };
1745
+ return router.state.actions[routeId];
1746
+ })();
1747
+
1748
+ let route = {
1749
+ routeId,
1750
+ routePath,
1751
+ fullPath,
1752
+ options,
1753
+ router,
1754
+ childRoutes: undefined,
1755
+ parentRoute: parent,
1756
+ action,
1757
+ buildLink: options => {
1758
+ return router.buildLink(_extends$1({}, options, {
1759
+ from: fullPath
1760
+ }));
1761
+ },
1762
+ navigate: options => {
1763
+ return router.navigate(_extends$1({}, options, {
1764
+ from: fullPath
1765
+ }));
1766
+ },
1767
+ matchRoute: (matchLocation, opts) => {
1768
+ return router.matchRoute(_extends$1({}, matchLocation, {
1769
+ from: fullPath
1770
+ }), opts);
1771
+ }
1772
+ };
1773
+ router.options.createRoute == null ? void 0 : router.options.createRoute({
1774
+ router,
1775
+ route
1776
+ });
1777
+ return route;
1778
+ }
1779
+ function createRouteMatch(router, route, opts) {
1780
+ const routeMatch = _extends$1({}, route, opts, {
1781
+ router,
1782
+ routeSearch: {},
1783
+ search: {},
1784
+ childMatches: [],
1785
+ status: 'idle',
1786
+ routeLoaderData: {},
1787
+ loaderData: {},
1788
+ isPending: false,
1789
+ isFetching: false,
1790
+ isInvalid: false,
1791
+ __: {
1792
+ abortController: new AbortController(),
1793
+ latestId: '',
1794
+ resolve: () => {},
1795
+ notify: () => {
1796
+ routeMatch.__.resolve();
1797
+
1798
+ routeMatch.router.notify();
1799
+ },
1800
+ startPending: () => {
1801
+ var _routeMatch$options$p, _routeMatch$options$p2;
1802
+
1803
+ const pendingMs = (_routeMatch$options$p = routeMatch.options.pendingMs) != null ? _routeMatch$options$p : router.options.defaultPendingMs;
1804
+ const pendingMinMs = (_routeMatch$options$p2 = routeMatch.options.pendingMinMs) != null ? _routeMatch$options$p2 : router.options.defaultPendingMinMs;
1805
+
1806
+ if (routeMatch.__.pendingTimeout || routeMatch.status !== 'loading' || typeof pendingMs === 'undefined') {
1807
+ return;
1808
+ }
1809
+
1810
+ routeMatch.__.pendingTimeout = setTimeout(() => {
1811
+ routeMatch.isPending = true;
1812
+
1813
+ routeMatch.__.resolve();
1814
+
1815
+ if (typeof pendingMinMs !== 'undefined') {
1816
+ routeMatch.__.pendingMinPromise = new Promise(r => routeMatch.__.pendingMinTimeout = setTimeout(r, pendingMinMs));
1817
+ }
1818
+ }, pendingMs);
1819
+ },
1820
+ cancelPending: () => {
1821
+ routeMatch.isPending = false;
1822
+ clearTimeout(routeMatch.__.pendingTimeout);
1823
+ clearTimeout(routeMatch.__.pendingMinTimeout);
1824
+ delete routeMatch.__.pendingMinPromise;
1825
+ },
1826
+ setParentMatch: parentMatch => {
1827
+ routeMatch.parentMatch = parentMatch;
1828
+ },
1829
+ addChildMatch: childMatch => {
1830
+ if (routeMatch.childMatches.find(d => d.matchId === childMatch.matchId)) {
1831
+ return;
1832
+ }
1833
+
1834
+ routeMatch.childMatches.push(childMatch);
1835
+ },
1836
+ validate: () => {
1837
+ var _routeMatch$parentMat, _routeMatch$parentMat2;
1838
+
1839
+ // Validate the search params and stabilize them
1840
+ const parentSearch = (_routeMatch$parentMat = (_routeMatch$parentMat2 = routeMatch.parentMatch) == null ? void 0 : _routeMatch$parentMat2.search) != null ? _routeMatch$parentMat : router.location.search;
1841
+
1842
+ try {
1843
+ const prevSearch = routeMatch.routeSearch;
1844
+ let nextSearch = replaceEqualDeep(prevSearch, routeMatch.options.validateSearch == null ? void 0 : routeMatch.options.validateSearch(parentSearch)); // Invalidate route matches when search param stability changes
1845
+
1846
+ if (prevSearch !== nextSearch) {
1847
+ routeMatch.isInvalid = true;
1848
+ }
1849
+
1850
+ routeMatch.routeSearch = nextSearch;
1851
+ routeMatch.search = replaceEqualDeep(parentSearch, _extends$1({}, parentSearch, nextSearch));
1852
+ } catch (err) {
1853
+ console.error(err);
1854
+ const error = new Error('Invalid search params found', {
1855
+ cause: err
1856
+ });
1857
+ error.code = 'INVALID_SEARCH_PARAMS';
1858
+ routeMatch.status = 'error';
1859
+ routeMatch.error = error; // Do not proceed with loading the route
1860
+
1861
+ return;
1862
+ }
1863
+ }
1864
+ },
1865
+ cancel: () => {
1866
+ var _routeMatch$__$abortC;
1867
+
1868
+ (_routeMatch$__$abortC = routeMatch.__.abortController) == null ? void 0 : _routeMatch$__$abortC.abort();
1869
+
1870
+ routeMatch.__.cancelPending();
1871
+ },
1872
+ load: async () => {
1873
+ const id = '' + Date.now() + Math.random();
1874
+ routeMatch.__.latestId = id; // If the match was in an error state, set it
1875
+ // to a loading state again. Otherwise, keep it
1876
+ // as loading or resolved
1877
+
1878
+ if (routeMatch.status === 'error' || routeMatch.status === 'idle') {
1879
+ routeMatch.status = 'loading';
1880
+ } // We started loading the route, so it's no longer invalid
1881
+
1882
+
1883
+ routeMatch.isInvalid = false;
1884
+ routeMatch.__.loadPromise = new Promise(async resolve => {
1885
+ // We are now fetching, even if it's in the background of a
1886
+ // resolved state
1887
+ routeMatch.isFetching = true;
1888
+ routeMatch.__.resolve = resolve;
1889
+
1890
+ const loaderPromise = (async () => {
1891
+ const importer = routeMatch.options.import; // First, run any importers
1892
+
1893
+ if (importer) {
1894
+ routeMatch.__.importPromise = importer({
1895
+ params: routeMatch.params // search: routeMatch.search,
1896
+
1897
+ }).then(imported => {
1898
+ routeMatch.__ = _extends$1({}, routeMatch.__, imported);
1899
+ });
1900
+ } // Wait for the importer to finish before
1901
+ // attempting to load elements and data
1902
+
1903
+
1904
+ await routeMatch.__.importPromise; // Next, load the elements and data in parallel
1905
+
1906
+ routeMatch.__.elementsPromise = (async () => {
1907
+ // then run all element and data loaders in parallel
1908
+ // For each element type, potentially load it asynchronously
1909
+ const elementTypes = ['element', 'errorElement', 'catchElement', 'pendingElement'];
1910
+ await Promise.all(elementTypes.map(async type => {
1911
+ const routeElement = routeMatch.options[type];
1912
+
1913
+ if (routeMatch.__[type]) {
1914
+ return;
1915
+ }
1916
+
1917
+ if (typeof routeElement === 'function') {
1918
+ const res = await routeElement(routeMatch);
1919
+ routeMatch.__[type] = res;
1920
+ } else {
1921
+ routeMatch.__[type] = routeMatch.options[type];
1922
+ }
1923
+ }));
1924
+ })();
1925
+
1926
+ routeMatch.__.dataPromise = Promise.resolve().then(async () => {
1927
+ try {
1928
+ const data = await (routeMatch.options.loader == null ? void 0 : routeMatch.options.loader({
1929
+ params: routeMatch.params,
1930
+ search: routeMatch.routeSearch,
1931
+ signal: routeMatch.__.abortController.signal
1932
+ }));
1933
+
1934
+ if (id !== routeMatch.__.latestId) {
1935
+ return routeMatch.__.loaderPromise;
1936
+ }
1937
+
1938
+ routeMatch.routeLoaderData = replaceEqualDeep(routeMatch.routeLoaderData, data);
1939
+ cascadeLoaderData(routeMatch);
1940
+ routeMatch.error = undefined;
1941
+ routeMatch.status = 'success';
1942
+ routeMatch.updatedAt = Date.now();
1943
+ } catch (err) {
1944
+ if (id !== routeMatch.__.latestId) {
1945
+ return routeMatch.__.loaderPromise;
1946
+ }
1947
+
1948
+ {
1949
+ console.error(err);
1950
+ }
1951
+
1952
+ routeMatch.error = err;
1953
+ routeMatch.status = 'error';
1954
+ routeMatch.updatedAt = Date.now();
1955
+ }
1956
+ });
1957
+
1958
+ try {
1959
+ await Promise.all([routeMatch.__.elementsPromise, routeMatch.__.dataPromise]);
1960
+
1961
+ if (id !== routeMatch.__.latestId) {
1962
+ return routeMatch.__.loaderPromise;
1963
+ }
1964
+
1965
+ if (routeMatch.__.pendingMinPromise) {
1966
+ await routeMatch.__.pendingMinPromise;
1967
+ delete routeMatch.__.pendingMinPromise;
1968
+ }
1969
+ } finally {
1970
+ if (id !== routeMatch.__.latestId) {
1971
+ return routeMatch.__.loaderPromise;
1972
+ }
1973
+
1974
+ routeMatch.__.cancelPending();
1975
+
1976
+ routeMatch.isPending = false;
1977
+ routeMatch.isFetching = false;
1978
+
1979
+ routeMatch.__.notify();
1980
+ }
1981
+ })();
1982
+
1983
+ routeMatch.__.loaderPromise = loaderPromise;
1984
+ await loaderPromise;
1985
+
1986
+ if (id !== routeMatch.__.latestId) {
1987
+ return routeMatch.__.loaderPromise;
1988
+ }
1989
+
1990
+ delete routeMatch.__.loaderPromise;
1991
+ });
1992
+ return await routeMatch.__.loadPromise;
1993
+ }
1994
+ });
1995
+
1996
+ return routeMatch;
1997
+ }
1998
+
1999
+ function cascadeLoaderData(routeMatch) {
2000
+ if (routeMatch.parentMatch) {
2001
+ routeMatch.loaderData = replaceEqualDeep(routeMatch.loaderData, _extends$1({}, routeMatch.parentMatch.loaderData, routeMatch.routeLoaderData));
2002
+ }
2003
+
2004
+ if (routeMatch.childMatches.length) {
2005
+ routeMatch.childMatches.forEach(childMatch => {
2006
+ cascadeLoaderData(childMatch);
2007
+ });
2008
+ }
2009
+ }
2010
+
2011
+ function matchPathname(currentPathname, matchLocation) {
2012
+ const pathParams = matchByPath(currentPathname, matchLocation); // const searchMatched = matchBySearch(currentLocation.search, matchLocation)
2013
+
2014
+ if (matchLocation.to && !pathParams) {
2015
+ return;
2016
+ } // if (matchLocation.search && !searchMatched) {
2017
+ // return
2018
+ // }
2019
+
2020
+
2021
+ return pathParams != null ? pathParams : {};
2022
+ }
2023
+
2024
+ function interpolatePath(path, params, leaveWildcard) {
2025
+ const interpolatedPathSegments = parsePathname(path);
2026
+ return joinPaths(interpolatedPathSegments.map(segment => {
2027
+ if (segment.value === '*' && !leaveWildcard) {
2028
+ return '';
2029
+ }
2030
+
2031
+ if (segment.type === 'param') {
2032
+ var _segment$value$substr;
2033
+
2034
+ return (_segment$value$substr = params[segment.value.substring(1)]) != null ? _segment$value$substr : '';
2035
+ }
2036
+
2037
+ return segment.value;
2038
+ }));
2039
+ }
2040
+
2041
+ function warning(cond, message) {
2042
+ if (cond) {
2043
+ if (typeof console !== 'undefined') console.warn(message);
2044
+
2045
+ try {
2046
+ throw new Error(message);
2047
+ } catch (_unused) {}
2048
+ }
2049
+
2050
+ return true;
2051
+ }
2052
+
2053
+ function isFunction(d) {
2054
+ return typeof d === 'function';
2055
+ }
2056
+
2057
+ function functionalUpdate(updater, previous) {
2058
+ if (isFunction(updater)) {
2059
+ return updater(previous);
2060
+ }
2061
+
2062
+ return updater;
2063
+ }
2064
+
2065
+ function joinPaths(paths) {
2066
+ return cleanPath(paths.filter(Boolean).join('/'));
2067
+ }
2068
+
2069
+ function cleanPath(path) {
2070
+ // remove double slashes
2071
+ return path.replace(/\/{2,}/g, '/');
2072
+ }
2073
+
2074
+ function trimPathLeft(path) {
2075
+ return path === '/' ? path : path.replace(/^\/{1,}/, '');
2076
+ }
2077
+
2078
+ function trimPathRight(path) {
2079
+ return path === '/' ? path : path.replace(/\/{1,}$/, '');
2080
+ }
2081
+
2082
+ function trimPath(path) {
2083
+ return trimPathRight(trimPathLeft(path));
2084
+ }
2085
+
2086
+ function matchByPath(from, matchLocation) {
2087
+ var _matchLocation$to;
2088
+
2089
+ const baseSegments = parsePathname(from);
2090
+ const routeSegments = parsePathname("" + ((_matchLocation$to = matchLocation.to) != null ? _matchLocation$to : '*'));
2091
+ const params = {};
2092
+
2093
+ let isMatch = (() => {
2094
+ for (let i = 0; i < Math.max(baseSegments.length, routeSegments.length); i++) {
2095
+ const baseSegment = baseSegments[i];
2096
+ const routeSegment = routeSegments[i];
2097
+ const isLastRouteSegment = i === routeSegments.length - 1;
2098
+ const isLastBaseSegment = i === baseSegments.length - 1;
2099
+
2100
+ if (routeSegment) {
2101
+ if (routeSegment.type === 'wildcard') {
2102
+ if (baseSegment != null && baseSegment.value) {
2103
+ params['*'] = joinPaths(baseSegments.slice(i).map(d => d.value));
2104
+ return true;
2105
+ }
2106
+
2107
+ return false;
2108
+ }
2109
+
2110
+ if (routeSegment.type === 'pathname') {
2111
+ if (routeSegment.value === '/' && !(baseSegment != null && baseSegment.value)) {
2112
+ return true;
2113
+ }
2114
+
2115
+ if (baseSegment) {
2116
+ if (matchLocation.caseSensitive) {
2117
+ if (routeSegment.value !== baseSegment.value) {
2118
+ return false;
2119
+ }
2120
+ } else if (routeSegment.value.toLowerCase() !== baseSegment.value.toLowerCase()) {
2121
+ return false;
2122
+ }
2123
+ }
2124
+ }
2125
+
2126
+ if (!baseSegment) {
2127
+ return false;
2128
+ }
2129
+
2130
+ if (routeSegment.type === 'param') {
2131
+ if ((baseSegment == null ? void 0 : baseSegment.value) === '/') {
2132
+ return false;
2133
+ }
2134
+
2135
+ if (!baseSegment.value.startsWith(':')) {
2136
+ params[routeSegment.value.substring(1)] = baseSegment.value;
2137
+ }
2138
+ }
2139
+ }
2140
+
2141
+ if (isLastRouteSegment && !isLastBaseSegment) {
2142
+ return !!matchLocation.fuzzy;
2143
+ }
2144
+ }
2145
+
2146
+ return true;
2147
+ })();
2148
+
2149
+ return isMatch ? params : undefined;
2150
+ } // function matchBySearch(
2151
+ // search: SearchSchema,
2152
+ // matchLocation: MatchLocation,
2153
+ // ) {
2154
+ // return !!(matchLocation.search && matchLocation.search(search))
2155
+ // }
2156
+
2157
+ function parsePathname(pathname) {
2158
+ if (!pathname) {
2159
+ return [];
2160
+ }
2161
+
2162
+ pathname = cleanPath(pathname);
2163
+ const segments = [];
2164
+
2165
+ if (pathname.slice(0, 1) === '/') {
2166
+ pathname = pathname.substring(1);
2167
+ segments.push({
2168
+ type: 'pathname',
2169
+ value: '/'
2170
+ });
2171
+ }
2172
+
2173
+ if (!pathname) {
2174
+ return segments;
2175
+ } // Remove empty segments and '.' segments
2176
+
2177
+
2178
+ const split = pathname.split('/').filter(Boolean);
2179
+ segments.push(...split.map(part => {
2180
+ if (part.startsWith('*')) {
2181
+ return {
2182
+ type: 'wildcard',
2183
+ value: part
2184
+ };
2185
+ }
2186
+
2187
+ if (part.charAt(0) === ':') {
2188
+ return {
2189
+ type: 'param',
2190
+ value: part
2191
+ };
2192
+ }
2193
+
2194
+ return {
2195
+ type: 'pathname',
2196
+ value: part
2197
+ };
2198
+ }));
2199
+
2200
+ if (pathname.slice(-1) === '/') {
2201
+ pathname = pathname.substring(1);
2202
+ segments.push({
2203
+ type: 'pathname',
2204
+ value: '/'
2205
+ });
2206
+ }
2207
+
2208
+ return segments;
2209
+ }
2210
+
2211
+ function _resolvePath(basepath, base, to) {
2212
+ base = base.replace(new RegExp("^" + basepath), '/');
2213
+ to = to.replace(new RegExp("^" + basepath), '/');
2214
+ let baseSegments = parsePathname(base);
2215
+ const toSegments = parsePathname(to);
2216
+ toSegments.forEach((toSegment, index) => {
2217
+ if (toSegment.value === '/') {
2218
+ if (!index) {
2219
+ // Leading slash
2220
+ baseSegments = [toSegment];
2221
+ } else if (index === toSegments.length - 1) {
2222
+ // Trailing Slash
2223
+ baseSegments.push(toSegment);
2224
+ } else ;
2225
+ } else if (toSegment.value === '..') {
2226
+ var _last2;
2227
+
2228
+ // Extra trailing slash? pop it off
2229
+ if (baseSegments.length > 1 && ((_last2 = last(baseSegments)) == null ? void 0 : _last2.value) === '/') {
2230
+ baseSegments.pop();
2231
+ }
2232
+
2233
+ baseSegments.pop();
2234
+ } else if (toSegment.value === '.') {
2235
+ return;
2236
+ } else {
2237
+ baseSegments.push(toSegment);
2238
+ }
2239
+ });
2240
+ const joined = joinPaths([basepath, ...baseSegments.map(d => d.value)]);
2241
+ return cleanPath(joined);
2242
+ }
2243
+ function replaceEqualDeep(prev, next) {
2244
+ if (prev === next) {
2245
+ return prev;
2246
+ }
2247
+
2248
+ const array = Array.isArray(prev) && Array.isArray(next);
2249
+
2250
+ if (array || isPlainObject(prev) && isPlainObject(next)) {
2251
+ const aSize = array ? prev.length : Object.keys(prev).length;
2252
+ const bItems = array ? next : Object.keys(next);
2253
+ const bSize = bItems.length;
2254
+ const copy = array ? [] : {};
2255
+ let equalItems = 0;
2256
+
2257
+ for (let i = 0; i < bSize; i++) {
2258
+ const key = array ? i : bItems[i];
2259
+ copy[key] = replaceEqualDeep(prev[key], next[key]);
2260
+
2261
+ if (copy[key] === prev[key]) {
2262
+ equalItems++;
2263
+ }
2264
+ }
2265
+
2266
+ return aSize === bSize && equalItems === aSize ? prev : copy;
2267
+ }
2268
+
2269
+ return next;
2270
+ } // Copied from: https://github.com/jonschlinkert/is-plain-object
2271
+
2272
+ function isPlainObject(o) {
2273
+ if (!hasObjectPrototype(o)) {
2274
+ return false;
2275
+ } // If has modified constructor
2276
+
2277
+
2278
+ const ctor = o.constructor;
2279
+
2280
+ if (typeof ctor === 'undefined') {
2281
+ return true;
2282
+ } // If has modified prototype
2283
+
2284
+
2285
+ const prot = ctor.prototype;
2286
+
2287
+ if (!hasObjectPrototype(prot)) {
2288
+ return false;
2289
+ } // If constructor does not have an Object-specific method
2290
+
2291
+
2292
+ if (!prot.hasOwnProperty('isPrototypeOf')) {
2293
+ return false;
2294
+ } // Most likely a plain Object
2295
+
2296
+
2297
+ return true;
2298
+ }
2299
+
2300
+ function hasObjectPrototype(o) {
2301
+ return Object.prototype.toString.call(o) === '[object Object]';
2302
+ }
2303
+
2304
+ const defaultParseSearch = parseSearchWith(JSON.parse);
2305
+ const defaultStringifySearch = stringifySearchWith(JSON.stringify);
2306
+ function parseSearchWith(parser) {
2307
+ return searchStr => {
2308
+ if (searchStr.substring(0, 1) === '?') {
2309
+ searchStr = searchStr.substring(1);
2310
+ }
2311
+
2312
+ let query = decode(searchStr); // Try to parse any query params that might be json
2313
+
2314
+ for (let key in query) {
2315
+ const value = query[key];
2316
+
2317
+ if (typeof value === 'string') {
2318
+ try {
2319
+ query[key] = parser(value);
2320
+ } catch (err) {//
2321
+ }
2322
+ }
2323
+ }
2324
+
2325
+ return query;
2326
+ };
2327
+ }
2328
+ function stringifySearchWith(stringify) {
2329
+ return search => {
2330
+ search = _extends$1({}, search);
2331
+
2332
+ if (search) {
2333
+ Object.keys(search).forEach(key => {
2334
+ const val = search[key];
2335
+
2336
+ if (typeof val === 'undefined' || val === undefined) {
2337
+ delete search[key];
2338
+ } else if (val && typeof val === 'object' && val !== null) {
2339
+ try {
2340
+ search[key] = stringify(val);
2341
+ } catch (err) {// silent
2342
+ }
2343
+ }
2344
+ });
2345
+ }
2346
+
2347
+ const searchStr = encode(search).toString();
2348
+ return searchStr ? "?" + searchStr : '';
2349
+ };
2350
+ }
2351
+
2352
+ function isCtrlEvent(e) {
2353
+ return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
2354
+ }
2355
+
2356
+ function last(arr) {
2357
+ return arr[arr.length - 1];
2358
+ }
2359
+
2360
+ const _excluded = ["type", "children", "target", "activeProps", "inactiveProps", "activeOptions", "disabled", "hash", "search", "params", "to", "preload", "preloadDelay", "preloadMaxAge", "replace", "style", "className", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "onTouchStart", "onTouchEnd"],
2361
+ _excluded2 = ["pending", "caseSensitive", "children"],
2362
+ _excluded3 = ["children", "router"];
2363
+ //
2364
+ const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
2365
+ const routerContext = /*#__PURE__*/React__namespace.createContext(null); // Detect if we're in the DOM
2366
+
2367
+ const isDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
2368
+ const useLayoutEffect = isDOM ? React__namespace.useLayoutEffect : React__namespace.useEffect;
2369
+ function MatchesProvider(props) {
2370
+ return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, props);
2371
+ }
2372
+
2373
+ const useRouterSubscription = router => {
2374
+ shim.useSyncExternalStore(cb => router.subscribe(() => cb()), () => router.state);
2375
+ };
2376
+
2377
+ function createReactRouter(opts) {
2378
+ const coreRouter = createRouter(_extends$2({}, opts, {
2379
+ createRouter: router => {
2380
+ const routerExt = {
2381
+ useRoute: routeId => {
2382
+ const route = router.getRoute(routeId);
2383
+ useRouterSubscription(router);
2384
+
2385
+ if (!route) {
2386
+ throw new Error("Could not find a route for route \"" + routeId + "\"! Did you forget to add it to your route config?");
2387
+ }
2388
+
2389
+ return route;
2390
+ },
2391
+ useMatch: routeId => {
2392
+ if (routeId === rootRouteId) {
2393
+ throw new Error("\"" + rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + rootRouteId + "\")?");
2394
+ }
2395
+
2396
+ const runtimeMatch = _useMatch();
2397
+
2398
+ const match = router.state.matches.find(d => d.routeId === routeId);
2399
+
2400
+ if (!match) {
2401
+ throw new Error("Could not find a match for route \"" + routeId + "\" being rendered in this component!");
2402
+ }
2403
+
2404
+ if (runtimeMatch.routeId !== (match == null ? void 0 : match.routeId)) {
2405
+ throw new Error("useMatch('" + (match == null ? void 0 : match.routeId) + "') is being called in a component that is meant to render the '" + runtimeMatch.routeId + "' route. Did you mean to 'useRoute(" + (match == null ? void 0 : match.routeId) + ")' instead?");
2406
+ }
2407
+
2408
+ useRouterSubscription(router);
2409
+
2410
+ if (!match) {
2411
+ throw new Error('Match not found!');
2412
+ }
2413
+
2414
+ return match;
2415
+ }
2416
+ };
2417
+ Object.assign(router, routerExt);
2418
+ },
2419
+ createRoute: _ref => {
2420
+ let {
2421
+ router,
2422
+ route
2423
+ } = _ref;
2424
+ const routeExt = {
2425
+ linkProps: options => {
2426
+ var _functionalUpdate, _functionalUpdate2;
2427
+
2428
+ const {
2429
+ // custom props
2430
+ target,
2431
+ activeProps = () => ({
2432
+ className: 'active'
2433
+ }),
2434
+ inactiveProps = () => ({}),
2435
+ disabled,
2436
+ // element props
2437
+ style,
2438
+ className,
2439
+ onClick,
2440
+ onFocus,
2441
+ onMouseEnter,
2442
+ onMouseLeave
2443
+ } = options,
2444
+ rest = _objectWithoutPropertiesLoose(options, _excluded);
2445
+
2446
+ const linkInfo = route.buildLink(options);
2447
+
2448
+ if (linkInfo.type === 'external') {
2449
+ const {
2450
+ href
2451
+ } = linkInfo;
2452
+ return {
2453
+ href
2454
+ };
2455
+ }
2456
+
2457
+ const {
2458
+ handleClick,
2459
+ handleFocus,
2460
+ handleEnter,
2461
+ handleLeave,
2462
+ isActive,
2463
+ next
2464
+ } = linkInfo;
2465
+
2466
+ const composeHandlers = handlers => e => {
2467
+ e.persist();
2468
+ handlers.forEach(handler => {
2469
+ if (handler) handler(e);
2470
+ });
2471
+ }; // Get the active props
2472
+
2473
+
2474
+ const resolvedActiveProps = isActive ? (_functionalUpdate = functionalUpdate(activeProps)) != null ? _functionalUpdate : {} : {}; // Get the inactive props
2475
+
2476
+ const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = functionalUpdate(inactiveProps)) != null ? _functionalUpdate2 : {};
2477
+ return _extends$2({}, resolvedActiveProps, resolvedInactiveProps, rest, {
2478
+ href: disabled ? undefined : next.href,
2479
+ onClick: composeHandlers([handleClick, onClick]),
2480
+ onFocus: composeHandlers([handleFocus, onFocus]),
2481
+ onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
2482
+ onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
2483
+ target,
2484
+ style: _extends$2({}, style, resolvedActiveProps.style, resolvedInactiveProps.style),
2485
+ className: [className, resolvedActiveProps.className, resolvedInactiveProps.className].filter(Boolean).join(' ') || undefined
2486
+ }, disabled ? {
2487
+ role: 'link',
2488
+ 'aria-disabled': true
2489
+ } : undefined, {
2490
+ ['data-status']: isActive ? 'active' : undefined
2491
+ });
2492
+ },
2493
+ Link: /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
2494
+ const linkProps = route.linkProps(props);
2495
+ useRouterSubscription(router);
2496
+ return /*#__PURE__*/React__namespace.createElement("a", _extends$2({
2497
+ ref: ref
2498
+ }, linkProps, {
2499
+ children: typeof props.children === 'function' ? props.children({
2500
+ isActive: linkProps['data-status'] === 'active'
2501
+ }) : props.children
2502
+ }));
2503
+ }),
2504
+ MatchRoute: opts => {
2505
+ const {
2506
+ pending,
2507
+ caseSensitive
2508
+ } = opts,
2509
+ rest = _objectWithoutPropertiesLoose(opts, _excluded2);
2510
+
2511
+ const params = route.matchRoute(rest, {
2512
+ pending,
2513
+ caseSensitive
2514
+ }); // useRouterSubscription(router)
2515
+
2516
+ if (!params) {
2517
+ return null;
2518
+ }
2519
+
2520
+ return typeof opts.children === 'function' ? opts.children(params) : opts.children;
2521
+ }
2522
+ };
2523
+ Object.assign(route, routeExt);
2524
+ }
2525
+ }));
2526
+ return coreRouter;
2527
+ }
2528
+ function RouterProvider(_ref2) {
2529
+ let {
2530
+ children,
2531
+ router
2532
+ } = _ref2,
2533
+ rest = _objectWithoutPropertiesLoose(_ref2, _excluded3);
2534
+
2535
+ router.update(rest);
2536
+ shim.useSyncExternalStore(cb => router.subscribe(() => cb()), () => router.state);
2537
+ useLayoutEffect(() => {
2538
+ router.mount();
2539
+ }, []);
2540
+ return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
2541
+ value: {
2542
+ router
2543
+ }
2544
+ }, /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
2545
+ value: router.state.matches
2546
+ }, children != null ? children : /*#__PURE__*/React__namespace.createElement(Outlet, null)));
2547
+ }
2548
+ function useRouter() {
2549
+ const value = React__namespace.useContext(routerContext);
2550
+ warning(!value, 'useRouter must be used inside a <Router> component!');
2551
+ useRouterSubscription(value.router);
2552
+ return value.router;
2553
+ }
2554
+ function useMatches() {
2555
+ return React__namespace.useContext(matchesContext);
2556
+ }
2557
+ function useParentMatches() {
2558
+ const router = useRouter();
2559
+
2560
+ const match = _useMatch();
2561
+
2562
+ const matches = router.state.matches;
2563
+ return matches.slice(0, matches.findIndex(d => d.matchId === match.matchId) - 1);
2564
+ }
2565
+
2566
+ function _useMatch() {
2567
+ var _useMatches;
2568
+
2569
+ return (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
2570
+ }
2571
+ function Outlet() {
2572
+ var _ref3, _childMatch$options$c;
2573
+
2574
+ const router = useRouter();
2575
+ const [, ...matches] = useMatches();
2576
+ const childMatch = matches[0];
2577
+ if (!childMatch) return null;
2578
+ const element = (_ref3 = (() => {
2579
+ var _childMatch$__$errorE, _ref5;
2580
+
2581
+ if (!childMatch) {
2582
+ return null;
2583
+ }
2584
+
2585
+ const errorElement = (_childMatch$__$errorE = childMatch.__.errorElement) != null ? _childMatch$__$errorE : router.options.defaultErrorElement;
2586
+
2587
+ if (childMatch.status === 'error') {
2588
+ if (errorElement) {
2589
+ return errorElement;
2590
+ }
2591
+
2592
+ if (childMatch.options.useErrorBoundary || router.options.useErrorBoundary) {
2593
+ throw childMatch.error;
2594
+ }
2595
+
2596
+ return /*#__PURE__*/React__namespace.createElement(DefaultCatchBoundary, {
2597
+ error: childMatch.error
2598
+ });
2599
+ }
2600
+
2601
+ if (childMatch.status === 'loading' || childMatch.status === 'idle') {
2602
+ if (childMatch.isPending) {
2603
+ var _childMatch$__$pendin;
2604
+
2605
+ const pendingElement = (_childMatch$__$pendin = childMatch.__.pendingElement) != null ? _childMatch$__$pendin : router.options.defaultPendingElement;
2606
+
2607
+ if (childMatch.options.pendingMs || pendingElement) {
2608
+ var _ref4;
2609
+
2610
+ return (_ref4 = pendingElement) != null ? _ref4 : null;
2611
+ }
2612
+ }
2613
+
2614
+ return null;
2615
+ }
2616
+
2617
+ return (_ref5 = childMatch.__.element) != null ? _ref5 : router.options.defaultElement;
2618
+ })()) != null ? _ref3 : /*#__PURE__*/React__namespace.createElement(Outlet, null);
2619
+ const catchElement = (_childMatch$options$c = childMatch == null ? void 0 : childMatch.options.catchElement) != null ? _childMatch$options$c : router.options.defaultCatchElement;
2620
+ return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
2621
+ value: matches,
2622
+ key: childMatch.matchId
2623
+ }, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
2624
+ catchElement: catchElement
2625
+ }, element));
2626
+ }
2627
+
2628
+ class CatchBoundary extends React__namespace.Component {
2629
+ constructor() {
2630
+ super(...arguments);
2631
+ this.state = {
2632
+ error: false
2633
+ };
2634
+
2635
+ this.reset = () => {
2636
+ this.setState({
2637
+ error: false,
2638
+ info: false
2639
+ });
2640
+ };
2641
+ }
2642
+
2643
+ componentDidCatch(error, info) {
2644
+ console.error(error);
2645
+ this.setState({
2646
+ error,
2647
+ info
2648
+ });
2649
+ }
2650
+
2651
+ render() {
2652
+ var _this$props$catchElem;
2653
+
2654
+ const catchElement = (_this$props$catchElem = this.props.catchElement) != null ? _this$props$catchElem : DefaultCatchBoundary;
2655
+
2656
+ if (this.state.error) {
2657
+ return typeof catchElement === 'function' ? catchElement(this.state) : catchElement;
2658
+ }
2659
+
2660
+ return this.props.children;
2661
+ }
2662
+
2663
+ }
2664
+
2665
+ function DefaultCatchBoundary(_ref6) {
2666
+ let {
2667
+ error
2668
+ } = _ref6;
2669
+ return /*#__PURE__*/React__namespace.createElement("div", {
2670
+ style: {
2671
+ padding: '.5rem',
2672
+ maxWidth: '100%'
2673
+ }
2674
+ }, /*#__PURE__*/React__namespace.createElement("strong", {
2675
+ style: {
2676
+ fontSize: '1.2rem'
2677
+ }
2678
+ }, "Something went wrong!"), /*#__PURE__*/React__namespace.createElement("div", {
2679
+ style: {
2680
+ height: '.5rem'
2681
+ }
2682
+ }), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("pre", null, error.message ? /*#__PURE__*/React__namespace.createElement("code", {
2683
+ style: {
2684
+ fontSize: '.7em',
2685
+ border: '1px solid red',
2686
+ borderRadius: '.25rem',
2687
+ padding: '.5rem',
2688
+ color: 'red'
2689
+ }
2690
+ }, error.message) : null)), /*#__PURE__*/React__namespace.createElement("div", {
2691
+ style: {
2692
+ height: '1rem'
2693
+ }
2694
+ }), /*#__PURE__*/React__namespace.createElement("div", {
2695
+ style: {
2696
+ fontSize: '.8em',
2697
+ borderLeft: '3px solid rgba(127, 127, 127, 1)',
2698
+ paddingLeft: '.5rem',
2699
+ opacity: 0.5
2700
+ }
2701
+ }, "If you are the owner of this website, it's highly recommended that you configure your own custom Catch/Error boundaries for the router. You can optionally configure a boundary for each route."));
2702
+ }
2703
+
2704
+ exports.DefaultCatchBoundary = DefaultCatchBoundary;
2705
+ exports.MatchesProvider = MatchesProvider;
2706
+ exports.Outlet = Outlet;
2707
+ exports.RouterProvider = RouterProvider;
2708
+ exports.createBrowserHistory = createBrowserHistory;
2709
+ exports.createHashHistory = createHashHistory;
2710
+ exports.createMemoryHistory = createMemoryHistory;
2711
+ exports.createReactRouter = createReactRouter;
2712
+ exports.createRoute = createRoute;
2713
+ exports.createRouteConfig = createRouteConfig;
2714
+ exports.createRouteMatch = createRouteMatch;
2715
+ exports.createRouter = createRouter;
2716
+ exports.defaultParseSearch = defaultParseSearch;
2717
+ exports.defaultStringifySearch = defaultStringifySearch;
2718
+ exports.functionalUpdate = functionalUpdate;
2719
+ exports.last = last;
2720
+ exports.matchByPath = matchByPath;
2721
+ exports.matchPathname = matchPathname;
2722
+ exports.parsePathname = parsePathname;
2723
+ exports.parseSearchWith = parseSearchWith;
2724
+ exports.replaceEqualDeep = replaceEqualDeep;
2725
+ exports.resolvePath = _resolvePath;
2726
+ exports.rootRouteId = rootRouteId;
2727
+ exports.stringifySearchWith = stringifySearchWith;
2728
+ exports.useMatch = _useMatch;
2729
+ exports.useMatches = useMatches;
2730
+ exports.useParentMatches = useParentMatches;
2731
+ exports.useRouter = useRouter;
2732
+ exports.warning = warning;
2733
+
2734
+ Object.defineProperty(exports, '__esModule', { value: true });
2735
+
2736
+ }));
2737
+ //# sourceMappingURL=index.development.js.map