@amazon-devices/react-navigation__routers 2.0.9000000000 → 2.0.9000000002

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,2821 @@
1
+ var __BUNDLE_START_TIME__=this.nativePerformanceNow?nativePerformanceNow():Date.now(),__DEV__=false,process=this.process||{},__METRO_GLOBAL_PREFIX__='';process.env=process.env||{};process.env.NODE_ENV=process.env.NODE_ENV||"production";
2
+ (function (global) {
3
+ global._majorVersionToNoVersionIdMap["d2c135022758278c79f0"] = "6cc26ebe1139d52af4d3";
4
+ global._majorVersionToNoVersionIdMap["ed52cec8d045963ef690"] = "c258e5bc01f444b02a2f";
5
+ global._majorVersionToNoVersionIdMap["753e4ea4136d8a647a48"] = "6b0bd1c9ea67b0b3e2ed";
6
+ global._majorVersionToNoVersionIdMap["e439c281fd8214dde054"] = "52f387a967cfde3b7e3d";
7
+ global._majorVersionToNoVersionIdMap["b9c3076b2184de60772e"] = "98f134d6d6fb1a1eb176";
8
+ global._majorVersionToNoVersionIdMap["51bc6144a204648d7f40"] = "78e64f8354d943d7e210";
9
+ global._majorVersionToNoVersionIdMap["ecba6c88b265e5561955"] = "5fb9294c2ccbbc11804d";
10
+ global._majorVersionToNoVersionIdMap["b49427bde5b4a88de1e7"] = "b71011de8b8a3cb15ab4";
11
+ global._majorVersionToNoVersionIdMap["95ae28b023658c6d2aff"] = "32fd789b2b4e67ba3679";
12
+ global._majorVersionToNoVersionIdMap["f1e0b3318f7f12bf2431"] = "0060dd931905de8947f2";
13
+ global._majorVersionToNoVersionIdMap["4344b53816d7b780f3dd"] = "2b770725127b9776e940";
14
+ global._majorVersionToNoVersionIdMap["94f0b8bb0225084df7a9"] = "b4b91107e9e069bf6a04";
15
+ global._majorVersionToNoVersionIdMap["20cc2f3e0ac4154b79f0"] = "dec21c689e6604dbbf6a";
16
+ global._majorVersionToNoVersionIdMap["36fad61dee5e550281f1"] = "38a8cc556e14fd685890";
17
+ global._majorVersionToNoVersionIdMap["e32e355e493ded18598c"] = "2bee182fbe6f2aca641e";
18
+ global._majorVersionToNoVersionIdMap["b9efaf09e49316e130ae"] = "6770b45f91f2db97b2e2";
19
+ global._majorVersionToNoVersionIdMap["58153a28fc8e098e8bbf"] = "46404a6d49463f9601d3";
20
+ global._majorVersionToNoVersionIdMap["44010d2886624e71e726"] = "cbb4d666ebd7ab852aa3";
21
+ global._majorVersionToNoVersionIdMap["68ee2377a6ca7029997f"] = "06a5a1d28ce3fd05c417";
22
+ global._majorVersionToNoVersionIdMap["97533916e76df342b455"] = "fb17719fd282a08dfde9";
23
+ global._majorVersionToNoVersionIdMap["46e9b616ece3d5066957"] = "8b1e20a6232a353c9981";
24
+ global._majorVersionToNoVersionIdMap["c7ce5eb5541f78e249bf"] = "39eca4bd16c398373cc4";
25
+ global._majorVersionToNoVersionIdMap["9c8c9b182c731effad0e"] = "347ca45e3641dd48caa1";
26
+ })(typeof globalThis !== 'undefined' ? globalThis : typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this);
27
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
28
+ "use strict";
29
+
30
+ Object.defineProperty(exports, "__esModule", {
31
+ value: true
32
+ });
33
+ exports.default = undefined;
34
+ /**
35
+ * Base router object that can be used when writing custom routers.
36
+ * This provides few helper methods to handle common actions such as `RESET`.
37
+ */
38
+ var BaseRouter = {
39
+ getStateForAction(state, action) {
40
+ switch (action.type) {
41
+ case 'SET_PARAMS':
42
+ {
43
+ var index = action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
44
+ if (index === -1) {
45
+ return null;
46
+ }
47
+ return {
48
+ ...state,
49
+ routes: state.routes.map((r, i) => i === index ? {
50
+ ...r,
51
+ params: {
52
+ ...r.params,
53
+ ...action.payload.params
54
+ }
55
+ } : r)
56
+ };
57
+ }
58
+ case 'RESET':
59
+ {
60
+ var nextState = action.payload;
61
+ if (nextState.routes.length === 0 || nextState.routes.some(route => !state.routeNames.includes(route.name))) {
62
+ return null;
63
+ }
64
+ if (nextState.stale === false) {
65
+ if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(name => !state.routeNames.includes(name))) {
66
+ return null;
67
+ }
68
+ return {
69
+ ...nextState,
70
+ routes: nextState.routes.map(route => route.key ? route : {
71
+ ...route,
72
+ key: `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[0]).nanoid)()}`
73
+ })
74
+ };
75
+ }
76
+ return nextState;
77
+ }
78
+ default:
79
+ return null;
80
+ }
81
+ },
82
+ shouldActionChangeFocus(action) {
83
+ return action.type === 'NAVIGATE';
84
+ }
85
+ };
86
+ var _default = exports.default = BaseRouter;
87
+ },"ed52cec8d045963ef690",["e03db9aacb1ee503cd26"]);
88
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
89
+ Object.defineProperty(exports, "__esModule", {
90
+ value: true
91
+ });
92
+ exports.nanoid = exports.customAlphabet = undefined;
93
+ // This alphabet uses `A-Za-z0-9_-` symbols. The genetic algorithm helped
94
+ // optimize the gzip compression for this alphabet.
95
+ var urlAlphabet = 'ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW';
96
+ var customAlphabet = (alphabet, size) => {
97
+ return () => {
98
+ var id = '';
99
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
100
+ var i = size;
101
+ while (i--) {
102
+ // `| 0` is more compact and faster than `Math.floor()`.
103
+ id += alphabet[Math.random() * alphabet.length | 0];
104
+ }
105
+ return id;
106
+ };
107
+ };
108
+ exports.customAlphabet = customAlphabet;
109
+ var nanoid = (size = 21) => {
110
+ var id = '';
111
+ // A compact alternative for `for (var i = 0; i < step; i++)`.
112
+ var i = size;
113
+ while (i--) {
114
+ // `| 0` is more compact and faster than `Math.floor()`.
115
+ id += urlAlphabet[Math.random() * 64 | 0];
116
+ }
117
+ return id;
118
+ };
119
+ exports.nanoid = nanoid;
120
+ },"e03db9aacb1ee503cd26",[]);
121
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
122
+ "use strict";
123
+
124
+ Object.defineProperty(exports, "__esModule", {
125
+ value: true
126
+ });
127
+ exports.goBack = goBack;
128
+ exports.navigate = navigate;
129
+ exports.reset = reset;
130
+ exports.setParams = setParams;
131
+ function goBack() {
132
+ return {
133
+ type: 'GO_BACK'
134
+ };
135
+ }
136
+
137
+ // eslint-disable-next-line no-redeclare
138
+
139
+ // eslint-disable-next-line no-redeclare
140
+ function navigate(...args) {
141
+ if (typeof args[0] === 'string') {
142
+ return {
143
+ type: 'NAVIGATE',
144
+ payload: {
145
+ name: args[0],
146
+ params: args[1]
147
+ }
148
+ };
149
+ } else {
150
+ var payload = args[0] || {};
151
+ if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
152
+ throw new Error('You need to specify name or key when calling navigate with an object as the argument. See https://reactnavigation.org/docs/navigation-actions#navigate for usage.');
153
+ }
154
+ return {
155
+ type: 'NAVIGATE',
156
+ payload
157
+ };
158
+ }
159
+ }
160
+ function reset(state) {
161
+ return {
162
+ type: 'RESET',
163
+ payload: state
164
+ };
165
+ }
166
+ function setParams(params) {
167
+ return {
168
+ type: 'SET_PARAMS',
169
+ payload: {
170
+ params
171
+ }
172
+ };
173
+ }
174
+ },"753e4ea4136d8a647a48",[]);
175
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
176
+ "use strict";
177
+
178
+ Object.defineProperty(exports, "__esModule", {
179
+ value: true
180
+ });
181
+ exports.DrawerActions = undefined;
182
+ exports.default = DrawerRouter;
183
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
184
+ function _interopRequireWildcard(e, t) {
185
+ if ("function" == typeof WeakMap) var r = new WeakMap(),
186
+ n = new WeakMap();
187
+ return (_interopRequireWildcard = function (e, t) {
188
+ if (!t && e && e.__esModule) return e;
189
+ var o,
190
+ i,
191
+ f = {
192
+ __proto__: null,
193
+ default: e
194
+ };
195
+ if (null === e || "object" != typeof e && "function" != typeof e) return f;
196
+ if (o = t ? n : r) {
197
+ if (o.has(e)) return o.get(e);
198
+ o.set(e, f);
199
+ }
200
+ for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]);
201
+ return f;
202
+ })(e, t);
203
+ }
204
+ var DrawerActions = exports.DrawerActions = {
205
+ ..._TabRouter.TabActions,
206
+ openDrawer() {
207
+ return {
208
+ type: 'OPEN_DRAWER'
209
+ };
210
+ },
211
+ closeDrawer() {
212
+ return {
213
+ type: 'CLOSE_DRAWER'
214
+ };
215
+ },
216
+ toggleDrawer() {
217
+ return {
218
+ type: 'TOGGLE_DRAWER'
219
+ };
220
+ }
221
+ };
222
+ function DrawerRouter({
223
+ defaultStatus = 'closed',
224
+ ...rest
225
+ }) {
226
+ var router = (0, _TabRouter.default)(rest);
227
+ var isDrawerInHistory = state => {
228
+ var _state$history;
229
+ return Boolean((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.some(it => it.type === 'drawer'));
230
+ };
231
+ var addDrawerToHistory = state => {
232
+ if (isDrawerInHistory(state)) {
233
+ return state;
234
+ }
235
+ return {
236
+ ...state,
237
+ history: [...state.history, {
238
+ type: 'drawer',
239
+ status: defaultStatus === 'open' ? 'closed' : 'open'
240
+ }]
241
+ };
242
+ };
243
+ var removeDrawerFromHistory = state => {
244
+ if (!isDrawerInHistory(state)) {
245
+ return state;
246
+ }
247
+ return {
248
+ ...state,
249
+ history: state.history.filter(it => it.type !== 'drawer')
250
+ };
251
+ };
252
+ var openDrawer = state => {
253
+ if (defaultStatus === 'open') {
254
+ return removeDrawerFromHistory(state);
255
+ }
256
+ return addDrawerToHistory(state);
257
+ };
258
+ var closeDrawer = state => {
259
+ if (defaultStatus === 'open') {
260
+ return addDrawerToHistory(state);
261
+ }
262
+ return removeDrawerFromHistory(state);
263
+ };
264
+ return {
265
+ ...router,
266
+ type: 'drawer',
267
+ getInitialState({
268
+ routeNames,
269
+ routeParamList,
270
+ routeGetIdList
271
+ }) {
272
+ var state = router.getInitialState({
273
+ routeNames,
274
+ routeParamList,
275
+ routeGetIdList
276
+ });
277
+ return {
278
+ ...state,
279
+ default: defaultStatus,
280
+ stale: false,
281
+ type: 'drawer',
282
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
283
+ };
284
+ },
285
+ getRehydratedState(partialState, {
286
+ routeNames,
287
+ routeParamList,
288
+ routeGetIdList
289
+ }) {
290
+ if (partialState.stale === false) {
291
+ return partialState;
292
+ }
293
+ var state = router.getRehydratedState(partialState, {
294
+ routeNames,
295
+ routeParamList,
296
+ routeGetIdList
297
+ });
298
+ if (isDrawerInHistory(partialState)) {
299
+ // Re-sync the drawer entry in history to correct it if it was wrong
300
+ state = removeDrawerFromHistory(state);
301
+ state = addDrawerToHistory(state);
302
+ }
303
+ return {
304
+ ...state,
305
+ default: defaultStatus,
306
+ type: 'drawer',
307
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
308
+ };
309
+ },
310
+ getStateForRouteFocus(state, key) {
311
+ var result = router.getStateForRouteFocus(state, key);
312
+ return closeDrawer(result);
313
+ },
314
+ getStateForAction(state, action, options) {
315
+ switch (action.type) {
316
+ case 'OPEN_DRAWER':
317
+ return openDrawer(state);
318
+ case 'CLOSE_DRAWER':
319
+ return closeDrawer(state);
320
+ case 'TOGGLE_DRAWER':
321
+ if (isDrawerInHistory(state)) {
322
+ return removeDrawerFromHistory(state);
323
+ }
324
+ return addDrawerToHistory(state);
325
+ case 'JUMP_TO':
326
+ case 'NAVIGATE':
327
+ {
328
+ var result = router.getStateForAction(state, action, options);
329
+ if (result != null && result.index !== state.index) {
330
+ return closeDrawer(result);
331
+ }
332
+ return result;
333
+ }
334
+ case 'GO_BACK':
335
+ if (isDrawerInHistory(state)) {
336
+ return removeDrawerFromHistory(state);
337
+ }
338
+ return router.getStateForAction(state, action, options);
339
+ default:
340
+ return router.getStateForAction(state, action, options);
341
+ }
342
+ },
343
+ actionCreators: DrawerActions
344
+ };
345
+ }
346
+ },"e439c281fd8214dde054",["51bc6144a204648d7f40","e03db9aacb1ee503cd26"]);
347
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
348
+ "use strict";
349
+
350
+ Object.defineProperty(exports, "__esModule", {
351
+ value: true
352
+ });
353
+ exports.TabActions = undefined;
354
+ exports.default = TabRouter;
355
+ var _BaseRouter = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[0]));
356
+ function _interopRequireDefault(e) {
357
+ return e && e.__esModule ? e : {
358
+ default: e
359
+ };
360
+ }
361
+ var TYPE_ROUTE = 'route';
362
+ var TabActions = exports.TabActions = {
363
+ jumpTo(name, params) {
364
+ return {
365
+ type: 'JUMP_TO',
366
+ payload: {
367
+ name,
368
+ params
369
+ }
370
+ };
371
+ }
372
+ };
373
+ var getRouteHistory = (routes, index, backBehavior, initialRouteName) => {
374
+ var history = [{
375
+ type: TYPE_ROUTE,
376
+ key: routes[index].key
377
+ }];
378
+ var initialRouteIndex;
379
+ switch (backBehavior) {
380
+ case 'order':
381
+ for (var i = index; i > 0; i--) {
382
+ history.unshift({
383
+ type: TYPE_ROUTE,
384
+ key: routes[i - 1].key
385
+ });
386
+ }
387
+ break;
388
+ case 'firstRoute':
389
+ if (index !== 0) {
390
+ history.unshift({
391
+ type: TYPE_ROUTE,
392
+ key: routes[0].key
393
+ });
394
+ }
395
+ break;
396
+ case 'initialRoute':
397
+ initialRouteIndex = routes.findIndex(route => route.name === initialRouteName);
398
+ initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;
399
+ if (index !== initialRouteIndex) {
400
+ history.unshift({
401
+ type: TYPE_ROUTE,
402
+ key: routes[initialRouteIndex].key
403
+ });
404
+ }
405
+ break;
406
+ case 'history':
407
+ // The history will fill up on navigation
408
+ break;
409
+ }
410
+ return history;
411
+ };
412
+ var changeIndex = (state, index, backBehavior, initialRouteName) => {
413
+ var history;
414
+ if (backBehavior === 'history') {
415
+ var currentKey = state.routes[index].key;
416
+ history = state.history.filter(it => it.type === 'route' ? it.key !== currentKey : false).concat({
417
+ type: TYPE_ROUTE,
418
+ key: currentKey
419
+ });
420
+ } else {
421
+ history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);
422
+ }
423
+ return {
424
+ ...state,
425
+ index,
426
+ history
427
+ };
428
+ };
429
+ function TabRouter({
430
+ initialRouteName,
431
+ backBehavior = 'firstRoute'
432
+ }) {
433
+ var router = {
434
+ ..._BaseRouter.default,
435
+ type: 'tab',
436
+ getInitialState({
437
+ routeNames,
438
+ routeParamList
439
+ }) {
440
+ var index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;
441
+ var routes = routeNames.map(name => ({
442
+ name,
443
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
444
+ params: routeParamList[name]
445
+ }));
446
+ var history = getRouteHistory(routes, index, backBehavior, initialRouteName);
447
+ return {
448
+ stale: false,
449
+ type: 'tab',
450
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
451
+ index,
452
+ routeNames,
453
+ history,
454
+ routes
455
+ };
456
+ },
457
+ getRehydratedState(partialState, {
458
+ routeNames,
459
+ routeParamList
460
+ }) {
461
+ var _state$routes, _state$history;
462
+ var state = partialState;
463
+ if (state.stale === false) {
464
+ return state;
465
+ }
466
+ var routes = routeNames.map(name => {
467
+ var route = state.routes.find(r => r.name === name);
468
+ return {
469
+ ...route,
470
+ name,
471
+ key: route && route.name === name && route.key ? route.key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
472
+ params: routeParamList[name] !== undefined ? {
473
+ ...routeParamList[name],
474
+ ...(route ? route.params : undefined)
475
+ } : route ? route.params : undefined
476
+ };
477
+ });
478
+ var index = Math.min(Math.max(routeNames.indexOf((_state$routes = state.routes[(state === null || state === undefined ? undefined : state.index) ?? 0]) === null || _state$routes === undefined ? undefined : _state$routes.name), 0), routes.length - 1);
479
+ var history = ((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.filter(it => routes.find(r => r.key === it.key))) ?? [];
480
+ return changeIndex({
481
+ stale: false,
482
+ type: 'tab',
483
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
484
+ index,
485
+ routeNames,
486
+ history,
487
+ routes
488
+ }, index, backBehavior, initialRouteName);
489
+ },
490
+ getStateForRouteNamesChange(state, {
491
+ routeNames,
492
+ routeParamList,
493
+ routeKeyChanges
494
+ }) {
495
+ var routes = routeNames.map(name => state.routes.find(r => r.name === name && !routeKeyChanges.includes(r.name)) || {
496
+ name,
497
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
498
+ params: routeParamList[name]
499
+ });
500
+ var index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));
501
+ var history = state.history.filter(
502
+ // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)
503
+ it => it.type !== 'route' || routes.find(r => r.key === it.key));
504
+ if (!history.length) {
505
+ history = getRouteHistory(routes, index, backBehavior, initialRouteName);
506
+ }
507
+ return {
508
+ ...state,
509
+ history,
510
+ routeNames,
511
+ routes,
512
+ index
513
+ };
514
+ },
515
+ getStateForRouteFocus(state, key) {
516
+ var index = state.routes.findIndex(r => r.key === key);
517
+ if (index === -1 || index === state.index) {
518
+ return state;
519
+ }
520
+ return changeIndex(state, index, backBehavior, initialRouteName);
521
+ },
522
+ getStateForAction(state, action, {
523
+ routeParamList,
524
+ routeGetIdList
525
+ }) {
526
+ switch (action.type) {
527
+ case 'JUMP_TO':
528
+ case 'NAVIGATE':
529
+ {
530
+ var index = -1;
531
+ if (action.type === 'NAVIGATE' && action.payload.key) {
532
+ index = state.routes.findIndex(route => route.key === action.payload.key);
533
+ } else {
534
+ index = state.routes.findIndex(route => route.name === action.payload.name);
535
+ }
536
+ if (index === -1) {
537
+ return null;
538
+ }
539
+ return changeIndex({
540
+ ...state,
541
+ routes: state.routes.map((route, i) => {
542
+ if (i !== index) {
543
+ return route;
544
+ }
545
+ var getId = routeGetIdList[route.name];
546
+ var currentId = getId === null || getId === undefined ? undefined : getId({
547
+ params: route.params
548
+ });
549
+ var nextId = getId === null || getId === undefined ? undefined : getId({
550
+ params: action.payload.params
551
+ });
552
+ var key = currentId === nextId ? route.key : `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`;
553
+ var params;
554
+ if (action.type === 'NAVIGATE' && action.payload.merge && currentId === nextId) {
555
+ params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? {
556
+ ...routeParamList[route.name],
557
+ ...route.params,
558
+ ...action.payload.params
559
+ } : route.params;
560
+ } else {
561
+ params = routeParamList[route.name] !== undefined ? {
562
+ ...routeParamList[route.name],
563
+ ...action.payload.params
564
+ } : action.payload.params;
565
+ }
566
+ var path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;
567
+ return params !== route.params || path !== route.path ? {
568
+ ...route,
569
+ key,
570
+ path,
571
+ params
572
+ } : route;
573
+ })
574
+ }, index, backBehavior, initialRouteName);
575
+ }
576
+ case 'GO_BACK':
577
+ {
578
+ if (state.history.length === 1) {
579
+ return null;
580
+ }
581
+ var previousKey = state.history[state.history.length - 2].key;
582
+ var _index = state.routes.findIndex(route => route.key === previousKey);
583
+ if (_index === -1) {
584
+ return null;
585
+ }
586
+ return {
587
+ ...state,
588
+ history: state.history.slice(0, -1),
589
+ index: _index
590
+ };
591
+ }
592
+ default:
593
+ return _BaseRouter.default.getStateForAction(state, action);
594
+ }
595
+ },
596
+ shouldActionChangeFocus(action) {
597
+ return action.type === 'NAVIGATE';
598
+ },
599
+ actionCreators: TabActions
600
+ };
601
+ return router;
602
+ }
603
+ },"51bc6144a204648d7f40",["ed52cec8d045963ef690","e03db9aacb1ee503cd26"]);
604
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
605
+ "use strict";
606
+
607
+ Object.defineProperty(exports, "__esModule", {
608
+ value: true
609
+ });
610
+ exports.StackActions = undefined;
611
+ exports.default = StackRouter;
612
+ var _BaseRouter = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[0]));
613
+ function _interopRequireDefault(e) {
614
+ return e && e.__esModule ? e : {
615
+ default: e
616
+ };
617
+ }
618
+ var StackActions = exports.StackActions = {
619
+ replace(name, params) {
620
+ return {
621
+ type: 'REPLACE',
622
+ payload: {
623
+ name,
624
+ params
625
+ }
626
+ };
627
+ },
628
+ push(name, params) {
629
+ return {
630
+ type: 'PUSH',
631
+ payload: {
632
+ name,
633
+ params
634
+ }
635
+ };
636
+ },
637
+ pop(count = 1) {
638
+ return {
639
+ type: 'POP',
640
+ payload: {
641
+ count
642
+ }
643
+ };
644
+ },
645
+ popToTop() {
646
+ return {
647
+ type: 'POP_TO_TOP'
648
+ };
649
+ }
650
+ };
651
+ function StackRouter(options) {
652
+ var router = {
653
+ ..._BaseRouter.default,
654
+ type: 'stack',
655
+ getInitialState({
656
+ routeNames,
657
+ routeParamList
658
+ }) {
659
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
660
+ return {
661
+ stale: false,
662
+ type: 'stack',
663
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
664
+ index: 0,
665
+ routeNames,
666
+ routes: [{
667
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
668
+ name: initialRouteName,
669
+ params: routeParamList[initialRouteName]
670
+ }]
671
+ };
672
+ },
673
+ getRehydratedState(partialState, {
674
+ routeNames,
675
+ routeParamList
676
+ }) {
677
+ var state = partialState;
678
+ if (state.stale === false) {
679
+ return state;
680
+ }
681
+ var routes = state.routes.filter(route => routeNames.includes(route.name)).map(route => ({
682
+ ...route,
683
+ key: route.key || `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
684
+ params: routeParamList[route.name] !== undefined ? {
685
+ ...routeParamList[route.name],
686
+ ...route.params
687
+ } : route.params
688
+ }));
689
+ if (routes.length === 0) {
690
+ var initialRouteName = options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];
691
+ routes.push({
692
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
693
+ name: initialRouteName,
694
+ params: routeParamList[initialRouteName]
695
+ });
696
+ }
697
+ return {
698
+ stale: false,
699
+ type: 'stack',
700
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
701
+ index: routes.length - 1,
702
+ routeNames,
703
+ routes
704
+ };
705
+ },
706
+ getStateForRouteNamesChange(state, {
707
+ routeNames,
708
+ routeParamList,
709
+ routeKeyChanges
710
+ }) {
711
+ var routes = state.routes.filter(route => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name));
712
+ if (routes.length === 0) {
713
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
714
+ routes.push({
715
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
716
+ name: initialRouteName,
717
+ params: routeParamList[initialRouteName]
718
+ });
719
+ }
720
+ return {
721
+ ...state,
722
+ routeNames,
723
+ routes,
724
+ index: Math.min(state.index, routes.length - 1)
725
+ };
726
+ },
727
+ getStateForRouteFocus(state, key) {
728
+ var index = state.routes.findIndex(r => r.key === key);
729
+ if (index === -1 || index === state.index) {
730
+ return state;
731
+ }
732
+ return {
733
+ ...state,
734
+ index,
735
+ routes: state.routes.slice(0, index + 1)
736
+ };
737
+ },
738
+ getStateForAction(state, action, options) {
739
+ var routeParamList = options.routeParamList;
740
+ switch (action.type) {
741
+ case 'REPLACE':
742
+ {
743
+ var index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
744
+ if (index === -1) {
745
+ return null;
746
+ }
747
+ var _action$payload = action.payload,
748
+ name = _action$payload.name,
749
+ key = _action$payload.key,
750
+ params = _action$payload.params;
751
+ if (!state.routeNames.includes(name)) {
752
+ return null;
753
+ }
754
+ return {
755
+ ...state,
756
+ routes: state.routes.map((route, i) => i === index ? {
757
+ key: key !== undefined ? key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
758
+ name,
759
+ params: routeParamList[name] !== undefined ? {
760
+ ...routeParamList[name],
761
+ ...params
762
+ } : params
763
+ } : route)
764
+ };
765
+ }
766
+ case 'PUSH':
767
+ if (state.routeNames.includes(action.payload.name)) {
768
+ var getId = options.routeGetIdList[action.payload.name];
769
+ var id = getId === null || getId === undefined ? undefined : getId({
770
+ params: action.payload.params
771
+ });
772
+ var route = id ? state.routes.find(route => route.name === action.payload.name && id === (getId === null || getId === undefined ? undefined : getId({
773
+ params: route.params
774
+ }))) : undefined;
775
+ var routes;
776
+ if (route) {
777
+ routes = state.routes.filter(r => r.key !== route.key);
778
+ routes.push({
779
+ ...route,
780
+ params: routeParamList[action.payload.name] !== undefined ? {
781
+ ...routeParamList[action.payload.name],
782
+ ...action.payload.params
783
+ } : action.payload.params
784
+ });
785
+ } else {
786
+ routes = [...state.routes, {
787
+ key: `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
788
+ name: action.payload.name,
789
+ params: routeParamList[action.payload.name] !== undefined ? {
790
+ ...routeParamList[action.payload.name],
791
+ ...action.payload.params
792
+ } : action.payload.params
793
+ }];
794
+ }
795
+ return {
796
+ ...state,
797
+ index: routes.length - 1,
798
+ routes
799
+ };
800
+ }
801
+ return null;
802
+ case 'POP':
803
+ {
804
+ var _index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
805
+ if (_index > 0) {
806
+ var count = Math.max(_index - action.payload.count + 1, 1);
807
+ var _routes = state.routes.slice(0, count).concat(state.routes.slice(_index + 1));
808
+ return {
809
+ ...state,
810
+ index: _routes.length - 1,
811
+ routes: _routes
812
+ };
813
+ }
814
+ return null;
815
+ }
816
+ case 'POP_TO_TOP':
817
+ return router.getStateForAction(state, {
818
+ type: 'POP',
819
+ payload: {
820
+ count: state.routes.length - 1
821
+ }
822
+ }, options);
823
+ case 'NAVIGATE':
824
+ if (action.payload.name !== undefined && !state.routeNames.includes(action.payload.name)) {
825
+ return null;
826
+ }
827
+ if (action.payload.key || action.payload.name) {
828
+ // If the route already exists, navigate to that
829
+ var _index2 = -1;
830
+ var _getId =
831
+ // `getId` and `key` can't be used together
832
+ action.payload.key === undefined && action.payload.name !== undefined ? options.routeGetIdList[action.payload.name] : undefined;
833
+ var _id = _getId === null || _getId === undefined ? undefined : _getId({
834
+ params: action.payload.params
835
+ });
836
+ if (_id) {
837
+ _index2 = state.routes.findIndex(route => route.name === action.payload.name && _id === (_getId === null || _getId === undefined ? undefined : _getId({
838
+ params: route.params
839
+ })));
840
+ } else if (state.routes[state.index].name === action.payload.name && action.payload.key === undefined || state.routes[state.index].key === action.payload.key) {
841
+ _index2 = state.index;
842
+ } else {
843
+ for (var i = state.routes.length - 1; i >= 0; i--) {
844
+ if (state.routes[i].name === action.payload.name && action.payload.key === undefined || state.routes[i].key === action.payload.key) {
845
+ _index2 = i;
846
+ break;
847
+ }
848
+ }
849
+ }
850
+ if (_index2 === -1 && action.payload.key && action.payload.name === undefined) {
851
+ return null;
852
+ }
853
+ if (_index2 === -1 && action.payload.name !== undefined) {
854
+ var _routes2 = [...state.routes, {
855
+ key: action.payload.key ?? `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`,
856
+ name: action.payload.name,
857
+ path: action.payload.path,
858
+ params: routeParamList[action.payload.name] !== undefined ? {
859
+ ...routeParamList[action.payload.name],
860
+ ...action.payload.params
861
+ } : action.payload.params
862
+ }];
863
+ return {
864
+ ...state,
865
+ routes: _routes2,
866
+ index: _routes2.length - 1
867
+ };
868
+ }
869
+ var _route = state.routes[_index2];
870
+ var _params;
871
+ if (action.payload.merge) {
872
+ _params = action.payload.params !== undefined || routeParamList[_route.name] !== undefined ? {
873
+ ...routeParamList[_route.name],
874
+ ..._route.params,
875
+ ...action.payload.params
876
+ } : _route.params;
877
+ } else {
878
+ _params = routeParamList[_route.name] !== undefined ? {
879
+ ...routeParamList[_route.name],
880
+ ...action.payload.params
881
+ } : action.payload.params;
882
+ }
883
+ return {
884
+ ...state,
885
+ index: _index2,
886
+ routes: [...state.routes.slice(0, _index2), _params !== _route.params || action.payload.path && action.payload.path !== _route.path ? {
887
+ ..._route,
888
+ path: action.payload.path ?? _route.path,
889
+ params: _params
890
+ } : state.routes[_index2]]
891
+ };
892
+ }
893
+ return null;
894
+ case 'GO_BACK':
895
+ if (state.index > 0) {
896
+ return router.getStateForAction(state, {
897
+ type: 'POP',
898
+ payload: {
899
+ count: 1
900
+ },
901
+ target: action.target,
902
+ source: action.source
903
+ }, options);
904
+ }
905
+ return null;
906
+ default:
907
+ return _BaseRouter.default.getStateForAction(state, action);
908
+ }
909
+ },
910
+ actionCreators: StackActions
911
+ };
912
+ return router;
913
+ }
914
+ },"b9c3076b2184de60772e",["ed52cec8d045963ef690","e03db9aacb1ee503cd26"]);
915
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
916
+ "use strict";
917
+
918
+ Object.defineProperty(exports, "__esModule", {
919
+ value: true
920
+ });
921
+ var _exportNames = {
922
+ CommonActions: true,
923
+ BaseRouter: true,
924
+ DrawerActions: true,
925
+ DrawerRouter: true,
926
+ StackActions: true,
927
+ StackRouter: true,
928
+ TabActions: true,
929
+ TabRouter: true
930
+ };
931
+ Object.defineProperty(exports, "BaseRouter", {
932
+ enumerable: true,
933
+ get: function () {
934
+ return _BaseRouter.default;
935
+ }
936
+ });
937
+ exports.CommonActions = undefined;
938
+ Object.defineProperty(exports, "DrawerActions", {
939
+ enumerable: true,
940
+ get: function () {
941
+ return _DrawerRouter.DrawerActions;
942
+ }
943
+ });
944
+ Object.defineProperty(exports, "DrawerRouter", {
945
+ enumerable: true,
946
+ get: function () {
947
+ return _DrawerRouter.default;
948
+ }
949
+ });
950
+ Object.defineProperty(exports, "StackActions", {
951
+ enumerable: true,
952
+ get: function () {
953
+ return _StackRouter.StackActions;
954
+ }
955
+ });
956
+ Object.defineProperty(exports, "StackRouter", {
957
+ enumerable: true,
958
+ get: function () {
959
+ return _StackRouter.default;
960
+ }
961
+ });
962
+ Object.defineProperty(exports, "TabActions", {
963
+ enumerable: true,
964
+ get: function () {
965
+ return _TabRouter.TabActions;
966
+ }
967
+ });
968
+ Object.defineProperty(exports, "TabRouter", {
969
+ enumerable: true,
970
+ get: function () {
971
+ return _TabRouter.default;
972
+ }
973
+ });
974
+ var CommonActions = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
975
+ exports.CommonActions = CommonActions;
976
+ var _BaseRouter = _interopRequireDefault(_$$_REQUIRE(_dependencyMap[1]));
977
+ var _DrawerRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[2]));
978
+ var _StackRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
979
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[4]));
980
+ Object.keys(_$$_REQUIRE(_dependencyMap[5])).forEach(function (key) {
981
+ if (key === "default" || key === "__esModule") return;
982
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
983
+ if (key in exports && exports[key] === _$$_REQUIRE(_dependencyMap[5])[key]) return;
984
+ Object.defineProperty(exports, key, {
985
+ enumerable: true,
986
+ get: function () {
987
+ return _$$_REQUIRE(_dependencyMap[5])[key];
988
+ }
989
+ });
990
+ });
991
+ function _interopRequireDefault(e) {
992
+ return e && e.__esModule ? e : {
993
+ default: e
994
+ };
995
+ }
996
+ function _interopRequireWildcard(e, t) {
997
+ if ("function" == typeof WeakMap) var r = new WeakMap(),
998
+ n = new WeakMap();
999
+ return (_interopRequireWildcard = function (e, t) {
1000
+ if (!t && e && e.__esModule) return e;
1001
+ var o,
1002
+ i,
1003
+ f = {
1004
+ __proto__: null,
1005
+ default: e
1006
+ };
1007
+ if (null === e || "object" != typeof e && "function" != typeof e) return f;
1008
+ if (o = t ? n : r) {
1009
+ if (o.has(e)) return o.get(e);
1010
+ o.set(e, f);
1011
+ }
1012
+ for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]);
1013
+ return f;
1014
+ })(e, t);
1015
+ }
1016
+ },"ecba6c88b265e5561955",["753e4ea4136d8a647a48","ed52cec8d045963ef690","e439c281fd8214dde054","b9c3076b2184de60772e","51bc6144a204648d7f40","b49427bde5b4a88de1e7"]);
1017
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1018
+ "use strict";
1019
+
1020
+ Object.defineProperty(exports, "__esModule", {
1021
+ value: true
1022
+ });
1023
+ },"b49427bde5b4a88de1e7",[]);
1024
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1025
+ Object.defineProperty(exports, "__esModule", {
1026
+ value: true
1027
+ });
1028
+ exports.default = undefined;
1029
+ /**
1030
+ * Base router object that can be used when writing custom routers.
1031
+ * This provides few helper methods to handle common actions such as `RESET`.
1032
+ */
1033
+ var BaseRouter = {
1034
+ getStateForAction(state, action) {
1035
+ switch (action.type) {
1036
+ case 'SET_PARAMS':
1037
+ {
1038
+ var index = action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
1039
+ if (index === -1) {
1040
+ return null;
1041
+ }
1042
+ return {
1043
+ ...state,
1044
+ routes: state.routes.map((r, i) => i === index ? {
1045
+ ...r,
1046
+ params: {
1047
+ ...r.params,
1048
+ ...action.payload.params
1049
+ }
1050
+ } : r)
1051
+ };
1052
+ }
1053
+ case 'RESET':
1054
+ {
1055
+ var nextState = action.payload;
1056
+ if (nextState.routes.length === 0 || nextState.routes.some(route => !state.routeNames.includes(route.name))) {
1057
+ return null;
1058
+ }
1059
+ if (nextState.stale === false) {
1060
+ if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(name => !state.routeNames.includes(name))) {
1061
+ return null;
1062
+ }
1063
+ return {
1064
+ ...nextState,
1065
+ routes: nextState.routes.map(route => route.key ? route : {
1066
+ ...route,
1067
+ key: `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[0]).nanoid)()}`
1068
+ })
1069
+ };
1070
+ }
1071
+ return nextState;
1072
+ }
1073
+ default:
1074
+ return null;
1075
+ }
1076
+ },
1077
+ shouldActionChangeFocus(action) {
1078
+ return action.type === 'NAVIGATE';
1079
+ }
1080
+ };
1081
+ var _default = exports.default = BaseRouter;
1082
+ },"95ae28b023658c6d2aff",["e03db9aacb1ee503cd26"]);
1083
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1084
+ Object.defineProperty(exports, "__esModule", {
1085
+ value: true
1086
+ });
1087
+ exports.goBack = goBack;
1088
+ exports.navigate = navigate;
1089
+ exports.reset = reset;
1090
+ exports.setParams = setParams;
1091
+ function goBack() {
1092
+ return {
1093
+ type: 'GO_BACK'
1094
+ };
1095
+ }
1096
+
1097
+ // eslint-disable-next-line no-redeclare
1098
+
1099
+ // eslint-disable-next-line no-redeclare
1100
+ function navigate(...args) {
1101
+ if (typeof args[0] === 'string') {
1102
+ return {
1103
+ type: 'NAVIGATE',
1104
+ payload: {
1105
+ name: args[0],
1106
+ params: args[1]
1107
+ }
1108
+ };
1109
+ } else {
1110
+ var payload = args[0] || {};
1111
+ if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
1112
+ throw new Error('You need to specify name or key when calling navigate with an object as the argument. See https://reactnavigation.org/docs/navigation-actions#navigate for usage.');
1113
+ }
1114
+ return {
1115
+ type: 'NAVIGATE',
1116
+ payload
1117
+ };
1118
+ }
1119
+ }
1120
+ function reset(state) {
1121
+ return {
1122
+ type: 'RESET',
1123
+ payload: state
1124
+ };
1125
+ }
1126
+ function setParams(params) {
1127
+ return {
1128
+ type: 'SET_PARAMS',
1129
+ payload: {
1130
+ params
1131
+ }
1132
+ };
1133
+ }
1134
+ },"f1e0b3318f7f12bf2431",[]);
1135
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1136
+ Object.defineProperty(exports, "__esModule", {
1137
+ value: true
1138
+ });
1139
+ exports.DrawerActions = undefined;
1140
+ exports.default = DrawerRouter;
1141
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
1142
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
1143
+ var DrawerActions = exports.DrawerActions = {
1144
+ ..._TabRouter.TabActions,
1145
+ openDrawer() {
1146
+ return {
1147
+ type: 'OPEN_DRAWER'
1148
+ };
1149
+ },
1150
+ closeDrawer() {
1151
+ return {
1152
+ type: 'CLOSE_DRAWER'
1153
+ };
1154
+ },
1155
+ toggleDrawer() {
1156
+ return {
1157
+ type: 'TOGGLE_DRAWER'
1158
+ };
1159
+ }
1160
+ };
1161
+ function DrawerRouter({
1162
+ defaultStatus = 'closed',
1163
+ ...rest
1164
+ }) {
1165
+ var router = (0, _TabRouter.default)(rest);
1166
+ var isDrawerInHistory = state => {
1167
+ var _state$history;
1168
+ return Boolean((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.some(it => it.type === 'drawer'));
1169
+ };
1170
+ var addDrawerToHistory = state => {
1171
+ if (isDrawerInHistory(state)) {
1172
+ return state;
1173
+ }
1174
+ return {
1175
+ ...state,
1176
+ history: [...state.history, {
1177
+ type: 'drawer',
1178
+ status: defaultStatus === 'open' ? 'closed' : 'open'
1179
+ }]
1180
+ };
1181
+ };
1182
+ var removeDrawerFromHistory = state => {
1183
+ if (!isDrawerInHistory(state)) {
1184
+ return state;
1185
+ }
1186
+ return {
1187
+ ...state,
1188
+ history: state.history.filter(it => it.type !== 'drawer')
1189
+ };
1190
+ };
1191
+ var openDrawer = state => {
1192
+ if (defaultStatus === 'open') {
1193
+ return removeDrawerFromHistory(state);
1194
+ }
1195
+ return addDrawerToHistory(state);
1196
+ };
1197
+ var closeDrawer = state => {
1198
+ if (defaultStatus === 'open') {
1199
+ return addDrawerToHistory(state);
1200
+ }
1201
+ return removeDrawerFromHistory(state);
1202
+ };
1203
+ return {
1204
+ ...router,
1205
+ type: 'drawer',
1206
+ getInitialState({
1207
+ routeNames,
1208
+ routeParamList,
1209
+ routeGetIdList
1210
+ }) {
1211
+ var state = router.getInitialState({
1212
+ routeNames,
1213
+ routeParamList,
1214
+ routeGetIdList
1215
+ });
1216
+ return {
1217
+ ...state,
1218
+ default: defaultStatus,
1219
+ stale: false,
1220
+ type: 'drawer',
1221
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
1222
+ };
1223
+ },
1224
+ getRehydratedState(partialState, {
1225
+ routeNames,
1226
+ routeParamList,
1227
+ routeGetIdList
1228
+ }) {
1229
+ if (partialState.stale === false) {
1230
+ return partialState;
1231
+ }
1232
+ var state = router.getRehydratedState(partialState, {
1233
+ routeNames,
1234
+ routeParamList,
1235
+ routeGetIdList
1236
+ });
1237
+ if (isDrawerInHistory(partialState)) {
1238
+ // Re-sync the drawer entry in history to correct it if it was wrong
1239
+ state = removeDrawerFromHistory(state);
1240
+ state = addDrawerToHistory(state);
1241
+ }
1242
+ return {
1243
+ ...state,
1244
+ default: defaultStatus,
1245
+ type: 'drawer',
1246
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
1247
+ };
1248
+ },
1249
+ getStateForRouteFocus(state, key) {
1250
+ var result = router.getStateForRouteFocus(state, key);
1251
+ return closeDrawer(result);
1252
+ },
1253
+ getStateForAction(state, action, options) {
1254
+ switch (action.type) {
1255
+ case 'OPEN_DRAWER':
1256
+ return openDrawer(state);
1257
+ case 'CLOSE_DRAWER':
1258
+ return closeDrawer(state);
1259
+ case 'TOGGLE_DRAWER':
1260
+ if (isDrawerInHistory(state)) {
1261
+ return removeDrawerFromHistory(state);
1262
+ }
1263
+ return addDrawerToHistory(state);
1264
+ case 'JUMP_TO':
1265
+ case 'NAVIGATE':
1266
+ {
1267
+ var result = router.getStateForAction(state, action, options);
1268
+ if (result != null && result.index !== state.index) {
1269
+ return closeDrawer(result);
1270
+ }
1271
+ return result;
1272
+ }
1273
+ case 'GO_BACK':
1274
+ if (isDrawerInHistory(state)) {
1275
+ return removeDrawerFromHistory(state);
1276
+ }
1277
+ return router.getStateForAction(state, action, options);
1278
+ default:
1279
+ return router.getStateForAction(state, action, options);
1280
+ }
1281
+ },
1282
+ actionCreators: DrawerActions
1283
+ };
1284
+ }
1285
+ },"4344b53816d7b780f3dd",["20cc2f3e0ac4154b79f0","e03db9aacb1ee503cd26"]);
1286
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1287
+ Object.defineProperty(exports, "__esModule", {
1288
+ value: true
1289
+ });
1290
+ exports.TabActions = undefined;
1291
+ exports.default = TabRouter;
1292
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
1293
+ var TYPE_ROUTE = 'route';
1294
+ var TabActions = exports.TabActions = {
1295
+ jumpTo(name, params) {
1296
+ return {
1297
+ type: 'JUMP_TO',
1298
+ payload: {
1299
+ name,
1300
+ params
1301
+ }
1302
+ };
1303
+ }
1304
+ };
1305
+ var getRouteHistory = (routes, index, backBehavior, initialRouteName) => {
1306
+ var history = [{
1307
+ type: TYPE_ROUTE,
1308
+ key: routes[index].key
1309
+ }];
1310
+ var initialRouteIndex;
1311
+ switch (backBehavior) {
1312
+ case 'order':
1313
+ for (var i = index; i > 0; i--) {
1314
+ history.unshift({
1315
+ type: TYPE_ROUTE,
1316
+ key: routes[i - 1].key
1317
+ });
1318
+ }
1319
+ break;
1320
+ case 'firstRoute':
1321
+ if (index !== 0) {
1322
+ history.unshift({
1323
+ type: TYPE_ROUTE,
1324
+ key: routes[0].key
1325
+ });
1326
+ }
1327
+ break;
1328
+ case 'initialRoute':
1329
+ initialRouteIndex = routes.findIndex(route => route.name === initialRouteName);
1330
+ initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;
1331
+ if (index !== initialRouteIndex) {
1332
+ history.unshift({
1333
+ type: TYPE_ROUTE,
1334
+ key: routes[initialRouteIndex].key
1335
+ });
1336
+ }
1337
+ break;
1338
+ case 'history':
1339
+ // The history will fill up on navigation
1340
+ break;
1341
+ }
1342
+ return history;
1343
+ };
1344
+ var changeIndex = (state, index, backBehavior, initialRouteName) => {
1345
+ var history;
1346
+ if (backBehavior === 'history') {
1347
+ var currentKey = state.routes[index].key;
1348
+ history = state.history.filter(it => it.type === 'route' ? it.key !== currentKey : false).concat({
1349
+ type: TYPE_ROUTE,
1350
+ key: currentKey
1351
+ });
1352
+ } else {
1353
+ history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);
1354
+ }
1355
+ return {
1356
+ ...state,
1357
+ index,
1358
+ history
1359
+ };
1360
+ };
1361
+ function TabRouter({
1362
+ initialRouteName,
1363
+ backBehavior = 'firstRoute'
1364
+ }) {
1365
+ var router = {
1366
+ ..._BaseRouter.default,
1367
+ type: 'tab',
1368
+ getInitialState({
1369
+ routeNames,
1370
+ routeParamList
1371
+ }) {
1372
+ var index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;
1373
+ var routes = routeNames.map(name => ({
1374
+ name,
1375
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1376
+ params: routeParamList[name]
1377
+ }));
1378
+ var history = getRouteHistory(routes, index, backBehavior, initialRouteName);
1379
+ return {
1380
+ stale: false,
1381
+ type: 'tab',
1382
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1383
+ index,
1384
+ routeNames,
1385
+ history,
1386
+ routes
1387
+ };
1388
+ },
1389
+ getRehydratedState(partialState, {
1390
+ routeNames,
1391
+ routeParamList
1392
+ }) {
1393
+ var _state$routes, _state$history;
1394
+ var state = partialState;
1395
+ if (state.stale === false) {
1396
+ return state;
1397
+ }
1398
+ var routes = routeNames.map(name => {
1399
+ var route = state.routes.find(r => r.name === name);
1400
+ return {
1401
+ ...route,
1402
+ name,
1403
+ key: route && route.name === name && route.key ? route.key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1404
+ params: routeParamList[name] !== undefined ? {
1405
+ ...routeParamList[name],
1406
+ ...(route ? route.params : undefined)
1407
+ } : route ? route.params : undefined
1408
+ };
1409
+ });
1410
+ var index = Math.min(Math.max(routeNames.indexOf((_state$routes = state.routes[(state === null || state === undefined ? undefined : state.index) ?? 0]) === null || _state$routes === undefined ? undefined : _state$routes.name), 0), routes.length - 1);
1411
+ var history = ((_state$history = state.history) === null || _state$history === undefined ? undefined : _state$history.filter(it => routes.find(r => r.key === it.key))) ?? [];
1412
+ return changeIndex({
1413
+ stale: false,
1414
+ type: 'tab',
1415
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1416
+ index,
1417
+ routeNames,
1418
+ history,
1419
+ routes
1420
+ }, index, backBehavior, initialRouteName);
1421
+ },
1422
+ getStateForRouteNamesChange(state, {
1423
+ routeNames,
1424
+ routeParamList,
1425
+ routeKeyChanges
1426
+ }) {
1427
+ var routes = routeNames.map(name => state.routes.find(r => r.name === name && !routeKeyChanges.includes(r.name)) || {
1428
+ name,
1429
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1430
+ params: routeParamList[name]
1431
+ });
1432
+ var index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));
1433
+ var history = state.history.filter(
1434
+ // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)
1435
+ it => it.type !== 'route' || routes.find(r => r.key === it.key));
1436
+ if (!history.length) {
1437
+ history = getRouteHistory(routes, index, backBehavior, initialRouteName);
1438
+ }
1439
+ return {
1440
+ ...state,
1441
+ history,
1442
+ routeNames,
1443
+ routes,
1444
+ index
1445
+ };
1446
+ },
1447
+ getStateForRouteFocus(state, key) {
1448
+ var index = state.routes.findIndex(r => r.key === key);
1449
+ if (index === -1 || index === state.index) {
1450
+ return state;
1451
+ }
1452
+ return changeIndex(state, index, backBehavior, initialRouteName);
1453
+ },
1454
+ getStateForAction(state, action, {
1455
+ routeParamList,
1456
+ routeGetIdList
1457
+ }) {
1458
+ switch (action.type) {
1459
+ case 'JUMP_TO':
1460
+ case 'NAVIGATE':
1461
+ {
1462
+ var index = -1;
1463
+ if (action.type === 'NAVIGATE' && action.payload.key) {
1464
+ index = state.routes.findIndex(route => route.key === action.payload.key);
1465
+ } else {
1466
+ index = state.routes.findIndex(route => route.name === action.payload.name);
1467
+ }
1468
+ if (index === -1) {
1469
+ return null;
1470
+ }
1471
+ return changeIndex({
1472
+ ...state,
1473
+ routes: state.routes.map((route, i) => {
1474
+ if (i !== index) {
1475
+ return route;
1476
+ }
1477
+ var getId = routeGetIdList[route.name];
1478
+ var currentId = getId === null || getId === undefined ? undefined : getId({
1479
+ params: route.params
1480
+ });
1481
+ var nextId = getId === null || getId === undefined ? undefined : getId({
1482
+ params: action.payload.params
1483
+ });
1484
+ var key = currentId === nextId ? route.key : `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`;
1485
+ var params;
1486
+ if (action.type === 'NAVIGATE' && action.payload.merge && currentId === nextId) {
1487
+ params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? {
1488
+ ...routeParamList[route.name],
1489
+ ...route.params,
1490
+ ...action.payload.params
1491
+ } : route.params;
1492
+ } else {
1493
+ params = routeParamList[route.name] !== undefined ? {
1494
+ ...routeParamList[route.name],
1495
+ ...action.payload.params
1496
+ } : action.payload.params;
1497
+ }
1498
+ var path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;
1499
+ return params !== route.params || path !== route.path ? {
1500
+ ...route,
1501
+ key,
1502
+ path,
1503
+ params
1504
+ } : route;
1505
+ })
1506
+ }, index, backBehavior, initialRouteName);
1507
+ }
1508
+ case 'GO_BACK':
1509
+ {
1510
+ if (state.history.length === 1) {
1511
+ return null;
1512
+ }
1513
+ var previousKey = state.history[state.history.length - 2].key;
1514
+ var _index = state.routes.findIndex(route => route.key === previousKey);
1515
+ if (_index === -1) {
1516
+ return null;
1517
+ }
1518
+ return {
1519
+ ...state,
1520
+ history: state.history.slice(0, -1),
1521
+ index: _index
1522
+ };
1523
+ }
1524
+ default:
1525
+ return _BaseRouter.default.getStateForAction(state, action);
1526
+ }
1527
+ },
1528
+ shouldActionChangeFocus(action) {
1529
+ return action.type === 'NAVIGATE';
1530
+ },
1531
+ actionCreators: TabActions
1532
+ };
1533
+ return router;
1534
+ }
1535
+ },"20cc2f3e0ac4154b79f0",["d3b57c8ff490ba8c7c47","95ae28b023658c6d2aff","e03db9aacb1ee503cd26"]);
1536
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1537
+ function _interopRequireDefault(e) {
1538
+ return e && e.__esModule ? e : {
1539
+ "default": e
1540
+ };
1541
+ }
1542
+ module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
1543
+ },"d3b57c8ff490ba8c7c47",[]);
1544
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1545
+ Object.defineProperty(exports, "__esModule", {
1546
+ value: true
1547
+ });
1548
+ exports.StackActions = undefined;
1549
+ exports.default = StackRouter;
1550
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
1551
+ var StackActions = exports.StackActions = {
1552
+ replace(name, params) {
1553
+ return {
1554
+ type: 'REPLACE',
1555
+ payload: {
1556
+ name,
1557
+ params
1558
+ }
1559
+ };
1560
+ },
1561
+ push(name, params) {
1562
+ return {
1563
+ type: 'PUSH',
1564
+ payload: {
1565
+ name,
1566
+ params
1567
+ }
1568
+ };
1569
+ },
1570
+ pop(count = 1) {
1571
+ return {
1572
+ type: 'POP',
1573
+ payload: {
1574
+ count
1575
+ }
1576
+ };
1577
+ },
1578
+ popToTop() {
1579
+ return {
1580
+ type: 'POP_TO_TOP'
1581
+ };
1582
+ }
1583
+ };
1584
+ function StackRouter(options) {
1585
+ var router = {
1586
+ ..._BaseRouter.default,
1587
+ type: 'stack',
1588
+ getInitialState({
1589
+ routeNames,
1590
+ routeParamList
1591
+ }) {
1592
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
1593
+ return {
1594
+ stale: false,
1595
+ type: 'stack',
1596
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1597
+ index: 0,
1598
+ routeNames,
1599
+ routes: [{
1600
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1601
+ name: initialRouteName,
1602
+ params: routeParamList[initialRouteName]
1603
+ }]
1604
+ };
1605
+ },
1606
+ getRehydratedState(partialState, {
1607
+ routeNames,
1608
+ routeParamList
1609
+ }) {
1610
+ var state = partialState;
1611
+ if (state.stale === false) {
1612
+ return state;
1613
+ }
1614
+ var routes = state.routes.filter(route => routeNames.includes(route.name)).map(route => ({
1615
+ ...route,
1616
+ key: route.key || `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1617
+ params: routeParamList[route.name] !== undefined ? {
1618
+ ...routeParamList[route.name],
1619
+ ...route.params
1620
+ } : route.params
1621
+ }));
1622
+ if (routes.length === 0) {
1623
+ var initialRouteName = options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];
1624
+ routes.push({
1625
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1626
+ name: initialRouteName,
1627
+ params: routeParamList[initialRouteName]
1628
+ });
1629
+ }
1630
+ return {
1631
+ stale: false,
1632
+ type: 'stack',
1633
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1634
+ index: routes.length - 1,
1635
+ routeNames,
1636
+ routes
1637
+ };
1638
+ },
1639
+ getStateForRouteNamesChange(state, {
1640
+ routeNames,
1641
+ routeParamList,
1642
+ routeKeyChanges
1643
+ }) {
1644
+ var routes = state.routes.filter(route => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name));
1645
+ if (routes.length === 0) {
1646
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
1647
+ routes.push({
1648
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1649
+ name: initialRouteName,
1650
+ params: routeParamList[initialRouteName]
1651
+ });
1652
+ }
1653
+ return {
1654
+ ...state,
1655
+ routeNames,
1656
+ routes,
1657
+ index: Math.min(state.index, routes.length - 1)
1658
+ };
1659
+ },
1660
+ getStateForRouteFocus(state, key) {
1661
+ var index = state.routes.findIndex(r => r.key === key);
1662
+ if (index === -1 || index === state.index) {
1663
+ return state;
1664
+ }
1665
+ return {
1666
+ ...state,
1667
+ index,
1668
+ routes: state.routes.slice(0, index + 1)
1669
+ };
1670
+ },
1671
+ getStateForAction(state, action, options) {
1672
+ var routeParamList = options.routeParamList;
1673
+ switch (action.type) {
1674
+ case 'REPLACE':
1675
+ {
1676
+ var index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
1677
+ if (index === -1) {
1678
+ return null;
1679
+ }
1680
+ var _action$payload = action.payload,
1681
+ name = _action$payload.name,
1682
+ key = _action$payload.key,
1683
+ params = _action$payload.params;
1684
+ if (!state.routeNames.includes(name)) {
1685
+ return null;
1686
+ }
1687
+ return {
1688
+ ...state,
1689
+ routes: state.routes.map((route, i) => i === index ? {
1690
+ key: key !== undefined ? key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1691
+ name,
1692
+ params: routeParamList[name] !== undefined ? {
1693
+ ...routeParamList[name],
1694
+ ...params
1695
+ } : params
1696
+ } : route)
1697
+ };
1698
+ }
1699
+ case 'PUSH':
1700
+ if (state.routeNames.includes(action.payload.name)) {
1701
+ var getId = options.routeGetIdList[action.payload.name];
1702
+ var id = getId === null || getId === undefined ? undefined : getId({
1703
+ params: action.payload.params
1704
+ });
1705
+ var route = id ? state.routes.find(route => route.name === action.payload.name && id === (getId === null || getId === undefined ? undefined : getId({
1706
+ params: route.params
1707
+ }))) : undefined;
1708
+ var routes;
1709
+ if (route) {
1710
+ routes = state.routes.filter(r => r.key !== route.key);
1711
+ routes.push({
1712
+ ...route,
1713
+ params: routeParamList[action.payload.name] !== undefined ? {
1714
+ ...routeParamList[action.payload.name],
1715
+ ...action.payload.params
1716
+ } : action.payload.params
1717
+ });
1718
+ } else {
1719
+ routes = [...state.routes, {
1720
+ key: `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1721
+ name: action.payload.name,
1722
+ params: routeParamList[action.payload.name] !== undefined ? {
1723
+ ...routeParamList[action.payload.name],
1724
+ ...action.payload.params
1725
+ } : action.payload.params
1726
+ }];
1727
+ }
1728
+ return {
1729
+ ...state,
1730
+ index: routes.length - 1,
1731
+ routes
1732
+ };
1733
+ }
1734
+ return null;
1735
+ case 'POP':
1736
+ {
1737
+ var _index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
1738
+ if (_index > 0) {
1739
+ var count = Math.max(_index - action.payload.count + 1, 1);
1740
+ var _routes = state.routes.slice(0, count).concat(state.routes.slice(_index + 1));
1741
+ return {
1742
+ ...state,
1743
+ index: _routes.length - 1,
1744
+ routes: _routes
1745
+ };
1746
+ }
1747
+ return null;
1748
+ }
1749
+ case 'POP_TO_TOP':
1750
+ return router.getStateForAction(state, {
1751
+ type: 'POP',
1752
+ payload: {
1753
+ count: state.routes.length - 1
1754
+ }
1755
+ }, options);
1756
+ case 'NAVIGATE':
1757
+ if (action.payload.name !== undefined && !state.routeNames.includes(action.payload.name)) {
1758
+ return null;
1759
+ }
1760
+ if (action.payload.key || action.payload.name) {
1761
+ // If the route already exists, navigate to that
1762
+ var _index2 = -1;
1763
+ var _getId =
1764
+ // `getId` and `key` can't be used together
1765
+ action.payload.key === undefined && action.payload.name !== undefined ? options.routeGetIdList[action.payload.name] : undefined;
1766
+ var _id = _getId === null || _getId === undefined ? undefined : _getId({
1767
+ params: action.payload.params
1768
+ });
1769
+ if (_id) {
1770
+ _index2 = state.routes.findIndex(route => route.name === action.payload.name && _id === (_getId === null || _getId === undefined ? undefined : _getId({
1771
+ params: route.params
1772
+ })));
1773
+ } else if (state.routes[state.index].name === action.payload.name && action.payload.key === undefined || state.routes[state.index].key === action.payload.key) {
1774
+ _index2 = state.index;
1775
+ } else {
1776
+ for (var i = state.routes.length - 1; i >= 0; i--) {
1777
+ if (state.routes[i].name === action.payload.name && action.payload.key === undefined || state.routes[i].key === action.payload.key) {
1778
+ _index2 = i;
1779
+ break;
1780
+ }
1781
+ }
1782
+ }
1783
+ if (_index2 === -1 && action.payload.key && action.payload.name === undefined) {
1784
+ return null;
1785
+ }
1786
+ if (_index2 === -1 && action.payload.name !== undefined) {
1787
+ var _routes2 = [...state.routes, {
1788
+ key: action.payload.key ?? `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
1789
+ name: action.payload.name,
1790
+ path: action.payload.path,
1791
+ params: routeParamList[action.payload.name] !== undefined ? {
1792
+ ...routeParamList[action.payload.name],
1793
+ ...action.payload.params
1794
+ } : action.payload.params
1795
+ }];
1796
+ return {
1797
+ ...state,
1798
+ routes: _routes2,
1799
+ index: _routes2.length - 1
1800
+ };
1801
+ }
1802
+ var _route = state.routes[_index2];
1803
+ var _params;
1804
+ if (action.payload.merge) {
1805
+ _params = action.payload.params !== undefined || routeParamList[_route.name] !== undefined ? {
1806
+ ...routeParamList[_route.name],
1807
+ ..._route.params,
1808
+ ...action.payload.params
1809
+ } : _route.params;
1810
+ } else {
1811
+ _params = routeParamList[_route.name] !== undefined ? {
1812
+ ...routeParamList[_route.name],
1813
+ ...action.payload.params
1814
+ } : action.payload.params;
1815
+ }
1816
+ return {
1817
+ ...state,
1818
+ index: _index2,
1819
+ routes: [...state.routes.slice(0, _index2), _params !== _route.params || action.payload.path && action.payload.path !== _route.path ? {
1820
+ ..._route,
1821
+ path: action.payload.path ?? _route.path,
1822
+ params: _params
1823
+ } : state.routes[_index2]]
1824
+ };
1825
+ }
1826
+ return null;
1827
+ case 'GO_BACK':
1828
+ if (state.index > 0) {
1829
+ return router.getStateForAction(state, {
1830
+ type: 'POP',
1831
+ payload: {
1832
+ count: 1
1833
+ },
1834
+ target: action.target,
1835
+ source: action.source
1836
+ }, options);
1837
+ }
1838
+ return null;
1839
+ default:
1840
+ return _BaseRouter.default.getStateForAction(state, action);
1841
+ }
1842
+ },
1843
+ actionCreators: StackActions
1844
+ };
1845
+ return router;
1846
+ }
1847
+ },"94f0b8bb0225084df7a9",["d3b57c8ff490ba8c7c47","95ae28b023658c6d2aff","e03db9aacb1ee503cd26"]);
1848
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1849
+ Object.defineProperty(exports, "__esModule", {
1850
+ value: true
1851
+ });
1852
+ var _exportNames = {
1853
+ CommonActions: true,
1854
+ BaseRouter: true,
1855
+ DrawerActions: true,
1856
+ DrawerRouter: true,
1857
+ StackActions: true,
1858
+ StackRouter: true,
1859
+ TabActions: true,
1860
+ TabRouter: true
1861
+ };
1862
+ Object.defineProperty(exports, "BaseRouter", {
1863
+ enumerable: true,
1864
+ get: function () {
1865
+ return _BaseRouter.default;
1866
+ }
1867
+ });
1868
+ exports.CommonActions = undefined;
1869
+ Object.defineProperty(exports, "DrawerActions", {
1870
+ enumerable: true,
1871
+ get: function () {
1872
+ return _DrawerRouter.DrawerActions;
1873
+ }
1874
+ });
1875
+ Object.defineProperty(exports, "DrawerRouter", {
1876
+ enumerable: true,
1877
+ get: function () {
1878
+ return _DrawerRouter.default;
1879
+ }
1880
+ });
1881
+ Object.defineProperty(exports, "StackActions", {
1882
+ enumerable: true,
1883
+ get: function () {
1884
+ return _StackRouter.StackActions;
1885
+ }
1886
+ });
1887
+ Object.defineProperty(exports, "StackRouter", {
1888
+ enumerable: true,
1889
+ get: function () {
1890
+ return _StackRouter.default;
1891
+ }
1892
+ });
1893
+ Object.defineProperty(exports, "TabActions", {
1894
+ enumerable: true,
1895
+ get: function () {
1896
+ return _TabRouter.TabActions;
1897
+ }
1898
+ });
1899
+ Object.defineProperty(exports, "TabRouter", {
1900
+ enumerable: true,
1901
+ get: function () {
1902
+ return _TabRouter.default;
1903
+ }
1904
+ });
1905
+ var CommonActions = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
1906
+ exports.CommonActions = CommonActions;
1907
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[1])(_$$_REQUIRE(_dependencyMap[2]));
1908
+ var _DrawerRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
1909
+ var _StackRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[4]));
1910
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[5]));
1911
+ Object.keys(_$$_REQUIRE(_dependencyMap[6])).forEach(function (key) {
1912
+ if (key === "default" || key === "__esModule") return;
1913
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
1914
+ if (key in exports && exports[key] === _$$_REQUIRE(_dependencyMap[6])[key]) return;
1915
+ Object.defineProperty(exports, key, {
1916
+ enumerable: true,
1917
+ get: function () {
1918
+ return _$$_REQUIRE(_dependencyMap[6])[key];
1919
+ }
1920
+ });
1921
+ });
1922
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
1923
+ },"36fad61dee5e550281f1",["f1e0b3318f7f12bf2431","d3b57c8ff490ba8c7c47","95ae28b023658c6d2aff","4344b53816d7b780f3dd","94f0b8bb0225084df7a9","20cc2f3e0ac4154b79f0","e32e355e493ded18598c"]);
1924
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1925
+ Object.defineProperty(exports, "__esModule", {
1926
+ value: true
1927
+ });
1928
+ },"e32e355e493ded18598c",[]);
1929
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1930
+ Object.defineProperty(exports, "__esModule", {
1931
+ value: true
1932
+ });
1933
+ exports.default = undefined;
1934
+ /**
1935
+ * Base router object that can be used when writing custom routers.
1936
+ * This provides few helper methods to handle common actions such as `RESET`.
1937
+ */
1938
+ var BaseRouter = {
1939
+ getStateForAction(state, action) {
1940
+ switch (action.type) {
1941
+ case 'SET_PARAMS':
1942
+ {
1943
+ var index = action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
1944
+ if (index === -1) {
1945
+ return null;
1946
+ }
1947
+ return {
1948
+ ...state,
1949
+ routes: state.routes.map((r, i) => i === index ? {
1950
+ ...r,
1951
+ params: {
1952
+ ...r.params,
1953
+ ...action.payload.params
1954
+ }
1955
+ } : r)
1956
+ };
1957
+ }
1958
+ case 'RESET':
1959
+ {
1960
+ var nextState = action.payload;
1961
+ if (nextState.routes.length === 0 || nextState.routes.some(route => !state.routeNames.includes(route.name))) {
1962
+ return null;
1963
+ }
1964
+ if (nextState.stale === false) {
1965
+ if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(name => !state.routeNames.includes(name))) {
1966
+ return null;
1967
+ }
1968
+ return {
1969
+ ...nextState,
1970
+ routes: nextState.routes.map(route => route.key ? route : {
1971
+ ...route,
1972
+ key: `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[0]).nanoid)()}`
1973
+ })
1974
+ };
1975
+ }
1976
+ return nextState;
1977
+ }
1978
+ default:
1979
+ return null;
1980
+ }
1981
+ },
1982
+ shouldActionChangeFocus(action) {
1983
+ return action.type === 'NAVIGATE';
1984
+ }
1985
+ };
1986
+ var _default = exports.default = BaseRouter;
1987
+ },"58153a28fc8e098e8bbf",["e03db9aacb1ee503cd26"]);
1988
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
1989
+ Object.defineProperty(exports, "__esModule", {
1990
+ value: true
1991
+ });
1992
+ exports.goBack = goBack;
1993
+ exports.navigate = navigate;
1994
+ exports.reset = reset;
1995
+ exports.setParams = setParams;
1996
+ function goBack() {
1997
+ return {
1998
+ type: 'GO_BACK'
1999
+ };
2000
+ }
2001
+
2002
+ // eslint-disable-next-line no-redeclare
2003
+
2004
+ // eslint-disable-next-line no-redeclare
2005
+ function navigate(...args) {
2006
+ if (typeof args[0] === 'string') {
2007
+ return {
2008
+ type: 'NAVIGATE',
2009
+ payload: {
2010
+ name: args[0],
2011
+ params: args[1]
2012
+ }
2013
+ };
2014
+ } else {
2015
+ var payload = args[0] || {};
2016
+ if (!payload.hasOwnProperty('key') && !payload.hasOwnProperty('name')) {
2017
+ throw new Error('You need to specify name or key when calling navigate with an object as the argument. See https://reactnavigation.org/docs/navigation-actions#navigate for usage.');
2018
+ }
2019
+ return {
2020
+ type: 'NAVIGATE',
2021
+ payload
2022
+ };
2023
+ }
2024
+ }
2025
+ function reset(state) {
2026
+ return {
2027
+ type: 'RESET',
2028
+ payload: state
2029
+ };
2030
+ }
2031
+ function setParams(params) {
2032
+ return {
2033
+ type: 'SET_PARAMS',
2034
+ payload: {
2035
+ params
2036
+ }
2037
+ };
2038
+ }
2039
+ },"44010d2886624e71e726",[]);
2040
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2041
+ Object.defineProperty(exports, "__esModule", {
2042
+ value: true
2043
+ });
2044
+ exports.DrawerActions = undefined;
2045
+ exports.default = DrawerRouter;
2046
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
2047
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
2048
+ var DrawerActions = exports.DrawerActions = {
2049
+ ..._TabRouter.TabActions,
2050
+ openDrawer() {
2051
+ return {
2052
+ type: 'OPEN_DRAWER'
2053
+ };
2054
+ },
2055
+ closeDrawer() {
2056
+ return {
2057
+ type: 'CLOSE_DRAWER'
2058
+ };
2059
+ },
2060
+ toggleDrawer() {
2061
+ return {
2062
+ type: 'TOGGLE_DRAWER'
2063
+ };
2064
+ }
2065
+ };
2066
+ function DrawerRouter({
2067
+ defaultStatus = 'closed',
2068
+ ...rest
2069
+ }) {
2070
+ var router = (0, _TabRouter.default)(rest);
2071
+ var isDrawerInHistory = state => Boolean(state.history?.some(it => it.type === 'drawer'));
2072
+ var addDrawerToHistory = state => {
2073
+ if (isDrawerInHistory(state)) {
2074
+ return state;
2075
+ }
2076
+ return {
2077
+ ...state,
2078
+ history: [...state.history, {
2079
+ type: 'drawer',
2080
+ status: defaultStatus === 'open' ? 'closed' : 'open'
2081
+ }]
2082
+ };
2083
+ };
2084
+ var removeDrawerFromHistory = state => {
2085
+ if (!isDrawerInHistory(state)) {
2086
+ return state;
2087
+ }
2088
+ return {
2089
+ ...state,
2090
+ history: state.history.filter(it => it.type !== 'drawer')
2091
+ };
2092
+ };
2093
+ var openDrawer = state => {
2094
+ if (defaultStatus === 'open') {
2095
+ return removeDrawerFromHistory(state);
2096
+ }
2097
+ return addDrawerToHistory(state);
2098
+ };
2099
+ var closeDrawer = state => {
2100
+ if (defaultStatus === 'open') {
2101
+ return addDrawerToHistory(state);
2102
+ }
2103
+ return removeDrawerFromHistory(state);
2104
+ };
2105
+ return {
2106
+ ...router,
2107
+ type: 'drawer',
2108
+ getInitialState({
2109
+ routeNames,
2110
+ routeParamList,
2111
+ routeGetIdList
2112
+ }) {
2113
+ var state = router.getInitialState({
2114
+ routeNames,
2115
+ routeParamList,
2116
+ routeGetIdList
2117
+ });
2118
+ return {
2119
+ ...state,
2120
+ default: defaultStatus,
2121
+ stale: false,
2122
+ type: 'drawer',
2123
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
2124
+ };
2125
+ },
2126
+ getRehydratedState(partialState, {
2127
+ routeNames,
2128
+ routeParamList,
2129
+ routeGetIdList
2130
+ }) {
2131
+ if (partialState.stale === false) {
2132
+ return partialState;
2133
+ }
2134
+ var state = router.getRehydratedState(partialState, {
2135
+ routeNames,
2136
+ routeParamList,
2137
+ routeGetIdList
2138
+ });
2139
+ if (isDrawerInHistory(partialState)) {
2140
+ // Re-sync the drawer entry in history to correct it if it was wrong
2141
+ state = removeDrawerFromHistory(state);
2142
+ state = addDrawerToHistory(state);
2143
+ }
2144
+ return {
2145
+ ...state,
2146
+ default: defaultStatus,
2147
+ type: 'drawer',
2148
+ key: `drawer-${(0, _$$_REQUIRE(_dependencyMap[1]).nanoid)()}`
2149
+ };
2150
+ },
2151
+ getStateForRouteFocus(state, key) {
2152
+ var result = router.getStateForRouteFocus(state, key);
2153
+ return closeDrawer(result);
2154
+ },
2155
+ getStateForAction(state, action, options) {
2156
+ switch (action.type) {
2157
+ case 'OPEN_DRAWER':
2158
+ return openDrawer(state);
2159
+ case 'CLOSE_DRAWER':
2160
+ return closeDrawer(state);
2161
+ case 'TOGGLE_DRAWER':
2162
+ if (isDrawerInHistory(state)) {
2163
+ return removeDrawerFromHistory(state);
2164
+ }
2165
+ return addDrawerToHistory(state);
2166
+ case 'JUMP_TO':
2167
+ case 'NAVIGATE':
2168
+ {
2169
+ var result = router.getStateForAction(state, action, options);
2170
+ if (result != null && result.index !== state.index) {
2171
+ return closeDrawer(result);
2172
+ }
2173
+ return result;
2174
+ }
2175
+ case 'GO_BACK':
2176
+ if (isDrawerInHistory(state)) {
2177
+ return removeDrawerFromHistory(state);
2178
+ }
2179
+ return router.getStateForAction(state, action, options);
2180
+ default:
2181
+ return router.getStateForAction(state, action, options);
2182
+ }
2183
+ },
2184
+ actionCreators: DrawerActions
2185
+ };
2186
+ }
2187
+ },"68ee2377a6ca7029997f",["46e9b616ece3d5066957","e03db9aacb1ee503cd26"]);
2188
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2189
+ Object.defineProperty(exports, "__esModule", {
2190
+ value: true
2191
+ });
2192
+ exports.TabActions = undefined;
2193
+ exports.default = TabRouter;
2194
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
2195
+ var TYPE_ROUTE = 'route';
2196
+ var TabActions = exports.TabActions = {
2197
+ jumpTo(name, params) {
2198
+ return {
2199
+ type: 'JUMP_TO',
2200
+ payload: {
2201
+ name,
2202
+ params
2203
+ }
2204
+ };
2205
+ }
2206
+ };
2207
+ var getRouteHistory = (routes, index, backBehavior, initialRouteName) => {
2208
+ var history = [{
2209
+ type: TYPE_ROUTE,
2210
+ key: routes[index].key
2211
+ }];
2212
+ var initialRouteIndex;
2213
+ switch (backBehavior) {
2214
+ case 'order':
2215
+ for (var i = index; i > 0; i--) {
2216
+ history.unshift({
2217
+ type: TYPE_ROUTE,
2218
+ key: routes[i - 1].key
2219
+ });
2220
+ }
2221
+ break;
2222
+ case 'firstRoute':
2223
+ if (index !== 0) {
2224
+ history.unshift({
2225
+ type: TYPE_ROUTE,
2226
+ key: routes[0].key
2227
+ });
2228
+ }
2229
+ break;
2230
+ case 'initialRoute':
2231
+ initialRouteIndex = routes.findIndex(route => route.name === initialRouteName);
2232
+ initialRouteIndex = initialRouteIndex === -1 ? 0 : initialRouteIndex;
2233
+ if (index !== initialRouteIndex) {
2234
+ history.unshift({
2235
+ type: TYPE_ROUTE,
2236
+ key: routes[initialRouteIndex].key
2237
+ });
2238
+ }
2239
+ break;
2240
+ case 'history':
2241
+ // The history will fill up on navigation
2242
+ break;
2243
+ }
2244
+ return history;
2245
+ };
2246
+ var changeIndex = (state, index, backBehavior, initialRouteName) => {
2247
+ var history;
2248
+ if (backBehavior === 'history') {
2249
+ var currentKey = state.routes[index].key;
2250
+ history = state.history.filter(it => it.type === 'route' ? it.key !== currentKey : false).concat({
2251
+ type: TYPE_ROUTE,
2252
+ key: currentKey
2253
+ });
2254
+ } else {
2255
+ history = getRouteHistory(state.routes, index, backBehavior, initialRouteName);
2256
+ }
2257
+ return {
2258
+ ...state,
2259
+ index,
2260
+ history
2261
+ };
2262
+ };
2263
+ function TabRouter({
2264
+ initialRouteName,
2265
+ backBehavior = 'firstRoute'
2266
+ }) {
2267
+ var router = {
2268
+ ..._BaseRouter.default,
2269
+ type: 'tab',
2270
+ getInitialState({
2271
+ routeNames,
2272
+ routeParamList
2273
+ }) {
2274
+ var index = initialRouteName !== undefined && routeNames.includes(initialRouteName) ? routeNames.indexOf(initialRouteName) : 0;
2275
+ var routes = routeNames.map(name => ({
2276
+ name,
2277
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2278
+ params: routeParamList[name]
2279
+ }));
2280
+ var history = getRouteHistory(routes, index, backBehavior, initialRouteName);
2281
+ return {
2282
+ stale: false,
2283
+ type: 'tab',
2284
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2285
+ index,
2286
+ routeNames,
2287
+ history,
2288
+ routes
2289
+ };
2290
+ },
2291
+ getRehydratedState(partialState, {
2292
+ routeNames,
2293
+ routeParamList
2294
+ }) {
2295
+ var state = partialState;
2296
+ if (state.stale === false) {
2297
+ return state;
2298
+ }
2299
+ var routes = routeNames.map(name => {
2300
+ var route = state.routes.find(r => r.name === name);
2301
+ return {
2302
+ ...route,
2303
+ name,
2304
+ key: route && route.name === name && route.key ? route.key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2305
+ params: routeParamList[name] !== undefined ? {
2306
+ ...routeParamList[name],
2307
+ ...(route ? route.params : undefined)
2308
+ } : route ? route.params : undefined
2309
+ };
2310
+ });
2311
+ var index = Math.min(Math.max(routeNames.indexOf(state.routes[state?.index ?? 0]?.name), 0), routes.length - 1);
2312
+ var history = state.history?.filter(it => routes.find(r => r.key === it.key)) ?? [];
2313
+ return changeIndex({
2314
+ stale: false,
2315
+ type: 'tab',
2316
+ key: `tab-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2317
+ index,
2318
+ routeNames,
2319
+ history,
2320
+ routes
2321
+ }, index, backBehavior, initialRouteName);
2322
+ },
2323
+ getStateForRouteNamesChange(state, {
2324
+ routeNames,
2325
+ routeParamList,
2326
+ routeKeyChanges
2327
+ }) {
2328
+ var routes = routeNames.map(name => state.routes.find(r => r.name === name && !routeKeyChanges.includes(r.name)) || {
2329
+ name,
2330
+ key: `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2331
+ params: routeParamList[name]
2332
+ });
2333
+ var index = Math.max(0, routeNames.indexOf(state.routes[state.index].name));
2334
+ var history = state.history.filter(
2335
+ // Type will always be 'route' for tabs, but could be different in a router extending this (e.g. drawer)
2336
+ it => it.type !== 'route' || routes.find(r => r.key === it.key));
2337
+ if (!history.length) {
2338
+ history = getRouteHistory(routes, index, backBehavior, initialRouteName);
2339
+ }
2340
+ return {
2341
+ ...state,
2342
+ history,
2343
+ routeNames,
2344
+ routes,
2345
+ index
2346
+ };
2347
+ },
2348
+ getStateForRouteFocus(state, key) {
2349
+ var index = state.routes.findIndex(r => r.key === key);
2350
+ if (index === -1 || index === state.index) {
2351
+ return state;
2352
+ }
2353
+ return changeIndex(state, index, backBehavior, initialRouteName);
2354
+ },
2355
+ getStateForAction(state, action, {
2356
+ routeParamList,
2357
+ routeGetIdList
2358
+ }) {
2359
+ switch (action.type) {
2360
+ case 'JUMP_TO':
2361
+ case 'NAVIGATE':
2362
+ {
2363
+ var index = -1;
2364
+ if (action.type === 'NAVIGATE' && action.payload.key) {
2365
+ index = state.routes.findIndex(route => route.key === action.payload.key);
2366
+ } else {
2367
+ index = state.routes.findIndex(route => route.name === action.payload.name);
2368
+ }
2369
+ if (index === -1) {
2370
+ return null;
2371
+ }
2372
+ return changeIndex({
2373
+ ...state,
2374
+ routes: state.routes.map((route, i) => {
2375
+ if (i !== index) {
2376
+ return route;
2377
+ }
2378
+ var getId = routeGetIdList[route.name];
2379
+ var currentId = getId?.({
2380
+ params: route.params
2381
+ });
2382
+ var nextId = getId?.({
2383
+ params: action.payload.params
2384
+ });
2385
+ var key = currentId === nextId ? route.key : `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`;
2386
+ var params;
2387
+ if (action.type === 'NAVIGATE' && action.payload.merge && currentId === nextId) {
2388
+ params = action.payload.params !== undefined || routeParamList[route.name] !== undefined ? {
2389
+ ...routeParamList[route.name],
2390
+ ...route.params,
2391
+ ...action.payload.params
2392
+ } : route.params;
2393
+ } else {
2394
+ params = routeParamList[route.name] !== undefined ? {
2395
+ ...routeParamList[route.name],
2396
+ ...action.payload.params
2397
+ } : action.payload.params;
2398
+ }
2399
+ var path = action.type === 'NAVIGATE' && action.payload.path != null ? action.payload.path : route.path;
2400
+ return params !== route.params || path !== route.path ? {
2401
+ ...route,
2402
+ key,
2403
+ path,
2404
+ params
2405
+ } : route;
2406
+ })
2407
+ }, index, backBehavior, initialRouteName);
2408
+ }
2409
+ case 'GO_BACK':
2410
+ {
2411
+ if (state.history.length === 1) {
2412
+ return null;
2413
+ }
2414
+ var previousKey = state.history[state.history.length - 2].key;
2415
+ var _index = state.routes.findIndex(route => route.key === previousKey);
2416
+ if (_index === -1) {
2417
+ return null;
2418
+ }
2419
+ return {
2420
+ ...state,
2421
+ history: state.history.slice(0, -1),
2422
+ index: _index
2423
+ };
2424
+ }
2425
+ default:
2426
+ return _BaseRouter.default.getStateForAction(state, action);
2427
+ }
2428
+ },
2429
+ shouldActionChangeFocus(action) {
2430
+ return action.type === 'NAVIGATE';
2431
+ },
2432
+ actionCreators: TabActions
2433
+ };
2434
+ return router;
2435
+ }
2436
+ },"46e9b616ece3d5066957",["d3b57c8ff490ba8c7c47","58153a28fc8e098e8bbf","e03db9aacb1ee503cd26"]);
2437
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2438
+ Object.defineProperty(exports, "__esModule", {
2439
+ value: true
2440
+ });
2441
+ exports.StackActions = undefined;
2442
+ exports.default = StackRouter;
2443
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[0])(_$$_REQUIRE(_dependencyMap[1]));
2444
+ var StackActions = exports.StackActions = {
2445
+ replace(name, params) {
2446
+ return {
2447
+ type: 'REPLACE',
2448
+ payload: {
2449
+ name,
2450
+ params
2451
+ }
2452
+ };
2453
+ },
2454
+ push(name, params) {
2455
+ return {
2456
+ type: 'PUSH',
2457
+ payload: {
2458
+ name,
2459
+ params
2460
+ }
2461
+ };
2462
+ },
2463
+ pop(count = 1) {
2464
+ return {
2465
+ type: 'POP',
2466
+ payload: {
2467
+ count
2468
+ }
2469
+ };
2470
+ },
2471
+ popToTop() {
2472
+ return {
2473
+ type: 'POP_TO_TOP'
2474
+ };
2475
+ }
2476
+ };
2477
+ function StackRouter(options) {
2478
+ var router = {
2479
+ ..._BaseRouter.default,
2480
+ type: 'stack',
2481
+ getInitialState({
2482
+ routeNames,
2483
+ routeParamList
2484
+ }) {
2485
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
2486
+ return {
2487
+ stale: false,
2488
+ type: 'stack',
2489
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2490
+ index: 0,
2491
+ routeNames,
2492
+ routes: [{
2493
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2494
+ name: initialRouteName,
2495
+ params: routeParamList[initialRouteName]
2496
+ }]
2497
+ };
2498
+ },
2499
+ getRehydratedState(partialState, {
2500
+ routeNames,
2501
+ routeParamList
2502
+ }) {
2503
+ var state = partialState;
2504
+ if (state.stale === false) {
2505
+ return state;
2506
+ }
2507
+ var routes = state.routes.filter(route => routeNames.includes(route.name)).map(route => ({
2508
+ ...route,
2509
+ key: route.key || `${route.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2510
+ params: routeParamList[route.name] !== undefined ? {
2511
+ ...routeParamList[route.name],
2512
+ ...route.params
2513
+ } : route.params
2514
+ }));
2515
+ if (routes.length === 0) {
2516
+ var initialRouteName = options.initialRouteName !== undefined ? options.initialRouteName : routeNames[0];
2517
+ routes.push({
2518
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2519
+ name: initialRouteName,
2520
+ params: routeParamList[initialRouteName]
2521
+ });
2522
+ }
2523
+ return {
2524
+ stale: false,
2525
+ type: 'stack',
2526
+ key: `stack-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2527
+ index: routes.length - 1,
2528
+ routeNames,
2529
+ routes
2530
+ };
2531
+ },
2532
+ getStateForRouteNamesChange(state, {
2533
+ routeNames,
2534
+ routeParamList,
2535
+ routeKeyChanges
2536
+ }) {
2537
+ var routes = state.routes.filter(route => routeNames.includes(route.name) && !routeKeyChanges.includes(route.name));
2538
+ if (routes.length === 0) {
2539
+ var initialRouteName = options.initialRouteName !== undefined && routeNames.includes(options.initialRouteName) ? options.initialRouteName : routeNames[0];
2540
+ routes.push({
2541
+ key: `${initialRouteName}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2542
+ name: initialRouteName,
2543
+ params: routeParamList[initialRouteName]
2544
+ });
2545
+ }
2546
+ return {
2547
+ ...state,
2548
+ routeNames,
2549
+ routes,
2550
+ index: Math.min(state.index, routes.length - 1)
2551
+ };
2552
+ },
2553
+ getStateForRouteFocus(state, key) {
2554
+ var index = state.routes.findIndex(r => r.key === key);
2555
+ if (index === -1 || index === state.index) {
2556
+ return state;
2557
+ }
2558
+ return {
2559
+ ...state,
2560
+ index,
2561
+ routes: state.routes.slice(0, index + 1)
2562
+ };
2563
+ },
2564
+ getStateForAction(state, action, options) {
2565
+ var routeParamList = options.routeParamList;
2566
+ switch (action.type) {
2567
+ case 'REPLACE':
2568
+ {
2569
+ var index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
2570
+ if (index === -1) {
2571
+ return null;
2572
+ }
2573
+ var _action$payload = action.payload,
2574
+ name = _action$payload.name,
2575
+ key = _action$payload.key,
2576
+ params = _action$payload.params;
2577
+ if (!state.routeNames.includes(name)) {
2578
+ return null;
2579
+ }
2580
+ return {
2581
+ ...state,
2582
+ routes: state.routes.map((route, i) => i === index ? {
2583
+ key: key !== undefined ? key : `${name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2584
+ name,
2585
+ params: routeParamList[name] !== undefined ? {
2586
+ ...routeParamList[name],
2587
+ ...params
2588
+ } : params
2589
+ } : route)
2590
+ };
2591
+ }
2592
+ case 'PUSH':
2593
+ if (state.routeNames.includes(action.payload.name)) {
2594
+ var getId = options.routeGetIdList[action.payload.name];
2595
+ var id = getId?.({
2596
+ params: action.payload.params
2597
+ });
2598
+ var route = id ? state.routes.find(route => route.name === action.payload.name && id === getId?.({
2599
+ params: route.params
2600
+ })) : undefined;
2601
+ var routes;
2602
+ if (route) {
2603
+ routes = state.routes.filter(r => r.key !== route.key);
2604
+ routes.push({
2605
+ ...route,
2606
+ params: routeParamList[action.payload.name] !== undefined ? {
2607
+ ...routeParamList[action.payload.name],
2608
+ ...action.payload.params
2609
+ } : action.payload.params
2610
+ });
2611
+ } else {
2612
+ routes = [...state.routes, {
2613
+ key: `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2614
+ name: action.payload.name,
2615
+ params: routeParamList[action.payload.name] !== undefined ? {
2616
+ ...routeParamList[action.payload.name],
2617
+ ...action.payload.params
2618
+ } : action.payload.params
2619
+ }];
2620
+ }
2621
+ return {
2622
+ ...state,
2623
+ index: routes.length - 1,
2624
+ routes
2625
+ };
2626
+ }
2627
+ return null;
2628
+ case 'POP':
2629
+ {
2630
+ var _index = action.target === state.key && action.source ? state.routes.findIndex(r => r.key === action.source) : state.index;
2631
+ if (_index > 0) {
2632
+ var _count = Math.max(_index - action.payload.count + 1, 1);
2633
+ var _routes = state.routes.slice(0, _count).concat(state.routes.slice(_index + 1));
2634
+ return {
2635
+ ...state,
2636
+ index: _routes.length - 1,
2637
+ routes: _routes
2638
+ };
2639
+ }
2640
+ return null;
2641
+ }
2642
+ case 'POP_TO_TOP':
2643
+ return router.getStateForAction(state, {
2644
+ type: 'POP',
2645
+ payload: {
2646
+ count: state.routes.length - 1
2647
+ }
2648
+ }, options);
2649
+ case 'NAVIGATE':
2650
+ if (action.payload.name !== undefined && !state.routeNames.includes(action.payload.name)) {
2651
+ return null;
2652
+ }
2653
+ if (action.payload.key || action.payload.name) {
2654
+ // If the route already exists, navigate to that
2655
+ var _index2 = -1;
2656
+ var _getId =
2657
+ // `getId` and `key` can't be used together
2658
+ action.payload.key === undefined && action.payload.name !== undefined ? options.routeGetIdList[action.payload.name] : undefined;
2659
+ var _id = _getId?.({
2660
+ params: action.payload.params
2661
+ });
2662
+ if (_id) {
2663
+ _index2 = state.routes.findIndex(route => route.name === action.payload.name && _id === _getId?.({
2664
+ params: route.params
2665
+ }));
2666
+ } else if (state.routes[state.index].name === action.payload.name && action.payload.key === undefined || state.routes[state.index].key === action.payload.key) {
2667
+ _index2 = state.index;
2668
+ } else {
2669
+ for (var i = state.routes.length - 1; i >= 0; i--) {
2670
+ if (state.routes[i].name === action.payload.name && action.payload.key === undefined || state.routes[i].key === action.payload.key) {
2671
+ _index2 = i;
2672
+ break;
2673
+ }
2674
+ }
2675
+ }
2676
+ if (_index2 === -1 && action.payload.key && action.payload.name === undefined) {
2677
+ return null;
2678
+ }
2679
+ if (_index2 === -1 && action.payload.name !== undefined) {
2680
+ var _routes2 = [...state.routes, {
2681
+ key: action.payload.key ?? `${action.payload.name}-${(0, _$$_REQUIRE(_dependencyMap[2]).nanoid)()}`,
2682
+ name: action.payload.name,
2683
+ path: action.payload.path,
2684
+ params: routeParamList[action.payload.name] !== undefined ? {
2685
+ ...routeParamList[action.payload.name],
2686
+ ...action.payload.params
2687
+ } : action.payload.params
2688
+ }];
2689
+ return {
2690
+ ...state,
2691
+ routes: _routes2,
2692
+ index: _routes2.length - 1
2693
+ };
2694
+ }
2695
+ var _route = state.routes[_index2];
2696
+ var _params;
2697
+ if (action.payload.merge) {
2698
+ _params = action.payload.params !== undefined || routeParamList[_route.name] !== undefined ? {
2699
+ ...routeParamList[_route.name],
2700
+ ..._route.params,
2701
+ ...action.payload.params
2702
+ } : _route.params;
2703
+ } else {
2704
+ _params = routeParamList[_route.name] !== undefined ? {
2705
+ ...routeParamList[_route.name],
2706
+ ...action.payload.params
2707
+ } : action.payload.params;
2708
+ }
2709
+ return {
2710
+ ...state,
2711
+ index: _index2,
2712
+ routes: [...state.routes.slice(0, _index2), _params !== _route.params || action.payload.path && action.payload.path !== _route.path ? {
2713
+ ..._route,
2714
+ path: action.payload.path ?? _route.path,
2715
+ params: _params
2716
+ } : state.routes[_index2]]
2717
+ };
2718
+ }
2719
+ return null;
2720
+ case 'GO_BACK':
2721
+ if (state.index > 0) {
2722
+ return router.getStateForAction(state, {
2723
+ type: 'POP',
2724
+ payload: {
2725
+ count: 1
2726
+ },
2727
+ target: action.target,
2728
+ source: action.source
2729
+ }, options);
2730
+ }
2731
+ return null;
2732
+ default:
2733
+ return _BaseRouter.default.getStateForAction(state, action);
2734
+ }
2735
+ },
2736
+ actionCreators: StackActions
2737
+ };
2738
+ return router;
2739
+ }
2740
+ },"97533916e76df342b455",["d3b57c8ff490ba8c7c47","58153a28fc8e098e8bbf","e03db9aacb1ee503cd26"]);
2741
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2742
+ Object.defineProperty(exports, "__esModule", {
2743
+ value: true
2744
+ });
2745
+ var _exportNames = {
2746
+ CommonActions: true,
2747
+ BaseRouter: true,
2748
+ DrawerActions: true,
2749
+ DrawerRouter: true,
2750
+ StackActions: true,
2751
+ StackRouter: true,
2752
+ TabActions: true,
2753
+ TabRouter: true
2754
+ };
2755
+ Object.defineProperty(exports, "BaseRouter", {
2756
+ enumerable: true,
2757
+ get: function () {
2758
+ return _BaseRouter.default;
2759
+ }
2760
+ });
2761
+ exports.CommonActions = undefined;
2762
+ Object.defineProperty(exports, "DrawerActions", {
2763
+ enumerable: true,
2764
+ get: function () {
2765
+ return _DrawerRouter.DrawerActions;
2766
+ }
2767
+ });
2768
+ Object.defineProperty(exports, "DrawerRouter", {
2769
+ enumerable: true,
2770
+ get: function () {
2771
+ return _DrawerRouter.default;
2772
+ }
2773
+ });
2774
+ Object.defineProperty(exports, "StackActions", {
2775
+ enumerable: true,
2776
+ get: function () {
2777
+ return _StackRouter.StackActions;
2778
+ }
2779
+ });
2780
+ Object.defineProperty(exports, "StackRouter", {
2781
+ enumerable: true,
2782
+ get: function () {
2783
+ return _StackRouter.default;
2784
+ }
2785
+ });
2786
+ Object.defineProperty(exports, "TabActions", {
2787
+ enumerable: true,
2788
+ get: function () {
2789
+ return _TabRouter.TabActions;
2790
+ }
2791
+ });
2792
+ Object.defineProperty(exports, "TabRouter", {
2793
+ enumerable: true,
2794
+ get: function () {
2795
+ return _TabRouter.default;
2796
+ }
2797
+ });
2798
+ var CommonActions = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[0]));
2799
+ exports.CommonActions = CommonActions;
2800
+ var _BaseRouter = _$$_REQUIRE(_dependencyMap[1])(_$$_REQUIRE(_dependencyMap[2]));
2801
+ var _DrawerRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[3]));
2802
+ var _StackRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[4]));
2803
+ var _TabRouter = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[5]));
2804
+ Object.keys(_$$_REQUIRE(_dependencyMap[6])).forEach(function (key) {
2805
+ if (key === "default" || key === "__esModule") return;
2806
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
2807
+ if (key in exports && exports[key] === _$$_REQUIRE(_dependencyMap[6])[key]) return;
2808
+ Object.defineProperty(exports, key, {
2809
+ enumerable: true,
2810
+ get: function () {
2811
+ return _$$_REQUIRE(_dependencyMap[6])[key];
2812
+ }
2813
+ });
2814
+ });
2815
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
2816
+ },"c7ce5eb5541f78e249bf",["44010d2886624e71e726","d3b57c8ff490ba8c7c47","58153a28fc8e098e8bbf","68ee2377a6ca7029997f","97533916e76df342b455","46e9b616ece3d5066957","9c8c9b182c731effad0e"]);
2817
+ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
2818
+ Object.defineProperty(exports, "__esModule", {
2819
+ value: true
2820
+ });
2821
+ },"9c8c9b182c731effad0e",[]);