"use strict";

var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"), _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

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 _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, s = e.onAddConnection, a = e.zoom, i = e.onZoom, p = e.onRemoveConnection, c = e.onRemoveNode, d = e.nodeProps, f = t.nodes, m = t.connections;
            return _react.default.createElement(_amosJsplumb.AmosPlumb, {
                className: "amos-plumb-container",
                key: "amos-plumb",
                onCreated: r,
                nodes: f,
                connections: m,
                eventListeners: u,
                registerTypes: registerTypes,
                onChange: o,
                onPlumbClick: n,
                jsPlumbSettings: defaultSettings,
                getNodeContent: _customElelist.default,
                destroy: l,
                zoom: a,
                showControl: !0,
                draggableOptions: {
                    constrain: !0
                },
                onAddConnection: s,
                onRemoveConnection: p,
                onRemoveNode: c,
                onZoom: i,
                nodeProps: d
            });
        }
    } ]), 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;