"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"), _typeof = require("@babel/runtime/helpers/typeof");

Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")), _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")), _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")), _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")), _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")), _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty")), _react = _interopRequireWildcard(require("react")), _propTypes = _interopRequireDefault(require("prop-types")), _amosJsplumb = require("amos-jsplumb"), _nodeConf = require("./modelConf/nodeConf"), _customElelist = _interopRequireDefault(require("./ele/customElelist"));

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

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

function _createSuper(e) {
  var t = _isNativeReflectConstruct();
  return function() {
    var o, r = (0, _getPrototypeOf2.default)(e);
    if (t) {
      var n = (0, _getPrototypeOf2.default)(this).constructor;
      o = Reflect.construct(r, arguments, n);
    } else o = r.apply(this, arguments);
    return (0, _possibleConstructorReturn2.default)(this, o);
  };
}

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

var dottedConnectionStyle = _amosJsplumb.setting.dottedConnectionStyle, selectedConnectionStyle = _amosJsplumb.setting.selectedConnectionStyle, defaultSettings = _amosJsplumb.setting.defaultSettings, registerTypes = {
  connections: {
    dotted: dottedConnectionStyle,
    selected: selectedConnectionStyle
  },
  endpoints: {}
}, TopoStagePlumb = function(e) {
  (0, _inherits2.default)(o, e);
  var t = _createSuper(o);
  function o() {
    return (0, _classCallCheck2.default)(this, o), t.apply(this, arguments);
  }
  return (0, _createClass2.default)(o, [ {
    key: "render",
    value: function() {
      var e = this.props, t = e.dataSource, o = e.onPlumbChange, r = e.onSceneCreated, n = e.onPlumbClick, u = e.eventListeners, l = e.destroy, a = e.onAddConnection, s = e.zoom, i = e.onZoom, p = e.onRemoveConnection, c = e.onRemoveNode, f = e.nodeProps, d = t.nodes, _ = t.connections;
      return _react.default.createElement(_amosJsplumb.AmosPlumb, {
        className: "amos-plumb-container",
        key: "amos-plumb",
        onCreated: r,
        nodes: d,
        connections: _,
        eventListeners: u,
        registerTypes: registerTypes,
        onChange: o,
        onPlumbClick: n,
        jsPlumbSettings: defaultSettings,
        getNodeContent: _customElelist.default,
        destroy: l,
        zoom: s,
        showControl: !0,
        draggableOptions: {
          constrain: !0
        },
        onAddConnection: a,
        onRemoveConnection: p,
        onRemoveNode: c,
        onZoom: i,
        nodeProps: f
      });
    }
  } ]), o;
}(_react.Component);

(0, _defineProperty2.default)(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 = _default;