{"version":3,"sources":["webpack:///./components/layout-request-cru/client/js/index.js","webpack:///./template/js/index.js","webpack:///./template/js/components.js"],"names":["MainComponent","require","LayoutTemplate","elementExist","_require2","resolveComponents","getTopButton","module","exports","mainFunction","selector","arguments","length","undefined","element","document","querySelector","config","_objectSpread","dataset","result","JSON","parse","__webpack_public_path__","publicPath","components","map","component","loader","concat","name","filter","then","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","reduce","acc","setTimeout","window","dispatchEvent","Event","unobserve","root","rootMargin","threshold","observe","COMPONENTS"],"mappings":";gJAAA,IAAMA,EAAgB,WAAH,OACf,gEAKmBC,EAAQ,IAGpBC,CAAeF,I,uvCCJ1BC,EAAQ,KAER,IAAQE,EAAiBF,EAAQ,GAAzBE,aAERC,EAA4CH,EAAQ,KAA5CI,EAAiBD,EAAjBC,kBAAmBC,EAAYF,EAAZE,aAE3BC,EAAOC,QAAU,SAAwBC,GAA8D,IAAhDC,EAAQC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,oCAC9D,GAAIR,EAAaO,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,IAaRG,IAA0BN,EAAOO,WAGjC,IAAMC,EAAapB,IACdqB,KAAI,SAAAC,GAAS,MAAK,CACfC,OAAQD,EAAUC,OAClBd,QAASC,SAASC,cAAc,oBAADa,OAAqBF,EAAUG,KAAI,WAErEC,QAAO,SAAAJ,GAAS,OAAIA,EAAUb,WAKnCL,IAAeuB,MAAK,SAAAzB,GAAM,OAAIA,EAAM,aAMpC,IAAM0B,EAAW,IAAIC,sBACjB,SAAAC,GACIA,EAAQC,SAAQ,SAAAC,GACRA,EAAMC,kBAAoB,IAW1BV,EAVmBH,EACdM,QAAO,SAAAJ,GAAS,OAAIA,EAAUb,UAAYuB,EAAME,UAChDC,QAAO,SAAAC,GAAG,OAAIA,KAFXb,UAUCI,MAAK,SAAAzB,GACVA,EAAM,UAENmC,YAAW,kBAAMC,OAAOC,cAAc,IAAIC,MAAM,aAAY,KAE5DZ,EAASa,UAAUT,EAAME,gBAKzC,CACIQ,KAAM,KACNC,WAAY,MACZC,UAAW,MAInBxB,EAAWW,SAAQ,SAAAT,GACfM,EAASiB,QAAQvB,EAAUb,YAI/BR,IAAe0B,MAAK,SAAAzB,GAAM,OAAIA,EAAM,gB,oBC7E5C,IAwCM4C,EAAa,CACf,CACIvB,OA1Ca,WACjB,OAAO,gEA0CHE,KAAM,aAEV,CACIF,OApCa,WACjB,OAAO,yDAoCHE,KAAM,aAEV,CACIF,OApByB,WAC7B,OAAO,yDAoBHE,KAAM,0BAYdvB,EAAOC,QAAU,CACbF,aA5CiB,WACjB,OAAO,mCA4CPD,kBAPJ,WACI,OAAO8C,M","file":"index.bundle.js","sourcesContent":["const MainComponent = () =>\n import(\n /* webpackChunkName: \"main-request-cru\" */\n '@logitravel/alex-comp-cru/components/main-request-cru/client/js'\n );\n\nconst LayoutTemplate = require('../../../../template/js');\n\n(function InitLayout() {\n return LayoutTemplate(MainComponent);\n})();\n","/* ==========================================================================\n LayoutTemplate > Client\n ========================================================================== */\n\n/* Modules */\nrequire('intersection-observer');\n\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst { resolveComponents, getTopButton } = require('./components');\n\nmodule.exports = function LayoutTemplate(mainFunction, selector = '[data-component=\"LayoutTemplate\"]') {\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 __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 * Execute main function\n */\n mainFunction().then(module => module.default());\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 setTimeout(() => window.dispatchEvent(new Event('resize')), 1000);\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 /* TopButton */\n getTopButton().then(module => module.default());\n }\n};\n","/* ==========================================================================\n LayoutTemplate > Client > Components\n ========================================================================== */\n\n/**\n * HeaderByl\n */\nconst getHeaderByl = () => {\n return import(\n /* webpackChunkName: \"header-byl\" */\n '@logitravel/alex-contrib-bylogi/components/header-byl/client/js'\n );\n};\n\n/**\n * Footerbyl\n */\nconst getFooterByl = () => {\n return import(\n /* webpackChunkName: \"footer-byl\" */\n '@logitravel/alex-contrib-bylogi/components/footer-byl/client/js'\n );\n};\n\n/**\n * TopButton\n */\nconst getTopButton = () => {\n return import(\n /* webpackChunkName: \"top-button\" */\n '@bluekiri/alexandria-contrib-components/components/top-button/client/js'\n );\n};\n\n/**\n * CruisesCertifications\n */\nconst getCruisesCertifications = () => {\n return import(\n /* webpackChunkName: \"cruises-certifications\" */\n '@logitravel/alex-comp-cru/components/cruises-certifications/client/js'\n );\n};\n\n/**\n * Components\n */\nconst COMPONENTS = [\n {\n loader: getHeaderByl,\n name: 'HeaderByl'\n },\n {\n loader: getFooterByl,\n name: 'FooterByl'\n },\n {\n loader: getCruisesCertifications,\n name: 'CruisesCertifications'\n }\n];\n\n/**\n * Resolver components\n */\nfunction resolveComponents() {\n return COMPONENTS;\n}\n\n/* Exports */\nmodule.exports = {\n getTopButton,\n resolveComponents\n};\n"],"sourceRoot":""}