{"version":3,"sources":["webpack:///./node_modules/@logitravel/alex-comp-trans/components/main-car-continent/client/js/components.js","webpack:///./node_modules/@logitravel/alex-comp-trans/components/main-car-continent/client/js/index.js"],"names":["COMPONENTS","loader","name","module","exports","resolveComponents","elementExist","selector","element","document","querySelector","config","dataset","result","JSON","parse","publicPath","components","filter","component","map","observerConfig","root","rootMargin","threshold","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","reduce","acc","then","default","unobserve","observe"],"mappings":";8EAOA,MAsEMA,EAAa,CACf,CACIC,OA1Ce,IACZ,qCA0CHC,KAAM,eAEV,CACID,OA5EmB,IAChB,2DA4EHC,KAAM,mBAEV,CACID,OAxCuB,IACpB,4DAwCHC,KAAM,uBAEV,CACID,OAlCiC,IAC9B,2DAkCHC,KAAM,iCAEV,CACID,OA9EoB,IACjB,2DA8EHC,KAAM,oBAEV,CACID,OAxEW,IACR,2DAwEHC,KAAM,WAEV,CACID,OApCgB,IACb,4DAoCHC,KAAM,iBAWdC,EAAOC,QAAU,CACbC,kBALJ,WACI,OAAOL,K,qBC3GX,EAAQ,QAER,MAAM,aAAEM,GAAiB,EAAQ,SAE3B,kBAAED,GAAsB,EAAQ,QAMtCF,EAAOC,QAAU,SAA0BG,EAAW,qCAClD,GAAID,EAAaC,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,EAAaZ,IACda,OAAOC,GAAgC,qBAAnBA,EAAUjB,MAC9BkB,IAAID,IAAa,CACdlB,OAAQkB,EAAUlB,OAClBO,QAASC,SAASC,cAAc,oBAAoBS,EAAUjB,aAEjEgB,OAAOC,GAAaA,EAAUX,SAG7Ba,EAAiB,CACnBC,KAAM,KACNC,WAAY,MACZC,UAAW,KAOTC,EAAW,IAAIC,qBACjBC,IACIA,EAAQC,QAAQC,IACZ,GAAIA,EAAMC,kBAAoB,EAAG,CAC7B,MAAM,OAAE7B,GAAWgB,EACdC,OAAOC,GAAaA,EAAUX,UAAYqB,EAAME,QAChDC,OAAOC,GAAOA,GAQnBhC,IAASiC,KAAK/B,IACVA,EAAOgC,UAEPV,EAASW,UAAUP,EAAME,YAGlCV,IAEP,CACIC,KAAM,KACNC,WAAY,MACZC,UAAW,MAInBP,EAAWW,QAAQT,IACfM,EAASY,QAAQlB,EAAUX","file":"main-car-continent.1fd05d34da5a0dcdf5e1.bundle.js","sourcesContent":["/* ==========================================================================\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 * BannerHighlights\n */\nconst getBannerHighlights = () => {\n    return import(\n        /* webpackChunkName: \"banner-highlights\" */\n        '../../../banner-highlights/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 * SearcherCar\n */\nconst getSearcherCar = () => {\n    return import(\n        /* webpackChunkName: \"searcher-car\" */\n        '../../../searcher-car/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 * CardProductHorizontalCarousel\n */\nconst getCardProductHorizontalCarousel = () => {\n    return import(\n        /* webpackChunkName: \"card-product-horizontal-carousel\" */\n        '../../../card-product-horizontal-carousel/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 * Components\n */\nconst COMPONENTS = [\n    {\n        loader: getSearcherCar,\n        name: 'SearcherCar'\n    },\n    {\n        loader: getHeaderBannerAub,\n        name: 'HeaderBannerAub'\n    },\n    {\n        loader: getCardProductCarousel,\n        name: 'CardProductCarousel'\n    },\n    {\n        loader: getCardProductHorizontalCarousel,\n        name: 'CardProductHorizontalCarousel'\n    },\n    {\n        loader: getBannerHighlights,\n        name: 'BannerHighlights'\n    },\n    {\n        loader: getBlogAub,\n        name: 'BlogAub'\n    },\n    {\n        loader: getVerticalTabs,\n        name: 'VerticalTabs'\n    }\n];\n\n/**\n * Resolve components\n */\nfunction resolveComponents() {\n    return COMPONENTS;\n}\n\nmodule.exports = {\n    resolveComponents\n};\n","/* ==========================================================================\n   MainCarContinent > Client\n   ========================================================================== */\n\n/* Import modules */\nrequire('intersection-observer');\n\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst { resolveComponents } = require('./components');\n\n/**\n * MainCarContinent component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function MainCarContinent(selector = '[data-component=MainCarContinent]') {\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 !== 'CardExtendedTabs')\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(\n            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                }, observerConfig);\n            },\n            {\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        components.forEach(component => {\n            observer.observe(component.element);\n        });\n    }\n};\n"],"sourceRoot":""}