{"version":3,"names":["format","first","middle","last","removeIntersectionObserver","io","disconnect","addIntersectionObserver","el","callback","overlaySelectors","options","root","rootMargin","threshold","IntersectionObserver","data","isIntersecting","removeOverlay","event","target","removeEventListener","remove","forEach","selector","overlay","querySelector","addEventListener","elementToObserve","observe","console","error","checkLanguageCookie","cookieName","value","document","cookie","parts","split","length","pop","shift"],"sources":["src/utils/utils.ts"],"sourcesContent":["export function format(first: string, middle: string, last: string): string {\n return (first || '') + (middle ? ` ${middle}` : '') + (last ? ` ${last}` : '');\n}\n\nexport function removeIntersectionObserver(io: IntersectionObserver) {\n if (io) {\n io.disconnect();\n io = null;\n }\n}\n\n\nexport function addIntersectionObserver(\n el: HTMLElement,\n callback: Function,\n overlaySelectors: string[],\n options: any = { root: null, rootMargin: '0px 0px 0px 0px', threshold: 0 },\n) {\n // Adjust the threshold to 0.0 to trigger the callback as soon as the target element comes into view\n options.threshold = 0.0;\n\n const io = new IntersectionObserver((data: any) => {\n if (data[0].isIntersecting) {\n callback();\n\n const removeOverlay = (event: AnimationEvent) => {\n const target = event.target as HTMLElement;\n target.removeEventListener('animationend', removeOverlay);\n target.remove();\n };\n\n overlaySelectors.forEach(selector => {\n const overlay = el.querySelector(selector);\n if (overlay) {\n overlay.addEventListener('animationend', removeOverlay);\n }\n });\n\n removeIntersectionObserver(io);\n }\n }, options);\n\n const elementToObserve = el;\n\n if (elementToObserve) {\n io.observe(elementToObserve);\n } else {\n console.error('Element to observe not found');\n }\n}\n\nexport function checkLanguageCookie(cookieName: string): string {\n const value = `; ${document.cookie}`;\n const parts = value.split(`; ${cookieName}=`);\n if (parts.length === 2) return parts.pop().split(';').shift();\n}"],"mappings":"SAAgBA,EAAOC,EAAeC,EAAgBC,GACpD,OAAQF,GAAS,KAAOC,EAAS,IAAIA,IAAW,KAAOC,EAAO,IAAIA,IAAS,GAC7E,C,SAEgBC,EAA2BC,GACzC,GAAIA,EAAI,CACNA,EAAGC,aACHD,EAAK,I,CAET,C,SAGgBE,EACdC,EACAC,EACAC,EACAC,EAAe,CAAEC,KAAM,KAAMC,WAAY,kBAAmBC,UAAW,IAGvEH,EAAQG,UAAY,EAEpB,MAAMT,EAAK,IAAIU,sBAAsBC,IACnC,GAAIA,EAAK,GAAGC,eAAgB,CAC1BR,IAEA,MAAMS,EAAiBC,IACrB,MAAMC,EAASD,EAAMC,OACrBA,EAAOC,oBAAoB,eAAgBH,GAC3CE,EAAOE,QAAQ,EAGjBZ,EAAiBa,SAAQC,IACvB,MAAMC,EAAUjB,EAAGkB,cAAcF,GACjC,GAAIC,EAAS,CACXA,EAAQE,iBAAiB,eAAgBT,E,KAI7Cd,EAA2BC,E,IAE5BM,GAEH,MAAMiB,EAAmBpB,EAEzB,GAAIoB,EAAkB,CACpBvB,EAAGwB,QAAQD,E,KACN,CACLE,QAAQC,MAAM,+B,CAElB,C,SAEgBC,EAAoBC,GAClC,MAAMC,EAAQ,KAAKC,SAASC,SAC5B,MAAMC,EAAQH,EAAMI,MAAM,KAAKL,MAC/B,GAAII,EAAME,SAAW,EAAG,OAAOF,EAAMG,MAAMF,MAAM,KAAKG,OACxD,Q"}