UNPKG

vue-data-ui

Version:

A user-empowering data visualization Vue 3 components library for eloquent data storytelling

2,807 lines 94.3 kB
import { ref as E, watchEffect as an, unref as v, defineAsyncComponent as et, toRefs as ln, computed as H, onMounted as Gt, nextTick as Ne, watch as Ae, onBeforeUnmount as jt, createElementBlock as _, openBlock as y, normalizeStyle as ce, normalizeClass as Wt, createCommentVNode as L, createBlock as te, createVNode as tt, toDisplayString as Se, withCtx as F, renderSlot as M, normalizeProps as z, guardReactiveProps as V, createSlots as cn, createElementVNode as K, Fragment as ue, renderList as Le, withModifiers as Yt, mergeProps as ot, createTextVNode as un, Transition as Ht, Teleport as Ut } from "vue";
import { c as ut, aB as dn, t as fn, o as hn, g as Zt, m as Xt, X as mn, as as gn } from "./lib-2iaAPQ_c.js";
import { t as vn, u as pn } from "./useResponsive-DfdjqQps.js";
import { u as bn } from "./usePanZoom-CDF7rb3o.js";
import { u as wn, a as nt } from "./useNestedProp-2p4Tjzc8.js";
import { u as yn, B as kn } from "./BaseScanner-BMpwQAfz.js";
import { u as En } from "./usePrinter-ChVMpU2f.js";
import { u as Cn } from "./useSvgExport-ByUukOZt.js";
import { u as _n } from "./useThemeCheck-DGJ31Vi5.js";
import { u as xn } from "./useUserOptionState-BIvW1Kz7.js";
import { u as Nn } from "./useChartAccessibility-9icAAmYg.js";
import An from "./Title-DSOZzIrU.js";
import { B as qt } from "./BaseZoomControls-e4hnaBoq.js";
import Sn from "./img-CqYIrJ8I.js";
import { _ as Ln } from "./_plugin-vue_export-helper-CHgC5LLL.js";
const Mn = "\0", de = "\0", Kt = "";
class oe {
  _isDirected = !0;
  _isMultigraph = !1;
  _isCompound = !1;
  // Label for the graph itself
  _label;
  // Defaults to be set when creating a new node
  _defaultNodeLabelFn = () => {
  };
  // Defaults to be set when creating a new edge
  _defaultEdgeLabelFn = () => {
  };
  // v -> label
  _nodes = {};
  // v -> edgeObj
  _in = {};
  // u -> v -> Number
  _preds = {};
  // v -> edgeObj
  _out = {};
  // v -> w -> Number
  _sucs = {};
  // e -> edgeObj
  _edgeObjs = {};
  // e -> label
  _edgeLabels = {};
  /* Number of nodes in the graph. Should only be changed by the implementation. */
  _nodeCount = 0;
  /* Number of edges in the graph. Should only be changed by the implementation. */
  _edgeCount = 0;
  _parent;
  _children;
  constructor(t) {
    t && (this._isDirected = Object.hasOwn(t, "directed") ? t.directed : !0, this._isMultigraph = Object.hasOwn(t, "multigraph") ? t.multigraph : !1, this._isCompound = Object.hasOwn(t, "compound") ? t.compound : !1), this._isCompound && (this._parent = {}, this._children = {}, this._children[de] = {});
  }
  /* === Graph functions ========= */
  /**
   * Whether graph was created with 'directed' flag set to true or not.
   */
  isDirected() {
    return this._isDirected;
  }
  /**
   * Whether graph was created with 'multigraph' flag set to true or not.
   */
  isMultigraph() {
    return this._isMultigraph;
  }
  /**
   * Whether graph was created with 'compound' flag set to true or not.
   */
  isCompound() {
    return this._isCompound;
  }
  /**
   * Sets the label of the graph.
   */
  setGraph(t) {
    return this._label = t, this;
  }
  /**
   * Gets the graph label.
   */
  graph() {
    return this._label;
  }
  /* === Node functions ========== */
  /**
   * Sets the default node label. If newDefault is a function, it will be
   * invoked each time when setting a label for a node. Otherwise, this label
   * will be assigned as default label in case if no label was specified while
   * setting a node.
   * Complexity: O(1).
   */
  setDefaultNodeLabel(t) {
    return this._defaultNodeLabelFn = t, typeof t != "function" && (this._defaultNodeLabelFn = () => t), this;
  }
  /**
   * Gets the number of nodes in the graph.
   * Complexity: O(1).
   */
  nodeCount() {
    return this._nodeCount;
  }
  /**
   * Gets all nodes of the graph. Note, the in case of compound graph subnodes are
   * not included in list.
   * Complexity: O(1).
   */
  nodes() {
    return Object.keys(this._nodes);
  }
  /**
   * Gets list of nodes without in-edges.
   * Complexity: O(|V|).
   */
  sources() {
    const t = this;
    return this.nodes().filter((o) => Object.keys(t._in[o]).length === 0);
  }
  /**
   * Gets list of nodes without out-edges.
   * Complexity: O(|V|).
   */
  sinks() {
    const t = this;
    return this.nodes().filter((o) => Object.keys(t._out[o]).length === 0);
  }
  /**
   * Invokes setNode method for each node in names list.
   * Complexity: O(|names|).
   */
  setNodes(t, o) {
    const n = arguments, s = this;
    return t.forEach((i) => {
      n.length > 1 ? s.setNode(i, o) : s.setNode(i);
    }), this;
  }
  /**
   * Creates or updates the value for the node v in the graph. If value is supplied
   * it is set as the value for the node. If value is not supplied and the node was
   * created by this call then the default node label will be assigned.
   * Complexity: O(1).
   */
  setNode(t, o) {
    return Object.hasOwn(this._nodes, t) ? (arguments.length > 1 && (this._nodes[t] = o), this) : (this._nodes[t] = arguments.length > 1 ? o : this._defaultNodeLabelFn(t), this._isCompound && (this._parent[t] = de, this._children[t] = {}, this._children[de][t] = !0), this._in[t] = {}, this._preds[t] = {}, this._out[t] = {}, this._sucs[t] = {}, ++this._nodeCount, this);
  }
  /**
   * Gets the label of node with specified name.
   * Complexity: O(1).
   */
  node(t) {
    return this._nodes[t];
  }
  /**
   * Detects whether graph has a node with specified name or not.
   */
  hasNode(t) {
    return Object.hasOwn(this._nodes, t);
  }
  /**
   * Remove the node with the name from the graph or do nothing if the node is not in
   * the graph. If the node was removed this function also removes any incident
   * edges.
   * Complexity: O(1).
   */
  removeNode(t) {
    const o = this;
    if (Object.hasOwn(this._nodes, t)) {
      const n = (s) => o.removeEdge(o._edgeObjs[s]);
      delete this._nodes[t], this._isCompound && (this._removeFromParentsChildList(t), delete this._parent[t], this.children(t).forEach((s) => {
        o.setParent(s);
      }), delete this._children[t]), Object.keys(this._in[t]).forEach(n), delete this._in[t], delete this._preds[t], Object.keys(this._out[t]).forEach(n), delete this._out[t], delete this._sucs[t], --this._nodeCount;
    }
    return this;
  }
  /**
   * Sets node parentId as a parent for node nodeId if it is defined, or removes the
   * parent for nodeId if parentId is undefined. Method throws an exception in case of
   * invoking it in context of noncompound graph.
   * Average-case complexity: O(1).
   */
  setParent(t, o) {
    if (!this._isCompound)
      throw new Error("Cannot set parent in a non-compound graph");
    if (o === void 0)
      o = de;
    else {
      o += "";
      for (let n = o; n !== void 0; n = this.parent(n))
        if (n === t)
          throw new Error(
            "Setting " + o + " as parent of " + t + " would create a cycle"
          );
      this.setNode(o);
    }
    return this.setNode(t), this._removeFromParentsChildList(t), this._parent[t] = o, this._children[o][t] = !0, this;
  }
  _removeFromParentsChildList(t) {
    delete this._children[this._parent[t]][t];
  }
  /**
   * Gets parent node for node nodeId.
   * Complexity: O(1).
   */
  parent(t) {
    if (this._isCompound) {
      const o = this._parent[t];
      if (o !== de)
        return o;
    }
  }
  /**
   * Gets list of direct children of node nodeId.
   * Complexity: O(1).
   */
  children(t = de) {
    if (this._isCompound) {
      const o = this._children[t];
      if (o)
        return Object.keys(o);
    } else {
      if (t === de)
        return this.nodes();
      if (this.hasNode(t))
        return [];
    }
  }
  /**
   * Return all nodes that are predecessors of the specified node or undefined if nodeId is not in
   * the graph. Behavior is undefined for undirected graphs - use neighbors instead.
   * Complexity: O(|V|).
   */
  predecessors(t) {
    const o = this._preds[t];
    if (o)
      return Object.keys(o);
  }
  /**
   * Return all nodes that are successors of the specified node or undefined if nodeId is not in
   * the graph. Behavior is undefined for undirected graphs - use neighbors instead.
   * Complexity: O(|V|).
   */
  successors(t) {
    const o = this._sucs[t];
    if (o)
      return Object.keys(o);
  }
  /**
   * Return all nodes that are predecessors or successors of the specified node or undefined if
   * nodeId is not in the graph.
   * Complexity: O(|V|).
   */
  neighbors(t) {
    const o = this.predecessors(t);
    if (o) {
      const n = new Set(o);
      for (const s of this.successors(t))
        n.add(s);
      return Array.from(n.values());
    }
  }
  isLeaf(t) {
    let o;
    return this.isDirected() ? o = this.successors(t) : o = this.neighbors(t), o.length === 0;
  }
  /**
   * Creates new graph with nodes filtered via filter. Edges incident to rejected node
   * are also removed. In case of compound graph, if parent is rejected by filter,
   * then all its children are rejected too.
   * Average-case complexity: O(|E|+|V|).
   */
  filterNodes(t) {
    const o = new this.constructor({
      directed: this._isDirected,
      multigraph: this._isMultigraph,
      compound: this._isCompound
    });
    o.setGraph(this.graph());
    const n = this;
    Object.entries(this._nodes).forEach(([r, a]) => {
      t(r) && o.setNode(r, a);
    }), Object.values(this._edgeObjs).forEach((r) => {
      o.hasNode(r.v) && o.hasNode(r.w) && o.setEdge(r, n.edge(r));
    });
    const s = {};
    function i(r) {
      const a = n.parent(r);
      return a === void 0 || o.hasNode(a) ? (s[r] = a, a) : a in s ? s[a] : i(a);
    }
    return this._isCompound && o.nodes().forEach((r) => o.setParent(r, i(r))), o;
  }
  /* === Edge functions ========== */
  /**
   * Sets the default edge label or factory function. This label will be
   * assigned as default label in case if no label was specified while setting
   * an edge or this function will be invoked each time when setting an edge
   * with no label specified and returned value will be used as a label for edge.
   * Complexity: O(1).
   */
  setDefaultEdgeLabel(t) {
    return this._defaultEdgeLabelFn = t, typeof t != "function" && (this._defaultEdgeLabelFn = () => t), this;
  }
  /**
   * Gets the number of edges in the graph.
   * Complexity: O(1).
   */
  edgeCount() {
    return this._edgeCount;
  }
  /**
   * Gets edges of the graph. In case of compound graph subgraphs are not considered.
   * Complexity: O(|E|).
   */
  edges() {
    return Object.values(this._edgeObjs);
  }
  /**
   * Establish an edges path over the nodes in nodeIds list. If some edge already
   * exists, it will update its label, otherwise it will create an edge between pair
   * of nodes with label provided or default label if no label provided.
   * Complexity: O(|nodeIds|).
   */
  setPath(t, o) {
    const n = this, s = arguments;
    return t.reduce((i, r) => (s.length > 1 ? n.setEdge(i, r, o) : n.setEdge(i, r), r)), this;
  }
  /**
   * Creates or updates the label for the edge (v, w) with the optionally supplied
   * name. If value is supplied it is set as the value for the edge. If value is not
   * supplied and the edge was created by this call then the default edge label will
   * be assigned. The name parameter is only useful with multigraphs.
   */
  setEdge() {
    let t, o, n, s, i = !1;
    const r = arguments[0];
    typeof r == "object" && r !== null && "v" in r ? (t = r.v, o = r.w, n = r.name, arguments.length === 2 && (s = arguments[1], i = !0)) : (t = r, o = arguments[1], n = arguments[3], arguments.length > 2 && (s = arguments[2], i = !0)), t = "" + t, o = "" + o, n !== void 0 && (n = "" + n);
    let a = Me(this._isDirected, t, o, n);
    if (Object.hasOwn(this._edgeLabels, a))
      return i && (this._edgeLabels[a] = s), this;
    if (n !== void 0 && !this._isMultigraph)
      throw new Error("Cannot set a named edge when isMultigraph = false");
    this.setNode(t), this.setNode(o), this._edgeLabels[a] = i ? s : this._defaultEdgeLabelFn(t, o, n);
    const l = On(this._isDirected, t, o, n);
    return t = l.v, o = l.w, Object.freeze(l), this._edgeObjs[a] = l, Jt(this._preds[o], t), Jt(this._sucs[t], o), this._in[o][a] = l, this._out[t][a] = l, this._edgeCount++, this;
  }
  /**
   * Gets the label for the specified edge.
   * Complexity: O(1).
   */
  edge(t, o, n) {
    const s = arguments.length === 1 ? st(this._isDirected, arguments[0]) : Me(this._isDirected, t, o, n);
    return this._edgeLabels[s];
  }
  /**
   * Gets the label for the specified edge and converts it to an object.
   * Complexity: O(1)
   */
  edgeAsObj() {
    const t = this.edge(...arguments);
    return typeof t != "object" ? { label: t } : t;
  }
  /**
   * Detects whether the graph contains specified edge or not. No subgraphs are considered.
   * Complexity: O(1).
   */
  hasEdge(t, o, n) {
    const s = arguments.length === 1 ? st(this._isDirected, arguments[0]) : Me(this._isDirected, t, o, n);
    return Object.hasOwn(this._edgeLabels, s);
  }
  /**
   * Removes the specified edge from the graph. No subgraphs are considered.
   * Complexity: O(1).
   */
  removeEdge(t, o, n) {
    const s = arguments.length === 1 ? st(this._isDirected, arguments[0]) : Me(this._isDirected, t, o, n), i = this._edgeObjs[s];
    return i && (t = i.v, o = i.w, delete this._edgeLabels[s], delete this._edgeObjs[s], Qt(this._preds[o], t), Qt(this._sucs[t], o), delete this._in[o][s], delete this._out[t][s], this._edgeCount--), this;
  }
  /**
   * Return all edges that point to the node v. Optionally filters those edges down to just those
   * coming from node u. Behavior is undefined for undirected graphs - use nodeEdges instead.
   * Complexity: O(|E|).
   */
  inEdges(t, o) {
    const n = this._in[t];
    if (n) {
      const s = Object.values(n);
      return o ? s.filter((i) => i.v === o) : s;
    }
  }
  /**
   * Return all edges that are pointed at by node v. Optionally filters those edges down to just
   * those pointing to w. Behavior is undefined for undirected graphs - use nodeEdges instead.
   * Complexity: O(|E|).
   */
  outEdges(t, o) {
    const n = this._out[t];
    if (n) {
      const s = Object.values(n);
      return o ? s.filter((i) => i.w === o) : s;
    }
  }
  /**
   * Returns all edges to or from node v regardless of direction. Optionally filters those edges
   * down to just those between nodes v and w regardless of direction.
   * Complexity: O(|E|).
   */
  nodeEdges(t, o) {
    const n = this.inEdges(t, o);
    if (n)
      return n.concat(this.outEdges(t, o));
  }
}
function Jt(e, t) {
  e[t] ? e[t]++ : e[t] = 1;
}
function Qt(e, t) {
  --e[t] || delete e[t];
}
function Me(e, t, o, n) {
  let s = "" + t, i = "" + o;
  if (!e && s > i) {
    const r = s;
    s = i, i = r;
  }
  return s + Kt + i + Kt + (n === void 0 ? Mn : n);
}
function On(e, t, o, n) {
  let s = "" + t, i = "" + o;
  if (!e && s > i) {
    const a = s;
    s = i, i = a;
  }
  const r = { v: s, w: i };
  return n && (r.name = n), r;
}
function st(e, t) {
  return Me(e, t.v, t.w, t.name);
}
class Dn {
  constructor() {
    const t = {};
    t._next = t._prev = t, this._sentinel = t;
  }
  dequeue() {
    const t = this._sentinel, o = t._prev;
    if (o !== t)
      return eo(o), o;
  }
  enqueue(t) {
    const o = this._sentinel;
    t._prev && t._next && eo(t), t._next = o._next, o._next._prev = t, o._next = t, t._prev = o;
  }
  toString() {
    const t = [], o = this._sentinel;
    let n = o._prev;
    for (; n !== o; )
      t.push(JSON.stringify(n, Rn)), n = n._prev;
    return "[" + t.join(", ") + "]";
  }
}
function eo(e) {
  e._prev._next = e._next, e._next._prev = e._prev, delete e._next, delete e._prev;
}
function Rn(e, t) {
  if (e !== "_next" && e !== "_prev")
    return t;
}
const Tn = () => 1;
function Pn(e, t) {
  if (e.nodeCount() <= 1)
    return [];
  const o = Fn(e, t || Tn);
  return $n(o.graph, o.buckets, o.zeroIndex).flatMap((s) => e.outEdges(s.v, s.w));
}
function $n(e, t, o) {
  let n = [];
  const s = t[t.length - 1], i = t[0];
  let r;
  for (; e.nodeCount(); ) {
    for (; r = i.dequeue(); )
      rt(e, t, o, r);
    for (; r = s.dequeue(); )
      rt(e, t, o, r);
    if (e.nodeCount()) {
      for (let a = t.length - 2; a > 0; --a)
        if (r = t[a].dequeue(), r) {
          n = n.concat(rt(e, t, o, r, !0));
          break;
        }
    }
  }
  return n;
}
function rt(e, t, o, n, s) {
  const i = s ? [] : void 0;
  return e.inEdges(n.v).forEach((r) => {
    const a = e.edge(r), l = e.node(r.v);
    s && i.push({ v: r.v, w: r.w }), l.out -= a, dt(t, o, l);
  }), e.outEdges(n.v).forEach((r) => {
    const a = e.edge(r), l = e.node(r.w);
    l.in -= a, dt(t, o, l);
  }), e.removeNode(n.v), i;
}
function Fn(e, t) {
  const o = new oe();
  let n = 0, s = 0;
  e.nodes().forEach((a) => {
    o.setNode(a, { v: a, in: 0, out: 0 });
  }), e.edges().forEach((a) => {
    const l = o.edge(a.v, a.w) || 0, c = t(a), f = l + c;
    o.setEdge(a.v, a.w, f), s = Math.max(s, o.node(a.v).out += c), n = Math.max(n, o.node(a.w).in += c);
  });
  const i = Bn(s + n + 3).map(() => new Dn()), r = n + 1;
  return o.nodes().forEach((a) => {
    dt(i, r, o.node(a));
  }), {
    graph: o,
    buckets: i,
    zeroIndex: r
  };
}
function dt(e, t, o) {
  o.out ? o.in ? e[o.out - o.in + t].enqueue(o) : e[e.length - 1].enqueue(o) : e[0].enqueue(o);
}
function Bn(e) {
  const t = [];
  for (let o = 0; o < e; o++)
    t.push(o);
  return t;
}
function pe(e, t, o, n) {
  let s = n;
  for (; e.hasNode(s); )
    s = Ve(n);
  return o.dummy = t, e.setNode(s, o), s;
}
function fo(e) {
  const t = new oe().setGraph(e.graph());
  return e.nodes().forEach((o) => {
    t.setNode(o, e.node(o));
  }), e.edges().forEach((o) => {
    const n = t.edge(o.v, o.w) || { weight: 0, minlen: 1 }, s = e.edge(o);
    t.setEdge(o.v, o.w, {
      weight: n.weight + s.weight,
      minlen: Math.max(n.minlen, s.minlen)
    });
  }), t;
}
function ht(e) {
  const t = new oe({ multigraph: e.isMultigraph() }).setGraph(e.graph());
  return e.nodes().forEach((o) => {
    e.children(o).length || t.setNode(o, e.node(o));
  }), e.edges().forEach((o) => {
    t.setEdge(o, e.edge(o));
  }), t;
}
function zn(e) {
  const t = e.nodes().map((o) => {
    const n = {};
    return e.outEdges(o).forEach((s) => {
      n[s.w] = (n[s.w] || 0) + e.edge(s).weight;
    }), n;
  });
  return Ie(e.nodes(), t);
}
function Vn(e) {
  const t = e.nodes().map((o) => {
    const n = {};
    return e.inEdges(o).forEach((s) => {
      n[s.v] = (n[s.v] || 0) + e.edge(s).weight;
    }), n;
  });
  return Ie(e.nodes(), t);
}
function ft(e, t) {
  let o = e.x, n = e.y;
  const s = t.x - o, i = t.y - n;
  let r = e.width / 2, a = e.height / 2;
  if (!s && !i)
    throw new Error("Not possible to find intersection inside of the rectangle");
  let l, c;
  return Math.abs(i) * r > Math.abs(s) * a ? (i < 0 && (a = -a), l = a * s / i, c = a) : (s < 0 && (r = -r), l = r, c = r * i / s), { x: o + l, y: n + c };
}
function De(e) {
  const t = ve(mt(e) + 1).map(() => []);
  return e.nodes().forEach((o) => {
    const n = e.node(o), s = n.rank;
    s !== void 0 && (t[s][n.order] = o);
  }), t;
}
function ho(e) {
  const t = e.nodes().map((n) => {
    const s = e.node(n).rank;
    return s === void 0 ? Number.MAX_VALUE : s;
  }), o = X(Math.min, t);
  e.nodes().forEach((n) => {
    const s = e.node(n);
    Object.hasOwn(s, "rank") && (s.rank -= o);
  });
}
function mo(e) {
  const t = e.nodes().map((r) => e.node(r).rank).filter((r) => r !== void 0), o = X(Math.min, t), n = [];
  e.nodes().forEach((r) => {
    const a = e.node(r).rank - o;
    n[a] || (n[a] = []), n[a].push(r);
  });
  let s = 0;
  const i = e.graph().nodeRankFactor;
  Array.from(n).forEach((r, a) => {
    r === void 0 && a % i !== 0 ? --s : r !== void 0 && s && r.forEach((l) => {
      e.node(l).rank += s;
    });
  });
}
function In(e, t, o, n) {
  const s = {
    width: 0,
    height: 0
  };
  return arguments.length >= 4 && (s.rank = o, s.order = n), pe(e, "border", s, t);
}
const go = 65535;
function Gn(e, t = go) {
  const o = [];
  for (let n = 0; n < e.length; n += t) {
    const s = e.slice(n, n + t);
    o.push(s);
  }
  return o;
}
function X(e, t) {
  if (t.length > go) {
    const o = Gn(t);
    return e.apply(
      null,
      o.map((n) => e.apply(null, n))
    );
  } else
    return e.apply(null, t);
}
function mt(e) {
  const o = e.nodes().map((n) => {
    const s = e.node(n).rank;
    return s === void 0 ? Number.MIN_VALUE : s;
  });
  return X(Math.max, o);
}
function vo(e, t) {
  const o = { lhs: [], rhs: [] };
  return e.forEach((n) => {
    t(n) ? o.lhs.push(n) : o.rhs.push(n);
  }), o;
}
function po(e, t) {
  const o = Date.now();
  try {
    return t();
  } finally {
    console.log(e + " time: " + (Date.now() - o) + "ms");
  }
}
function bo(e, t) {
  return t();
}
let jn = 0;
function Ve(e) {
  const t = ++jn;
  return e + String(t);
}
function ve(e, t, o = 1) {
  t == null && (t = e, e = 0);
  let n = (i) => i < t;
  o < 0 && (n = (i) => t < i);
  const s = [];
  for (let i = e; n(i); i += o)
    s.push(i);
  return s;
}
function Oe(e, t) {
  const o = {};
  for (const n of t)
    e[n] !== void 0 && (o[n] = e[n]);
  return o;
}
function Re(e, t) {
  let o = t;
  if (typeof t == "string") {
    const n = t;
    o = (s) => s[n];
  }
  return Object.entries(e).reduce((n, [s, i]) => (n[s] = o(i, s), n), {});
}
function Ie(e, t) {
  return e.reduce((o, n, s) => (o[n] = t[s], o), {});
}
const ze = {
  addBorderNode: In,
  addDummyNode: pe,
  applyWithChunking: X,
  asNonCompoundGraph: ht,
  buildLayerMatrix: De,
  intersectRect: ft,
  mapValues: Re,
  maxRank: mt,
  normalizeRanks: ho,
  notime: bo,
  partition: vo,
  pick: Oe,
  predecessorWeights: Vn,
  range: ve,
  removeEmptyRanks: mo,
  simplify: fo,
  successorWeights: zn,
  time: po,
  uniqueId: Ve,
  zipObject: Ie
};
function Wn(e) {
  (e.graph().acyclicer === "greedy" ? Pn(e, o(e)) : Hn(e)).forEach((n) => {
    const s = e.edge(n);
    e.removeEdge(n), s.forwardName = n.name, s.reversed = !0, e.setEdge(n.w, n.v, s, Ve("rev"));
  });
  function o(n) {
    return (s) => n.edge(s).weight;
  }
}
function Yn(e) {
  e.edges().forEach((t) => {
    const o = e.edge(t);
    if (o.reversed) {
      e.removeEdge(t);
      const n = o.forwardName;
      delete o.reversed, delete o.forwardName, e.setEdge(t.w, t.v, o, n);
    }
  });
}
function Hn(e) {
  const t = [], o = {}, n = {};
  function s(i) {
    Object.hasOwn(n, i) || (n[i] = !0, o[i] = !0, e.outEdges(i).forEach((r) => {
      Object.hasOwn(o, r.w) ? t.push(r) : s(r.w);
    }), delete o[i]);
  }
  return e.nodes().forEach(s), t;
}
function Un(e) {
  e.graph().dummyChains = [], e.edges().forEach((t) => Zn(e, t));
}
function Zn(e, t) {
  let o = t.v, n = e.node(o).rank;
  const s = t.w, i = e.node(s).rank, r = t.name, a = e.edge(t), l = a.labelRank;
  if (i === n + 1)
    return;
  e.removeEdge(t);
  let c, f, m;
  for (m = 0, ++n; n < i; ++m, ++n)
    a.points = [], f = {
      width: 0,
      height: 0,
      edgeLabel: a,
      edgeObj: t,
      rank: n
    }, c = pe(e, "edge", f, "_d"), n === l && (f.width = a.width, f.height = a.height, f.dummy = "edge-label", f.labelpos = a.labelpos), e.setEdge(o, c, { weight: a.weight }, r), m === 0 && e.graph().dummyChains.push(c), o = c;
  e.setEdge(o, s, { weight: a.weight }, r);
}
function Xn(e) {
  e.graph().dummyChains.forEach((t) => {
    let o = e.node(t);
    const n = o.edgeLabel;
    e.setEdge(o.edgeObj, n);
    let s;
    for (; o.dummy; )
      s = e.successors(t)[0], e.removeNode(t), n.points.push({ x: o.x, y: o.y }), o.dummy === "edge-label" && (n.x = o.x, n.y = o.y, n.width = o.width, n.height = o.height), t = s, o = e.node(t);
  });
}
function wo(e) {
  function t(o) {
    const n = e.node(o);
    if (n && Object.prototype.hasOwnProperty.call(n, "rank"))
      return n.rank;
    const s = e.outEdges(o) || [];
    if (!s.length)
      return n && (n.rank = 0), 0;
    const i = s.map((a) => {
      if (!e.node(a.w))
        return Number.POSITIVE_INFINITY;
      const c = t(a.w), f = e.edge(a).minlen;
      return c - f;
    });
    let r = X(Math.min, i);
    return r === Number.POSITIVE_INFINITY && (r = 0), n && (n.rank = r), r;
  }
  (e.sources() || []).forEach(t);
}
function qn(e, t) {
  return e.node(t.w).rank - e.node(t.v).rank - e.edge(t).minlen;
}
function Kn(e) {
  Jn(e);
  const t = new oe();
  e.nodes().forEach((i) => {
    t.setNode(i, {});
  });
  const o = e.nodes();
  if (!o.length)
    return t;
  const n = o[0], s = /* @__PURE__ */ new Set([n]);
  for (; s.size < o.length; ) {
    const i = Qn(e, s);
    if (!i) {
      const f = o.find((m) => !s.has(m));
      s.add(f), t.setNode(f, {});
      continue;
    }
    const { edgeObject: r, delta: a, attachFrom: l, attachTo: c } = i;
    es(e, s, l, a), t.setEdge(r.v, r.w, {}), s.add(c);
  }
  return t;
}
function Jn(e) {
  e.nodes().forEach((t) => {
    const o = e.node(t) || {};
    Object.prototype.hasOwnProperty.call(o, "rank") || (o.rank = 0, e.setNode(t, o));
  });
}
function Qn(e, t) {
  let o = null;
  return e.edges().forEach((n) => {
    const s = t.has(n.v), i = t.has(n.w);
    if (s === i)
      return;
    const r = qn(e, n), a = Math.abs(r);
    if (!o || a < o.absoluteSlack) {
      const l = s ? n.v : n.w, c = s ? n.w : n.v, f = s ? r : -r;
      o = {
        edgeObject: n,
        delta: f,
        attachFrom: l,
        attachTo: c,
        absoluteSlack: a
      };
    }
  }), o;
}
function es(e, t, o, n) {
  n && e.nodes().forEach((s) => {
    if (!t.has(s)) {
      const i = e.node(s);
      i.rank += n;
    }
  });
}
function be(e) {
  const t = fo(e);
  return wo(t), t.nodes().forEach((o) => {
    const n = t.node(o), s = e.node(o) || {};
    s.rank = n.rank, e.setNode(o, s);
  }), e;
}
function ts(e, t) {
}
function os(e, t) {
}
function ns(e, t, o) {
  return 0;
}
function ss(e) {
  return null;
}
function rs(e, t) {
  return null;
}
be.initLowLimValues = ts;
be.initCutValues = os;
be.calcCutValue = ns;
be.leaveEdge = ss;
be.enterEdge = rs;
const yo = wo;
function is(e) {
  const t = e.graph().ranker;
  if (t instanceof Function)
    return t(e);
  switch (e.graph().ranker) {
    case "network-simplex":
      to(e);
      break;
    case "tight-tree":
      ls(e);
      break;
    case "longest-path":
      as(e);
      break;
    case "none":
      break;
    default:
      to(e);
  }
}
const as = yo;
function ls(e) {
  yo(e), Kn(e);
}
function to(e) {
  be(e);
}
function cs(e) {
  const t = ds(e);
  e.graph().dummyChains.forEach((o) => {
    let n = e.node(o);
    const s = n.edgeObj, i = us(e, t, s.v, s.w), r = i.path, a = i.lca;
    let l = 0, c = r[l], f = !0, m = o;
    for (; m !== s.w; ) {
      if (n = e.node(m), f) {
        for (; (c = r[l]) !== a && e.node(c).maxRank < n.rank; )
          l++;
        c === a && (f = !1);
      }
      if (!f) {
        for (; l < r.length - 1 && e.node(c = r[l + 1]).minRank <= n.rank; )
          l++;
        c = r[l];
      }
      e.setParent(m, c), m = e.successors(m)[0];
    }
  });
}
function us(e, t, o, n) {
  const s = [], i = [], r = Math.min(t[o].low, t[n].low), a = Math.max(t[o].lim, t[n].lim);
  let l, c;
  l = o;
  do
    l = e.parent(l), s.push(l);
  while (l && (t[l].low > r || a > t[l].lim));
  for (c = l, l = n; (l = e.parent(l)) !== c; )
    i.push(l);
  return {
    path: s.concat(i.reverse()),
    lca: c
  };
}
function ds(e) {
  const t = {};
  let o = 0;
  function n(s) {
    const i = o;
    e.children(s).forEach(n), t[s] = { low: i, lim: o++ };
  }
  return e.children().forEach(n), t;
}
function fs(e) {
  const t = ze.addDummyNode(e, "root", {}, "_root"), o = hs(e), n = Object.values(o), s = ze.applyWithChunking(Math.max, n) - 1, i = 2 * s + 1;
  e.graph().nestingRoot = t, e.edges().forEach((a) => {
    e.edge(a).minlen *= i;
  });
  const r = ms(e) + 1;
  e.children().forEach((a) => {
    ko(e, t, i, r, s, o, a);
  }), e.graph().nodeRankFactor = i;
}
function ko(e, t, o, n, s, i, r) {
  const a = e.children(r);
  if (!a.length) {
    r !== t && e.setEdge(t, r, { weight: 0, minlen: o });
    return;
  }
  const l = ze.addBorderNode(e, "_bt"), c = ze.addBorderNode(e, "_bb"), f = e.node(r);
  e.setParent(l, r), f.borderTop = l, e.setParent(c, r), f.borderBottom = c, a.forEach((m) => {
    ko(e, t, o, n, s, i, m);
    const g = e.node(m), w = g.borderTop ? g.borderTop : m, N = g.borderBottom ? g.borderBottom : m, x = g.borderTop ? n : 2 * n, P = w !== N ? 1 : s - i[r] + 1;
    e.setEdge(l, w, {
      weight: x,
      minlen: P,
      nestingEdge: !0
    }), e.setEdge(N, c, {
      weight: x,
      minlen: P,
      nestingEdge: !0
    });
  }), e.parent(r) || e.setEdge(t, l, {
    weight: 0,
    minlen: s + i[r]
  });
}
function hs(e) {
  const t = {};
  function o(n, s) {
    const i = e.children(n);
    i && i.length && i.forEach((r) => o(r, s + 1)), t[n] = s;
  }
  return e.children().forEach((n) => o(n, 1)), t;
}
function ms(e) {
  return e.edges().reduce((t, o) => t + e.edge(o).weight, 0);
}
function gs(e) {
  const t = e.graph();
  e.removeNode(t.nestingRoot), delete t.nestingRoot, e.edges().forEach((o) => {
    e.edge(o).nestingEdge && e.removeEdge(o);
  });
}
function vs(e) {
  function t(o) {
    const n = e.children(o), s = e.node(o);
    if (n.length && n.forEach(t), Object.hasOwn(s, "minRank")) {
      s.borderLeft = [], s.borderRight = [];
      for (let i = s.minRank, r = s.maxRank + 1; i < r; ++i)
        oo(e, "borderLeft", "_bl", o, s, i), oo(e, "borderRight", "_br", o, s, i);
    }
  }
  e.children().forEach(t);
}
function oo(e, t, o, n, s, i) {
  const r = {
    width: 0,
    height: 0,
    rank: i,
    borderType: t
  }, a = s[t][i - 1], l = pe(e, "border", r, o);
  s[t][i] = l, e.setParent(l, n), a && e.setEdge(a, l, { weight: 1 });
}
function ps(e) {
  const t = e.graph().rankdir.toLowerCase();
  (t === "lr" || t === "rl") && Eo(e);
}
function bs(e) {
  const t = e.graph().rankdir.toLowerCase();
  (t === "bt" || t === "rl") && ws(e), (t === "lr" || t === "rl") && (ys(e), Eo(e));
}
function Eo(e) {
  e.nodes().forEach((t) => {
    no(e.node(t));
  }), e.edges().forEach((t) => {
    no(e.edge(t));
  });
}
function no(e) {
  const t = e.width;
  e.width = e.height, e.height = t;
}
function ws(e) {
  e.nodes().forEach((t) => {
    it(e.node(t));
  }), e.edges().forEach((t) => {
    const o = e.edge(t);
    o.points.forEach(it), Object.hasOwn(o, "y") && it(o);
  });
}
function it(e) {
  e.y = -e.y;
}
function ys(e) {
  e.nodes().forEach((t) => {
    at(e.node(t));
  }), e.edges().forEach((t) => {
    const o = e.edge(t);
    o.points.forEach(at), Object.hasOwn(o, "x") && at(o);
  });
}
function at(e) {
  const t = e.x;
  e.x = e.y, e.y = t;
}
const so = {
  adjust: ps,
  undo: bs
};
function ks(e) {
  const t = {}, o = e.nodes().filter((l) => e.children(l).length === 0), n = o.map((l) => e.node(l).rank), s = X(Math.max, n), i = ve(s + 1).map(() => []);
  function r(l) {
    if (t[l]) return;
    t[l] = !0;
    const c = e.node(l);
    i[c.rank].push(l), e.successors(l).forEach(r);
  }
  return o.sort(
    (l, c) => e.node(l).rank - e.node(c).rank
  ).forEach(r), i;
}
function Es(e, t) {
  let o = 0;
  for (let n = 1; n < t.length; ++n)
    o += Cs(e, t[n - 1], t[n]);
  return o;
}
function Cs(e, t, o) {
  const n = Ie(
    o,
    o.map((c, f) => f)
  ), s = t.flatMap((c) => e.outEdges(c).map((f) => ({
    pos: n[f.w],
    weight: e.edge(f).weight
  })).sort((f, m) => f.pos - m.pos));
  let i = 1;
  for (; i < o.length; ) i <<= 1;
  const r = 2 * i - 1;
  i -= 1;
  const a = new Array(r).fill(0);
  let l = 0;
  return s.forEach((c) => {
    let f = c.pos + i;
    a[f] += c.weight;
    let m = 0;
    for (; f > 0; )
      f % 2 && (m += a[f + 1]), f = f - 1 >> 1, a[f] += c.weight;
    l += c.weight * m;
  }), l;
}
function _s(e, t = []) {
  return t.map((o) => {
    const n = e.inEdges(o);
    if (!n.length)
      return { v: o };
    const s = n.reduce(
      (i, r) => {
        const a = e.edge(r), l = e.node(r.v);
        return {
          sum: i.sum + a.weight * l.order,
          weight: i.weight + a.weight
        };
      },
      { sum: 0, weight: 0 }
    );
    return {
      v: o,
      barycenter: s.sum / s.weight,
      weight: s.weight
    };
  });
}
function xs(e, t) {
  const o = {};
  e.forEach((s, i) => {
    const r = o[s.v] = {
      indegree: 0,
      in: [],
      out: [],
      vs: [s.v],
      i
    };
    s.barycenter !== void 0 && (r.barycenter = s.barycenter, r.weight = s.weight);
  }), t.edges().forEach((s) => {
    const i = o[s.v], r = o[s.w];
    i !== void 0 && r !== void 0 && (r.indegree++, i.out.push(r));
  });
  const n = Object.values(o).filter((s) => !s.indegree);
  return Ns(n);
}
function Ns(e) {
  const t = [];
  function o(s) {
    return (i) => {
      i.merged || (i.barycenter === void 0 || s.barycenter === void 0 || i.barycenter >= s.barycenter) && As(s, i);
    };
  }
  function n(s) {
    return (i) => {
      i.in.push(s), --i.indegree === 0 && e.push(i);
    };
  }
  for (; e.length; ) {
    const s = e.pop();
    t.push(s), s.in.reverse().forEach(o(s)), s.out.forEach(n(s));
  }
  return t.filter((s) => !s.merged).map((s) => Oe(s, ["vs", "i", "barycenter", "weight"]));
}
function As(e, t) {
  let o = 0, n = 0;
  e.weight && (o += e.barycenter * e.weight, n += e.weight), t.weight && (o += t.barycenter * t.weight, n += t.weight), e.vs = t.vs.concat(e.vs), e.barycenter = o / n, e.weight = n, e.i = Math.min(t.i, e.i), t.merged = !0;
}
function Ss(e, t) {
  const o = vo(e, (f) => Object.hasOwn(f, "barycenter")), n = o.lhs, s = o.rhs.sort((f, m) => m.i - f.i), i = [];
  let r = 0, a = 0, l = 0;
  n.sort(Ls(!!t)), l = ro(i, s, l), n.forEach((f) => {
    l += f.vs.length, i.push(f.vs), r += f.barycenter * f.weight, a += f.weight, l = ro(i, s, l);
  });
  const c = { vs: i.flat(!0) };
  return a && (c.barycenter = r / a, c.weight = a), c;
}
function ro(e, t, o) {
  let n;
  for (; t.length && (n = t[t.length - 1]).i <= o; )
    t.pop(), e.push(n.vs), o++;
  return o;
}
function Ls(e) {
  return (t, o) => t.barycenter < o.barycenter ? -1 : t.barycenter > o.barycenter ? 1 : e ? o.i - t.i : t.i - o.i;
}
function Co(e, t, o, n) {
  let s = e.children(t);
  const i = e.node(t), r = i ? i.borderLeft : void 0, a = i ? i.borderRight : void 0, l = {};
  r && (s = s.filter((g) => g !== r && g !== a));
  const c = _s(e, s);
  c.forEach((g) => {
    if (e.children(g.v).length) {
      const w = Co(e, g.v, o, n);
      l[g.v] = w, Object.hasOwn(w, "barycenter") && Os(g, w);
    }
  });
  let f = xs(c, o);
  Ms(f, l);
  const m = Ss(f, n);
  if (r && (m.vs = [r, m.vs, a].flat(!0), e.predecessors(r).length)) {
    const g = e.node(e.predecessors(r)[0]), w = e.node(e.predecessors(a)[0]);
    Object.hasOwn(m, "barycenter") || (m.barycenter = 0, m.weight = 0), m.barycenter = (m.barycenter * m.weight + g.order + w.order) / (m.weight + 2), m.weight += 2;
  }
  return m;
}
function Ms(e, t) {
  e.forEach((o) => {
    o.vs = o.vs.flatMap((n) => t[n] ? t[n].vs : n);
  });
}
function Os(e, t) {
  e.barycenter !== void 0 ? (e.barycenter = (e.barycenter * e.weight + t.barycenter * t.weight) / (e.weight + t.weight), e.weight += t.weight) : (e.barycenter = t.barycenter, e.weight = t.weight);
}
function Ds(e, t, o, n) {
  n || (n = e.nodes());
  const s = Rs(e), i = new oe({ compound: !0 }).setGraph({ root: s }).setDefaultNodeLabel((r) => e.node(r));
  return n.forEach((r) => {
    const a = e.node(r), l = e.parent(r);
    (a.rank === t || a.minRank <= t && t <= a.maxRank) && (i.setNode(r), i.setParent(r, l || s), e[o](r).forEach((f) => {
      const m = f.v === r ? f.w : f.v, g = i.edge(m, r), w = g ? g.weight : 0;
      i.setEdge(m, r, {
        weight: e.edge(f).weight + w
      });
    }), Object.hasOwn(a, "minRank") && i.setNode(r, {
      borderLeft: a.borderLeft[t],
      borderRight: a.borderRight[t]
    }));
  }), i;
}
function Rs(e) {
  let t;
  for (; e.hasNode(t = Ve("_root")); ) ;
  return t;
}
function Ts(e, t, o) {
  let n = {}, s;
  o.forEach((i) => {
    let r = e.parent(i), a, l;
    for (; r; ) {
      if (a = e.parent(r), a ? (l = n[a], n[a] = r) : (l = s, s = r), l && l !== r) {
        t.setEdge(l, r);
        return;
      }
      r = a;
    }
  });
}
function _o(e, t = {}) {
  if (typeof t.customOrder == "function") {
    t.customOrder(e, _o);
    return;
  }
  const o = mt(e), n = io(
    e,
    ve(1, o + 1),
    "inEdges"
  ), s = io(
    e,
    ve(o - 1, -1, -1),
    "outEdges"
  );
  let i = ks(e);
  if (ao(e, i), t.disableOptimalOrderHeuristic)
    return;
  let r = Number.POSITIVE_INFINITY, a;
  const l = t.constraints || [];
  for (let c = 0, f = 0; f < 4; ++c, ++f) {
    const m = c % 2 === 0 ? n : s, g = c % 4 >= 2;
    Ps(m, g, l), i = De(e);
    const w = Es(e, i);
    w < r ? (r = w, f = 0, a = structuredClone(i)) : w === r && (a = structuredClone(i));
  }
  ao(e, a);
}
function io(e, t, o) {
  const n = /* @__PURE__ */ new Map();
  function s(i, r) {
    n.has(i) || n.set(i, []), n.get(i).push(r);
  }
  for (const i of e.nodes()) {
    const r = e.node(i);
    if (typeof r.rank == "number" && s(r.rank, i), typeof r.minRank == "number" && typeof r.maxRank == "number")
      for (let a = r.minRank; a <= r.maxRank; a++)
        a !== r.rank && s(a, i);
  }
  return t.map(
    (i) => Ds(
      e,
      i,
      o,
      n.get(i) || []
    )
  );
}
function Ps(e, t, o) {
  const n = new oe();
  e.forEach((s) => {
    o.forEach((a) => n.setEdge(a.left, a.right));
    const i = s.graph().root, r = Co(s, i, n, t);
    r.vs.forEach((a, l) => {
      s.node(a).order = l;
    }), Ts(s, n, r.vs);
  });
}
function ao(e, t) {
  Object.values(t).forEach((o) => {
    o.forEach((n, s) => {
      e.node(n).order = s;
    });
  });
}
function $s(e, t) {
  const o = {};
  function n(s, i) {
    let r = 0, a = 0;
    const l = s.length, c = i[i.length - 1];
    return i.forEach((f, m) => {
      const g = Bs(e, f), w = g ? e.node(g).order : l;
      (g || f === c) && (i.slice(a, m + 1).forEach((N) => {
        e.predecessors(N).forEach((x) => {
          const P = e.node(x), J = P.order;
          (J < r || w < J) && !(P.dummy && e.node(N).dummy) && xo(o, x, N);
        });
      }), a = m + 1, r = w);
    }), i;
  }
  return t.length && t.reduce(n), o;
}
function Fs(e, t) {
  const o = {};
  function n(i, r, a, l, c) {
    let f;
    ve(r, a).forEach((m) => {
      f = i[m], e.node(f).dummy && e.predecessors(f).forEach((g) => {
        const w = e.node(g);
        w.dummy && (w.order < l || w.order > c) && xo(o, g, f);
      });
    });
  }
  function s(i, r) {
    let a = -1, l, c = 0;
    return r.forEach((f, m) => {
      if (e.node(f).dummy === "border") {
        const g = e.predecessors(f);
        g.length && (l = e.node(g[0]).order, n(r, c, m, a, l), c = m, a = l);
      }
      n(r, c, r.length, l, i.length);
    }), r;
  }
  return t.length && t.reduce(s), o;
}
function Bs(e, t) {
  if (e.node(t).dummy)
    return e.predecessors(t).find((o) => e.node(o).dummy);
}
function xo(e, t, o) {
  if (t > o) {
    const s = t;
    t = o, o = s;
  }
  let n = e[t];
  n || (e[t] = n = {}), n[o] = !0;
}
function zs(e, t, o) {
  if (t > o) {
    const n = t;
    t = o, o = n;
  }
  return !!e[t] && Object.hasOwn(e[t], o);
}
function Vs(e, t, o, n) {
  const s = {}, i = {}, r = {};
  return t.forEach((a) => {
    a.forEach((l, c) => {
      s[l] = l, i[l] = l, r[l] = c;
    });
  }), t.forEach((a) => {
    let l = -1;
    a.forEach((c) => {
      let f = n(c);
      if (f.length) {
        f = f.sort((g, w) => r[g] - r[w]);
        const m = (f.length - 1) / 2;
        for (let g = Math.floor(m), w = Math.ceil(m); g <= w; ++g) {
          const N = f[g];
          i[c] === c && l < r[N] && !zs(o, c, N) && (i[N] = c, i[c] = s[c] = s[N], l = r[N]);
        }
      }
    });
  }), { root: s, align: i };
}
function Is(e, t, o, n, s) {
  const i = {}, r = Gs(e, t, o, s), a = s ? "borderLeft" : "borderRight";
  function l(m, g) {
    const w = r.nodes().slice(), N = {};
    let x = w.pop();
    for (; x; ) {
      if (N[x])
        m(x);
      else {
        N[x] = !0, w.push(x);
        for (const P of g(x))
          w.push(P);
      }
      x = w.pop();
    }
  }
  function c(m) {
    i[m] = r.inEdges(m).reduce((g, w) => Math.max(g, i[w.v] + r.edge(w)), 0);
  }
  function f(m) {
    const g = r.outEdges(m).reduce((N, x) => Math.min(N, i[x.w] - r.edge(x)), Number.POSITIVE_INFINITY), w = e.node(m);
    g !== Number.POSITIVE_INFINITY && w.borderType !== a && (i[m] = Math.max(i[m], g));
  }
  return l(c, r.predecessors.bind(r)), l(f, r.successors.bind(r)), Object.keys(n).forEach((m) => {
    i[m] = i[o[m]];
  }), i;
}
function Gs(e, t, o, n) {
  const s = new e.constructor(), i = e.graph(), r = Us(i.nodesep, i.edgesep, n);
  return t.forEach((a) => {
    let l;
    a.forEach((c) => {
      const f = o[c];
      if (s.setNode(f), l) {
        const m = o[l], g = s.edge(m, f);
        s.setEdge(
          m,
          f,
          Math.max(r(e, c, l), g || 0)
        );
      }
      l = c;
    });
  }), s;
}
function js(e, t) {
  return Object.values(t).reduce(
    (o, n) => {
      let s = Number.NEGATIVE_INFINITY, i = Number.POSITIVE_INFINITY;
      Object.entries(n).forEach(([a, l]) => {
        const c = Zs(e, a) / 2;
        s = Math.max(l + c, s), i = Math.min(l - c, i);
      });
      const r = s - i;
      return r < o[0] && (o = [r, n]), o;
    },
    [Number.POSITIVE_INFINITY, null]
  )[1];
}
function Ws(e, t) {
  const o = Object.values(t), n = X(Math.min, o), s = X(Math.max, o);
  ["u", "d"].forEach((i) => {
    ["l", "r"].forEach((r) => {
      const a = i + r;
      let l = e[a];
      if (l === t) return;
      const c = Object.values(l);
      let f = n - X(Math.min, c);
      r !== "l" && (f = s - X(Math.max, c)), f && (l = Re(l, (m) => m + f), e[a] = l);
    });
  });
}
function Ys(e, t) {
  return Re(e.ul, (o, n) => {
    if (t)
      return e[t.toLowerCase()][n];
    const s = Object.values(e).map((i) => i[n]).sort((i, r) => i - r);
    return (s[1] + s[2]) / 2;
  });
}
function Hs(e) {
  const t = De(e), o = Object.assign(
    $s(e, t),
    Fs(e, t)
  ), n = {};
  let s;
  ["u", "d"].forEach((r) => {
    s = r === "u" ? t : Object.values(t).reverse(), ["l", "r"].forEach((a) => {
      let l = s;
      a === "r" && (l = l.map(
        (g) => Object.values(g).reverse()
      ));
      const c = (r === "u" ? e.predecessors : e.successors).bind(e), f = Vs(
        e,
        l,
        o,
        c
      );
      let m = Is(
        e,
        l,
        f.root,
        f.align,
        a === "r"
      );
      a === "r" && (m = Re(m, (g) => -g)), n[r + a] = m;
    });
  });
  const i = js(e, n);
  return Ws(n, i), Ys(n, e.graph().align);
}
function Us(e, t, o) {
  return (n, s, i) => {
    const r = n.node(s), a = n.node(i);
    let l = 0, c;
    if (l += r.width / 2, Object.hasOwn(r, "labelpos"))
      switch (r.labelpos.toLowerCase()) {
        case "l":
          c = -r.width / 2;
          break;
        case "r":
          c = r.width / 2;
          break;
      }
    if (c && (l += o ? c : -c), c = 0, l += (r.dummy ? t : e) / 2, l += (a.dummy ? t : e) / 2, l += a.width / 2, Object.hasOwn(a, "labelpos"))
      switch (a.labelpos.toLowerCase()) {
        case "l":
          c = a.width / 2;
          break;
        case "r":
          c = -a.width / 2;
          break;
      }
    return c && (l += o ? c : -c), c = 0, l;
  };
}
function Zs(e, t) {
  return e.node(t).width;
}
function Xs(e) {
  const t = ht(e);
  qs(t);
  const o = Hs(t);
  Object.entries(o).forEach(([n, s]) => {
    e.node(n).x = s;
  });
}
function qs(e) {
  const t = De(e), o = e.graph().ranksep;
  let n = 0;
  t.forEach((s) => {
    const i = s.reduce((r, a) => {
      const l = e.node(a).height;
      return r > l ? r : l;
    }, 0);
    s.forEach((r) => {
      e.node(r).y = n + i / 2;
    }), n += i + o;
  });
}
function Ks(e, t = {}) {
  const o = t.debugTiming ? po : bo;
  return o("layout", () => {
    const n = o("  buildLayoutGraph", () => ar(e));
    return o("  runLayout", () => Js(n, o, t)), o("  updateInputGraph", () => Qs(e, n)), n;
  });
}
function Js(e, t, o) {
  t("    makeSpaceForEdgeLabels", () => lr(e)), t("    removeSelfEdges", () => pr(e)), t("    acyclic", () => Wn(e)), t("    nestingGraph.run", () => fs(e)), t("    rank", () => is(ht(e))), t("    injectEdgeLabelProxies", () => cr(e)), t("    removeEmptyRanks", () => mo(e)), t("    nestingGraph.cleanup", () => gs(e)), t("    normalizeRanks", () => ho(e)), t("    assignRankMinMax", () => ur(e)), t("    removeEdgeLabelProxies", () => dr(e)), t("    normalize.run", () => Un(e)), t("    parentDummyChains", () => cs(e)), t("    addBorderSegments", () => vs(e)), t("    order", () => _o(e, o)), t("    insertSelfEdges", () => br(e)), t("    adjustCoordinateSystem", () => so.adjust(e)), t("    position", () => Xs(e)), t("    positionSelfEdges", () => wr(e)), t("    removeBorderNodes", () => vr(e)), t("    normalize.undo", () => Xn(e)), t("    fixupEdgeLabelCoords", () => mr(e)), t("    undoCoordinateSystem", () => so.undo(e)), t("    translateGraph", () => fr(e)), t("    assignNodeIntersects", () => hr(e)), t("    reversePoints", () => gr(e)), t("    acyclic.undo", () => Yn(e));
}
function Qs(e, t) {
  e.nodes().forEach((s) => {
    const i = e.node(s), r = t.node(s);
    i && (i.x = r.x, i.y = r.y, i.order = r.order, i.rank = r.rank, t.children(s).length && (i.width = r.width, i.height = r.height));
  }), e.edges().forEach((s) => {
    const i = e.edge(s), r = t.edge(s);
    i.points = r.points, Object.hasOwn(r, "x") && (i.x = r.x, i.y = r.y);
  });
  const o = t.graph(), n = e.graph();
  n.width = o.width, n.height = o.height;
}
const er = ["nodesep", "edgesep", "ranksep", "marginx", "marginy"], tr = { ranksep: 50, edgesep: 20, nodesep: 50, rankdir: "tb" }, or = ["acyclicer", "ranker", "rankdir", "align"], nr = ["width", "height", "rank"], lo = { width: 0, height: 0 }, sr = ["minlen", "weight", "width", "height", "labeloffset"], rr = {
  minlen: 1,
  weight: 1,
  width: 0,
  height: 0,
  labeloffset: 10,
  labelpos: "r"
}, ir = ["labelpos", "arrowshape"];
function ar(e) {
  const t = ct(e.graph()), o = {
    ...tr,
    ...lt(t, er),
    ...Oe(t, or)
  }, n = new oe({ multigraph: !0, compound: !0 });
  return n.setGraph(o), e.nodes().forEach((s) => {
    const i = ct(e.node(s)), r = lt(i, nr);
    Object.keys(lo).forEach((a) => {
      r[a] === void 0 && (r[a] = lo[a]);
    }), n.setNode(s, r), n.setParent(s, e.parent(s));
  }), e.edges().forEach((s) => {
    const i = ct(e.edge(s));
    n.setEdge(
      s,
      {
        ...rr,
        ...lt(i, sr),
        ...Oe(i, ir)
      }
    );
  }), n;
}
function lr(e) {
  const t = e.graph();
  t.ranksep /= 2, e.edges().forEach((o) => {
    const n = e.edge(o);
    n.minlen *= 2, n.labelpos.toLowerCase() !== "c" && (t.rankdir === "TB" || t.rankdir === "BT" ? n.width += n.labeloffset : n.height += n.labeloffset);
  });
}
function cr(e) {
  e.edges().forEach((t) => {
    const o = e.edge(t);
    if (o.width && o.height) {
      const n = e.node(t.v), i = { rank: (e.node(t.w).rank - n.rank) / 2 + n.rank, e: t };
      pe(e, "edge-proxy", i, "_ep");
    }
  });
}
function ur(e) {
  let t = 0;
  e.nodes().forEach((o) => {
    const n = e.node(o);
    n.borderTop && (n.minRank = e.node(n.borderTop).rank, n.maxRank = e.node(n.borderBottom).rank, t = Math.max(t, n.maxRank));
  }), e.graph().maxRank = t;
}
function dr(e) {
  e.nodes().forEach((t) => {
    const o = e.node(t);
    o.dummy === "edge-proxy" && (e.edge(o.e).labelRank = o.rank, e.removeNode(t));
  });
}
function fr(e) {
  let t = Number.POSITIVE_INFINITY, o = 0, n = Number.POSITIVE_INFINITY, s = 0;
  const i = e.graph(), r = i.marginx || 0, a = i.marginy || 0;
  function l(c) {
    const f = c.x, m = c.y, g = c.width, w = c.height;
    t = Math.min(t, f - g / 2), o = Math.max(o, f + g / 2), n = Math.min(n, m - w / 2), s = Math.max(s, m + w / 2);
  }
  e.nodes().forEach((c) => l(e.node(c))), e.edges().forEach((c) => {
    const f = e.edge(c);
    Object.hasOwn(f, "x") && l(f);
  }), t -= r, n -= a, e.nodes().forEach((c) => {
    const f = e.node(c);
    f.x -= t, f.y -= n;
  }), e.edges().forEach((c) => {
    const f = e.edge(c);
    f.points.forEach((m) => {
      m.x -= t, m.y -= n;
    }), Object.hasOwn(f, "x") && (f.x -= t), Object.hasOwn(f, "y") && (f.y -= n);
  }), i.width = o - t + r, i.height = s - n + a;
}
function co(e, t, o) {
  if (!t)
    return e;
  const n = t.x - e.x, s = t.y - e.y, i = Math.sqrt(n * n + s * s);
  if (!i || i <= o)
    return e;
  const r = o / i;
  return {
    x: e.x + n * r,
    y: e.y + s * r
  };
}
function hr(e) {
  e.edges().forEach((o) => {
    const n = e.edge(o), s = e.node(o.v), i = e.node(o.w);
    let r, a;
    !n.points || !n.points.length ? (n.points = [], r = i, a = s) : (r = n.points[0], a = n.points[n.points.length - 1]);
    const l = ft(s, r), c = ft(i, a), f = n.points.length ? n.points[0] : r, m = n.points.length ? n.points[n.points.length - 1] : a, g = n.arrowshape, w = g === "normal" || g === "vee", N = !!n.reversed;
    let x = l, P = c;
    w && (N ? x = co(l, f, 4) : P = co(c, m, 4)), n.points.unshift(x), n.points.push(P);
  });
}
function mr(e) {
  e.edges().forEach((t) => {
    const o = e.edge(t);
    if (Object.hasOwn(o, "x"))
      switch ((o.labelpos === "l" || o.labelpos === "r") && (o.width -= o.labeloffset), o.labelpos) {
        case "l":
          o.x -= o.width / 2 + o.labeloffset;
          break;
        case "r":
          o.x += o.width / 2 + o.labeloffset;
          break;
      }
  });
}
function gr(e) {
  e.edges().forEach((t) => {
    const o = e.edge(t);
    o.reversed && o.points.reverse();
  });
}
function vr(e) {
  e.nodes().forEach((t) => {
    if (e.children(t).length) {
      const o = e.node(t), n = e.node(o.borderTop), s = e.node(o.borderBottom), i = e.node(o.borderLeft[o.borderLeft.length - 1]), r = e.node(o.borderRight[o.borderRight.length - 1]);
      o.width = Math.abs(r.x - i.x), o.height = Math.abs(s.y - n.y), o.x = i.x + o.width / 2, o.y = n.y + o.height / 2;
    }
  }), e.nodes().forEach((t) => {
    e.node(t).dummy === "border" && e.removeNode(t);
  });
}
function pr(e) {
  e.edges().forEach((t) => {
    if (t.v === t.w) {
      const o = e.node(t.v);
      o.selfEdges || (o.selfEdges = []), o.selfEdges.push({ e: t, label: e.edge(t) }), e.removeEdge(t);
    }
  });
}
function br(e) {
  De(e).forEach((o) => {
    let n = 0;
    o.forEach((s, i) => {
      const r = e.node(s);
      r.order = i + n, (r.selfEdges || []).forEach((a) => {
        pe(e, "selfedge", {
          width: a.label.width,
          height: a.label.height,
          rank: r.rank,
          order: i + ++n,
          e: a.e,
          label: a.label
        }, "_se");
      }), delete r.selfEdges;
    });
  });
}
function wr(e) {
  e.nodes().forEach((t) => {
    const o = e.node(t);
    if (o.dummy === "selfedge") {
      const n = e.node(o.e.v), s = n.x + n.width / 2, i = n.y, r = o.x - s, a = n.height / 2;
      e.setEdge(o.e, o.label), e.removeNode(t), o.label.points = [
        { x: s + 2 * r / 3, y: i - a },
        { x: s + 5 * r / 6, y: i - a },
        { x: s + r, y: i },
        { x: s + 5 * r / 6, y: i + a },
        { x: s + 2 * r / 3, y: i + a }
      ], o.label.x = o.x, o.label.y = o.y;
    }
  });
}
function lt(e, t) {
  return Re(Oe(e, t), Number);
}
function ct(e) {
  const t = {};
  return e && Object.entries(e).forEach(([o, n]) => {
    let s = o;
    typeof s == "string" && (s = s.toLowerCase()), t[s] = n;
  }), t;
}
const yr = {
  rankDirection: "TB",
  // "TB", "BT", "LR", "RL"
  nodeSeparation: 50,
  rankSeparation: 50,
  edgeSeparation: 10,
  // "UL", "UR", "DL", "DR" or undefined force one of four extreme alignment strategies (Up/Down × Left/Right).
  align: void 0,
  nodeWidth: 100,
  nodeHeight: 40,
  curvedEdges: !1,
  padding: 20,
  // "undirected" | "normal" | "vee"
  arrowShape: "normal",
  arrowSize: 10
};
function kr(e) {
  return e.length ? e.map(
    (t, o) => `${o === 0 ? "M" : "L"} ${t.x} ${t.y}`
  ).join(" ") : "";
}
function Er(e) {
  if (!e.length) return "";
  if (e.length === 1) {
    const s = e[0];
    return `M ${s.x} ${s.y}`;
  }
  if (e.length === 2)
    return `M ${e[0].x} ${e[0].y} L ${e[1].x} ${e[1].y}`;
  const [t] = e;
  let o = `M ${t.x} ${t.y}`;
  for (let s = 1; s < e.length - 1; s += 1) {
    e[s - 1];
    const i = e[s], r = e[s + 1], a = i.x, l = i.y, c = (i.x + r.x) / 2, f = (i.y + r.y) / 2;
    o += ` Q ${a} ${l} ${c} ${f}`;
  }
  const n = e[e.length - 1];
  return o += ` L ${n.x} ${n.y}`, o;
}
function Cr(e) {
  const { nodes: t, edges: o, configuration: n } = e, s = E(null), i = E(null), r = `dag-arrow-${ut()}`;
  function a(l, c, f) {
    i.value = null, s.value = null;
    const m = {
      ...yr,
      ...f
    }, g = new oe({ multigraph: !0, compound: !0 });
    g.setGraph({
      rankdir: m.rankDirection,
      nodesep: m.nodeSeparation,
      ranksep: m.rankSeparation,
      edgesep: m.edgeSeparation,
      align: m.align
    }), l.forEach((u) => {
      g.setNode(u.id, {
        label: u.label,
        width: u.width ?? m.nodeWidth,
        height: u.height ?? m.nodeHeight
      });
    }), c.forEach((u) => {
      g.setEdge(u.from, u.to, {
        weight: u.weight ?? 1,
        minlen: u.minLength ?? 1,
        arrowShape: m.arrowShape ?? "normal"
      });
    }), Ks(g);
    const w = l.map((u) => {
      const j = g.node(u.id);
      return {
        id: u.id,
        label: u.label,
        x: j.x,
        y: j.y,
        width: j.width,
        height: j.height,
        original: u
      };
    }), N = g.edges().map((u) => {
      const j = g.edge(u), Q = j.points || [];
      if (!Q.length)
        return null;
      const Te = m.curvedEdges ? Er(Q) : kr(Q), Pe = m.arrowShape !== "undirected" ? `url(#${r})` : null, $e = c.find((ye) => ye?.from === u.v && ye?.to === u.w);
      return {
        id: `${u.v}->${u.w}->${ut()}`,
        from: u.v,
        to: u.w,
        points: Q,
        pathData: Te,
        markerEnd: Pe,
        original: {
          ...$e,
          ...j
        }
      };
    }).filter(Boolean), x = m.padding;
    if (!w.length) {
      s.value = {
        nodes: [],
        edges: N,
        viewBox: "0 0 0 0",
        arrowShape: m.arrowShape,
        arrowSize: m.arrowSize
      };
      return;
    }
    const P = w.flatMap((u) => [
      u.x - u.width / 2,
      u.x + u.width / 2
    ]), J = w.flatMap((u) => [
      u.y - u.height / 2,
      u.y + u.height / 2
    ]), we = Math.min(...P) - x, fe = Math.max(...P) + x, $ = Math.min(...J) - x, I = Math.max(...J) + x;
    s.value = {
      nodes: w,
      edges: N.map((u) => ({
        ...u,
        midpoint: u.pathData ? dn(u.pathData) : { x: 0, y: 0 }
      })),
      viewBox: `${we} ${$} ${fe - we} ${I - $}`,
      arrowShape: m.arrowShape,
      arrowSize: m.arrowSize
    };
  }
  return an(() => {
    try {
      const l = v(t) || [], c = v(o) || [], f = v(n) || {};
      a(l, c, f);
    } catch (l) {
      console.error("[useDag] layout error:", l), i.value = l, s.value = null;
    }
  }), {
    layoutData: s,
    lastError: i,
    arrowMarkerIdentifier: r,
    recomputeLayout: () => {
      const l = v(t) || [], c = v(o) || [], f = v(n) || {};
      a(l, c, f);
    }
  };
}
const No = { style: { chart: { backgroundColor: "#1A1A1A", color: "#CCCCCC", backgroundPattern: { dotColor: "#3A3A3A" }, nodes: { stroke: "#6A6A6A", backgroundColor: "#2A2A2A", labels: { color: "#CCCCCC" }, tooltip: { backgroundColor: "#3A3A3A", color: "#CCCCCC" } }, edges: { stroke: "#6A6A6A" }, midpoints: { stroke: "#6A6A6A", fill: "#1A1A1A", tooltip: { backgroundColor: "#3A3A3A", color: "#CCCCCC" } }, controls: { backgroundColor: "#2A2A2A", buttonColor: "#2A2A2A", color: "#CCCCCC", border: "1px solid #4A4A4A" }, title: { color: "#CCCCCC", subtitle: { color: "#757575" } } } } }, Ao = { style: { chart: { backgroundColor: "#FFF8E1", color: "#424242", backgroundPattern: { dotColor: "#edc7bb" }, nodes: { stroke: "#5D4037", backgroundColor: "#fcf9f0", labels: { color: "#424242" }, tooltip: { backgroundColor: "#5D4037", color: "#FFF8E1" } }, edges: { stroke: "#5D4037" }, midpoints: { stroke: "#5D4037", fill: "#FFF8E1", tooltip: { backgroundColor: "#5D4037", color: "#FFF8E1" } }, controls: { backgroundColor: "#FFF8E1", buttonColor: "#FFF8E1", color: "#424242", border: "1px solid #d9bbb2" }, title: { color: "#424242", subtitle: { color: "#757575" } } } } }, So = { style: { chart: { backgroundColor: "#1E1E1E", color: "#BDBDBD", backgroundPattern: { dotColor: "#3E3E3E" }, nodes: { stroke: "#965039", backgroundColor: "#2A2A2A", labels: { color: "#BDBDBD" }, tooltip: { backgroundColor: "#3A3A3A", color: "#FFF8E1" } }, edges: { stroke: "#965039" }, midpoints: { stroke: "#965039", fill: "#1E1E1E", tooltip: { backgroundColor: "#3A3A3A", color: "#FFF8E1" } }, controls: { backgroundColor: "#1E1E1E", buttonColor: "#1E1E1E", color: "#BDBDBD", border: "1px solid #3A3A3A" }, title: { color: "#FFF8E1", subtitle: { color: "#BDBDBD" } } } } }, Lo = { style: { chart: { backgroundColor: "#1A1A1A", color: "#99AA99", backgroundPattern: { dotColor: "#2f3d2f" }, nodes: { stroke: "#66CC66", backgroundColor: "#2A2A2A", labels: { color: "#99AA99" }, tooltip: { backgroundColor: "#3A3A3A", color: "#99AA99" } }, edges: { stroke: "#66CC66" }, midpoints: { stroke: "#66CC66", fill: "#1A1A1A", tooltip: { backgroundColor: "#3A3A3A", color: "#99AA99" } }, controls: { backgroundColor: "#1A1A1A", buttonColor: "#1A1A1A", color: "#99AA99", border: "1px solid #1e361e" }, title: { color: "#66CC66", subtitle: { color: "#99AA99" } } } } }, Mo = { style: { chart: { backgroundColor: "#fbfafa", color: "#8A9892", backgroundPattern: { dotColor: "#dbcfc5" }, nodes: { stroke: "#8F837A", backgroundColor: "#ffffff", labels: { color: "#8A9892" }, tooltip: { backgroundColor: "#8F837A", color: "#fbfafa" } }, edges: { stroke: "#8F837A" }, midpoints: { stroke: "#8F837A", fill: "#fbfafa", tooltip: { backgroundColor: "#8F837A", color: "#fbfafa" } }, controls: { backgroundColor: "#fbfafa", buttonColor: "#fbfafa", color: "#99AA99", border: "1px solid #ebded3" }, title: { color: "#8A9892", subtitle: { color: "#99AA99" } } } } }, Oo = { style: { chart: { backgroundColor: "#f6f6fb", color: "#50606C", backgroundPattern: { dotColor: "#c3cfd9" }, layout: { arrowShape: "normal", curvedEdges: !1 }, nodes: { stroke: "#50606C", backgroundColor: "#ffffff", borderRadius: 0, labels: { color: "#50606C" }, tooltip: { backgroundColor: "#50606C", color: "#f6f6fb" } }, edges: { stroke: "#50606C" }, midpoints: { stroke: "#50606C", fill: "#fbfafa", tooltip: { backgroundColor: "#50606C", color: "#f6f6fb" } }, controls: { backgroundColor: "#f6f6fb", buttonColor: "#f6f6fb", color: "#50606C", border: "1px solid #98aab8", borderRadius: "0" }, title: { color: "#50606C", subtitle: { color: "#718890" } } } } }, Do = {
  default: {},
  dark: No,
  celebration: Ao,
  celebrationNight: So,
  hack: Lo,
  zen: Mo,
  concrete: Oo
}, bi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  celebration: Ao,
  celebrationNight: So,
  concrete: Oo,
  dark: No,
  default: Do,
  hack: Lo,
  zen: Mo
}, Symbol.toStringTag, { value: "Module" })), _r = ["id"], xr = {
  key: 0,
  class: "dag-chart-error"
}, Nr = ["viewBox", "xmlns"], Ar = { key: 0 }, Sr = ["id", "width", "height"], Lr = ["cx", "cy", "r", "fill"], Mr = ["x", "y", "width", "height", "fill"], Or = { key: 2 }, Dr = ["id", "markerWidth", "markerHeight", "refX", "refY"], Rr = ["d", "fill", "stroke"], Tr = ["d", "fill", "stroke"], Pr = { class: "vue-ui-dag-edges" }, $r = ["d", "stroke", "stroke-width"], Fr = ["cx", "cy", "r", "fill", "stroke", "stroke-width", "onMouseenter"], Br = { class: "vue-ui-dag-nodes" }, zr = ["onClick", "onMouseenter"], Vr = ["x", "y", "width", "height", "rx", "fill", "stroke", "stroke-width"], Ir = ["x", "y", "width", "height"], Gr = { class: "vue-ui-dag-edges" }, jr = ["d", "stroke-width", "marker-end"], Wr = { class: "vue-ui-dag-node-labels" }, Yr = ["onClick", "onMouseenter"], Hr = ["x", "y", "font-size", "fill", "font-weight"], Ur = ["x", "y", "font-size", "fill", "font-weight", "innerHTML"], Zr = { key: 1 }, Xr = {
  key: 6,
  class: "vue-data-ui-watermark"
}, qr = ["data-position"], Kr = { key: 0 }, Jr = ["data-position"], Qr = { key: 0 }, uo = 1.5, ei = {
  __name: "vue-ui-dag",
  props: {
    dataset: {
      type: Object,
      default() {
        return {
          nodes: [],
          edges: []
        };
      }
    },
    config: {
      type: Object,
      default() {
        return {};
      }
    }
  },
  emits: ["onNodeClick", "onMidpointEnter", "onMidpointLeave"],
  setup(e, { expose: t, emit: o }) {
    const n = et(() => import("./PenAndPaper-CvyKWfNl.js")), s = et(() => import("./UserOptions-BQO4YFrn.js")), i = et(() => import("./PackageVersion-Br3DrrFh.js")), { vue_ui_dag: r } = wn(), { isThemeValid: a, warnInvalidTheme: l } = _n(), c = e, f = o, m = E(null), g = E(ut()), w = E(null), N = E(null), x = E(null), P = E(0), J = E(0), we = E(!1), fe = E(!1), $ = E(null), I = E(null), u = E(Ye()), j = E(u.value.style.chart.width), Q = E(u.value.style.chart.height), Te = E({ x: 0, y: 0 }), G = E(null), Pe = E(null), $e = E({ left: "0px", top: "0px" }), ye = E("top"), ne = E(!1), gt = E({ x: 0, y: 0 }), vt = E({ x: 0, y: 0 }), ke = E(null), Ge = E(null), je = E({ left: "0px", top: "0px" }), pt = E("top"), Fe = E(!1), Ee = E(!1), { svgRef: se } = Nn({ config: u.value.style.chart.title }), { userOptionsVisible: We, setUserOptionsVisibility: bt, keepUserOptionState: wt } = xn({ config: u.value }), ee = E(u.value.style.chart.layout.rankDirection), { loading: Ce, FINAL_DATASET: yt, manualLoading: kt } = yn({
      ...ln(c),
      FINAL_CONFIG: u,
      prepareConfig: Ye,
      skeletonDataset: {
        nodes: [
          { id: "A", label: "" },
          { id: "B", label: "" },
          { id: "C", label: "" }
        ],
        edges: [
          { from: "A", to: "B" },
          { from: "A", to: "C" }
        ]
      },
      skeletonConfig: fn({
        defaultConfig: u.value,
        userConfig: {
          userOptions: { show: !1 },
          style: {
            chart: {
              backgroundColor: "#99999930",
              nodes: {
                stroke: "#CCCCCC",
                backgroundColor: "#DDDDDD50"
              },
              edges: {
                stroke: "#CCCCCC"
              },
              midpoints: {
                stroke: "#CCCCCC",
                fill: "#CCCCCC"
              }
            }
          }
        }
      })
    });
    function Ye() {
      const h = nt({
        userConfig: c.config,
        defaultConfig: r
      }), p = h.theme;
      if (!p) return h;
      if (!a.value(h))
        return l(h), h;
      const d = nt({
        userConfig: Do[p] || c.config,
        defaultConfig: h
      });
      return nt({
        userConfig: c.config,
        defaultConfig: d
      });
    }
    const He = H(() => !!u.value.debug);
    Gt(async () => {
      hn(c.dataset) && (Zt({
        componentName: "VueUiDag",
        type: "dataset",
        debug: He.value
      }), fe.value = !1, kt.value = !0), c.dataset.nodes || (Zt({
        componentName: "VueUiDag",
        type: "datasetAttributeEmpty",
        property: "nodes",
        index: 0,
        debug: He.value
      }), fe.value = !1, kt.value = !0), fe.value = !0, await Ne(), Vt();
    }), Ae(() => c.config, async (h) => {
      Ce.value || (u.value = Ye()), We.value = !u.value.userOptions.showOnChartHover, P.value += 1, ee.value = u.value.style.chart.layout.rankDirection, j.value = u.value.style.chart.width, Q.value = u.value.style.chart.height, he.value = u.value.style.chart.zoom.active, await Ne(), Vt();
    }, { deep: !0 });
    const { isPrinting: Et, isImaging: Ct, generatePdf: _t, generateImage: xt } = En({
      elementId: `dag_${g.value}`,
      fileName: u.value.style.chart.title.text || "vue-ui-dag",
      options: u.value.userOptions.print
    }), Ro = H(() => u.value.style.chart.backgroundColor), To = H(() => u.value.style.chart.title), { exportSvg: Po, getSvg: $o } = Cn({
      svg: se,
      title: To,
      legend: void 0,
      legendItems: void 0,
      backgroundColor: Ro
    });
    async function Nt({ isCb: h }) {
      if (h) {
        const { blob: p, url: d, text: b, dataUrl: O } = await $o();
        u.value.userOptions.callbacks.svg({ blob: p, url: d, text: b, dataUrl: O });
      } else
        Po();
    }
    function Fo() {
      we.value = !0, bt(!0);
    }
    function Bo() {
      bt(!1), we.value = !1;
    }
    function At({
      tooltipRef: h,
      isVisibleRef: p,
      anchorRef: d,
      styleRef: b,
      placementRef: O,
      offsetRef: A,
      margin: C = 24
    }) {
      return function() {
        const W = h.value;
        if (!W || !p.value) return;
        const S = W.getBoundingClientRect(), T = window.innerWidth, B = window.innerHeight, Y = d.value.x, q = d.value.y, U = A?.value?.x ?? 0, le = A?.value?.y ?? 0;
        let D = q - le - S.height - C, Z = Y - S.width / 2, _e = "top";
        if (D < C) {
          const ge = q + le + C;
          ge + S.height <= B - C ? (D = ge, _e = "bottom") : (D = q - S.height / 2, D < C && (D = C), D + S.height > B - C && (D = B - S.height - C), _e = "center");
        }
        Z < C && (Z = C), Z + S.width > T - C && (Z = T - S.width - C);
        const nn = Z <= C, sn = Z + S.width >= T - C;
        if ((nn || sn) && _e !== "center") {
          let ge, xe;
          const rn = Y - U - C;
          T - (Y + U) - C >= rn ? (ge = "right", xe = Y + U + C) : (ge = "left", xe = Y - U - C - S.width), xe >= C && xe + S.width <= T - C && (Z = xe, D = q - S.height / 2, D < C && (D = C), D + S.height > B - C && (D = B - S.height - C), _e = ge);
        }
        O.value = _e, b.value = {
          left: `${Z}px`,
          top: `${D}px`
        };
      };
    }
    const zo = H(() => yt.value.nodes.map((h) => ({
      ...h,
      backgroundColor: h.backgroundColor ? Xt(h.backgroundColor) : u.value.style.chart.nodes.backgroundColor,
      color: h.color ? Xt(h.color) : u.value.style.chart.nodes.labels.color
    }))), Vo = H(() => yt.value.edges), Io = H(() => ({
      ...u.value.style.chart.layout,
      rankDirection: ee.value
    })), { layoutData: k, lastError: St, arrowMarkerIdentifier: Go } = Cr({
      nodes: zo,
      edges: Vo,
      configuration: Io
    });
    function Lt(h) {
      return k.value ? k.value.nodes.find((p) => p.id === h) : null;
    }
    const jo = H(() => {
      if (!k.value) return [];
      const h = u.value.style.chart.edges.stroke, p = /* @__PURE__ */ new Set();
      return k.value.edges.forEach((d) => {
        p.add(d.original?.color || h);
      }), Array.from(p);
    });
    function Mt(h) {
      return `${Go}-${String(h).replace(/[^a-zA-Z0-9_-]/g, "_")}`;
    }
    const Ot = H(() => {
      const h = j.value, p = Q.value, d = Number(h), b = Number(p), O = Number.isFinite(d) && d > 0, A = Number.isFinite(b) && b > 0;
      return !O && !A ? null : {
        width: O ? d : null,
        height: A ? b : null
      };
    }), re = E(null), he = E(u.value.style.chart.zoom.active), {
      viewBox: me,
      resetZoom: Be,
      setInitialViewBox: Wo,
      scale: Dt,
      zoomByFactor: Rt
    } = bn(
      se,
      { x: 0, y: 0, width: 100, height: 100 },
      1,
      he,
      () => {
        ne.value = !1;
      }
    );
    function Yo() {
      he.value = !he.value;
    }
    function Tt() {
      const h = k.value && k.value.viewBox;
      if (!h) return;
      const p = String(h).split(" ").map(Number);
      if (p.length !== 4) return;
      const [d, b, O, A] = p;
      if (!Number.isFinite(d) || !Number.isFinite(b) || !Number.isFinite(O) || !Number.isFinite(A))
        return;
      let C = O, R = A, W = d, S = b;
      const T = Ot.value;
      T && (T.width !== null && (C = T.width), T.height !== null && (R = T.height), W = d - (C - O) / 2, S = b - (R - A) / 2), Wo(
        { x: W, y: S, width: C, height: R },
        { overwriteCurrentIfNotZoomed: !0 }
      );
    }
    Ae(
      () => k.value && k.value.viewBox,
      () => {
        Tt();
      },
      { immediate: !0 }
    ), Ae(
      () => Ot.value,
      () => {
        Tt();
      }
    ), Ae(() => Ee.value, (h) => {
      he.value = !h;
    });
    const Ho = H(() => {
      const h = me.value;
      return h ? `${h.x} ${h.y} ${h.width} ${h.height}` : "0 0 0 0";
    }), ie = E(!1);
    function Pt(h) {
      ie.value = h, J.value += 1;
    }
    function Ue() {
      Ee.value = !Ee.value;
    }
    function Ze() {
      Rt(uo, !0);
    }
    function Xe() {
      Rt(1 / uo, !0);
    }
    const qe = ["TB", "RL", "BT", "LR"];
    function Ke() {
      ee.value = qe[(qe.indexOf(ee.value) + 1) % qe.length], Be();
    }
    const Uo = At({
      tooltipRef: Pe,
      isVisibleRef: Fe,
      anchorRef: Te,
      styleRef: $e,
      placementRef: ye
    }), Zo = At({
      tooltipRef: Ge,
      isVisibleRef: ne,
      anchorRef: gt,
      styleRef: je,
      placementRef: pt,
      offsetRef: vt
    });
    async function Xo(h) {
      f("onMidpointEnter", h);
      const p = se.value;
      if (!p || !h?.midpoint) return;
      const d = p.createSVGPoint();
      d.x = h.midpoint.x, d.y = h.midpoint.y;
      const b = p.getScreenCTM();
      if (!b) return;
      const O = d.matrixTransform(b);
      Te.value = {
        x: O.x,
        y: O.y
      }, G.value = h, Fe.value = !0, await Ne(), Uo();
    }
    function qo() {
      Fe.value = !1, G.value = null, f("onMidpointLeave");
    }
    async function $t(h) {
      if (f("onNodeClick", h), !u.value.style.chart.nodes.tooltip.showOnClick) return;
      const p = se.value;
      if (!p) return;
      const d = p.createSVGPoint();
      d.x = h.x, d.y = h.y;
      const b = p.getScreenCTM();
      if (!b) return;
      const O = d.matrixTransform(b), A = u.value.style.chart.layout.nodeWidth, C = u.value.style.chart.layout.nodeHeight, R = b.a, W = b.d, S = A * R, T = C * W;
      vt.value = {
        x: S / 2,
        y: T / 2
      }, gt.value = {
        x: O.x,
        y: O.y
      }, ke.value = h, ne.value = !0, await Ne(), Zo();
    }
    function Ft() {
      ne.value = !1, ke.value = null;
    }
    function Bt(h) {
      if (!ne.value) return;
      const p = Ge.value;
      if (p && p.contains(h.target))
        return;
      const d = se.value;
      d && d.contains(h.target) && h.target.closest(".vue-ui-dag-node") || Ft();
    }
    function zt(h) {
      h.key === "Escape" && ne.value && Ft();
    }
    Gt(() => {
      document.addEventListener("mousedown", Bt), document.addEventListener("keydown", zt);
    }), jt(() => {
      document.removeEventListener("mousedown", Bt), document.removeEventListener("keydown", zt), $.value && (I.value && $.value.unobserve(I.value), $.value.disconnect());
    });
    function Vt() {
      if (!u.value.responsive) {
        $.value && (I.value && $.value.unobserve(I.value), $.value.disconnect(), $.value = null, I.value = null);
        return;
      }
      const h = vn(() => {
        if (!m.value) return;
        const { width: p, height: d } = pn({
          chart: m.value,
          title: u.value.style.chart.title.text ? w.value : null,
          legend: u.value.style.chart.controls.show ? x.value?.$el : null,
          source: N.value
        });
        requestAnimationFrame(() => {
          j.value = Math.max(0.1, p), Q.value = Math.max(0.1, d - 12);
        });
      });
      $.value && (I.value && $.value.unobserve(I.value), $.value.disconnect()), $.value = new ResizeObserver(h), I.value = m.value ? m.value.parentNode : null, I.value && $.value.observe(I.value), h();
    }
    function Ko(h, p = {}) {
      const {
        direction: d = -1,
        mode: b = "oneLapNearest",
        dasharray: O = null
      } = p;
      if (!h || typeof h.getTotalLength != "function")
        return He.value && console.warn(
          "VueUiDag @getIdealDashoffsetDelta: invalid path element",
          h
        ), 0;
      const A = h.getTotalLength(), C = O ?? h.getAttribute("stroke-dasharray") ?? (typeof getComputedStyle == "function" ? getComputedStyle(h).strokeDasharray : ""), R = Y(C);
      if (!Number.isFinite(R) || R <= 0)
        return d * A;
      const W = Math.max(1, Math.round(A / R)), S = Math.max(1, Math.ceil(A / R)), T = Math.max(1, Math.floor(A / R));
      let B;
      return b === "pattern" ? B = R : b === "oneLapCeil" ? B = S * R : b === "oneLapFloor" ? B = T * R : B = W * R, d * B;
      function Y(q) {
        if (!q || q === "none") return NaN;
        const U = String(q).replace(/,/g, " ").trim().split(/\s+/).map((D) => Number.parseFloat(D)).filter((D) => Number.isFinite(D));
        if (!U.length) return NaN;
        const le = U.reduce((D, Z) => D + Z, 0);
        return U.length % 2 === 1 ? le * 2 : le;
      }
    }
    const Je = E(/* @__PURE__ */ new Map()), Qe = E(/* @__PURE__ */ new Map());
    function Jo(h) {
      return function(d) {
        d ? Je.value.set(h, d) : Je.value.delete(h);
      };
    }
    function It() {
      Qe.value.forEach((h) => {
        try {
          h.cancel();
        } catch {
        }
      }), Qe.value.clear();
    }
    function Qo() {
      It();
      const h = k.value?.edges ?? [];
      if (!h.length) return;
      const p = u.value.style.chart.edges.animations, d = Number(p.referenceDistance) > 0 ? Number(p.referenceDistance) : 24;
      h.forEach((b) => {
        if (!!!b?.original?.animated) return;
        const A = Je.value.get(b.id);
        if (!A) return;
        const C = b?.original?.dasharray ?? p.dasharray;
        A.style.strokeDasharray = String(C), A.style.strokeDashoffset = "0";
        const R = ![void 0, null].includes(b?.original?.animationDirection), W = ![void 0, null].includes(p.animationDirection), S = R ? Number(b.original.animationDirection) : W ? Number(p.animationDirection) : -1, T = Ko(A, {
          direction: S,
          mode: "oneLapNearest",
          dasharray: String(C)
        }), B = b?.original?.animationDurationMs ?? p.animationDurationMs ?? 1e3, Y = Number(B), U = Number.isFinite(Y) && Y > 0 ? d / Y : d / 1e3, le = Math.max(1, Math.round(Math.abs(T) / Math.max(1e-9, U))), D = A.animate(
          [{ strokeDashoffset: 0 }, { strokeDashoffset: T }],
          { duration: le, iterations: 1 / 0, easing: "linear" }
        );
        Qe.value.set(b.id, D);
      });
    }
    Ae(
      () => k.value && k.value.edges,
      async () => {
        await Ne(), Qo();
      },
      { deep: !0, immediate: !0 }
    ), jt(() => {
      It();
    });
    async function en({ scale: h = 2 } = {}) {
      if (!m.value) return;
      const { width: p, height: d } = m.value.getBoundingClientRect(), b = p / d, { imageUri: O, base64: A } = await Sn({ domElement: m.value, base64: !0, img: !0, scale: h });
      return {
        imageUri: O,
        base64: A,
        title: u.value.style.chart.title.text ?? "vue-ui-dag",
        width: p,
        height: d,
        aspectRatio: b
      };
    }
    const ae = H(() => {
      const h = Number(u.value.style.chart.layout.nodeHeight);
      return Number.isFinite(h) && h > 0 ? h / u.value.style.chart.backgroundPattern.spacingRatio : 12;
    }), tn = H(() => ae.value * (u.value.style.chart.backgroundPattern.dotRadiusRatio / 100));
    function on() {
      return k.value;
    }
    return t({
      getData: on,
      getImage: en,
      generatePdf: _t,
      generateSvg: Nt,
      generateImage: xt,
      toggleAnnotator: Ue,
      toggleFullscreen: Pt,
      zoomIn: Ze,
      zoomOut: Xe,
      resetZoom: Be,
      switchDirection: Ke
    }), (h, p) => (y(), _("div", {
      class: Wt(`vue-data-ui-component vue-ui-dag ${ie.value ? "vue-data-ui-wrapper-fullscreen" : ""} ${u.value.responsive ? "vue-ui-dag-responsive" : ""}`),
      id: `dag_${g.value}`,
      ref_key: "dagChart",
      ref: m,
      style: ce({
        fontFamily: u.value.style.fontFamily,
        backgroundColor: u.value.style.chart.backgroundColor,
        padding: "0.5rem"
      }),
      onMouseenter: Fo,
      onMouseleave: Bo
    }, [
      v(St) ? (y(), _("div", xr, Se(String(v(St))), 1)) : L("", !0),
      u.value.userOptions.buttons.annotator ? (y(), te(v(n), {
        key: 1,
        svgRef: v(se),
        backgroundColor: u.value.style.chart.backgroundColor,
        color: u.value.style.chart.color,
        active: Ee.value,
        onClose: Ue
      }, {
        "annotator-action-close": F(() => [
          M(h.$slots, "annotator-action-close", {}, void 0, !0)
        ]),
        "annotator-action-color": F(({ color: d }) => [
          M(h.$slots, "annotator-action-color", z(V({ color: d })), void 0, !0)
        ]),
        "annotator-action-draw": F(({ mode: d }) => [
          M(h.$slots, "annotator-action-draw", z(V({ mode: d })), void 0, !0)
        ]),
        "annotator-action-undo": F(({ disabled: d }) => [
          M(h.$slots, "annotator-action-undo", z(V({ disabled: d })), void 0, !0)
        ]),
        "annotator-action-redo": F(({ disabled: d }) => [
          M(h.$slots, "annotator-action-redo", z(V({ disabled: d })), void 0, !0)
        ]),
        "annotator-action-delete": F(({ disabled: d }) => [
          M(h.$slots, "annotator-action-delete", z(V({ disabled: d })), void 0, !0)
        ]),
        _: 3
      }, 8, ["svgRef", "backgroundColor", "color", "active"])) : L("", !0),
      u.value.userOptions.show && fe.value && (v(wt) || v(We)) ? (y(), te(v(s), {
        ref: "userOptionsRef",
        key: `user_option_${J.value}`,
        backgroundColor: u.value.style.chart.backgroundColor,
        color: u.value.style.chart.color,
        isPrinting: v(Et),
        isImaging: v(Ct),
        uid: g.value,
        hasTooltip: !1,
        hasTable: !1,
        hasXls: !1,
        hasLabel: !1,
        hasPdf: u.value.userOptions.buttons.pdf,
        hasImg: u.value.userOptions.buttons.img,
        hasSvg: u.value.userOptions.buttons.svg,
        hasFullscreen: u.value.userOptions.buttons.fullscreen,
        isFullscreen: ie.value,
        chartElement: m.value,
        position: u.value.userOptions.position,
        titles: { ...u.value.userOptions.buttonTitles },
        hasAnnotator: u.value.userOptions.buttons.annotator,
        isAnnotation: Ee.value,
        callbacks: u.value.userOptions.callbacks,
        printScale: u.value.userOptions.print.scale,
        hasZoom: u.value.userOptions.buttons.zoom,
        isZoom: he.value,
        onToggleFullscreen: Pt,
        onGeneratePdf: v(_t),
        onGenerateImage: v(xt),
        onGenerateSvg: Nt,
        onToggleAnnotator: Ue,
        onToggleZoom: Yo,
        style: ce({
          visibility: v(wt) ? v(We) ? "visible" : "hidden" : "visible"
        })
      }, cn({ _: 2 }, [
        h.$slots.menuIcon ? {
          name: "menuIcon",
          fn: F(({ isOpen: d, color: b }) => [
            M(h.$slots, "menuIcon", z(V({ isOpen: d, color: b })), void 0, !0)
          ]),
          key: "0"
        } : void 0,
        h.$slots.optionPdf ? {
          name: "optionPdf",
          fn: F(() => [
            M(h.$slots, "optionPdf", {}, void 0, !0)
          ]),
          key: "1"
        } : void 0,
        h.$slots.optionImg ? {
          name: "optionImg",
          fn: F(() => [
            M(h.$slots, "optionImg", {}, void 0, !0)
          ]),
          key: "2"
        } : void 0,
        h.$slots.optionSvg ? {
          name: "optionSvg",
          fn: F(() => [
            M(h.$slots, "optionSvg", {}, void 0, !0)
          ]),
          key: "3"
        } : void 0,
        h.$slots.optionFullscreen ? {
          name: "optionFullscreen",
          fn: F(({ toggleFullscreen: d, isFullscreen: b }) => [
            M(h.$slots, "optionFullscreen", z(V({ toggleFullscreen: d, isFullscreen: b })), void 0, !0)
          ]),
          key: "4"
        } : void 0,
        h.$slots.optionAnnotator ? {
          name: "optionAnnotator",
          fn: F(({ toggleAnnotator: d, isAnnotator: b }) => [
            M(h.$slots, "optionAnnotator", z(V({ toggleAnnotator: d, isAnnotator: b })), void 0, !0)
          ]),
          key: "5"
        } : void 0,
        h.$slots.optionZoom ? {
          name: "optionZoom",
          fn: F(({ toggleZoom: d, isZoomLocked: b }) => [
            M(h.$slots, "optionZoom", z(V({ toggleZoom: d, isZoomLocked: b })), void 0, !0)
          ]),
          key: "6"
        } : void 0
      ]), 1032, ["backgroundColor", "color", "isPrinting", "isImaging", "uid", "hasPdf", "hasImg", "hasSvg", "hasFullscreen", "isFullscreen", "chartElement", "position", "titles", "hasAnnotator", "isAnnotation", "callbacks", "printScale", "hasZoom", "isZoom", "onGeneratePdf", "onGenerateImage", "style"])) : L("", !0),
      u.value.style.chart.title.text ? (y(), _("div", {
        key: 3,
        ref_key: "chartTitle",
        ref: w,
        style: "width:100%;background:transparent;"
      }, [
        (y(), te(An, {
          key: `title_${P.value}`,
          config: {
            title: {
              cy: "dag-title",
              ...u.value.style.chart.title
            },
            subtitle: {
              cy: "dag-subtitle",
              ...u.value.style.chart.title.subtitle
            }
          }
        }, null, 8, ["config"]))
      ], 512)) : L("", !0),
      u.value.style.chart.controls.position === "top" && !v(Ce) && u.value.style.chart.controls.show ? (y(), te(qt, {
        key: 4,
        ref_key: "zoomControls",
        ref: x,
        config: u.value,
        scale: v(Dt),
        isFullscreen: ie.value,
        withDirection: "",
        onZoomIn: Ze,
        onZoomOut: Xe,
        onResetZoom: p[0] || (p[0] = () => v(Be)(!0)),
        onSwitchDirection: Ke
      }, null, 8, ["config", "scale", "isFullscreen"])) : L("", !0),
      v(k) ? (y(), _("svg", {
        key: 5,
        ref_key: "svgRef",
        ref: se,
        class: Wt({ "vue-ui-dag-svg": !0, "vue-data-ui-loading": v(Ce) }),
        viewBox: Ho.value,
        xmlns: v(mn),
        style: ce({
          backgroundColor: u.value.style.chart.backgroundColor,
          height: "100%",
          width: "100%"
        })
      }, [
        tt(v(i)),
        u.value.style.chart.backgroundPattern.show ? (y(), _("defs", Ar, [
          K("pattern", {
            id: `dag_bg_pattern_${g.value}`,
            patternUnits: "userSpaceOnUse",
            width: ae.value,
            height: ae.value
          }, [
            M(h.$slots, "background-pattern", z(V({
              x: ae.value / 2,
              y: ae.value / 2,
              color: u.value.style.chart.backgroundPattern.dotColor
            })), () => [
              K("circle", {
                cx: ae.value / 2,
                cy: ae.value / 2,
                r: tn.value,
                fill: u.value.style.chart.backgroundPattern.dotColor
              }, null, 8, Lr)
            ], !0)
          ], 8, Sr)
        ])) : L("", !0),
        u.value.style.chart.backgroundPattern.show ? (y(), _("rect", {
          key: 1,
          x: v(me)?.x ?? 0,
          y: v(me)?.y ?? 0,
          width: v(me)?.width ?? 0,
          height: v(me)?.height ?? 0,
          fill: `url(#dag_bg_pattern_${g.value})`,
          style: ce({
            pointerEvents: "none",
            opacity: u.value.style.chart.backgroundPattern.opacity
          })
        }, null, 12, Mr)) : L("", !0),
        v(k).arrowShape !== "undirected" ? (y(), _("defs", Or, [
          (y(!0), _(ue, null, Le(jo.value, (d) => (y(), _("marker", {
            key: d,
            id: Mt(d),
            markerWidth: v(k).arrowSize,
            markerHeight: v(k).arrowSize,
            refX: v(k).arrowSize - 3,
            refY: v(k).arrowSize / 2,
            orient: "auto",
            markerUnits: "strokeWidth"
          }, [
            v(k).arrowShape === "normal" ? (y(), _("path", {
              key: 0,
              d: `M 0 0 L ${v(k).arrowSize} ${v(k).arrowSize / 2} L 0 ${v(k).arrowSize} Z`,
              fill: d,
              stroke: d,
              "stroke-width": "0"
            }, null, 8, Rr)) : (y(), _("path", {
              key: 1,
              d: `M 0 0 L ${v(k).arrowSize} ${v(k).arrowSize / 2} L 0 ${v(k).arrowSize} L ${v(k).arrowSize / 3} ${v(k).arrowSize / 2} Z`,
              fill: d,
              stroke: d,
              "stroke-width": "0"
            }, null, 8, Tr))
          ], 8, Dr))), 128))
        ])) : L("", !0),
        K("g", Pr, [
          (y(!0), _(ue, null, Le(v(k).edges, (d) => (y(), _(ue, {
            key: d.id
          }, [
            K("path", {
              "data-cy-edge": "",
              ref_for: !0,
              ref: Jo(d.id),
              d: d.pathData,
              fill: "none",
              stroke: d.original.color ?? u.value.style.chart.edges.stroke,
              "stroke-width": u.value.style.chart.edges.strokeWidth * (d.from === re.value || d.id === G.value?.id ? 2 : 1),
              "stroke-linecap": "round",
              "stroke-linejoin": "round",
              style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out" }
            }, null, 8, $r),
            u.value.style.chart.midpoints.show ? (y(), _("circle", {
              key: 0,
              "data-cy-midpoint": "",
              class: "vue-ui-dag-edge-midpoint",
              cx: d.midpoint.x,
              cy: d.midpoint.y,
              r: u.value.style.chart.midpoints.radius,
              fill: u.value.style.chart.midpoints.fill,
              stroke: d.original.color ?? u.value.style.chart.midpoints.stroke,
              "stroke-width": u.value.style.chart.midpoints.strokeWidth * (d.from === re.value || d.id === G.value?.id ? 2 : 1),
              style: { transition: "stroke-width 0.2s ease-in-out" },
              onMouseenter: (b) => Xo(d),
              onMouseleave: qo
            }, null, 40, Fr)) : L("", !0)
          ], 64))), 128))
        ]),
        K("g", Br, [
          (y(!0), _(ue, null, Le(v(k).nodes, (d) => (y(), _("g", {
            key: d.id,
            class: "vue-ui-dag-node",
            onClick: Yt((b) => u.value.style.chart.nodes.tooltip.showOnClick && $t(d), ["stop"]),
            onMouseenter: (b) => re.value = d.id,
            onMouseleave: p[1] || (p[1] = (b) => re.value = null)
          }, [
            h.$slots.node ? L("", !0) : (y(), _("rect", {
              key: 0,
              "data-cy-node": "",
              x: d.x - d.width / 2,
              y: d.y - d.height / 2,
              width: d.width,
              height: d.height,
              rx: u.value.style.chart.nodes.borderRadius,
              fill: d.original.backgroundColor,
              stroke: u.value.style.chart.nodes.stroke,
              "stroke-width": u.value.style.chart.nodes.strokeWidth,
              style: ce({
                cursor: u.value.style.chart.nodes.tooltip.showOnClick ? "pointer" : "default"
              })
            }, null, 12, Vr)),
            h.$slots.node ? (y(), _("foreignObject", {
              key: 1,
              x: d.x - d.width / 2,
              y: d.y - d.height / 2,
              width: d.width,
              height: d.height
            }, [
              M(h.$slots, "node", ot({ ref_for: !0 }, { node: d, orientation: ee.value }), void 0, !0)
            ], 8, Ir)) : L("", !0)
          ], 40, zr))), 128))
        ]),
        K("g", Gr, [
          (y(!0), _(ue, null, Le(v(k).edges, (d) => (y(), _("path", {
            key: d.id,
            d: d.pathData,
            fill: "none",
            stroke: "transparent",
            "stroke-width": u.value.style.chart.edges.strokeWidth * (d.from === re.value || d.id === G.value?.id ? 1.3 : 1),
            "stroke-linecap": "round",
            "stroke-linejoin": "round",
            "marker-end": v(k).arrowShape === "undirected" ? null : `url(#${Mt(d.original?.color || u.value.style.chart.edges.stroke)})`,
            style: { "pointer-events": "none", transition: "stroke-width 0.2s ease-in-out" }
          }, null, 8, jr))), 128))
        ]),
        K("g", Wr, [
          (y(!0), _(ue, null, Le(v(k).nodes, (d) => (y(), _("g", {
            key: d.id,
            onClick: Yt((b) => u.value.style.chart.nodes.tooltip.showOnClick && $t(d), ["stop"]),
            onMouseenter: (b) => re.value = d.id,
            onMouseleave: p[2] || (p[2] = (b) => re.value = null)
          }, [
            h.$slots["free-node-label"] ? L("", !0) : (y(), _(ue, { key: 0 }, [
              h.$slots["node-label"] ? (y(), _("text", {
                key: 0,
                x: d.x,
                y: d.y + u.value.style.chart.nodes.labels.fontSize / 3,
                "text-anchor": "middle",
                "font-size": u.value.style.chart.nodes.labels.fontSize,
                fill: d.original.color,
                "font-weight": u.value.style.chart.nodes.labels.bold ? "bold" : "normal"
              }, [
                M(h.$slots, "node-label", ot({ ref_for: !0 }, { node: d, orientation: ee.value }), () => [
                  un(Se(d.label), 1)
                ], !0)
              ], 8, Hr)) : !h.$slots["free-node-label"] && !h.$slots.node ? (y(), _("text", {
                key: 1,
                "data-cy-node-label": "",
                x: d.x,
                y: d.y + u.value.style.chart.nodes.labels.fontSize / 3,
                "text-anchor": "middle",
                "font-size": u.value.style.chart.nodes.labels.fontSize,
                fill: d.original.color,
                "font-weight": u.value.style.chart.nodes.labels.bold ? "bold" : "normal",
                innerHTML: v(gn)({
                  content: d.label,
                  fontSize: u.value.style.chart.nodes.labels.fontSize,
                  fontWeight: u.value.style.chart.nodes.labels.bold ? "bold" : "normal",
                  fill: d.original.color,
                  x: d.x,
                  y: d.y,
                  autoOffset: !0
                })
              }, null, 8, Ur)) : L("", !0)
            ], 64)),
            h.$slots["free-node-label"] ? (y(), _("g", Zr, [
              M(h.$slots, "free-node-label", ot({ ref_for: !0 }, { node: d, layoutData: v(k), orientation: ee.value }), void 0, !0)
            ])) : L("", !0)
          ], 40, Yr))), 128))
        ]),
        M(h.$slots, "svg", {
          svg: {
            drawingArea: v(me),
            data: v(k),
            orientation: ee.value
          }
        }, void 0, !0)
      ], 14, Nr)) : L("", !0),
      h.$slots.watermark ? (y(), _("div", Xr, [
        M(h.$slots, "watermark", z(V({ isPrinting: v(Et) || v(Ct) })), void 0, !0)
      ])) : L("", !0),
      tt(Ht, { name: "fade" }, {
        default: F(() => [
          Fe.value ? (y(), te(Ut, {
            key: 0,
            to: ie.value ? m.value : "body"
          }, [
            K("div", {
              "data-cy-tooltip-midpoint": "",
              ref_key: "tooltipRef",
              ref: Pe,
              class: "vue-ui-dag-tooltip",
              style: ce({
                ...$e.value,
                maxWidth: u.value.style.chart.midpoints.tooltip.maxWidth,
                "--vue-data-ui-dag-tooltip-background": u.value.style.chart.midpoints.tooltip.backgroundColor,
                "--vue-data-ui-dag-tooltip-color": u.value.style.chart.midpoints.tooltip.color
              }),
              "data-position": ye.value
            }, [
              M(h.$slots, "tooltip-midpoint", z(V({ edge: G.value, layoutData: v(k) })), () => [
                G.value ? (y(), _("div", Kr, Se(Lt(G.value.from)?.label ?? G.value.from) + " → " + Se(Lt(G.value.to)?.label ?? G.value.to), 1)) : L("", !0)
              ], !0)
            ], 12, qr)
          ], 8, ["to"])) : L("", !0)
        ]),
        _: 3
      }),
      tt(Ht, { name: "fade" }, {
        default: F(() => [
          ne.value ? (y(), te(Ut, {
            key: 0,
            to: ie.value ? m.value : "body"
          }, [
            K("div", {
              "data-cy-tooltip-node": "",
              ref_key: "nodeTooltipRef",
              ref: Ge,
              class: "vue-ui-dag-node-tooltip",
              style: ce({
                maxWidth: u.value.style.chart.nodes.tooltip.maxWidth,
                left: je.value.left,
                top: je.value.top,
                "--vue-data-ui-dag-node-tooltip-background": u.value.style.chart.nodes.tooltip.backgroundColor,
                "--vue-data-ui-dag-node-tooltip-color": u.value.style.chart.nodes.tooltip.color
              }),
              "data-position": pt.value
            }, [
              M(h.$slots, "tooltip-node", z(V({ node: ke.value, layoutData: v(k) })), () => [
                ke.value ? (y(), _("div", Qr, Se(ke.value.label), 1)) : L("", !0)
              ], !0)
            ], 12, Jr)
          ], 8, ["to"])) : L("", !0)
        ]),
        _: 3
      }),
      u.value.style.chart.controls.position === "bottom" && !v(Ce) && u.value.style.chart.controls.show ? (y(), te(qt, {
        key: 7,
        ref_key: "zoomControls",
        ref: x,
        config: u.value,
        scale: v(Dt),
        isFullscreen: ie.value,
        withDirection: "",
        onZoomIn: Ze,
        onZoomOut: Xe,
        onResetZoom: p[3] || (p[3] = () => v(Be)(!0)),
        onSwitchDirection: Ke
      }, null, 8, ["config", "scale", "isFullscreen"])) : L("", !0),
      h.$slots.source ? (y(), _("div", {
        key: 8,
        ref_key: "source",
        ref: N,
        dir: "auto"
      }, [
        M(h.$slots, "source", {}, void 0, !0)
      ], 512)) : L("", !0),
      v(Ce) ? (y(), te(kn, { key: 9 })) : L("", !0)
    ], 46, _r));
  }
}, ti = /* @__PURE__ */ Ln(ei, [["__scopeId", "data-v-5cf3932e"]]), wi = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  __proto__: null,
  default: ti
}, Symbol.toStringTag, { value: "Module" }));
export {
  bi as a,
  wi as b,
  ti as v
};