{"ast":null,"code":"\"use strict\";\n\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/objectWithoutPropertiesLoose\";\nconst _excluded = [\"direction\", \"theme\", \"linking\", \"fallback\", \"documentTitle\", \"onReady\", \"onStateChange\"];\nimport { BaseNavigationContainer, getActionFromState, getPathFromState, getStateFromPath, ThemeProvider, validatePathConfig } from '@react-navigation/core';\nimport * as React from 'react';\nimport I18nManager from \"react-native-web/dist/exports/I18nManager\";\nimport useLatestCallback from 'use-latest-callback';\nimport { LinkingContext } from \"./LinkingContext.js\";\nimport { LocaleDirContext } from \"./LocaleDirContext.js\";\nimport { DefaultTheme } from \"./theming/DefaultTheme.js\";\nimport { UnhandledLinkingContext } from \"./UnhandledLinkingContext.js\";\nimport { useBackButton } from \"./useBackButton\";\nimport { useDocumentTitle } from \"./useDocumentTitle\";\nimport { useLinking } from \"./useLinking\";\nimport { useThenable } from \"./useThenable.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nglobalThis.REACT_NAVIGATION_DEVTOOLS = new WeakMap();\nfunction NavigationContainerInner(_ref, ref) {\n  let {\n      direction = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr',\n      theme = DefaultTheme,\n      linking,\n      fallback = null,\n      documentTitle,\n      onReady,\n      onStateChange\n    } = _ref,\n    rest = _objectWithoutPropertiesLoose(_ref, _excluded);\n  const isLinkingEnabled = linking ? linking.enabled !== false : false;\n  if (linking?.config) {\n    validatePathConfig(linking.config);\n  }\n  const refContainer = React.useRef(null);\n  useBackButton(refContainer);\n  useDocumentTitle(refContainer, documentTitle);\n  const [lastUnhandledLink, setLastUnhandledLink] = React.useState();\n  const {\n    getInitialState\n  } = useLinking(refContainer, Object.assign({\n    enabled: isLinkingEnabled,\n    prefixes: []\n  }, linking), setLastUnhandledLink);\n  const linkingContext = React.useMemo(() => ({\n    options: linking\n  }), [linking]);\n  const unhandledLinkingContext = React.useMemo(() => ({\n    lastUnhandledLink,\n    setLastUnhandledLink\n  }), [lastUnhandledLink, setLastUnhandledLink]);\n  const onReadyForLinkingHandling = useLatestCallback(() => {\n    const path = refContainer.current?.getCurrentRoute()?.path;\n    setLastUnhandledLink(previousLastUnhandledLink => {\n      if (previousLastUnhandledLink === path) {\n        return undefined;\n      }\n      return previousLastUnhandledLink;\n    });\n    onReady?.();\n  });\n  const onStateChangeForLinkingHandling = useLatestCallback(state => {\n    const path = refContainer.current?.getCurrentRoute()?.path;\n    setLastUnhandledLink(previousLastUnhandledLink => {\n      if (previousLastUnhandledLink === path) {\n        return undefined;\n      }\n      return previousLastUnhandledLink;\n    });\n    onStateChange?.(state);\n  });\n  React.useEffect(() => {\n    if (refContainer.current) {\n      REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {\n        get linking() {\n          return Object.assign({}, linking, {\n            enabled: isLinkingEnabled,\n            prefixes: linking?.prefixes ?? [],\n            getStateFromPath: linking?.getStateFromPath ?? getStateFromPath,\n            getPathFromState: linking?.getPathFromState ?? getPathFromState,\n            getActionFromState: linking?.getActionFromState ?? getActionFromState\n          });\n        }\n      });\n    }\n  });\n  const [isResolved, initialState] = useThenable(getInitialState);\n  React.useImperativeHandle(ref, () => refContainer.current);\n  const isLinkingReady = rest.initialState != null || !isLinkingEnabled || isResolved;\n  if (!isLinkingReady) {\n    return _jsx(LocaleDirContext.Provider, {\n      value: direction,\n      children: _jsx(ThemeProvider, {\n        value: theme,\n        children: fallback\n      })\n    });\n  }\n  return _jsx(LocaleDirContext.Provider, {\n    value: direction,\n    children: _jsx(UnhandledLinkingContext.Provider, {\n      value: unhandledLinkingContext,\n      children: _jsx(LinkingContext.Provider, {\n        value: linkingContext,\n        children: _jsx(BaseNavigationContainer, Object.assign({}, rest, {\n          theme: theme,\n          onReady: onReadyForLinkingHandling,\n          onStateChange: onStateChangeForLinkingHandling,\n          initialState: rest.initialState == null ? initialState : rest.initialState,\n          ref: refContainer\n        }))\n      })\n    })\n  });\n}\nexport const NavigationContainer = React.forwardRef(NavigationContainerInner);","map":{"version":3,"names":["BaseNavigationContainer","getActionFromState","getPathFromState","getStateFromPath","ThemeProvider","validatePathConfig","React","I18nManager","useLatestCallback","LinkingContext","LocaleDirContext","DefaultTheme","UnhandledLinkingContext","useBackButton","useDocumentTitle","useLinking","useThenable","jsx","_jsx","globalThis","REACT_NAVIGATION_DEVTOOLS","WeakMap","NavigationContainerInner","_ref","ref","direction","getConstants","isRTL","theme","linking","fallback","documentTitle","onReady","onStateChange","rest","_objectWithoutPropertiesLoose","_excluded","isLinkingEnabled","enabled","config","refContainer","useRef","lastUnhandledLink","setLastUnhandledLink","useState","getInitialState","Object","assign","prefixes","linkingContext","useMemo","options","unhandledLinkingContext","onReadyForLinkingHandling","path","current","getCurrentRoute","previousLastUnhandledLink","undefined","onStateChangeForLinkingHandling","state","useEffect","set","isResolved","initialState","useImperativeHandle","isLinkingReady","Provider","value","children","NavigationContainer","forwardRef"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/@react-navigation/native/src/NavigationContainer.tsx"],"sourcesContent":["import {\n  BaseNavigationContainer,\n  getActionFromState,\n  getPathFromState,\n  getStateFromPath,\n  type NavigationContainerProps,\n  type NavigationContainerRef,\n  type NavigationState,\n  type ParamListBase,\n  ThemeProvider,\n  validatePathConfig,\n} from '@react-navigation/core';\nimport * as React from 'react';\nimport { I18nManager } from 'react-native';\nimport useLatestCallback from 'use-latest-callback';\n\nimport { LinkingContext } from './LinkingContext';\nimport { LocaleDirContext } from './LocaleDirContext';\nimport { DefaultTheme } from './theming/DefaultTheme';\nimport type {\n  DocumentTitleOptions,\n  LinkingOptions,\n  LocaleDirection,\n} from './types';\nimport { UnhandledLinkingContext } from './UnhandledLinkingContext';\nimport { useBackButton } from './useBackButton';\nimport { useDocumentTitle } from './useDocumentTitle';\nimport { useLinking } from './useLinking';\nimport { useThenable } from './useThenable';\n\ndeclare global {\n  var REACT_NAVIGATION_DEVTOOLS: WeakMap<\n    NavigationContainerRef<any>,\n    { readonly linking: LinkingOptions<any> }\n  >;\n}\n\nglobalThis.REACT_NAVIGATION_DEVTOOLS = new WeakMap();\n\ntype Props<ParamList extends {}> = NavigationContainerProps & {\n  direction?: LocaleDirection;\n  linking?: LinkingOptions<ParamList>;\n  fallback?: React.ReactNode;\n  documentTitle?: DocumentTitleOptions;\n};\n\n/**\n * Container component which holds the navigation state designed for React Native apps.\n * This should be rendered at the root wrapping the whole app.\n *\n * @param props.initialState Initial state object for the navigation tree. When deep link handling is enabled, this will override deep links when specified. Make sure that you don't specify an `initialState` when there's a deep link (`Linking.getInitialURL()`).\n * @param props.onReady Callback which is called after the navigation tree mounts.\n * @param props.onStateChange Callback which is called with the latest navigation state when it changes.\n * @param props.onUnhandledAction Callback which is called when an action is not handled.\n * @param props.direction Text direction of the components. Defaults to `'ltr'`.\n * @param props.theme Theme object for the UI elements.\n * @param props.linking Options for deep linking. Deep link handling is enabled when this prop is provided, unless `linking.enabled` is `false`.\n * @param props.fallback Fallback component to render until we have finished getting initial state when linking is enabled. Defaults to `null`.\n * @param props.documentTitle Options to configure the document title on Web. Updating document title is handled by default unless `documentTitle.enabled` is `false`.\n * @param props.children Child elements to render the content.\n * @param props.ref Ref object which refers to the navigation object containing helper methods.\n */\nfunction NavigationContainerInner(\n  {\n    direction = I18nManager.getConstants().isRTL ? 'rtl' : 'ltr',\n    theme = DefaultTheme,\n    linking,\n    fallback = null,\n    documentTitle,\n    onReady,\n    onStateChange,\n    ...rest\n  }: Props<ParamListBase>,\n  ref?: React.Ref<NavigationContainerRef<ParamListBase> | null>\n) {\n  const isLinkingEnabled = linking ? linking.enabled !== false : false;\n\n  if (linking?.config) {\n    validatePathConfig(linking.config);\n  }\n\n  const refContainer =\n    React.useRef<NavigationContainerRef<ParamListBase>>(null);\n\n  useBackButton(refContainer);\n  useDocumentTitle(refContainer, documentTitle);\n\n  const [lastUnhandledLink, setLastUnhandledLink] = React.useState<\n    string | undefined\n  >();\n\n  const { getInitialState } = useLinking(\n    refContainer,\n    {\n      enabled: isLinkingEnabled,\n      prefixes: [],\n      ...linking,\n    },\n    setLastUnhandledLink\n  );\n\n  const linkingContext = React.useMemo(() => ({ options: linking }), [linking]);\n\n  const unhandledLinkingContext = React.useMemo(\n    () => ({ lastUnhandledLink, setLastUnhandledLink }),\n    [lastUnhandledLink, setLastUnhandledLink]\n  );\n\n  const onReadyForLinkingHandling = useLatestCallback(() => {\n    // If the screen path matches lastUnhandledLink, we do not track it\n    const path = refContainer.current?.getCurrentRoute()?.path;\n    setLastUnhandledLink((previousLastUnhandledLink) => {\n      if (previousLastUnhandledLink === path) {\n        return undefined;\n      }\n      return previousLastUnhandledLink;\n    });\n    onReady?.();\n  });\n\n  const onStateChangeForLinkingHandling = useLatestCallback(\n    (state: Readonly<NavigationState> | undefined) => {\n      // If the screen path matches lastUnhandledLink, we do not track it\n      const path = refContainer.current?.getCurrentRoute()?.path;\n      setLastUnhandledLink((previousLastUnhandledLink) => {\n        if (previousLastUnhandledLink === path) {\n          return undefined;\n        }\n        return previousLastUnhandledLink;\n      });\n      onStateChange?.(state);\n    }\n  );\n  // Add additional linking related info to the ref\n  // This will be used by the devtools\n  React.useEffect(() => {\n    if (refContainer.current) {\n      REACT_NAVIGATION_DEVTOOLS.set(refContainer.current, {\n        get linking() {\n          return {\n            ...linking,\n            enabled: isLinkingEnabled,\n            prefixes: linking?.prefixes ?? [],\n            getStateFromPath: linking?.getStateFromPath ?? getStateFromPath,\n            getPathFromState: linking?.getPathFromState ?? getPathFromState,\n            getActionFromState:\n              linking?.getActionFromState ?? getActionFromState,\n          };\n        },\n      });\n    }\n  });\n\n  const [isResolved, initialState] = useThenable(getInitialState);\n\n  // FIXME\n  // @ts-expect-error not sure why this is not working\n  React.useImperativeHandle(ref, () => refContainer.current);\n\n  const isLinkingReady =\n    rest.initialState != null || !isLinkingEnabled || isResolved;\n\n  if (!isLinkingReady) {\n    return (\n      <LocaleDirContext.Provider value={direction}>\n        <ThemeProvider value={theme}>{fallback}</ThemeProvider>\n      </LocaleDirContext.Provider>\n    );\n  }\n\n  return (\n    <LocaleDirContext.Provider value={direction}>\n      <UnhandledLinkingContext.Provider value={unhandledLinkingContext}>\n        <LinkingContext.Provider value={linkingContext}>\n          <BaseNavigationContainer\n            {...rest}\n            theme={theme}\n            onReady={onReadyForLinkingHandling}\n            onStateChange={onStateChangeForLinkingHandling}\n            initialState={\n              rest.initialState == null ? initialState : rest.initialState\n            }\n            ref={refContainer}\n          />\n        </LinkingContext.Provider>\n      </UnhandledLinkingContext.Provider>\n    </LocaleDirContext.Provider>\n  );\n}\n\nexport const NavigationContainer = React.forwardRef(\n  NavigationContainerInner\n) as <RootParamList extends {} = ReactNavigation.RootParamList>(\n  props: Props<RootParamList> & {\n    ref?: React.Ref<NavigationContainerRef<RootParamList>>;\n  }\n) => React.ReactElement;\n"],"mappings":";;;;AAAA,SACEA,uBAAuB,EACvBC,kBAAkB,EAClBC,gBAAgB,EAChBC,gBAAgB,EAKhBC,aAAa,EACbC,kBAAkB,QACb,wBAAwB;AAC/B,OAAO,KAAKC,KAAK,MAAM,OAAO;AAAA,OAAAC,WAAA;AAE9B,OAAOC,iBAAiB,MAAM,qBAAqB;AAEnD,SAASC,cAAc;AACvB,SAASC,gBAAgB;AACzB,SAASC,YAAY;AAMrB,SAASC,uBAAuB;AAChC,SAASC,aAAa;AACtB,SAASC,gBAAgB;AACzB,SAASC,UAAU;AACnB,SAASC,WAAW;AAAwB,SAAAC,GAAA,IAAAC,IAAA;AAS5CC,UAAU,CAACC,yBAAyB,GAAG,IAAIC,OAAO,CAAC,CAAC;AAyBpD,SAASC,wBAAwBA,CAAAC,IAAA,EAW/BC,GAA6D,EAC7D;EAAA,IAXA;MACEC,SAAS,GAAGlB,WAAW,CAACmB,YAAY,CAAC,CAAC,CAACC,KAAK,GAAG,KAAK,GAAG,KAAK;MAC5DC,KAAK,GAAGjB,YAAY;MACpBkB,OAAO;MACPC,QAAQ,GAAG,IAAI;MACfC,aAAa;MACbC,OAAO;MACPC;IAEoB,CAAC,G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