UNPKG

repoweaver

Version:

A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies

1 lines 69.6 kB
{"ast":null,"code":"\"use strict\";\n\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nimport _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nvar _excluded = [\"children\", \"layout\", \"screenOptions\", \"screenLayout\", \"screenListeners\", \"UNSTABLE_router\"];\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 { CommonActions } from '@react-navigation/routers';\nimport * as React from 'react';\nimport { isValidElementType } from 'react-is';\nimport useLatestCallback from 'use-latest-callback';\nimport { deepFreeze } from \"./deepFreeze.js\";\nimport { Group } from \"./Group.js\";\nimport { isArrayEqual } from \"./isArrayEqual.js\";\nimport { isRecordEqual } from \"./isRecordEqual.js\";\nimport { NavigationHelpersContext } from \"./NavigationHelpersContext.js\";\nimport { NavigationRouteContext } from \"./NavigationRouteContext.js\";\nimport { NavigationStateContext } from \"./NavigationStateContext.js\";\nimport { PreventRemoveProvider } from \"./PreventRemoveProvider.js\";\nimport { Screen } from \"./Screen.js\";\nimport { PrivateValueStore } from \"./types.js\";\nimport { useChildListeners } from \"./useChildListeners.js\";\nimport { useClientLayoutEffect } from \"./useClientLayoutEffect.js\";\nimport { useComponent } from \"./useComponent.js\";\nimport { useCurrentRender } from \"./useCurrentRender.js\";\nimport { useDescriptors } from \"./useDescriptors.js\";\nimport { useEventEmitter } from \"./useEventEmitter.js\";\nimport { useFocusedListenersChildrenAdapter } from \"./useFocusedListenersChildrenAdapter.js\";\nimport { useFocusEvents } from \"./useFocusEvents.js\";\nimport { useKeyedChildListeners } from \"./useKeyedChildListeners.js\";\nimport { useLazyValue } from \"./useLazyValue.js\";\nimport { useNavigationHelpers } from \"./useNavigationHelpers.js\";\nimport { NavigationStateListenerProvider } from \"./useNavigationState.js\";\nimport { useOnAction } from \"./useOnAction.js\";\nimport { useOnGetState } from \"./useOnGetState.js\";\nimport { useOnRouteFocus } from \"./useOnRouteFocus.js\";\nimport { useRegisterNavigator } from \"./useRegisterNavigator.js\";\nimport { useScheduleUpdate } from \"./useScheduleUpdate.js\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nPrivateValueStore;\nvar isScreen = function isScreen(child) {\n  return child.type === Screen;\n};\nvar isGroup = function isGroup(child) {\n  return child.type === React.Fragment || child.type === Group;\n};\nvar isValidKey = function isValidKey(key) {\n  return key === undefined || typeof key === 'string' && key !== '';\n};\nvar _getRouteConfigsFromChildren = function getRouteConfigsFromChildren(children, groupKey, groupOptions, groupLayout) {\n  var configs = React.Children.toArray(children).reduce(function (acc, child) {\n    var _child$type, _child$props;\n    if (React.isValidElement(child)) {\n      if (isScreen(child)) {\n        if (typeof child.props !== 'object' || child.props === null) {\n          throw new Error(`Got an invalid element for screen.`);\n        }\n        if (typeof child.props.name !== 'string' || child.props.name === '') {\n          throw new Error(`Got an invalid name (${JSON.stringify(child.props.name)}) for the screen. It must be a non-empty string.`);\n        }\n        if (child.props.navigationKey !== undefined && (typeof child.props.navigationKey !== 'string' || child.props.navigationKey === '')) {\n          throw new Error(`Got an invalid 'navigationKey' prop (${JSON.stringify(child.props.navigationKey)}) for the screen '${child.props.name}'. It must be a non-empty string or 'undefined'.`);\n        }\n        acc.push({\n          keys: [groupKey, child.props.navigationKey],\n          options: groupOptions,\n          layout: groupLayout,\n          props: child.props\n        });\n        return acc;\n      }\n      if (isGroup(child)) {\n        if (!isValidKey(child.props.navigationKey)) {\n          throw new Error(`Got an invalid 'navigationKey' prop (${JSON.stringify(child.props.navigationKey)}) for the group. It must be a non-empty string or 'undefined'.`);\n        }\n        acc.push.apply(acc, _toConsumableArray(_getRouteConfigsFromChildren(child.props.children, child.props.navigationKey, child.type !== Group ? groupOptions : groupOptions != null ? [].concat(_toConsumableArray(groupOptions), [child.props.screenOptions]) : [child.props.screenOptions], typeof child.props.screenLayout === 'function' ? child.props.screenLayout : groupLayout)));\n        return acc;\n      }\n    }\n    throw new Error(`A navigator can only contain 'Screen', 'Group' or 'React.Fragment' as its direct children (found ${React.isValidElement(child) ? `'${typeof child.type === 'string' ? child.type : (_child$type = child.type) == null ? void 0 : _child$type.name}'${child.props != null && typeof child.props === 'object' && 'name' in child.props && (_child$props = child.props) != null && _child$props.name ? ` for the screen '${child.props.name}'` : ''}` : typeof child === 'object' ? JSON.stringify(child) : `'${String(child)}'`}). To render this component in the navigator, pass it in the 'component' prop to 'Screen'.`);\n  }, []);\n  if (process.env.NODE_ENV !== 'production') {\n    configs.forEach(function (config) {\n      var _config$props = config.props,\n        name = _config$props.name,\n        children = _config$props.children,\n        component = _config$props.component,\n        getComponent = _config$props.getComponent;\n      if (children != null || component !== undefined || getComponent !== undefined) {\n        if (children != null && component !== undefined) {\n          throw new Error(`Got both 'component' and 'children' props for the screen '${name}'. You must pass only one of them.`);\n        }\n        if (children != null && getComponent !== undefined) {\n          throw new Error(`Got both 'getComponent' and 'children' props for the screen '${name}'. You must pass only one of them.`);\n        }\n        if (component !== undefined && getComponent !== undefined) {\n          throw new Error(`Got both 'component' and 'getComponent' props for the screen '${name}'. You must pass only one of them.`);\n        }\n        if (children != null && typeof children !== 'function') {\n          throw new Error(`Got an invalid value for 'children' prop for the screen '${name}'. It must be a function returning a React Element.`);\n        }\n        if (component !== undefined && !isValidElementType(component)) {\n          throw new Error(`Got an invalid value for 'component' prop for the screen '${name}'. It must be a valid React Component.`);\n        }\n        if (getComponent !== undefined && typeof getComponent !== 'function') {\n          throw new Error(`Got an invalid value for 'getComponent' prop for the screen '${name}'. It must be a function returning a React Component.`);\n        }\n        if (typeof component === 'function') {\n          if (component.name === 'component') {\n            console.warn(`Looks like you're passing an inline function for 'component' prop for the screen '${name}' (e.g. component={() => <SomeComponent />}). Passing an inline function will cause the component state to be lost on re-render and cause perf issues since it's re-created every render. You can pass the function as children to 'Screen' instead to achieve the desired behaviour.`);\n          } else if (/^[a-z]/.test(component.name)) {\n            console.warn(`Got a component with the name '${component.name}' for the screen '${name}'. React Components must start with an uppercase letter. If you're passing a regular function and not a component, pass it as children to 'Screen' instead. Otherwise capitalize your component's name.`);\n          }\n        }\n      } else {\n        throw new Error(`Couldn't find a 'component', 'getComponent' or 'children' prop for the screen '${name}'. This can happen if you passed 'undefined'. You likely forgot to export your component from the file it's defined in, or mixed up default import and named import when importing.`);\n      }\n    });\n  }\n  return configs;\n};\nexport function useNavigationBuilder(createRouter, options) {\n  var navigatorKey = useRegisterNavigator();\n  var route = React.useContext(NavigationRouteContext);\n  var children = options.children,\n    layout = options.layout,\n    screenOptions = options.screenOptions,\n    screenLayout = options.screenLayout,\n    screenListeners = options.screenListeners,\n    UNSTABLE_router = options.UNSTABLE_router,\n    rest = _objectWithoutProperties(options, _excluded);\n  var routeConfigs = _getRouteConfigsFromChildren(children);\n  var router = useLazyValue(function () {\n    if (rest.initialRouteName != null && routeConfigs.every(function (config) {\n      return config.props.name !== rest.initialRouteName;\n    })) {\n      throw new Error(`Couldn't find a screen named '${rest.initialRouteName}' to use as 'initialRouteName'.`);\n    }\n    var original = createRouter(rest);\n    if (UNSTABLE_router != null) {\n      var overrides = UNSTABLE_router(original);\n      return _objectSpread(_objectSpread({}, original), overrides);\n    }\n    return original;\n  });\n  var screens = routeConfigs.reduce(function (acc, config) {\n    if (config.props.name in acc) {\n      throw new Error(`A navigator cannot contain multiple 'Screen' components with the same name (found duplicate screen named '${config.props.name}')`);\n    }\n    acc[config.props.name] = config;\n    return acc;\n  }, {});\n  var routeNames = routeConfigs.map(function (config) {\n    return config.props.name;\n  });\n  var routeKeyList = routeNames.reduce(function (acc, curr) {\n    acc[curr] = screens[curr].keys.map(function (key) {\n      return key != null ? key : '';\n    }).join(':');\n    return acc;\n  }, {});\n  var routeParamList = routeNames.reduce(function (acc, curr) {\n    var initialParams = screens[curr].props.initialParams;\n    acc[curr] = initialParams;\n    return acc;\n  }, {});\n  var routeGetIdList = routeNames.reduce(function (acc, curr) {\n    return Object.assign(acc, _defineProperty({}, curr, screens[curr].props.getId));\n  }, {});\n  if (!routeNames.length) {\n    throw new Error(\"Couldn't find any screens for the navigator. Have you defined any screens as its children?\");\n  }\n  var isStateValid = React.useCallback(function (state) {\n    return state.type === undefined || state.type === router.type;\n  }, [router.type]);\n  var isStateInitialized = React.useCallback(function (state) {\n    return state !== undefined && state.stale === false && isStateValid(state);\n  }, [isStateValid]);\n  var _React$useContext = React.useContext(NavigationStateContext),\n    currentState = _React$useContext.state,\n    getCurrentState = _React$useContext.getState,\n    setCurrentState = _React$useContext.setState,\n    setKey = _React$useContext.setKey,\n    getKey = _React$useContext.getKey,\n    getIsInitial = _React$useContext.getIsInitial;\n  var stateCleanedUp = React.useRef(false);\n  var setState = useLatestCallback(function (state) {\n    if (stateCleanedUp.current) {\n      return;\n    }\n    setCurrentState(state);\n  });\n  var _React$useMemo = React.useMemo(function () {\n      var _route$params4, _route$params5, _route$params6;\n      var initialRouteParamList = routeNames.reduce(function (acc, curr) {\n        var _route$params, _route$params2, _route$params3;\n        var initialParams = screens[curr].props.initialParams;\n        var initialParamsFromParams = (route == null ? void 0 : (_route$params = route.params) == null ? void 0 : _route$params.state) == null && (route == null ? void 0 : (_route$params2 = route.params) == null ? void 0 : _route$params2.initial) !== false && (route == null ? void 0 : (_route$params3 = route.params) == null ? void 0 : _route$params3.screen) === curr ? route.params.params : undefined;\n        acc[curr] = initialParams !== undefined || initialParamsFromParams !== undefined ? _objectSpread(_objectSpread({}, initialParams), initialParamsFromParams) : undefined;\n        return acc;\n      }, {});\n      if ((currentState === undefined || !isStateValid(currentState)) && (route == null ? void 0 : (_route$params4 = route.params) == null ? void 0 : _route$params4.state) == null && !(typeof (route == null ? void 0 : (_route$params5 = route.params) == null ? void 0 : _route$params5.screen) === 'string' && (route == null ? void 0 : (_route$params6 = route.params) == null ? void 0 : _route$params6.initial) !== false)) {\n        return [router.getInitialState({\n          routeNames: routeNames,\n          routeParamList: initialRouteParamList,\n          routeGetIdList: routeGetIdList\n        }), true];\n      } else {\n        var _route$params7, _route$params8, _route$params9, _stateFromParams;\n        var stateFromParams;\n        if ((route == null ? void 0 : (_route$params7 = route.params) == null ? void 0 : _route$params7.state) != null) {\n          stateFromParams = route.params.state;\n        } else if (typeof (route == null ? void 0 : (_route$params8 = route.params) == null ? void 0 : _route$params8.screen) === 'string' && (route == null ? void 0 : (_route$params9 = route.params) == null ? void 0 : _route$params9.initial) !== false) {\n          stateFromParams = {\n            index: 0,\n            routes: [{\n              name: route.params.screen,\n              params: route.params.params,\n              path: route.params.path\n            }]\n          };\n        }\n        return [router.getRehydratedState((_stateFromParams = stateFromParams) != null ? _stateFromParams : currentState, {\n          routeNames: routeNames,\n          routeParamList: initialRouteParamList,\n          routeGetIdList: routeGetIdList\n        }), false];\n      }\n    }, [currentState, router, isStateValid]),\n    _React$useMemo2 = _slicedToArray(_React$useMemo, 2),\n    initializedState = _React$useMemo2[0],\n    isFirstStateInitialization = _React$useMemo2[1];\n  var previousRouteKeyListRef = React.useRef(routeKeyList);\n  React.useEffect(function () {\n    previousRouteKeyListRef.current = routeKeyList;\n  });\n  var previousRouteKeyList = previousRouteKeyListRef.current;\n  var state = isStateInitialized(currentState) ? currentState : initializedState;\n  var nextState = state;\n  if (!isArrayEqual(state.routeNames, routeNames) || !isRecordEqual(routeKeyList, previousRouteKeyList)) {\n    nextState = router.getStateForRouteNamesChange(state, {\n      routeNames: routeNames,\n      routeParamList: routeParamList,\n      routeGetIdList: routeGetIdList,\n      routeKeyChanges: Object.keys(routeKeyList).filter(function (name) {\n        return name in previousRouteKeyList && routeKeyList[name] !== previousRouteKeyList[name];\n      })\n    });\n  }\n  var previousNestedParamsRef = React.useRef(route == null ? void 0 : route.params);\n  React.useEffect(function () {\n    previousNestedParamsRef.current = route == null ? void 0 : route.params;\n  }, [route == null ? void 0 : route.params]);\n  if (route != null && route.params) {\n    var previousParams = previousNestedParamsRef.current;\n    var action;\n    if (typeof route.params.state === 'object' && route.params.state != null && route.params !== previousParams) {\n      action = CommonActions.reset(route.params.state);\n    } else if (typeof route.params.screen === 'string' && (route.params.initial === false && isFirstStateInitialization || route.params !== previousParams)) {\n      action = CommonActions.navigate({\n        name: route.params.screen,\n        params: route.params.params,\n        path: route.params.path,\n        merge: route.params.merge,\n        pop: route.params.pop\n      });\n    }\n    var updatedState = action ? router.getStateForAction(nextState, action, {\n      routeNames: routeNames,\n      routeParamList: routeParamList,\n      routeGetIdList: routeGetIdList\n    }) : null;\n    nextState = updatedState !== null ? router.getRehydratedState(updatedState, {\n      routeNames: routeNames,\n      routeParamList: routeParamList,\n      routeGetIdList: routeGetIdList\n    }) : nextState;\n  }\n  var shouldUpdate = state !== nextState;\n  useScheduleUpdate(function () {\n    if (shouldUpdate) {\n      setState(nextState);\n    }\n  });\n  state = nextState;\n  React.useEffect(function () {\n    stateCleanedUp.current = false;\n    setKey(navigatorKey);\n    if (!getIsInitial()) {\n      setState(nextState);\n    }\n    return function () {\n      if (getCurrentState() !== undefined && getKey() === navigatorKey) {\n        setCurrentState(undefined);\n        stateCleanedUp.current = true;\n      }\n    };\n  }, []);\n  var stateRef = React.useRef(state);\n  stateRef.current = state;\n  useClientLayoutEffect(function () {\n    stateRef.current = null;\n  });\n  var getState = useLatestCallback(function () {\n    var currentState = getCurrentState();\n    return deepFreeze(isStateInitialized(currentState) ? currentState : initializedState);\n  });\n  var emitter = useEventEmitter(function (e) {\n    var _ref;\n    var routeNames = [];\n    var route;\n    if (e.target) {\n      var _route;\n      route = state.routes.find(function (route) {\n        return route.key === e.target;\n      });\n      if ((_route = route) != null && _route.name) {\n        routeNames.push(route.name);\n      }\n    } else {\n      route = state.routes[state.index];\n      routeNames.push.apply(routeNames, _toConsumableArray(Object.keys(screens).filter(function (name) {\n        var _route2;\n        return ((_route2 = route) == null ? void 0 : _route2.name) === name;\n      })));\n    }\n    if (route == null) {\n      return;\n    }\n    var navigation = descriptors[route.key].navigation;\n    var listeners = (_ref = []).concat.apply(_ref, _toConsumableArray([screenListeners].concat(_toConsumableArray(routeNames.map(function (name) {\n      var listeners = screens[name].props.listeners;\n      return listeners;\n    }))).map(function (listeners) {\n      var map = typeof listeners === 'function' ? listeners({\n        route: route,\n        navigation: navigation\n      }) : listeners;\n      return map ? Object.keys(map).filter(function (type) {\n        return type === e.type;\n      }).map(function (type) {\n        return map == null ? void 0 : map[type];\n      }) : undefined;\n    }))).filter(function (cb, i, self) {\n      return cb && self.lastIndexOf(cb) === i;\n    });\n    listeners.forEach(function (listener) {\n      return listener == null ? void 0 : listener(e);\n    });\n  });\n  useFocusEvents({\n    state: state,\n    emitter: emitter\n  });\n  React.useEffect(function () {\n    emitter.emit({\n      type: 'state',\n      data: {\n        state: state\n      }\n    });\n  }, [emitter, state]);\n  var _useChildListeners = useChildListeners(),\n    childListeners = _useChildListeners.listeners,\n    addListener = _useChildListeners.addListener;\n  var _useKeyedChildListene = useKeyedChildListeners(),\n    keyedListeners = _useKeyedChildListene.keyedListeners,\n    addKeyedListener = _useKeyedChildListene.addKeyedListener;\n  var onAction = useOnAction({\n    router: router,\n    getState: getState,\n    setState: setState,\n    key: route == null ? void 0 : route.key,\n    actionListeners: childListeners.action,\n    beforeRemoveListeners: keyedListeners.beforeRemove,\n    routerConfigOptions: {\n      routeNames: routeNames,\n      routeParamList: routeParamList,\n      routeGetIdList: routeGetIdList\n    },\n    emitter: emitter\n  });\n  var onRouteFocus = useOnRouteFocus({\n    router: router,\n    key: route == null ? void 0 : route.key,\n    getState: getState,\n    setState: setState\n  });\n  var navigation = useNavigationHelpers({\n    id: options.id,\n    onAction: onAction,\n    getState: getState,\n    emitter: emitter,\n    router: router,\n    stateRef: stateRef\n  });\n  useFocusedListenersChildrenAdapter({\n    navigation: navigation,\n    focusedListeners: childListeners.focus\n  });\n  useOnGetState({\n    getState: getState,\n    getStateListeners: keyedListeners.getState\n  });\n  var _useDescriptors = useDescriptors({\n      state: state,\n      screens: screens,\n      navigation: navigation,\n      screenOptions: screenOptions,\n      screenLayout: screenLayout,\n      onAction: onAction,\n      getState: getState,\n      setState: setState,\n      onRouteFocus: onRouteFocus,\n      addListener: addListener,\n      addKeyedListener: addKeyedListener,\n      router: router,\n      emitter: emitter\n    }),\n    describe = _useDescriptors.describe,\n    descriptors = _useDescriptors.descriptors;\n  useCurrentRender({\n    state: state,\n    navigation: navigation,\n    descriptors: descriptors\n  });\n  var NavigationContent = useComponent(function (children) {\n    var element = layout != null ? layout({\n      state: state,\n      descriptors: descriptors,\n      navigation: navigation,\n      children: children\n    }) : children;\n    return _jsx(NavigationHelpersContext.Provider, {\n      value: navigation,\n      children: _jsx(NavigationStateListenerProvider, {\n        state: state,\n        children: _jsx(PreventRemoveProvider, {\n          children: element\n        })\n      })\n    });\n  });\n  return {\n    state: state,\n    navigation: navigation,\n    describe: describe,\n    descriptors: descriptors,\n    NavigationContent: NavigationContent\n  };\n}","map":{"version":3,"names":["CommonActions","React","isValidElementType","useLatestCallback","deepFreeze","Group","isArrayEqual","isRecordEqual","NavigationHelpersContext","NavigationRouteContext","NavigationStateContext","PreventRemoveProvider","Screen","PrivateValueStore","useChildListeners","useClientLayoutEffect","useComponent","useCurrentRender","useDescriptors","useEventEmitter","useFocusedListenersChildrenAdapter","useFocusEvents","useKeyedChildListeners","useLazyValue","useNavigationHelpers","NavigationStateListenerProvider","useOnAction","useOnGetState","useOnRouteFocus","useRegisterNavigator","useScheduleUpdate","jsx","_jsx","isScreen","child","type","isGroup","Fragment","isValidKey","key","undefined","getRouteConfigsFromChildren","children","groupKey","groupOptions","groupLayout","configs","Children","toArray","reduce","acc","_child$type","_child$props","isValidElement","props","Error","name","JSON","stringify","navigationKey","push","keys","options","layout","apply","_toConsumableArray","concat","screenOptions","screenLayout","String","process","env","NODE_ENV","forEach","config","_config$props","component","getComponent","console","warn","test","useNavigationBuilder","createRouter","navigatorKey","route","useContext","screenListeners","UNSTABLE_router","rest","_objectWithoutProperties","_excluded","routeConfigs","router","initialRouteName","every","original","overrides","_objectSpread","screens","routeNames","map","routeKeyList","curr","join","routeParamList","initialParams","routeGetIdList","Object","assign","_defineProperty","getId","length","isStateValid","useCallback","state","isStateInitialized","stale","_React$useContext","currentState","getCurrentState","getState","setCurrentState","setState","setKey","getKey","getIsInitial","stateCleanedUp","useRef","current","_React$useMemo","useMemo","_route$params4","_route$params5","_route$params6","initialRouteParamList","_route$params","_route$params2","_route$params3","initialParamsFromParams","params","initial","screen","getInitialState","_route$params7","_route$params8","_route$params9","_stateFromParams","stateFromParams","index","routes","path","getRehydratedState","_React$useMemo2","_slicedToArray","initializedState","isFirstStateInitialization","previousRouteKeyListRef","useEffect","previousRouteKeyList","nextState","getStateForRouteNamesChange","routeKeyChanges","filter","previousNestedParamsRef","previousParams","action","reset","navigate","merge","pop","updatedState","getStateForAction","shouldUpdate","stateRef","emitter","e","_ref","target","_route","find","_route2","navigation","descriptors","listeners","cb","i","self","lastIndexOf","listener","emit","data","_useChildListeners","childListeners","addListener","_useKeyedChildListene","keyedListeners","addKeyedListener","onAction","actionListeners","beforeRemoveListeners","beforeRemove","routerConfigOptions","onRouteFocus","id","focusedListeners","focus","getStateListeners","_useDescriptors","describe","NavigationContent","element","Provider","value"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/@react-navigation/core/src/useNavigationBuilder.tsx"],"sourcesContent":["import {\n  CommonActions,\n  type DefaultRouterOptions,\n  type NavigationAction,\n  type NavigationState,\n  type ParamListBase,\n  type PartialState,\n  type Route,\n  type Router,\n  type RouterConfigOptions,\n  type RouterFactory,\n} from '@react-navigation/routers';\nimport * as React from 'react';\nimport { isValidElementType } from 'react-is';\nimport useLatestCallback from 'use-latest-callback';\n\nimport { deepFreeze } from './deepFreeze';\nimport { Group } from './Group';\nimport { isArrayEqual } from './isArrayEqual';\nimport { isRecordEqual } from './isRecordEqual';\nimport { NavigationHelpersContext } from './NavigationHelpersContext';\nimport { NavigationRouteContext } from './NavigationRouteContext';\nimport { NavigationStateContext } from './NavigationStateContext';\nimport { PreventRemoveProvider } from './PreventRemoveProvider';\nimport { Screen } from './Screen';\nimport {\n  type DefaultNavigatorOptions,\n  type EventMapBase,\n  type EventMapCore,\n  type NavigatorScreenParams,\n  PrivateValueStore,\n  type RouteConfig,\n} from './types';\nimport { useChildListeners } from './useChildListeners';\nimport { useClientLayoutEffect } from './useClientLayoutEffect';\nimport { useComponent } from './useComponent';\nimport { useCurrentRender } from './useCurrentRender';\nimport { type ScreenConfigWithParent, useDescriptors } from './useDescriptors';\nimport { useEventEmitter } from './useEventEmitter';\nimport { useFocusedListenersChildrenAdapter } from './useFocusedListenersChildrenAdapter';\nimport { useFocusEvents } from './useFocusEvents';\nimport { useKeyedChildListeners } from './useKeyedChildListeners';\nimport { useLazyValue } from './useLazyValue';\nimport { useNavigationHelpers } from './useNavigationHelpers';\nimport { NavigationStateListenerProvider } from './useNavigationState';\nimport { useOnAction } from './useOnAction';\nimport { useOnGetState } from './useOnGetState';\nimport { useOnRouteFocus } from './useOnRouteFocus';\nimport { useRegisterNavigator } from './useRegisterNavigator';\nimport { useScheduleUpdate } from './useScheduleUpdate';\n\n// This is to make TypeScript compiler happy\n// eslint-disable-next-line @typescript-eslint/no-unused-expressions\nPrivateValueStore;\n\ntype NavigatorRoute = {\n  key: string;\n  params?: NavigatorScreenParams<ParamListBase>;\n};\n\nconst isScreen = (\n  child: React.ReactElement<unknown>\n): child is React.ReactElement<{\n  name?: unknown;\n  navigationKey?: unknown;\n}> => {\n  return child.type === Screen;\n};\n\nconst isGroup = (\n  child: React.ReactElement<unknown>\n): child is React.ReactElement<{\n  navigationKey?: unknown;\n  screenOptions?: unknown;\n  screenLayout?: unknown;\n  children?: unknown;\n}> => {\n  return child.type === React.Fragment || child.type === Group;\n};\n\nconst isValidKey = (key: unknown): key is string | undefined =>\n  key === undefined || (typeof key === 'string' && key !== '');\n\n/**\n * Extract route config object from React children elements.\n *\n * @param children React Elements to extract the config from.\n */\nconst getRouteConfigsFromChildren = <\n  State extends NavigationState,\n  ScreenOptions extends {},\n  EventMap extends EventMapBase,\n>(\n  children: React.ReactNode,\n  groupKey?: string,\n  groupOptions?: ScreenConfigWithParent<\n    State,\n    ScreenOptions,\n    EventMap\n  >['options'],\n  groupLayout?: ScreenConfigWithParent<State, ScreenOptions, EventMap>['layout']\n) => {\n  const configs = React.Children.toArray(children).reduce<\n    ScreenConfigWithParent<State, ScreenOptions, EventMap>[]\n  >((acc, child) => {\n    if (React.isValidElement(child)) {\n      if (isScreen(child)) {\n        // We can only extract the config from `Screen` elements\n        // If something else was rendered, it's probably a bug\n\n        if (typeof child.props !== 'object' || child.props === null) {\n          throw new Error(`Got an invalid element for screen.`);\n        }\n\n        if (typeof child.props.name !== 'string' || child.props.name === '') {\n          throw new Error(\n            `Got an invalid name (${JSON.stringify(\n              child.props.name\n            )}) for the screen. It must be a non-empty string.`\n          );\n        }\n\n        if (\n          child.props.navigationKey !== undefined &&\n          (typeof child.props.navigationKey !== 'string' ||\n            child.props.navigationKey === '')\n        ) {\n          throw new Error(\n            `Got an invalid 'navigationKey' prop (${JSON.stringify(\n              child.props.navigationKey\n            )}) for the screen '${\n              child.props.name\n            }'. It must be a non-empty string or 'undefined'.`\n          );\n        }\n\n        acc.push({\n          keys: [groupKey, child.props.navigationKey],\n          options: groupOptions,\n          layout: groupLayout,\n          props: child.props as RouteConfig<\n            ParamListBase,\n            string,\n            State,\n            ScreenOptions,\n            EventMap,\n            unknown\n          >,\n        });\n\n        return acc;\n      }\n\n      if (isGroup(child)) {\n        if (!isValidKey(child.props.navigationKey)) {\n          throw new Error(\n            `Got an invalid 'navigationKey' prop (${JSON.stringify(\n              child.props.navigationKey\n            )}) for the group. It must be a non-empty string or 'undefined'.`\n          );\n        }\n\n        // When we encounter a fragment or group, we need to dive into its children to extract the configs\n        // This is handy to conditionally define a group of screens\n        acc.push(\n          ...getRouteConfigsFromChildren<State, ScreenOptions, EventMap>(\n            child.props.children as React.ReactNode,\n            child.props.navigationKey,\n            // FIXME\n            // @ts-expect-error: add validation\n            child.type !== Group\n              ? groupOptions\n              : groupOptions != null\n                ? [...groupOptions, child.props.screenOptions]\n                : [child.props.screenOptions],\n            typeof child.props.screenLayout === 'function'\n              ? child.props.screenLayout\n              : groupLayout\n          )\n        );\n\n        return acc;\n      }\n    }\n\n    throw new Error(\n      `A navigator can only contain 'Screen', 'Group' or 'React.Fragment' as its direct children (found ${\n        React.isValidElement(child)\n          ? `'${\n              typeof child.type === 'string' ? child.type : child.type?.name\n            }'${\n              child.props != null &&\n              typeof child.props === 'object' &&\n              'name' in child.props &&\n              child.props?.name\n                ? ` for the screen '${child.props.name}'`\n                : ''\n            }`\n          : typeof child === 'object'\n            ? JSON.stringify(child)\n            : `'${String(child)}'`\n      }). To render this component in the navigator, pass it in the 'component' prop to 'Screen'.`\n    );\n  }, []);\n\n  if (process.env.NODE_ENV !== 'production') {\n    configs.forEach((config) => {\n      const { name, children, component, getComponent } = config.props;\n\n      if (\n        children != null ||\n        component !== undefined ||\n        getComponent !== undefined\n      ) {\n        if (children != null && component !== undefined) {\n          throw new Error(\n            `Got both 'component' and 'children' props for the screen '${name}'. You must pass only one of them.`\n          );\n        }\n\n        if (children != null && getComponent !== undefined) {\n          throw new Error(\n            `Got both 'getComponent' and 'children' props for the screen '${name}'. You must pass only one of them.`\n          );\n        }\n\n        if (component !== undefined && getComponent !== undefined) {\n          throw new Error(\n            `Got both 'component' and 'getComponent' props for the screen '${name}'. You must pass only one of them.`\n          );\n        }\n\n        if (children != null && typeof children !== 'function') {\n          throw new Error(\n            `Got an invalid value for 'children' prop for the screen '${name}'. It must be a function returning a React Element.`\n          );\n        }\n\n        if (component !== undefined && !isValidElementType(component)) {\n          throw new Error(\n            `Got an invalid value for 'component' prop for the screen '${name}'. It must be a valid React Component.`\n          );\n        }\n\n        if (getComponent !== undefined && typeof getComponent !== 'function') {\n          throw new Error(\n            `Got an invalid value for 'getComponent' prop for the screen '${name}'. It must be a function returning a React Component.`\n          );\n        }\n\n        if (typeof component === 'function') {\n          if (component.name === 'component') {\n            // Inline anonymous functions passed in the `component` prop will have the name of the prop\n            // It's relatively safe to assume that it's not a component since it should also have PascalCase name\n            // We won't catch all scenarios here, but this should catch a good chunk of incorrect use.\n            console.warn(\n              `Looks like you're passing an inline function for 'component' prop for the screen '${name}' (e.g. component={() => <SomeComponent />}). Passing an inline function will cause the component state to be lost on re-render and cause perf issues since it's re-created every render. You can pass the function as children to 'Screen' instead to achieve the desired behaviour.`\n            );\n          } else if (/^[a-z]/.test(component.name)) {\n            console.warn(\n              `Got a component with the name '${component.name}' for the screen '${name}'. React Components must start with an uppercase letter. If you're passing a regular function and not a component, pass it as children to 'Screen' instead. Otherwise capitalize your component's name.`\n            );\n          }\n        }\n      } else {\n        throw new Error(\n          `Couldn't find a 'component', 'getComponent' or 'children' prop for the screen '${name}'. This can happen if you passed 'undefined'. You likely forgot to export your component from the file it's defined in, or mixed up default import and named import when importing.`\n        );\n      }\n    });\n  }\n\n  return configs;\n};\n\n/**\n * Hook for building navigators.\n *\n * @param createRouter Factory method which returns router object.\n * @param options Options object containing `children` and additional options for the router.\n * @returns An object containing `state`, `navigation`, `descriptors` objects.\n */\nexport function useNavigationBuilder<\n  State extends NavigationState,\n  RouterOptions extends DefaultRouterOptions,\n  ActionHelpers extends Record<string, (...args: any) => void>,\n  ScreenOptions extends {},\n  EventMap extends Record<string, any>,\n>(\n  createRouter: RouterFactory<State, NavigationAction, RouterOptions>,\n  options: DefaultNavigatorOptions<\n    ParamListBase,\n    string | undefined,\n    State,\n    ScreenOptions,\n    EventMap,\n    any\n  > &\n    RouterOptions\n) {\n  const navigatorKey = useRegisterNavigator();\n\n  const route = React.useContext(NavigationRouteContext) as\n    | NavigatorRoute\n    | undefined;\n\n  const {\n    children,\n    layout,\n    screenOptions,\n    screenLayout,\n    screenListeners,\n    UNSTABLE_router,\n    ...rest\n  } = options;\n\n  const routeConfigs = getRouteConfigsFromChildren<\n    State,\n    ScreenOptions,\n    EventMap\n  >(children);\n\n  const router = useLazyValue<Router<State, any>>(() => {\n    if (\n      rest.initialRouteName != null &&\n      routeConfigs.every(\n        (config) => config.props.name !== rest.initialRouteName\n      )\n    ) {\n      throw new Error(\n        `Couldn't find a screen named '${rest.initialRouteName}' to use as 'initialRouteName'.`\n      );\n    }\n\n    const original = createRouter(rest as unknown as RouterOptions);\n\n    if (UNSTABLE_router != null) {\n      const overrides = UNSTABLE_router(original);\n\n      return {\n        ...original,\n        ...overrides,\n      };\n    }\n\n    return original;\n  });\n\n  const screens = routeConfigs.reduce<\n    Record<string, ScreenConfigWithParent<State, ScreenOptions, EventMap>>\n  >((acc, config) => {\n    if (config.props.name in acc) {\n      throw new Error(\n        `A navigator cannot contain multiple 'Screen' components with the same name (found duplicate screen named '${config.props.name}')`\n      );\n    }\n\n    acc[config.props.name] = config;\n    return acc;\n  }, {});\n\n  const routeNames = routeConfigs.map((config) => config.props.name);\n  const routeKeyList = routeNames.reduce<Record<string, React.Key | undefined>>(\n    (acc, curr) => {\n      acc[curr] = screens[curr].keys.map((key) => key ?? '').join(':');\n      return acc;\n    },\n    {}\n  );\n  const routeParamList = routeNames.reduce<Record<string, object | undefined>>(\n    (acc, curr) => {\n      const { initialParams } = screens[curr].props;\n      acc[curr] = initialParams;\n      return acc;\n    },\n    {}\n  );\n  const routeGetIdList = routeNames.reduce<\n    RouterConfigOptions['routeGetIdList']\n  >(\n    (acc, curr) =>\n      Object.assign(acc, {\n        [curr]: screens[curr].props.getId,\n      }),\n    {}\n  );\n\n  if (!routeNames.length) {\n    throw new Error(\n      \"Couldn't find any screens for the navigator. Have you defined any screens as its children?\"\n    );\n  }\n\n  const isStateValid = React.useCallback(\n    (state: NavigationState | PartialState<NavigationState>) =>\n      state.type === undefined || state.type === router.type,\n    [router.type]\n  );\n\n  const isStateInitialized = React.useCallback(\n    (state: NavigationState | PartialState<NavigationState> | undefined) =>\n      state !== undefined && state.stale === false && isStateValid(state),\n    [isStateValid]\n  );\n\n  const {\n    state: currentState,\n    getState: getCurrentState,\n    setState: setCurrentState,\n    setKey,\n    getKey,\n    getIsInitial,\n  } = React.useContext(NavigationStateContext);\n\n  const stateCleanedUp = React.useRef(false);\n\n  const setState = useLatestCallback(\n    (state: NavigationState | PartialState<NavigationState> | undefined) => {\n      if (stateCleanedUp.current) {\n        // State might have been already cleaned up due to unmount\n        // We do not want to expose API allowing to override this\n        // This would lead to old data preservation on main navigator unmount\n        return;\n      }\n\n      setCurrentState(state);\n    }\n  );\n\n  const [initializedState, isFirstStateInitialization] = React.useMemo(() => {\n    const initialRouteParamList = routeNames.reduce<\n      Record<string, object | undefined>\n    >((acc, curr) => {\n      const { initialParams } = screens[curr].props;\n      const initialParamsFromParams =\n        route?.params?.state == null &&\n        route?.params?.initial !== false &&\n        route?.params?.screen === curr\n          ? route.params.params\n          : undefined;\n\n      acc[curr] =\n        initialParams !== undefined || initialParamsFromParams !== undefined\n          ? {\n              ...initialParams,\n              ...initialParamsFromParams,\n            }\n          : undefined;\n\n      return acc;\n    }, {});\n\n    // If the current state isn't initialized on first render, we initialize it\n    // We also need to re-initialize it if the state passed from parent was changed (maybe due to reset)\n    // Otherwise assume that the state was provided as initial state\n    // So we need to rehydrate it to make it usable\n    if (\n      (currentState === undefined || !isStateValid(currentState)) &&\n      route?.params?.state == null &&\n      !(\n        typeof route?.params?.screen === 'string' &&\n        route?.params?.initial !== false\n      )\n    ) {\n      return [\n        router.getInitialState({\n          routeNames,\n          routeParamList: initialRouteParamList,\n          routeGetIdList,\n        }),\n        true,\n      ];\n    } else {\n      let stateFromParams;\n\n      if (route?.params?.state != null) {\n        stateFromParams = route.params.state;\n      } else if (\n        typeof route?.params?.screen === 'string' &&\n        route?.params?.initial !== false\n      ) {\n        stateFromParams = {\n          index: 0,\n          routes: [\n            {\n              name: route.params.screen,\n              params: route.params.params,\n              path: route.params.path,\n            },\n          ],\n        };\n      }\n\n      return [\n        router.getRehydratedState(\n          (stateFromParams ?? currentState) as PartialState<State>,\n          {\n            routeNames,\n            routeParamList: initialRouteParamList,\n            routeGetIdList,\n          }\n        ),\n        false,\n      ];\n    }\n    // We explicitly don't include routeNames, route.params etc. in the dep list\n    // below. We want to avoid forcing a new state to be calculated in those cases\n    // Instead, we handle changes to these in the nextState code below. Note\n    // that some changes to routeConfigs are explicitly ignored, such as changes\n    // to initialParams\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [currentState, router, isStateValid]);\n\n  const previousRouteKeyListRef = React.useRef(routeKeyList);\n\n  React.useEffect(() => {\n    previousRouteKeyListRef.current = routeKeyList;\n  });\n\n  const previousRouteKeyList = previousRouteKeyListRef.current;\n\n  let state =\n    // If the state isn't initialized, or stale, use the state we initialized instead\n    // The state won't update until there's a change needed in the state we have initialized locally\n    // So it'll be `undefined` or stale until the first navigation event happens\n    isStateInitialized(currentState)\n      ? (currentState as State)\n      : (initializedState as State);\n\n  let nextState: State = state;\n\n  if (\n    !isArrayEqual(state.routeNames, routeNames) ||\n    !isRecordEqual(routeKeyList, previousRouteKeyList)\n  ) {\n    // When the list of route names change, the router should handle it to remove invalid routes\n    nextState = router.getStateForRouteNamesChange(state, {\n      routeNames,\n      routeParamList,\n      routeGetIdList,\n      routeKeyChanges: Object.keys(routeKeyList).filter(\n        (name) =>\n          name in previousRouteKeyList &&\n          routeKeyList[name] !== previousRouteKeyList[name]\n      ),\n    });\n  }\n\n  const previousNestedParamsRef = React.useRef(route?.params);\n\n  React.useEffect(() => {\n    previousNestedParamsRef.current = route?.params;\n  }, [route?.params]);\n\n  if (route?.params) {\n    const previousParams = previousNestedParamsRef.current;\n\n    let action: CommonActions.Action | undefined;\n\n    if (\n      typeof route.params.state === 'object' &&\n      route.params.state != null &&\n      route.params !== previousParams\n    ) {\n      // If the route was updated with new state, we should reset to it\n      action = CommonActions.reset(route.params.state);\n    } else if (\n      typeof route.params.screen === 'string' &&\n      ((route.params.initial === false && isFirstStateInitialization) ||\n        route.params !== previousParams)\n    ) {\n      // If the route was updated with new screen name and/or params, we should navigate there\n      action = CommonActions.navigate({\n        name: route.params.screen,\n        params: route.params.params,\n        path: route.params.path,\n        merge: route.params.merge,\n        pop: route.params.pop,\n      });\n    }\n\n    // The update should be limited to current navigator only, so we call the router manually\n    const updatedState = action\n      ? router.getStateForAction(nextState, action, {\n          routeNames,\n          routeParamList,\n          routeGetIdList,\n        })\n      : null;\n\n    nextState =\n      updatedState !== null\n        ? router.getRehydratedState(updatedState, {\n            routeNames,\n            routeParamList,\n            routeGetIdList,\n          })\n        : nextState;\n  }\n\n  const shouldUpdate = state !== nextState;\n\n  useScheduleUpdate(() => {\n    if (shouldUpdate) {\n      // If the state needs to be updated, we'll schedule an update\n      setState(nextState);\n    }\n  });\n\n  // The up-to-date state will come in next render, but we don't need to wait for it\n  // We can't use the outdated state since the screens have changed, which will cause error due to mismatched config\n  // So we override the state object we return to use the latest state as soon as possible\n  state = nextState;\n\n  React.useEffect(() => {\n    // In strict mode, React will double-invoke effects.\n    // So we need to reset the flag if component was not unmounted\n    stateCleanedUp.current = false;\n\n    setKey(navigatorKey);\n\n    if (!getIsInitial()) {\n      // If it's not initial render, we need to update the state\n      // This will make sure that our container gets notifier of state changes due to new mounts\n      // This is necessary for proper screen tracking, URL updates etc.\n      setState(nextState);\n    }\n\n    return () => {\n      // We need to clean up state for this navigator on unmount\n      if (getCurrentState() !== undefined && getKey() === navigatorKey) {\n        setCurrentState(undefined);\n        stateCleanedUp.current = true;\n      }\n    };\n    // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, []);\n\n  // In some cases (e.g. route names change), internal state might have changed\n  // But it hasn't been committed yet, so hasn't propagated to the sync external store\n  // During this time, we need to return the internal state in `getState`\n  // Otherwise it can result in inconsistent state during render in children\n  // To avoid this, we use a ref for render phase, and immediately clear it on commit\n  const stateRef = React.useRef<State | null>(state);\n\n  stateRef.current = state;\n\n  useClientLayoutEffect(() => {\n    stateRef.current = null;\n  });\n\n  const getState = useLatestCallback((): State => {\n    const currentState = getCurrentState();\n\n    return deepFreeze(\n      (isStateInitialized(currentState)\n        ? currentState\n        : initializedState) as State\n    );\n  });\n\n  const emitter = useEventEmitter<EventMapCore<State>>((e) => {\n    const routeNames = [];\n\n    let route: Route<string> | undefined;\n\n    if (e.target) {\n      route = state.routes.find((route) => route.key === e.target);\n\n      if (route?.name) {\n        routeNames.push(route.name);\n      }\n    } else {\n      route = state.routes[state.index];\n      routeNames.push(\n        ...Object.keys(screens).filter((name) => route?.name === name)\n      );\n    }\n\n    if (route == null) {\n      return;\n    }\n\n    const navigation = descriptors[route.key].navigation;\n\n    const listeners = ([] as (((e: any) => void) | undefined)[])\n      .concat(\n        // Get an array of listeners for all screens + common listeners on navigator\n        ...[\n          screenListeners,\n          ...routeNames.map((name) => {\n            const { listeners } = screens[name].props;\n            return listeners;\n          }),\n        ].map((listeners) => {\n          const map =\n            typeof listeners === 'function'\n              ? listeners({ route: route as any, navigation })\n              : listeners;\n\n          return map\n            ? Object.keys(map)\n                .filter((type) => type === e.type)\n                .map((type) => map?.[type])\n            : undefined;\n        })\n      )\n      // We don't want same listener to be called multiple times for same event\n      // So we remove any duplicate functions from the array\n      .filter((cb, i, self) => cb && self.lastIndexOf(cb) === i);\n\n    listeners.forEach((listener) => listener?.(e));\n  });\n\n  useFocusEvents({ state, emitter });\n\n  React.useEffect(() => {\n    emitter.emit({ type: 'state', data: { state } });\n  }, [emitter, state]);\n\n  const { listeners: childListeners, addListener } = useChildListeners();\n\n  const { keyedListeners, addKeyedListener } = useKeyedChildListeners();\n\n  const onAction = useOnAction({\n    router,\n    getState,\n    setState,\n    key: route?.key,\n    actionListeners: childListeners.action,\n    beforeRemoveListeners: keyedListeners.beforeRemove,\n    routerConfigOptions: {\n      routeNames,\n      routeParamList,\n      routeGetIdList,\n    },\n    emitter,\n  });\n\n  const onRouteFocus = useOnRouteFocus({\n    router,\n    key: route?.key,\n    getState,\n    setState,\n  });\n\n  const navigation = useNavigationHelpers<\n    State,\n    ActionHelpers,\n    NavigationAction,\n    EventMap\n  >({\n    id: options.id,\n    onAction,\n    getState,\n    emitter,\n    router,\n    stateRef,\n  });\n\n  useFocusedListenersChildrenAdapter({\n    navigation,\n    focusedListeners: childListeners.focus,\n  });\n\n  useOnGetState({\n    getState,\n    getStateListeners: keyedListeners.getState,\n  });\n\n  const { describe, descriptors } = useDescriptors<\n    State,\n    ActionHelpers,\n    ScreenOptions,\n    EventMap\n  >({\n    state,\n    screens,\n    navigation,\n    screenOptions,\n    screenLayout,\n    onAction,\n    getState,\n    setState,\n    onRouteFocus,\n    addListener,\n    addKeyedListener,\n    router,\n    // @ts-expect-error: this should have both core and custom events, but too much work right now\n    emitter,\n  });\n\n  useCurrentRender({\n    state,\n    navigation,\n    descriptors,\n  });\n\n  const NavigationContent = useComponent((children: React.ReactNode) => {\n    const element =\n      layout != null\n        ? layout({\n            state,\n            descriptors,\n            navigation,\n            children,\n          })\n        : children;\n\n    return (\n      <NavigationHelpersContext.Provider value={navigation}>\n        <NavigationStateListenerProvider state={state}>\n          <PreventRemoveProvider>{element}</PreventRemoveProvider>\n        </NavigationStateListenerProvider>\n      </NavigationHelpersContext.Provider>\n    );\n  });\n\n  return {\n    state,\n    navigation,\n    describe,\n    descriptors,\n    NavigationContent,\n  };\n}\n"],"mappings":";;;;;;;;;AAAA,SACEA,aAAa,QAUR,2BAA2B;AAClC,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SA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