import type { SerializedStyles } from "@emotion/react" ; import { css } from "@emotion/react" ; import type { Option } from '@guardian/types' ; import { map , withDefault } from '@guardian/types' ; import { ReactElement } from 'react' ; const darkModeCss = ( supportsDarkMode ) => ( styles , ... placeholders ) : SerializedStyles => supportsDarkMode ? css `
        @media (prefers-color-scheme: dark) {
          ${ styles . map ( ( style , i ) => `${ style }${ placeholders [ i ] ? placeholders [ i ] : "" }` ) . join ( "" ) }
        }
      ` : css `` ; param a param f param g param h example function pipe < A , B > ( a , f ) ; function pipe < A , B , C > ( a , f , g ) ; function pipe < A , B , C , D > ( a , f , g , h ) ; function pipe < A , B , C , D > ( a , f , g ? , h ? ) { if ( g !== undefined && h !== undefined ) { return h ( g ( f ( a ) ) ) ; } else if ( g !== undefined ) { return g ( f ( a ) ) ; } return f ( a ) ; } param oa param f returns { ReactElement | null } example const maybeRender = < A > ( oa , f ) : ReactElement | null => pipe ( oa , map ( f ) , withDefault < ReactElement | null > ( null ) ) ; export { darkModeCss , maybeRender , pipe } ;