import type * as d from '../../declarations' ; import { addHostEventListeners } from '@runtime' ; let customError ; export const cmpModules = new Map < string , { [ exportName ] : d . ComponentConstructor ; } > ( ) ; const getModule = ( tagName ) : d . ComponentConstructor => { if ( typeof tagName === 'string' ) { tagName = tagName . toLowerCase ( ) ; const cmpModule = cmpModules . get ( tagName ) ; if ( cmpModule != null ) { return cmpModule [ tagName ] ; } } return null ; } ; export const loadModule = ( cmpMeta , _hostRef , _hmrVersionId ? ) : any => { return getModule ( cmpMeta . $tagName$ ) ; } ; export const isMemberInElement = ( elm , memberName ) => { if ( elm != null ) { if ( memberName in elm ) { return true ; } const cstr = getModule ( elm . nodeName ) ; if ( cstr != null ) { const hostRef = cstr as any ; if ( hostRef != null && hostRef . cmpMeta != null && hostRef . cmpMeta . $members$ != null ) { return memberName in hostRef . cmpMeta . $members$ ; } } } return false ; } ; export const registerComponents = ( Cstrs ) => { for ( const Cstr of Cstrs ) { const exportName = Cstr . cmpMeta . $tagName$ ; cmpModules . set ( exportName , { [ exportName ] : Cstr , } ) ; } } ; export const win = window ; export const doc = win . document ; export const readTask = ( cb ) => { process . nextTick ( ( ) => { try { cb ( ) ; } catch ( e ) { consoleError ( e ) ; } } ) ; } ; export const writeTask = ( cb ) => { process . nextTick ( ( ) => { try { cb ( ) ; } catch ( e ) { consoleError ( e ) ; } } ) ; } ; const resolved = Promise . resolve ( ) ; export const nextTick = ( cb ) => resolved . then ( cb ) ; const defaultConsoleError = ( e ) => { if ( e != null ) { console . error ( e . stack || e . message || e ) ; } } ; export const consoleError = ( e , el ? ) => ( customError || defaultConsoleError ) ( e , el ) ; export const consoleDevError = ( ... _ ) => { } ; export const consoleDevWarn = ( ... _ ) => { } ; export const consoleDevInfo = ( ... _ ) => { } ; export const setErrorHandler = ( handler ) => ( customError = handler ) ; export const Context = { } ; export const plt = { $flags$ : 0 , $resourcesUrl$ : '' , jmp : ( h ) => h ( ) , raf : ( h ) => requestAnimationFrame ( h ) , ael : ( el , eventName , listener , opts ) => el . addEventListener ( eventName , listener , opts ) , rel : ( el , eventName , listener , opts ) => el . removeEventListener ( eventName , listener , opts ) , ce : ( eventName , opts ) => new win . CustomEvent ( eventName , opts ) , } ; export const setPlatformHelpers = ( helpers ) => { Object . assign ( plt , helpers ) ; } ; export const supportsShadow = false ; export const supportsListenerOptions = false ; export const supportsConstructibleStylesheets = false ; const hostRefs = new WeakMap ( ) ; export const getHostRef = ( ref ) => hostRefs . get ( ref ) ; export const registerInstance = ( lazyInstance , hostRef ) => hostRefs . set ( ( hostRef . $lazyInstance$ = lazyInstance ) , hostRef ) ; export const registerHost = ( elm , cmpMeta ) => { const hostRef = { $flags$ : 0 , $cmpMeta$ : cmpMeta , $hostElement$ : elm , $instanceValues$ : new Map ( ) , $renderCount$ : 0 , } ; hostRef . $onInstancePromise$ = new Promise ( ( r ) => ( hostRef . $onInstanceResolve$ = r ) ) ; hostRef . $onReadyPromise$ = new Promise ( ( r ) => ( hostRef . $onReadyResolve$ = r ) ) ; elm [ 's-p' ] = [ ] ; elm [ 's-rc' ] = [ ] ; addHostEventListeners ( elm , hostRef , cmpMeta . $listeners$ , false ) ; return hostRefs . set ( elm , hostRef ) ; } ; export const Build = { isDev : false , isBrowser : false , isServer : true , isTesting : false , } ; export const styles = new Map ( ) ; export const modeResolutionChain = [ ] ; export { BUILD , NAMESPACE , Env } from '@app-data' ; export { hydrateApp } from './hydrate-app' ; export { addHostEventListeners , defineCustomElement , forceModeUpdate , proxyCustomElement , bootstrapLazy , connectedCallback , createEvent , disconnectedCallback , getAssetPath , setAssetPath , getConnect , getContext , getElement , getValue , setValue , Fragment , Host , insertVdomAnnotations , parsePropertyValue , forceUpdate , postUpdateComponent , getRenderingRef , proxyComponent , renderVdom , setMode , getMode , } from '@runtime' ; export { hAsync as h } from './h-async' ;