var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.AuthNavigationContainer=void 0;var _extends2=_interopRequireDefault(require("@babel/runtime/helpers/extends"));var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _objectWithoutProperties2=_interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));var React=_interopRequireWildcard(require("react"));var _reactNativeSafeAreaContext=require("react-native-safe-area-context");var _native=require("@react-navigation/native");var _reactNativePaper=require("react-native-paper");var _Splash=require("./Splash");var _PreAuthContainer=require("./PreAuthContainer");var _ChangePassword=require("../screens/ChangePassword");var _reactAuthShared=require("@brightlayer-ui/react-auth-shared");var _jsxFileName="/home/circleci/login-workflow/login-workflow/src/screens/AuthNavigationContainer.tsx";var _excluded=["children","extraRoutes","initialRouteName"];function _getRequireWildcardCache(nodeInterop){if(typeof WeakMap!=="function")return null;var cacheBabelInterop=new WeakMap();var cacheNodeInterop=new WeakMap();return(_getRequireWildcardCache=function _getRequireWildcardCache(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop;})(nodeInterop);}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule){return obj;}if(obj===null||typeof obj!=="object"&&typeof obj!=="function"){return{default:obj};}var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj)){return cache.get(obj);}var newObj={};var hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj){if(key!=="default"&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;if(desc&&(desc.get||desc.set)){Object.defineProperty(newObj,key,desc);}else{newObj[key]=obj[key];}}}newObj.default=obj;if(cache){cache.set(obj,newObj);}return newObj;}var AuthNavigationContainerRender=function AuthNavigationContainerRender(props,ref){var children=props.children,extraRoutes=props.extraRoutes,initialRouteName=props.initialRouteName,other=(0,_objectWithoutProperties2.default)(props,_excluded);var securityState=(0,_reactAuthShared.useSecurityState)();var theme=(0,_reactNativePaper.useTheme)();var securityActions=(0,_reactAuthShared.useSecurityActions)();var injectedContext=(0,_reactAuthShared.useInjectedUIContext)();React.useEffect(function(){var bootstrapAsync=function bootstrapAsync(){return _regenerator.default.async(function bootstrapAsync$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _regenerator.default.awrap(injectedContext.authActions().initiateSecurity());case 2:case"end":return _context.stop();}}},null,null,null,Promise);};void bootstrapAsync();},[]);if(securityState.isLoading){return React.createElement(_Splash.Splash,{mainImage:injectedContext.projectImage,__source:{fileName:_jsxFileName,lineNumber:89,columnNumber:16}});}var ChangePasswordScreen=React.createElement(_ChangePassword.ChangePassword,{onChangePassword:injectedContext.authActions().changePassword,onCancel:securityActions.hideChangePassword,onChangeComplete:securityActions.onUserNotAuthenticated,__source:{fileName:_jsxFileName,lineNumber:93,columnNumber:9}});var appShouldBeVisible=securityState.isAuthenticatedUser&&!securityState.isShowingChangePassword;return React.createElement(_reactNativeSafeAreaContext.SafeAreaProvider,{style:{backgroundColor:theme.colors.background},__source:{fileName:_jsxFileName,lineNumber:106,columnNumber:9}},React.createElement(_native.NavigationContainer,(0,_extends2.default)({ref:ref},other,{__source:{fileName:_jsxFileName,lineNumber:107,columnNumber:13}}),appShouldBeVisible?React.createElement(React.Fragment,null,children):React.createElement(_reactAuthShared.AuthUIInternalStore,{__source:{fileName:_jsxFileName,lineNumber:111,columnNumber:21}},securityState.isShowingChangePassword?ChangePasswordScreen:React.createElement(_PreAuthContainer.PreAuthContainer,{extraRoutes:extraRoutes,initialRouteName:initialRouteName,__source:{fileName:_jsxFileName,lineNumber:115,columnNumber:29}}))));};var AuthNavigationContainer=React.forwardRef(AuthNavigationContainerRender);exports.AuthNavigationContainer=AuthNavigationContainer;
//# sourceMappingURL=AuthNavigationContainer.js.map