const noop = ( ) => void 0 ; const always = ( x ) => ( ) => x ; export const elementMap = new Map < string , any > ( [ [ 'document' , documentElement ( ) ] , [ 'body' , bodyElement ( ) ] , [ 'window' , windowElement ( ) ] , ] ) ; const fallback = { matches : always ( true ) , addEventListener : noop , removeEventListener : noop } ; function documentElement ( ) { try { return document ; } catch ( e ) { return fallback as Document ; } } function bodyElement ( ) { try { return document && document . body as HTMLBodyElement ; } catch ( e ) { return fallback as HTMLBodyElement ; } } function windowElement ( ) { try { return window ; } catch ( e ) { return fallback as Window ; } }