{"version":3,"sources":["webpack:///./node_modules/@logitravel/alex-comp-trans/components/main-car-company-country/client/js/index.js","webpack:///./node_modules/@logitravel/alex-comp-trans/components/main-car-company-country/client/js/components.js"],"names":["elementExist","resolveComponents","getSearcherCar","module","exports","selector","element","document","querySelector","config","dataset","result","JSON","parse","publicPath","components","map","component","loader","name","filter","observerConfig","root","rootMargin","threshold","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","reduce","acc","then","default","unobserve","observe","COMPONENTS"],"mappings":";8EAKA,EAAQ,QAER,MAAM,aAAEA,GAAiB,EAAQ,SAE3B,kBAAEC,EAAiB,eAAEC,GAAmB,EAAQ,QAMtDC,EAAOC,QAAU,SAA+BC,EAAW,0CACvD,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,IAAIC,IAAa,CACdC,OAAQD,EAAUC,OAClBZ,QAASC,SAASC,cAAc,oBAAoBS,EAAUE,aAEjEC,OAAOH,GAAaA,EAAUX,SAG7Be,EAAiB,CACnBC,KAAM,KACNC,WAAY,MACZC,UAAW,KAOTC,EAAW,IAAIC,qBACjBC,IACIA,EAAQC,QAAQC,IACZ,GAAIA,EAAMC,kBAAoB,EAAG,CAC7B,MAAM,OAAEZ,GAAWH,EACdK,OAAOH,GAAaA,EAAUX,UAAYuB,EAAME,QAChDC,OAAOC,GAAOA,GAQnBf,IAASgB,KAAK/B,IACVA,EAAOgC,UAEPV,EAASW,UAAUP,EAAME,YAGlCV,IAEP,CACIC,KAAM,KACNC,WAAY,MACZC,UAAW,MAInBT,EAAWa,QAAQX,IACfQ,EAASY,QAAQpB,EAAUX,WAI/BJ,IAAiBgC,KAAK/B,GAAUA,EAAOgC,QAAQ,oC,qBCjFvD,MAsEMG,EAAa,CACf,CACIpB,OAxEmB,IAChB,2DAwEHC,KAAM,mBAEV,CACID,OA9CuB,IACpB,mEA8CHC,KAAM,uBAEV,CACID,OAxCiB,IACd,4DAwCHC,KAAM,iBAEV,CACID,OAlCW,IACR,4DAkCHC,KAAM,WAEV,CACID,OA9EW,IACR,2DA8EHC,KAAM,WAEV,CACID,OAhCoB,IACjB,2DAgCHC,KAAM,qBAWdhB,EAAOC,QAAU,CACbH,kBALJ,WACI,OAAOqC,GAKPpC,eAtFmB,IACZ","file":"main-car-company-country.fd109812a705d432f5bb.bundle.js","sourcesContent":["/* ==========================================================================\n MainCarCompanyCountry > Client\n ========================================================================== */\n\n/* Import modules */\nrequire('intersection-observer');\n\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst { resolveComponents, getSearcherCar } = require('./components');\n\n/**\n * MainCarCompanyCountry component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function MainCarCompanyCountry(selector = '[data-component=MainCarCompanyCountry]') {\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 .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 /* Searcher Car */\n getSearcherCar().then(module => module.default('[data-component=SearcherCar]'));\n }\n};\n","/* ==========================================================================\n MainCarCompanyCountry > 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 * 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 * FleetListTabs\n */\nconst getFleetListTabs = () => {\n return import(\n /* webpackChunkName: \"fleet-list-tabs\" */\n '../../../fleet-list-tabs/client/js'\n );\n};\n\n/**\n * Reviews\n */\nconst getReviews = () => {\n return import(\n /* webpackChunkName: \"reviews\" */\n '../../../reviews/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 * Components\n */\nconst COMPONENTS = [\n {\n loader: getHeaderBannerAub,\n name: 'HeaderBannerAub'\n },\n {\n loader: getCardProductCarousel,\n name: 'CardProductCarousel'\n },\n {\n loader: getFleetListTabs,\n name: 'FleetListTabs'\n },\n {\n loader: getReviews,\n name: 'Reviews'\n },\n {\n loader: getBlogAub,\n name: 'BlogAub'\n },\n {\n loader: getBannerHighlights,\n name: 'BannerHighlights'\n }\n];\n\n/**\n * Resolve components\n */\nfunction resolveComponents() {\n return COMPONENTS;\n}\n\nmodule.exports = {\n resolveComponents,\n getSearcherCar\n};\n"],"sourceRoot":""}