import { Observable , fromEvent , map , merge , startWith } from "rxjs" ; /**
 * Viewport offset
 */ export interface ViewportOffset { x : number ; y : number ; } returns export function getViewportOffset ( ) { return { x : Math . max ( 0 , scrollX ) , y : Math . max ( 0 , scrollY ) } ; } returns export function watchViewportOffset ( ) { return merge ( fromEvent ( window , "scroll" , { passive : true } ) , fromEvent ( window , "resize" , { passive : true } ) ) . pipe ( map ( getViewportOffset ) , startWith ( getViewportOffset ( ) ) ) ; }