{"version":3,"sources":["webpack:///./node_modules/@logitravel/alex-comp-cru/components/company-gallery/client/js/prototype.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/company-gallery/client/js/index.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/company-gallery/client/js/config.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/company-gallery/client/js/store/reducer.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/company-gallery/client/js/store/actions.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/company-gallery/client/js/gallery/index.js"],"names":["fromEvent","require","map","Store","_require4","actions","types","reducer","addGallery","prototype","setupStore","this","store","data","setupActions","_this","destroy","dispatch","setupReactions","_this2","reactions","subscribe","state","action","type","DESTROY","unsubscribe","_toConsumableArray","Object","keys","forEach","key","element","parentNode","removeChild","_this3","subscriptions","hooks","galleryTrigger","galleryClick","pipe","e","target","closest","dataset","_this4","start","config","init","module","exports","elementExist","ImageClient","selector","arguments","length","undefined","configuration","instance","create","document","querySelector","_objectSpread","result","JSON","parse","image","concat","imageTwo","component","css","imgConfig","width","height","imgTwoConfig","initialState","html","toNode","GalActions","GalleryTempalte","Gallery","sanitizeObject","index","panel","node","_instance$config","gallery","context","template","items","item","createGallery","body","appendChild","photoswipe","hideGallery"],"mappings":";sIAKA,IAAQA,EAAcC,EAAQ,QAAtBD,UACAE,EAAQD,EAAQ,QAAhBC,IAEAC,EAAUF,EAAQ,QAAlBE,MAERC,EAA2BH,EAAQ,QAA3BI,EAAOD,EAAPC,QAASC,EAAKF,EAALE,MACTC,EAAYN,EAAQ,QAApBM,QAEAC,EAAeP,EAAQ,QAAvBO,WAGFC,EAAY,CAEdC,WAAU,WACN,OAAIC,KAAKC,QAETD,KAAKC,MAAQ,IAAIT,EAAM,CACnBU,KAAMN,KAHaI,MAS3BG,aAAY,WAAG,IAAAC,EAAA,KACX,OAAIJ,KAAKN,UAETM,KAAKN,QAAU,CACXW,QAAS,WACL,OAAOD,EAAKH,MAAMK,SAASZ,EAAQ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QAAU,CACb5C,MAAO,CACHmB,WAEJpB,QAAS,CACLW,QARQ,WAAH,MAAU,CAAEQ,KAAMC,O,orBCH/B,IAAQmD,EAAS3E,EAAQ,QAAjB2E,KACAC,EAAW5E,EAAQ,QAAnB4E,OAEFC,EAAa7E,EAAQ,QACrB8E,EAAkB9E,EAAQ,QAC1B+E,EAAU/E,EAAQ,QAChBgF,EAAmBhF,EAAQ,QAA3BgF,eAmDRhC,EAAOC,QAAU,CACb1C,WA7BJ,SAAoBkD,EAAUwB,GAC1B,IAAMC,EAAQzB,EAGR0B,EAxBV,SAAuB1B,GAEnB,IAAA2B,EAA6B3B,EAASX,OAA9BuC,EAAOD,EAAPC,QAASC,EAAOF,EAAPE,QAGXC,EAAWZ,EACbG,EACI,CAAEU,MAAOH,EAAQpF,KAAI,SAAAwF,GAAI,OAAIT,EAAcnB,IAAC,GAAK4B,GAAUA,EAAK3C,OAAS2C,EAAK3C,OAAS,SACvFwC,IAQR,OAHaV,EAAOW,GAAU,GAWjBG,CAAcjC,GAG3BE,SAASgC,KAAKC,YAAYT,GAG1BD,EAAMG,QAAUN,EAAQ,iCAAkC,CACtDc,WAAY,CACRZ,WAKRC,EAAM/D,UAAS0C,IAAA,GACRqB,EAAM/D,WAAS,IAClB2E,YAAaZ,EAAMG,QAAQ1E,MAAMS,WAAU,SAACC,EAAOC,GAC3CA,EAAOC,OAASsD,EAAWxE,MAAMmB,gBAE9B0D,EAAMG","file":"company-gallery.fd4b2d34e4e5fbe308fb.bundle.js","sourcesContent":["/* ==========================================================================\n CompanyGallery > Client > Prototype\n ========================================================================== */\n\n/* Import modules */\nconst { fromEvent } = require('rxjs');\nconst { map } = require('rxjs/operators');\n\nconst { Store } = require('@bluekiri/alexandria/helpers/state');\n\nconst { actions, types } = require('./store/actions');\nconst { reducer } = require('./store/reducer');\n\nconst { addGallery } = require('./gallery');\n\n/* Prototype */\nconst prototype = {\n /* Setup store */\n setupStore() {\n if (this.store) return this;\n\n this.store = new Store({\n data: reducer\n });\n\n return this;\n },\n /* Setup actions */\n setupActions() {\n if (this.actions) return this;\n\n this.actions = {\n destroy: () => {\n return this.store.dispatch(actions.destroy());\n }\n };\n\n return this;\n },\n /* Setup reactions */\n setupReactions() {\n if (this.reactions) return this;\n\n this.reactions = {\n destroy: this.store.subscribe((state, action) => {\n if (action.type !== types.DESTROY) return;\n\n /* Unsubscribe */\n this.unsubscribe();\n [...Object.keys(this.reactions)].forEach(key => this.reactions[key].unsubscribe());\n\n /* Clean DOM */\n this.element.parentNode.removeChild(this.element);\n\n /* Clean reference */\n [...Object.keys(this)].forEach(key => delete this[key]);\n })\n };\n\n return this;\n },\n /* Subscribe */\n subscribe() {\n if (this.subscriptions) this.unsubscribe();\n\n this.subscriptions = {};\n\n if (this.hooks.galleryTrigger) {\n this.subscriptions.galleryClick = fromEvent(this.hooks.galleryTrigger, 'click')\n .pipe(map(e => e.target.closest('[data-type]')))\n .subscribe(e => {\n const { type } = e.dataset;\n addGallery(this, +type);\n });\n }\n\n return this;\n },\n /* Unsubscribe */\n unsubscribe() {\n if (!this.subscriptions) return this;\n\n [...Object.keys(this.subscriptions)].forEach(key => this.subscriptions[key].unsubscribe());\n\n return this;\n },\n /* Start */\n start() {\n if (!this.config.start) return this;\n\n /* Start logic */\n\n return this;\n },\n /* Init */\n init() {\n if (!this.config.init) return this;\n\n /* Setup store */\n this.setupStore();\n\n /* Setup actions */\n this.setupActions();\n\n /* Setup reactions */\n this.setupReactions();\n\n /* Subscribe */\n this.subscribe();\n\n /* Start */\n this.start();\n\n return this;\n }\n};\n\n/* Exports */\nmodule.exports = prototype;\n","/* ==========================================================================\n CompanyGallery > Client\n ========================================================================== */\n\n/* Import modules */\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst ImageClient = require('@bluekiri/alexandria-contrib-components/components/image-rxjs/client/js');\n\nconst prototype = require('./prototype');\nconst config = require('./config');\n\n/**\n * CompanyGallery component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function CompanyGallery(selector = '[data-component=CompanyGallery]', configuration = {}) {\n if (elementExist(selector)) {\n /* Instance */\n const instance = Object.create(prototype);\n\n /* Selector */\n instance.selector = selector;\n\n /* Element */\n instance.element = document.querySelector(selector);\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 instance.image = ImageClient(`${selector} [data-component=\"ImageRxjs\"][data-type=\"0\"]`);\n\n instance.imageTwo = ImageClient(`${selector} [data-component=\"ImageRxjs\"][data-type=\"1\"]`);\n\n instance.hooks = {\n galleryTrigger: instance.element.querySelector('[data-gallery-trigger]')\n };\n\n /* Init */\n instance.init();\n\n /* Return */\n return instance;\n }\n};\n","/* ==========================================================================\n CompanyGallery > Client > Config\n ========================================================================== */\n\n/* Import modules */\n\n/* Config */\nconst config = {\n component: 'CompanyGallery',\n init: true,\n start: true,\n css: {},\n type: {},\n imgConfig: {\n width: 500,\n height: 240\n },\n imgTwoConfig: {\n width: 350,\n height: 240\n }\n};\n\nmodule.exports = () => config;\n","/* ==========================================================================\n CompanyGallery > Client > Store > Reducer\n ========================================================================== */\n\n/* Modules */\nconst { types } = require('./actions');\n\n/* Initial state */\nconst initialState = {};\n\n/* Reducer */\nfunction reducer(state = initialState, action) {\n switch (action.type) {\n case types.DESTROY:\n default:\n return state;\n }\n}\n\n/* Exports */\nmodule.exports = {\n reducer\n};\n","/* ==========================================================================\n CompanyGallery > Client > Store > Actions\n ========================================================================== */\n\n/* Types */\nconst DESTROY = 'COMPANYGALLERY::DESTROY';\n\n/* Actions */\nconst destroy = () => ({ type: DESTROY });\n\n/* Exports */\nmodule.exports = {\n types: {\n DESTROY\n },\n actions: {\n destroy\n }\n};\n","/* ==========================================================================\n ShipSection > Client > Js > Gallery\n ========================================================================== */\n\n/* Modules */\nconst { html } = require('common-tags');\nconst { toNode } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst GalActions = require('@bluekiri/alexandria-contrib-components/components/gallery-rxjs/client/js/store/actions');\nconst GalleryTempalte = require('@bluekiri/alexandria-contrib-components/components/gallery-rxjs/template');\nconst Gallery = require('@bluekiri/alexandria-contrib-components/components/gallery-rxjs/client/js');\nconst { sanitizeObject } = require('@bluekiri/alexandria/helpers/sanitize');\n\n/* Create gallery */\nfunction createGallery(instance) {\n /* Data */\n const { gallery, context } = instance.config;\n\n /* Template */\n const template = html(\n GalleryTempalte(\n { items: gallery.map(item => sanitizeObject({ ...item, ...(item.config ? item.config : {}) })) },\n context\n )\n );\n\n /* Node */\n const node = toNode(template)[0];\n\n /* Return */\n return node;\n}\n\n/* Add gallery */\nfunction addGallery(instance, index) {\n const panel = instance;\n\n /* Node */\n const node = createGallery(instance);\n\n /* Add to DOM */\n document.body.appendChild(node);\n\n /* Update reference */\n panel.gallery = Gallery('[data-component=\"GalleryRxjs\"]', {\n photoswipe: {\n index\n }\n });\n\n /* Update */\n panel.reactions = {\n ...panel.reactions,\n hideGallery: panel.gallery.store.subscribe((state, action) => {\n if (action.type !== GalActions.types.DESTROY) return;\n\n delete panel.gallery;\n })\n };\n}\n\n/* Exports */\nmodule.exports = {\n addGallery\n};\n"],"sourceRoot":""}