{"version":3,"sources":["webpack:///./node_modules/@logitravel/alex-comp-cru/components/floating-index/client/js/config.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/floating-index/client/js/index.js","webpack:///./node_modules/@logitravel/alex-comp-cru/components/floating-index/client/js/prototype.js"],"names":["config","component","init","css","fixed","module","exports","elementExist","require","prototype","selector","arguments","length","undefined","configuration","instance","Object","create","element","document","querySelector","_objectSpread","dataset","result","JSON","parse","fromEvent","goToPointTab","point","tab","tabs","this","goToPoint","querySelectorAll","setTimeout","click","concat","scroll","offsetTop","scrollHeight","window","scrollTo","getPoints","_this","options","_toConsumableArray","map","option","subscribe","link","split","setScroll","_this2","breakPointScroll","offsetTopEl","onscroll","scrollTop","documentElement","_this2$offsetTopEl","classList","add","remove"],"mappings":";+EAOA,IAAMA,EAAS,CACXC,UAAW,gBACXC,MAAM,EACNC,IAAK,CACDC,MAAO,aAIfC,EAAOC,QAAU,kBAAMN,I,0qBCVvB,IAAQO,EAAiBC,EAAQ,QAAzBD,aAEFE,EAAYD,EAAQ,QACpBR,EAASQ,EAAQ,QAMvBH,EAAOC,QAAU,WAAwF,IAAjEI,EAAQC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,iCAAkCG,EAAaH,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,GACjG,GAAIJ,EAAaG,GAAW,CACxB,IAAMK,EAAWC,OAAOC,OAAOR,GAkB/B,OAhBAM,EAASG,QAAUC,SAASC,cAAcV,GAE1CK,EAASf,OAAMqB,MAAA,GACRrB,KACAc,GACC,WACA,IAAKC,EAASG,QAAQI,QAAQtB,OAAQ,MAAO,GAE7C,IAAMuB,EAASC,KAAKC,MAAMV,EAASG,QAAQI,QAAQtB,QAEnD,OADAe,EAASG,QAAQI,QAAQtB,OAAS,GAC3BuB,EALP,IASRR,EAASb,OAEFa,K,mEC/Bf,IAAQW,EAAclB,EAAQ,QAAtBkB,UAEFjB,EAAY,CACdkB,aAAY,SAACC,EAAOC,GAChB,IACMC,EADYC,KAAKC,UAAUJ,GACVK,iBAAiB,gBAIxC,OAFAC,YAAW,kBAAMJ,EAAKD,GAAKM,UAAS,KAE7BJ,MAEXC,UAAS,SAACJ,GACN,IAAM3B,EAAYkB,SAASC,cAAc,oBAADgB,OAAqBR,EAAK,OAC5DS,EAASpC,EAAUqC,UAAYP,KAAKb,QAAQqB,aAIlD,OAFAC,OAAOC,SAAS,EAAGJ,GAEZpC,GAEXyC,UAAS,WAAG,IAAAC,EAAA,KAeR,OAdAZ,KAAKa,QAAUC,EAAId,KAAKb,QAAQe,iBAAiB,gBAAgBa,KAAI,SAAAC,GACjE,OAAOrB,EAAUqB,EAAQ,SAASC,WAAU,WAExC,IAAMC,EAAOF,EAAOzB,QAAQ2B,KAAKC,MAAM,KAEjCtB,EAAQqB,EAAK,GAEbpB,EAAMoB,EAAKrC,OAAS,GAAIqC,EAAK,GAEnC,OAAIpB,EAAYc,EAAKhB,aAAaC,EAAOC,GAElCc,EAAKX,UAAUJ,SAGvBG,MAEXoB,UAAS,WAAG,IAAAC,EAAA,KACFC,EAAmBlC,SAASC,cAAc,2CAChDW,KAAKuB,YAAcD,EAAmBA,EAAiBf,UAAY,QAAKzB,EAExE2B,OAAOe,SAAW,WACd,IAAQC,EAAcrC,SAASsC,gBAAvBD,UACAtC,EAAwCkC,EAAxClC,QAAOwC,EAAiCN,EAA/BE,mBAAW,IAAAI,EAAG,KAAIA,EAAE1D,EAAWoD,EAAXpD,OAErC,OAAIwD,GAAaF,GACbpC,EAAQyC,UAAUC,IAAI5D,EAAOG,IAAIC,QAC1B,IAEXc,EAAQyC,UAAUE,OAAO7D,EAAOG,IAAIC,QAC7B,KAGfF,KAAI,WACA,OAAK6B,KAAK/B,OAAOE,MAEjB6B,KAAKoB,YAELpB,KAAKW,YAEEX,MANuBA,OAWtC1B,EAAOC,QAAUG","file":"floating-index.2e79219d2b77ffa393be.bundle.js","sourcesContent":["/* ==========================================================================\n FloatingIndex > Client > Config\n ========================================================================== */\n\n/* Import modules */\n\n/* Config */\nconst config = {\n component: 'FloatingIndex',\n init: true,\n css: {\n fixed: 'is-fixed'\n }\n};\n\nmodule.exports = () => config;\n","/* ==========================================================================\n FloatingIndex > Client\n ========================================================================== */\n\n/* Import modules */\nconst { elementExist } = require('@bluekiri/alexandria/helpers/domHelpers');\n\nconst prototype = require('./prototype');\nconst config = require('./config');\n\n/**\n * FloatingIndex component\n * @param {selector} String selector for the component in the client side.\n */\nmodule.exports = function FloatingIndex(selector = '[data-component=FloatingIndex]', configuration = {}) {\n if (elementExist(selector)) {\n const instance = Object.create(prototype);\n\n instance.element = document.querySelector(selector);\n\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.init();\n\n return instance;\n }\n};\n","/* ==========================================================================\n FloatingIndex > Client > Prototype\n ========================================================================= */\nconst { fromEvent } = require('rxjs');\n\nconst prototype = {\n goToPointTab(point, tab) {\n const component = this.goToPoint(point);\n const tabs = component.querySelectorAll('.js-nav-tabs');\n\n setTimeout(() => tabs[tab].click(), 200);\n\n return this;\n },\n goToPoint(point) {\n const component = document.querySelector(`[data-component=\"${point}\"]`);\n const scroll = component.offsetTop - this.element.scrollHeight;\n\n window.scrollTo(0, scroll);\n\n return component;\n },\n getPoints() {\n this.options = [...this.element.querySelectorAll('[data-link]')].map(option => {\n return fromEvent(option, 'click').subscribe(() => {\n /* Spli by _ for tab goTo */\n const link = option.dataset.link.split('_');\n /* Get name component first */\n const point = link[0];\n /* Check if we get tab from link split */\n const tab = link.length > 1 ? link[1] : false;\n /* if we have a tab, will execute goToPointTab */\n if (tab) return this.goToPointTab(point, tab);\n /* if we dont have tab then execute goToPoint */\n return this.goToPoint(point);\n });\n });\n return this;\n },\n setScroll() {\n const breakPointScroll = document.querySelector('[data-component=\"GalleryVideoCarousel\"]');\n this.offsetTopEl = breakPointScroll ? breakPointScroll.offsetTop - 60 : undefined;\n\n window.onscroll = () => {\n const { scrollTop } = document.documentElement;\n const { element, offsetTopEl = 1200, config } = this;\n\n if (scrollTop >= offsetTopEl) {\n element.classList.add(config.css.fixed);\n return true;\n }\n element.classList.remove(config.css.fixed);\n return true;\n };\n },\n init() {\n if (!this.config.init) return this;\n\n this.setScroll();\n\n this.getPoints();\n\n return this;\n }\n};\n\n// Exports\nmodule.exports = prototype;\n"],"sourceRoot":""}