(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
/* smoothscroll v0.4.4 - 2019 - Dustan Kasten, Jeremias Menichelli - MIT License */
(function () {
  'use strict';

  // polyfill
  function polyfill() {
    // aliases
    var w = window;
    var d = document;

    // return if scroll behavior is supported and polyfill is not forced
    if (
      'scrollBehavior' in d.documentElement.style &&
      w.__forceSmoothScrollPolyfill__ !== true
    ) {
      return;
    }

    // globals
    var Element = w.HTMLElement || w.Element;
    var SCROLL_TIME = 468;

    // object gathering original scroll methods
    var original = {
      scroll: w.scroll || w.scrollTo,
      scrollBy: w.scrollBy,
      elementScroll: Element.prototype.scroll || scrollElement,
      scrollIntoView: Element.prototype.scrollIntoView
    };

    // define timing method
    var now =
      w.performance && w.performance.now
        ? w.performance.now.bind(w.performance)
        : Date.now;

    /**
     * indicates if a the current browser is made by Microsoft
     * @method isMicrosoftBrowser
     * @param {String} userAgent
     * @returns {Boolean}
     */
    function isMicrosoftBrowser(userAgent) {
      var userAgentPatterns = ['MSIE ', 'Trident/', 'Edge/'];

      return new RegExp(userAgentPatterns.join('|')).test(userAgent);
    }

    /*
     * IE has rounding bug rounding down clientHeight and clientWidth and
     * rounding up scrollHeight and scrollWidth causing false positives
     * on hasScrollableSpace
     */
    var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;

    /**
     * changes scroll position inside an element
     * @method scrollElement
     * @param {Number} x
     * @param {Number} y
     * @returns {undefined}
     */
    function scrollElement(x, y) {
      this.scrollLeft = x;
      this.scrollTop = y;
    }

    /**
     * returns result of applying ease math function to a number
     * @method ease
     * @param {Number} k
     * @returns {Number}
     */
    function ease(k) {
      return 0.5 * (1 - Math.cos(Math.PI * k));
    }

    /**
     * indicates if a smooth behavior should be applied
     * @method shouldBailOut
     * @param {Number|Object} firstArg
     * @returns {Boolean}
     */
    function shouldBailOut(firstArg) {
      if (
        firstArg === null ||
        typeof firstArg !== 'object' ||
        firstArg.behavior === undefined ||
        firstArg.behavior === 'auto' ||
        firstArg.behavior === 'instant'
      ) {
        // first argument is not an object/null
        // or behavior is auto, instant or undefined
        return true;
      }

      if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {
        // first argument is an object and behavior is smooth
        return false;
      }

      // throw error when behavior is not supported
      throw new TypeError(
        'behavior member of ScrollOptions ' +
          firstArg.behavior +
          ' is not a valid value for enumeration ScrollBehavior.'
      );
    }

    /**
     * indicates if an element has scrollable space in the provided axis
     * @method hasScrollableSpace
     * @param {Node} el
     * @param {String} axis
     * @returns {Boolean}
     */
    function hasScrollableSpace(el, axis) {
      if (axis === 'Y') {
        return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
      }

      if (axis === 'X') {
        return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
      }
    }

    /**
     * indicates if an element has a scrollable overflow property in the axis
     * @method canOverflow
     * @param {Node} el
     * @param {String} axis
     * @returns {Boolean}
     */
    function canOverflow(el, axis) {
      var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];

      return overflowValue === 'auto' || overflowValue === 'scroll';
    }

    /**
     * indicates if an element can be scrolled in either axis
     * @method isScrollable
     * @param {Node} el
     * @param {String} axis
     * @returns {Boolean}
     */
    function isScrollable(el) {
      var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
      var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');

      return isScrollableY || isScrollableX;
    }

    /**
     * finds scrollable parent of an element
     * @method findScrollableParent
     * @param {Node} el
     * @returns {Node} el
     */
    function findScrollableParent(el) {
      while (el !== d.body && isScrollable(el) === false) {
        el = el.parentNode || el.host;
      }

      return el;
    }

    /**
     * self invoked function that, given a context, steps through scrolling
     * @method step
     * @param {Object} context
     * @returns {undefined}
     */
    function step(context) {
      var time = now();
      var value;
      var currentX;
      var currentY;
      var elapsed = (time - context.startTime) / SCROLL_TIME;

      // avoid elapsed times higher than one
      elapsed = elapsed > 1 ? 1 : elapsed;

      // apply easing to elapsed time
      value = ease(elapsed);

      currentX = context.startX + (context.x - context.startX) * value;
      currentY = context.startY + (context.y - context.startY) * value;

      context.method.call(context.scrollable, currentX, currentY);

      // scroll more if we have not reached our destination
      if (currentX !== context.x || currentY !== context.y) {
        w.requestAnimationFrame(step.bind(w, context));
      }
    }

    /**
     * scrolls window or element with a smooth behavior
     * @method smoothScroll
     * @param {Object|Node} el
     * @param {Number} x
     * @param {Number} y
     * @returns {undefined}
     */
    function smoothScroll(el, x, y) {
      var scrollable;
      var startX;
      var startY;
      var method;
      var startTime = now();

      // define scroll context
      if (el === d.body) {
        scrollable = w;
        startX = w.scrollX || w.pageXOffset;
        startY = w.scrollY || w.pageYOffset;
        method = original.scroll;
      } else {
        scrollable = el;
        startX = el.scrollLeft;
        startY = el.scrollTop;
        method = scrollElement;
      }

      // scroll looping over a frame
      step({
        scrollable: scrollable,
        method: method,
        startTime: startTime,
        startX: startX,
        startY: startY,
        x: x,
        y: y
      });
    }

    // ORIGINAL METHODS OVERRIDES
    // w.scroll and w.scrollTo
    w.scroll = w.scrollTo = function() {
      // avoid action when no arguments are passed
      if (arguments[0] === undefined) {
        return;
      }

      // avoid smooth behavior if not required
      if (shouldBailOut(arguments[0]) === true) {
        original.scroll.call(
          w,
          arguments[0].left !== undefined
            ? arguments[0].left
            : typeof arguments[0] !== 'object'
              ? arguments[0]
              : w.scrollX || w.pageXOffset,
          // use top prop, second argument if present or fallback to scrollY
          arguments[0].top !== undefined
            ? arguments[0].top
            : arguments[1] !== undefined
              ? arguments[1]
              : w.scrollY || w.pageYOffset
        );

        return;
      }

      // LET THE SMOOTHNESS BEGIN!
      smoothScroll.call(
        w,
        d.body,
        arguments[0].left !== undefined
          ? ~~arguments[0].left
          : w.scrollX || w.pageXOffset,
        arguments[0].top !== undefined
          ? ~~arguments[0].top
          : w.scrollY || w.pageYOffset
      );
    };

    // w.scrollBy
    w.scrollBy = function() {
      // avoid action when no arguments are passed
      if (arguments[0] === undefined) {
        return;
      }

      // avoid smooth behavior if not required
      if (shouldBailOut(arguments[0])) {
        original.scrollBy.call(
          w,
          arguments[0].left !== undefined
            ? arguments[0].left
            : typeof arguments[0] !== 'object' ? arguments[0] : 0,
          arguments[0].top !== undefined
            ? arguments[0].top
            : arguments[1] !== undefined ? arguments[1] : 0
        );

        return;
      }

      // LET THE SMOOTHNESS BEGIN!
      smoothScroll.call(
        w,
        d.body,
        ~~arguments[0].left + (w.scrollX || w.pageXOffset),
        ~~arguments[0].top + (w.scrollY || w.pageYOffset)
      );
    };

    // Element.prototype.scroll and Element.prototype.scrollTo
    Element.prototype.scroll = Element.prototype.scrollTo = function() {
      // avoid action when no arguments are passed
      if (arguments[0] === undefined) {
        return;
      }

      // avoid smooth behavior if not required
      if (shouldBailOut(arguments[0]) === true) {
        // if one number is passed, throw error to match Firefox implementation
        if (typeof arguments[0] === 'number' && arguments[1] === undefined) {
          throw new SyntaxError('Value could not be converted');
        }

        original.elementScroll.call(
          this,
          // use left prop, first number argument or fallback to scrollLeft
          arguments[0].left !== undefined
            ? ~~arguments[0].left
            : typeof arguments[0] !== 'object' ? ~~arguments[0] : this.scrollLeft,
          // use top prop, second argument or fallback to scrollTop
          arguments[0].top !== undefined
            ? ~~arguments[0].top
            : arguments[1] !== undefined ? ~~arguments[1] : this.scrollTop
        );

        return;
      }

      var left = arguments[0].left;
      var top = arguments[0].top;

      // LET THE SMOOTHNESS BEGIN!
      smoothScroll.call(
        this,
        this,
        typeof left === 'undefined' ? this.scrollLeft : ~~left,
        typeof top === 'undefined' ? this.scrollTop : ~~top
      );
    };

    // Element.prototype.scrollBy
    Element.prototype.scrollBy = function() {
      // avoid action when no arguments are passed
      if (arguments[0] === undefined) {
        return;
      }

      // avoid smooth behavior if not required
      if (shouldBailOut(arguments[0]) === true) {
        original.elementScroll.call(
          this,
          arguments[0].left !== undefined
            ? ~~arguments[0].left + this.scrollLeft
            : ~~arguments[0] + this.scrollLeft,
          arguments[0].top !== undefined
            ? ~~arguments[0].top + this.scrollTop
            : ~~arguments[1] + this.scrollTop
        );

        return;
      }

      this.scroll({
        left: ~~arguments[0].left + this.scrollLeft,
        top: ~~arguments[0].top + this.scrollTop,
        behavior: arguments[0].behavior
      });
    };

    // Element.prototype.scrollIntoView
    Element.prototype.scrollIntoView = function() {
      // avoid smooth behavior if not required
      if (shouldBailOut(arguments[0]) === true) {
        original.scrollIntoView.call(
          this,
          arguments[0] === undefined ? true : arguments[0]
        );

        return;
      }

      // LET THE SMOOTHNESS BEGIN!
      var scrollableParent = findScrollableParent(this);
      var parentRects = scrollableParent.getBoundingClientRect();
      var clientRects = this.getBoundingClientRect();

      if (scrollableParent !== d.body) {
        // reveal element inside parent
        smoothScroll.call(
          this,
          scrollableParent,
          scrollableParent.scrollLeft + clientRects.left - parentRects.left,
          scrollableParent.scrollTop + clientRects.top - parentRects.top
        );

        // reveal parent in viewport unless is fixed
        if (w.getComputedStyle(scrollableParent).position !== 'fixed') {
          w.scrollBy({
            left: parentRects.left,
            top: parentRects.top,
            behavior: 'smooth'
          });
        }
      } else {
        // reveal element in viewport
        w.scrollBy({
          left: clientRects.left,
          top: clientRects.top,
          behavior: 'smooth'
        });
      }
    };
  }

  if (typeof exports === 'object' && typeof module !== 'undefined') {
    // commonjs
    module.exports = { polyfill: polyfill };
  } else {
    // global
    polyfill();
  }

}());

},{}],2:[function(require,module,exports){
'use strict';

var _tabBar = require('./tab-bar');

// initialize all elements
var componentsList = document.querySelectorAll(_tabBar.TabBar.getSelector()); // Import all components

for (var i = 0; i < componentsList.length; i++) {
	new _tabBar.TabBar(componentsList[i]);
}
},{"./tab-bar":3}],3:[function(require,module,exports){
'use strict';

Object.defineProperty(exports, "__esModule", {
	value: true
});
exports.TabBar = undefined;

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /**
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      * import dependencies
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      */


var _elementHelpers = require('../helpers/element-helpers');

var _elementHelpers2 = _interopRequireDefault(_elementHelpers);

var _smoothscrollPolyfill = require('smoothscroll-polyfill');

var _smoothscrollPolyfill2 = _interopRequireDefault(_smoothscrollPolyfill);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

/**
 * Declare global vars
 */
var attributeBase = 'data-rs-tab-bar';

var TabBar = exports.TabBar = function () {
	function TabBar(element) {
		_classCallCheck(this, TabBar);

		_smoothscrollPolyfill2.default.polyfill();
		this.element = element;
		this.items = _elementHelpers2.default.getElementsByAttributeWithinElement(this.element, this.attributes.item);
		this.setVariables();
		this.setFadeElements();
		this.addEventListeners();
		this.toggleFadeElements();
		this.scrollToActive();
	}

	/**
  * Declare class constants
  */


	_createClass(TabBar, [{
		key: 'setVariables',


		/**
   * Declare HTML variables
   * SVG chrevron templates
   */
		value: function setVariables() {
			this.chevronRight = '<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">\n  \t\t\t\t<path d="M7,2 C7.256,2 7.512,2.098 7.707,2.293 L14.707,9.293 C15.098,9.684 15.098,10.316 14.707,10.707 L7.707,17.707 C7.316,18.098 6.684,18.098 6.293,17.707 C5.902,17.316 5.902,16.684 6.293,16.293 L12.586,10 L6.293,3.707 C5.902,3.316 5.902,2.684 6.293,2.293 C6.488,2.098 6.744,2 7,2"/>\n\t\t\t\t</svg>';
			this.chevronLeft = '<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">\n  \t\t\t\t<path d="M13,18 C12.744,18 12.488,17.902 12.293,17.707 L5.293,10.707 C4.902,10.316 4.902,9.684 5.293,9.293 L12.293,2.293 C12.684,1.902 13.316,1.902 13.707,2.293 C14.098,2.684 14.098,3.316 13.707,3.707 L7.414,10 L13.707,16.293 C14.098,16.684 14.098,17.316 13.707,17.707 C13.512,17.902 13.256,18 13,18"/>\n\t\t\t\t</svg>';
			this.fadeLeft = '<div class="' + this.classes.fadeElement + ' ' + this.classes.fadeElementLeft + ' ' + this.classes.hide + '" ' + this.attributes.fadeElementLeft + '><div ' + this.attributes.iconLeft + ' class="' + this.classes.icon + ' ' + this.classes.iconLeft + '">' + this.chevronLeft + '</div></div>';
			this.fadeRight = '<div class="' + this.classes.fadeElement + ' ' + this.classes.fadeElementRight + ' ' + this.classes.hide + '" ' + this.attributes.fadeElementRight + '><div ' + this.attributes.iconRight + ' class="' + this.classes.icon + ' ' + this.classes.iconRight + '">' + this.chevronRight + '</div></div>';
		}

		/**
   * insert fade elements at start and end of list items
   */

	}, {
		key: 'setFadeElements',
		value: function setFadeElements() {
			var _this = this;

			this.items.forEach(function (item, index, array) {
				if (index === 1) {
					item.insertAdjacentHTML('beforebegin', _this.fadeLeft);
				}
				if (index === array.length - 1) {
					item.insertAdjacentHTML('afterend', _this.fadeRight);
				}
			});
		}

		/**
   * add event listeners to all Tab-bar elements
   */

	}, {
		key: 'addEventListeners',
		value: function addEventListeners() {
			var _this2 = this;

			this.iconLeft = _elementHelpers2.default.getElementByAttributeWithinElement(this.element, this.attributes.iconLeft);
			this.iconRight = _elementHelpers2.default.getElementByAttributeWithinElement(this.element, this.attributes.iconRight);

			// scroll left on click
			this.iconLeft.addEventListener('click', function () {
				_this2.element.scrollBy({ left: -(_this2.element.clientWidth / 2), behavior: 'smooth' });
			});
			// scroll right on click
			this.iconRight.addEventListener('click', function () {
				_this2.element.scrollBy({ left: _this2.element.clientWidth / 2, behavior: 'smooth' });
			});
			//reset position fadeElement/chevron on scroll
			this.element.addEventListener('scroll', function () {
				_this2.toggleFadeElements();
			});
			//reset position fadeElement/chevron on resize
			window.addEventListener('resize', function () {
				_this2.toggleFadeElements();
				_this2.scrollToActive();
			});
			//loop items and add click event to call setActiveClass function
			this.items.forEach(function (item) {
				item.addEventListener('click', function (event) {
					event.preventDefault;
					_this2.setActiveClass(event);
				});
			});
		}

		/**
   * Set or remove active state on list item
   */

	}, {
		key: 'setActiveClass',
		value: function setActiveClass(event) {
			var _this3 = this;

			this.items.forEach(function (item) {
				item.classList.remove(_this3.classes.active);
			});
			event.currentTarget.classList.add(this.classes.active);
			this.scrollToActive();
		}

		/**
   * on init and resize, scroll to active item
   */

	}, {
		key: 'scrollToActive',
		value: function scrollToActive() {
			this.activeElement = _elementHelpers2.default.getElementByClassWithinElement(this.element, this.classes.active);
			var rectTabBar = this.element.getBoundingClientRect();
			var rectActiveTab = this.activeElement.getBoundingClientRect();
			var viewportWidth = window.innerWidth;
			var inScreenSize = viewportWidth - rectTabBar.left * 2;
			if (rectActiveTab.left + this.activeElement.clientWidth > inScreenSize) {
				this.element.scrollBy({ behavior: 'smooth', left: rectActiveTab.left - rectTabBar.left * 2 });
			} else if (rectActiveTab.left < this.activeElement.clientWidth + 50) {
				this.element.scrollBy({ behavior: 'smooth', left: rectActiveTab.left - inScreenSize / 2 });
			}
		}

		/**
   * Hide or show the Fade elements and position them
   */

	}, {
		key: 'toggleFadeElements',
		value: function toggleFadeElements() {
			this.fadeElementRight = _elementHelpers2.default.getElementByAttributeWithinElement(this.element, this.attributes.fadeElementRight);
			this.fadeElementLeft = _elementHelpers2.default.getElementByAttributeWithinElement(this.element, this.attributes.fadeElementLeft);
			//calculate maximum scroll left
			var maxScrollLeft = this.element.scrollWidth - this.element.clientWidth;
			//calculate the position for the chevrons
			this.screenCenter = window.innerWidth / 2;
			this.tabBarWidth = this.element.clientWidth;
			this.positionLeft = this.screenCenter - this.tabBarWidth / 2;
			this.positionRight = this.screenCenter + this.tabBarWidth / 2;
			// hide/show fade element right
			if (this.element.scrollLeft > maxScrollLeft - 20) {
				this.fadeElementRight.classList.add(this.classes.hide);
			} else {
				this.fadeElementRight.classList.remove(this.classes.hide);
				// minus 25px for the right-fadeElement width
				this.fadeElementRight.style.left = this.positionRight - 25 + 'px';
			}
			// hide/show fade element left
			if (this.element.scrollLeft > 10) {
				this.fadeElementLeft.classList.remove(this.classes.hide);
				// minus 25px for the left-fadeElement width
				this.fadeElementLeft.style.left = this.positionLeft - 25 + 'px';
			} else {
				this.fadeElementLeft.classList.add(this.classes.hide);
			}
		}

		/**
   * Get selector
   */

	}, {
		key: 'classes',
		get: function get() {
			return {
				fadeElement: 'fade-element',
				fadeElementRight: 'fade-element--right',
				fadeElementLeft: 'fade-element--left',
				icon: 'icon',
				iconLeft: 'icon__left',
				iconRight: 'icon__right',
				hide: 'hide',
				active: 'active'

			};
		}

		/**
   * Declare attribute constants
   */

	}, {
		key: 'attributes',
		get: function get() {
			return {
				item: attributeBase + '-item',
				iconLeft: attributeBase + '-icon-left',
				iconRight: attributeBase + '-icon-right',
				fadeElementLeft: attributeBase + '-fade-element-left',
				fadeElementRight: attributeBase + '-fade-element-right'

			};
		}
	}], [{
		key: 'getSelector',
		value: function getSelector() {
			return '[' + attributeBase + ']';
		}
	}]);

	return TabBar;
}();
},{"../helpers/element-helpers":4,"smoothscroll-polyfill":1}],4:[function(require,module,exports){
'use strict';

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var ElementHelpers = function () {
	function ElementHelpers() {
		_classCallCheck(this, ElementHelpers);
	}

	_createClass(ElementHelpers, null, [{
		key: 'triggerEvent',


		/**
   * Trigger an event on a specified element
   * @param element {Node}
   * @param eventType
   */
		value: function triggerEvent(element, eventType) {
			var event = void 0;

			if (typeof Event === 'function') {
				event = new Event(eventType);
			} else {
				event = document.createEvent('Event');
				event.initEvent(eventType, true, true);
			}
			element.dispatchEvent(event);
		}

		/**
   * Get element by attribute and optional by attribute value
   * @param attributeName
   * @param attributeValue - optional
   */

	}, {
		key: 'getElementByAttribute',
		value: function getElementByAttribute(attributeName, attributeValue) {
			if (attributeValue) {
				return document.querySelector('[' + attributeName + '="' + attributeValue + '"]');
			} else {
				return document.querySelector('[' + attributeName + ']');
			}
		}

		/**
   * Get multiple elements by attribute and optional by attribute value
   * @param attributeName
   * @param attributeValue - optional
   */

	}, {
		key: 'getElementsByAttribute',
		value: function getElementsByAttribute(attributeName, attributeValue) {
			if (attributeValue) {
				return document.querySelectorAll('[' + attributeName + '="' + attributeValue + '"]');
			} else {
				return document.querySelectorAll('[' + attributeName + ']');
			}
		}

		/**
   * Get element by attribute and optional by attribute value, within an element
   * @param element
   * @param attributeName
   * @param attributeValue - optional
   */

	}, {
		key: 'getElementByAttributeWithinElement',
		value: function getElementByAttributeWithinElement(element, attributeName, attributeValue) {
			if (attributeValue) {
				return element.querySelector('[' + attributeName + '="' + attributeValue + '"]');
			} else {
				return element.querySelector('[' + attributeName + ']');
			}
		}

		/**
   * check if mouse pointer is on element
   * @param element
   */

	}, {
		key: 'isMouseOver',
		value: function isMouseOver(element) {
			return Array.prototype.slice.call(element.parentElement.querySelectorAll(':hover')).filter(function () {
				return element[0] == this;
			}).length > 0;
		}

		/**
   * Get multiple elements by attribute and optional by attribute value, within an element
   * @param element
   * @param attributeName
   * @param attributeValue - optional
   */

	}, {
		key: 'getElementsByAttributeWithinElement',
		value: function getElementsByAttributeWithinElement(element, attributeName, attributeValue) {
			if (attributeValue) {
				return element.querySelectorAll('[' + attributeName + '="' + attributeValue + '"]');
			} else {
				return element.querySelectorAll('[' + attributeName + ']');
			}
		}

		/**
   * Get element by class, within an element
   * @param element
   * @param className
   */

	}, {
		key: 'getElementByClassWithinElement',
		value: function getElementByClassWithinElement(element, className) {
			return element.querySelector('.' + className);
		}

		/**
   * get max width for mobile viewports 
   */

	}, {
		key: 'maxWidthMobileViewports',
		value: function maxWidthMobileViewports() {
			return 940;
		}

		/**
   * Create an event
   * @param eventType
   */

	}, {
		key: 'createEvent',
		value: function createEvent(eventType) {
			var event = void 0;
			if (typeof Event === 'function') {
				event = new Event(eventType);
			} else {
				event = document.createEvent('Event');
				event.initEvent(eventType, true, true);
			}
			return event;
		}

		/**
   * checks if viewport is desktop size
   */

	}, {
		key: 'isDesktop',
		value: function isDesktop() {
			return Math.max(document.documentElement.clientWidth, window.innerWidth || 0) > this.maxWidthMobileViewports();
		}
	}, {
		key: 'isIE11',
		value: function isIE11() {
			return navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > -1;
		}

		/**
   * Get keycode on keydown event, as fallback if event.code is not supported yet by the browser
   * @param event
   */

	}, {
		key: 'getKeyCodeOnKeyDownEvent',
		value: function getKeyCodeOnKeyDownEvent(event) {
			var keyCode = void 0;
			if (event != null) {
				if (typeof event.code === 'undefined') {
					switch (event.keyCode) {
						case 13:
							keyCode = 'Enter';
							break;
						case 38:
							keyCode = 'ArrowUp';
							break;
						case 40:
							keyCode = 'ArrowDown';
							break;
						case 9:
							keyCode = 'Tab';
							break;
						case 27:
							keyCode = 'Escape';
							break;
						case 33:
							keyCode = 'PageUp';
							break;
						case 34:
							keyCode = 'PageDown';
							break;
						default:
							keyCode = undefined;
							break;
					}
				} else {
					keyCode = event.code;
				}
			}
			return keyCode;
		}
	}]);

	return ElementHelpers;
}();

module.exports = ElementHelpers;
},{}]},{},[2]);
