{"version":3,"sources":["webpack:///./node_modules/@logitravel/alex-comp-trans/components/main-car-airport/client/js/index.js","webpack:///./node_modules/@logitravel/alex-comp-trans/components/main-car-airport/client/js/components.js"],"names":["elementExist","resolveComponents","getCardProductCarousel","module","exports","selector","element","document","querySelector","config","dataset","result","JSON","parse","publicPath","components","filter","component","name","map","loader","observerConfig","root","rootMargin","threshold","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","reduce","acc","then","default","unobserve","observe","cardProductCarousel","querySelectorAll","item","cPCarouselObserver","type","getCPCarouselObserver","COMPONENTS"],"mappings":";gFAKA,EAAQ,QAER,MAAM,aAAEA,GAAiB,EAAQ,SAE3B,kBAAEC,EAAiB,uBAAEC,GAA2B,EAAQ,QAM9DC,EAAOC,QAAU,SAAwBC,EAAW,mCAChD,GAAIL,EAAaK,GAAW,CACxB,MAAMC,EAAUC,SAASC,cAAcH,GAEjCI,EAAS,IACR,WACC,IAAKH,EAAQI,QAAQD,OAAQ,MAAO,GAEpC,MAAME,EAASC,KAAKC,MAAMP,EAAQI,QAAQD,QAE1C,OADAH,EAAQI,QAAQD,OAAS,GAClBE,EALR,IAaHF,EAAOK,aAAY,IAA0BL,EAAOK,YAGxD,MAAMC,EAAad,IACde,OAAOC,GAAgC,wBAAnBA,EAAUC,MAC9BC,IAAIF,IAAa,CACdG,OAAQH,EAAUG,OAClBd,QAASC,SAASC,cAAc,oBAAoBS,EAAUC,aAEjEF,OAAOC,GAAaA,EAAUX,SAG7Be,EAAiB,CACnBC,KAAM,KACNC,WAAY,MACZC,UAAW,KAOTC,EAAW,IAAIC,qBAAqBC,IACtCA,EAAQC,QAAQC,IACZ,GAAIA,EAAMC,kBAAoB,EAAG,CAC7B,MAAM,OAAEV,GAAWL,EACdC,OAAOC,GAAaA,EAAUX,UAAYuB,EAAME,QAChDC,OAAOC,GAAOA,GAQnBb,IAASc,KAAK/B,IACVA,EAAOgC,UAEPV,EAASW,UAAUP,EAAME,cAItCV,GAEHN,EAAWa,QAAQX,IACfQ,EAASY,QAAQpB,EAAUX,WAQvC,SAA+Be,EAAgBf,GAC3C,MAAMgC,EAAsB,IAAIhC,EAAQiC,iBAAiB,2CAA2CpB,IAAIqB,IAAQ,CAC5GpB,OAAQlB,EACRI,QAASkC,KAQPC,EAAqB,IAAIf,qBAAqBC,IAChDA,EAAQC,QAAQC,IACZ,GAAIA,EAAMC,kBAAoB,EAAG,CAC7B,MAAM,OAAEV,GAAWkB,EACdtB,OAAOC,GAAaA,EAAUX,UAAYuB,EAAME,QAChDC,OAAOC,GAAOA,GAQnBb,IAASc,KAAK/B,IACV,MAAM,KAAEuC,GAASb,EAAME,OAAOrB,QAC9BP,EAAOgC,QAAQ,qDAAqDO,OAEpED,EAAmBL,UAAUP,EAAME,cAIhDV,GAEHiB,EAAoBV,QAAQX,IACxBwB,EAAmBJ,QAAQpB,EAAUX,WAvCrCqC,CAAsBtB,EAAgBf,M,qBC3E9C,MAgFMsC,EAAa,CACf,CACIxB,OAZe,IACZ,qCAYHF,KAAM,eAEV,CACIE,OA5EW,IACR,2DA4EHF,KAAM,WAEV,CACIE,OA1FmB,IAChB,2DA0FHF,KAAM,mBAEV,CACIE,OAhEiB,IACd,2DAgEHF,KAAM,iBAEV,CACIE,OA9EgB,IACb,4DA8EHF,KAAM,gBAEV,CACIE,OA9DoB,IACjB,2DA8DHF,KAAM,oBAEV,CACIE,OAxDc,IACX,kEAwDHF,KAAM,eAWdf,EAAOC,QAAU,CACbH,kBALJ,WACI,OAAO2C,GAKP1C,uBA5D2B,IACpB","file":"main-car-airport.6e6c1e398ba9233d661b.bundle.js","sourcesContent":["/* ==========================================================================\n MainCarAirport > Client\n ========================================================================== */\n\n/* Import modules */\nrequire('intersection-observer');\n\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst { resolveComponents, getCardProductCarousel } = require('./components');\n\n/**\n * MainCarContinent component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function MainCarAirport(selector = '[data-component=MainCarAirport]') {\n if (elementExist(selector)) {\n const element = document.querySelector(selector);\n\n const config = {\n ...(function getConfig() {\n if (!element.dataset.config) return '';\n\n const result = JSON.parse(element.dataset.config);\n element.dataset.config = '';\n return result;\n })()\n };\n\n /**\n * Setting public path to the webpack exposed variable\n */\n /* eslint-disable */\n if (config.publicPath) __webpack_public_path__ = config.publicPath;\n /* eslint-enable */\n\n const components = resolveComponents()\n .filter(component => component.name !== 'CardProductCarousel')\n .map(component => ({\n loader: component.loader,\n element: document.querySelector(`[data-component=\"${component.name}\"]`)\n }))\n .filter(component => component.element);\n\n /* Observer Config */\n const observerConfig = {\n root: null, // avoiding 'root' or setting it to 'null' sets it to default value: viewport\n rootMargin: '0px',\n threshold: 0.15\n };\n\n /**\n * Observer to lazy load modules based on\n * currently viewed components in the viewport\n */\n const observer = new IntersectionObserver(entries => {\n entries.forEach(entry => {\n if (entry.intersectionRatio > 0) {\n const { loader } = components\n .filter(component => component.element === entry.target)\n .reduce(acc => acc);\n\n /**\n * Init component with its loader and then\n * unobserve from this entry so we dont\n * call the init of the component more\n * than once\n */\n loader().then(module => {\n module.default();\n\n observer.unobserve(entry.target);\n });\n }\n });\n }, observerConfig);\n\n components.forEach(component => {\n observer.observe(component.element);\n });\n\n /* CardProductCarousel init */\n getCPCarouselObserver(observerConfig, element);\n }\n};\n\nfunction getCPCarouselObserver(observerConfig, element) {\n const cardProductCarousel = [...element.querySelectorAll('[data-component=\"CardProductCarousel\"]')].map(item => ({\n loader: getCardProductCarousel,\n element: item\n }));\n\n /**\n * Since we have multiple of the same component, in this\n * layout the cardProductCarousel component will have its own\n * observer part to handle its dynamic init\n */\n const cPCarouselObserver = new IntersectionObserver(entries => {\n entries.forEach(entry => {\n if (entry.intersectionRatio > 0) {\n const { loader } = cardProductCarousel\n .filter(component => component.element === entry.target)\n .reduce(acc => acc);\n\n /**\n * Init component with its loader and then\n * unobserve from this entry so we dont\n * call the init of the component more\n * than once\n */\n loader().then(module => {\n const { type } = entry.target.dataset;\n module.default(`[data-component=\"CardProductCarousel\"][data-type=\"${type}\"]`);\n\n cPCarouselObserver.unobserve(entry.target);\n });\n }\n });\n }, observerConfig);\n\n cardProductCarousel.forEach(component => {\n cPCarouselObserver.observe(component.element);\n });\n}\n","/* ==========================================================================\n MainCarContinent > Client > Components\n ========================================================================== */\n\n/**\n * HeaderBannerAub\n */\nconst getHeaderBannerAub = () => {\n return import(\n /* webpackChunkName: \"header-banner-aub\" */\n '@logitravel/alex-aubergine/components/header-banner-aub/client/js'\n );\n};\n\n/**\n * BlogAub\n */\nconst getBlogAub = () => {\n return import(\n /* webpackChunkName: \"blog-aub\" */\n '@logitravel/alex-aubergine/components/blog-aub/client/js'\n );\n};\n\n/**\n * VerticalTabs\n */\nconst getVerticalTabs = () => {\n return import(\n /* webpackChunkName: \"vertical-tabs\" */\n '../../../vertical-tabs/client/js'\n );\n};\n\n/**\n * LogosCarousel\n */\nconst getLogosCarousel = () => {\n return import(\n /* webpackChunkName: \"logos-carousel\" */\n '../../../logos-carousel/client/js'\n );\n};\n\n/**\n * BannerHighlights\n */\nconst getBannerHighlights = () => {\n return import(\n /* webpackChunkName: \"banner-highlights\" */\n '../../../banner-highlights/client/js'\n );\n};\n\n/**\n * MapFilters\n */\nconst getMapFilters = () => {\n return import(\n /* webpackChunkName: \"map-filters\" */\n '../../../map-filters/client/js'\n );\n};\n\n/**\n * CardProductCarousel\n */\nconst getCardProductCarousel = () => {\n return import(\n /* webpackChunkName: \"card-product-carousel\" */\n '../../../card-product-carousel/client/js'\n );\n};\n\n/**\n * SearcherCar\n */\nconst getSearcherCar = () => {\n return import(\n /* webpackChunkName: \"searcher-car\" */\n '../../../searcher-car/client/js'\n );\n};\n\n/**\n * Components\n */\nconst COMPONENTS = [\n {\n loader: getSearcherCar,\n name: 'SearcherCar'\n },\n {\n loader: getBlogAub,\n name: 'BlogAub'\n },\n {\n loader: getHeaderBannerAub,\n name: 'HeaderBannerAub'\n },\n {\n loader: getLogosCarousel,\n name: 'LogosCarousel'\n },\n {\n loader: getVerticalTabs,\n name: 'VerticalTabs'\n },\n {\n loader: getBannerHighlights,\n name: 'BannerHighlights'\n },\n {\n loader: getMapFilters,\n name: 'MapFilters'\n }\n];\n\n/**\n * Resolve components\n */\nfunction resolveComponents() {\n return COMPONENTS;\n}\n\nmodule.exports = {\n resolveComponents,\n getCardProductCarousel\n};\n"],"sourceRoot":""}