import { App , AppNavLinkStatus , AppStatus , AppDeepLink , PublicAppInfo , PublicAppDeepLinkInfo , } from '../types' ; export function getAppInfo ( app ) { const { updater$ , mount , navLinkStatus = AppNavLinkStatus . default , ... infos } = app ; return { ... infos , status : app . status ! , navLinkStatus : navLinkStatus === AppNavLinkStatus . default ? app . status === AppStatus . inaccessible ? AppNavLinkStatus . hidden : AppNavLinkStatus . visible : navLinkStatus , searchable : app . searchable ?? ( navLinkStatus === AppNavLinkStatus . default || navLinkStatus === AppNavLinkStatus . visible ) , appRoute : app . appRoute ! , keywords : app . keywords ?? [ ] , deepLinks : getDeepLinkInfos ( app . deepLinks ) , } ; } function getDeepLinkInfos ( deepLinks ? ) { if ( ! deepLinks ) return [ ] ; return deepLinks . map ( ( { navLinkStatus = AppNavLinkStatus . default , ... rawDeepLink } ) : PublicAppDeepLinkInfo => { return { ... rawDeepLink , keywords : rawDeepLink . keywords ?? [ ] , navLinkStatus : navLinkStatus === AppNavLinkStatus . default ? AppNavLinkStatus . hidden : navLinkStatus , searchable : rawDeepLink . searchable ?? ( navLinkStatus === AppNavLinkStatus . default || navLinkStatus === AppNavLinkStatus . visible ) , deepLinks : getDeepLinkInfos ( rawDeepLink . deepLinks ) , } ; } ) ; }