"use strict";
Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;
var _react = _interopRequireWildcard(require("react")),
  _propTypes = _interopRequireDefault(require("prop-types")),
  _amosJsplumb = require("amos-jsplumb"),
  _nodeConf = require("./modelConf/nodeConf"),
  _customElelist = _interopRequireDefault(require("./ele/customElelist"));

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

function _getRequireWildcardCache() {
  if ("function" != typeof WeakMap) return null;
  var e = new WeakMap;
  return _getRequireWildcardCache = function() {
    return e
  }, e
}

function _interopRequireWildcard(e) {
  if (e && e.__esModule) return e;
  if (null === e || "object" !== _typeof(e) && "function" != typeof e) return {
    default: e
  };
  var t = _getRequireWildcardCache();
  if (t && t.has(e)) return t.get(e);
  var o, n, r = {},
    u = Object.defineProperty && Object.getOwnPropertyDescriptor;
  for (o in e) Object.prototype.hasOwnProperty.call(e, o) && ((n = u ? Object.getOwnPropertyDescriptor(e, o) : null) && (n.get || n.set) ? Object.defineProperty(r, o, n) : r[o] = e[o]);
  return r.default = e, t && t.set(e, r), r
}

function _typeof(e) {
  return (_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
    return typeof e
  } : function(e) {
    return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
  })(e)
}

function _classCallCheck(e, t) {
  if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}

function _defineProperties(e, t) {
  for (var o = 0; o < t.length; o++) {
    var n = t[o];
    n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n)
  }
}

function _createClass(e, t, o) {
  return t && _defineProperties(e.prototype, t), o && _defineProperties(e, o), e
}

function _inherits(e, t) {
  if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
  e.prototype = Object.create(t && t.prototype, {
    constructor: {
      value: e,
      writable: !0,
      configurable: !0
    }
  }), t && _setPrototypeOf(e, t)
}

function _setPrototypeOf(e, t) {
  return (_setPrototypeOf = Object.setPrototypeOf || function(e, t) {
    return e.__proto__ = t, e
  })(e, t)
}

function _createSuper(o) {
  var n = _isNativeReflectConstruct();
  return function() {
    var e, t = _getPrototypeOf(o);
    return _possibleConstructorReturn(this, n ? (e = _getPrototypeOf(this).constructor, Reflect.construct(t, arguments, e)) : t.apply(this, arguments))
  }
}

function _possibleConstructorReturn(e, t) {
  return !t || "object" !== _typeof(t) && "function" != typeof t ? _assertThisInitialized(e) : t
}

function _assertThisInitialized(e) {
  if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  return e
}

function _isNativeReflectConstruct() {
  if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
  if (Reflect.construct.sham) return !1;
  if ("function" == typeof Proxy) return !0;
  try {
    return Date.prototype.toString.call(Reflect.construct(Date, [], function() {})), !0
  } catch (e) {
    return !1
  }
}

function _getPrototypeOf(e) {
  return (_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
    return e.__proto__ || Object.getPrototypeOf(e)
  })(e)
}

function _defineProperty(e, t, o) {
  return t in e ? Object.defineProperty(e, t, {
    value: o,
    enumerable: !0,
    configurable: !0,
    writable: !0
  }) : e[t] = o, e
}
var dottedConnectionStyle = _amosJsplumb.setting.dottedConnectionStyle,
  selectedConnectionStyle = _amosJsplumb.setting.selectedConnectionStyle,
  defaultSettings = _amosJsplumb.setting.defaultSettings,
  registerTypes = {
    connections: {
      dotted: dottedConnectionStyle,
      selected: selectedConnectionStyle
    },
    endpoints: {}
  },
  TopoStagePlumb = function() {
    _inherits(t, _react.Component);
    var e = _createSuper(t);

    function t() {
      return _classCallCheck(this, t), e.apply(this, arguments)
    }
    return _createClass(t, [{
      key: "render",
      value: function() {
        var e = this.props,
          t = e.dataSource,
          o = e.onPlumbChange,
          n = e.onSceneCreated,
          r = e.onPlumbClick,
          u = e.eventListeners,
          i = e.destroy,
          s = e.onAddConnection,
          p = e.zoom,
          c = e.onZoom,
          a = e.onRemoveConnection,
          l = e.onRemoveNode,
          f = e.nodeProps,
          e = t.nodes,
          t = t.connections;
        return _react.default.createElement(_amosJsplumb.AmosPlumb, {
          className: "amos-plumb-container",
          key: "amos-plumb",
          onCreated: n,
          nodes: e,
          connections: t,
          eventListeners: u,
          registerTypes: registerTypes,
          onChange: o,
          onPlumbClick: r,
          jsPlumbSettings: defaultSettings,
          getNodeContent: _customElelist.default,
          destroy: i,
          zoom: p,
          showControl: !0,
          draggableOptions: {
            constrain: !0
          },
          onAddConnection: s,
          onRemoveConnection: a,
          onRemoveNode: l,
          onZoom: c,
          nodeProps: f
        })
      }
    }]), t
  }();
_defineProperty(TopoStagePlumb, "propTypes", {
  dataSource: _propTypes.default.shape({
    nodes: _propTypes.default.array,
    connections: _propTypes.default.array
  }),
  handleDrop: _propTypes.default.func,
  onPlumbChange: _propTypes.default.func,
  onSceneCreated: _propTypes.default.func,
  onPlumbClick: _propTypes.default.func,
  destroy: _propTypes.default.bool,
  eventListeners: _propTypes.default.object,
  onAddConnection: _propTypes.default.func,
  zoom: _propTypes.default.number,
  onZoom: _propTypes.default.func,
  onRemoveConnection: _propTypes.default.func,
  onRemoveNode: _propTypes.default.func,
  nodeProps: _propTypes.default.object
}), TopoStagePlumb.displayName = "TopoStagePlumb";
var _default = TopoStagePlumb;
exports.default = TopoStagePlumb, module.exports = exports.default;
