{"ast":null,"code":"\"use strict\";\n\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nconst _excluded = [\"state\", \"screen\", \"params\", \"initial\"];\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({\n  screen,\n  route,\n  navigation,\n  routeState,\n  getState,\n  setState,\n  options,\n  clearOptions\n}) {\n  const navigatorKeyRef = React.useRef(undefined);\n  const getKey = React.useCallback(() => navigatorKeyRef.current, []);\n  const {\n    addOptionsGetter\n  } = useOptionsGetters({\n    key: route.key,\n    options,\n    navigation\n  });\n  const setKey = React.useCallback(key => {\n    navigatorKeyRef.current = key;\n  }, []);\n  const getCurrentState = React.useCallback(() => {\n    const state = getState();\n    const currentRoute = state.routes.find(r => r.key === route.key);\n    return currentRoute ? currentRoute.state : undefined;\n  }, [getState, route.key]);\n  const setCurrentState = React.useCallback(child => {\n    const state = getState();\n    setState(Object.assign({}, state, {\n      routes: state.routes.map(r => {\n        if (r.key !== route.key) {\n          return r;\n        }\n        const nextRoute = Object.assign({}, 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          const _nextRoute$params = nextRoute.params,\n            rest = _objectWithoutPropertiesLoose(_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  const isInitialRef = React.useRef(true);\n  React.useEffect(() => {\n    isInitialRef.current = false;\n  });\n  React.useEffect(() => {\n    return clearOptions;\n  }, []);\n  const getIsInitial = React.useCallback(() => isInitialRef.current, []);\n  const parentFocusedRouteState = React.useContext(NavigationFocusedRouteStateContext);\n  const focusedRouteState = React.useMemo(() => {\n    const state = {\n      routes: [{\n        key: route.key,\n        name: route.name,\n        params: route.params,\n        path: route.path\n      }]\n    };\n    const addState = parent => {\n      const parentRoute = parent?.routes[0];\n      if (parentRoute) {\n        return {\n          routes: [Object.assign({}, 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  const context = React.useMemo(() => ({\n    state: routeState,\n    getState: getCurrentState,\n    setState: setCurrentState,\n    getKey,\n    setKey,\n    getIsInitial,\n    addOptionsGetter\n  }), [routeState, getCurrentState, setCurrentState, getKey, setKey, getIsInitial, addOptionsGetter]);\n  const 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,\n            route\n          }) : null\n        })\n      })\n    })\n  });\n}","map":{"version":3,"names":["React","EnsureSingleNavigator","NavigationFocusedRouteStateContext","NavigationStateContext","StaticContainer","useOptionsGetters","jsx","_jsx","SceneView","screen","route","navigation","routeState","getState","setState","options","clearOptions","navigatorKeyRef","useRef","undefined","getKey","useCallback","current","addOptionsGetter","key","setKey","getCurrentState","state","currentRoute","routes","find","r","setCurrentState","child","Object","assign","map","nextRoute","params","_nextRoute$params","rest","_objectWithoutPropertiesLoose","_excluded","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,CAGvB;EACAC,MAAM;EACNC,KAAK;EACLC,UAAU;EACVC,UAAU;EACVC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACPC;AAC2B,CAAC,EAAE;EAC9B,MAAMC,eAAe,GAAGjB,KAAK,CAACkB,MAAM,CAAqBC,SAAS,CAAC;EACnE,MAAMC,MAAM,GAAGpB,KAAK,CAACqB,WAAW,CAAC,MAAMJ,eAAe,CAACK,OAAO,EAAE,EAAE,CAAC;EAEnE,MAAM;IAAEC;EAAiB,CAAC,GAAGlB,iBAAiB,CAAC;IAC7Cm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