"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const vector = require("../../../../../../zrender@5.4.4/node_modules/zrender/lib/core/vector.js");
const util = require("../../../../../../zrender@5.4.4/node_modules/zrender/lib/core/util.js");
const multipleGraphEdgeHelper = require("../helper/multipleGraphEdgeHelper.js");
function simpleLayout(seriesModel) {
  var coordSys = seriesModel.coordinateSystem;
  if (coordSys && coordSys.type !== "view") {
    return;
  }
  var graph = seriesModel.getGraph();
  graph.eachNode(function(node) {
    var model = node.getModel();
    node.setLayout([+model.get("x"), +model.get("y")]);
  });
  simpleLayoutEdge(graph, seriesModel);
}
function simpleLayoutEdge(graph, seriesModel) {
  graph.eachEdge(function(edge, index) {
    var curveness = util.retrieve3(edge.getModel().get(["lineStyle", "curveness"]), -multipleGraphEdgeHelper.getCurvenessForEdge(edge, seriesModel, index, true), 0);
    var p1 = vector.clone(edge.node1.getLayout());
    var p2 = vector.clone(edge.node2.getLayout());
    var points = [p1, p2];
    if (+curveness) {
      points.push([(p1[0] + p2[0]) / 2 - (p1[1] - p2[1]) * curveness, (p1[1] + p2[1]) / 2 - (p2[0] - p1[0]) * curveness]);
    }
    edge.setLayout(points);
  });
}
exports.simpleLayout = simpleLayout;
exports.simpleLayoutEdge = simpleLayoutEdge;
