{"version":3,"sources":["webpack:///./Avensia.Common/Features/Shared/infinite-scroll.tsx"],"names":["isBound","bindInfiniteScroll","element","callback","offset","clientHeight","scrollTop","elementBottomPosition","offsetTop","offsetHeight","scrollBottomPosition","window","pageYOffset","handleScroll"],"mappings":"2FAAA,6CAEIA,GAAU,EAEP,SAASC,EAAmBC,EAAsBC,EAAsBC,GAC7E,GAAI,gBAAgBJ,EAAS,CAC3B,IACM,EAAmB,YAAG,UADX,WAAM,OAU3B,SAAsBE,EAAsBC,EAAsBC,QAAA,IAAAA,MAAA,GAC1D,+BAAEC,EAAA,EAAAA,aAAcC,EAAA,EAAAA,UAChBC,EAAwBL,EAAQM,UAAYN,EAAQO,aACpDC,GAAwBJ,GAAwBK,OAAOC,aAAeP,EAExEE,GAAyBG,EAAuBN,GAClDD,IAhBuBU,CAAaX,EAASC,EAAUC,MAGvD,OADAJ,GAAU,EACH,WACL,IACAA,GAAU","file":"assets/15.chunk.f6816cd55fc556a96a78.js","sourcesContent":["import { isBrowser, on } from '@avensia/scope';\r\n\r\nlet isBound = false;\r\n\r\nexport function bindInfiniteScroll(element: HTMLElement, callback: () => void, offset?: number) {\r\n if (isBrowser() && !isBound) {\r\n const listener = () => handleScroll(element, callback, offset);\r\n const unbindRootScroll = on('scroll', listener);\r\n isBound = true;\r\n return () => {\r\n unbindRootScroll();\r\n isBound = false;\r\n };\r\n }\r\n}\r\n\r\nfunction handleScroll(element: HTMLElement, callback: () => void, offset = 0) {\r\n const { clientHeight, scrollTop } = document.documentElement;\r\n const elementBottomPosition = element.offsetTop + element.offsetHeight;\r\n const scrollBottomPosition = (scrollTop ? scrollTop : window.pageYOffset) + clientHeight;\r\n\r\n if (elementBottomPosition <= scrollBottomPosition - offset) {\r\n callback();\r\n }\r\n}\r\n"],"sourceRoot":""}