{"ast":null,"code":"\"use strict\";\n\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nvar _excluded = [\"state\", \"screen\", \"params\", \"initial\"];\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 * as React from 'react';\nimport { EnsureSingleNavigator } from \"./EnsureSingleNavigator.js\";\nimport { NavigationFocusedRouteStateContext } from \"./NavigationFocusedRouteStateContext.js\";\nimport { NavigationStateContext } from \"./NavigationStateContext.js\";\nimport { StaticContainer } from \"./StaticContainer.js\";\nimport { useOptionsGetters } from \"./useOptionsGetters.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nexport function SceneView(_ref) {\n  var screen = _ref.screen,\n    route = _ref.route,\n    navigation = _ref.navigation,\n    routeState = _ref.routeState,\n    getState = _ref.getState,\n    setState = _ref.setState,\n    options = _ref.options,\n    clearOptions = _ref.clearOptions;\n  var navigatorKeyRef = React.useRef(undefined);\n  var getKey = React.useCallback(function () {\n    return navigatorKeyRef.current;\n  }, []);\n  var _useOptionsGetters = useOptionsGetters({\n      key: route.key,\n      options: options,\n      navigation: navigation\n    }),\n    addOptionsGetter = _useOptionsGetters.addOptionsGetter;\n  var setKey = React.useCallback(function (key) {\n    navigatorKeyRef.current = key;\n  }, []);\n  var getCurrentState = React.useCallback(function () {\n    var state = getState();\n    var currentRoute = state.routes.find(function (r) {\n      return r.key === route.key;\n    });\n    return currentRoute ? currentRoute.state : undefined;\n  }, [getState, route.key]);\n  var setCurrentState = React.useCallback(function (child) {\n    var state = getState();\n    setState(_objectSpread(_objectSpread({}, state), {}, {\n      routes: state.routes.map(function (r) {\n        if (r.key !== route.key) {\n          return r;\n        }\n        var nextRoute = _objectSpread(_objectSpread({}, r), {}, {\n          state: child\n        });\n        if (nextRoute.params && ('state' in nextRoute.params && typeof nextRoute.params.state === 'object' && nextRoute.params.state !== null || 'screen' in nextRoute.params && typeof nextRoute.params.screen === 'string')) {\n          var _nextRoute$params = nextRoute.params,\n            _state = _nextRoute$params.state,\n            _screen = _nextRoute$params.screen,\n            params = _nextRoute$params.params,\n            initial = _nextRoute$params.initial,\n            rest = _objectWithoutProperties(_nextRoute$params, _excluded);\n          if (Object.keys(rest).length) {\n            nextRoute.params = rest;\n          } else {\n            delete nextRoute.params;\n          }\n        }\n        return nextRoute;\n      })\n    }));\n  }, [getState, route.key, setState]);\n  var isInitialRef = React.useRef(true);\n  React.useEffect(function () {\n    isInitialRef.current = false;\n  });\n  React.useEffect(function () {\n    return clearOptions;\n  }, []);\n  var getIsInitial = React.useCallback(function () {\n    return isInitialRef.current;\n  }, []);\n  var parentFocusedRouteState = React.useContext(NavigationFocusedRouteStateContext);\n  var focusedRouteState = React.useMemo(function () {\n    var state = {\n      routes: [{\n        key: route.key,\n        name: route.name,\n        params: route.params,\n        path: route.path\n      }]\n    };\n    var _addState = function addState(parent) {\n      var parentRoute = parent == null ? void 0 : parent.routes[0];\n      if (parentRoute) {\n        return {\n          routes: [_objectSpread(_objectSpread({}, parentRoute), {}, {\n            state: _addState(parentRoute.state)\n          })]\n        };\n      }\n      return state;\n    };\n    return _addState(parentFocusedRouteState);\n  }, [parentFocusedRouteState, route.key, route.name, route.params, route.path]);\n  var context = React.useMemo(function () {\n    return {\n      state: routeState,\n      getState: getCurrentState,\n      setState: setCurrentState,\n      getKey: getKey,\n      setKey: setKey,\n      getIsInitial: getIsInitial,\n      addOptionsGetter: addOptionsGetter\n    };\n  }, [routeState, getCurrentState, setCurrentState, getKey, setKey, getIsInitial, addOptionsGetter]);\n  var ScreenComponent = screen.getComponent ? screen.getComponent() : screen.component;\n  return _jsx(NavigationStateContext.Provider, {\n    value: context,\n    children: _jsx(NavigationFocusedRouteStateContext.Provider, {\n      value: focusedRouteState,\n      children: _jsx(EnsureSingleNavigator, {\n        children: _jsx(StaticContainer, {\n          name: screen.name,\n          render: ScreenComponent || screen.children,\n          navigation: navigation,\n          route: route,\n          children: ScreenComponent !== undefined ? _jsx(ScreenComponent, {\n            navigation: navigation,\n            route: route\n          }) : screen.children !== undefined ? screen.children({\n            navigation: navigation,\n            route: route\n          }) : null\n        })\n      })\n    })\n  });\n}","map":{"version":3,"names":["React","EnsureSingleNavigator","NavigationFocusedRouteStateContext","NavigationStateContext","StaticContainer","useOptionsGetters","jsx","_jsx","SceneView","_ref","screen","route","navigation","routeState","getState","setState","options","clearOptions","navigatorKeyRef","useRef","undefined","getKey","useCallback","current","_useOptionsGetters","key","addOptionsGetter","setKey","getCurrentState","state","currentRoute","routes","find","r","setCurrentState","child","_objectSpread","map","nextRoute","params","_nextRoute$params","initial","rest","_objectWithoutProperties","_excluded","Object","keys","length","isInitialRef","useEffect","getIsInitial","parentFocusedRouteState","useContext","focusedRouteState","useMemo","name","path","addState","parent","parentRoute","context","ScreenComponent","getComponent","component","Provider","value","children","render"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/@react-navigation/core/src/SceneView.tsx"],"sourcesContent":["import type {\n  NavigationState,\n  ParamListBase,\n  PartialState,\n  Route,\n} from '@react-navigation/routers';\nimport * as React from 'react';\n\nimport { EnsureSingleNavigator } from './EnsureSingleNavigator';\nimport {\n  type FocusedRouteState,\n  NavigationFocusedRouteStateContext,\n} from './NavigationFocusedRouteStateContext';\nimport { NavigationStateContext } from './NavigationStateContext';\nimport { StaticContainer } from './StaticContainer';\nimport type { NavigationProp, RouteConfigComponent } from './types';\nimport { useOptionsGetters } from './useOptionsGetters';\n\ntype Props<State extends NavigationState, ScreenOptions extends {}> = {\n  screen: RouteConfigComponent<ParamListBase, string> & { name: string };\n  navigation: NavigationProp<\n    ParamListBase,\n    string,\n    string | undefined,\n    State,\n    ScreenOptions\n  >;\n  route: Route<string>;\n  routeState: NavigationState | PartialState<NavigationState> | undefined;\n  getState: () => State;\n  setState: (state: State) => void;\n  options: object;\n  clearOptions: () => void;\n};\n\n/**\n * Component which takes care of rendering the screen for a route.\n * It provides all required contexts and applies optimizations when applicable.\n */\nexport function SceneView<\n  State extends NavigationState,\n  ScreenOptions extends {},\n>({\n  screen,\n  route,\n  navigation,\n  routeState,\n  getState,\n  setState,\n  options,\n  clearOptions,\n}: Props<State, ScreenOptions>) {\n  const navigatorKeyRef = React.useRef<string | undefined>(undefined);\n  const getKey = React.useCallback(() => navigatorKeyRef.current, []);\n\n  const { addOptionsGetter } = useOptionsGetters({\n    key: route.key,\n    options,\n    navigation,\n  });\n\n  const setKey = React.useCallback((key: string) => {\n    navigatorKeyRef.current = key;\n  }, []);\n\n  const getCurrentState = React.useCallback(() => {\n    const state = getState();\n    const currentRoute = state.routes.find((r) => r.key === route.key);\n\n    return currentRoute ? currentRoute.state : undefined;\n  }, [getState, route.key]);\n\n  const setCurrentState = React.useCallback(\n    (child: NavigationState | PartialState<NavigationState> | undefined) => {\n      const state = getState();\n\n      setState({\n        ...state,\n        routes: state.routes.map((r) => {\n          if (r.key !== route.key) {\n            return r;\n          }\n\n          const nextRoute = { ...r, state: child };\n\n          // Before updating the state, cleanup any nested screen and state\n          // This will avoid the navigator trying to handle them again\n          if (\n            nextRoute.params &&\n            (('state' in nextRoute.params &&\n              typeof nextRoute.params.state === 'object' &&\n              nextRoute.params.state !== null) ||\n              ('screen' in nextRoute.params &&\n                typeof nextRoute.params.screen === 'string'))\n          ) {\n            // @ts-expect-error: we don't have correct type for params\n            // eslint-disable-next-line @typescript-eslint/no-unused-vars\n            const { state, screen, params, initial, ...rest } =\n              nextRoute.params;\n\n            if (Object.keys(rest).length) {\n              nextRoute.params = rest;\n            } else {\n              delete nextRoute.params;\n            }\n          }\n\n          return nextRoute;\n        }),\n      });\n    },\n    [getState, route.key, setState]\n  );\n\n  const isInitialRef = React.useRef(true);\n\n  React.useEffect(() => {\n    isInitialRef.current = false;\n  });\n\n  // Clear options set by this screen when it is unmounted\n  React.useEffect(() => {\n    return clearOptions;\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n\n  const getIsInitial = React.useCallback(() => isInitialRef.current, []);\n\n  const parentFocusedRouteState = React.useContext(\n    NavigationFocusedRouteStateContext\n  );\n\n  const focusedRouteState = React.useMemo(() => {\n    const state: FocusedRouteState = {\n      routes: [\n        {\n          key: route.key,\n          name: route.name,\n          params: route.params,\n          path: route.path,\n        },\n      ],\n    };\n\n    // Add our state to the innermost route of the parent state\n    const addState = (\n      parent: FocusedRouteState | undefined\n    ): FocusedRouteState => {\n      const parentRoute = parent?.routes[0];\n\n      if (parentRoute) {\n        return {\n          routes: [\n            {\n              ...parentRoute,\n              state: addState(parentRoute.state),\n            },\n          ],\n        };\n      }\n\n      return state;\n    };\n\n    return addState(parentFocusedRouteState);\n  }, [\n    parentFocusedRouteState,\n    route.key,\n    route.name,\n    route.params,\n    route.path,\n  ]);\n\n  const context = React.useMemo(\n    () => ({\n      state: routeState,\n      getState: getCurrentState,\n      setState: setCurrentState,\n      getKey,\n      setKey,\n      getIsInitial,\n      addOptionsGetter,\n    }),\n    [\n      routeState,\n      getCurrentState,\n      setCurrentState,\n      getKey,\n      setKey,\n      getIsInitial,\n      addOptionsGetter,\n    ]\n  );\n\n  const ScreenComponent = screen.getComponent\n    ? screen.getComponent()\n    : screen.component;\n\n  return (\n    <NavigationStateContext.Provider value={context}>\n      <NavigationFocusedRouteStateContext.Provider value={focusedRouteState}>\n        <EnsureSingleNavigator>\n          <StaticContainer\n            name={screen.name}\n            render={ScreenComponent || screen.children}\n            navigation={navigation}\n            route={route}\n          >\n            {ScreenComponent !== undefined ? (\n              <ScreenComponent navigation={navigation} route={route} />\n            ) : screen.children !== undefined ? (\n              screen.children({ navigation, route })\n            ) : null}\n          </StaticContainer>\n        </EnsureSingleNavigator>\n      </NavigationFocusedRouteStateContext.Provider>\n    </NavigationStateContext.Provider>\n  );\n}\n"],"mappings":";;;;;;;AAMA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,SAASC,qBAAqB;AAC9B,SAEEC,kCAAkC;AAEpC,SAASC,sBAAsB;AAC/B,SAASC,eAAe;AAExB,SAASC,iBAAiB;AAA8B,SAAAC,GAAA,IAAAC,IAAA;AAuBxD,OAAO,SAASC,SAASA,CAAAC,IAAA,EAYO;EAAA,IAR9BC,MAAM,GAAAD,IAAA,CAANC,MAAM;IACNC,KAAK,GAAAF,IAAA,CAALE,KAAK;IACLC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,UAAU,GAAAJ,IAAA,CAAVI,UAAU;IACVC,QAAQ,GAAAL,IAAA,CAARK,QAAQ;IACRC,QAAQ,GAAAN,IAAA,CAARM,QAAQ;IACRC,OAAO,GAAAP,IAAA,CAAPO,OAAO;IACPC,YAAA,GAAAR,IAAA,CAAAQ,YAAA;EAEA,IAAMC,eAAe,GAAGlB,KAAK,CAACmB,MAAM,CAAqBC,SAAS,CAAC;EACnE,IAAMC,MAAM,GAAGrB,KAAK,CAACsB,WAAW,CAAC;IAAA,OAAMJ,eAAe,CAACK,OAAO;EAAA,GAAE,EAAE,CAAC;EAEnE,IAAAC,kBAAA,GAA6BnB,iBAAiB,CAAC;MAC7CoB,GAAG,EAAEd,KAAK,CAACc,GAAG;MACdT,OAAO,EAAPA,OAAO;MACPJ,UAAA,EAAAA;IACF,CAAC,CAAC;IAJMc,gBAAA,GAAAF,kBAAA,CAAAE,gBAAA;EAMR,IAAMC,MAAM,GAAG3B,KAAK,CAACsB,WAAW,CAAE,UAAAG,GAAW,EAA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