/*!
 * Copyright © 2018 Splunk Inc.
 * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
 * in part without a valid written license from Splunk Inc. is PROHIBITED.
 */
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 23);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {

module.exports = require("prop-types");

/***/ }),
/* 1 */
/***/ (function(module, exports) {

module.exports = require("react");

/***/ }),
/* 2 */
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/defineProperty");

/***/ }),
/* 3 */
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/assertThisInitialized");

/***/ }),
/* 4 */
/***/ (function(module, exports) {

module.exports = require("lodash");

/***/ }),
/* 5 */
/***/ (function(module, exports) {

module.exports = require("styled-components");

/***/ }),
/* 6 */,
/* 7 */
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/classCallCheck");

/***/ }),
/* 8 */
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/createClass");

/***/ }),
/* 9 */
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/getPrototypeOf");

/***/ }),
/* 10 */,
/* 11 */
/***/ (function(module, exports) {

module.exports = require("@splunk/charting-bundle");

/***/ }),
/* 12 */
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/inherits");

/***/ }),
/* 13 */
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/possibleConstructorReturn");

/***/ }),
/* 14 */,
/* 15 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _classCallCheck = __webpack_require__(7);

var _createClass = __webpack_require__(8);

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

var ChartingApi = /*#__PURE__*/function () {
  function ChartingApi(charting) {
    _classCallCheck(this, ChartingApi);

    this.charting = charting;
  }
  /**
   * Allows users to programmatically highlight a point on the chart
   *
   * @memberof ChartingApi
   */


  _createClass(ChartingApi, [{
    key: "highlight",
    value: function highlight() {
      var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
        xValue: '',
        seriesName: ''
      },
          xValue = _ref.xValue,
          seriesName = _ref.seriesName;

      this.charting.chart.highlight(xValue, seriesName);
    }
    /**
     * Allows users to programmatically unhighlight all points on the chart
     *
     * @memberof ChartingApi
     */

  }, {
    key: "unHighlight",
    value: function unHighlight() {
      this.charting.chart.unHighlight();
    }
  }]);

  return ChartingApi;
}();

exports.default = ChartingApi;

/***/ }),
/* 16 */
/***/ (function(module, exports) {

module.exports = require("@splunk/ui-utils/i18n");

/***/ }),
/* 17 */
/***/ (function(module, exports) {

module.exports = require("@splunk/visualizations-shared/Message");

/***/ }),
/* 18 */
/***/ (function(module, exports) {

module.exports = require("react-event-listener");

/***/ }),
/* 19 */
/***/ (function(module, exports) {

module.exports = require("@splunk/visualization-context/TimezoneContext");

/***/ }),
/* 20 */
/***/ (function(module, exports) {

module.exports = require("@splunk/visualizations-shared/style");

/***/ }),
/* 21 */,
/* 22 */,
/* 23 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_INPLACE_PROPS", function() { return NO_INPLACE_PROPS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "changedOptions", function() { return changedOptions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Charting; });
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7);
/* harmony import */ var _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8);
/* harmony import */ var _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3);
/* harmony import */ var _babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12);
/* harmony import */ var _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(13);
/* harmony import */ var _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9);
/* harmony import */ var _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(2);
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(4);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_7__);
/* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(16);
/* harmony import */ var _splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_8__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(1);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_9__);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(0);
/* harmony import */ var prop_types__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(prop_types__WEBPACK_IMPORTED_MODULE_10__);
/* harmony import */ var react_event_listener__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(18);
/* harmony import */ var react_event_listener__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(react_event_listener__WEBPACK_IMPORTED_MODULE_11__);
/* harmony import */ var _splunk_visualizations_shared_i18n__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(24);
/* harmony import */ var _splunk_visualizations_shared_i18n__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_i18n__WEBPACK_IMPORTED_MODULE_12__);
/* harmony import */ var _splunk_visualization_context_TimezoneContext__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(19);
/* harmony import */ var _splunk_visualization_context_TimezoneContext__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualization_context_TimezoneContext__WEBPACK_IMPORTED_MODULE_13__);
/* harmony import */ var _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(11);
/* harmony import */ var _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(_splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_14__);
/* harmony import */ var _splunk_visualizations_shared_style__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(20);
/* harmony import */ var _splunk_visualizations_shared_style__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_style__WEBPACK_IMPORTED_MODULE_15__);
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(5);
/* harmony import */ var styled_components__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(styled_components__WEBPACK_IMPORTED_MODULE_16__);
/* harmony import */ var _splunk_visualizations_shared_Message__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(17);
/* harmony import */ var _splunk_visualizations_shared_Message__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(_splunk_visualizations_shared_Message__WEBPACK_IMPORTED_MODULE_17__);
/* harmony import */ var _ChartingApi__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(15);
/* harmony import */ var _ChartingApi__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_ChartingApi__WEBPACK_IMPORTED_MODULE_18__);








function ownKeys(object, enumerableOnly) {
  var keys = Object.keys(object);

  if (Object.getOwnPropertySymbols) {
    var symbols = Object.getOwnPropertySymbols(object);
    if (enumerableOnly) symbols = symbols.filter(function (sym) {
      return Object.getOwnPropertyDescriptor(object, sym).enumerable;
    });
    keys.push.apply(keys, symbols);
  }

  return keys;
}

function _objectSpread(target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};

    if (i % 2) {
      ownKeys(Object(source), true).forEach(function (key) {
        _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(target, key, source[key]);
      });
    } else if (Object.getOwnPropertyDescriptors) {
      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
    } else {
      ownKeys(Object(source)).forEach(function (key) {
        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
      });
    }
  }

  return target;
}

function _createSuper(Derived) {
  var hasNativeReflectConstruct = _isNativeReflectConstruct();

  return function _createSuperInternal() {
    var Super = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(Derived),
        result;

    if (hasNativeReflectConstruct) {
      var NewTarget = _babel_runtime_helpers_getPrototypeOf__WEBPACK_IMPORTED_MODULE_5___default()(this).constructor;

      result = Reflect.construct(Super, arguments, NewTarget);
    } else {
      result = Super.apply(this, arguments);
    }

    return _babel_runtime_helpers_possibleConstructorReturn__WEBPACK_IMPORTED_MODULE_4___default()(this, result);
  };
}

function _isNativeReflectConstruct() {
  if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  if (Reflect.construct.sham) return false;
  if (typeof Proxy === "function") return true;

  try {
    Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
    return true;
  } catch (e) {
    return false;
  }
}
/* eslint-disable import/first, react/prop-types */







 // fixme, @splunk/charting should be refactor to use locale & timezone instead of i18n functions







var NO_INPLACE_PROPS = ['chart', 'chart.orientation', 'layout.splitSeries', 'chart.style', 'legend.placement'];
var changedOptions = function changedOptions(a, b) {
  return Object.keys(a).filter(function (k) {
    return !(k in b);
  }).concat(Object.keys(b).filter(function (k) {
    return !(k in a) || a[k] !== b[k];
  }));
};
var ChartingContainer = styled_components__WEBPACK_IMPORTED_MODULE_16___default.a.div.withConfig({
  displayName: "Charting__ChartingContainer",
  componentId: "gifkf9-0"
})(["overflow:hidden;position:relative;", ";"], function (props) {
  return Object(_splunk_visualizations_shared_style__WEBPACK_IMPORTED_MODULE_15__["toDimension"])(Object(lodash__WEBPACK_IMPORTED_MODULE_7__["pick"])(props, ['width', 'height']));
});

var Charting = /*#__PURE__*/function (_Component) {
  _babel_runtime_helpers_inherits__WEBPACK_IMPORTED_MODULE_3___default()(Charting, _Component);

  var _super = _createSuper(Charting);

  function Charting(props, context) {
    var _this;

    _babel_runtime_helpers_classCallCheck__WEBPACK_IMPORTED_MODULE_0___default()(this, Charting);

    _this = _super.call(this, props, context);

    _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), "drawChart", Object(lodash__WEBPACK_IMPORTED_MODULE_7__["debounce"])(function () {
      var _this$props = _this.props,
          options = _this$props.options,
          chartData = _this$props.chartData,
          themeKey = _this$props.themeKey,
          colorPalette = _this$props.colorPalette;

      var updatedOptions = _objectSpread(_objectSpread({}, options), {}, {
        shouldColorizeTooltipData: false
      });

      var _this$computeCharting = _this.computeChartingSize(),
          width = _this$computeCharting.width,
          height = _this$computeCharting.height;

      var serializedTimezone = Object(lodash__WEBPACK_IMPORTED_MODULE_7__["get"])(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), ['context', 'serializedTimezone']);
      var ianaTimezone = Object(lodash__WEBPACK_IMPORTED_MODULE_7__["get"])(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), ['context', 'ianaTimezone']);
      var utcOffset = Object(lodash__WEBPACK_IMPORTED_MODULE_7__["get"])(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), ['context', 'utcOffset']);

      if (!width || !height) {
        return;
      }

      if (!chartData || !chartData.length) {
        return;
      }

      try {
        if (_this.needsInit) {
          _this.destroyChart();

          _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_14___default.a.setTheme(themeKey);

          if (colorPalette.length > 0) {
            _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_14___default.a.setColorPalette(colorPalette);
          }

          _this.chart = _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_14___default.a.createChart(_this.container, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, updatedOptions), {}, {
            drilldown: 'all'
          }, typeof serializedTimezone === 'string' && {
            'time.serializedTz': serializedTimezone
          }), typeof ianaTimezone === 'string' && {
            'time.ianaTimezone': ianaTimezone
          }), typeof utcOffset === 'number' && {
            'time.timezoneOffset': utcOffset
          })); // bind event handlers

          _this.chart.on('pointClick', function (e) {
            _this.handleClick(e, 'point.click');
          });

          _this.chart.on('pointMouseOver', function (e) {
            _this.handlePointMouseOver(e, 'point.mouseover');
          });

          _this.chart.on('pointMouseOut', function (e) {
            _this.handlePointMouseOut(e, 'point.mouseout');
          });

          _this.chart.on('legendClick', function (e) {
            _this.handleClick(e, 'legend.click');
          });

          _this.chart.on('chartRangeSelect', _this.handleSelect);
        }

        if (_this.needsRedraw) {
          _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_14___default.a.setTheme(themeKey);

          if (colorPalette.length > 0) {
            _splunk_charting_bundle__WEBPACK_IMPORTED_MODULE_14___default.a.setColorPalette(colorPalette);
          }

          _this.chart.prepareAndDraw(chartData, updatedOptions, function () {});
        }

        if (_this.chart) {
          _this.chart.resize(width, height);
        }

        _this.needsInit = false;
        _this.needsRedraw = false;
      } catch (e) {
        window.console.error('Caught error rendering chart:', e);
      }
    }, 5));

    _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), "onContainerMount", function (container) {
      _this.container = container;

      _this.drawChart();
    });

    _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), "computeChartingSize", function () {
      if (_this.container) {
        var rect = _this.container.getBoundingClientRect();

        return {
          height: rect.height,
          width: rect.width
        };
      }

      return {};
    });

    _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), "handleClick", function (chartEvent, type) {
      // todo: need change this after breaking all visualizations
      if (_this.props.onClick && typeof _this.props.onClick === 'function') {
        _this.props.onClick({
          type: type,
          originalEvent: chartEvent,
          payload: Object(lodash__WEBPACK_IMPORTED_MODULE_7__["pick"])(chartEvent, 'name', 'value', 'name2', 'value2', '_span', 'rowContext', 'modifierKey')
        });

        return;
      } // todo: need remove it after breaking all visualizations
      // the chartEvent here is a jQuery event


      _this.props.onEventTrigger({
        type: type,
        originalEvent: chartEvent,
        payload: Object(lodash__WEBPACK_IMPORTED_MODULE_7__["pick"])(chartEvent, 'name', 'value', 'name2', 'value2', '_span', 'rowContext', 'modifierKey')
      });
    });

    _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), "handlePointMouseOver", function (chartEvent, type) {
      _this.props.onPointMouseOver({
        type: type,
        originalEvent: chartEvent,
        payload: Object(lodash__WEBPACK_IMPORTED_MODULE_7__["pick"])(chartEvent, 'name', 'value', 'name2', 'value2', '_span', 'rowContext', 'modifierKey', 'tooltipContext')
      });
    });

    _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), "handlePointMouseOut", function (chartEvent, type) {
      _this.props.onPointMouseOut({
        type: type,
        originalEvent: chartEvent,
        payload: Object(lodash__WEBPACK_IMPORTED_MODULE_7__["pick"])(chartEvent, 'name', 'value', 'name2', 'value2', '_span', 'rowContext', 'modifierKey', 'tooltipContext')
      });
    });

    _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this), "handleSelect", function (chartEvent) {
      // todo: need change this after breaking all visualizations
      if (_this.props.onSelect && typeof _this.props.onSelect === 'function') {
        _this.props.onSelect({
          type: 'range.select',
          originalEvent: chartEvent,
          payload: Object(lodash__WEBPACK_IMPORTED_MODULE_7__["pick"])(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
        });

        return;
      } // the chartEvent here is a jQuery event


      _this.props.onEventTrigger({
        type: 'range.select',
        originalEvent: chartEvent,
        payload: Object(lodash__WEBPACK_IMPORTED_MODULE_7__["pick"])(chartEvent, 'startXIndex', 'endXIndex', 'startXValue', 'endXValue')
      });
    });

    _this.needsInit = true;
    _this.needsRedraw = true;
    _this.container = null;
    _this.api = new _ChartingApi__WEBPACK_IMPORTED_MODULE_18___default.a(_babel_runtime_helpers_assertThisInitialized__WEBPACK_IMPORTED_MODULE_2___default()(_this));
    return _this;
  }

  _babel_runtime_helpers_createClass__WEBPACK_IMPORTED_MODULE_1___default()(Charting, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this.drawChart();
      this.props.visualizationApiRef(this.api);
    } // eslint-disable-next-line camelcase

  }, {
    key: "UNSAFE_componentWillReceiveProps",
    value: function UNSAFE_componentWillReceiveProps(nextProps) {
      var nextOptions = nextProps.options,
          nextData = nextProps.chartData;
      var _this$props2 = this.props,
          currentOptions = _this$props2.options,
          currentData = _this$props2.chartData;

      if (!this.chart || !Charting.canUpdateInPlace(currentOptions, nextOptions)) {
        this.needsInit = true;
      }

      if (!Object(lodash__WEBPACK_IMPORTED_MODULE_7__["isEqual"])(currentOptions, nextOptions) || !Object(lodash__WEBPACK_IMPORTED_MODULE_7__["isEqual"])(currentData.toJSON(), nextData.toJSON()) || !Object(lodash__WEBPACK_IMPORTED_MODULE_7__["isEqual"])(currentData.annotations, nextData.annotations)) {
        this.needsRedraw = true;
      }
    }
  }, {
    key: "componentDidUpdate",
    value: function componentDidUpdate() {
      this.drawChart();
    }
  }, {
    key: "componentWillUnmount",
    value: function componentWillUnmount() {
      this.props.visualizationApiRef(null);
      this.destroyChart();
    }
  }, {
    key: "destroyChart",
    value: function destroyChart() {
      if (this.chart) {
        this.chart.destroy();
        this.chart = null;
      }

      this.needsRedraw = true;
      this.needsInit = true;
    }
  }, {
    key: "render",
    value: function render() {
      var _this$props3 = this.props,
          width = _this$props3.width,
          height = _this$props3.height,
          style = _this$props3.style,
          chartData = _this$props3.chartData;
      return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(ChartingContainer, {
        "data-test": "charting-container",
        style: style,
        width: width,
        height: height,
        ref: this.onContainerMount
      }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(react_event_listener__WEBPACK_IMPORTED_MODULE_11___default.a, {
        target: window,
        onResize: this.drawChart
      }), !chartData && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(_splunk_visualizations_shared_Message__WEBPACK_IMPORTED_MODULE_17___default.a, {
        text: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_8__["_"])('No DataSource'),
        level: "warning"
      }), chartData && !chartData.length && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(_splunk_visualizations_shared_Message__WEBPACK_IMPORTED_MODULE_17___default.a, {
        text: Object(_splunk_ui_utils_i18n__WEBPACK_IMPORTED_MODULE_8__["_"])('No Result'),
        level: "info"
      }));
    }
  }], [{
    key: "canUpdateInPlace",
    value:
    /**
     * Check if a chart can be updated without re-init
     */
    function canUpdateInPlace(curOptions, nextOptions) {
      return !NO_INPLACE_PROPS.some(function (p) {
        return curOptions[p] !== nextOptions[p];
      }) && !changedOptions(curOptions, nextOptions).some(function (p) {
        return p.toLowerCase().endsWith('color');
      });
    }
  }]);

  return Charting;
}(react__WEBPACK_IMPORTED_MODULE_9__["Component"]);

_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(Charting, "propTypes", {
  /**
   * width in pixel or string, defaults to 100%
   */
  width: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.number]),

  /**
   * height in pixel or string
   */
  height: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.oneOfType([prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.string, prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.number]),

  /**
   * visualization formatting options
   */
  options: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.object,

  /**
   * charting dataset from jsCharting.extractChartReadyData
   */
  chartData: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.object,

  /**
   * callbacks to trigger event
   */
  onEventTrigger: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.func,
  onClick: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.func,
  onSelect: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.func,
  onPointMouseOver: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.func,
  onPointMouseOut: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.func,

  /**
   * Custom style on visualization
   */
  style: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.object,
  themeKey: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.string,
  colorPalette: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.array,
  visualizationApiRef: prop_types__WEBPACK_IMPORTED_MODULE_10___default.a.func
});

_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(Charting, "defaultProps", {
  width: '100%',
  options: {},
  style: {},
  // todo: need remove it
  onEventTrigger: function onEventTrigger() {},
  // todo: need change to a function
  onClick: null,
  onSelect: null,
  onPointMouseOver: function onPointMouseOver() {},
  onPointMouseOut: function onPointMouseOut() {},
  colorPalette: [],
  visualizationApiRef: function visualizationApiRef() {}
});

_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(Charting, "contextType", _splunk_visualization_context_TimezoneContext__WEBPACK_IMPORTED_MODULE_13___default.a);



/***/ }),
/* 24 */
/***/ (function(module, exports) {

module.exports = require("@splunk/visualizations-shared/i18n");

/***/ })
/******/ ]);
//# sourceMappingURL=Charting.js.map