import { __exports as h } from "./index-react-apexcharts.min3.js";
import { __require as S } from "./index-apexcharts.common.js";
import k from "react";
import { __require as A } from "./index-prop-types.js";
var g;
function D() {
  if (g) return h;
  g = 1, Object.defineProperty(h, "__esModule", { value: !0 });
  var m = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
    return typeof e;
  } : function(e) {
    return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
  }, v = Object.assign || function(e) {
    for (var t = 1; t < arguments.length; t++) {
      var r = arguments[t];
      for (var n in r) Object.prototype.hasOwnProperty.call(r, n) && (e[n] = r[n]);
    }
    return e;
  }, O = /* @__PURE__ */ (function() {
    function e(t, r) {
      for (var n = 0; n < r.length; n++) {
        var i = r[n];
        i.enumerable = i.enumerable || !1, i.configurable = !0, "value" in i && (i.writable = !0), Object.defineProperty(t, i.key, i);
      }
    }
    return function(t, r, n) {
      return r && e(t.prototype, r), n && e(t, n), t;
    };
  })(), w = S(), y = l(w), d = k, f = l(d), j = /* @__PURE__ */ A(), p = l(j);
  function l(e) {
    return e && e.__esModule ? e : { default: e };
  }
  function R(e, t, r) {
    return t in e ? Object.defineProperty(e, t, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[t] = r, e;
  }
  function x(e, t) {
    var r = {};
    for (var n in e) 0 <= t.indexOf(n) || Object.prototype.hasOwnProperty.call(e, n) && (r[n] = e[n]);
    return r;
  }
  function C(e, t) {
    if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
  }
  function P(e, t) {
    if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return !t || typeof t != "object" && typeof t != "function" ? e : t;
  }
  function q(e, t) {
    if (typeof t != "function" && t !== null) throw new TypeError("Super expression must either be null or a function, not " + typeof t);
    e.prototype = Object.create(t && t.prototype, { constructor: { value: e, enumerable: !1, writable: !0, configurable: !0 } }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
  }
  window.ApexCharts = y.default;
  var b = (function() {
    function e(t) {
      C(this, e);
      var r = P(this, (e.__proto__ || Object.getPrototypeOf(e)).call(this, t));
      return f.default.createRef ? r.chartRef = f.default.createRef() : r.setRef = function(n) {
        return r.chartRef = n;
      }, r.chart = null, r;
    }
    return q(e, d.Component), O(e, [{ key: "render", value: function() {
      var t = this.props, r = (t.type, t.height, t.width, t.series, t.options, x(t, ["type", "height", "width", "series", "options"]));
      return f.default.createElement("div", v({ ref: f.default.createRef ? this.chartRef : this.setRef }, r));
    } }, { key: "componentDidMount", value: function() {
      var t = f.default.createRef ? this.chartRef.current : this.chartRef;
      this.chart = new y.default(t, this.getConfig()), this.chart.render();
    } }, { key: "getConfig", value: function() {
      var t = this.props, r = t.type, n = t.height, i = t.width, o = t.series, s = t.options, a = { chart: { type: r, height: n, width: i }, series: o };
      return this.extend(s, a);
    } }, { key: "isObject", value: function(t) {
      return t && (t === void 0 ? "undefined" : m(t)) === "object" && !Array.isArray(t) && t != null;
    } }, { key: "extend", value: function(t, r) {
      var n = this;
      typeof Object.assign != "function" && (Object.assign = function(o) {
        if (o == null) throw new TypeError("Cannot convert undefined or null to object");
        for (var s = Object(o), a = 1; a < arguments.length; a++) {
          var u = arguments[a];
          if (u != null) for (var c in u) u.hasOwnProperty(c) && (s[c] = u[c]);
        }
        return s;
      });
      var i = Object.assign({}, t);
      return this.isObject(t) && this.isObject(r) && Object.keys(r).forEach(function(o) {
        n.isObject(r[o]) && o in t ? i[o] = n.extend(t[o], r[o]) : Object.assign(i, R({}, o, r[o]));
      }), i;
    } }, { key: "componentDidUpdate", value: function(t) {
      if (!this.chart) return null;
      var r = this.props, n = r.options, i = r.series, o = r.height, s = r.width, a = JSON.stringify(t.options), u = JSON.stringify(t.series), c = JSON.stringify(n), _ = JSON.stringify(i);
      a === c && u === _ && o === t.height && s === t.width || (u === _ ? this.chart.updateOptions(this.getConfig()) : a === c && o === t.height && s === t.width ? this.chart.updateSeries(i) : this.chart.updateOptions(this.getConfig()));
    } }, { key: "componentWillUnmount", value: function() {
      this.chart && typeof this.chart.destroy == "function" && this.chart.destroy();
    } }]), e;
  })();
  return (h.default = b).propTypes = { type: p.default.string.isRequired, width: p.default.any, height: p.default.any, series: p.default.array.isRequired, options: p.default.object.isRequired }, b.defaultProps = { type: "line", width: "100%", height: "auto" }, h;
}
export {
  D as __require
};
