import { n as g } from "./chunk-AGHRB4JF.js";
var m = /* @__PURE__ */ g((t, n) => {
  if (n) return "translate(" + -t.width / 2 + ", " + -t.height / 2 + ")";
  const l = t.x ?? 0, r = t.y ?? 0;
  return "translate(" + -(l + t.width / 2) + ", " + -(r + t.height / 2) + ")";
}, "computeLabelTransform"), c = {
  aggregation: 17.25,
  extension: 17.25,
  composition: 17.25,
  dependency: 6,
  lollipop: 13.5,
  arrow_point: 4,
  arrow_barb: 0,
  arrow_barb_neo: 5.5
}, O = {
  arrow_point: 4,
  arrow_cross: 12.5,
  arrow_circle: 12.5
};
function p(t, n) {
  if (t === void 0 || n === void 0) return {
    angle: 0,
    deltaX: 0,
    deltaY: 0
  };
  t = e(t), n = e(n);
  const [l, r] = [t.x, t.y], [o, f] = [n.x, n.y], a = o - l, w = f - r;
  return {
    angle: Math.atan(w / a),
    deltaX: a,
    deltaY: w
  };
}
g(p, "calculateDeltaAndAngle");
var e = /* @__PURE__ */ g((t) => Array.isArray(t) ? {
  x: t[0],
  y: t[1]
} : t, "pointTransformer"), E = /* @__PURE__ */ g((t) => ({
  x: /* @__PURE__ */ g(function(n, l, r) {
    let o = 0;
    const f = e(r[0]).x < e(r[r.length - 1]).x ? "left" : "right";
    if (l === 0 && Object.hasOwn(c, t.arrowTypeStart)) {
      const { angle: s, deltaX: u } = p(r[0], r[1]);
      o = c[t.arrowTypeStart] * Math.cos(s) * (u >= 0 ? 1 : -1);
    } else if (l === r.length - 1 && Object.hasOwn(c, t.arrowTypeEnd)) {
      const { angle: s, deltaX: u } = p(r[r.length - 1], r[r.length - 2]);
      o = c[t.arrowTypeEnd] * Math.cos(s) * (u >= 0 ? 1 : -1);
    }
    const a = Math.abs(e(n).x - e(r[r.length - 1]).x), w = Math.abs(e(n).y - e(r[r.length - 1]).y), h = Math.abs(e(n).x - e(r[0]).x), x = Math.abs(e(n).y - e(r[0]).y), i = c[t.arrowTypeStart], y = c[t.arrowTypeEnd], T = 1;
    if (a < y && a > 0 && w < y) {
      let s = y + T - a;
      s *= f === "right" ? -1 : 1, o -= s;
    }
    if (h < i && h > 0 && x < i) {
      let s = i + T - h;
      s *= f === "right" ? -1 : 1, o += s;
    }
    return e(n).x + o;
  }, "x"),
  y: /* @__PURE__ */ g(function(n, l, r) {
    let o = 0;
    const f = e(r[0]).y < e(r[r.length - 1]).y ? "down" : "up";
    if (l === 0 && Object.hasOwn(c, t.arrowTypeStart)) {
      const { angle: s, deltaY: u } = p(r[0], r[1]);
      o = c[t.arrowTypeStart] * Math.abs(Math.sin(s)) * (u >= 0 ? 1 : -1);
    } else if (l === r.length - 1 && Object.hasOwn(c, t.arrowTypeEnd)) {
      const { angle: s, deltaY: u } = p(r[r.length - 1], r[r.length - 2]);
      o = c[t.arrowTypeEnd] * Math.abs(Math.sin(s)) * (u >= 0 ? 1 : -1);
    }
    const a = Math.abs(e(n).y - e(r[r.length - 1]).y), w = Math.abs(e(n).x - e(r[r.length - 1]).x), h = Math.abs(e(n).y - e(r[0]).y), x = Math.abs(e(n).x - e(r[0]).x), i = c[t.arrowTypeStart], y = c[t.arrowTypeEnd], T = 1;
    if (a < y && a > 0 && w < y) {
      let s = y + T - a;
      s *= f === "up" ? -1 : 1, o -= s;
    }
    if (h < i && h > 0 && x < i) {
      let s = i + T - h;
      s *= f === "up" ? -1 : 1, o += s;
    }
    return e(n).y + o;
  }, "y")
}), "getLineFunctionsWithOffset");
export {
  O as i,
  E as n,
  c as r,
  m as t
};

//# sourceMappingURL=chunk-BSJP7CBP.js.map