{"version":3,"sources":["webpack:///./node_modules/@logitravel/alex-comp-cru/components/main-company-port-cru/client/js/index.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/main-company-port-cru/client/js/components.js"],"names":["require","elementExist","_require2","resolveComponents","getClickToCall","module","exports","selector","arguments","length","undefined","element","document","querySelector","config","_objectSpread","dataset","result","JSON","parse","publicPath","__webpack_public_path__","components","map","component","loader","concat","name","filter","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","reduce","acc","then","default","unobserve","root","rootMargin","threshold","observe","COMPONENTS"],"mappings":";iwBAKAA,EAAQ,QAER,IAAQC,EAAiBD,EAAQ,QAAzBC,aAERC,EAA8CF,EAAQ,QAA9CG,EAAiBD,EAAjBC,kBAAmBC,EAAcF,EAAdE,eAM3BC,EAAOC,QAAU,WAAgF,IAApDC,EAAQC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,wCACpD,GAAIP,EAAaM,GAAW,CACxB,IAAMI,EAAUC,SAASC,cAAcN,GAEjCO,EAAMC,EAAA,GACJ,WACA,IAAKJ,EAAQK,QAAQF,OAAQ,MAAO,GAEpC,IAAMG,EAASC,KAAKC,MAAMR,EAAQK,QAAQF,QAE1C,OADAH,EAAQK,QAAQF,OAAS,GAClBG,EALP,IAaJH,EAAOM,aAAYC,IAA0BP,EAAOM,YAGxD,IAAME,EAAanB,IACdoB,KAAI,SAAAC,GAAS,MAAK,CACfC,OAAQD,EAAUC,OAClBd,QAASC,SAASC,cAAc,oBAADa,OAAqBF,EAAUG,KAAI,WAErEC,QAAO,SAAAJ,GAAS,OAAIA,EAAUb,WAM7BkB,EAAW,IAAIC,sBACjB,SAAAC,GACIA,EAAQC,SAAQ,SAAAC,GACRA,EAAMC,kBAAoB,IAW1BT,EAVmBH,EACdM,QAAO,SAAAJ,GAAS,OAAIA,EAAUb,UAAYsB,EAAME,UAChDC,QAAO,SAAAC,GAAG,OAAIA,KAFXZ,UAUCa,MAAK,SAAAjC,GACVA,EAAOkC,UAEPV,EAASW,UAAUP,EAAME,gBAKzC,CACIM,KAAM,KACNC,WAAY,MACZC,UAAW,MAInBrB,EAAWU,SAAQ,SAAAR,GACfK,EAASe,QAAQpB,EAAUb,YAI/BP,IAAiBkC,MAAK,SAAAjC,GAAM,OAAIA,EAAOkC,gB,uEC9E/C,IAsEMM,EAAa,CACf,CACIpB,OApDoB,WACxB,OAAO,6DAoDHE,KAAM,oBAEV,CACIF,OAlEgB,WACpB,OAAO,4DAkEHE,KAAM,gBAEV,CACIF,OAxCmB,WACvB,OAAO,4DAwCHE,KAAM,mBAEV,CACIF,OAtDa,WACjB,OAAO,oEAsDHE,KAAM,aAEV,CACIF,OA5BmB,WACvB,OAAO,oEA4BHE,KAAM,mBAEV,CACIF,OA1CkB,WACtB,OAAO,oEA0CHE,KAAM,mBAWdtB,EAAOC,QAAU,CACbH,kBALJ,WACI,OAAO0C,GAKPzC,eA1GmB,WACnB,OAAO","file":"main-company-port-cru.e5428ab87960d23f8f11.bundle.js","sourcesContent":["/* ==========================================================================\n MainCompanyPortCru > Client\n ========================================================================== */\n\n/* Modules */\nrequire('intersection-observer');\n\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst { resolveComponents, getClickToCall } = require('./components');\n\n/**\n * MainCompanyPortCru component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function MainCompanyPortCru(selector = '[data-component=\"MainCompanyPortCru\"]') {\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 /**\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 });\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 /* ClickToCall */\n getClickToCall().then(module => module.default());\n }\n};\n","/**\n * ClickToCall\n */\nconst getClickToCall = () => {\n return import(\n /* webpackChunkName: \"click-to-call\" */\n '@bluekiri/alexandria-contrib-components/components/click-to-call/client/js'\n );\n};\n\n/**\n * HeaderBanner\n */\nconst getHeaderBanner = () => {\n return import(\n /* webpackChunkName: \"header-banner\" */\n '../../../header-banner/client/js'\n );\n};\n\n/**\n * BreadcrumbsIdCru\n */\nconst getBreadcrumbsIdCru = () => {\n return import(\n /* webpackChunkName: \"breadcrumbs-id-cru\" */\n '../../../breadcrumbs-id-cru/client/js'\n );\n};\n\n/**\n * TextMedia\n */\nconst getTextMedia = () => {\n return import(\n /* webpackChunkName: \"text-media\" */\n '../../../text-media/client/js'\n );\n};\n\n/**\n * NewsletterAgent\n */\nconst getNewsletterAgent = () => {\n return import(\n /* webpackChunkName: \"newsletter-agent\" */\n '../../../newsletter-agent/client/js'\n );\n};\n\n/**\n * CarouselBanner\n */\nconst getCarouselBanner = () => {\n return import(\n /* webpackChunkName: \"carousel-banner\" */\n '../../../carousel-banner/client/js'\n );\n};\n\n/**\n * SearcherSection\n */\nconst getSearcherSection = () => {\n return import(\n /* webpackChunkName: \"searcher-section\" */\n '../../../searcher-section/client/js'\n );\n};\n\n/**\n * Components\n */\nconst COMPONENTS = [\n {\n loader: getBreadcrumbsIdCru,\n name: 'BreadcrumbsIdCru'\n },\n {\n loader: getHeaderBanner,\n name: 'HeaderBanner'\n },\n {\n loader: getNewsletterAgent,\n name: 'NewsletterAgent'\n },\n {\n loader: getTextMedia,\n name: 'TextMedia'\n },\n {\n loader: getSearcherSection,\n name: 'SearcherSection'\n },\n {\n loader: getCarouselBanner,\n name: 'CarouselBanner'\n }\n];\n\n/**\n * Resolver components\n */\nfunction resolveComponents() {\n return COMPONENTS;\n}\n\nmodule.exports = {\n resolveComponents,\n getClickToCall\n};\n"],"sourceRoot":""}