{"version":3,"sources":["webpack:///./src/client/default/js/components/classTogglerComponent.js","webpack:///./src/client/default/js/base/baseComponent.js"],"names":["classTogglerComponent","props","handleClick","this","$on","e","preventDefault","Object","keys","$options","config","forEach","key","document","querySelectorAll","el","classList","toggle","currentTarget","contains","body","querySelector","add","window","scrollY","remove","event","EMIT","CUSTOM_MESSAGES","CLASS_TOGGLER_EVENTS","toggled","BaseComponent","element","_componentElement","setAttribute","_checkMessages","compOptions","options","$el","dataset","filter","entry","includes","optionValue","cleanEntry","cleanOptionKey","JSON","parse","replace","convertType","deepFreeze","getAttribute","events","cb","elements","Bean","on","stopPropagation","one","off","fire","container","message","_loading","LOADER_EVENTS","show","error","icon","setTimeout","hide","option","optionReturn","str","charAt","toLocaleLowerCase","slice","BaseGiaComponent"],"mappings":"+oBAEqBA,E,gCACnB,WAAYC,GAAO,0BACjB,cAAMA,IACDC,cAFY,E,uCAKnB,WAAc,WACZC,KAAKC,IAAI,sBAAsB,SAACC,GAC9BA,EAAEC,iBACFC,OAAOC,KAAK,EAAKC,SAASC,QAAQC,SAAQ,SAACC,GACzCC,SAASC,iBAAiBF,GAAKD,SAAQ,SAACI,GACtCA,EAAGC,UAAUC,OAAO,EAAKR,SAASC,OAAOE,UAGzCP,EAAEa,cAAcF,UAAUG,SAAS,0BACrCN,SAASO,KAAKJ,UAAUC,OAAO,uBAC3BZ,EAAEa,cAAcF,UAAUG,SAAS,8BACrCN,SAASQ,cAAc,iBAAiBL,UAAUM,IAAI,aAC7CjB,EAAEa,cAAcF,UAAUG,SAAS,gCAAoD,GAAlBI,OAAOC,SACrFX,SAASQ,cAAc,iBAAiBL,UAAUS,OAAO,cAGzD,EAAKhB,SAASiB,OAChB,EAAKC,KAAK,EAAKC,gBAAgBC,qBAAqBC,QAAS,CAC3DJ,MAAO,EAAKjB,SAASiB,e,UAxBoBK,I,g1BCM9BA,E,gCAmCnB,WAAYC,GAAS,0BACnB,cAAMA,IACDC,kBAAoBD,EACzB,EAAKC,kBAAkB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AahD,SAASO,KACjC0C,QAASA,UAAW,S,wBAaxB,SAAWD,EAAWC,GAA8B,WAArBI,EAAqB,wDAANC,EAAM,uCAClDhE,KAAK4D,UAAW,EAChBK,YAAW,WACJ,EAAKL,UACR,EAAKpC,KAAK,EAAKC,gBAAgBoC,cAAcK,KAAM,CACjDR,UAAWA,GAAahD,SAASO,KACjC0C,UACAI,QACAC,WAGH,Q,0BAtHL,SAAmBG,GACjB,IAAIC,EACJ,OAAQD,GACN,IAAK,QACHC,GAAe,EACf,MACF,IAAK,OACHA,GAAe,EACf,MACF,IAAK,OACHA,EAAe,KACf,MACF,QACEA,EAAeD,EAInB,OAAOC,I,4BAGT,SAAsB3D,GACpB,IAAM4D,EAAM5D,EAAIoC,QAAQ,SAAU,IAClC,gBAAUwB,EAAIC,OAAO,GAAGC,qBAAxB,OAA8CF,EAAIG,MAAM,Q,SAhEjBC","file":"js/component-classTogglerComponent-js.chunks.js","sourcesContent":["import BaseComponent from '../base/baseComponent';\n\nexport default class classTogglerComponent extends BaseComponent {\n  constructor(props) {\n    super(props);\n    this.handleClick();\n  }\n\n  handleClick() {\n    this.$on('click.classToggler', (e) => {\n      e.preventDefault();\n      Object.keys(this.$options.config).forEach((key) => {\n        document.querySelectorAll(key).forEach((el) => {\n          el.classList.toggle(this.$options.config[key]);\n        });\n      });\n      if (e.currentTarget.classList.contains('filter-store-locator')) {\n        document.body.classList.toggle('mobile-block-scroll');\n        if (e.currentTarget.classList.contains('filter-store-locator--open')) {\n          document.querySelector('header.header').classList.add('collapsed');\n        } else if (e.currentTarget.classList.contains('filter-store-locator--close') && window.scrollY == 0) {\n          document.querySelector('header.header').classList.remove('collapsed');\n        }\n      }\n      if (this.$options.event) {\n        this.EMIT(this.CUSTOM_MESSAGES.CLASS_TOGGLER_EVENTS.toggled, {\n          event: this.$options.event\n        });\n      }\n    });\n  }\n}\n","/* eslint-disable new-cap */\n/* eslint-disable valid-jsdoc */\n/* eslint-disable no-underscore-dangle */\n\nimport Bean from 'bean';\nimport deepFreeze from '../utilities/freeze';\nimport BaseGiaComponent from './baseGiaComponent';\n\nexport default class BaseComponent extends BaseGiaComponent {\n  /**\n   * @returns {HTMLElement}\n   */\n  get $el() {\n    return /** @type {HTMLElement} */ (this._componentElement);\n  }\n\n  get $options() {\n    const compOptions = {};\n    const options = { ...this.$el.dataset };\n    const optionsEntires = Object.keys(options).filter((entry) => entry.includes('option'));\n    optionsEntires.forEach((entry) => {\n      const cleanEntry = BaseComponent.cleanOptionKey(entry);\n      let optionValue;\n      if (options[entry].includes('{') && options[entry].includes('}')) {\n        optionValue = JSON.parse(options[entry].replace(/'/g, '\"'));\n      } else {\n        optionValue = BaseComponent.convertType(options[entry]);\n      }\n      compOptions[cleanEntry] = optionValue;\n    });\n    return deepFreeze(compOptions);\n  }\n\n  get COMPONENT_NAME() {\n    return this.$el.getAttribute('data-component');\n  }\n\n  /**\n   *\n   * constructor\n   *\n   * @param {Element} element\n   */\n  constructor(element) {\n    super(element);\n    this._componentElement = element;\n    this._componentElement.setAttribute('data-component-init', 'true');\n    this._checkMessages();\n  }\n\n  static convertType(option) {\n    let optionReturn;\n    switch (option) {\n      case 'false':\n        optionReturn = false;\n        break;\n      case 'true':\n        optionReturn = true;\n        break;\n      case 'null':\n        optionReturn = null;\n        break;\n      default:\n        optionReturn = option;\n        break;\n    }\n\n    return optionReturn;\n  }\n\n  static cleanOptionKey(key) {\n    const str = key.replace('option', '');\n    return `${str.charAt(0).toLocaleLowerCase()}${str.slice(1)}`;\n  }\n\n  /**\n   *\n   * $on\n   *\n   * @param {String} events\n   * @param {Function} cb\n   * @param {Element} [element = this.$el]\n   * @param {Array|String|Element} [elements = null]\n   */\n  $on(events, cb, element = this.$el, elements = null) {\n    if (!element || !events || !cb) return;\n    if (!elements) {\n      Bean.on(element, events, (e) => {\n        if (e) e.stopPropagation();\n        cb(e);\n      });\n    } else {\n      Bean.on(element, events, elements, (e) => {\n        if (e) e.stopPropagation();\n        cb(e);\n      });\n    }\n  }\n\n  /**\n   *\n   * $one\n   *\n   * @param {String} events\n   * @param {Function} cb\n   * @param {Element} [element = this.$el]\n   */\n  $one(events, cb, element = this.$el) {\n    Bean.one(element, events, cb);\n  }\n\n  /**\n   *\n   * $off\n   *\n   * @param {String} events\n   * @param {Element} [element = this.$el]\n   */\n  $off(events, element = this.$el) {\n    Bean.off(element, events);\n  }\n\n  /**\n   *\n   * $fire\n   *\n   * @param {String} events\n   * @param {Element} [element = this.$el]\n   */\n  $fire(events, element = this.$el) {\n    Bean.fire(element, events);\n  }\n\n  /**\n   *\n   * Activate loader\n   *\n   * @param {HTMLElement} [container]\n   * @param {String} [message]\n   */\n  loading(container, message) {\n    this._loading = true;\n    this.EMIT(this.CUSTOM_MESSAGES.LOADER_EVENTS.show, {\n      container: container || document.body,\n      message: message ?? null\n    });\n  }\n\n  /**\n   *\n   * Deactivate loader\n   *\n   * @param {HTMLElement} [container]\n   * @param {String} [message]\n   * @param {Boolean} [error=false]\n   * @param {String} [icon]\n   */\n  endLoading(container, message, error = false, icon) {\n    this._loading = false;\n    setTimeout(() => {\n      if (!this._loading) {\n        this.EMIT(this.CUSTOM_MESSAGES.LOADER_EVENTS.hide, {\n          container: container || document.body,\n          message,\n          error,\n          icon\n        });\n      }\n    }, 400);\n  }\n}\n"],"sourceRoot":""}