{"ast":null,"code":"\"use strict\";\n\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nimport { nanoid } from 'nanoid/non-secure';\nexport var BaseRouter = {\n  getStateForAction: function getStateForAction(state, action) {\n    switch (action.type) {\n      case 'SET_PARAMS':\n      case 'REPLACE_PARAMS':\n        {\n          var index = action.source ? state.routes.findIndex(function (r) {\n            return r.key === action.source;\n          }) : state.index;\n          if (index === -1) {\n            return null;\n          }\n          return _objectSpread(_objectSpread({}, state), {}, {\n            routes: state.routes.map(function (r, i) {\n              return i === index ? _objectSpread(_objectSpread({}, r), {}, {\n                params: action.type === 'REPLACE_PARAMS' ? action.payload.params : _objectSpread(_objectSpread({}, r.params), action.payload.params)\n              }) : r;\n            })\n          });\n        }\n      case 'RESET':\n        {\n          var nextState = action.payload;\n          if (nextState.routes.length === 0 || nextState.routes.some(function (route) {\n            return !state.routeNames.includes(route.name);\n          })) {\n            return null;\n          }\n          if (nextState.stale === false) {\n            if (state.routeNames.length !== nextState.routeNames.length || nextState.routeNames.some(function (name) {\n              return !state.routeNames.includes(name);\n            })) {\n              return null;\n            }\n            return _objectSpread(_objectSpread({}, nextState), {}, {\n              routes: nextState.routes.map(function (route) {\n                return route.key ? route : _objectSpread(_objectSpread({}, route), {}, {\n                  key: `${route.name}-${nanoid()}`\n                });\n              })\n            });\n          }\n          return nextState;\n        }\n      default:\n        return null;\n    }\n  },\n  shouldActionChangeFocus: function shouldActionChangeFocus(action) {\n    return action.type === 'NAVIGATE' || action.type === 'NAVIGATE_DEPRECATED';\n  }\n};","map":{"version":3,"names":["nanoid","BaseRouter","getStateForAction","state","action","type","index","source","routes","findIndex","r","key","_objectSpread","map","i","params","payload","nextState","length","some","route","routeNames","includes","name","stale","shouldActionChangeFocus"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/@react-navigation/routers/src/BaseRouter.tsx"],"sourcesContent":["import { nanoid } from 'nanoid/non-secure';\n\nimport type {\n  CommonNavigationAction,\n  NavigationState,\n  PartialState,\n} from './types';\n\n/**\n * Base router object that can be used when writing custom routers.\n * This provides few helper methods to handle common actions such as `RESET`.\n */\nexport const BaseRouter = {\n  getStateForAction<State extends NavigationState>(\n    state: State,\n    action: CommonNavigationAction\n  ): State | PartialState<State> | null {\n    switch (action.type) {\n      case 'SET_PARAMS':\n      case 'REPLACE_PARAMS': {\n        const index = action.source\n          ? state.routes.findIndex((r) => r.key === action.source)\n          : state.index;\n\n        if (index === -1) {\n          return null;\n        }\n\n        return {\n          ...state,\n          routes: state.routes.map((r, i) =>\n            i === index\n              ? {\n                  ...r,\n                  params:\n                    action.type === 'REPLACE_PARAMS'\n                      ? action.payload.params\n                      : { ...r.params, ...action.payload.params },\n                }\n              : r\n          ),\n        };\n      }\n\n      case 'RESET': {\n        const nextState = action.payload as State | PartialState<State>;\n\n        if (\n          nextState.routes.length === 0 ||\n          nextState.routes.some(\n            (route: { name: string }) => !state.routeNames.includes(route.name)\n          )\n        ) {\n          return null;\n        }\n\n        if (nextState.stale === false) {\n          if (\n            state.routeNames.length !== nextState.routeNames.length ||\n            nextState.routeNames.some(\n              (name) => !state.routeNames.includes(name)\n            )\n          ) {\n            return null;\n          }\n\n          return {\n            ...nextState,\n            routes: nextState.routes.map((route) =>\n              route.key ? route : { ...route, key: `${route.name}-${nanoid()}` }\n            ),\n          };\n        }\n\n        return nextState;\n      }\n\n      default:\n        return null;\n    }\n  },\n\n  shouldActionChangeFocus(action: CommonNavigationAction) {\n    return action.type === 'NAVIGATE' || action.type === 'NAVIGATE_DEPRECATED';\n  },\n};\n"],"mappings":";;;;;AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAY1C,OAAO,IAAMC,UAAU,GAAG;EACxBC,iBAAiB,WAAjBA,iBAAiBA,CACfC,KAAY,EACZC,MAA8B,EACM;IACpC,QAAQA,MAAM,CAACC,IAAI;MACjB,KAAK,YAAY;MACjB,KAAK,gBAAgB;QAAE;UACrB,IAAMC,KAAK,GAAGF,MAAM,CAACG,MAAM,GACvBJ,KAAK,CAACK,MAAM,CAACC,SAAS,CAAE,UAAAC,CAAC;YAAA,OAAKA,CAAC,CAACC,GAAG,KAAKP,MAAM,CAACG,MAAM;UAAA,EAAC,GACtDJ,KAAK,CAACG,KAAK;UAEf,IAAIA,KAAK,KAAK,CAAC,CAAC,EAAE;YAChB,OAAO,IAAI;UACb;UAEA,OAAAM,aAAA,CAAAA,aAAA,KACKT,KAAK;YACRK,MAAM,EAAEL,KAAK,CAACK,MAAM,CAACK,GAAG,CAAC,UAACH,CAAC,EAAEI,CAAC;cAAA,OAC5BA,CAAC,KAAKR,KAAK,GAAAM,aAAA,CAAAA,aAAA,KAEFF,CAAC;gBACJK,MAAM,EACJX,MAAM,CAACC,IAAI,KAAK,gBAAgB,GAC5BD,MAAM,CAACY,OAAO,CAACD,MAAM,GAAAH,aAAA,CAAAA,aAAA,KAChBF,CAAC,CAACK,MAAM,GAAKX,MAAM,CAACY,OAAO,CAACD,MAAA;cAAO,KAEhDL,CACN;YAAA;UAAA;QAEJ;MAEA,KAAK,OAAO;QAAE;UACZ,IAAMO,SAAS,GAAGb,MAAM,CAACY,OAAsC;UAE/D,IACEC,SAAS,CAACT,MAAM,CAACU,MAAM,KAAK,CAAC,IAC7BD,SAAS,CAACT,MAAM,CAACW,IAAI,CAClB,UAAAC,K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