"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var react_1 = __importDefault(require("react"));
var errorBoundary_1 = __importDefault(require("../../errorBoundary"));
var useGraphs_1 = __importDefault(require("../../hooks/useGraphs"));
var useProps_1 = __importDefault(require("../../hooks/useProps"));
var createLoading_1 = __importDefault(require("../../utils/createLoading"));
var constants_1 = require("../../constants");
var defaultLayout = {
    type: 'radial',
    unitRadius: 50,
    preventOverlap: true,
    maxPreventOverlapIteration: 100,
};
var defaultProps = {
    nodeCfg: {
        type: 'circle',
        size: 10,
        anchorPoints: constants_1.defaultFlowGraphAnchorPoints,
        linkCenter: true,
        nodeStateStyles: constants_1.defaultStateStyles,
        style: constants_1.defaultNodeStyle,
    },
    edgeCfg: {
        type: 'line',
        edgeStateStyles: constants_1.defaultStateStyles,
    },
    behaviors: ['zoom-canvas', 'drag-canvas'],
    layout: defaultLayout,
    animate: true,
    markerPosition: 'right',
    autoFit: true,
    fitCenter: true,
    style: {
        position: 'relative',
        height: 'inherit',
        backgroundColor: '#fff',
    },
};
var RadialGraph = function (props) {
    var uProps = (0, useProps_1.default)(props, defaultProps).uProps;
    var className = uProps.className, style = uProps.style, loading = uProps.loading, loadingTemplate = uProps.loadingTemplate, errorTemplate = uProps.errorTemplate, rest = __rest(uProps, ["className", "style", "loading", "loadingTemplate", "errorTemplate"]);
    var container = (0, useGraphs_1.default)('Graph', rest, { name: 'RadialGraph' }).container;
    return (react_1.default.createElement(errorBoundary_1.default, { errorTemplate: errorTemplate },
        loading && react_1.default.createElement(createLoading_1.default, { loadingTemplate: loadingTemplate }),
        react_1.default.createElement("div", { className: className, style: style, ref: container })));
};
exports.default = RadialGraph;
