@html-graph/html-graph 8.24.0 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -63,7 +63,7 @@ var e = /* @__PURE__ */ function(e) {
63
63
  updateEdgeShape(e) {
64
64
  let t = this.edgeIdToElementMap.get(e);
65
65
  this.container.removeChild(t);
66
- let n = this.graphStore.getEdge(e).payload.shape.element;
66
+ let { element: n } = this.graphStore.getEdge(e).payload.shape;
67
67
  this.edgeIdToElementMap.set(e, n), this.container.appendChild(n);
68
68
  }
69
69
  renderEdge(t) {
@@ -750,16 +750,16 @@ var e = /* @__PURE__ */ function(e) {
750
750
  direction: e.portDirection
751
751
  }]
752
752
  };
753
- }, te = (e, t) => {
754
- let n = t;
755
- for (; n !== null;) {
756
- let t = e.findPortIdsByElement(n)[0] ?? null;
753
+ }, te = (e, t, n) => {
754
+ let r = t;
755
+ for (; r !== null;) {
756
+ let t = n(e.findPortIdsByElement(r));
757
757
  if (t !== null) return {
758
758
  status: "portFound",
759
759
  portId: t
760
760
  };
761
- if (e.findNodeIdByElement(n) !== void 0) return { status: "nodeEncountered" };
762
- n = n.parentElement;
761
+ if (e.findNodeIdByElement(r) !== void 0) return { status: "nodeEncountered" };
762
+ r = r.parentElement;
763
763
  }
764
764
  return { status: "notFound" };
765
765
  };
@@ -777,12 +777,12 @@ function* ne(e, t) {
777
777
  }
778
778
  //#endregion
779
779
  //#region src/configurators/shared/find-port-at-point/find-port-at-point.ts
780
- var re = (e, t) => {
781
- let n = ne(document, t);
782
- for (let t of n) {
783
- let n = te(e, t);
784
- if (n.status === "portFound") return n.portId;
785
- if (n.status === "nodeEncountered") return null;
780
+ var re = (e, t, n) => {
781
+ let r = ne(document, t);
782
+ for (let t of r) {
783
+ let r = te(e, t, n);
784
+ if (r.status === "portFound") return r.portId;
785
+ if (r.status === "nodeEncountered") return null;
786
786
  }
787
787
  return null;
788
788
  }, T = /* @__PURE__ */ function(e) {
@@ -1138,33 +1138,6 @@ var re = (e, t) => {
1138
1138
  let n = Math.abs(e.dir.y) < 1e-10, r = Math.abs(t.dir.y) < 1e-10;
1139
1139
  return n ? r ? de(e, t) : pe(e, t) : r ? me(e, t) : fe(e, t);
1140
1140
  }, ge = class {
1141
- path;
1142
- midpoint;
1143
- constructor(e) {
1144
- let { from: t, to: n, fromDir: r, toDir: i, arrowLength: a, arrowOffset: o, roundness: s, hasSourceArrow: c, hasTargetArrow: l } = e, u = c ? E({
1145
- x: t.x + a,
1146
- y: t.y
1147
- }, r, t) : t, d = l ? E({
1148
- x: n.x - a,
1149
- y: n.y
1150
- }, i, n) : n, f = a + o, p = E({
1151
- x: t.x + f,
1152
- y: t.y
1153
- }, r, t), m = E({
1154
- x: n.x - f,
1155
- y: n.y
1156
- }, i, n), h = de({
1157
- arrowPoint: u,
1158
- linePoint: p,
1159
- dir: r
1160
- }, {
1161
- arrowPoint: d,
1162
- linePoint: m,
1163
- dir: i
1164
- });
1165
- this.path = j(h.points, s), this.midpoint = h.midpoint;
1166
- }
1167
- }, _e = class {
1168
1141
  path;
1169
1142
  midpoint;
1170
1143
  constructor(e) {
@@ -1199,7 +1172,7 @@ var re = (e, t) => {
1199
1172
  p
1200
1173
  ], d);
1201
1174
  }
1202
- }, ve = class {
1175
+ }, _e = class {
1203
1176
  path;
1204
1177
  midpoint;
1205
1178
  constructor(e) {
@@ -1228,34 +1201,7 @@ var re = (e, t) => {
1228
1201
  y: n.y
1229
1202
  }, t, n) : n;
1230
1203
  }
1231
- }, ye = class {
1232
- path;
1233
- midpoint;
1234
- constructor(e) {
1235
- let { from: t, to: n, hasSourceArrow: r, hasTargetArrow: i, arrowLength: a, arrowOffset: o, fromDir: s, toDir: c, roundness: l } = e, u = r ? E({
1236
- x: t.x + a,
1237
- y: t.y
1238
- }, s, t) : t, d = i ? E({
1239
- x: n.x - a,
1240
- y: n.y
1241
- }, c, n) : n, f = a + o, p = E({
1242
- x: t.x + f,
1243
- y: t.y
1244
- }, s, t), m = E({
1245
- x: n.x - f,
1246
- y: n.y
1247
- }, c, n), h = fe({
1248
- arrowPoint: u,
1249
- linePoint: p,
1250
- dir: s
1251
- }, {
1252
- arrowPoint: d,
1253
- linePoint: m,
1254
- dir: c
1255
- });
1256
- this.path = j(h.points, l), this.midpoint = h.midpoint;
1257
- }
1258
- }, be = class {
1204
+ }, ve = class {
1259
1205
  path;
1260
1206
  midpoint;
1261
1207
  constructor(e) {
@@ -1282,7 +1228,7 @@ var re = (e, t) => {
1282
1228
  });
1283
1229
  this.path = j(h.points, s), this.midpoint = h.midpoint;
1284
1230
  }
1285
- }, P = class {
1231
+ }, ye = class {
1286
1232
  path;
1287
1233
  midpoint;
1288
1234
  constructor(e) {
@@ -1331,7 +1277,7 @@ var re = (e, t) => {
1331
1277
  y: (l[3].y + l[4].y) / 2
1332
1278
  };
1333
1279
  }
1334
- }, xe = class {
1280
+ }, be = class {
1335
1281
  path;
1336
1282
  midpoint;
1337
1283
  constructor(e) {
@@ -1366,10 +1312,10 @@ var re = (e, t) => {
1366
1312
  ].join(" "), h = `M ${a.x} ${a.y} L ${p[0].x} ${p[0].y} `;
1367
1313
  this.path = `${o ? "" : h}${m}`, this.midpoint = p[3];
1368
1314
  }
1369
- }, Se = (e, t, n) => {
1315
+ }, xe = (e, t, n) => {
1370
1316
  let r = Math.max(e.y, t.y), i = Math.min(e.y, t.y);
1371
1317
  return (n >= 0 ? r : i) + n;
1372
- }, Ce = class {
1318
+ }, Se = class {
1373
1319
  path;
1374
1320
  midpoint;
1375
1321
  constructor(e) {
@@ -1385,7 +1331,7 @@ var re = (e, t) => {
1385
1331
  }, o, i), h = E({
1386
1332
  x: a.x - p,
1387
1333
  y: a.y
1388
- }, s, a), g = Se(m, h, u);
1334
+ }, s, a), g = xe(m, h, u);
1389
1335
  this.midpoint = {
1390
1336
  x: (m.x + h.x) / 2,
1391
1337
  y: g
@@ -1404,10 +1350,10 @@ var re = (e, t) => {
1404
1350
  f
1405
1351
  ], l);
1406
1352
  }
1407
- }, we = (e, t, n) => {
1353
+ }, Ce = (e, t, n) => {
1408
1354
  let r = Math.max(e.x, t.x), i = Math.min(e.x, t.x);
1409
1355
  return (n >= 0 ? r : i) + n;
1410
- }, Te = class {
1356
+ }, we = class {
1411
1357
  path;
1412
1358
  midpoint;
1413
1359
  constructor(e) {
@@ -1423,7 +1369,7 @@ var re = (e, t) => {
1423
1369
  }, i, o), h = E({
1424
1370
  x: s.x - p,
1425
1371
  y: s.y
1426
- }, a, s), g = we(m, h, l);
1372
+ }, a, s), g = Ce(m, h, l);
1427
1373
  this.midpoint = {
1428
1374
  x: g,
1429
1375
  y: (m.y + h.y) / 2
@@ -1442,25 +1388,25 @@ var re = (e, t) => {
1442
1388
  f
1443
1389
  ], u);
1444
1390
  }
1445
- }, Ee = class {
1391
+ }, Te = class {
1446
1392
  path;
1447
1393
  midpoint;
1448
1394
  constructor(e) {
1449
1395
  let t = Math.abs(e.fromDir.y) < 1e-10, n = Math.abs(e.toDir.y) < 1e-10;
1450
1396
  if (t && n) {
1451
- let t = new Ce(e);
1397
+ let t = new Se(e);
1452
1398
  this.path = t.path, this.midpoint = t.midpoint;
1453
1399
  return;
1454
1400
  }
1455
1401
  if (!t && !n) {
1456
- let t = new Te(e);
1402
+ let t = new we(e);
1457
1403
  this.path = t.path, this.midpoint = t.midpoint;
1458
1404
  return;
1459
1405
  }
1460
- let r = new be(e);
1406
+ let r = new ve(e);
1461
1407
  this.path = r.path, this.midpoint = r.midpoint;
1462
1408
  }
1463
- }, F = Object.freeze({
1409
+ }, P = Object.freeze({
1464
1410
  color: "#777777",
1465
1411
  width: 1,
1466
1412
  arrowLength: 20,
@@ -1482,13 +1428,12 @@ var re = (e, t) => {
1482
1428
  curvature: 90,
1483
1429
  interactiveWidth: 10,
1484
1430
  portOffset: 0
1485
- }), De = (e) => ({
1431
+ }), Ee = (e) => ({
1486
1432
  x: Math.cos(e),
1487
1433
  y: Math.sin(e)
1488
- }), I = class {
1434
+ }), F = class {
1489
1435
  params;
1490
1436
  element;
1491
- svg;
1492
1437
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
1493
1438
  line;
1494
1439
  sourceArrow = null;
@@ -1497,7 +1442,7 @@ var re = (e, t) => {
1497
1442
  afterRenderEmitter;
1498
1443
  arrowRenderer;
1499
1444
  constructor(e) {
1500
- this.params = e, [this.afterRenderEmitter, this.onAfterRender] = u(), this.arrowRenderer = this.params.arrowRenderer, this.element = ce(e.color), this.svg = this.element, this.element.appendChild(this.group), this.line = le(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = A(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = A(), this.group.appendChild(this.targetArrow));
1445
+ this.params = e, [this.afterRenderEmitter, this.onAfterRender] = u(), this.arrowRenderer = this.params.arrowRenderer, this.element = ce(e.color), this.element.appendChild(this.group), this.line = le(e.width), this.group.appendChild(this.line), e.hasSourceArrow && (this.sourceArrow = A(), this.group.appendChild(this.sourceArrow)), e.hasTargetArrow && (this.targetArrow = A(), this.group.appendChild(this.targetArrow));
1501
1446
  }
1502
1447
  render(t) {
1503
1448
  let { x: n, y: r, width: i, height: a, from: o, to: s } = ae(t.from, t.to, this.params.padding);
@@ -1507,7 +1452,7 @@ var re = (e, t) => {
1507
1452
  width: i,
1508
1453
  height: a
1509
1454
  });
1510
- let c = De(t.from.direction), l = De(t.to.direction), u = {
1455
+ let c = Ee(t.from.direction), l = Ee(t.to.direction), u = {
1511
1456
  x: -l.x,
1512
1457
  y: -l.y
1513
1458
  }, d;
@@ -1531,7 +1476,7 @@ var re = (e, t) => {
1531
1476
  targetArrowPath: m
1532
1477
  });
1533
1478
  }
1534
- }, Oe = (e) => (t) => {
1479
+ }, De = (e) => (t) => {
1535
1480
  let n = [
1536
1481
  {
1537
1482
  x: 0,
@@ -1553,7 +1498,7 @@ var re = (e, t) => {
1553
1498
  y: e.y + t.shift.y
1554
1499
  }));
1555
1500
  return `${`M ${n[0].x} ${n[0].y}`} ${`L ${n[1].x} ${n[1].y}`} ${`L ${n[2].x} ${n[2].y}`} Z`;
1556
- }, ke = (e) => (t) => {
1501
+ }, Oe = (e) => (t) => {
1557
1502
  let n = e.radius, r = t.arrowLength, i = (r * r + 2 * r * n) / (2 * n), a = i + n, o = r + n - n * (r + n) / a, s = n * i / a, c = [
1558
1503
  {
1559
1504
  x: 0,
@@ -1575,7 +1520,7 @@ var re = (e, t) => {
1575
1520
  y: e.y + t.shift.y
1576
1521
  }));
1577
1522
  return `${`M ${c[0].x} ${c[0].y}`} ${`A ${i} ${i} 0 0 0 ${c[1].x} ${c[1].y}`} ${`A ${n} ${n} 0 0 0 ${c[2].x} ${c[2].y}`} ${`A ${i} ${i} 0 0 0 ${c[0].x} ${c[0].y}`}`;
1578
- }, Ae = (e) => (t) => {
1523
+ }, ke = (e) => (t) => {
1579
1524
  let n = e.smallRadius, r = e.radius, i = E({
1580
1525
  x: t.arrowLength,
1581
1526
  y: 0
@@ -1603,20 +1548,19 @@ var re = (e, t) => {
1603
1548
  y: e.y + t.shift.y
1604
1549
  }));
1605
1550
  return `${`M ${a[0].x} ${a[0].y}`} ${`A ${r} ${r} 0 0 1 ${a[1].x} ${a[1].y}`} ${`A ${n} ${n} 0 0 1 ${a[2].x} ${a[2].y}`} ${`A ${r} ${r} 0 0 1 ${a[0].x} ${a[0].y}`}`;
1606
- }, L = (e) => {
1551
+ }, I = (e) => {
1607
1552
  if (typeof e == "function") return e;
1608
1553
  switch (e.type) {
1609
- case "triangle": return Oe({ radius: e.radius ?? F.polygonArrowRadius });
1610
- case "arc": return ke({ radius: e.radius ?? F.circleArrowRadius });
1611
- default: return Ae({
1612
- smallRadius: e.smallRadius ?? F.wedgeArrowSmallRadius,
1613
- angle: e.angle ?? F.wedgeArrowAngle,
1614
- radius: e.radius ?? F.wedgeArrowRadius
1554
+ case "triangle": return De({ radius: e.radius ?? P.polygonArrowRadius });
1555
+ case "arc": return Oe({ radius: e.radius ?? P.circleArrowRadius });
1556
+ default: return ke({
1557
+ smallRadius: e.smallRadius ?? P.wedgeArrowSmallRadius,
1558
+ angle: e.angle ?? P.wedgeArrowAngle,
1559
+ radius: e.radius ?? P.wedgeArrowRadius
1615
1560
  });
1616
1561
  }
1617
- }, je = class {
1562
+ }, Ae = class {
1618
1563
  element;
1619
- svg;
1620
1564
  group;
1621
1565
  line;
1622
1566
  sourceArrow;
@@ -1631,7 +1575,7 @@ var re = (e, t) => {
1631
1575
  hasSourceArrow;
1632
1576
  hasTargetArrow;
1633
1577
  pathShape;
1634
- createCyclePath = (e, t, n) => new xe({
1578
+ createCyclePath = (e, t, n) => new be({
1635
1579
  origin: e,
1636
1580
  dir: n,
1637
1581
  radius: this.portCycleRadius,
@@ -1662,10 +1606,10 @@ var re = (e, t) => {
1662
1606
  hasTargetArrow: this.hasTargetArrow
1663
1607
  });
1664
1608
  constructor(e) {
1665
- this.arrowLength = e?.arrowLength ?? F.arrowLength, this.curvature = e?.curvature ?? F.curvature, this.portCycleRadius = e?.cycleRadius ?? F.cycleRadius, this.portCycleSmallRadius = e?.smallCycleRadius ?? F.smallCycleRadius, this.detourDirection = e?.detourDirection ?? F.detourDirection, this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1666
- color: e?.color ?? F.color,
1667
- width: e?.width ?? F.width,
1668
- arrowRenderer: L(e?.arrowRenderer ?? {}),
1609
+ this.arrowLength = e?.arrowLength ?? P.arrowLength, this.curvature = e?.curvature ?? P.curvature, this.portCycleRadius = e?.cycleRadius ?? P.cycleRadius, this.portCycleSmallRadius = e?.smallCycleRadius ?? P.smallCycleRadius, this.detourDirection = e?.detourDirection ?? P.detourDirection, this.detourDistance = e?.detourDistance ?? P.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? P.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? P.hasTargetArrow, this.pathShape = new F({
1610
+ color: e?.color ?? P.color,
1611
+ width: e?.width ?? P.width,
1612
+ arrowRenderer: I(e?.arrowRenderer ?? {}),
1669
1613
  arrowLength: this.arrowLength,
1670
1614
  hasSourceArrow: this.hasSourceArrow,
1671
1615
  hasTargetArrow: this.hasTargetArrow,
@@ -1673,92 +1617,13 @@ var re = (e, t) => {
1673
1617
  createDetourPath: this.createDetourPath,
1674
1618
  createLinePath: this.createLinePath,
1675
1619
  padding: 50
1676
- }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1620
+ }), this.element = this.pathShape.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1677
1621
  }
1678
1622
  render(e) {
1679
1623
  this.pathShape.render(e);
1680
1624
  }
1681
- }, Me = (e) => Math.cos(e) > 0 ? 0 : Math.PI, Ne = class {
1682
- element;
1683
- svg;
1684
- group;
1685
- line;
1686
- sourceArrow;
1687
- targetArrow;
1688
- onAfterRender;
1689
- arrowLength;
1690
- arrowOffset;
1691
- roundness;
1692
- cycleSquareSide;
1693
- detourDistance;
1694
- hasSourceArrow;
1695
- hasTargetArrow;
1696
- pathShape;
1697
- createCyclePath = (e, t, n) => new P({
1698
- origin: e,
1699
- dir: n,
1700
- arrowLength: this.arrowLength,
1701
- side: this.cycleSquareSide,
1702
- arrowOffset: this.arrowOffset,
1703
- roundness: this.roundness,
1704
- hasArrow: this.hasSourceArrow || this.hasTargetArrow
1705
- });
1706
- createDetourPath = (e, t, n, r) => new Ce({
1707
- from: e,
1708
- to: t,
1709
- fromDir: n,
1710
- toDir: r,
1711
- arrowLength: this.arrowLength,
1712
- arrowOffset: this.arrowOffset,
1713
- roundness: this.roundness,
1714
- detourDistance: this.detourDistance,
1715
- hasSourceArrow: this.hasSourceArrow,
1716
- hasTargetArrow: this.hasTargetArrow
1717
- });
1718
- createLinePath = (e, t, n, r) => new ge({
1719
- from: e,
1720
- to: t,
1721
- fromDir: n,
1722
- toDir: r,
1723
- arrowLength: this.arrowLength,
1724
- arrowOffset: this.arrowOffset,
1725
- roundness: this.roundness,
1726
- hasSourceArrow: this.hasSourceArrow,
1727
- hasTargetArrow: this.hasTargetArrow
1728
- });
1729
- constructor(e) {
1730
- this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
1731
- let t = e?.roundness ?? F.roundness;
1732
- this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1733
- color: e?.color ?? F.color,
1734
- width: e?.width ?? F.width,
1735
- arrowRenderer: L(e?.arrowRenderer ?? {}),
1736
- arrowLength: this.arrowLength,
1737
- hasSourceArrow: this.hasSourceArrow,
1738
- hasTargetArrow: this.hasTargetArrow,
1739
- createCyclePath: this.createCyclePath,
1740
- createDetourPath: this.createDetourPath,
1741
- createLinePath: this.createLinePath,
1742
- padding: 50
1743
- }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1744
- }
1745
- render(e) {
1746
- let { from: t, to: n, category: r } = e;
1747
- this.pathShape.render({
1748
- category: r,
1749
- from: {
1750
- ...t,
1751
- direction: Me(t.direction)
1752
- },
1753
- to: {
1754
- ...n,
1755
- direction: Me(n.direction)
1756
- }
1757
- });
1758
- }
1759
- }, Pe = class {
1625
+ }, je = class {
1760
1626
  element;
1761
- svg;
1762
1627
  group;
1763
1628
  line;
1764
1629
  sourceArrow;
@@ -1773,7 +1638,7 @@ var re = (e, t) => {
1773
1638
  hasSourceArrow;
1774
1639
  hasTargetArrow;
1775
1640
  pathShape;
1776
- createCyclePath = (e, t, n) => new P({
1641
+ createCyclePath = (e, t, n) => new ye({
1777
1642
  origin: e,
1778
1643
  dir: n,
1779
1644
  arrowLength: this.arrowLength,
@@ -1782,7 +1647,7 @@ var re = (e, t) => {
1782
1647
  roundness: this.roundness,
1783
1648
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1784
1649
  });
1785
- createDetourPath = (e, t, n, r) => new _e({
1650
+ createDetourPath = (e, t, n, r) => new ge({
1786
1651
  from: e,
1787
1652
  to: t,
1788
1653
  fromDir: n,
@@ -1795,7 +1660,7 @@ var re = (e, t) => {
1795
1660
  hasSourceArrow: this.hasSourceArrow,
1796
1661
  hasTargetArrow: this.hasTargetArrow
1797
1662
  });
1798
- createLinePath = (e, t, n, r) => new ve({
1663
+ createLinePath = (e, t, n, r) => new _e({
1799
1664
  from: e,
1800
1665
  to: t,
1801
1666
  fromDir: n,
@@ -1807,12 +1672,12 @@ var re = (e, t) => {
1807
1672
  hasTargetArrow: this.hasTargetArrow
1808
1673
  });
1809
1674
  constructor(e) {
1810
- this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
1811
- let t = e?.roundness ?? F.roundness;
1812
- this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDirection = e?.detourDirection ?? F.detourDirection, this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1813
- color: e?.color ?? F.color,
1814
- width: e?.width ?? F.width,
1815
- arrowRenderer: L(e?.arrowRenderer ?? {}),
1675
+ this.arrowLength = e?.arrowLength ?? P.arrowLength, this.arrowOffset = e?.arrowOffset ?? P.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? P.cycleSquareSide;
1676
+ let t = e?.roundness ?? P.roundness;
1677
+ this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDirection = e?.detourDirection ?? P.detourDirection, this.detourDistance = e?.detourDistance ?? P.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? P.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? P.hasTargetArrow, this.pathShape = new F({
1678
+ color: e?.color ?? P.color,
1679
+ width: e?.width ?? P.width,
1680
+ arrowRenderer: I(e?.arrowRenderer ?? {}),
1816
1681
  arrowLength: this.arrowLength,
1817
1682
  hasSourceArrow: this.hasSourceArrow,
1818
1683
  hasTargetArrow: this.hasTargetArrow,
@@ -1820,95 +1685,16 @@ var re = (e, t) => {
1820
1685
  createDetourPath: this.createDetourPath,
1821
1686
  createLinePath: this.createLinePath,
1822
1687
  padding: 50
1823
- }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1688
+ }), this.element = this.pathShape.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1824
1689
  }
1825
1690
  render(e) {
1826
1691
  this.pathShape.render(e);
1827
1692
  }
1828
- }, Fe = Math.PI / 2, Ie = (e) => Math.sin(e) > 0 ? Fe : -Fe, Le = class {
1829
- element;
1830
- svg;
1831
- group;
1832
- line;
1833
- sourceArrow;
1834
- targetArrow;
1835
- onAfterRender;
1836
- arrowLength;
1837
- arrowOffset;
1838
- roundness;
1839
- cycleSquareSide;
1840
- detourDistance;
1841
- hasSourceArrow;
1842
- hasTargetArrow;
1843
- pathShape;
1844
- createCyclePath = (e, t, n) => new P({
1845
- origin: e,
1846
- dir: n,
1847
- arrowLength: this.arrowLength,
1848
- side: this.cycleSquareSide,
1849
- arrowOffset: this.arrowOffset,
1850
- roundness: this.roundness,
1851
- hasArrow: this.hasSourceArrow || this.hasTargetArrow
1852
- });
1853
- createDetourPath = (e, t, n, r) => new Te({
1854
- from: e,
1855
- to: t,
1856
- fromDir: n,
1857
- toDir: r,
1858
- arrowLength: this.arrowLength,
1859
- arrowOffset: this.arrowOffset,
1860
- roundness: this.roundness,
1861
- detourDistance: this.detourDistance,
1862
- hasSourceArrow: this.hasSourceArrow,
1863
- hasTargetArrow: this.hasTargetArrow
1864
- });
1865
- createLinePath = (e, t, n, r) => new ye({
1866
- from: e,
1867
- to: t,
1868
- fromDir: n,
1869
- toDir: r,
1870
- arrowLength: this.arrowLength,
1871
- arrowOffset: this.arrowOffset,
1872
- roundness: this.roundness,
1873
- hasSourceArrow: this.hasSourceArrow,
1874
- hasTargetArrow: this.hasTargetArrow
1875
- });
1876
- constructor(e) {
1877
- this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
1878
- let t = e?.roundness ?? F.roundness;
1879
- this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1880
- color: e?.color ?? F.color,
1881
- width: e?.width ?? F.width,
1882
- arrowRenderer: L(e?.arrowRenderer ?? {}),
1883
- arrowLength: this.arrowLength,
1884
- hasSourceArrow: this.hasSourceArrow,
1885
- hasTargetArrow: this.hasTargetArrow,
1886
- createCyclePath: this.createCyclePath,
1887
- createDetourPath: this.createDetourPath,
1888
- createLinePath: this.createLinePath,
1889
- padding: 50
1890
- }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1891
- }
1892
- render(e) {
1893
- let { from: t, to: n, category: r } = e;
1894
- this.pathShape.render({
1895
- category: r,
1896
- from: {
1897
- ...t,
1898
- direction: Ie(t.direction)
1899
- },
1900
- to: {
1901
- ...n,
1902
- direction: Ie(n.direction)
1903
- }
1904
- });
1905
- }
1906
- }, Re = (e) => {
1693
+ }, Me = (e) => {
1907
1694
  let t = e + Math.PI / 4, n = Math.cos(t), r = Math.sin(t);
1908
1695
  return n > 0 ? r > 0 ? 0 : -Math.PI / 2 : r > 0 ? Math.PI / 2 : Math.PI;
1909
- }, ze = class {
1696
+ }, Ne = class {
1910
1697
  element;
1911
- svg;
1912
1698
  group;
1913
1699
  line;
1914
1700
  sourceArrow;
@@ -1922,7 +1708,7 @@ var re = (e, t) => {
1922
1708
  hasSourceArrow;
1923
1709
  hasTargetArrow;
1924
1710
  pathShape;
1925
- createCyclePath = (e, t, n) => new P({
1711
+ createCyclePath = (e, t, n) => new ye({
1926
1712
  origin: e,
1927
1713
  dir: n,
1928
1714
  arrowLength: this.arrowLength,
@@ -1931,7 +1717,7 @@ var re = (e, t) => {
1931
1717
  roundness: this.roundness,
1932
1718
  hasArrow: this.hasSourceArrow || this.hasTargetArrow
1933
1719
  });
1934
- createDetourPath = (e, t, n, r) => new Ee({
1720
+ createDetourPath = (e, t, n, r) => new Te({
1935
1721
  from: e,
1936
1722
  to: t,
1937
1723
  fromDir: n,
@@ -1943,7 +1729,7 @@ var re = (e, t) => {
1943
1729
  hasSourceArrow: this.hasSourceArrow,
1944
1730
  hasTargetArrow: this.hasTargetArrow
1945
1731
  });
1946
- createLinePath = (e, t, n, r) => new be({
1732
+ createLinePath = (e, t, n, r) => new ve({
1947
1733
  from: e,
1948
1734
  to: t,
1949
1735
  fromDir: n,
@@ -1955,12 +1741,12 @@ var re = (e, t) => {
1955
1741
  hasTargetArrow: this.hasTargetArrow
1956
1742
  });
1957
1743
  constructor(e) {
1958
- this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowOffset = e?.arrowOffset ?? F.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? F.cycleSquareSide;
1959
- let t = e?.roundness ?? F.roundness;
1960
- this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? F.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? F.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? F.hasTargetArrow, this.pathShape = new I({
1961
- color: e?.color ?? F.color,
1962
- width: e?.width ?? F.width,
1963
- arrowRenderer: L(e?.arrowRenderer ?? {}),
1744
+ this.arrowLength = e?.arrowLength ?? P.arrowLength, this.arrowOffset = e?.arrowOffset ?? P.arrowOffset, this.cycleSquareSide = e?.cycleSquareSide ?? P.cycleSquareSide;
1745
+ let t = e?.roundness ?? P.roundness;
1746
+ this.roundness = Math.min(t, this.arrowOffset, this.cycleSquareSide / 2), this.detourDistance = e?.detourDistance ?? P.detourDistance, this.hasSourceArrow = e?.hasSourceArrow ?? P.hasSourceArrow, this.hasTargetArrow = e?.hasTargetArrow ?? P.hasTargetArrow, this.pathShape = new F({
1747
+ color: e?.color ?? P.color,
1748
+ width: e?.width ?? P.width,
1749
+ arrowRenderer: I(e?.arrowRenderer ?? {}),
1964
1750
  arrowLength: this.arrowLength,
1965
1751
  hasSourceArrow: this.hasSourceArrow,
1966
1752
  hasTargetArrow: this.hasTargetArrow,
@@ -1968,7 +1754,7 @@ var re = (e, t) => {
1968
1754
  createDetourPath: this.createDetourPath,
1969
1755
  createLinePath: this.createLinePath,
1970
1756
  padding: 50
1971
- }), this.element = this.pathShape.element, this.svg = this.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1757
+ }), this.element = this.pathShape.element, this.group = this.pathShape.group, this.line = this.pathShape.line, this.sourceArrow = this.pathShape.sourceArrow, this.targetArrow = this.pathShape.targetArrow, this.onAfterRender = this.pathShape.onAfterRender;
1972
1758
  }
1973
1759
  render(e) {
1974
1760
  let { from: t, to: n, category: r } = e;
@@ -1976,20 +1762,19 @@ var re = (e, t) => {
1976
1762
  category: r,
1977
1763
  from: {
1978
1764
  ...t,
1979
- direction: Re(t.direction)
1765
+ direction: Me(t.direction)
1980
1766
  },
1981
1767
  to: {
1982
1768
  ...n,
1983
- direction: Re(n.direction)
1769
+ direction: Me(n.direction)
1984
1770
  }
1985
1771
  });
1986
1772
  }
1987
- }, Be = (e) => {
1773
+ }, Pe = (e) => {
1988
1774
  let { direction: t, radius: n } = e, { x: r, y: i } = t, { horizontal: a, vertical: o } = n, s = i / r, c = Math.abs(o / s), l = Math.abs(a * s), u = Math.min(a, c), d = Math.min(o, l);
1989
1775
  return Math.sqrt(u * u + d * d);
1990
- }, Ve = (e) => typeof e == "number" ? () => e : e === "box" ? Be : e, He = F.portOffset, R = class {
1776
+ }, Fe = (e) => typeof e == "number" ? () => e : e === "box" ? Pe : e, Ie = P.portOffset, L = class {
1991
1777
  element;
1992
- svg;
1993
1778
  group = document.createElementNS("http://www.w3.org/2000/svg", "g");
1994
1779
  line;
1995
1780
  sourceArrow = null;
@@ -2003,7 +1788,7 @@ var re = (e, t) => {
2003
1788
  afterRenderEmitter;
2004
1789
  arrowRenderer;
2005
1790
  constructor(e) {
2006
- [this.afterRenderEmitter, this.onAfterRender] = u(), this.color = e?.color ?? F.color, this.width = e?.width ?? F.width, this.arrowLength = e?.arrowLength ?? F.arrowLength, this.arrowRenderer = L(e?.arrowRenderer ?? {}), this.sourceOffsetFn = Ve(e?.sourceOffset ?? He), this.targetOffsetFn = Ve(e?.targetOffset ?? He), this.element = ce(this.color), this.svg = this.element, this.element.appendChild(this.group), this.line = le(this.width), this.group.appendChild(this.line), e?.hasSourceArrow && (this.sourceArrow = A(), this.group.appendChild(this.sourceArrow)), e?.hasTargetArrow && (this.targetArrow = A(), this.group.appendChild(this.targetArrow));
1791
+ [this.afterRenderEmitter, this.onAfterRender] = u(), this.color = e?.color ?? P.color, this.width = e?.width ?? P.width, this.arrowLength = e?.arrowLength ?? P.arrowLength, this.arrowRenderer = I(e?.arrowRenderer ?? {}), this.sourceOffsetFn = Fe(e?.sourceOffset ?? Ie), this.targetOffsetFn = Fe(e?.targetOffset ?? Ie), this.element = ce(this.color), this.element.appendChild(this.group), this.line = le(this.width), this.group.appendChild(this.line), e?.hasSourceArrow && (this.sourceArrow = A(), this.group.appendChild(this.sourceArrow)), e?.hasTargetArrow && (this.targetArrow = A(), this.group.appendChild(this.targetArrow));
2007
1792
  }
2008
1793
  render(e) {
2009
1794
  let { x: t, y: n, width: r, height: i, from: a, to: o } = ae(e.from, e.to, 50);
@@ -2105,44 +1890,43 @@ var re = (e, t) => {
2105
1890
  targetArrowPath: n
2106
1891
  });
2107
1892
  }
2108
- }, Ue = () => {
1893
+ }, Le = () => {
2109
1894
  let e = document.createElementNS("http://www.w3.org/2000/svg", "g");
2110
1895
  return e.style.pointerEvents = "auto", e.style.cursor = "pointer", e;
2111
- }, We = (e) => {
1896
+ }, Re = (e) => {
2112
1897
  let t = document.createElementNS("http://www.w3.org/2000/svg", "path");
2113
1898
  return t.setAttribute("stroke", "transparent"), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "none"), t.setAttribute("stroke-linecap", "round"), t;
2114
- }, Ge = (e) => {
1899
+ }, ze = (e) => {
2115
1900
  let t = document.createElementNS("http://www.w3.org/2000/svg", "path");
2116
1901
  return t.setAttribute("stroke-linejoin", "round"), t.setAttribute("stroke-width", `${e}`), t.setAttribute("fill", "transparent"), t.setAttribute("stroke", "transparent"), t;
2117
- }, Ke = class extends Error {
1902
+ }, Be = class extends Error {
2118
1903
  constructor(e) {
2119
1904
  super(e), this.name = "InteractiveEdgeError";
2120
1905
  }
2121
- }, qe = class e {
1906
+ }, Ve = class e {
2122
1907
  baseEdge;
2123
1908
  element;
2124
- svg;
2125
1909
  group;
2126
1910
  line;
2127
1911
  sourceArrow;
2128
1912
  targetArrow;
2129
- handle = Ue();
1913
+ handle = Le();
2130
1914
  onAfterRender;
2131
1915
  interactiveLine;
2132
1916
  interactiveSourceArrow = null;
2133
1917
  interactiveTargetArrow = null;
2134
1918
  constructor(t, n) {
2135
- if (this.baseEdge = t, t instanceof e) throw new Ke("interactive edge can be configured only once");
2136
- this.element = this.baseEdge.element, this.svg = this.element, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
2137
- let r = n?.distance ?? F.interactiveWidth;
2138
- this.interactiveLine = We(r), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = Ge(r), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = Ge(r), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((e) => {
1919
+ if (this.baseEdge = t, t instanceof e) throw new Be("interactive edge can be configured only once");
1920
+ this.element = this.baseEdge.element, this.group = this.baseEdge.group, this.line = this.baseEdge.line, this.sourceArrow = this.baseEdge.sourceArrow, this.targetArrow = this.baseEdge.targetArrow, this.onAfterRender = this.baseEdge.onAfterRender;
1921
+ let r = n?.distance ?? P.interactiveWidth;
1922
+ this.interactiveLine = Re(r), this.handle.appendChild(this.interactiveLine), this.sourceArrow && (this.interactiveSourceArrow = ze(r), this.handle.appendChild(this.interactiveSourceArrow)), this.targetArrow && (this.interactiveTargetArrow = ze(r), this.handle.appendChild(this.interactiveTargetArrow)), this.group.appendChild(this.handle), this.baseEdge.onAfterRender.subscribe((e) => {
2139
1923
  this.interactiveLine.setAttribute("d", e.edgePath.path), this.interactiveSourceArrow && this.interactiveSourceArrow.setAttribute("d", e.sourceArrowPath), this.interactiveTargetArrow && this.interactiveTargetArrow.setAttribute("d", e.targetArrowPath);
2140
1924
  });
2141
1925
  }
2142
1926
  render(e) {
2143
1927
  this.baseEdge.render(e);
2144
1928
  }
2145
- }, Je = class {
1929
+ }, He = class {
2146
1930
  baseShape;
2147
1931
  midpointElement;
2148
1932
  group;
@@ -2151,9 +1935,8 @@ var re = (e, t) => {
2151
1935
  targetArrow;
2152
1936
  onAfterRender;
2153
1937
  element;
2154
- svg;
2155
1938
  constructor(e, t) {
2156
- this.baseShape = e, this.midpointElement = t, this.element = this.baseShape.element, this.svg = this.element, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.element.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((e) => {
1939
+ this.baseShape = e, this.midpointElement = t, this.element = this.baseShape.element, this.group = this.baseShape.group, this.line = this.baseShape.line, this.sourceArrow = this.baseShape.sourceArrow, this.targetArrow = this.baseShape.targetArrow, this.onAfterRender = this.baseShape.onAfterRender, this.element.append(this.midpointElement), this.baseShape.onAfterRender.subscribe((e) => {
2157
1940
  let t = e.edgePath.midpoint, n = `translate(${t.x}px, ${t.y}px)`;
2158
1941
  this.midpointElement.style.setProperty("transform", n);
2159
1942
  });
@@ -2161,7 +1944,7 @@ var re = (e, t) => {
2161
1944
  render(e) {
2162
1945
  this.baseShape.render(e);
2163
1946
  }
2164
- }, Ye = class {
1947
+ }, Ue = class {
2165
1948
  graphStore;
2166
1949
  onAfterNodeAdded;
2167
1950
  onAfterNodeUpdated;
@@ -2260,7 +2043,7 @@ var re = (e, t) => {
2260
2043
  getNodeAdjacentEdgeIds(e) {
2261
2044
  return this.graphStore.getNodeAdjacentEdgeIds(e);
2262
2045
  }
2263
- }, z = class {
2046
+ }, R = class {
2264
2047
  checkExists;
2265
2048
  counter = 0;
2266
2049
  constructor(e) {
@@ -2274,13 +2057,13 @@ var re = (e, t) => {
2274
2057
  reset() {
2275
2058
  this.counter = 0;
2276
2059
  }
2277
- }, Xe = class {
2060
+ }, We = class {
2278
2061
  graphStore;
2279
2062
  htmlView;
2280
2063
  params;
2281
- nodeIdGenerator = new z((e) => this.graphStore.hasNode(e));
2282
- portIdGenerator = new z((e) => this.graphStore.hasPort(e));
2283
- edgeIdGenerator = new z((e) => this.graphStore.hasEdge(e));
2064
+ nodeIdGenerator = new R((e) => this.graphStore.hasNode(e));
2065
+ portIdGenerator = new R((e) => this.graphStore.hasPort(e));
2066
+ edgeIdGenerator = new R((e) => this.graphStore.hasEdge(e));
2284
2067
  onAfterNodeAdded = (e) => {
2285
2068
  this.htmlView.attachNode(e);
2286
2069
  };
@@ -2387,17 +2170,13 @@ var re = (e, t) => {
2387
2170
  destroy() {
2388
2171
  this.graphStore.onAfterNodeAdded.unsubscribe(this.onAfterNodeAdded), this.graphStore.onAfterNodeUpdated.unsubscribe(this.onAfterNodeUpdated), this.graphStore.onAfterNodePriorityUpdated.unsubscribe(this.onAfterNodePriorityUpdated), this.graphStore.onBeforeNodeRemoved.unsubscribe(this.onBeforeNodeRemoved), this.graphStore.onAfterPortUpdated.unsubscribe(this.onAfterPortUpdated), this.graphStore.onBeforePortRemoved.unsubscribe(this.onBeforePortUnmarked), this.graphStore.onAfterEdgeAdded.unsubscribe(this.onAfterEdgeAdded), this.graphStore.onAfterEdgeShapeUpdated.unsubscribe(this.onAfterEdgeShapeUpdated), this.graphStore.onAfterEdgeUpdated.unsubscribe(this.onAfterEdgeUpdated), this.graphStore.onAfterEdgePriorityUpdated.unsubscribe(this.onAfterEdgePriorityUpdated), this.graphStore.onBeforeEdgeRemoved.unsubscribe(this.onBeforeEdgeRemoved), this.graphStore.onBeforeClear.unsubscribe(this.onBeforeClear), this.htmlView.destroy();
2389
2172
  }
2390
- }, Ze = (e) => {
2391
- setTimeout(() => {
2392
- e();
2393
- });
2394
- }, Qe = (e) => {
2173
+ }, Ge = (e) => {
2395
2174
  queueMicrotask(() => {
2396
2175
  e();
2397
2176
  });
2398
- }, B = (e) => {
2177
+ }, z = (e) => {
2399
2178
  e();
2400
- }, $e = class {
2179
+ }, Ke = class {
2401
2180
  viewportStore;
2402
2181
  onBeforeUpdated;
2403
2182
  onAfterUpdated;
@@ -2420,7 +2199,7 @@ var re = (e, t) => {
2420
2199
  createViewportCoords(e) {
2421
2200
  return this.viewportStore.createViewportCoords(e);
2422
2201
  }
2423
- }, et = (e, t) => Symbol.iterator in e ? {
2202
+ }, qe = (e, t) => Symbol.iterator in e ? {
2424
2203
  minContentScale: t.focus.minContentScale,
2425
2204
  nodes: e,
2426
2205
  contentPadding: t.focus.contentPadding,
@@ -2428,17 +2207,17 @@ var re = (e, t) => {
2428
2207
  } : {
2429
2208
  minContentScale: e.minContentScale ?? t.focus.minContentScale,
2430
2209
  nodes: e.nodes ?? [],
2431
- contentPadding: e.contentPadding ?? e.contentOffset ?? t.focus.contentPadding,
2210
+ contentPadding: e.contentPadding ?? t.focus.contentPadding,
2432
2211
  animationDuration: e.animationDuration ?? t.focus.animationDuration
2433
- }, tt = (e, t, n) => ({
2212
+ }, Je = (e, t, n) => ({
2434
2213
  scale: e.scale,
2435
2214
  x: e.x + e.scale * t,
2436
2215
  y: e.y + e.scale * n
2437
- }), nt = (e, t, n, r) => ({
2216
+ }), Ye = (e, t, n, r) => ({
2438
2217
  scale: e.scale * t,
2439
2218
  x: e.scale * (1 - t) * n + e.x,
2440
2219
  y: e.scale * (1 - t) * r + e.y
2441
- }), rt = class {
2220
+ }), Xe = class {
2442
2221
  graphStore;
2443
2222
  viewportStore;
2444
2223
  params;
@@ -2456,16 +2235,16 @@ var re = (e, t) => {
2456
2235
  let { width: n, height: r } = this.viewportStore.getDimensions(), i = {
2457
2236
  x: n / 2,
2458
2237
  y: r / 2
2459
- }, a = this.viewportStore.getViewportMatrix(), o = this.viewportStore.createViewportCoords(e), s = tt(a, o.x - i.x, o.y - i.y), c = t?.contentScale;
2238
+ }, a = this.viewportStore.getViewportMatrix(), o = this.viewportStore.createViewportCoords(e), s = Je(a, o.x - i.x, o.y - i.y), c = t?.contentScale;
2460
2239
  if (c !== void 0) {
2461
2240
  let e = 1 / c;
2462
- s = nt(s, e / a.scale, i.x, i.y);
2241
+ s = Ye(s, e / a.scale, i.x, i.y);
2463
2242
  }
2464
2243
  let l = t?.animationDuration ?? 0;
2465
2244
  l > 0 ? this.animateNavigation(a, s, l) : this.viewportStore.patchViewportMatrix(s);
2466
2245
  }
2467
2246
  focus(e) {
2468
- let t = et(e ?? {}, this.params);
2247
+ let t = qe(e ?? {}, this.params);
2469
2248
  this.params.focus.schedule(() => {
2470
2249
  this.navigate(t);
2471
2250
  });
@@ -2507,25 +2286,25 @@ var re = (e, t) => {
2507
2286
  };
2508
2287
  this.win.requestAnimationFrame(a);
2509
2288
  }
2510
- }, it = (e, t, n) => {
2289
+ }, Ze = (e, t, n) => {
2511
2290
  let r = new h();
2512
- return new d(new Ye(r), new $e(t), new Xe(r, new a(r, t, e), {
2291
+ return new d(new Ue(r), new Ke(t), new We(r, new a(r, t, e), {
2513
2292
  nodes: {
2514
2293
  centerFn: ie,
2515
2294
  priorityFn: () => 0
2516
2295
  },
2517
2296
  edges: {
2518
- shapeFactory: () => new R(),
2297
+ shapeFactory: () => new L(),
2519
2298
  priorityFn: () => 0
2520
2299
  },
2521
2300
  ports: { direction: 0 }
2522
- }), new rt(r, t, { focus: {
2301
+ }), new Xe(r, t, { focus: {
2523
2302
  contentPadding: 0,
2524
2303
  minContentScale: 0,
2525
- schedule: B,
2304
+ schedule: z,
2526
2305
  animationDuration: 0
2527
2306
  } }, n));
2528
- }, V = Symbol(), at = class e {
2307
+ }, B = Symbol(), Qe = class e {
2529
2308
  canvas;
2530
2309
  window;
2531
2310
  pointInsideVerifier;
@@ -2542,11 +2321,11 @@ var re = (e, t) => {
2542
2321
  onPortMouseDown = (e) => {
2543
2322
  let t = e;
2544
2323
  if (!this.params.mouseDownEventVerifier(t)) return;
2545
- let n = e.currentTarget, r = this.canvas.graph.findPortIdsByElement(n)[0];
2546
- this.params.onPointerDownVerifier(r, {
2324
+ let n = e.currentTarget, r = this.canvas.graph.findPortIdsByElement(n), i = this.params.grabbedPortIdResolver(r);
2325
+ i !== null && this.params.onPointerDownVerifier(i, {
2547
2326
  x: t.clientX,
2548
2327
  y: t.clientY
2549
- }) && (this.eventTagger.tag(e, V), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }));
2328
+ }) && (this.eventTagger.tag(e, B), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }));
2550
2329
  };
2551
2330
  onWindowMouseMove = (e) => {
2552
2331
  if (!this.pointInsideVerifier.verify(e.clientX, e.clientY)) {
@@ -2571,7 +2350,7 @@ var re = (e, t) => {
2571
2350
  this.params.onPointerDownVerifier(i, {
2572
2351
  x: n.clientX,
2573
2352
  y: n.clientY
2574
- }) && (this.eventTagger.tag(e, V), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }));
2353
+ }) && (this.eventTagger.tag(e, B), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }));
2575
2354
  };
2576
2355
  onWindowTouchMove = (e) => {
2577
2356
  let t = e.touches[0];
@@ -2619,16 +2398,16 @@ var re = (e, t) => {
2619
2398
  removeWindowTouchListeners() {
2620
2399
  this.window.removeEventListener("touchmove", this.onWindowTouchMove), this.window.removeEventListener("touchend", this.onWindowTouchFinish), this.window.removeEventListener("touchcancel", this.onWindowTouchFinish);
2621
2400
  }
2622
- }, H = Symbol(), ot = class {
2401
+ }, V = Symbol(), $e = class {
2623
2402
  has(e, t) {
2624
- let n = e[H];
2403
+ let n = e[V];
2625
2404
  return n !== void 0 && n.has(t);
2626
2405
  }
2627
2406
  tag(e, t) {
2628
- let n = e, r = n[H];
2629
- r === void 0 ? n[H] = /* @__PURE__ */ new Set([t]) : r.add(t);
2407
+ let n = e, r = n[V];
2408
+ r === void 0 ? n[V] = /* @__PURE__ */ new Set([t]) : r.add(t);
2630
2409
  }
2631
- }, U = Symbol(), W = class {
2410
+ }, H = Symbol(), U = class {
2632
2411
  window;
2633
2412
  pointInsideVerifier;
2634
2413
  onSelected;
@@ -2709,10 +2488,10 @@ var re = (e, t) => {
2709
2488
  let r = Math.sqrt(e * e + t * t);
2710
2489
  this.movedDistance += r, this.movedDistance > this.movementThreshold && n();
2711
2490
  }
2712
- }, st = (e, t) => ({
2491
+ }, W = (e, t) => ({
2713
2492
  from: e.isDirect ? e.staticPortId : t,
2714
2493
  to: e.isDirect ? t : e.staticPortId
2715
- }), ct = class {
2494
+ }), et = class {
2716
2495
  graph;
2717
2496
  connectionAllowedVerifier;
2718
2497
  constructor(e, t) {
@@ -2723,7 +2502,7 @@ var re = (e, t) => {
2723
2502
  return this.graph.getAllPortIds().forEach((i) => {
2724
2503
  let { element: a, direction: o, nodeId: s } = this.graph.getPort(i), { x: c, y: l } = this.graph.getNode(s);
2725
2504
  if (c === null || l === null) return;
2726
- let u = st(e, i);
2505
+ let u = W(e, i);
2727
2506
  if (!this.connectionAllowedVerifier(u)) return;
2728
2507
  let { top: d, left: f, width: p, height: m } = a.getBoundingClientRect(), h = {
2729
2508
  x: f + p / 2,
@@ -2732,7 +2511,7 @@ var re = (e, t) => {
2732
2511
  v < n && (n = v, t = o);
2733
2512
  }), t;
2734
2513
  }
2735
- }, lt = class {
2514
+ }, tt = class {
2736
2515
  direction;
2737
2516
  constructor(e) {
2738
2517
  this.direction = e;
@@ -2740,7 +2519,7 @@ var re = (e, t) => {
2740
2519
  resolve() {
2741
2520
  return this.direction;
2742
2521
  }
2743
- }, ut = class e {
2522
+ }, G = (e) => e.length > 0 ? e[0] : null, nt = class e {
2744
2523
  canvas;
2745
2524
  element;
2746
2525
  window;
@@ -2763,12 +2542,12 @@ var re = (e, t) => {
2763
2542
  t.removeEventListener("mousedown", this.onMouseDown), t.removeEventListener("touchstart", this.onTouchStart);
2764
2543
  };
2765
2544
  onMouseDown = (e) => {
2766
- if (this.eventTagger.has(e, V)) return;
2545
+ if (this.eventTagger.has(e, B)) return;
2767
2546
  let t = e;
2768
2547
  if (!this.params.mouseDownEventVerifier(t)) return;
2769
2548
  let n = e.currentTarget, r = this.graph.findNodeIdByElement(n), i = this.graph.getNode(r);
2770
2549
  if (!this.params.nodeDragVerifier(r)) return;
2771
- this.eventTagger.tag(e, V), this.params.onNodeDragStarted(r);
2550
+ this.eventTagger.tag(e, B), this.params.onNodeDragStarted(r);
2772
2551
  let a = this.calculateContentPoint({
2773
2552
  x: t.clientX,
2774
2553
  y: t.clientY
@@ -2780,17 +2559,12 @@ var re = (e, t) => {
2780
2559
  }, C(this.element, this.params.dragCursor), this.moveNodeOnTop(r), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 });
2781
2560
  };
2782
2561
  onTouchStart = (e) => {
2783
- if (this.eventTagger.has(e, V)) return;
2562
+ if (this.eventTagger.has(e, B)) return;
2784
2563
  let t = e;
2785
2564
  if (t.touches.length !== 1) return;
2786
2565
  let n = t.touches[0], r = e.currentTarget, i = this.canvas.graph.findNodeIdByElement(r), a = this.graph.getNode(i);
2787
- if (!this.params.nodeDragVerifier({
2788
- nodeId: i,
2789
- element: a.element,
2790
- x: a.x,
2791
- y: a.y
2792
- })) return;
2793
- this.eventTagger.tag(e, V);
2566
+ if (!this.params.nodeDragVerifier(i)) return;
2567
+ this.eventTagger.tag(e, B);
2794
2568
  let o = this.calculateContentPoint({
2795
2569
  x: n.clientX,
2796
2570
  y: n.clientY
@@ -2904,7 +2678,7 @@ var re = (e, t) => {
2904
2678
  let e = this.grabbedNodeState.nodeId;
2905
2679
  this.graph.hasNode(e) && this.params.onNodeDragFinished(e), this.grabbedNodeState = null;
2906
2680
  }
2907
- }, G = (e) => {
2681
+ }, K = (e) => {
2908
2682
  let t = [], n = e.touches.length;
2909
2683
  for (let r = 0; r < n; r++) t.push([e.touches[r].clientX, e.touches[r].clientY]);
2910
2684
  let r = t.reduce((e, t) => [e[0] + t[0], e[1] + t[1]], [0, 0]), i = [r[0] / n, r[1] / n], a = t.map((e) => [e[0] - i[0], e[1] - i[1]]).reduce((e, t) => e + Math.sqrt(t[0] * t[0] + t[1] * t[1]), 0);
@@ -2915,7 +2689,7 @@ var re = (e, t) => {
2915
2689
  touchesCnt: n,
2916
2690
  touches: t
2917
2691
  };
2918
- }, dt = class e {
2692
+ }, rt = class e {
2919
2693
  canvas;
2920
2694
  element;
2921
2695
  window;
@@ -2930,7 +2704,7 @@ var re = (e, t) => {
2930
2704
  this.removeMouseDragListeners(), this.removeTouchDragListeners();
2931
2705
  };
2932
2706
  onMouseDown = (e) => {
2933
- this.eventTagger.has(e, V) || this.params.mouseDownEventVerifier(e) && (C(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }), this.startRegisteredTransform());
2707
+ this.eventTagger.has(e, B) || this.params.mouseDownEventVerifier(e) && (C(this.element, this.params.shiftCursor), this.window.addEventListener("mousemove", this.onWindowMouseMove, { passive: !0 }), this.window.addEventListener("mouseup", this.onWindowMouseUp, { passive: !0 }), this.startRegisteredTransform());
2934
2708
  };
2935
2709
  onWindowMouseMove = (e) => {
2936
2710
  let t = this.pointInsideVerifier.verify(e.clientX, e.clientY);
@@ -2952,16 +2726,16 @@ var re = (e, t) => {
2952
2726
  }, this.params.scaleWheelFinishTimeout);
2953
2727
  };
2954
2728
  onTouchStart = (e) => {
2955
- if (!this.eventTagger.has(e, V)) {
2729
+ if (!this.eventTagger.has(e, B)) {
2956
2730
  if (this.prevTouches !== null) {
2957
- this.prevTouches = G(e);
2731
+ this.prevTouches = K(e);
2958
2732
  return;
2959
2733
  }
2960
- this.prevTouches = G(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }), this.startRegisteredTransform();
2734
+ this.prevTouches = K(e), this.window.addEventListener("touchmove", this.onWindowTouchMove, { passive: !0 }), this.window.addEventListener("touchend", this.onWindowTouchFinish, { passive: !0 }), this.window.addEventListener("touchcancel", this.onWindowTouchFinish, { passive: !0 }), this.startRegisteredTransform();
2961
2735
  }
2962
2736
  };
2963
2737
  onWindowTouchMove = (e) => {
2964
- let t = G(e);
2738
+ let t = K(e);
2965
2739
  if (!t.touches.every((e) => this.pointInsideVerifier.verify(e[0], e[1]))) {
2966
2740
  this.stopTouchDrag();
2967
2741
  return;
@@ -2977,7 +2751,7 @@ var re = (e, t) => {
2977
2751
  this.prevTouches = t;
2978
2752
  };
2979
2753
  onWindowTouchFinish = (e) => {
2980
- e.touches.length > 0 ? this.prevTouches = G(e) : this.stopTouchDrag();
2754
+ e.touches.length > 0 ? this.prevTouches = K(e) : this.stopTouchDrag();
2981
2755
  };
2982
2756
  preventWheelScaleListener = (e) => {
2983
2757
  e.preventDefault();
@@ -2991,20 +2765,24 @@ var re = (e, t) => {
2991
2765
  new e(t, n, r, i, a, o);
2992
2766
  }
2993
2767
  moveViewport(e, t) {
2994
- let n = this.viewport.getViewportMatrix(), r = tt(n, e, t), { width: i, height: a } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
2768
+ let n = this.viewport.getViewportMatrix(), r = Je(n, e, t), { width: i, height: a } = this.viewport.getDimensions(), o = this.params.transformPreprocessor({
2995
2769
  prevTransform: n,
2996
2770
  nextTransform: r,
2997
- canvasWidth: i,
2998
- canvasHeight: a
2771
+ viewport: {
2772
+ width: i,
2773
+ height: a
2774
+ }
2999
2775
  });
3000
2776
  this.performTransform(o);
3001
2777
  }
3002
2778
  scaleViewport(e, t, n) {
3003
- let r = this.canvas.viewport.getViewportMatrix(), i = nt(r, e, t, n), { width: a, height: o } = this.viewport.getDimensions(), s = this.params.transformPreprocessor({
2779
+ let r = this.canvas.viewport.getViewportMatrix(), i = Ye(r, e, t, n), { width: a, height: o } = this.viewport.getDimensions(), s = this.params.transformPreprocessor({
3004
2780
  prevTransform: r,
3005
2781
  nextTransform: i,
3006
- canvasWidth: a,
3007
- canvasHeight: o
2782
+ viewport: {
2783
+ width: a,
2784
+ height: o
2785
+ }
3008
2786
  });
3009
2787
  this.performTransform(s);
3010
2788
  }
@@ -3033,12 +2811,14 @@ var re = (e, t) => {
3033
2811
  let e = this.viewport.getViewportMatrix(), { width: t, height: n } = this.viewport.getDimensions(), r = this.params.transformPreprocessor({
3034
2812
  prevTransform: e,
3035
2813
  nextTransform: e,
3036
- canvasWidth: t,
3037
- canvasHeight: n
2814
+ viewport: {
2815
+ width: t,
2816
+ height: n
2817
+ }
3038
2818
  });
3039
2819
  this.params.onResizeTransformStarted(), this.canvas.patchViewportMatrix(r), this.params.onResizeTransformFinished();
3040
2820
  }
3041
- }, ft = class e {
2821
+ }, it = class e {
3042
2822
  canvas;
3043
2823
  element;
3044
2824
  window;
@@ -3091,7 +2871,7 @@ var re = (e, t) => {
3091
2871
  this.scheduleLoadAreaAroundViewport(), r.onTransformFinished();
3092
2872
  }
3093
2873
  };
3094
- dt.configure(e, this.element, this.window, this.pointInsideVerifier, o, c), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
2874
+ rt.configure(e, this.element, this.window, this.pointInsideVerifier, o, c), this.trigger.subscribe(this.updateLoadedArea), this.canvas.viewport.onAfterUpdated.subscribe(this.onAfterViewportUpdated);
3095
2875
  }
3096
2876
  static configure(t, n, r, i, a, o, s, c) {
3097
2877
  new e(t, n, r, i, a, o, s, c);
@@ -3116,21 +2896,21 @@ var re = (e, t) => {
3116
2896
  height: u
3117
2897
  });
3118
2898
  }
3119
- }, pt = () => {
2899
+ }, at = () => {
3120
2900
  let e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
3121
2901
  return e.style.position = "absolute", e.style.inset = "0", e;
3122
- }, mt = () => {
2902
+ }, ot = () => {
3123
2903
  let e = document.createElementNS("http://www.w3.org/2000/svg", "rect");
3124
2904
  return e.setAttribute("fill", "url(#pattern)"), e;
3125
- }, ht = () => {
2905
+ }, st = () => {
3126
2906
  let e = document.createElementNS("http://www.w3.org/2000/svg", "pattern");
3127
2907
  return e.setAttribute("id", "pattern"), e;
3128
- }, gt = class e {
2908
+ }, ct = class e {
3129
2909
  canvas;
3130
2910
  backgroundHost;
3131
- svg = pt();
3132
- patternRenderingRectangle = mt();
3133
- pattern = ht();
2911
+ svg = at();
2912
+ patternRenderingRectangle = ot();
2913
+ pattern = st();
3134
2914
  patternContent;
3135
2915
  tileWidth;
3136
2916
  tileHeight;
@@ -3165,7 +2945,7 @@ var re = (e, t) => {
3165
2945
  this.pattern.setAttribute("width", `${n}`), this.pattern.setAttribute("height", `${r}`);
3166
2946
  }
3167
2947
  }
3168
- }, _t = class e {
2948
+ }, lt = class e {
3169
2949
  canvas;
3170
2950
  overlayLayer;
3171
2951
  viewportStore;
@@ -3179,7 +2959,7 @@ var re = (e, t) => {
3179
2959
  this.params.onAfterEdgeCreated(e);
3180
2960
  };
3181
2961
  constructor(e, t, n, r, i, a, o) {
3182
- this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = it(this.overlayLayer, this.viewportStore, this.window);
2962
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = Ze(this.overlayLayer, this.viewportStore, this.window);
3183
2963
  let s = {
3184
2964
  mouseDownEventVerifier: this.params.mouseDownEventVerifier,
3185
2965
  mouseUpEventVerifier: this.params.mouseUpEventVerifier,
@@ -3196,9 +2976,10 @@ var re = (e, t) => {
3196
2976
  onPointerOutside: () => {
3197
2977
  let e = this.edgeInProgress;
3198
2978
  this.resetDragState(), this.params.onEdgeCreationInterrupted(e);
3199
- }
2979
+ },
2980
+ grabbedPortIdResolver: this.params.grabbedPortIdResolver
3200
2981
  };
3201
- at.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
2982
+ Qe.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
3202
2983
  }
3203
2984
  static configure(t, n, r, i, a, o, s) {
3204
2985
  new e(t, n, r, i, a, o, s);
@@ -3237,12 +3018,12 @@ var re = (e, t) => {
3237
3018
  this.edgeInProgress = null, this.overlayCanvas.clear();
3238
3019
  }
3239
3020
  tryCreateConnection(e) {
3240
- let t = re(this.canvas.graph, e);
3021
+ let t = re(this.canvas.graph, e, this.params.releasedPortIdResolver);
3241
3022
  if (t === null) {
3242
3023
  this.params.onEdgeCreationInterrupted(this.edgeInProgress);
3243
3024
  return;
3244
3025
  }
3245
- let n = st(this.edgeInProgress, t), r = this.params.connectionAllowedVerifier(n), i = this.params.connectionPreprocessor({
3026
+ let n = W(this.edgeInProgress, t), r = this.params.connectionAllowedVerifier(n), i = this.params.connectionPreprocessor({
3246
3027
  from: n.from,
3247
3028
  to: n.to
3248
3029
  });
@@ -3261,7 +3042,7 @@ var re = (e, t) => {
3261
3042
  y: n.y
3262
3043
  }).updatePort(T.DraggingNodeId, { direction: r });
3263
3044
  }
3264
- }, vt = class e {
3045
+ }, ut = class e {
3265
3046
  canvas;
3266
3047
  overlayLayer;
3267
3048
  viewportStore;
@@ -3276,7 +3057,7 @@ var re = (e, t) => {
3276
3057
  this.params.onAfterEdgeReattached(e);
3277
3058
  };
3278
3059
  constructor(e, t, n, r, i, a, o) {
3279
- this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = it(this.overlayLayer, this.viewportStore, this.window);
3060
+ this.canvas = e, this.overlayLayer = t, this.viewportStore = n, this.window = r, this.pointInsideVerifier = i, this.eventTagger = a, this.params = o, this.overlayCanvas = Ze(this.overlayLayer, this.viewportStore, this.window);
3280
3061
  let s = {
3281
3062
  mouseDownEventVerifier: this.params.mouseDownEventVerifier,
3282
3063
  mouseUpEventVerifier: this.params.mouseUpEventVerifier,
@@ -3296,9 +3077,10 @@ var re = (e, t) => {
3296
3077
  shape: e.shape,
3297
3078
  priority: e.priority
3298
3079
  });
3299
- }
3080
+ },
3081
+ grabbedPortIdResolver: this.params.grabbedPortIdResolver
3300
3082
  };
3301
- at.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
3083
+ Qe.configure(this.canvas, this.window, this.pointInsideVerifier, this.eventTagger, s);
3302
3084
  }
3303
3085
  static configure(t, n, r, i, a, o, s) {
3304
3086
  new e(t, n, r, i, a, o, s);
@@ -3366,7 +3148,7 @@ var re = (e, t) => {
3366
3148
  }).updatePort(T.DraggingNodeId, { direction: i });
3367
3149
  }
3368
3150
  tryCreateConnection(e) {
3369
- let t = re(this.canvas.graph, e);
3151
+ let t = re(this.canvas.graph, e, this.params.releasedPortIdResolver);
3370
3152
  if (this.overlayCanvas.removeEdge(T.EdgeId), t === null) {
3371
3153
  let e = this.draggingEdgePayload;
3372
3154
  this.params.onEdgeReattachInterrupted({
@@ -3378,7 +3160,7 @@ var re = (e, t) => {
3378
3160
  });
3379
3161
  return;
3380
3162
  }
3381
- let { from: n, to: r } = st(this.edgeInProgress, t), i = this.draggingEdgePayload, a = {
3163
+ let { from: n, to: r } = W(this.edgeInProgress, t), i = this.draggingEdgePayload, a = {
3382
3164
  id: i.id,
3383
3165
  from: n,
3384
3166
  to: r,
@@ -3400,7 +3182,7 @@ var re = (e, t) => {
3400
3182
  });
3401
3183
  }
3402
3184
  }
3403
- }, yt = class e {
3185
+ }, dt = class e {
3404
3186
  applier;
3405
3187
  trigger;
3406
3188
  constructor(e, t) {
@@ -3411,7 +3193,7 @@ var re = (e, t) => {
3411
3193
  static configure(t, n) {
3412
3194
  new e(t, n);
3413
3195
  }
3414
- }, bt = class e {
3196
+ }, ft = class e {
3415
3197
  graph;
3416
3198
  applier;
3417
3199
  defererFn;
@@ -3436,7 +3218,7 @@ var re = (e, t) => {
3436
3218
  scheduleApply() {
3437
3219
  this.applyScheduled || (this.applyScheduled = !0, this.defererFn(this.apply));
3438
3220
  }
3439
- }, xt = class {
3221
+ }, pt = class {
3440
3222
  canvas;
3441
3223
  layoutAlgorithm;
3442
3224
  params;
@@ -3452,23 +3234,23 @@ var re = (e, t) => {
3452
3234
  this.params.staticNodeResolver(t) || this.canvas.updateNode(t, e);
3453
3235
  }), this.params.onAfterApplied();
3454
3236
  }
3455
- }, St = class {
3237
+ }, mt = class {
3456
3238
  static configure(e, t) {
3457
- let n = t.applyOn, r = new xt(e, t.algorithm, {
3239
+ let n = t.applyOn, r = new pt(e, t.algorithm, {
3458
3240
  staticNodeResolver: t.staticNodeResolver,
3459
3241
  onBeforeApplied: t.onBeforeApplied,
3460
3242
  onAfterApplied: t.onAfterApplied
3461
3243
  });
3462
3244
  switch (n.type) {
3463
3245
  case "trigger":
3464
- yt.configure(r, n.trigger);
3246
+ dt.configure(r, n.trigger);
3465
3247
  break;
3466
3248
  case "topologyChangeSchedule":
3467
- bt.configure(e.graph, r, n.schedule);
3249
+ ft.configure(e.graph, r, n.schedule);
3468
3250
  break;
3469
3251
  }
3470
3252
  }
3471
- }, Ct = class {
3253
+ }, ht = class {
3472
3254
  win;
3473
3255
  callback;
3474
3256
  previousTimeStamp = void 0;
@@ -3483,7 +3265,7 @@ var re = (e, t) => {
3483
3265
  constructor(e, t) {
3484
3266
  this.win = e, this.callback = t, this.win.requestAnimationFrame(this.step);
3485
3267
  }
3486
- }, wt = class {
3268
+ }, gt = class {
3487
3269
  canvas;
3488
3270
  layoutAlgorithm;
3489
3271
  params;
@@ -3500,30 +3282,29 @@ var re = (e, t) => {
3500
3282
  this.params.staticNodeResolver(t) || this.canvas.updateNode(t, e);
3501
3283
  }), this.params.onAfterApplied();
3502
3284
  }
3503
- }, Tt = class e {
3504
- win;
3285
+ }, _t = class e {
3505
3286
  applier;
3506
3287
  step = (e) => {
3507
3288
  this.applier.apply(e);
3508
3289
  };
3509
3290
  constructor(e, t, n) {
3510
- this.win = n, this.applier = new wt(e, t.algorithm, {
3291
+ this.applier = new gt(e, t.algorithm, {
3511
3292
  staticNodeResolver: t.staticNodeResolver,
3512
3293
  onBeforeApplied: t.onBeforeApplied,
3513
3294
  onAfterApplied: t.onAfterApplied
3514
- }), new Ct(this.win, this.step);
3295
+ }), new ht(n, this.step);
3515
3296
  }
3516
3297
  static configure(t, n, r) {
3517
3298
  new e(t, n, r);
3518
3299
  }
3519
- }, Et = class e {
3300
+ }, vt = class e {
3520
3301
  canvas;
3521
3302
  window;
3522
3303
  pointInsideVerifier;
3523
3304
  eventTagger;
3524
3305
  configurator;
3525
3306
  onNodeSelected;
3526
- eventHandledTag = U;
3307
+ eventHandledTag = H;
3527
3308
  onAfterNodeAdded = (e) => {
3528
3309
  let { element: t } = this.canvas.graph.getNode(e);
3529
3310
  this.configurator.enable(t);
@@ -3539,7 +3320,7 @@ var re = (e, t) => {
3539
3320
  });
3540
3321
  };
3541
3322
  constructor(e, t, n, r, i) {
3542
- this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onNodeSelected = i.onNodeSelected, this.configurator = new W(this.window, this.pointInsideVerifier, {
3323
+ this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onNodeSelected = i.onNodeSelected, this.configurator = new U(this.window, this.pointInsideVerifier, {
3543
3324
  onSelected: (e, t) => {
3544
3325
  let n = this.canvas.graph.findNodeIdByElement(e);
3545
3326
  this.eventTagger.tag(t, this.eventHandledTag), this.onNodeSelected(n);
@@ -3552,13 +3333,13 @@ var re = (e, t) => {
3552
3333
  static configure(t, n, r, i, a) {
3553
3334
  new e(t, n, r, i, a);
3554
3335
  }
3555
- }, Dt = class e {
3336
+ }, yt = class e {
3556
3337
  canvas;
3557
3338
  window;
3558
3339
  pointInsideVerifier;
3559
3340
  eventTagger;
3560
3341
  configurator;
3561
- eventHandledTag = U;
3342
+ eventHandledTag = H;
3562
3343
  onEdgeSelected;
3563
3344
  onAfterEdgeAdded = (e) => {
3564
3345
  let { shape: t } = this.canvas.graph.getEdge(e);
@@ -3575,7 +3356,7 @@ var re = (e, t) => {
3575
3356
  });
3576
3357
  };
3577
3358
  constructor(e, t, n, r, i) {
3578
- this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onEdgeSelected = i.onEdgeSelected, this.configurator = new W(this.window, this.pointInsideVerifier, {
3359
+ this.canvas = e, this.window = t, this.pointInsideVerifier = n, this.eventTagger = r, this.onEdgeSelected = i.onEdgeSelected, this.configurator = new U(this.window, this.pointInsideVerifier, {
3579
3360
  onSelected: (e, t) => {
3580
3361
  let n = this.canvas.graph.findEdgeIdByElement(e);
3581
3362
  this.eventTagger.tag(t, this.eventHandledTag), this.onEdgeSelected(n);
@@ -3588,7 +3369,7 @@ var re = (e, t) => {
3588
3369
  static configure(t, n, r, i, a) {
3589
3370
  new e(t, n, r, i, a);
3590
3371
  }
3591
- }, Ot = class e {
3372
+ }, bt = class e {
3592
3373
  canvas;
3593
3374
  element;
3594
3375
  window;
@@ -3596,9 +3377,9 @@ var re = (e, t) => {
3596
3377
  eventTagger;
3597
3378
  configurator;
3598
3379
  onCanvasSelected;
3599
- eventHandledTag = U;
3380
+ eventHandledTag = H;
3600
3381
  constructor(e, t, n, r, i, a) {
3601
- this.canvas = e, this.element = t, this.window = n, this.pointInsideVerifier = r, this.eventTagger = i, this.onCanvasSelected = a.onCanvasSelected, this.configurator = new W(this.window, this.pointInsideVerifier, {
3382
+ this.canvas = e, this.element = t, this.window = n, this.pointInsideVerifier = r, this.eventTagger = i, this.onCanvasSelected = a.onCanvasSelected, this.configurator = new U(this.window, this.pointInsideVerifier, {
3602
3383
  onSelected: (e, t) => {
3603
3384
  this.eventTagger.has(t, this.eventHandledTag) || this.onCanvasSelected();
3604
3385
  },
@@ -3612,29 +3393,29 @@ var re = (e, t) => {
3612
3393
  static configure(t, n, r, i, a, o) {
3613
3394
  new e(t, n, r, i, a, o);
3614
3395
  }
3615
- }, kt = () => {
3396
+ }, xt = () => {
3616
3397
  let e = document.createElement("div");
3617
3398
  return e.style.width = "100%", e.style.height = "100%", e.style.position = "relative", e;
3618
- }, At = () => {
3399
+ }, St = () => {
3619
3400
  let e = document.createElement("div");
3620
3401
  return e.style.position = "absolute", e.style.inset = "0", e;
3621
- }, jt = () => {
3622
- let e = At();
3402
+ }, Ct = () => {
3403
+ let e = St();
3623
3404
  return e.style.pointerEvents = "none", e;
3624
- }, Mt = class {
3405
+ }, wt = class {
3625
3406
  element;
3626
- background = At();
3627
- main = At();
3628
- overlayConnectablePorts = jt();
3629
- overlayDraggableEdges = jt();
3630
- host = kt();
3407
+ background = St();
3408
+ main = St();
3409
+ overlayConnectablePorts = Ct();
3410
+ overlayDraggableEdges = Ct();
3411
+ host = xt();
3631
3412
  constructor(e) {
3632
3413
  this.element = e, this.element.appendChild(this.host), this.host.appendChild(this.background), this.host.appendChild(this.main), this.host.appendChild(this.overlayConnectablePorts), this.host.appendChild(this.overlayDraggableEdges);
3633
3414
  }
3634
3415
  destroy() {
3635
3416
  this.host.removeChild(this.background), this.host.removeChild(this.main), this.host.removeChild(this.overlayConnectablePorts), this.host.removeChild(this.overlayDraggableEdges), this.element.removeChild(this.host);
3636
3417
  }
3637
- }, K = Object.freeze({
3418
+ }, q = Object.freeze({
3638
3419
  seed: "HTMLGraph is awesome",
3639
3420
  maxTimeDeltaSec: .01,
3640
3421
  nodeCharge: 1e5,
@@ -3648,14 +3429,14 @@ var re = (e, t) => {
3648
3429
  nodeForceCoefficient: 1,
3649
3430
  barnesHutAreaRadiusThreshold: .01,
3650
3431
  barnesHutTheta: 1
3651
- }), q = Object.freeze({
3432
+ }), J = Object.freeze({
3652
3433
  mouseDownEventVerifier: (e) => e.button === 0,
3653
3434
  mouseUpEventVerifier: (e) => e.button === 0,
3654
3435
  movementThreshold: 10
3655
- }), J = () => {}, Nt = (e, t, n) => e === "closest-connectable-port" || e === "nearest-connectable-port" ? new ct(t, n) : new lt(e), Y = (e) => {
3436
+ }), Y = () => {}, Tt = (e, t, n) => e === "nearest-connectable-port" ? new et(t, n) : typeof e == "number" ? new tt(e) : new tt(void 0), Et = (e) => {
3656
3437
  if (typeof e == "function") return e;
3657
3438
  switch (e.type) {
3658
- case "straight": return () => new Pe({
3439
+ case "straight": return () => new je({
3659
3440
  color: e.color,
3660
3441
  width: e.width,
3661
3442
  arrowLength: e.arrowLength,
@@ -3668,7 +3449,7 @@ var re = (e, t) => {
3668
3449
  detourDistance: e.detourDistance,
3669
3450
  detourDirection: e.detourDirection
3670
3451
  });
3671
- case "horizontal": return () => new Ne({
3452
+ case "orthogonal": return () => new Ne({
3672
3453
  color: e.color,
3673
3454
  width: e.width,
3674
3455
  arrowLength: e.arrowLength,
@@ -3680,31 +3461,7 @@ var re = (e, t) => {
3680
3461
  roundness: e.roundness,
3681
3462
  detourDistance: e.detourDistance
3682
3463
  });
3683
- case "vertical": return () => new Le({
3684
- color: e.color,
3685
- width: e.width,
3686
- arrowLength: e.arrowLength,
3687
- arrowOffset: e.arrowOffset,
3688
- arrowRenderer: e.arrowRenderer,
3689
- hasSourceArrow: e.hasSourceArrow,
3690
- hasTargetArrow: e.hasTargetArrow,
3691
- cycleSquareSide: e.cycleSquareSide,
3692
- roundness: e.roundness,
3693
- detourDistance: e.detourDistance
3694
- });
3695
- case "orthogonal": return () => new ze({
3696
- color: e.color,
3697
- width: e.width,
3698
- arrowLength: e.arrowLength,
3699
- arrowOffset: e.arrowOffset,
3700
- arrowRenderer: e.arrowRenderer,
3701
- hasSourceArrow: e.hasSourceArrow,
3702
- hasTargetArrow: e.hasTargetArrow,
3703
- cycleSquareSide: e.cycleSquareSide,
3704
- roundness: e.roundness,
3705
- detourDistance: e.detourDistance
3706
- });
3707
- case "direct": return () => new R({
3464
+ case "direct": return () => new L({
3708
3465
  color: e.color,
3709
3466
  width: e.width,
3710
3467
  arrowLength: e.arrowLength,
@@ -3714,7 +3471,7 @@ var re = (e, t) => {
3714
3471
  sourceOffset: e.sourceOffset,
3715
3472
  targetOffset: e.targetOffset
3716
3473
  });
3717
- default: return () => new je({
3474
+ default: return () => new Ae({
3718
3475
  color: e.color,
3719
3476
  width: e.width,
3720
3477
  arrowLength: e.arrowLength,
@@ -3728,7 +3485,7 @@ var re = (e, t) => {
3728
3485
  detourDirection: e.detourDirection
3729
3486
  });
3730
3487
  }
3731
- }, Pt = (e) => {
3488
+ }, Dt = (e) => {
3732
3489
  let t = e.nodeDragVerifier ?? (() => !0), n = e.moveOnTop !== !1, r = e.moveEdgesOnTop !== !1 && n, i = e.mouse?.dragCursor, a = i === void 0 ? "grab" : i, o = e.mouse?.mouseDownEventVerifier, s = o === void 0 ? (e) => e.button === 0 : o, c = e.mouse?.mouseUpEventVerifier, l = c === void 0 ? (e) => e.button === 0 : c;
3733
3490
  return {
3734
3491
  moveOnTop: n,
@@ -3737,26 +3494,26 @@ var re = (e, t) => {
3737
3494
  gridSize: e.gridSize ?? null,
3738
3495
  mouseDownEventVerifier: s,
3739
3496
  mouseUpEventVerifier: l,
3740
- onNodeDragStarted: e.events?.onNodeDragStarted ?? J,
3741
- onNodeDrag: e.events?.onNodeDrag ?? J,
3497
+ onNodeDragStarted: e.events?.onNodeDragStarted ?? Y,
3498
+ onNodeDrag: e.events?.onNodeDrag ?? Y,
3742
3499
  nodeDragVerifier: t,
3743
- onNodeDragFinished: e.events?.onNodeDragFinished ?? J
3500
+ onNodeDragFinished: e.events?.onNodeDragFinished ?? Y
3744
3501
  };
3745
- }, Ft = (e) => {
3502
+ }, Ot = (e) => {
3746
3503
  let t = e.minX === null ? -Infinity : e.minX, n = e.maxX === null ? Infinity : e.maxX, r = e.minY === null ? -Infinity : e.minY, i = e.maxY === null ? Infinity : e.maxY;
3747
3504
  return (e) => {
3748
3505
  let a = e.nextTransform.x, o = e.nextTransform.y;
3749
3506
  a < t && a < e.prevTransform.x && (a = Math.min(e.prevTransform.x, t));
3750
- let s = n - e.canvasWidth * e.prevTransform.scale;
3507
+ let s = n - e.viewport.width * e.prevTransform.scale;
3751
3508
  a > s && a > e.prevTransform.x && (a = Math.max(e.prevTransform.x, s)), o < r && o < e.prevTransform.y && (o = Math.min(e.prevTransform.y, r));
3752
- let c = i - e.canvasHeight * e.prevTransform.scale;
3509
+ let c = i - e.viewport.height * e.prevTransform.scale;
3753
3510
  return o > c && o > e.prevTransform.y && (o = Math.max(e.prevTransform.y, c)), {
3754
3511
  scale: e.nextTransform.scale,
3755
3512
  x: a,
3756
3513
  y: o
3757
3514
  };
3758
3515
  };
3759
- }, It = (e) => {
3516
+ }, kt = (e) => {
3760
3517
  let t = e.maxContentScale, n = e.minContentScale, r = t === null ? 0 : 1 / t, i = n === null ? Infinity : 1 / n;
3761
3518
  return (e) => {
3762
3519
  let t = e.prevTransform, n = e.nextTransform, a = n.scale, o = n.x, s = n.y;
@@ -3776,53 +3533,52 @@ var re = (e, t) => {
3776
3533
  y: s
3777
3534
  };
3778
3535
  };
3779
- }, Lt = (e) => (t) => e.reduce((e, n) => n({
3536
+ }, At = (e) => (t) => e.reduce((e, n) => n({
3780
3537
  prevTransform: t.prevTransform,
3781
3538
  nextTransform: e,
3782
- canvasWidth: t.canvasWidth,
3783
- canvasHeight: t.canvasHeight
3784
- }), t.nextTransform), Rt = (e) => {
3539
+ viewport: t.viewport
3540
+ }), t.nextTransform), jt = (e) => {
3785
3541
  if (typeof e == "function") return e;
3786
3542
  switch (e.type) {
3787
- case "scale-limit": return It({
3543
+ case "scale-limit": return kt({
3788
3544
  minContentScale: e.minContentScale ?? 0,
3789
3545
  maxContentScale: e.maxContentScale ?? Infinity
3790
3546
  });
3791
- case "shift-limit": return Ft({
3547
+ case "shift-limit": return Ot({
3792
3548
  minX: e.minX ?? -Infinity,
3793
3549
  maxX: e.maxX ?? Infinity,
3794
3550
  minY: e.minY ?? -Infinity,
3795
3551
  maxY: e.maxY ?? Infinity
3796
3552
  });
3797
3553
  }
3798
- }, zt = (e) => {
3554
+ }, Mt = (e) => {
3799
3555
  let t = e?.scale?.mouseWheelSensitivity, n = t === void 0 ? 1.2 : t, r = e?.transformPreprocessor, i;
3800
- i = r === void 0 ? (e) => e.nextTransform : Array.isArray(r) ? Lt(r.map((e) => Rt(e))) : Rt(r);
3801
- let a = e?.shift?.cursor === void 0 ? "grab" : e.shift.cursor, o = e?.shift?.mouseDownEventVerifier, s = o === void 0 ? (e) => e.button === 0 : o, c = e?.shift?.mouseUpEventVerifier, l = c === void 0 ? (e) => e.button === 0 : c, u = e?.scale?.mouseWheelEventVerifier, d = u === void 0 ? () => !0 : u;
3556
+ i = r === void 0 ? (e) => e.nextTransform : Array.isArray(r) ? At(r.map((e) => jt(e))) : jt(r);
3557
+ let a = e?.pan?.cursor === void 0 ? "grab" : e.pan.cursor, o = e?.pan?.mouseDownEventVerifier, s = o === void 0 ? (e) => e.button === 0 : o, c = e?.pan?.mouseUpEventVerifier, l = c === void 0 ? (e) => e.button === 0 : c, u = e?.scale?.mouseWheelEventVerifier, d = u === void 0 ? () => !0 : u;
3802
3558
  return {
3803
3559
  wheelSensitivity: n,
3804
- onTransformStarted: e?.events?.onTransformStarted ?? J,
3805
- onTransformFinished: e?.events?.onTransformFinished ?? J,
3806
- onBeforeTransformChange: e?.events?.onBeforeTransformChange ?? J,
3807
- onTransformChange: e?.events?.onTransformChange ?? J,
3560
+ onTransformStarted: e?.events?.onTransformStarted ?? Y,
3561
+ onTransformFinished: e?.events?.onTransformFinished ?? Y,
3562
+ onBeforeTransformChange: e?.events?.onBeforeTransformChange ?? Y,
3563
+ onTransformChange: e?.events?.onTransformChange ?? Y,
3808
3564
  transformPreprocessor: i,
3809
3565
  shiftCursor: a,
3810
3566
  mouseDownEventVerifier: s,
3811
3567
  mouseUpEventVerifier: l,
3812
3568
  mouseWheelEventVerifier: d,
3813
3569
  scaleWheelFinishTimeout: e?.scale?.wheelFinishTimeout ?? 500,
3814
- onResizeTransformStarted: e?.events?.onResizeTransformStarted ?? J,
3815
- onResizeTransformFinished: e?.events?.onResizeTransformFinished ?? J
3570
+ onResizeTransformStarted: e?.events?.onResizeTransformStarted ?? Y,
3571
+ onResizeTransformFinished: e?.events?.onResizeTransformFinished ?? Y
3816
3572
  };
3817
- }, Bt = (e, t) => {
3573
+ }, Nt = (e, t) => {
3818
3574
  let n = document.createElementNS("http://www.w3.org/2000/svg", "circle");
3819
3575
  return n.setAttribute("cx", "0"), n.setAttribute("cy", "0"), n.setAttribute("r", `${e}`), n.setAttribute("fill", `${t}`), n;
3820
- }, Vt = (e) => e instanceof SVGElement ? e : Bt(e?.radius ?? 1.5, e?.color ?? "#d8d8d8"), Ht = (e) => {
3576
+ }, Pt = (e) => e instanceof SVGElement ? e : Nt(e?.radius ?? 1.5, e?.color ?? "#d8d8d8"), Ft = (e) => {
3821
3577
  let t = e.tileDimensions;
3822
3578
  return {
3823
3579
  tileWidth: t?.width ?? 25,
3824
3580
  tileHeight: t?.height ?? 25,
3825
- renderer: Vt(e.renderer ?? {}),
3581
+ renderer: Pt(e.renderer ?? {}),
3826
3582
  maxViewportScale: e.maxViewportScale ?? 10
3827
3583
  };
3828
3584
  }, X = Object.freeze({
@@ -3830,26 +3586,28 @@ var re = (e, t) => {
3830
3586
  connectionPreprocessor: (e) => e,
3831
3587
  connectionAllowedVerifier: () => !0,
3832
3588
  mouseEventVerifier: (e) => e.button === 0
3833
- }), Ut = (e, t, n) => {
3589
+ }), It = (e, t, n) => {
3834
3590
  let r = e.connectionAllowedVerifier ?? X.connectionAllowedVerifier;
3835
3591
  return {
3836
3592
  connectionTypeResolver: e.connectionTypeResolver ?? X.connectionTypeResolver,
3837
3593
  connectionAllowedVerifier: r,
3838
- draggingPortDirectionResolver: Nt(e.dragPortDirection, n, r),
3839
- edgeShapeFactory: e.edgeShape === void 0 ? t : Y(e.edgeShape),
3594
+ draggingPortDirectionResolver: Tt(e.dragPortDirection, n, r),
3595
+ edgeShapeFactory: e.edgeShape === void 0 ? t : Et(e.edgeShape),
3840
3596
  connectionPreprocessor: e.connectionPreprocessor ?? X.connectionPreprocessor,
3841
3597
  mouseDownEventVerifier: e.mouseDownEventVerifier ?? X.mouseEventVerifier,
3842
3598
  mouseUpEventVerifier: e.mouseUpEventVerifier ?? X.mouseEventVerifier,
3843
- onAfterEdgeCreated: e.events?.onAfterEdgeCreated ?? J,
3844
- onEdgeCreationInterrupted: e.events?.onEdgeCreationInterrupted ?? J,
3845
- onEdgeCreationPrevented: e.events?.onEdgeCreationPrevented ?? J
3599
+ onAfterEdgeCreated: e.events?.onAfterEdgeCreated ?? Y,
3600
+ onEdgeCreationInterrupted: e.events?.onEdgeCreationInterrupted ?? Y,
3601
+ onEdgeCreationPrevented: e.events?.onEdgeCreationPrevented ?? Y,
3602
+ grabbedPortIdResolver: e.grabbedPortIdResolver ?? G,
3603
+ releasedPortIdResolver: e.releasedPortIdResolver ?? G
3846
3604
  };
3847
3605
  }, Z = Object.freeze({
3848
3606
  connectionAllowedVerifier: () => !0,
3849
3607
  connectionPreprocessor: (e) => e,
3850
- mouseDownEventVerifier: (e) => e.button === 0 && e.ctrlKey,
3608
+ mouseDownEventVerifier: (e) => e.button === 0,
3851
3609
  mouseUpEventVerifier: (e) => e.button === 0
3852
- }), Wt = (e, t) => {
3610
+ }), Lt = (e, t) => {
3853
3611
  let n = (e) => {
3854
3612
  let n = t.getPortAdjacentEdgeIds(e);
3855
3613
  return n.length > 0 ? n[n.length - 1] : null;
@@ -3860,21 +3618,23 @@ var re = (e, t) => {
3860
3618
  mouseDownEventVerifier: e.mouseDownEventVerifier ?? Z.mouseDownEventVerifier,
3861
3619
  mouseUpEventVerifier: e.mouseUpEventVerifier ?? Z.mouseUpEventVerifier,
3862
3620
  draggingEdgeResolver: e.draggingEdgeResolver ?? n,
3863
- draggingEdgeShapeFactory: e.draggingEdgeShape === void 0 ? null : Y(e.draggingEdgeShape),
3864
- onAfterEdgeReattached: e.events?.onAfterEdgeReattached ?? J,
3865
- onEdgeReattachInterrupted: e.events?.onEdgeReattachInterrupted ?? J,
3866
- onEdgeReattachPrevented: e.events?.onEdgeReattachPrevented ?? J,
3867
- draggingPortDirectionResolver: Nt(e.dragPortDirection, t, r)
3621
+ draggingEdgeShapeFactory: e.draggingEdgeShape === void 0 ? null : Et(e.draggingEdgeShape),
3622
+ onAfterEdgeReattached: e.events?.onAfterEdgeReattached ?? Y,
3623
+ onEdgeReattachInterrupted: e.events?.onEdgeReattachInterrupted ?? Y,
3624
+ onEdgeReattachPrevented: e.events?.onEdgeReattachPrevented ?? Y,
3625
+ draggingPortDirectionResolver: Tt(e.dragPortDirection, t, r),
3626
+ grabbedPortIdResolver: e.grabbedPortIdResolver ?? G,
3627
+ releasedPortIdResolver: e.releasedPortIdResolver ?? G
3868
3628
  };
3869
- }, Gt = (e) => ({
3629
+ }, Rt = (e) => ({
3870
3630
  nodeVerticalRadius: e.nodeContainingRadius.vertical,
3871
3631
  nodeHorizontalRadius: e.nodeContainingRadius.horizontal
3872
- }), Kt = (e) => ({
3873
- onAfterNodeDetached: e?.events?.onAfterNodeDetached ?? J,
3874
- onBeforeNodeAttached: e?.events?.onBeforeNodeAttached ?? J
3875
- }), qt = class extends Error {
3632
+ }), zt = (e) => ({
3633
+ onAfterNodeDetached: e?.events?.onAfterNodeDetached ?? Y,
3634
+ onBeforeNodeAttached: e?.events?.onBeforeNodeAttached ?? Y
3635
+ }), Bt = class extends Error {
3876
3636
  name = "CanvasBuilderError";
3877
- }, Jt = class {
3637
+ }, Vt = class {
3878
3638
  graph;
3879
3639
  currentCoords;
3880
3640
  dt;
@@ -3909,7 +3669,7 @@ var re = (e, t) => {
3909
3669
  d.x += l, d.y += u, f.x -= l, f.y -= u;
3910
3670
  });
3911
3671
  }
3912
- }, Yt = class {
3672
+ }, Ht = class {
3913
3673
  rand;
3914
3674
  PI2 = 2 * Math.PI;
3915
3675
  constructor(e) {
@@ -3932,11 +3692,11 @@ var re = (e, t) => {
3932
3692
  d: a
3933
3693
  };
3934
3694
  }
3935
- }, Xt = (e) => {
3695
+ }, Ut = (e) => {
3936
3696
  if (e.distance === 0) return e.maxForce;
3937
3697
  let t = e.coefficient * (e.sourceCharge * e.targetCharge / (e.distance * e.distance));
3938
3698
  return Math.min(t, e.maxForce);
3939
- }, Zt = class {
3699
+ }, Wt = class {
3940
3700
  nodeCharge;
3941
3701
  distanceVectorGenerator;
3942
3702
  maxForce;
@@ -3948,7 +3708,7 @@ var re = (e, t) => {
3948
3708
  for (let i = 0; i < r; i++) {
3949
3709
  let a = n[i];
3950
3710
  for (let o = i + 1; o < r; o++) {
3951
- let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l = Xt({
3711
+ let r = n[o], i = e.get(a), s = e.get(r), c = this.distanceVectorGenerator.create(i, s), l = Ut({
3952
3712
  coefficient: 1,
3953
3713
  sourceCharge: this.nodeCharge,
3954
3714
  targetCharge: this.nodeCharge,
@@ -3959,7 +3719,7 @@ var re = (e, t) => {
3959
3719
  }
3960
3720
  }
3961
3721
  }
3962
- }, Qt = (e) => {
3722
+ }, Gt = (e) => {
3963
3723
  if (e.size === 0) return {
3964
3724
  centerX: 0,
3965
3725
  centerY: 0,
@@ -3975,7 +3735,7 @@ var re = (e, t) => {
3975
3735
  centerY: (r + i) / 2,
3976
3736
  radius: s / 2
3977
3737
  };
3978
- }, $t = class {
3738
+ }, Kt = class {
3979
3739
  root;
3980
3740
  leaves = /* @__PURE__ */ new Map();
3981
3741
  coords;
@@ -4131,7 +3891,7 @@ var re = (e, t) => {
4131
3891
  y: n / e.size
4132
3892
  };
4133
3893
  }
4134
- }, en = class {
3894
+ }, qt = class {
4135
3895
  areaRadiusThreshold;
4136
3896
  nodeMass;
4137
3897
  nodeCharge;
@@ -4143,8 +3903,8 @@ var re = (e, t) => {
4143
3903
  this.areaRadiusThreshold = e.areaRadiusThreshold, this.nodeMass = e.nodeMass, this.nodeCharge = e.nodeCharge, this.theta = e.theta, this.distanceVectorGenerator = e.distanceVectorGenerator, this.nodeForceCoefficient = e.nodeForceCoefficient, this.maxForce = e.maxForce;
4144
3904
  }
4145
3905
  apply(e, t) {
4146
- let n = new $t({
4147
- box: Qt(e),
3906
+ let n = new Kt({
3907
+ box: Gt(e),
4148
3908
  coords: e,
4149
3909
  areaRadiusThreshold: this.areaRadiusThreshold,
4150
3910
  nodeMass: this.nodeMass,
@@ -4254,7 +4014,7 @@ var re = (e, t) => {
4254
4014
  });
4255
4015
  }
4256
4016
  calculateNodeRepulsiveForce(e) {
4257
- let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n = Xt({
4017
+ let t = this.distanceVectorGenerator.create(e.sourceCoords, e.targetCoords), n = Ut({
4258
4018
  coefficient: this.nodeForceCoefficient,
4259
4019
  sourceCharge: e.sourceCharge,
4260
4020
  targetCharge: e.targetCharge,
@@ -4281,12 +4041,12 @@ var re = (e, t) => {
4281
4041
  this.applyForce(e.totalForce, t);
4282
4042
  }
4283
4043
  }
4284
- }, tn = (e) => e.theta === 0 ? new Zt({
4044
+ }, Jt = (e) => e.theta === 0 ? new Wt({
4285
4045
  nodeCharge: e.nodeCharge,
4286
4046
  nodeForceCoefficient: e.nodeForceCoefficient,
4287
4047
  distanceVectorGenerator: e.distanceVectorGenerator,
4288
4048
  maxForce: e.maxForce
4289
- }) : new en({
4049
+ }) : new qt({
4290
4050
  nodeCharge: e.nodeCharge,
4291
4051
  nodeForceCoefficient: e.nodeForceCoefficient,
4292
4052
  distanceVectorGenerator: e.distanceVectorGenerator,
@@ -4294,7 +4054,7 @@ var re = (e, t) => {
4294
4054
  theta: e.theta,
4295
4055
  nodeMass: e.nodeMass,
4296
4056
  areaRadiusThreshold: e.areaRadiusThreshold
4297
- }), nn = class {
4057
+ }), Yt = class {
4298
4058
  rand;
4299
4059
  sparsity;
4300
4060
  constructor(e) {
@@ -4319,7 +4079,7 @@ var re = (e, t) => {
4319
4079
  });
4320
4080
  }), r;
4321
4081
  }
4322
- }, rn = class {
4082
+ }, Xt = class {
4323
4083
  distanceVectorGenerator;
4324
4084
  nodeForcesApplicationStrategy;
4325
4085
  fillerLayoutAlgorithm;
@@ -4330,7 +4090,7 @@ var re = (e, t) => {
4330
4090
  edgeStiffness;
4331
4091
  convergenceVelocity;
4332
4092
  constructor(e) {
4333
- this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.convergenceVelocity, this.distanceVectorGenerator = new Yt(e.rand), this.nodeForcesApplicationStrategy = tn({
4093
+ this.maxIterations = e.maxIterations, this.dtSec = e.dtSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.convergenceVelocity = e.stopVelocity, this.distanceVectorGenerator = new Ht(e.rand), this.nodeForcesApplicationStrategy = Jt({
4334
4094
  distanceVectorGenerator: this.distanceVectorGenerator,
4335
4095
  nodeCharge: e.nodeCharge,
4336
4096
  maxForce: e.maxForce,
@@ -4338,7 +4098,7 @@ var re = (e, t) => {
4338
4098
  theta: e.barnesHutTheta,
4339
4099
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4340
4100
  nodeMass: e.nodeMass
4341
- }), this.fillerLayoutAlgorithm = new nn({
4101
+ }), this.fillerLayoutAlgorithm = new Yt({
4342
4102
  rand: e.rand,
4343
4103
  sparsity: e.edgeEquilibriumLength
4344
4104
  });
@@ -4348,7 +4108,7 @@ var re = (e, t) => {
4348
4108
  graph: t,
4349
4109
  viewport: n
4350
4110
  });
4351
- for (let e = 0; e < this.maxIterations && !(new Jt(t, r, {
4111
+ for (let e = 0; e < this.maxIterations && !(new Vt(t, r, {
4352
4112
  distanceVectorGenerator: this.distanceVectorGenerator,
4353
4113
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
4354
4114
  dtSec: this.dtSec,
@@ -4358,7 +4118,7 @@ var re = (e, t) => {
4358
4118
  }).apply() < this.convergenceVelocity); e++);
4359
4119
  return r;
4360
4120
  }
4361
- }, an = class {
4121
+ }, Zt = class {
4362
4122
  graph;
4363
4123
  nextLayerNodesResolver;
4364
4124
  forest = /* @__PURE__ */ new Set();
@@ -4402,7 +4162,7 @@ var re = (e, t) => {
4402
4162
  }), r = e;
4403
4163
  }
4404
4164
  }
4405
- }, on = class {
4165
+ }, Qt = class {
4406
4166
  params;
4407
4167
  constructor(e) {
4408
4168
  this.params = e;
@@ -4441,13 +4201,13 @@ var re = (e, t) => {
4441
4201
  }
4442
4202
  return n - 2 * this.params.spaceAroundRadius;
4443
4203
  }
4444
- }, sn = class {
4204
+ }, $t = class {
4445
4205
  tree;
4446
4206
  offsets = /* @__PURE__ */ new Map();
4447
4207
  treeSpans = /* @__PURE__ */ new Map();
4448
4208
  constructor(e, t) {
4449
4209
  this.tree = e;
4450
- let n = t.spaceAroundRadius, r = new on({ spaceAroundRadius: n });
4210
+ let n = t.spaceAroundRadius, r = new Qt({ spaceAroundRadius: n });
4451
4211
  [...this.tree.sequence].reverse().forEach((e) => {
4452
4212
  let t = Array.from(e.children).map((e) => this.treeSpans.get(e.nodeId)), i = r.generate(t), a = 0;
4453
4213
  e.children.forEach((e) => {
@@ -4463,19 +4223,19 @@ var re = (e, t) => {
4463
4223
  generate() {
4464
4224
  return this.offsets;
4465
4225
  }
4466
- }, cn = class {
4226
+ }, en = class {
4467
4227
  params;
4468
4228
  constructor(e) {
4469
4229
  this.params = e;
4470
4230
  }
4471
4231
  calculateCoordinates(e) {
4472
- let t = /* @__PURE__ */ new Map(), n = new an(e.graph, this.params.nextLayerNodesResolver).generate(), r = 0;
4232
+ let t = /* @__PURE__ */ new Map(), n = new Zt(e.graph, this.params.nextLayerNodesResolver).generate(), r = 0;
4473
4233
  return n.forEach((e) => {
4474
4234
  t.set(e.root.nodeId, {
4475
4235
  x: r,
4476
4236
  y: 0
4477
4237
  });
4478
- let n = new sn(e, { spaceAroundRadius: this.params.layerSpace / 2 }).generate(), i = [e.root];
4238
+ let n = new $t(e, { spaceAroundRadius: this.params.layerSpace / 2 }).generate(), i = [e.root];
4479
4239
  for (; i.length > 0;) {
4480
4240
  let e = [];
4481
4241
  r += this.params.layerWidth, i.forEach((i) => {
@@ -4492,7 +4252,7 @@ var re = (e, t) => {
4492
4252
  t.set(n, this.params.transform(e));
4493
4253
  }), t;
4494
4254
  }
4495
- }, ln = (e) => {
4255
+ }, tn = (e) => {
4496
4256
  let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
4497
4257
  let n = t.getEdge(e);
4498
4258
  return t.getPort(n.to).nodeId;
@@ -4501,19 +4261,19 @@ var re = (e, t) => {
4501
4261
  return t.getPort(n.from).nodeId;
4502
4262
  });
4503
4263
  return /* @__PURE__ */ new Set([...r, ...i]);
4504
- }, un = (e) => {
4264
+ }, nn = (e) => {
4505
4265
  let { graph: t, currentNodeId: n } = e, r = t.getNodeOutgoingEdgeIds(n).map((e) => {
4506
4266
  let n = t.getEdge(e);
4507
4267
  return t.getPort(n.to).nodeId;
4508
4268
  });
4509
4269
  return new Set(r);
4510
- }, dn = (e) => {
4270
+ }, rn = (e) => {
4511
4271
  let { graph: t, currentNodeId: n } = e, r = t.getNodeIncomingEdgeIds(n).map((e) => {
4512
4272
  let n = t.getEdge(e);
4513
4273
  return t.getPort(n.from).nodeId;
4514
4274
  });
4515
4275
  return new Set(r);
4516
- }, fn = class {
4276
+ }, an = class {
4517
4277
  distanceVectorGenerator;
4518
4278
  nodeForcesApplicationStrategy;
4519
4279
  convergenceVelocity;
@@ -4523,7 +4283,7 @@ var re = (e, t) => {
4523
4283
  edgeStiffness;
4524
4284
  fillerLayoutAlgorithm;
4525
4285
  constructor(e) {
4526
- this.convergenceVelocity = e.convergenceVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Yt(e.rand), this.nodeForcesApplicationStrategy = tn({
4286
+ this.convergenceVelocity = e.stopVelocity, this.maxTimeDeltaSec = e.maxTimeDeltaSec, this.nodeMass = e.nodeMass, this.edgeEquilibriumLength = e.edgeEquilibriumLength, this.edgeStiffness = e.edgeStiffness, this.distanceVectorGenerator = new Ht(e.rand), this.nodeForcesApplicationStrategy = Jt({
4527
4287
  distanceVectorGenerator: this.distanceVectorGenerator,
4528
4288
  nodeCharge: e.nodeCharge,
4529
4289
  maxForce: e.maxForce,
@@ -4531,7 +4291,7 @@ var re = (e, t) => {
4531
4291
  theta: e.barnesHutTheta,
4532
4292
  areaRadiusThreshold: e.barnesHutAreaRadiusThreshold,
4533
4293
  nodeMass: e.nodeMass
4534
- }), this.fillerLayoutAlgorithm = new nn({
4294
+ }), this.fillerLayoutAlgorithm = new Yt({
4535
4295
  rand: e.rand,
4536
4296
  sparsity: e.edgeEquilibriumLength
4537
4297
  });
@@ -4541,7 +4301,7 @@ var re = (e, t) => {
4541
4301
  graph: t,
4542
4302
  viewport: n
4543
4303
  });
4544
- return new Jt(t, i, {
4304
+ return new Vt(t, i, {
4545
4305
  distanceVectorGenerator: this.distanceVectorGenerator,
4546
4306
  nodeForcesApplicationStrategy: this.nodeForcesApplicationStrategy,
4547
4307
  dtSec: Math.min(r, this.maxTimeDeltaSec),
@@ -4553,7 +4313,7 @@ var re = (e, t) => {
4553
4313
  return n.x === null || n.y === null;
4554
4314
  }) ? /* @__PURE__ */ new Map() : i;
4555
4315
  }
4556
- }, pn = (e) => {
4316
+ }, on = (e) => {
4557
4317
  let t = 1779033703, n = 3144134277, r = 1013904242, i = 2773480762;
4558
4318
  for (let a = 0, o; a < e.length; a++) o = e.charCodeAt(a), t = n ^ Math.imul(t ^ o, 597399067), n = r ^ Math.imul(n ^ o, 2869860233), r = i ^ Math.imul(r ^ o, 951274213), i = t ^ Math.imul(i ^ o, 2716044179);
4559
4319
  return t = Math.imul(r ^ t >>> 18, 597399067), n = Math.imul(i ^ n >>> 22, 2869860233), r = Math.imul(t ^ r >>> 17, 951274213), i = Math.imul(n ^ i >>> 19, 2716044179), t ^= n ^ r ^ i, n ^= t, r ^= t, i ^= t, [
@@ -4562,48 +4322,42 @@ var re = (e, t) => {
4562
4322
  r >>> 0,
4563
4323
  i >>> 0
4564
4324
  ];
4565
- }, mn = (e, t, n, r) => function() {
4325
+ }, sn = (e, t, n, r) => function() {
4566
4326
  e |= 0, t |= 0, n |= 0, r |= 0;
4567
4327
  let i = (e + t | 0) + r | 0;
4568
4328
  return r = r + 1 | 0, e = t ^ t >>> 9, t = n + (n << 3) | 0, n = n << 21 | n >>> 11, n = n + i | 0, (i >>> 0) / 4294967296;
4569
- }, hn = (e) => {
4329
+ }, cn = (e) => {
4570
4330
  switch (e?.type) {
4571
4331
  case "custom": return e.instance;
4572
4332
  default: {
4573
- let t = pn(e?.seed ?? K.seed);
4574
- return new fn({
4575
- rand: mn(t[0], t[1], t[2], t[3]),
4576
- maxTimeDeltaSec: e?.maxTimeDeltaSec ?? K.maxTimeDeltaSec,
4577
- nodeCharge: e?.nodeCharge ?? K.nodeCharge,
4578
- nodeMass: e?.nodeMass ?? K.nodeMass,
4579
- edgeEquilibriumLength: e?.edgeEquilibriumLength ?? K.edgeEquilibriumLength,
4580
- edgeStiffness: e?.edgeStiffness ?? K.edgeStiffness,
4581
- convergenceVelocity: e?.convergenceVelocity ?? K.convergenceVelocity,
4582
- maxForce: e?.maxForce ?? K.maxForce,
4583
- nodeForceCoefficient: e?.nodeForceCoefficient ?? K.nodeForceCoefficient,
4584
- barnesHutTheta: e?.barnesHut?.theta ?? K.barnesHutTheta,
4585
- barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? K.barnesHutAreaRadiusThreshold
4333
+ let t = on(e?.seed ?? q.seed);
4334
+ return new an({
4335
+ rand: sn(t[0], t[1], t[2], t[3]),
4336
+ maxTimeDeltaSec: e?.maxTimeDeltaSec ?? q.maxTimeDeltaSec,
4337
+ nodeCharge: e?.nodeCharge ?? q.nodeCharge,
4338
+ nodeMass: e?.nodeMass ?? q.nodeMass,
4339
+ edgeEquilibriumLength: e?.edgeEquilibriumLength ?? q.edgeEquilibriumLength,
4340
+ edgeStiffness: e?.edgeStiffness ?? q.edgeStiffness,
4341
+ stopVelocity: e?.stopVelocity ?? q.convergenceVelocity,
4342
+ maxForce: e?.maxForce ?? q.maxForce,
4343
+ nodeForceCoefficient: e?.nodeForceCoefficient ?? q.nodeForceCoefficient,
4344
+ barnesHutTheta: e?.barnesHut?.theta ?? q.barnesHutTheta,
4345
+ barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? q.barnesHutAreaRadiusThreshold
4586
4346
  });
4587
4347
  }
4588
4348
  }
4589
- }, gn = { staticNodeResolver: () => !1 }, _n = (e) => ({
4590
- algorithm: hn(e?.algorithm ?? {}),
4591
- staticNodeResolver: e?.staticNodeResolver ?? gn.staticNodeResolver,
4592
- onBeforeApplied: e?.events?.onBeforeApplied ?? J,
4593
- onAfterApplied: e?.events?.onAfterApplied ?? J
4594
- }), vn = (e) => e instanceof l ? {
4349
+ }, ln = { staticNodeResolver: () => !1 }, un = (e) => ({
4350
+ algorithm: cn(e?.algorithm ?? {}),
4351
+ staticNodeResolver: e?.staticNodeResolver ?? ln.staticNodeResolver,
4352
+ onBeforeApplied: e?.events?.onBeforeApplied ?? Y,
4353
+ onAfterApplied: e?.events?.onAfterApplied ?? Y
4354
+ }), dn = (e) => e instanceof l ? {
4595
4355
  type: "trigger",
4596
4356
  trigger: e
4597
- } : e === "topologyChangeMicrotask" ? {
4598
- type: "topologyChangeSchedule",
4599
- schedule: Qe
4600
- } : e?.type === "topologyChangeMacrotask" ? {
4601
- type: "topologyChangeSchedule",
4602
- schedule: Ze
4603
4357
  } : {
4604
4358
  type: "topologyChangeSchedule",
4605
- schedule: Qe
4606
- }, yn = Object.freeze({
4359
+ schedule: Ge
4360
+ }, fn = Object.freeze({
4607
4361
  staticNodeResolver: () => !1,
4608
4362
  hierarchicalLayout: {
4609
4363
  layerWidth: 300,
@@ -4616,7 +4370,7 @@ var re = (e, t) => {
4616
4370
  d: e.d * t.a + e.e * t.d,
4617
4371
  e: e.d * t.b + e.e * t.e,
4618
4372
  f: e.d * t.c + e.e * t.f + e.f
4619
- }), bn = (e) => {
4373
+ }), pn = (e) => {
4620
4374
  let { a: t, b: n, c: r, d: i, e: a, f: o } = e, s = t * a - n * i;
4621
4375
  return {
4622
4376
  a: a / s,
@@ -4626,7 +4380,7 @@ var re = (e, t) => {
4626
4380
  e: t / s,
4627
4381
  f: (r * i - t * o) / s
4628
4382
  };
4629
- }, xn = class {
4383
+ }, mn = class {
4630
4384
  resolve(e) {
4631
4385
  if ("shift" in e) return this.createShiftBaseMatrix(e.shift);
4632
4386
  if ("scale" in e) {
@@ -4672,7 +4426,7 @@ var re = (e, t) => {
4672
4426
  return this.createRelativeTransform(n, r);
4673
4427
  }
4674
4428
  createRelativeTransform(e, t) {
4675
- return Q(Q(t, e), bn(t));
4429
+ return Q(Q(t, e), pn(t));
4676
4430
  }
4677
4431
  createShiftBaseMatrix(e) {
4678
4432
  return {
@@ -4715,7 +4469,7 @@ var re = (e, t) => {
4715
4469
  f: 0
4716
4470
  };
4717
4471
  }
4718
- }, Sn = (e) => {
4472
+ }, hn = (e) => {
4719
4473
  if (e === void 0) return (e) => e;
4720
4474
  if (typeof e == "function") return e;
4721
4475
  let t = Array.isArray(e) ? e : [e], n = {
@@ -4725,7 +4479,7 @@ var re = (e, t) => {
4725
4479
  d: 0,
4726
4480
  e: 1,
4727
4481
  f: 0
4728
- }, r = new xn();
4482
+ }, r = new mn();
4729
4483
  return t.forEach((e) => {
4730
4484
  let t = r.resolve(e);
4731
4485
  n = Q(n, t);
@@ -4736,47 +4490,47 @@ var re = (e, t) => {
4736
4490
  y: n.d * t + n.e * r + n.f
4737
4491
  };
4738
4492
  };
4739
- }, Cn = (e) => {
4493
+ }, gn = (e) => {
4740
4494
  if (typeof e == "function") return e;
4741
4495
  switch (e) {
4742
- case "outgoing": return un;
4743
- case "incoming": return dn;
4744
- default: return ln;
4496
+ case "outgoing": return nn;
4497
+ case "incoming": return rn;
4498
+ default: return tn;
4745
4499
  }
4746
- }, wn = (e) => {
4500
+ }, _n = (e) => {
4747
4501
  switch (e?.type) {
4748
4502
  case "custom": return e.instance;
4749
- case "hierarchical": return new cn({
4750
- layerWidth: e.layerWidth ?? yn.hierarchicalLayout.layerWidth,
4751
- layerSpace: e.layerSpace ?? yn.hierarchicalLayout.layerSpace,
4752
- transform: Sn(e.transform),
4753
- nextLayerNodesResolver: Cn(e.nextLayerNodesResolver)
4503
+ case "hierarchical": return new en({
4504
+ layerWidth: e.layerWidth ?? fn.hierarchicalLayout.layerWidth,
4505
+ layerSpace: e.layerSpace ?? fn.hierarchicalLayout.layerSpace,
4506
+ transform: hn(e.transform),
4507
+ nextLayerNodesResolver: gn(e.nextLayerNodesResolver)
4754
4508
  });
4755
4509
  default: {
4756
- let t = pn(e?.seed ?? K.seed), n = mn(t[0], t[1], t[2], t[3]);
4757
- return new rn({
4758
- dtSec: e?.dtSec ?? K.dtSec,
4759
- maxIterations: e?.maxIterations ?? K.maxIterations,
4510
+ let t = on(e?.seed ?? q.seed), n = sn(t[0], t[1], t[2], t[3]);
4511
+ return new Xt({
4512
+ dtSec: e?.dtSec ?? q.dtSec,
4513
+ maxIterations: e?.maxIterations ?? q.maxIterations,
4760
4514
  rand: n,
4761
- nodeCharge: e?.nodeCharge ?? K.nodeCharge,
4762
- nodeMass: e?.nodeMass ?? K.nodeMass,
4763
- edgeEquilibriumLength: e?.edgeEquilibriumLength ?? K.edgeEquilibriumLength,
4764
- edgeStiffness: e?.edgeStiffness ?? K.edgeStiffness,
4765
- convergenceVelocity: e?.convergenceVelocity ?? K.convergenceVelocity,
4766
- maxForce: e?.maxForce ?? K.maxForce,
4767
- nodeForceCoefficient: e?.nodeForceCoefficient ?? K.nodeForceCoefficient,
4768
- barnesHutTheta: e?.barnesHut?.theta ?? K.barnesHutTheta,
4769
- barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? K.barnesHutAreaRadiusThreshold
4515
+ nodeCharge: e?.nodeCharge ?? q.nodeCharge,
4516
+ nodeMass: e?.nodeMass ?? q.nodeMass,
4517
+ edgeEquilibriumLength: e?.edgeEquilibriumLength ?? q.edgeEquilibriumLength,
4518
+ edgeStiffness: e?.edgeStiffness ?? q.edgeStiffness,
4519
+ stopVelocity: e?.stopVelocity ?? q.convergenceVelocity,
4520
+ maxForce: e?.maxForce ?? q.maxForce,
4521
+ nodeForceCoefficient: e?.nodeForceCoefficient ?? q.nodeForceCoefficient,
4522
+ barnesHutTheta: e?.barnesHut?.theta ?? q.barnesHutTheta,
4523
+ barnesHutAreaRadiusThreshold: e?.barnesHut?.areaRadiusThreshold ?? q.barnesHutAreaRadiusThreshold
4770
4524
  });
4771
4525
  }
4772
4526
  }
4773
- }, Tn = (e) => ({
4774
- algorithm: wn(e.algorithm),
4775
- applyOn: vn(e.applyOn),
4776
- staticNodeResolver: e.staticNodeResolver ?? yn.staticNodeResolver,
4777
- onBeforeApplied: e.events?.onBeforeApplied ?? J,
4778
- onAfterApplied: e.events?.onAfterApplied ?? J
4779
- }), En = (e, t) => ({
4527
+ }, vn = (e) => ({
4528
+ algorithm: _n(e.algorithm),
4529
+ applyOn: dn(e.applyOn),
4530
+ staticNodeResolver: e.staticNodeResolver ?? fn.staticNodeResolver,
4531
+ onBeforeApplied: e.events?.onBeforeApplied ?? Y,
4532
+ onAfterApplied: e.events?.onAfterApplied ?? Y
4533
+ }), yn = (e, t) => ({
4780
4534
  ...e,
4781
4535
  onNodeDragStarted: (n) => {
4782
4536
  t.add(n), e.onNodeDragStarted(n);
@@ -4784,7 +4538,7 @@ var re = (e, t) => {
4784
4538
  onNodeDragFinished: (n) => {
4785
4539
  t.delete(n), e.onNodeDragFinished(n);
4786
4540
  }
4787
- }), Dn = (e, t) => {
4541
+ }), bn = (e, t) => {
4788
4542
  e.graph.onBeforeNodeRemoved.subscribe((e) => {
4789
4543
  t.delete(e);
4790
4544
  }), e.graph.onBeforeClear.subscribe(() => {
@@ -4792,20 +4546,20 @@ var re = (e, t) => {
4792
4546
  }), e.onBeforeDestroy.subscribe(() => {
4793
4547
  t.clear();
4794
4548
  });
4795
- }, On = (e, t) => ({
4549
+ }, xn = (e, t) => ({
4796
4550
  ...e,
4797
4551
  staticNodeResolver: (n) => e.staticNodeResolver(n) || t.has(n)
4798
- }), $ = (e) => () => e, kn = $(0), An = () => {
4552
+ }), $ = (e) => () => e, Sn = $(0), Cn = () => {
4799
4553
  let e = 0;
4800
4554
  return () => e++;
4801
- }, jn = (e, t) => {
4802
- let n = kn, r = kn, i = An();
4555
+ }, wn = (e, t) => {
4556
+ let n = Sn, r = Sn, i = Cn();
4803
4557
  return e === "incremental" && (n = i), t === "incremental" && (r = i), typeof e == "number" && (n = $(e)), typeof t == "number" && (r = $(t)), typeof e == "function" && (n = e), typeof t == "function" && (r = t), {
4804
4558
  nodesPriorityFn: n,
4805
4559
  edgesPriorityFn: r
4806
4560
  };
4807
- }, Mn = (e) => {
4808
- let t = jn(e.nodes?.priority, e.edges?.priority);
4561
+ }, Tn = (e) => {
4562
+ let t = wn(e.nodes?.priority, e.edges?.priority);
4809
4563
  return {
4810
4564
  nodes: {
4811
4565
  centerFn: e.nodes?.centerFn ?? ie,
@@ -4813,34 +4567,34 @@ var re = (e, t) => {
4813
4567
  },
4814
4568
  ports: { direction: e.ports?.direction ?? 0 },
4815
4569
  edges: {
4816
- shapeFactory: Y(e.edges?.shape ?? {}),
4570
+ shapeFactory: Et(e.edges?.shape ?? {}),
4817
4571
  priorityFn: t.edgesPriorityFn
4818
4572
  }
4819
4573
  };
4820
- }, Nn = (e) => e.applyOn.type === "topologyChangeSchedule" ? e.applyOn.schedule : B, Pn = (e) => {
4821
- let { canvasDefaults: t } = e, n = e.hasLayout ? Nn(e.layoutParams) : B;
4574
+ }, En = (e) => e.applyOn.type === "topologyChangeSchedule" ? e.applyOn.schedule : z, Dn = (e) => {
4575
+ let { canvasDefaults: t } = e, n = e.hasLayout ? En(e.layoutParams) : z;
4822
4576
  return { focus: {
4823
- contentPadding: t.focus?.contentPadding ?? t.focus?.contentOffset ?? 100,
4577
+ contentPadding: t.focus?.contentPadding ?? 100,
4824
4578
  minContentScale: t.focus?.minContentScale ?? 0,
4825
4579
  schedule: n,
4826
4580
  animationDuration: t.focus?.animationDuration ?? 0
4827
4581
  } };
4828
- }, Fn = (e) => ({
4582
+ }, On = (e) => ({
4829
4583
  onNodeSelected: e.onNodeSelected,
4830
- mouseDownEventVerifier: e.mouseDownEventVerifier ?? q.mouseDownEventVerifier,
4831
- mouseUpEventVerifier: e.mouseUpEventVerifier ?? q.mouseUpEventVerifier,
4832
- movementThreshold: e.movementThreshold ?? q.movementThreshold
4833
- }), In = (e) => ({
4584
+ mouseDownEventVerifier: e.mouseDownEventVerifier ?? J.mouseDownEventVerifier,
4585
+ mouseUpEventVerifier: e.mouseUpEventVerifier ?? J.mouseUpEventVerifier,
4586
+ movementThreshold: e.movementThreshold ?? J.movementThreshold
4587
+ }), kn = (e) => ({
4834
4588
  onCanvasSelected: e.onCanvasSelected,
4835
- mouseDownEventVerifier: e.mouseDownEventVerifier ?? q.mouseDownEventVerifier,
4836
- mouseUpEventVerifier: e.mouseUpEventVerifier ?? q.mouseUpEventVerifier,
4837
- movementThreshold: e.movementThreshold ?? q.movementThreshold
4838
- }), Ln = (e) => ({
4589
+ mouseDownEventVerifier: e.mouseDownEventVerifier ?? J.mouseDownEventVerifier,
4590
+ mouseUpEventVerifier: e.mouseUpEventVerifier ?? J.mouseUpEventVerifier,
4591
+ movementThreshold: e.movementThreshold ?? J.movementThreshold
4592
+ }), An = (e) => ({
4839
4593
  onEdgeSelected: e.onEdgeSelected,
4840
- mouseDownEventVerifier: e.mouseDownEventVerifier ?? q.mouseDownEventVerifier,
4841
- mouseUpEventVerifier: e.mouseUpEventVerifier ?? q.mouseUpEventVerifier,
4842
- movementThreshold: e.movementThreshold ?? q.movementThreshold
4843
- }), Rn = class {
4594
+ mouseDownEventVerifier: e.mouseDownEventVerifier ?? J.mouseDownEventVerifier,
4595
+ mouseUpEventVerifier: e.mouseUpEventVerifier ?? J.mouseUpEventVerifier,
4596
+ movementThreshold: e.movementThreshold ?? J.movementThreshold
4597
+ }), jn = class {
4844
4598
  element;
4845
4599
  used = !1;
4846
4600
  canvasDefaults = {};
@@ -4867,7 +4621,7 @@ var re = (e, t) => {
4867
4621
  window = window;
4868
4622
  animationStaticNodes = /* @__PURE__ */ new Set();
4869
4623
  pointInsideVerifier;
4870
- eventTagger = new ot();
4624
+ eventTagger = new $e();
4871
4625
  constructor(e) {
4872
4626
  this.element = e, this.pointInsideVerifier = new ee(e, this.window);
4873
4627
  }
@@ -4911,40 +4665,40 @@ var re = (e, t) => {
4911
4665
  return this.userSelectableCanvasConfig = e, this;
4912
4666
  }
4913
4667
  build() {
4914
- if (this.used) throw new qt("Failed to build Canvas because CanvasBuilder is a single-use object");
4668
+ if (this.used) throw new Bt("Failed to build Canvas because CanvasBuilder is a single-use object");
4915
4669
  this.used = !0;
4916
- let e = new y(this.element), t = new h(), n = new Mt(this.element), r = this.createHtmlView(n.main, t, e), i = Mn(this.canvasDefaults), a = new Xe(t, r, i), o = Tn(this.layoutConfig), s = new rt(t, e, Pn({
4670
+ let e = new y(this.element), t = new h(), n = new wt(this.element), r = this.createHtmlView(n.main, t, e), i = Tn(this.canvasDefaults), a = new We(t, r, i), o = vn(this.layoutConfig), s = new Xe(t, e, Dn({
4917
4671
  canvasDefaults: this.canvasDefaults,
4918
4672
  hasLayout: this.hasLayout,
4919
4673
  layoutParams: o
4920
- }), this.window), c = new $e(e), l = new d(new Ye(t), c, a, s);
4921
- if (this.hasBackground && gt.configure(l, Ht(this.backgroundConfig), n.background), this.hasNodeResizeReactiveEdges && b.configure(l), this.userSelectableEdgesConfig !== void 0) {
4922
- let e = Ln(this.userSelectableEdgesConfig);
4923
- Dt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
4674
+ }), this.window), c = new Ke(e), l = new d(new Ue(t), c, a, s);
4675
+ if (this.hasBackground && ct.configure(l, Ft(this.backgroundConfig), n.background), this.hasNodeResizeReactiveEdges && b.configure(l), this.userSelectableEdgesConfig !== void 0) {
4676
+ let e = An(this.userSelectableEdgesConfig);
4677
+ yt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
4924
4678
  }
4925
4679
  if (this.userSelectableNodesConfig !== void 0) {
4926
- let e = Fn(this.userSelectableNodesConfig);
4927
- Et.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
4680
+ let e = On(this.userSelectableNodesConfig);
4681
+ vt.configure(l, this.window, this.pointInsideVerifier, this.eventTagger, e);
4928
4682
  }
4929
4683
  if (this.userSelectableCanvasConfig !== void 0) {
4930
- let e = In(this.userSelectableCanvasConfig);
4931
- Ot.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
4684
+ let e = kn(this.userSelectableCanvasConfig);
4685
+ bt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
4932
4686
  }
4933
4687
  if (this.hasDraggableNodes) {
4934
- let e = Pt(this.dragConfig);
4935
- this.hasAnimatedLayout && (e = En(e, this.animationStaticNodes)), ut.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
4688
+ let e = Dt(this.dragConfig);
4689
+ this.hasAnimatedLayout && (e = yn(e, this.animationStaticNodes)), nt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, e);
4936
4690
  }
4937
4691
  if (this.hasUserConnectablePorts) {
4938
- let t = Ut(this.connectablePortsConfig, i.edges.shapeFactory, l.graph);
4939
- _t.configure(l, n.overlayConnectablePorts, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
4692
+ let t = It(this.connectablePortsConfig, i.edges.shapeFactory, l.graph);
4693
+ lt.configure(l, n.overlayConnectablePorts, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
4940
4694
  }
4941
4695
  if (this.hasUserDraggableEdges) {
4942
- let t = Wt(this.draggableEdgesConfig, l.graph);
4943
- vt.configure(l, n.overlayDraggableEdges, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
4696
+ let t = Lt(this.draggableEdgesConfig, l.graph);
4697
+ ut.configure(l, n.overlayDraggableEdges, e, this.window, this.pointInsideVerifier, this.eventTagger, t);
4944
4698
  }
4945
- if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport && dt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, zt(this.transformConfig)) : ft.configure(l, n.main, this.window, zt(this.transformConfig), this.boxRenderingTrigger, this.pointInsideVerifier, this.eventTagger, Gt(this.virtualScrollConfig)), this.hasLayout && St.configure(l, o), this.hasAnimatedLayout) {
4946
- let e = _n(this.animatedLayoutConfig);
4947
- this.hasDraggableNodes && (Dn(l, this.animationStaticNodes), e = On(e, this.animationStaticNodes)), Tt.configure(l, e, this.window);
4699
+ if (this.virtualScrollConfig === void 0 ? this.hasTransformableViewport && rt.configure(l, n.main, this.window, this.pointInsideVerifier, this.eventTagger, Mt(this.transformConfig)) : it.configure(l, n.main, this.window, Mt(this.transformConfig), this.boxRenderingTrigger, this.pointInsideVerifier, this.eventTagger, Rt(this.virtualScrollConfig)), this.hasLayout && mt.configure(l, o), this.hasAnimatedLayout) {
4700
+ let e = un(this.animatedLayoutConfig);
4701
+ this.hasDraggableNodes && (bn(l, this.animationStaticNodes), e = xn(e, this.animationStaticNodes)), _t.configure(l, e, this.window);
4948
4702
  }
4949
4703
  return l.onBeforeDestroy.subscribe(() => {
4950
4704
  n.destroy();
@@ -4952,8 +4706,8 @@ var re = (e, t) => {
4952
4706
  }
4953
4707
  createHtmlView(e, t, n) {
4954
4708
  let r = new a(t, n, e);
4955
- return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger, Kt(this.virtualScrollConfig))), r = new c(r, t), r;
4709
+ return this.virtualScrollConfig !== void 0 && (r = new s(r, t, this.boxRenderingTrigger, zt(this.virtualScrollConfig))), r = new c(r, t), r;
4956
4710
  }
4957
4711
  };
4958
4712
  //#endregion
4959
- export { je as BezierEdgeShape, Rn as CanvasBuilder, qt as CanvasBuilderError, p as CanvasError, e as ConnectionCategory, R as DirectEdgeShape, l as EventSubject, Ne as HorizontalEdgeShape, Ke as InteractiveEdgeError, qe as InteractiveEdgeShape, Je as MidpointEdgeShape, ze as OrthogonalEdgeShape, Pe as StraightEdgeShape, Le as VerticalEdgeShape, Be as boxPortOffsetFn };
4713
+ export { Ae as BezierEdgeShape, jn as CanvasBuilder, Bt as CanvasBuilderError, p as CanvasError, e as ConnectionCategory, L as DirectEdgeShape, l as EventSubject, Be as InteractiveEdgeError, Ve as InteractiveEdgeShape, He as MidpointEdgeShape, Ne as OrthogonalEdgeShape, je as StraightEdgeShape };