{"version":3,"sources":["webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/radio-button/client/js/index.js","webpack:///./node_modules/@logitravel/alexandria-contrib-components-packages/components/searcher-multi-pak/client/js/config.js","webpack:///./node_modules/@logitravel/alexandria-contrib-components-packages/components/searcher-multi-pak/client/js/index.js","webpack:///./node_modules/@logitravel/alexandria-contrib-components-packages/components/searcher-multi-pak/client/js/radio-button.js","webpack:///./node_modules/@bluekiri/alexandria-contrib-components/components/radio-button/client/js/prototype.js"],"names":["randomId","elementExist","baseConfig","prototype","module","exports","selector","configuration","instance","Object","create","config","element","document","querySelector","id","dataset","error","value","getInput","init","type","flightHotel","ferryHotel","trainHotel","busHotel","product","component","css","radioButton","row","hidden","visible","load","toNode","SearcherTouTemplate","SearcherTouClient","initRadioButton","initFlightHotel","initFerryHotel","initTrainHotel","initBusHotel","hooks","searcherTou","result","JSON","parse","elementSearcher","classList","add","hookSearcherTou","context","template","node","remove","appendChild","addSearcherTou","undefined","initSearcherFlightHotel","initSearcherFerryHotel","initSearcherTraintHotel","initSearcherBusHotel","initSearchers","RadioButtonClient","clickRadioButton","position","slides","querySelectorAll","splice","forEach","item","map","i","onChange","index","isChecked","setName","name","this","setAttribute","setPairing","addEventListener"],"mappings":";+EAAA,MAAM,SAAEA,GAAa,EAAQ,SACvB,aAAEC,GAAiB,EAAQ,QAC3BC,EAAa,EAAQ,QACrBC,EAAY,EAAQ,QAE1BC,EAAOC,QAAU,SAA2BC,EAAW,iCAAkCC,EAAgB,IACrG,GAAIN,EAAaK,GAAW,CAExB,MAAME,EAAWC,OAAOC,OAAOP,GAoB/B,OAjBAK,EAASG,OAAS,IAAKT,KAAeK,GAGtCC,EAASI,QAAUC,SAASC,cAAcR,GAG1CE,EAASO,GAAKP,EAASI,QAAQI,QAAQD,IAAMf,EAAS,gBAGtDQ,EAASS,OAAQ,EAGjBT,EAASU,MAAQV,EAASW,WAAWD,MAGjCV,EAASG,OAAOS,MAAMZ,EAASY,OAE5BZ,K,mB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/dataHelpers');\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst baseConfig = require('../../../input/client/js/config');\nconst prototype = require('./prototype');\n\nmodule.exports = function RadioButtonClient(selector = '[data-component=\"RadioButton\"]', configuration = {}) {\n if (elementExist(selector)) {\n // Extend the proto input base with specific methods\n const instance = Object.create(prototype);\n\n // Config\n instance.config = { ...baseConfig, ...configuration };\n\n // Element reference\n instance.element = document.querySelector(selector);\n\n // Id reference\n instance.id = instance.element.dataset.id || randomId('radio-button');\n\n // Init error handler\n instance.error = false;\n\n // Value reference\n instance.value = instance.getInput().value;\n\n // Auto init\n if (instance.config.init) instance.init();\n\n return instance;\n }\n};\n","/* ==========================================================================\n SearcherFlight > Config\n ========================================================================== */\n\n/* Configuration */\nconst configuration = {\n type: {\n flightHotel: 'multi-pak-flight',\n ferryHotel: 'multi-pak-ferry',\n trainHotel: 'multi-pak-train',\n busHotel: 'multi-pak-bus',\n product: 'product'\n },\n component: {\n flightHotel: 'SearcherFlightHotel',\n ferryHotel: 'SearcherFerryHotel',\n trainHotel: 'SearcherTrainHotel',\n busHotel: 'SearcherBusHotel'\n },\n css: {\n flightHotel: 'multi-pak-flight',\n ferryHotel: 'multi-pak-ferry',\n trainHotel: 'multi-pak-train',\n busHotel: 'multi-pak-bus',\n radioButton: 'searcher-multi-pak__radio-button',\n row: 'searcher__row',\n hidden: 'is-hidden',\n visible: 'is-visible',\n load: 'is-load'\n }\n};\n\nconst config = () => configuration;\n\nmodule.exports = config;\n","/* ==========================================================================\n MultisearcherPak > Client\n ========================================================================== */\n\n/* Import modules */\nconst { toNode } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\nconst SearcherTouTemplate = require('@logitravel/alex-aubergine/components/searcher-tou/template');\nconst SearcherTouClient = require('@logitravel/alex-aubergine/components/searcher-tou/client/js');\n\nconst { initRadioButton } = require('./radio-button');\nconst initFlightHotel = require('../../../searcher-flight-hotel/client/js');\nconst initFerryHotel = require('../../../searcher-ferry-hotel/client/js');\nconst initTrainHotel = require('../../../searcher-train-hotel/client/js');\nconst initBusHotel = require('../../../searcher-bus-hotel/client/js');\n\nconst config = require('./config');\n\nfunction addSearcherTou(instance) {\n const hookSearcherTou = document.querySelector(`${instance.selector} [data-searcher-tou]`);\n\n if (hookSearcherTou) {\n const result = instance;\n\n const { context = {}, searcherTou } = instance.config;\n const template = SearcherTouTemplate(searcherTou, context);\n\n const node = toNode(template)[0];\n\n hookSearcherTou.classList.remove('is-hidden');\n hookSearcherTou.appendChild(node);\n\n result.searcherTou = SearcherTouClient(`${instance.selector} [data-component=\"SearcherTou\"]`);\n }\n}\n\n/**\n * MultisearcherPak component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function SearcherMultiPak(selector = '[data-component=\"SearcherMultiPak\"]', configuration = {}) {\n if (elementExist(selector)) {\n // Instance reference\n const instance = {};\n\n // Element reference\n instance.element = document.querySelector(selector);\n\n instance.selector = selector;\n\n instance.hooks = {\n searcherTou: instance.element.querySelector('[data-searcher-tou]')\n };\n\n /* Config */\n instance.config = {\n ...config(),\n ...configuration,\n ...(function getConfig() {\n if (!instance.element.dataset.config) return '';\n\n const result = JSON.parse(instance.element.dataset.config);\n instance.element.dataset.config = '';\n return result;\n })()\n };\n\n // Radio button\n instance.product = initRadioButton(instance);\n\n /* Searchers */\n initSearchers(instance);\n\n return instance;\n }\n};\n\nfunction initSearcherFlightHotel(instance) {\n const { selector } = instance;\n\n const flightHotel = instance.element.querySelector(\n `${selector} [data-component=\"${config().component.flightHotel}\"]`\n );\n\n if (flightHotel !== undefined) {\n initFlightHotel(`${selector} [data-component=\"${config().component.flightHotel}\"]`);\n }\n}\n\nfunction initSearcherFerryHotel(instance) {\n const { selector } = instance;\n\n const ferryHotel = instance.element.querySelector(\n `${selector} [data-component=\"${config().component.ferryHotel}\"]`\n );\n\n if (ferryHotel !== undefined) {\n initFerryHotel(`${selector} [data-component=\"${config().component.ferryHotel}\"]`);\n }\n}\n\nfunction initSearcherTraintHotel(instance) {\n const { selector } = instance;\n\n const trainHotel = instance.element.querySelector(\n `${selector} [data-component=\"${config().component.trainHotel}\"]`\n );\n\n if (trainHotel !== undefined) {\n initTrainHotel(`${selector} [data-component=\"${config().component.trainHotel}\"]`);\n }\n}\n\nfunction initSearcherBusHotel(instance) {\n const { selector } = instance;\n\n const busHotel = instance.element.querySelector(`${selector} [data-component=\"${config().component.busHotel}\"]`);\n\n if (busHotel !== undefined) {\n initBusHotel(`${selector} [data-component=\"${config().component.busHotel}\"]`);\n }\n}\n\nfunction initSearchers(instance) {\n const { selector } = instance;\n\n const elementSearcher = document.querySelector(`${selector} form[data-component]`);\n\n if (elementSearcher) {\n elementSearcher.classList.add(config().css.load);\n } else {\n addSearcherTou(instance);\n }\n\n /* Flight Hotel */\n initSearcherFlightHotel(instance);\n\n /* Ferry Hotel */\n initSearcherFerryHotel(instance);\n\n /* Train Hotel */\n initSearcherTraintHotel(instance);\n\n /* Bus Hotel */\n initSearcherBusHotel(instance);\n}\n","/* ==========================================================================\n SearcherFlight > Radio button\n ========================================================================== */\n\n/* Modules */\nconst { toNode } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst RadioButtonClient = require('@bluekiri/alexandria-contrib-components/components/radio-button/client/js');\nconst SearcherTouTemplate = require('@logitravel/alex-aubergine/components/searcher-tou/template');\nconst SearcherTouClient = require('@logitravel/alex-aubergine/components/searcher-tou/client/js');\n\nconst config = require('./config');\n\n/* Init */\nfunction initRadioButton(instance) {\n /* Radio button */\n const products = [...instance.element.querySelectorAll('[data-component=\"RadioButton\"]')].map((item, i) => {\n const type = item.dataset.type || false;\n const selector = `[data-component=\"RadioButton\"][data-type=\"${type}\"]`;\n\n return RadioButtonClient(selector, {\n onChange: [\n () => {\n clickRadioButton(instance, i);\n }\n ]\n });\n });\n\n products.forEach((item, index) => {\n if (item.isChecked()) clickRadioButton(instance, index);\n });\n}\n\nfunction addSearcherTou(instance) {\n const result = instance;\n const { config: configuration = {}, hooks = {}, selector } = instance;\n const { context = {}, searcherTou } = configuration;\n\n if (hooks.searcherTou && searcherTou && !instance.searcherTou) {\n const template = SearcherTouTemplate(searcherTou, context);\n\n const node = toNode(template)[0];\n\n hooks.searcherTou.appendChild(node);\n\n result.searcherTou = SearcherTouClient(`${selector} [data-component=\"SearcherTou\"]`);\n }\n}\n\n/* function change for searcher */\nfunction clickRadioButton(instance, position) {\n const slides = [...instance.element.querySelectorAll('[data-type=\"slide\"]')];\n\n if (slides[position] !== undefined) {\n slides[position].classList.remove(config().css.hidden);\n slides[position].classList.add(config().css.visible);\n\n if (slides[position].dataset.searcherTou === '') addSearcherTou(instance);\n\n // show slide\n slides.splice(position, 1);\n\n // hide slides\n slides.forEach(item => {\n item.classList.add(config().css.hidden);\n });\n }\n}\n\nmodule.exports = {\n initRadioButton\n};\n","/* ==========================================================================\n Radio button > Prototype\n ========================================================================== */\nconst inputPrototype = require('../../../input/client/js/prototype');\nconst checkBoxPrototype = require('../../../checkbox/client/js/prototype');\n\nconst radioButton = {\n ...inputPrototype,\n ...checkBoxPrototype,\n setName: function Fn(name = 'radio-default') {\n this.getInput().setAttribute('name', name);\n\n return this;\n },\n\n init: function Fn() {\n // Connect the label in case it has it with its input\n this.setPairing();\n\n // Adding listener\n this.addEventListener();\n }\n};\n\nmodule.exports = radioButton;\n"],"sourceRoot":""}