@xyflow/system 0.0.75 → 0.0.76
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.
- package/dist/esm/index.js +22 -21
- package/dist/esm/index.mjs +22 -21
- package/dist/esm/utils/edges/smoothstep-edge.d.ts.map +1 -1
- package/dist/esm/utils/general.d.ts +1 -1
- package/dist/esm/utils/store.d.ts +5 -1
- package/dist/esm/utils/store.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/utils/edges/smoothstep-edge.d.ts.map +1 -1
- package/dist/umd/utils/general.d.ts +1 -1
- package/dist/umd/utils/store.d.ts +5 -1
- package/dist/umd/utils/store.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -779,7 +779,7 @@ function nodeHasDimensions(node) {
|
|
|
779
779
|
(node.measured?.height ?? node.height ?? node.initialHeight) !== undefined);
|
|
780
780
|
}
|
|
781
781
|
/**
|
|
782
|
-
* Convert child position to
|
|
782
|
+
* Convert child position to absolute position
|
|
783
783
|
*
|
|
784
784
|
* @internal
|
|
785
785
|
* @param position
|
|
@@ -1194,13 +1194,13 @@ function getPoints({ source, sourcePosition = Position.Bottom, target, targetPos
|
|
|
1194
1194
|
if (sourceDir[dirAccessor] * targetDir[dirAccessor] === -1) {
|
|
1195
1195
|
if (dirAccessor === 'x') {
|
|
1196
1196
|
// Primary direction is horizontal, so stepPosition affects X coordinate
|
|
1197
|
-
centerX = center.x ??
|
|
1197
|
+
centerX = center.x ?? sourceGapped.x + (targetGapped.x - sourceGapped.x) * stepPosition;
|
|
1198
1198
|
centerY = center.y ?? (sourceGapped.y + targetGapped.y) / 2;
|
|
1199
1199
|
}
|
|
1200
1200
|
else {
|
|
1201
|
-
// Primary direction is vertical, so stepPosition affects Y coordinate
|
|
1201
|
+
// Primary direction is vertical, so stepPosition affects Y coordinate
|
|
1202
1202
|
centerX = center.x ?? (sourceGapped.x + targetGapped.x) / 2;
|
|
1203
|
-
centerY = center.y ??
|
|
1203
|
+
centerY = center.y ?? sourceGapped.y + (targetGapped.y - sourceGapped.y) * stepPosition;
|
|
1204
1204
|
}
|
|
1205
1205
|
/*
|
|
1206
1206
|
* --->
|
|
@@ -1277,11 +1277,16 @@ function getPoints({ source, sourcePosition = Position.Bottom, target, targetPos
|
|
|
1277
1277
|
centerY = (sourceGapPoint.y + targetGapPoint.y) / 2;
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
|
+
const gappedSource = { x: sourceGapped.x + sourceGapOffset.x, y: sourceGapped.y + sourceGapOffset.y };
|
|
1281
|
+
const gappedTarget = { x: targetGapped.x + targetGapOffset.x, y: targetGapped.y + targetGapOffset.y };
|
|
1280
1282
|
const pathPoints = [
|
|
1281
1283
|
source,
|
|
1282
|
-
|
|
1284
|
+
// we only want to add the gapped source/target if they are different from the first/last point to avoid duplicates which can cause issues with the bends
|
|
1285
|
+
...(gappedSource.x !== points[0].x || gappedSource.y !== points[0].y ? [gappedSource] : []),
|
|
1283
1286
|
...points,
|
|
1284
|
-
|
|
1287
|
+
...(gappedTarget.x !== points[points.length - 1].x || gappedTarget.y !== points[points.length - 1].y
|
|
1288
|
+
? [gappedTarget]
|
|
1289
|
+
: []),
|
|
1285
1290
|
target,
|
|
1286
1291
|
];
|
|
1287
1292
|
return [pathPoints, centerX, centerY, defaultOffsetX, defaultOffsetY];
|
|
@@ -1344,17 +1349,11 @@ function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom,
|
|
|
1344
1349
|
offset,
|
|
1345
1350
|
stepPosition,
|
|
1346
1351
|
});
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
else {
|
|
1353
|
-
segment = `${i === 0 ? 'M' : 'L'}${p.x} ${p.y}`;
|
|
1354
|
-
}
|
|
1355
|
-
res += segment;
|
|
1356
|
-
return res;
|
|
1357
|
-
}, '');
|
|
1352
|
+
let path = `M${points[0].x} ${points[0].y}`;
|
|
1353
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
1354
|
+
path += getBend(points[i - 1], points[i], points[i + 1], borderRadius);
|
|
1355
|
+
}
|
|
1356
|
+
path += `L${points[points.length - 1].x} ${points[points.length - 1].y}`;
|
|
1358
1357
|
return [path, labelX, labelY, offsetX, offsetY];
|
|
1359
1358
|
}
|
|
1360
1359
|
|
|
@@ -1606,6 +1605,7 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
|
|
|
1606
1605
|
const tmpLookup = new Map(nodeLookup);
|
|
1607
1606
|
const selectedNodeZ = _options?.elevateNodesOnSelect && !isManualZIndexMode(_options.zIndexMode) ? SELECTED_NODE_Z : 0;
|
|
1608
1607
|
let nodesInitialized = nodes.length > 0;
|
|
1608
|
+
let hasSelectedNodes = false;
|
|
1609
1609
|
nodeLookup.clear();
|
|
1610
1610
|
parentLookup.clear();
|
|
1611
1611
|
for (const userNode of nodes) {
|
|
@@ -1643,8 +1643,9 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
|
|
|
1643
1643
|
if (userNode.parentId) {
|
|
1644
1644
|
updateChildNode(internalNode, nodeLookup, parentLookup, options, rootParentIndex);
|
|
1645
1645
|
}
|
|
1646
|
+
hasSelectedNodes ||= userNode.selected ?? false;
|
|
1646
1647
|
}
|
|
1647
|
-
return nodesInitialized;
|
|
1648
|
+
return { nodesInitialized, hasSelectedNodes };
|
|
1648
1649
|
}
|
|
1649
1650
|
function updateParentLookup(node, parentLookup) {
|
|
1650
1651
|
if (!node.parentId) {
|
|
@@ -1898,7 +1899,7 @@ async function panBy({ delta, panZoom, transform, translateExtent, width, height
|
|
|
1898
1899
|
* @param connectionKey at which key the connection should be added
|
|
1899
1900
|
* @param connectionLookup reference to the connection lookup
|
|
1900
1901
|
* @param nodeId nodeId of the connection
|
|
1901
|
-
* @param handleId handleId of the
|
|
1902
|
+
* @param handleId handleId of the connection
|
|
1902
1903
|
*/
|
|
1903
1904
|
function addConnectionToLookup(type, connection, connectionKey, connectionLookup, nodeId, handleId) {
|
|
1904
1905
|
/*
|
|
@@ -2539,7 +2540,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
2539
2540
|
doc.addEventListener('touchmove', onPointerMove);
|
|
2540
2541
|
doc.addEventListener('touchend', onPointerUp);
|
|
2541
2542
|
}
|
|
2542
|
-
// checks if and returns connection in
|
|
2543
|
+
// checks if and returns connection in form of an object { source: 123, target: 312 }
|
|
2543
2544
|
function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, flowId, isValidConnection = alwaysValid, nodeLookup, }) {
|
|
2544
2545
|
const isTarget = fromType === 'target';
|
|
2545
2546
|
const handleDomNode = handle
|
|
@@ -2808,7 +2809,7 @@ function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDrag
|
|
|
2808
2809
|
zoomPanValues.timerId = setTimeout(() => {
|
|
2809
2810
|
onPanZoomEnd?.(event.sourceEvent, viewport);
|
|
2810
2811
|
},
|
|
2811
|
-
// we need a setTimeout for panOnScroll to
|
|
2812
|
+
// we need a setTimeout for panOnScroll to suppress multiple end events fired during scroll
|
|
2812
2813
|
panOnScroll ? 150 : 0);
|
|
2813
2814
|
}
|
|
2814
2815
|
};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -779,7 +779,7 @@ function nodeHasDimensions(node) {
|
|
|
779
779
|
(node.measured?.height ?? node.height ?? node.initialHeight) !== undefined);
|
|
780
780
|
}
|
|
781
781
|
/**
|
|
782
|
-
* Convert child position to
|
|
782
|
+
* Convert child position to absolute position
|
|
783
783
|
*
|
|
784
784
|
* @internal
|
|
785
785
|
* @param position
|
|
@@ -1194,13 +1194,13 @@ function getPoints({ source, sourcePosition = Position.Bottom, target, targetPos
|
|
|
1194
1194
|
if (sourceDir[dirAccessor] * targetDir[dirAccessor] === -1) {
|
|
1195
1195
|
if (dirAccessor === 'x') {
|
|
1196
1196
|
// Primary direction is horizontal, so stepPosition affects X coordinate
|
|
1197
|
-
centerX = center.x ??
|
|
1197
|
+
centerX = center.x ?? sourceGapped.x + (targetGapped.x - sourceGapped.x) * stepPosition;
|
|
1198
1198
|
centerY = center.y ?? (sourceGapped.y + targetGapped.y) / 2;
|
|
1199
1199
|
}
|
|
1200
1200
|
else {
|
|
1201
|
-
// Primary direction is vertical, so stepPosition affects Y coordinate
|
|
1201
|
+
// Primary direction is vertical, so stepPosition affects Y coordinate
|
|
1202
1202
|
centerX = center.x ?? (sourceGapped.x + targetGapped.x) / 2;
|
|
1203
|
-
centerY = center.y ??
|
|
1203
|
+
centerY = center.y ?? sourceGapped.y + (targetGapped.y - sourceGapped.y) * stepPosition;
|
|
1204
1204
|
}
|
|
1205
1205
|
/*
|
|
1206
1206
|
* --->
|
|
@@ -1277,11 +1277,16 @@ function getPoints({ source, sourcePosition = Position.Bottom, target, targetPos
|
|
|
1277
1277
|
centerY = (sourceGapPoint.y + targetGapPoint.y) / 2;
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
|
+
const gappedSource = { x: sourceGapped.x + sourceGapOffset.x, y: sourceGapped.y + sourceGapOffset.y };
|
|
1281
|
+
const gappedTarget = { x: targetGapped.x + targetGapOffset.x, y: targetGapped.y + targetGapOffset.y };
|
|
1280
1282
|
const pathPoints = [
|
|
1281
1283
|
source,
|
|
1282
|
-
|
|
1284
|
+
// we only want to add the gapped source/target if they are different from the first/last point to avoid duplicates which can cause issues with the bends
|
|
1285
|
+
...(gappedSource.x !== points[0].x || gappedSource.y !== points[0].y ? [gappedSource] : []),
|
|
1283
1286
|
...points,
|
|
1284
|
-
|
|
1287
|
+
...(gappedTarget.x !== points[points.length - 1].x || gappedTarget.y !== points[points.length - 1].y
|
|
1288
|
+
? [gappedTarget]
|
|
1289
|
+
: []),
|
|
1285
1290
|
target,
|
|
1286
1291
|
];
|
|
1287
1292
|
return [pathPoints, centerX, centerY, defaultOffsetX, defaultOffsetY];
|
|
@@ -1344,17 +1349,11 @@ function getSmoothStepPath({ sourceX, sourceY, sourcePosition = Position.Bottom,
|
|
|
1344
1349
|
offset,
|
|
1345
1350
|
stepPosition,
|
|
1346
1351
|
});
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
else {
|
|
1353
|
-
segment = `${i === 0 ? 'M' : 'L'}${p.x} ${p.y}`;
|
|
1354
|
-
}
|
|
1355
|
-
res += segment;
|
|
1356
|
-
return res;
|
|
1357
|
-
}, '');
|
|
1352
|
+
let path = `M${points[0].x} ${points[0].y}`;
|
|
1353
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
1354
|
+
path += getBend(points[i - 1], points[i], points[i + 1], borderRadius);
|
|
1355
|
+
}
|
|
1356
|
+
path += `L${points[points.length - 1].x} ${points[points.length - 1].y}`;
|
|
1358
1357
|
return [path, labelX, labelY, offsetX, offsetY];
|
|
1359
1358
|
}
|
|
1360
1359
|
|
|
@@ -1606,6 +1605,7 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
|
|
|
1606
1605
|
const tmpLookup = new Map(nodeLookup);
|
|
1607
1606
|
const selectedNodeZ = _options?.elevateNodesOnSelect && !isManualZIndexMode(_options.zIndexMode) ? SELECTED_NODE_Z : 0;
|
|
1608
1607
|
let nodesInitialized = nodes.length > 0;
|
|
1608
|
+
let hasSelectedNodes = false;
|
|
1609
1609
|
nodeLookup.clear();
|
|
1610
1610
|
parentLookup.clear();
|
|
1611
1611
|
for (const userNode of nodes) {
|
|
@@ -1643,8 +1643,9 @@ function adoptUserNodes(nodes, nodeLookup, parentLookup, options = {}) {
|
|
|
1643
1643
|
if (userNode.parentId) {
|
|
1644
1644
|
updateChildNode(internalNode, nodeLookup, parentLookup, options, rootParentIndex);
|
|
1645
1645
|
}
|
|
1646
|
+
hasSelectedNodes ||= userNode.selected ?? false;
|
|
1646
1647
|
}
|
|
1647
|
-
return nodesInitialized;
|
|
1648
|
+
return { nodesInitialized, hasSelectedNodes };
|
|
1648
1649
|
}
|
|
1649
1650
|
function updateParentLookup(node, parentLookup) {
|
|
1650
1651
|
if (!node.parentId) {
|
|
@@ -1898,7 +1899,7 @@ async function panBy({ delta, panZoom, transform, translateExtent, width, height
|
|
|
1898
1899
|
* @param connectionKey at which key the connection should be added
|
|
1899
1900
|
* @param connectionLookup reference to the connection lookup
|
|
1900
1901
|
* @param nodeId nodeId of the connection
|
|
1901
|
-
* @param handleId handleId of the
|
|
1902
|
+
* @param handleId handleId of the connection
|
|
1902
1903
|
*/
|
|
1903
1904
|
function addConnectionToLookup(type, connection, connectionKey, connectionLookup, nodeId, handleId) {
|
|
1904
1905
|
/*
|
|
@@ -2539,7 +2540,7 @@ function onPointerDown(event, { connectionMode, connectionRadius, handleId, node
|
|
|
2539
2540
|
doc.addEventListener('touchmove', onPointerMove);
|
|
2540
2541
|
doc.addEventListener('touchend', onPointerUp);
|
|
2541
2542
|
}
|
|
2542
|
-
// checks if and returns connection in
|
|
2543
|
+
// checks if and returns connection in form of an object { source: 123, target: 312 }
|
|
2543
2544
|
function isValidHandle(event, { handle, connectionMode, fromNodeId, fromHandleId, fromType, doc, lib, flowId, isValidConnection = alwaysValid, nodeLookup, }) {
|
|
2544
2545
|
const isTarget = fromType === 'target';
|
|
2545
2546
|
const handleDomNode = handle
|
|
@@ -2808,7 +2809,7 @@ function createPanZoomEndHandler({ zoomPanValues, panOnDrag, panOnScroll, onDrag
|
|
|
2808
2809
|
zoomPanValues.timerId = setTimeout(() => {
|
|
2809
2810
|
onPanZoomEnd?.(event.sourceEvent, viewport);
|
|
2810
2811
|
},
|
|
2811
|
-
// we need a setTimeout for panOnScroll to
|
|
2812
|
+
// we need a setTimeout for panOnScroll to suppress multiple end events fired during scroll
|
|
2812
2813
|
panOnScroll ? 150 : 0);
|
|
2813
2814
|
}
|
|
2814
2815
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smoothstep-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/smoothstep-edge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"smoothstep-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/smoothstep-edge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAwMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,YAAgB,EAChB,OAAO,EACP,OAAO,EACP,MAAW,EACX,YAAkB,GACnB,EAAE,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAoB5G"}
|
|
@@ -58,7 +58,7 @@ export declare function getNodeDimensions(node: {
|
|
|
58
58
|
};
|
|
59
59
|
export declare function nodeHasDimensions<NodeType extends NodeBase = NodeBase>(node: NodeType): boolean;
|
|
60
60
|
/**
|
|
61
|
-
* Convert child position to
|
|
61
|
+
* Convert child position to absolute position
|
|
62
62
|
*
|
|
63
63
|
* @internal
|
|
64
64
|
* @param position
|
|
@@ -11,7 +11,11 @@ type UpdateNodesOptions<NodeType extends NodeBase> = {
|
|
|
11
11
|
checkEquality?: boolean;
|
|
12
12
|
};
|
|
13
13
|
export declare function isManualZIndexMode(zIndexMode?: ZIndexMode): boolean;
|
|
14
|
-
|
|
14
|
+
type AdoptUserNodesReturn = {
|
|
15
|
+
nodesInitialized: boolean;
|
|
16
|
+
hasSelectedNodes: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function adoptUserNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): AdoptUserNodesReturn;
|
|
15
19
|
export declare function handleExpandParent(children: ParentExpandChild[], nodeLookup: NodeLookup, parentLookup: ParentLookup, nodeOrigin?: NodeOrigin): (NodeDimensionChange | NodePositionChange)[];
|
|
16
20
|
export declare function updateNodeInternals<NodeType extends InternalNodeBase>(updates: Map<string, InternalNodeUpdate>, nodeLookup: NodeLookup<NodeType>, parentLookup: ParentLookup<NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin, nodeExtent?: CoordinateExtent, zIndexMode?: ZIndexMode): {
|
|
17
21
|
changes: (NodeDimensionChange | NodePositionChange)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/utils/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,UAAU,EAAE,MAAM,IAAI,CAAC;AAC5F,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,UAAU,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAYlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA8B5C,wBAAgB,uBAAuB,CAAC,QAAQ,SAAS,QAAQ,EAC/D,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAClD,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,QAavC;AAkCD,KAAK,kBAAkB,CAAC,QAAQ,SAAS,QAAQ,IAAI;IACnD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAEnE;AAED,wBAAgB,cAAc,CAAC,QAAQ,SAAS,QAAQ,EACtD,KAAK,EAAE,QAAQ,EAAE,EACjB,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAClD,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,GAAE,kBAAkB,CAAC,QAAQ,CAAM,GACzC,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/utils/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,UAAU,EAAE,MAAM,IAAI,CAAC;AAC5F,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,UAAU,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAYlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA8B5C,wBAAgB,uBAAuB,CAAC,QAAQ,SAAS,QAAQ,EAC/D,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAClD,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,QAavC;AAkCD,KAAK,kBAAkB,CAAC,QAAQ,SAAS,QAAQ,IAAI;IACnD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAEnE;AAED,KAAK,oBAAoB,GAAG;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,SAAS,QAAQ,EACtD,KAAK,EAAE,QAAQ,EAAE,EACjB,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAClD,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,GAAE,kBAAkB,CAAC,QAAQ,CAAM,GACzC,oBAAoB,CA0DtB;AAyHD,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,UAAU,GAAE,UAAmB,GAC9B,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,EAAE,CAiF9C;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,gBAAgB,EACnE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACxC,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,EAChC,YAAY,EAAE,YAAY,CAAC,QAAQ,CAAC,EACpC,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,UAAU,CAAC,EAAE,UAAU,EACvB,UAAU,CAAC,EAAE,gBAAgB,EAC7B,UAAU,CAAC,EAAE,UAAU,GACtB;IAAE,OAAO,EAAE,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,EAAE,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,CAgGtF;AAED,wBAAsB,KAAK,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,SAAS,EACT,eAAe,EACf,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,gBAAgB,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBnB;AAwCD,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,QAgBnH"}
|
package/dist/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).XYFlowSystem={})}(this,(function(t){"use strict";const e={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${"source"===t?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},n=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],o={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var r,i,a;t.ConnectionMode=void 0,(r=t.ConnectionMode||(t.ConnectionMode={})).Strict="strict",r.Loose="loose",t.PanOnScrollMode=void 0,(i=t.PanOnScrollMode||(t.PanOnScrollMode={})).Free="free",i.Vertical="vertical",i.Horizontal="horizontal",t.SelectionMode=void 0,(a=t.SelectionMode||(t.SelectionMode={})).Partial="partial",a.Full="full";var s,u,c;t.ConnectionLineType=void 0,(s=t.ConnectionLineType||(t.ConnectionLineType={})).Bezier="default",s.Straight="straight",s.Step="step",s.SmoothStep="smoothstep",s.SimpleBezier="simplebezier",t.MarkerType=void 0,(u=t.MarkerType||(t.MarkerType={})).Arrow="arrow",u.ArrowClosed="arrowclosed",t.Position=void 0,(c=t.Position||(t.Position={})).Left="left",c.Top="top",c.Right="right",c.Bottom="bottom";const l={[t.Position.Left]:t.Position.Right,[t.Position.Right]:t.Position.Left,[t.Position.Top]:t.Position.Bottom,[t.Position.Bottom]:t.Position.Top};const h=t=>"id"in t&&"source"in t&&"target"in t,d=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),f=(t,e=[0,0])=>{const{width:n,height:o}=B(t),r=t.origin??e,i=n*r[0],a=o*r[1];return{x:t.position.x-i,y:t.position.y-a}},p=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach((t=>{(void 0===e.filter||e.filter(t))&&(n=b(n,z(t)),o=!0)})),o?P(n):{x:0,y:0,width:0,height:0}},g=(t,e)=>{const n=new Set;return t.forEach((t=>{n.add(t.id)})),e.filter((t=>n.has(t.source)||n.has(t.target)))};function m({nodeId:t,nextPosition:n,nodeLookup:o,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){const s=o.get(t),u=s.parentId?o.get(s.parentId):void 0,{x:c,y:l}=u?u.internals.positionAbsolute:{x:0,y:0},h=s.origin??r;let d=s.extent||i;if("parent"!==s.extent||s.expandParent)u&&H(s.extent)&&(d=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);else if(u){const t=u.measured.width,e=u.measured.height;t&&e&&(d=[[c,l],[c+t,l+e]])}else a?.("005",e.error005());const f=H(d)?v(n,d,s.measured):n;return void 0!==s.measured.width&&void 0!==s.measured.height||a?.("015",e.error015()),{position:{x:f.x-c+(s.measured.width??0)*h[0],y:f.y-l+(s.measured.height??0)*h[1]},positionAbsolute:f}}const y=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),v=(t={x:0,y:0},e,n)=>({x:y(t.x,e[0][0],e[1][0]-(n?.width??0)),y:y(t.y,e[0][1],e[1][1]-(n?.height??0))});function x(t,e,n){const{width:o,height:r}=B(n),{x:i,y:a}=n.internals.positionAbsolute;return v(t,[[i,a],[i+o,a+r]],e)}const w=(t,e,n)=>t<e?y(Math.abs(t-e),1,e)/e:t>n?-y(Math.abs(t-n),1,e)/e:0,_=(t,e,n=15,o=40)=>[w(t.x,o,e.width-o)*n,w(t.y,o,e.height-o)*n],b=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),M=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),P=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),E=(t,e=[0,0])=>{const{x:n,y:o}=d(t)?t.internals.positionAbsolute:f(t,e);return{x:n,y:o,width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}},z=(t,e=[0,0])=>{const{x:n,y:o}=d(t)?t.internals.positionAbsolute:f(t,e);return{x:n,y:o,x2:n+(t.measured?.width??t.width??t.initialWidth??0),y2:o+(t.measured?.height??t.height??t.initialHeight??0)}},N=(t,e)=>P(b(M(t),M(e))),S=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},k=t=>!isNaN(t)&&isFinite(t),I=(t,e)=>{},A=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),T=({x:t,y:e},[n,o,r],i=!1,a=[1,1])=>{const s={x:(t-n)/r,y:(e-o)/r};return i?A(s,a):s},$=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function C(t,e){if("number"==typeof t)return Math.floor(.5*(e-e/(1+t)));if("string"==typeof t&&t.endsWith("px")){const e=parseFloat(t);if(!Number.isNaN(e))return Math.floor(e)}if("string"==typeof t&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const O=(t,e,n,o,r,i)=>{const a=function(t,e,n){if("string"==typeof t||"number"==typeof t){const o=C(t,n),r=C(t,e);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof t){const o=C(t.top??t.y??0,n),r=C(t.bottom??t.y??0,n),i=C(t.left??t.x??0,e),a=C(t.right??t.x??0,e);return{top:o,right:a,bottom:r,left:i,x:i+a,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,e,n),s=(e-a.x)/t.width,u=(n-a.y)/t.height,c=Math.min(s,u),l=y(c,o,r),h=e/2-(t.x+t.width/2)*l,d=n/2-(t.y+t.height/2)*l,f=function(t,e,n,o,r,i){const{x:a,y:s}=$(t,[e,n,o]),{x:u,y:c}=$({x:t.x+t.width,y:t.y+t.height},[e,n,o]),l=r-u,h=i-c;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(l),bottom:Math.floor(h)}}(t,h,d,l,e,n),p=Math.min(f.left-a.left,0),g=Math.min(f.top-a.top,0);return{x:h-p+Math.min(f.right-a.right,0),y:d-g+Math.min(f.bottom-a.bottom,0),zoom:l}},D=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function H(t){return null!=t&&"parent"!==t}function B(t){return{width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}}function L(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:a}=q(t),s=T({x:i-(r?.left??0),y:a-(r?.top??0)},o),{x:u,y:c}=n?A(s,e):s;return{xSnapped:u,ySnapped:c,...s}}const R=t=>({width:t.offsetWidth,height:t.offsetHeight}),X=t=>t?.getRootNode?.()||window?.document,Y=["INPUT","SELECT","TEXTAREA"];const V=t=>"clientX"in t,q=(t,e)=>{const n=V(t),o=n?t.clientX:t.touches?.[0].clientX,r=n?t.clientY:t.touches?.[0].clientY;return{x:o-(e?.left??0),y:r-(e?.top??0)}},Z=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return i&&i.length?Array.from(i).map((e=>{const i=e.getBoundingClientRect();return{id:e.getAttribute("data-handleid"),type:t,nodeId:r,position:e.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...R(e)}})):null};function G({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:a,targetControlY:s}){const u=.125*t+.375*r+.375*a+.125*n,c=.125*e+.375*i+.375*s+.125*o;return[u,c,Math.abs(u-t),Math.abs(c-e)]}function j(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function W({pos:e,x1:n,y1:o,x2:r,y2:i,c:a}){switch(e){case t.Position.Left:return[n-j(n-r,a),o];case t.Position.Right:return[n+j(r-n,a),o];case t.Position.Top:return[n,o-j(o-i,a)];case t.Position.Bottom:return[n,o+j(i-o,a)]}}function F({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,a=Math.abs(o-e)/2;return[i,o<e?o+a:o-a,r,a]}const K=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`;const U={[t.Position.Left]:{x:-1,y:0},[t.Position.Right]:{x:1,y:0},[t.Position.Top]:{x:0,y:-1},[t.Position.Bottom]:{x:0,y:1}},Q=({source:e,sourcePosition:n=t.Position.Bottom,target:o})=>n===t.Position.Left||n===t.Position.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1},J=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function tt(t){return t&&!(!t.internals.handleBounds&&!t.handles?.length)&&!!(t.measured.width||t.width||t.initialWidth)}function et(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,"source"===o.type?e.push(o):"target"===o.type&&n.push(o);return{source:e,target:n}}function nt(e,n,o=t.Position.Left,r=!1){const i=(n?.x??0)+e.internals.positionAbsolute.x,a=(n?.y??0)+e.internals.positionAbsolute.y,{width:s,height:u}=n??B(e);if(r)return{x:i+s/2,y:a+u/2};switch(n?.position??o){case t.Position.Top:return{x:i+s/2,y:a};case t.Position.Right:return{x:i+s,y:a+u/2};case t.Position.Bottom:return{x:i+s/2,y:a+u};case t.Position.Left:return{x:i,y:a+u/2}}}function ot(t,e){return t&&(e?t.find((t=>t.id===e)):t[0])||null}function rt(t,e){if(!t)return"";if("string"==typeof t)return t;return`${e?`${e}__`:""}${Object.keys(t).sort().map((e=>`${e}=${t[e]}`)).join("&")}`}const it={left:0,center:50,right:100},at={top:0,center:50,bottom:100};const st=1e3,ut=10,ct={nodeOrigin:[0,0],nodeExtent:n,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},lt={...ct,checkEquality:!0};function ht(t,e){const n={...t};for(const t in e)void 0!==e[t]&&(n[t]=e[t]);return n}function dt(t,e){if(!t.handles)return t.measured?e?.internals.handleBounds:void 0;const n=[],o=[];for(const e of t.handles){const r={id:e.id,width:e.width??1,height:e.height??1,nodeId:t.id,x:e.x,y:e.y,position:e.position,type:e.type};"source"===e.type?n.push(r):"target"===e.type&&o.push(r)}return{source:n,target:o}}function ft(t){return"manual"===t}function pt(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:s,zIndexMode:u}=ht(ct,o),c=t.parentId,l=e.get(c);if(!l)return void console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}(t,n),r&&!l.parentId&&void 0===l.internals.rootParentIndex&&"auto"===u&&(l.internals.rootParentIndex=++r.i,l.internals.z=l.internals.z+r.i*ut),r&&void 0!==l.internals.rootParentIndex&&(r.i=l.internals.rootParentIndex);const h=i&&!ft(u)?st:0,{x:d,y:p,z:g}=function(t,e,n,o,r,i){const{x:a,y:s}=e.internals.positionAbsolute,u=B(t),c=f(t,n),l=H(t.extent)?v(c,t.extent,u):c;let h=v({x:a+l.x,y:s+l.y},o,u);"parent"===t.extent&&(h=x(h,u,e));const d=gt(t,r,i),p=e.internals.z??0;return{x:h.x,y:h.y,z:p>=d?p+1:d}}(t,l,a,s,h,u),{positionAbsolute:m}=t.internals,y=d!==m.x||p!==m.y;(y||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:y?{x:d,y:p}:m,z:g}})}function gt(t,e,n){const o=k(t.zIndex)?t.zIndex:0;return ft(n)?o:o+(t.selected?e:0)}function mt(t,e,n,o=[0,0]){const r=[],i=new Map;for(const n of t){const t=e.get(n.parentId);if(!t)continue;const o=i.get(n.parentId)?.expandedRect??E(t),r=N(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:t})}return i.size>0&&i.forEach((({expandedRect:e,parent:i},a)=>{const s=i.internals.positionAbsolute,u=B(i),c=i.origin??o,l=e.x<s.x?Math.round(Math.abs(s.x-e.x)):0,h=e.y<s.y?Math.round(Math.abs(s.y-e.y)):0,d=Math.max(u.width,Math.round(e.width)),f=Math.max(u.height,Math.round(e.height)),p=(d-u.width)*c[0],g=(f-u.height)*c[1];(l>0||h>0||p||g)&&(r.push({id:a,type:"position",position:{x:i.position.x-l+p,y:i.position.y-h+g}}),n.get(a)?.forEach((e=>{t.some((t=>t.id===e.id))||r.push({id:e.id,type:"position",position:{x:e.position.x+l,y:e.position.y+h}})}))),(u.width<e.width||u.height<e.height||l||h)&&r.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:d+(l?c[0]*l-p:0),height:f+(h?c[1]*h-g:0)}})})),r}function yt(t,e,n,o,r,i){let a=r;const s=o.get(a)||new Map;o.set(a,s.set(n,e)),a=`${r}-${t}`;const u=o.get(a)||new Map;if(o.set(a,u.set(n,e)),i){a=`${r}-${t}-${i}`;const s=o.get(a)||new Map;o.set(a,s.set(n,e))}}var vt={value:()=>{}};function xt(){for(var t,e=0,n=arguments.length,o={};e<n;++e){if(!(t=arguments[e]+"")||t in o||/[\s.]/.test(t))throw new Error("illegal type: "+t);o[t]=[]}return new wt(o)}function wt(t){this._=t}function _t(t,e){for(var n,o=0,r=t.length;o<r;++o)if((n=t[o]).name===e)return n.value}function bt(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=vt,t=t.slice(0,o).concat(t.slice(o+1));break}return null!=n&&t.push({name:e,value:n}),t}wt.prototype=xt.prototype={constructor:wt,on:function(t,e){var n,o,r=this._,i=(o=r,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!o.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=i[a]).type)r[n]=bt(r[n],t.name,e);else if(null==e)for(n in r)r[n]=bt(r[n],t.name,null);return this}for(;++a<s;)if((n=(t=i[a]).type)&&(n=_t(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new wt(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,n=(o=this._[t]).length;i<n;++i)o[i].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};var Mt="http://www.w3.org/1999/xhtml",Pt={svg:"http://www.w3.org/2000/svg",xhtml:Mt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Et(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Pt.hasOwnProperty(e)?{space:Pt[e],local:t}:t}function zt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Mt&&e.documentElement.namespaceURI===Mt?e.createElement(t):e.createElementNS(n,t)}}function Nt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function St(t){var e=Et(t);return(e.local?Nt:zt)(e)}function kt(){}function It(t){return null==t?kt:function(){return this.querySelector(t)}}function At(){return[]}function Tt(t){return null==t?At:function(){return this.querySelectorAll(t)}}function $t(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}function Ct(t){return function(){return this.matches(t)}}function Ot(t){return function(e){return e.matches(t)}}var Dt=Array.prototype.find;function Ht(){return this.firstElementChild}var Bt=Array.prototype.filter;function Lt(){return Array.from(this.children)}function Rt(t){return new Array(t.length)}function Xt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function Yt(t,e,n,o,r,i){for(var a,s=0,u=e.length,c=i.length;s<c;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Xt(t,i[s]);for(;s<u;++s)(a=e[s])&&(r[s]=a)}function Vt(t,e,n,o,r,i,a){var s,u,c,l=new Map,h=e.length,d=i.length,f=new Array(h);for(s=0;s<h;++s)(u=e[s])&&(f[s]=c=a.call(u,u.__data__,s,e)+"",l.has(c)?r[s]=u:l.set(c,u));for(s=0;s<d;++s)c=a.call(t,i[s],s,i)+"",(u=l.get(c))?(o[s]=u,u.__data__=i[s],l.delete(c)):n[s]=new Xt(t,i[s]);for(s=0;s<h;++s)(u=e[s])&&l.get(f[s])===u&&(r[s]=u)}function qt(t){return t.__data__}function Zt(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Gt(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function jt(t){return function(){this.removeAttribute(t)}}function Wt(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ft(t,e){return function(){this.setAttribute(t,e)}}function Kt(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Ut(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function Qt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Jt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function te(t){return function(){this.style.removeProperty(t)}}function ee(t,e,n){return function(){this.style.setProperty(t,e,n)}}function ne(t,e,n){return function(){var o=e.apply(this,arguments);null==o?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function oe(t,e){return t.style.getPropertyValue(e)||Jt(t).getComputedStyle(t,null).getPropertyValue(e)}function re(t){return function(){delete this[t]}}function ie(t,e){return function(){this[t]=e}}function ae(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function se(t){return t.trim().split(/^|\s+/)}function ue(t){return t.classList||new ce(t)}function ce(t){this._node=t,this._names=se(t.getAttribute("class")||"")}function le(t,e){for(var n=ue(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function he(t,e){for(var n=ue(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function de(t){return function(){le(this,t)}}function fe(t){return function(){he(this,t)}}function pe(t,e){return function(){(e.apply(this,arguments)?le:he)(this,t)}}function ge(){this.textContent=""}function me(t){return function(){this.textContent=t}}function ye(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function ve(){this.innerHTML=""}function xe(t){return function(){this.innerHTML=t}}function we(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function _e(){this.nextSibling&&this.parentNode.appendChild(this)}function be(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Me(){return null}function Pe(){var t=this.parentNode;t&&t.removeChild(this)}function Ee(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ze(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ne(t){return function(){var e=this.__on;if(e){for(var n,o=0,r=-1,i=e.length;o<i;++o)n=e[o],t.type&&n.type!==t.type||n.name!==t.name?e[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?e.length=r:delete this.__on}}}function Se(t,e,n){return function(){var o,r=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var a=0,s=r.length;a<s;++a)if((o=r[a]).type===t.type&&o.name===t.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=e);this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=[o]}}function ke(t,e,n){var o=Jt(t),r=o.CustomEvent;"function"==typeof r?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function Ie(t,e){return function(){return ke(this,t,e)}}function Ae(t,e){return function(){return ke(this,t,e.apply(this,arguments))}}Xt.prototype={constructor:Xt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},ce.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var Te=[null];function $e(t,e){this._groups=t,this._parents=e}function Ce(){return new $e([[document.documentElement]],Te)}function Oe(t){return"string"==typeof t?new $e([[document.querySelector(t)]],[document.documentElement]):new $e([[t]],Te)}function De(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}$e.prototype=Ce.prototype={constructor:$e,select:function(t){"function"!=typeof t&&(t=It(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i,a,s=e[r],u=s.length,c=o[r]=new Array(u),l=0;l<u;++l)(i=s[l])&&(a=t.call(i,i.__data__,l,s))&&("__data__"in i&&(a.__data__=i.__data__),c[l]=a);return new $e(o,this._parents)},selectAll:function(t){t="function"==typeof t?$t(t):Tt(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var a,s=e[i],u=s.length,c=0;c<u;++c)(a=s[c])&&(o.push(t.call(a,a.__data__,c,s)),r.push(a));return new $e(o,r)},selectChild:function(t){return this.select(null==t?Ht:function(t){return function(){return Dt.call(this.children,t)}}("function"==typeof t?t:Ot(t)))},selectChildren:function(t){return this.selectAll(null==t?Lt:function(t){return function(){return Bt.call(this.children,t)}}("function"==typeof t?t:Ot(t)))},filter:function(t){"function"!=typeof t&&(t=Ct(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i,a=e[r],s=a.length,u=o[r]=[],c=0;c<s;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&u.push(i);return new $e(o,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,qt);var n,o=e?Vt:Yt,r=this._parents,i=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=i.length,s=new Array(a),u=new Array(a),c=new Array(a),l=0;l<a;++l){var h=r[l],d=i[l],f=d.length,p=Zt(t.call(h,h&&h.__data__,l,r)),g=p.length,m=u[l]=new Array(g),y=s[l]=new Array(g);o(h,d,m,y,c[l]=new Array(f),p,e);for(var v,x,w=0,_=0;w<g;++w)if(v=m[w]){for(w>=_&&(_=w+1);!(x=y[_])&&++_<g;);v._next=x||null}}return(s=new $e(s,r))._enter=u,s._exit=c,s},enter:function(){return new $e(this._enter||this._groups.map(Rt),this._parents)},exit:function(){return new $e(this._exit||this._groups.map(Rt),this._parents)},join:function(t,e,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof t?(o=t(o))&&(o=o.selection()):o=o.append(t+""),null!=e&&(r=e(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,a=Math.min(r,i),s=new Array(r),u=0;u<a;++u)for(var c,l=n[u],h=o[u],d=l.length,f=s[u]=new Array(d),p=0;p<d;++p)(c=l[p]||h[p])&&(f[p]=c);for(;u<r;++u)s[u]=n[u];return new $e(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o,r=t[e],i=r.length-1,a=r[i];--i>=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=Gt);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var a,s=n[i],u=s.length,c=r[i]=new Array(u),l=0;l<u;++l)(a=s[l])&&(c[l]=a);c.sort(e)}return new $e(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var a=o[r];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r,i=e[n],a=0,s=i.length;a<s;++a)(r=i[a])&&t.call(r,r.__data__,a,i);return this},attr:function(t,e){var n=Et(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==e?n.local?Wt:jt:"function"==typeof e?n.local?Qt:Ut:n.local?Kt:Ft)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?te:"function"==typeof e?ne:ee)(t,e,null==n?"":n)):oe(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?re:"function"==typeof e?ae:ie)(t,e)):this.node()[t]},classed:function(t,e){var n=se(t+"");if(arguments.length<2){for(var o=ue(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?pe:e?de:fe)(n,e))},text:function(t){return arguments.length?this.each(null==t?ge:("function"==typeof t?ye:me)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?ve:("function"==typeof t?we:xe)(t)):this.node().innerHTML},raise:function(){return this.each(_e)},lower:function(){return this.each(be)},append:function(t){var e="function"==typeof t?t:St(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:St(t),o=null==e?Me:"function"==typeof e?e:It(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))},remove:function(){return this.each(Pe)},clone:function(t){return this.select(t?ze:Ee)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var o,r,i=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=i.length;if(!(arguments.length<2)){for(s=e?Se:Ne,o=0;o<a;++o)this.each(s(i[o],e,n));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(o=0,u=s[c];o<a;++o)if((r=i[o]).type===u.type&&r.name===u.name)return u.value},dispatch:function(t,e){return this.each(("function"==typeof e?Ae:Ie)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o,r=t[e],i=0,a=r.length;i<a;++i)(o=r[i])&&(yield o)}};const He={passive:!1},Be={capture:!0,passive:!1};function Le(t){t.stopImmediatePropagation()}function Re(t){t.preventDefault(),t.stopImmediatePropagation()}function Xe(t){var e=t.document.documentElement,n=Oe(t).on("dragstart.drag",Re,Be);"onselectstart"in e?n.on("selectstart.drag",Re,Be):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ye(t,e){var n=t.document.documentElement,o=Oe(t).on("dragstart.drag",null);e&&(o.on("click.drag",Re,Be),setTimeout((function(){o.on("click.drag",null)}),0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var Ve=t=>()=>t;function qe(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:a,y:s,dx:u,dy:c,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:l}})}function Ze(t){return!t.ctrlKey&&!t.button}function Ge(){return this.parentNode}function je(t,e){return null==e?{x:t.x,y:t.y}:e}function We(){return navigator.maxTouchPoints||"ontouchstart"in this}function Fe(){var t,e,n,o,r=Ze,i=Ge,a=je,s=We,u={},c=xt("start","drag","end"),l=0,h=0;function d(t){t.on("mousedown.drag",f).filter(s).on("touchstart.drag",m).on("touchmove.drag",y,He).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,s){if(!o&&r.call(this,a,s)){var u=x(this,i.call(this,a,s),a,s,"mouse");u&&(Oe(a.view).on("mousemove.drag",p,Be).on("mouseup.drag",g,Be),Xe(a.view),Le(a),n=!1,t=a.clientX,e=a.clientY,u("start",a))}}function p(o){if(Re(o),!n){var r=o.clientX-t,i=o.clientY-e;n=r*r+i*i>h}u.mouse("drag",o)}function g(t){Oe(t.view).on("mousemove.drag mouseup.drag",null),Ye(t.view,n),Re(t),u.mouse("end",t)}function m(t,e){if(r.call(this,t,e)){var n,o,a=t.changedTouches,s=i.call(this,t,e),u=a.length;for(n=0;n<u;++n)(o=x(this,s,t,e,a[n].identifier,a[n]))&&(Le(t),o("start",t,a[n]))}}function y(t){var e,n,o=t.changedTouches,r=o.length;for(e=0;e<r;++e)(n=u[o[e].identifier])&&(Re(t),n("drag",t,o[e]))}function v(t){var e,n,r=t.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout((function(){o=null}),500),e=0;e<i;++e)(n=u[r[e].identifier])&&(Le(t),n("end",t,r[e]))}function x(t,e,n,o,r,i){var s,h,f,p=c.copy(),g=De(i||n,e);if(null!=(f=a.call(t,new qe("beforestart",{sourceEvent:n,target:d,identifier:r,active:l,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),o)))return s=f.x-g[0]||0,h=f.y-g[1]||0,function n(i,a,c){var m,y=g;switch(i){case"start":u[r]=n,m=l++;break;case"end":delete u[r],--l;case"drag":g=De(c||a,e),m=l}p.call(i,t,new qe(i,{sourceEvent:a,subject:f,target:d,identifier:r,active:m,x:g[0]+s,y:g[1]+h,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),o)}}return d.filter=function(t){return arguments.length?(r="function"==typeof t?t:Ve(!!t),d):r},d.container=function(t){return arguments.length?(i="function"==typeof t?t:Ve(t),d):i},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:Ve(t),d):a},d.touchable=function(t){return arguments.length?(s="function"==typeof t?t:Ve(!!t),d):s},d.on=function(){var t=c.on.apply(c,arguments);return t===c?d:t},d.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,d):Math.sqrt(h)},d}function Ke(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return!!n&&(!!n.selected||Ke(n,e))}function Ue(t,e,n){let o=t;do{if(o?.matches?.(e))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Qe({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){const r=[];for(const[t,i]of e){const e=n.get(t)?.internals.userNode;e&&r.push({...e,position:i.position,dragging:o})}if(!t)return[r[0],r];const i=n.get(t)?.internals.userNode;return[i?{...i,position:e.get(t)?.position||i.position,dragging:o}:r[0],r]}qe.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const Je=250;function tn(t,e,n,o){let r=[],i=1/0;const a=function(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:2*n,height:2*n};for(const t of e.values())S(r,E(t))>0&&o.push(t);return o}(t,n,e+Je);for(const n of a){const a=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const s of a){if(o.nodeId===s.nodeId&&o.type===s.type&&o.id===s.id)continue;const{x:a,y:u}=nt(n,s,s.position,!0),c=Math.sqrt(Math.pow(a-t.x,2)+Math.pow(u-t.y,2));c>e||(c<i?(r=[{...s,x:a,y:u}],i=c):c===i&&r.push({...s,x:a,y:u}))}}if(!r.length)return null;if(r.length>1){const t="source"===o.type?"target":"source";return r.find((e=>e.type===t))??r[0]}return r[0]}function en(t,e,n,o,r,i=!1){const a=o.get(t);if(!a)return null;const s="strict"===r?a.internals.handleBounds?.[e]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],u=(n?s?.find((t=>t.id===n)):s?.[0])??null;return u&&i?{...u,...nt(a,u,u.position,!0)}:u}function nn(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}const on=()=>!0;function rn(e,{handle:n,connectionMode:o,fromNodeId:r,fromHandleId:i,fromType:a,doc:s,lib:u,flowId:c,isValidConnection:l=on,nodeLookup:h}){const d="target"===a,f=n?s.querySelector(`.${u}-flow__handle[data-id="${c}-${n?.nodeId}-${n?.id}-${n?.type}"]`):null,{x:p,y:g}=q(e),m=s.elementFromPoint(p,g),y=m?.classList.contains(`${u}-flow__handle`)?m:f,v={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const e=nn(void 0,y),n=y.getAttribute("data-nodeid"),a=y.getAttribute("data-handleid"),s=y.classList.contains("connectable"),u=y.classList.contains("connectableend");if(!n||!e)return v;const c={source:d?n:r,sourceHandle:d?a:i,target:d?r:n,targetHandle:d?i:a};v.connection=c;const f=s&&u&&(o===t.ConnectionMode.Strict?d&&"source"===e||!d&&"target"===e:n!==r||a!==i);v.isValid=f&&l(c),v.toHandle=en(n,e,a,h,o,!0)}return v}const an={onPointerDown:function(e,{connectionMode:n,connectionRadius:o,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:s,domNode:u,nodeLookup:c,lib:h,autoPanOnConnect:d,flowId:f,panBy:p,cancelConnection:g,onConnectStart:m,onConnect:y,onConnectEnd:v,isValidConnection:x=on,onReconnectEnd:w,updateConnection:b,getTransform:M,getFromHandle:P,autoPanSpeed:E,dragThreshold:z=1,handleDomNode:N}){const S=X(e.target);let k,I=0;const{x:A,y:C}=q(e),O=nn(a,N),D=u?.getBoundingClientRect();let H=!1;if(!D||!O)return;const B=en(i,O,r,c,n);if(!B)return;let L=q(e,D),R=!1,Y=null,V=!1,Z=null;function G(){if(!d||!D)return;const[t,e]=_(L,D,E);p({x:t,y:e}),I=requestAnimationFrame(G)}const j={...B,nodeId:i,type:O,position:B.position},W=c.get(i);let F={inProgress:!0,isValid:null,from:nt(W,j,t.Position.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:W,to:L,toHandle:null,toPosition:l[j.position],toNode:null,pointer:L};function K(){H=!0,b(F),m?.(e,{nodeId:i,handleId:r,handleType:O})}function U(e){if(!H){const{x:t,y:n}=q(e),o=t-A,r=n-C;if(!(o*o+r*r>z*z))return;K()}if(!P()||!j)return void Q(e);const a=M();L=q(e,D),k=tn(T(L,a,!1,[1,1]),o,c,j),R||(G(),R=!0);const u=rn(e,{handle:k,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:s?"target":"source",isValidConnection:x,doc:S,lib:h,flowId:f,nodeLookup:c});Z=u.handleDomNode,Y=u.connection,V=function(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}(!!k,u.isValid);const d=c.get(i),p=d?nt(d,j,t.Position.Left,!0):F.from,g={...F,from:p,isValid:V,to:u.toHandle&&V?$({x:u.toHandle.x,y:u.toHandle.y},a):L,toHandle:u.toHandle,toPosition:V&&u.toHandle?u.toHandle.position:l[j.position],toNode:u.toHandle?c.get(u.toHandle.nodeId):null,pointer:L};b(g),F=g}function Q(t){if(!("touches"in t&&t.touches.length>0)){if(H){(k||Z)&&Y&&V&&y?.(Y);const{inProgress:e,...n}=F,o={...n,toPosition:F.toHandle?F.toPosition:null};v?.(t,o),a&&w?.(t,o)}g(),cancelAnimationFrame(I),R=!1,V=!1,Y=null,Z=null,S.removeEventListener("mousemove",U),S.removeEventListener("mouseup",Q),S.removeEventListener("touchmove",U),S.removeEventListener("touchend",Q)}}0===z&&K(),S.addEventListener("mousemove",U),S.addEventListener("mouseup",Q),S.addEventListener("touchmove",U),S.addEventListener("touchend",Q)},isValid:rn};function sn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function un(t,e){var n=Object.create(t.prototype);for(var o in e)n[o]=e[o];return n}function cn(){}var ln=.7,hn=1/ln,dn="\\s*([+-]?\\d+)\\s*",fn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",pn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",gn=/^#([0-9a-f]{3,8})$/,mn=new RegExp(`^rgb\\(${dn},${dn},${dn}\\)$`),yn=new RegExp(`^rgb\\(${pn},${pn},${pn}\\)$`),vn=new RegExp(`^rgba\\(${dn},${dn},${dn},${fn}\\)$`),xn=new RegExp(`^rgba\\(${pn},${pn},${pn},${fn}\\)$`),wn=new RegExp(`^hsl\\(${fn},${pn},${pn}\\)$`),_n=new RegExp(`^hsla\\(${fn},${pn},${pn},${fn}\\)$`),bn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Mn(){return this.rgb().formatHex()}function Pn(){return this.rgb().formatRgb()}function En(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=gn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?zn(e):3===n?new kn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Nn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Nn(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=mn.exec(t))?new kn(e[1],e[2],e[3],1):(e=yn.exec(t))?new kn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=vn.exec(t))?Nn(e[1],e[2],e[3],e[4]):(e=xn.exec(t))?Nn(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=wn.exec(t))?On(e[1],e[2]/100,e[3]/100,1):(e=_n.exec(t))?On(e[1],e[2]/100,e[3]/100,e[4]):bn.hasOwnProperty(t)?zn(bn[t]):"transparent"===t?new kn(NaN,NaN,NaN,0):null}function zn(t){return new kn(t>>16&255,t>>8&255,255&t,1)}function Nn(t,e,n,o){return o<=0&&(t=e=n=NaN),new kn(t,e,n,o)}function Sn(t,e,n,o){return 1===arguments.length?((r=t)instanceof cn||(r=En(r)),r?new kn((r=r.rgb()).r,r.g,r.b,r.opacity):new kn):new kn(t,e,n,null==o?1:o);var r}function kn(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}function In(){return`#${Cn(this.r)}${Cn(this.g)}${Cn(this.b)}`}function An(){const t=Tn(this.opacity);return`${1===t?"rgb(":"rgba("}${$n(this.r)}, ${$n(this.g)}, ${$n(this.b)}${1===t?")":`, ${t})`}`}function Tn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function $n(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Cn(t){return((t=$n(t))<16?"0":"")+t.toString(16)}function On(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Hn(t,e,n,o)}function Dn(t){if(t instanceof Hn)return new Hn(t.h,t.s,t.l,t.opacity);if(t instanceof cn||(t=En(t)),!t)return new Hn;if(t instanceof Hn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,o=t.b/255,r=Math.min(e,n,o),i=Math.max(e,n,o),a=NaN,s=i-r,u=(i+r)/2;return s?(a=e===i?(n-o)/s+6*(n<o):n===i?(o-e)/s+2:(e-n)/s+4,s/=u<.5?i+r:2-i-r,a*=60):s=u>0&&u<1?0:a,new Hn(a,s,u,t.opacity)}function Hn(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}function Bn(t){return(t=(t||0)%360)<0?t+360:t}function Ln(t){return Math.max(0,Math.min(1,t||0))}function Rn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}sn(cn,En,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Mn,formatHex:Mn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Dn(this).formatHsl()},formatRgb:Pn,toString:Pn}),sn(kn,Sn,un(cn,{brighter(t){return t=null==t?hn:Math.pow(hn,t),new kn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?ln:Math.pow(ln,t),new kn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new kn($n(this.r),$n(this.g),$n(this.b),Tn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:In,formatHex:In,formatHex8:function(){return`#${Cn(this.r)}${Cn(this.g)}${Cn(this.b)}${Cn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:An,toString:An})),sn(Hn,(function(t,e,n,o){return 1===arguments.length?Dn(t):new Hn(t,e,n,null==o?1:o)}),un(cn,{brighter(t){return t=null==t?hn:Math.pow(hn,t),new Hn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?ln:Math.pow(ln,t),new Hn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,r=2*n-o;return new kn(Rn(t>=240?t-240:t+120,r,o),Rn(t,r,o),Rn(t<120?t+240:t-120,r,o),this.opacity)},clamp(){return new Hn(Bn(this.h),Ln(this.s),Ln(this.l),Tn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Tn(this.opacity);return`${1===t?"hsl(":"hsla("}${Bn(this.h)}, ${100*Ln(this.s)}%, ${100*Ln(this.l)}%${1===t?")":`, ${t})`}`}}));var Xn=t=>()=>t;function Yn(t){return 1==(t=+t)?Vn:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}(e,n,t):Xn(isNaN(e)?n:e)}}function Vn(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Xn(isNaN(t)?e:t)}var qn=function t(e){var n=Yn(e);function o(t,e){var o=n((t=Sn(t)).r,(e=Sn(e)).r),r=n(t.g,e.g),i=n(t.b,e.b),a=Vn(t.opacity,e.opacity);return function(e){return t.r=o(e),t.g=r(e),t.b=i(e),t.opacity=a(e),t+""}}return o.gamma=t,o}(1);function Zn(t,e){e||(e=[]);var n,o=t?Math.min(e.length,t.length):0,r=e.slice();return function(i){for(n=0;n<o;++n)r[n]=t[n]*(1-i)+e[n]*i;return r}}function Gn(t,e){var n,o=e?e.length:0,r=t?Math.min(o,t.length):0,i=new Array(r),a=new Array(o);for(n=0;n<r;++n)i[n]=Jn(t[n],e[n]);for(;n<o;++n)a[n]=e[n];return function(t){for(n=0;n<r;++n)a[n]=i[n](t);return a}}function jn(t,e){var n=new Date;return t=+t,e=+e,function(o){return n.setTime(t*(1-o)+e*o),n}}function Wn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Fn(t,e){var n,o={},r={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?o[n]=Jn(t[n],e[n]):r[n]=e[n];return function(t){for(n in o)r[n]=o[n](t);return r}}var Kn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Un=new RegExp(Kn.source,"g");function Qn(t,e){var n,o,r,i=Kn.lastIndex=Un.lastIndex=0,a=-1,s=[],u=[];for(t+="",e+="";(n=Kn.exec(t))&&(o=Un.exec(e));)(r=o.index)>i&&(r=e.slice(i,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,u.push({i:a,x:Wn(n,o)})),i=Un.lastIndex;return i<e.length&&(r=e.slice(i),s[a]?s[a]+=r:s[++a]=r),s.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,o=0;o<e;++o)s[(n=u[o]).i]=n.x(t);return s.join("")})}function Jn(t,e){var n,o,r=typeof e;return null==e||"boolean"===r?Xn(e):("number"===r?Wn:"string"===r?(n=En(e))?(e=n,qn):Qn:e instanceof En?qn:e instanceof Date?jn:(o=e,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(e)?Gn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Fn:Wn:Zn))(t,e)}var to,eo=180/Math.PI,no={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function oo(t,e,n,o,r,i){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*o)&&(n-=t*u,o-=e*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),t*o<e*n&&(t=-t,e=-e,u=-u,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(e,t)*eo,skewX:Math.atan(u)*eo,scaleX:a,scaleY:s}}function ro(t,e,n,o){function r(t){return t.length?t.pop()+" ":""}return function(i,a){var s=[],u=[];return i=t(i),a=t(a),function(t,o,r,i,a,s){if(t!==r||o!==i){var u=a.push("translate(",null,e,null,n);s.push({i:u-4,x:Wn(t,r)},{i:u-2,x:Wn(o,i)})}else(r||i)&&a.push("translate("+r+e+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,s,u),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:Wn(t,e)})):e&&n.push(r(n)+"rotate("+e+o)}(i.rotate,a.rotate,s,u),function(t,e,n,i){t!==e?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:Wn(t,e)}):e&&n.push(r(n)+"skewX("+e+o)}(i.skewX,a.skewX,s,u),function(t,e,n,o,i,a){if(t!==n||e!==o){var s=i.push(r(i)+"scale(",null,",",null,")");a.push({i:s-4,x:Wn(t,n)},{i:s-2,x:Wn(e,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,u),i=a=null,function(t){for(var e,n=-1,o=u.length;++n<o;)s[(e=u[n]).i]=e.x(t);return s.join("")}}}var io=ro((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?no:oo(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),ao=ro((function(t){return null==t?no:(to||(to=document.createElementNS("http://www.w3.org/2000/svg","g")),to.setAttribute("transform",t),(t=to.transform.baseVal.consolidate())?oo((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):no)}),", ",")",")");function so(t){return((t=Math.exp(t))+1/t)/2}var uo,co,lo=function t(e,n,o){function r(t,r){var i,a,s=t[0],u=t[1],c=t[2],l=r[0],h=r[1],d=r[2],f=l-s,p=h-u,g=f*f+p*p;if(g<1e-12)a=Math.log(d/c)/e,i=function(t){return[s+t*f,u+t*p,c*Math.exp(e*t*a)]};else{var m=Math.sqrt(g),y=(d*d-c*c+o*g)/(2*c*n*m),v=(d*d-c*c-o*g)/(2*d*n*m),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);a=(w-x)/e,i=function(t){var o,r=t*a,i=so(x),l=c/(n*m)*(i*(o=e*r+x,((o=Math.exp(2*o))-1)/(o+1))-function(t){return((t=Math.exp(t))-1/t)/2}(x));return[s+l*f,u+l*p,c*i/so(e*r+x)]}}return i.duration=1e3*a*e/Math.SQRT2,i}return r.rho=function(e){var n=Math.max(.001,+e),o=n*n;return t(n,o,o*o)},r}(Math.SQRT2,2,4),ho=0,fo=0,po=0,go=1e3,mo=0,yo=0,vo=0,xo="object"==typeof performance&&performance.now?performance:Date,wo="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function _o(){return yo||(wo(bo),yo=xo.now()+vo)}function bo(){yo=0}function Mo(){this._call=this._time=this._next=null}function Po(t,e,n){var o=new Mo;return o.restart(t,e,n),o}function Eo(){yo=(mo=xo.now())+vo,ho=fo=0;try{!function(){_o(),++ho;for(var t,e=uo;e;)(t=yo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ho}()}finally{ho=0,function(){var t,e,n=uo,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:uo=e);co=t,No(o)}(),yo=0}}function zo(){var t=xo.now(),e=t-mo;e>go&&(vo-=e,mo=t)}function No(t){ho||(fo&&(fo=clearTimeout(fo)),t-yo>24?(t<1/0&&(fo=setTimeout(Eo,t-xo.now()-vo)),po&&(po=clearInterval(po))):(po||(mo=xo.now(),po=setInterval(zo,go)),ho=1,wo(Eo)))}function So(t,e,n){var o=new Mo;return e=null==e?0:+e,o.restart((n=>{o.stop(),t(n+e)}),e,n),o}Mo.prototype=Po.prototype={constructor:Mo,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?_o():+n)+(null==e?0:+e),this._next||co===this||(co?co._next=this:uo=this,co=this),this._call=t,this._time=n,No()},stop:function(){this._call&&(this._call=null,this._time=1/0,No())}};var ko=xt("start","end","cancel","interrupt"),Io=[],Ao=0,To=1,$o=2,Co=3,Oo=4,Do=5,Ho=6;function Bo(t,e,n,o,r,i){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var o,r=t.__transition;function i(t){n.state=To,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(i){var c,l,h,d;if(n.state!==To)return u();for(c in r)if((d=r[c]).name===n.name){if(d.state===Co)return So(a);d.state===Oo?(d.state=Ho,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[c]):+c<e&&(d.state=Ho,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[c])}if(So((function(){n.state===Co&&(n.state=Oo,n.timer.restart(s,n.delay,n.time),s(i))})),n.state=$o,n.on.call("start",t,t.__data__,n.index,n.group),n.state===$o){for(n.state=Co,o=new Array(h=n.tween.length),c=0,l=-1;c<h;++c)(d=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(o[++l]=d);o.length=l+1}}function s(e){for(var r=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(u),n.state=Do,1),i=-1,a=o.length;++i<a;)o[i].call(t,r);n.state===Do&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){for(var o in n.state=Ho,n.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=n,n.timer=Po(i,0,n.time)}(t,n,{name:e,index:o,group:r,on:ko,tween:Io,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Ao})}function Lo(t,e){var n=Xo(t,e);if(n.state>Ao)throw new Error("too late; already scheduled");return n}function Ro(t,e){var n=Xo(t,e);if(n.state>Co)throw new Error("too late; already running");return n}function Xo(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Yo(t,e){var n,o,r,i=t.__transition,a=!0;if(i){for(r in e=null==e?null:e+"",i)(n=i[r]).name===e?(o=n.state>$o&&n.state<Do,n.state=Ho,n.timer.stop(),n.on.call(o?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[r]):a=!1;a&&delete t.__transition}}function Vo(t,e){var n,o;return function(){var r=Ro(this,t),i=r.tween;if(i!==n)for(var a=0,s=(o=n=i).length;a<s;++a)if(o[a].name===e){(o=o.slice()).splice(a,1);break}r.tween=o}}function qo(t,e,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=Ro(this,t),a=i.tween;if(a!==o){r=(o=a).slice();for(var s={name:e,value:n},u=0,c=r.length;u<c;++u)if(r[u].name===e){r[u]=s;break}u===c&&r.push(s)}i.tween=r}}function Zo(t,e,n){var o=t._id;return t.each((function(){var t=Ro(this,o);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return Xo(t,o).value[e]}}function Go(t,e){var n;return("number"==typeof e?Wn:e instanceof En?qn:(n=En(e))?(e=n,qn):Qn)(t,e)}function jo(t){return function(){this.removeAttribute(t)}}function Wo(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Fo(t,e,n){var o,r,i=n+"";return function(){var a=this.getAttribute(t);return a===i?null:a===o?r:r=e(o=a,n)}}function Ko(t,e,n){var o,r,i=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===o?r:r=e(o=a,n)}}function Uo(t,e,n){var o,r,i;return function(){var a,s,u=n(this);if(null!=u)return(a=this.getAttribute(t))===(s=u+"")?null:a===o&&s===r?i:(r=s,i=e(o=a,u));this.removeAttribute(t)}}function Qo(t,e,n){var o,r,i;return function(){var a,s,u=n(this);if(null!=u)return(a=this.getAttributeNS(t.space,t.local))===(s=u+"")?null:a===o&&s===r?i:(r=s,i=e(o=a,u));this.removeAttributeNS(t.space,t.local)}}function Jo(t,e){var n,o;function r(){var r=e.apply(this,arguments);return r!==o&&(n=(o=r)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,r)),n}return r._value=e,r}function tr(t,e){var n,o;function r(){var r=e.apply(this,arguments);return r!==o&&(n=(o=r)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,r)),n}return r._value=e,r}function er(t,e){return function(){Lo(this,t).delay=+e.apply(this,arguments)}}function nr(t,e){return e=+e,function(){Lo(this,t).delay=e}}function or(t,e){return function(){Ro(this,t).duration=+e.apply(this,arguments)}}function rr(t,e){return e=+e,function(){Ro(this,t).duration=e}}var ir=Ce.prototype.constructor;function ar(t){return function(){this.style.removeProperty(t)}}var sr=0;function ur(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function cr(){return++sr}var lr=Ce.prototype;ur.prototype={constructor:ur,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=It(t));for(var o=this._groups,r=o.length,i=new Array(r),a=0;a<r;++a)for(var s,u,c=o[a],l=c.length,h=i[a]=new Array(l),d=0;d<l;++d)(s=c[d])&&(u=t.call(s,s.__data__,d,c))&&("__data__"in s&&(u.__data__=s.__data__),h[d]=u,Bo(h[d],e,n,d,h,Xo(s,n)));return new ur(i,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Tt(t));for(var o=this._groups,r=o.length,i=[],a=[],s=0;s<r;++s)for(var u,c=o[s],l=c.length,h=0;h<l;++h)if(u=c[h]){for(var d,f=t.call(u,u.__data__,h,c),p=Xo(u,n),g=0,m=f.length;g<m;++g)(d=f[g])&&Bo(d,e,n,g,f,p);i.push(f),a.push(u)}return new ur(i,a,e,n)},selectChild:lr.selectChild,selectChildren:lr.selectChildren,filter:function(t){"function"!=typeof t&&(t=Ct(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i,a=e[r],s=a.length,u=o[r]=[],c=0;c<s;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&u.push(i);return new ur(o,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),a=new Array(o),s=0;s<i;++s)for(var u,c=e[s],l=n[s],h=c.length,d=a[s]=new Array(h),f=0;f<h;++f)(u=c[f]||l[f])&&(d[f]=u);for(;s<o;++s)a[s]=e[s];return new ur(a,this._parents,this._name,this._id)},selection:function(){return new ir(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=cr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],u=s.length,c=0;c<u;++c)if(a=s[c]){var l=Xo(a,e);Bo(a,t,n,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new ur(o,this._parents,t,n)},call:lr.call,nodes:lr.nodes,node:lr.node,size:lr.size,empty:lr.empty,each:lr.each,on:function(t,e){var n=this._id;return arguments.length<2?Xo(this.node(),n).on.on(t):this.each(function(t,e,n){var o,r,i=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Lo:Ro;return function(){var a=i(this,t),s=a.on;s!==o&&(r=(o=s).copy()).on(e,n),a.on=r}}(n,t,e))},attr:function(t,e){var n=Et(t),o="transform"===n?ao:Go;return this.attrTween(t,"function"==typeof e?(n.local?Qo:Uo)(n,o,Zo(this,"attr."+t,e)):null==e?(n.local?Wo:jo)(n):(n.local?Ko:Fo)(n,o,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var o=Et(t);return this.tween(n,(o.local?Jo:tr)(o,e))},style:function(t,e,n){var o="transform"==(t+="")?io:Go;return null==e?this.styleTween(t,function(t,e){var n,o,r;return function(){var i=oe(this,t),a=(this.style.removeProperty(t),oe(this,t));return i===a?null:i===n&&a===o?r:r=e(n=i,o=a)}}(t,o)).on("end.style."+t,ar(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var o,r,i;return function(){var a=oe(this,t),s=n(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=oe(this,t)),a===u?null:a===o&&u===r?i:(r=u,i=e(o=a,s))}}(t,o,Zo(this,"style."+t,e))).each(function(t,e){var n,o,r,i,a="style."+e,s="end."+a;return function(){var u=Ro(this,t),c=u.on,l=null==u.value[a]?i||(i=ar(e)):void 0;c===n&&r===l||(o=(n=c).copy()).on(s,r=l),u.on=o}}(this._id,t)):this.styleTween(t,function(t,e,n){var o,r,i=n+"";return function(){var a=oe(this,t);return a===i?null:a===o?r:r=e(o=a,n)}}(t,o,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==e)return this.tween(o,null);if("function"!=typeof e)throw new Error;return this.tween(o,function(t,e,n){var o,r;function i(){var i=e.apply(this,arguments);return i!==r&&(o=(r=i)&&function(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}(t,i,n)),o}return i._value=e,i}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Zo(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function o(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&function(t){return function(e){this.textContent=t.call(this,e)}}(o)),e}return o._value=t,o}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o,r=Xo(this.node(),n).tween,i=0,a=r.length;i<a;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((null==e?Vo:qo)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?er:nr)(e,t)):Xo(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?or:rr)(e,t)):Xo(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Ro(this,t).ease=e}}(e,t)):Xo(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Ro(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,o=n._id,r=n.size();return new Promise((function(i,a){var s={value:a},u={value:function(){0==--r&&i()}};n.each((function(){var n=Ro(this,o),r=n.on;r!==t&&((e=(t=r).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(u)),n.on=e})),0===r&&i()}))},[Symbol.iterator]:lr[Symbol.iterator]};var hr={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function dr(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}Ce.prototype.interrupt=function(t){return this.each((function(){Yo(this,t)}))},Ce.prototype.transition=function(t){var e,n;t instanceof ur?(e=t._id,t=t._name):(e=cr(),(n=hr).time=_o(),t=null==t?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],u=s.length,c=0;c<u;++c)(a=s[c])&&Bo(a,t,e,c,s,n||dr(a,e));return new ur(o,this._parents,t,e)};var fr=t=>()=>t;function pr(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function gr(t,e,n){this.k=t,this.x=e,this.y=n}gr.prototype={constructor:gr,scale:function(t){return 1===t?this:new gr(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new gr(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var mr=new gr(1,0,0);function yr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return mr;return t.__zoom}function vr(t){t.stopImmediatePropagation()}function xr(t){t.preventDefault(),t.stopImmediatePropagation()}function wr(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function _r(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function br(){return this.__zoom||mr}function Mr(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Pr(){return navigator.maxTouchPoints||"ontouchstart"in this}function Er(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function zr(){var t,e,n,o=wr,r=_r,i=Er,a=Mr,s=Pr,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,h=lo,d=xt("start","zoom","end"),f=500,p=150,g=0,m=10;function y(t){t.property("__zoom",br).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",z).filter(s).on("touchstart.zoom",N).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(t,e){return(e=Math.max(u[0],Math.min(u[1],e)))===t.k?t:new gr(e,t.x,t.y)}function x(t,e,n){var o=e[0]-n[0]*t.k,r=e[1]-n[1]*t.k;return o===t.x&&r===t.y?t:new gr(t.k,o,r)}function w(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function _(t,e,n,o){t.on("start.zoom",(function(){b(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){b(this,arguments).event(o).end()})).tween("zoom",(function(){var t=this,i=arguments,a=b(t,i).event(o),s=r.apply(t,i),u=null==n?w(s):"function"==typeof n?n.apply(t,i):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),l=t.__zoom,d="function"==typeof e?e.apply(t,i):e,f=h(l.invert(u).concat(c/l.k),d.invert(u).concat(c/d.k));return function(t){if(1===t)t=d;else{var e=f(t),n=c/e[2];t=new gr(n,u[0]-e[0]*n,u[1]-e[1]*n)}a.zoom(null,t)}}))}function b(t,e,n){return!n&&t.__zooming||new M(t,e)}function M(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=r.apply(t,e),this.taps=0}function P(t,...e){if(o.apply(this,arguments)){var n=b(this,e).event(t),r=this.__zoom,s=Math.max(u[0],Math.min(u[1],r.k*Math.pow(2,a.apply(this,arguments)))),l=De(t);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=r.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(r.k===s)return;n.mouse=[l,r.invert(l)],Yo(this),n.start()}xr(t),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),p),n.zoom("mouse",i(x(v(r,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function E(t,...e){if(!n&&o.apply(this,arguments)){var r=t.currentTarget,a=b(this,e,!0).event(t),s=Oe(t.view).on("mousemove.zoom",(function(t){if(xr(t),!a.moved){var e=t.clientX-l,n=t.clientY-h;a.moved=e*e+n*n>g}a.event(t).zoom("mouse",i(x(a.that.__zoom,a.mouse[0]=De(t,r),a.mouse[1]),a.extent,c))}),!0).on("mouseup.zoom",(function(t){s.on("mousemove.zoom mouseup.zoom",null),Ye(t.view,a.moved),xr(t),a.event(t).end()}),!0),u=De(t,r),l=t.clientX,h=t.clientY;Xe(t.view),vr(t),a.mouse=[u,this.__zoom.invert(u)],Yo(this),a.start()}}function z(t,...e){if(o.apply(this,arguments)){var n=this.__zoom,a=De(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),u=n.k*(t.shiftKey?.5:2),h=i(x(v(n,u),a,s),r.apply(this,e),c);xr(t),l>0?Oe(this).transition().duration(l).call(_,h,a,t):Oe(this).call(y.transform,h,a,t)}}function N(n,...r){if(o.apply(this,arguments)){var i,a,s,u,c=n.touches,l=c.length,h=b(this,r,n.changedTouches.length===l).event(n);for(vr(n),a=0;a<l;++a)u=[u=De(s=c[a],this),this.__zoom.invert(u),s.identifier],h.touch0?h.touch1||h.touch0[2]===u[2]||(h.touch1=u,h.taps=0):(h.touch0=u,i=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),i&&(h.taps<2&&(e=u[0],t=setTimeout((function(){t=null}),f)),Yo(this),h.start())}}function S(t,...e){if(this.__zooming){var n,o,r,a,s=b(this,e).event(t),u=t.changedTouches,l=u.length;for(xr(t),n=0;n<l;++n)r=De(o=u[n],this),s.touch0&&s.touch0[2]===o.identifier?s.touch0[0]=r:s.touch1&&s.touch1[2]===o.identifier&&(s.touch1[0]=r);if(o=s.that.__zoom,s.touch1){var h=s.touch0[0],d=s.touch0[1],f=s.touch1[0],p=s.touch1[1],g=(g=f[0]-h[0])*g+(g=f[1]-h[1])*g,m=(m=p[0]-d[0])*m+(m=p[1]-d[1])*m;o=v(o,Math.sqrt(g/m)),r=[(h[0]+f[0])/2,(h[1]+f[1])/2],a=[(d[0]+p[0])/2,(d[1]+p[1])/2]}else{if(!s.touch0)return;r=s.touch0[0],a=s.touch0[1]}s.zoom("touch",i(x(o,r,a),s.extent,c))}}function k(t,...o){if(this.__zooming){var r,i,a=b(this,o).event(t),s=t.changedTouches,u=s.length;for(vr(t),n&&clearTimeout(n),n=setTimeout((function(){n=null}),f),r=0;r<u;++r)i=s[r],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=De(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<m)){var c=Oe(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return y.transform=function(t,e,n,o){var r=t.selection?t.selection():t;r.property("__zoom",br),t!==r?_(t,e,n,o):r.interrupt().each((function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},y.scaleBy=function(t,e,n,o){y.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),n,o)},y.scaleTo=function(t,e,n,o){y.transform(t,(function(){var t=r.apply(this,arguments),o=this.__zoom,a=null==n?w(t):"function"==typeof n?n.apply(this,arguments):n,s=o.invert(a),u="function"==typeof e?e.apply(this,arguments):e;return i(x(v(o,u),a,s),t,c)}),n,o)},y.translateBy=function(t,e,n,o){y.transform(t,(function(){return i(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)}),null,o)},y.translateTo=function(t,e,n,o,a){y.transform(t,(function(){var t=r.apply(this,arguments),a=this.__zoom,s=null==o?w(t):"function"==typeof o?o.apply(this,arguments):o;return i(mr.translate(s[0],s[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)}),o,a)},M.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=Oe(this.that).datum();d.call(t,this.that,new pr(t,{sourceEvent:this.sourceEvent,target:y,type:t,transform:this.that.__zoom,dispatch:d}),e)}},y.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:fr(+t),y):a},y.filter=function(t){return arguments.length?(o="function"==typeof t?t:fr(!!t),y):o},y.touchable=function(t){return arguments.length?(s="function"==typeof t?t:fr(!!t),y):s},y.extent=function(t){return arguments.length?(r="function"==typeof t?t:fr([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),y):r},y.scaleExtent=function(t){return arguments.length?(u[0]=+t[0],u[1]=+t[1],y):[u[0],u[1]]},y.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],y):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},y.constrain=function(t){return arguments.length?(i=t,y):i},y.duration=function(t){return arguments.length?(l=+t,y):l},y.interpolate=function(t){return arguments.length?(h=t,y):h},y.on=function(){var t=d.on.apply(d,arguments);return t===d?y:t},y.clickDistance=function(t){return arguments.length?(g=(t=+t)*t,y):Math.sqrt(g)},y.tapDistance=function(t){return arguments.length?(m=+t,y):m},y}yr.prototype=gr.prototype;const Nr=t=>({x:t.x,y:t.y,zoom:t.k}),Sr=({x:t,y:e,zoom:n})=>mr.translate(t,e).scale(n),kr=(t,e)=>t.target.closest(`.${e}`),Ir=(t,e)=>2===e&&Array.isArray(t)&&t.includes(2),Ar=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,Tr=(t,e=0,n=Ar,o=(()=>{}))=>{const r="number"==typeof e&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},$r=t=>{const e=t.ctrlKey&&D()?10:1;return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*e};var Cr;t.ResizeControlVariant=void 0,(Cr=t.ResizeControlVariant||(t.ResizeControlVariant={})).Line="line",Cr.Handle="handle";function Or(t){return{isHorizontal:t.includes("right")||t.includes("left"),isVertical:t.includes("bottom")||t.includes("top"),affectsX:t.includes("left"),affectsY:t.includes("top")}}function Dr(t,e){return Math.max(0,e-t)}function Hr(t,e){return Math.max(0,t-e)}function Br(t,e,n){return Math.max(0,e-t,t-n)}function Lr(t,e){return t?!e:e}const Rr={width:0,height:0,x:0,y:0},Xr={...Rr,pointerX:0,pointerY:0,aspectRatio:1};function Yr(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,a=t.measured.height??0,s=n[0]*i,u=n[1]*a;return[[o-s,r-u],[o+i-s,r+a-u]]}t.XYDrag=function({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},a=0,s=new Map,u=!1,c={x:0,y:0},l=null,h=!1,d=null,f=!1,g=!1,y=null;return{update:function({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:b,nodeId:P,nodeClickDistance:E=0}){function z({x:t,y:n}){const{nodeLookup:r,nodeExtent:a,snapGrid:u,snapToGrid:c,nodeOrigin:l,onNodeDrag:h,onSelectionDrag:d,onError:f,updateNodePositions:v}=e();i={x:t,y:n};let x=!1;const w=s.size>1,_=w&&a?M(p(s)):null,b=w&&c?function({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},a=A(i,e);return{x:a.x-i.x,y:a.y-i.y}}({dragItems:s,snapGrid:u,x:t,y:n}):null;for(const[e,o]of s){if(!r.has(e))continue;let i={x:t-o.distance.x,y:n-o.distance.y};c&&(i=b?{x:Math.round(i.x+b.x),y:Math.round(i.y+b.y)}:A(i,u));let s=null;if(w&&a&&!o.extent&&_){const{positionAbsolute:t}=o.internals,e=t.x-_.x+a[0][0],n=t.x+o.measured.width-_.x2+a[1][0];s=[[e,t.y-_.y+a[0][1]],[n,t.y+o.measured.height-_.y2+a[1][1]]]}const{position:h,positionAbsolute:d}=m({nodeId:e,nextPosition:i,nodeLookup:r,nodeExtent:s||a,nodeOrigin:l,onError:f});x=x||o.position.x!==h.x||o.position.y!==h.y,o.position=h,o.internals.positionAbsolute=d}if(g=g||x,x&&(v(s,!0),y&&(o||h||!P&&d))){const[t,e]=Qe({nodeId:P,dragItems:s,nodeLookup:r});o?.(y,s,t,e),h?.(y,t,e),P||d?.(y,e)}}async function N(){if(!l)return;const{transform:t,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=e();if(!r)return u=!1,void cancelAnimationFrame(a);const[s,h]=_(c,l,o);0===s&&0===h||(i.x=(i.x??0)-s/t[2],i.y=(i.y??0)-h/t[2],await n({x:s,y:h})&&z(i)),a=requestAnimationFrame(N)}function S(o){const{nodeLookup:r,multiSelectionActive:a,nodesDraggable:u,transform:c,snapGrid:d,snapToGrid:f,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:y}=e();h=!0,p&&b||a||!P||r.get(P)?.selected||y(),b&&p&&P&&t?.(P);const v=L(o.sourceEvent,{transform:c,snapGrid:d,snapToGrid:f,containerBounds:l});if(i=v,s=function(t,e,n,o){const r=new Map;for(const[i,a]of t)if((a.selected||a.id===o)&&(!a.parentId||!Ke(a,t))&&(a.draggable||e&&void 0===a.draggable)){const e=t.get(i);e&&r.set(i,{id:i,position:e.position||{x:0,y:0},distance:{x:n.x-e.internals.positionAbsolute.x,y:n.y-e.internals.positionAbsolute.y},extent:e.extent,parentId:e.parentId,origin:e.origin,expandParent:e.expandParent,internals:{positionAbsolute:e.internals.positionAbsolute||{x:0,y:0}},measured:{width:e.measured.width??0,height:e.measured.height??0}})}return r}(r,u,v,P),s.size>0&&(n||g||!P&&m)){const[t,e]=Qe({nodeId:P,dragItems:s,nodeLookup:r});n?.(o.sourceEvent,s,t,e),g?.(o.sourceEvent,t,e),P||m?.(o.sourceEvent,e)}}d=Oe(w);const k=Fe().clickDistance(E).on("start",(t=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:a,snapToGrid:s}=e();l=n?.getBoundingClientRect()||null,f=!1,g=!1,y=t.sourceEvent,0===o&&S(t);const u=L(t.sourceEvent,{transform:r,snapGrid:a,snapToGrid:s,containerBounds:l});i=u,c=q(t.sourceEvent,l)})).on("drag",(t=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:a,nodeDragThreshold:d,nodeLookup:p}=e(),g=L(t.sourceEvent,{transform:o,snapGrid:r,snapToGrid:a,containerBounds:l});if(y=t.sourceEvent,("touchmove"===t.sourceEvent.type&&t.sourceEvent.touches.length>1||P&&!p.has(P))&&(f=!0),!f){if(!u&&n&&h&&(u=!0,N()),!h){const e=q(t.sourceEvent,l),n=e.x-c.x,o=e.y-c.y;Math.sqrt(n*n+o*o)>d&&S(t)}(i.x!==g.xSnapped||i.y!==g.ySnapped)&&s&&h&&(c=q(t.sourceEvent,l),z(g))}})).on("end",(t=>{if(h&&!f&&(u=!1,h=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:a}=e();if(g&&(o(s,!1),g=!1),r||i||!P&&a){const[e,o]=Qe({nodeId:P,dragItems:s,nodeLookup:n,dragging:!1});r?.(t.sourceEvent,s,e,o),i?.(t.sourceEvent,e,o),P||a?.(t.sourceEvent,o)}}})).filter((t=>{const e=t.target;return!t.button&&(!v||!Ue(e,`.${v}`,w))&&(!x||Ue(e,x,w))}));d.call(k)},destroy:function(){d?.on(".drag",null)}}},t.XYHandle=an,t.XYMinimap=function({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=Oe(t);return{update:function({translateExtent:t,width:i,height:a,zoomStep:s=1,pannable:u=!0,zoomable:c=!0,inversePan:l=!1}){let h=[0,0];const d=zr().on("start",(t=>{"mousedown"!==t.sourceEvent.type&&"touchstart"!==t.sourceEvent.type||(h=[t.sourceEvent.clientX??t.sourceEvent.touches[0].clientX,t.sourceEvent.clientY??t.sourceEvent.touches[0].clientY])})).on("zoom",u?r=>{const s=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!e)return;const u=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[u[0]-h[0],u[1]-h[1]];h=u;const d=o()*Math.max(s[2],Math.log(s[2]))*(l?-1:1),f={x:s[0]-c[0]*d,y:s[1]-c[1]*d},p=[[0,0],[i,a]];e.setViewportConstrained({x:f.x,y:f.y,zoom:s[2]},p,t)}:null).on("zoom.wheel",c?t=>{if("wheel"!==t.sourceEvent.type||!e)return;const o=n(),r=t.sourceEvent.ctrlKey&&D()?10:1,i=-t.sourceEvent.deltaY*(1===t.sourceEvent.deltaMode?.05:t.sourceEvent.deltaMode?1:.002)*s,a=o[2]*Math.pow(2,i*r);e.scaleTo(a)}:null);r.call(d,{})},destroy:function(){r.on("zoom",null)},pointer:De}},t.XYPanZoom=function({domNode:e,minZoom:n,maxZoom:o,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:s,onPanZoomEnd:u,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),d=zr().scaleExtent([n,o]).translateExtent(r),f=Oe(e).call(d);x({x:i.x,y:i.y,zoom:y(i.zoom,n,o)},[[0,0],[h.width,h.height]],r);const p=f.on("wheel.zoom"),g=f.on("dblclick.zoom");function m(t,e){return f?new Promise((n=>{d?.interpolate("linear"===e?.interpolate?Jn:lo).transform(Tr(f,e?.duration,e?.ease,(()=>n(!0))),t)})):Promise.resolve(!1)}function v(){d.on("zoom",null)}async function x(t,e,n){const o=Sr(t),r=d?.constrain()(o,e,n);return r&&await m(r),new Promise((t=>t(r)))}return d.wheelDelta($r),{update:function({noWheelClassName:e,noPanClassName:n,onPaneContextMenu:o,userSelectionActive:r,panOnScroll:i,panOnDrag:h,panOnScrollMode:m,panOnScrollSpeed:y,preventScrolling:x,zoomOnPinch:w,zoomOnScroll:_,zoomOnDoubleClick:b,zoomActivationKeyPressed:M,lib:P,onTransformChange:E,connectionInProgress:z,paneClickDistance:N,selectionOnDrag:S}){r&&!l.isZoomingOrPanning&&v();const I=i&&!M&&!r;d.clickDistance(S?1/0:!k(N)||N<0?0:N);const A=I?function({zoomPanValues:e,noWheelClassName:n,d3Selection:o,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:s,onPanZoomStart:u,onPanZoom:c,onPanZoomEnd:l}){return h=>{if(kr(h,n))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const d=o.property("__zoom").k||1;if(h.ctrlKey&&s){const t=De(h),e=$r(h),n=d*Math.pow(2,e);return void r.scaleTo(o,n,t,h)}const f=1===h.deltaMode?20:1;let p=i===t.PanOnScrollMode.Vertical?0:h.deltaX*f,g=i===t.PanOnScrollMode.Horizontal?0:h.deltaY*f;!D()&&h.shiftKey&&i!==t.PanOnScrollMode.Vertical&&(p=h.deltaY*f,g=0),r.translateBy(o,-p/d*a,-g/d*a,{internal:!0});const m=Nr(o.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(h,m),e.panScrollTimeout=setTimeout((()=>{l?.(h,m),e.isPanScrolling=!1}),150)):(e.isPanScrolling=!0,u?.(h,m))}}({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:m,panOnScrollSpeed:y,zoomOnPinch:w,onPanZoomStart:s,onPanZoom:a,onPanZoomEnd:u}):function({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,a=!e&&i&&!o.ctrlKey,s=kr(o,t);if(o.ctrlKey&&i&&s&&o.preventDefault(),a||s)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:x,d3ZoomHandler:p});if(f.on("wheel.zoom",A,{passive:!1}),!r){const t=function({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Nr(o.transform);t.mouseButton=o.sourceEvent?.button||0,t.isZoomingOrPanning=!0,t.prevViewport=r,"mousedown"===o.sourceEvent?.type&&e(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});d.on("start",t);const e=function({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{t.usedRightMouseButton=!(!n||!Ir(e,t.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Nr(i.transform))}}({zoomPanValues:l,panOnDrag:h,onPaneContextMenu:!!o,onPanZoom:a,onTransformChange:E});d.on("zoom",e);const n=function({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return a=>{if(!a.sourceEvent?.internal&&(t.isZoomingOrPanning=!1,i&&Ir(e,t.mouseButton??0)&&!t.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const e=Nr(a.transform);t.prevViewport=e,clearTimeout(t.timerId),t.timerId=setTimeout((()=>{r?.(a.sourceEvent,e)}),n?150:0)}}}({zoomPanValues:l,panOnDrag:h,panOnScroll:i,onPaneContextMenu:o,onPanZoomEnd:u,onDraggingChange:c});d.on("end",n)}const T=function({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:s,noPanClassName:u,lib:c,connectionInProgress:l}){return h=>{const d=t||e,f=n&&h.ctrlKey,p="wheel"===h.type;if(1===h.button&&"mousedown"===h.type&&(kr(h,`${c}-flow__node`)||kr(h,`${c}-flow__edge`)))return!0;if(!(o||d||r||i||n))return!1;if(a)return!1;if(l&&!p)return!1;if(kr(h,s)&&p)return!1;if(kr(h,u)&&(!p||r&&p&&!t))return!1;if(!n&&h.ctrlKey&&p)return!1;if(!n&&"touchstart"===h.type&&h.touches?.length>1)return h.preventDefault(),!1;if(!d&&!r&&!f&&p)return!1;if(!o&&("mousedown"===h.type||"touchstart"===h.type))return!1;if(Array.isArray(o)&&!o.includes(h.button)&&"mousedown"===h.type)return!1;const g=Array.isArray(o)&&o.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||p)&&g}}({zoomActivationKeyPressed:M,panOnDrag:h,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:b,zoomOnPinch:w,userSelectionActive:r,noPanClassName:n,noWheelClassName:e,lib:P,connectionInProgress:z});d.filter(T),b?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)},destroy:v,setViewport:async function(t,e){const n=Sr(t);return await m(n,e),new Promise((t=>t(n)))},setViewportConstrained:x,getViewport:function(){const t=f?yr(f.node()):{x:0,y:0,k:1};return{x:t.x,y:t.y,zoom:t.k}},scaleTo:function(t,e){return f?new Promise((n=>{d?.interpolate("linear"===e?.interpolate?Jn:lo).scaleTo(Tr(f,e?.duration,e?.ease,(()=>n(!0))),t)})):Promise.resolve(!1)},scaleBy:function(t,e){return f?new Promise((n=>{d?.interpolate("linear"===e?.interpolate?Jn:lo).scaleBy(Tr(f,e?.duration,e?.ease,(()=>n(!0))),t)})):Promise.resolve(!1)},setScaleExtent:function(t){d?.scaleExtent(t)},setTranslateExtent:function(t){d?.translateExtent(t)},syncViewport:function(t){if(f){const e=Sr(t),n=f.property("__zoom");n.k===t.zoom&&n.x===t.x&&n.y===t.y||d?.transform(f,e,null,{sync:!0})}},setClickDistance:function(t){const e=!k(t)||t<0?0:t;d?.clickDistance(e)}}},t.XYResizer=function({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=Oe(t);let a={controlDirection:Or("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:t,boundaries:s,keepAspectRatio:u,resizeDirection:c,onResizeStart:l,onResize:h,onResizeEnd:d,shouldResize:f}){let p,g={...Rr},m={...Xr};a={boundaries:s,resizeDirection:c,keepAspectRatio:u,controlDirection:Or(t)};let y,v,x,w=null,_=[],b=!1;const M=Fe().on("start",(t=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:a,nodeOrigin:s,paneDomNode:u}=n();if(p=o.get(e),!p)return;w=u?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:h}=L(t.sourceEvent,{transform:r,snapGrid:i,snapToGrid:a,containerBounds:w});g={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},m={...g,pointerX:c,pointerY:h,aspectRatio:g.width/g.height},y=void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(y=o.get(p.parentId),v=y&&"parent"===p.extent?function(t){return[[0,0],[t.measured.width,t.measured.height]]}(y):void 0),_=[],x=void 0;for(const[t,n]of o)if(n.parentId===e&&(_.push({id:t,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const t=Yr(n,p,n.origin??s);x=x?[[Math.min(t[0][0],x[0][0]),Math.min(t[0][1],x[0][1])],[Math.max(t[1][0],x[1][0]),Math.max(t[1][1],x[1][1])]]:t}l?.(t,{...g})})).on("drag",(t=>{const{transform:e,snapGrid:r,snapToGrid:i,nodeOrigin:s}=n(),u=L(t.sourceEvent,{transform:e,snapGrid:r,snapToGrid:i,containerBounds:w}),c=[];if(!p)return;const{x:l,y:d,width:M,height:P}=g,E={},z=p.origin??s,{width:N,height:S,x:k,y:I}=function(t,e,n,o,r,i,a,s){let{affectsX:u,affectsY:c}=e;const{isHorizontal:l,isVertical:h}=e,d=l&&h,{xSnapped:f,ySnapped:p}=n,{minWidth:g,maxWidth:m,minHeight:y,maxHeight:v}=o,{x:x,y:w,width:_,height:b,aspectRatio:M}=t;let P=Math.floor(l?f-t.pointerX:0),E=Math.floor(h?p-t.pointerY:0);const z=_+(u?-P:P),N=b+(c?-E:E),S=-i[0]*_,k=-i[1]*b;let I=Br(z,g,m),A=Br(N,y,v);if(a){let t=0,e=0;u&&P<0?t=Dr(x+P+S,a[0][0]):!u&&P>0&&(t=Hr(x+z+S,a[1][0])),c&&E<0?e=Dr(w+E+k,a[0][1]):!c&&E>0&&(e=Hr(w+N+k,a[1][1])),I=Math.max(I,t),A=Math.max(A,e)}if(s){let t=0,e=0;u&&P>0?t=Hr(x+P,s[0][0]):!u&&P<0&&(t=Dr(x+z,s[1][0])),c&&E>0?e=Hr(w+E,s[0][1]):!c&&E<0&&(e=Dr(w+N,s[1][1])),I=Math.max(I,t),A=Math.max(A,e)}if(r){if(l){const t=Br(z/M,y,v)*M;if(I=Math.max(I,t),a){let t=0;t=!u&&!c||u&&!c&&d?Hr(w+k+z/M,a[1][1])*M:Dr(w+k+(u?P:-P)/M,a[0][1])*M,I=Math.max(I,t)}if(s){let t=0;t=!u&&!c||u&&!c&&d?Dr(w+z/M,s[1][1])*M:Hr(w+(u?P:-P)/M,s[0][1])*M,I=Math.max(I,t)}}if(h){const t=Br(N*M,g,m)/M;if(A=Math.max(A,t),a){let t=0;t=!u&&!c||c&&!u&&d?Hr(x+N*M+S,a[1][0])/M:Dr(x+(c?E:-E)*M+S,a[0][0])/M,A=Math.max(A,t)}if(s){let t=0;t=!u&&!c||c&&!u&&d?Dr(x+N*M,s[1][0])/M:Hr(x+(c?E:-E)*M,s[0][0])/M,A=Math.max(A,t)}}}E+=E<0?A:-A,P+=P<0?I:-I,r&&(d?z>N*M?E=(Lr(u,c)?-P:P)/M:P=(Lr(u,c)?-E:E)*M:l?(E=P/M,c=u):(P=E*M,u=c));const T=u?x+P:x,$=c?w+E:w;return{width:_+(u?-P:P),height:b+(c?-E:E),x:i[0]*P*(u?-1:1)+T,y:i[1]*E*(c?-1:1)+$}}(m,a.controlDirection,u,a.boundaries,a.keepAspectRatio,z,v,x),A=N!==M,T=S!==P,$=k!==l&&A,C=I!==d&&T;if(!($||C||A||T))return;if(($||C||1===z[0]||1===z[1])&&(E.x=$?k:g.x,E.y=C?I:g.y,g.x=E.x,g.y=E.y,_.length>0)){const t=k-l,e=I-d;for(const n of _)n.position={x:n.position.x-t+z[0]*(N-M),y:n.position.y-e+z[1]*(S-P)},c.push(n)}if((A||T)&&(E.width=!A||a.resizeDirection&&"horizontal"!==a.resizeDirection?g.width:N,E.height=!T||a.resizeDirection&&"vertical"!==a.resizeDirection?g.height:S,g.width=E.width,g.height=E.height),y&&p.expandParent){const t=z[0]*(E.width??0);E.x&&E.x<t&&(g.x=t,m.x=m.x-(E.x-t));const e=z[1]*(E.height??0);E.y&&E.y<e&&(g.y=e,m.y=m.y-(E.y-e))}const O=function({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const a=t-e,s=n-o,u=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&r&&(u[0]=-1*u[0]),s&&i&&(u[1]=-1*u[1]),u}({width:g.width,prevWidth:M,height:g.height,prevHeight:P,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),D={...g,direction:O},H=f?.(t,D);!1!==H&&(b=!0,h?.(t,D),o(E,c))})).on("end",(t=>{b&&(d?.(t,{...g}),r?.({...g}),b=!1)}));i.call(M)},destroy:function(){i.on(".drag",null)}}},t.XY_RESIZER_HANDLE_POSITIONS=["top-left","top-right","bottom-left","bottom-right"],t.XY_RESIZER_LINE_POSITIONS=["top","right","bottom","left"],t.addEdge=(t,n,o={})=>{if(!t.source||!t.target)return e.error006(),n;const r=o.getEdgeId||K;let i;return i=h(t)?{...t}:{...t,id:r(t)},((t,e)=>e.some((e=>!(e.source!==t.source||e.target!==t.target||e.sourceHandle!==t.sourceHandle&&(e.sourceHandle||t.sourceHandle)||e.targetHandle!==t.targetHandle&&(e.targetHandle||t.targetHandle)))))(i,n)?n:(null===i.sourceHandle&&delete i.sourceHandle,null===i.targetHandle&&delete i.targetHandle,n.concat(i))},t.adoptUserNodes=function(t,e,n,o={}){const r=ht(lt,o),i={i:0},a=new Map(e),s=r?.elevateNodesOnSelect&&!ft(r.zIndexMode)?st:0;let u=t.length>0;e.clear(),n.clear();for(const c of t){let t=a.get(c.id);if(r.checkEquality&&c===t?.internals.userNode)e.set(c.id,t);else{const n=f(c,r.nodeOrigin),o=H(c.extent)?c.extent:r.nodeExtent,i=v(n,o,B(c));t={...r.defaults,...c,measured:{width:c.measured?.width,height:c.measured?.height},internals:{positionAbsolute:i,handleBounds:dt(c,t),z:gt(c,s,r.zIndexMode),userNode:c}},e.set(c.id,t)}void 0!==t.measured&&void 0!==t.measured.width&&void 0!==t.measured.height||t.hidden||(u=!1),c.parentId&&pt(t,e,n,o,i)}return u},t.areConnectionMapsEqual=function(t,e){if(!t&&!e)return!0;if(!t||!e||t.size!==e.size)return!1;if(!t.size&&!e.size)return!0;for(const n of t.keys())if(!e.has(n))return!1;return!0},t.areSetsEqual=function(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0},t.boxToRect=P,t.calcAutoPan=_,t.calculateNodePosition=m,t.clamp=y,t.clampPosition=v,t.clampPositionToParent=x,t.createMarkerIds=function(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce(((t,a)=>([a.markerStart||o,a.markerEnd||r].forEach((o=>{if(o&&"object"==typeof o){const r=rt(o,e);i.has(r)||(t.push({id:r,color:o.color||n,...o}),i.add(r))}})),t)),[]).sort(((t,e)=>t.id.localeCompare(e.id)))},t.defaultAriaLabelConfig=o,t.devWarn=I,t.elementSelectionKeys=["Enter"," ","Escape"],t.errorMessages=e,t.evaluateAbsolutePosition=function(t,e={width:0,height:0},n,o,r){const i={...t},a=o.get(n);if(a){const t=a.origin||r;i.x+=a.internals.positionAbsolute.x-(e.width??0)*t[0],i.y+=a.internals.positionAbsolute.y-(e.height??0)*t[1]}return i},t.fitViewport=async function({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},a){if(0===t.size)return Promise.resolve(!0);const s=function(t,e){const n=new Map,o=e?.nodes?new Set(e.nodes.map((t=>t.id))):null;return t.forEach((t=>{!t.measured.width||!t.measured.height||!e?.includeHiddenNodes&&t.hidden||o&&!o.has(t.id)||n.set(t.id,t)})),n}(t,a),u=p(s),c=O(u,e,n,a?.minZoom??r,a?.maxZoom??i,a?.padding??.1);return await o.setViewport(c,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)},t.getBezierEdgeCenter=G,t.getBezierPath=function({sourceX:e,sourceY:n,sourcePosition:o=t.Position.Bottom,targetX:r,targetY:i,targetPosition:a=t.Position.Top,curvature:s=.25}){const[u,c]=W({pos:o,x1:e,y1:n,x2:r,y2:i,c:s}),[l,h]=W({pos:a,x1:r,y1:i,x2:e,y2:n,c:s}),[d,f,p,g]=G({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:u,sourceControlY:c,targetControlX:l,targetControlY:h});return[`M${e},${n} C${u},${c} ${l},${h} ${r},${i}`,d,f,p,g]},t.getBoundsOfBoxes=b,t.getBoundsOfRects=N,t.getConnectedEdges=g,t.getConnectionStatus=function(t){return null===t?null:t?"valid":"invalid"},t.getDimensions=R,t.getEdgeCenter=F,t.getEdgeId=K,t.getEdgePosition=function(n){const{sourceNode:o,targetNode:r}=n;if(!tt(o)||!tt(r))return null;const i=o.internals.handleBounds||et(o.handles),a=r.internals.handleBounds||et(r.handles),s=ot(i?.source??[],n.sourceHandle),u=ot(n.connectionMode===t.ConnectionMode.Strict?a?.target??[]:(a?.target??[]).concat(a?.source??[]),n.targetHandle);if(!s||!u)return n.onError?.("008",e.error008(s?"target":"source",{id:n.id,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle})),null;const c=s?.position||t.Position.Bottom,l=u?.position||t.Position.Top,h=nt(o,s,c),d=nt(r,u,l);return{sourceX:h.x,sourceY:h.y,targetX:d.x,targetY:d.y,sourcePosition:c,targetPosition:l}},t.getEdgeToolbarTransform=function(t,e,n,o="center",r="center"){return`translate(${t}px, ${e}px) scale(${1/n}) translate(${-(it[o]??50)}%, ${-(at[r]??50)}%)`},t.getElementsToRemove=async function({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map((t=>t.id))),a=[];for(const t of n){if(!1===t.deletable)continue;const e=i.has(t.id),n=!e&&t.parentId&&a.find((e=>e.id===t.parentId));(e||n)&&a.push(t)}const s=new Set(e.map((t=>t.id))),u=o.filter((t=>!1!==t.deletable)),c=g(a,u);for(const t of u){s.has(t.id)&&!c.find((e=>e.id===t.id))&&c.push(t)}if(!r)return{edges:c,nodes:a};const l=await r({nodes:a,edges:c});return"boolean"==typeof l?l?{edges:c,nodes:a}:{edges:[],nodes:[]}:l},t.getElevatedEdgeZIndex=function({sourceNode:t,targetNode:e,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){return"manual"===i?o:(r&&n?o+1e3:o)+Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0)},t.getEventPosition=q,t.getHandleBounds=Z,t.getHandlePosition=nt,t.getHostForElement=X,t.getIncomers=(t,e,n)=>{if(!t.id)return[];const o=new Set;return n.forEach((e=>{e.target===t.id&&o.add(e.source)})),e.filter((t=>o.has(t.id)))},t.getInternalNodesBounds=p,t.getMarkerId=rt,t.getNodeDimensions=B,t.getNodePositionWithOrigin=f,t.getNodeToolbarTransform=function(e,n,o,r,i){let a=.5;"start"===i?a=0:"end"===i&&(a=1);let s=[(e.x+e.width*a)*n.zoom+n.x,e.y*n.zoom+n.y-r],u=[-100*a,-100];switch(o){case t.Position.Right:s=[(e.x+e.width)*n.zoom+n.x+r,(e.y+e.height*a)*n.zoom+n.y],u=[0,-100*a];break;case t.Position.Bottom:s[1]=(e.y+e.height)*n.zoom+n.y+r,u[1]=0;break;case t.Position.Left:s=[e.x*n.zoom+n.x-r,(e.y+e.height*a)*n.zoom+n.y],u=[-100,-100*a]}return`translate(${s[0]}px, ${s[1]}px) translate(${u[0]}%, ${u[1]}%)`},t.getNodesBounds=(t,e={nodeOrigin:[0,0]})=>{if(0===t.length)return{x:0,y:0,width:0,height:0};const n=t.reduce(((t,n)=>{const o="string"==typeof n;let r=e.nodeLookup||o?void 0:n;e.nodeLookup&&(r=o?e.nodeLookup.get(n):d(n)?n:e.nodeLookup.get(n.id));const i=r?z(r,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return b(t,i)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return P(n)},t.getNodesInside=(t,e,[n,o,r]=[0,0,1],i=!1,a=!1)=>{const s={...T(e,[n,o,r]),width:e.width/r,height:e.height/r},u=[];for(const e of t.values()){const{measured:t,selectable:n=!0,hidden:o=!1}=e;if(a&&!n||o)continue;const r=t.width??e.width??e.initialWidth??null,c=t.height??e.height??e.initialHeight??null,l=S(s,E(e)),h=(r??0)*(c??0),d=i&&l>0;(!e.internals.handleBounds||d||l>=h||e.dragging)&&u.push(e)}return u},t.getOutgoers=(t,e,n)=>{if(!t.id)return[];const o=new Set;return n.forEach((e=>{e.source===t.id&&o.add(e.target)})),e.filter((t=>o.has(t.id)))},t.getOverlappingArea=S,t.getPointerPosition=L,t.getSmoothStepPath=function({sourceX:e,sourceY:n,sourcePosition:o=t.Position.Bottom,targetX:r,targetY:i,targetPosition:a=t.Position.Top,borderRadius:s=5,centerX:u,centerY:c,offset:l=20,stepPosition:h=.5}){const[d,f,p,g,m]=function({source:e,sourcePosition:n=t.Position.Bottom,target:o,targetPosition:r=t.Position.Top,center:i,offset:a,stepPosition:s}){const u=U[n],c=U[r],l={x:e.x+u.x*a,y:e.y+u.y*a},h={x:o.x+c.x*a,y:o.y+c.y*a},d=Q({source:l,sourcePosition:n,target:h}),f=0!==d.x?"x":"y",p=d[f];let g,m,y=[];const v={x:0,y:0},x={x:0,y:0},[,,w,_]=F({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(u[f]*c[f]==-1){"x"===f?(g=i.x??l.x+(h.x-l.x)*s,m=i.y??(l.y+h.y)/2):(g=i.x??(l.x+h.x)/2,m=i.y??l.y+(h.y-l.y)*s);const t=[{x:g,y:l.y},{x:g,y:h.y}],e=[{x:l.x,y:m},{x:h.x,y:m}];y=u[f]===p?"x"===f?t:e:"x"===f?e:t}else{const t=[{x:l.x,y:h.y}],i=[{x:h.x,y:l.y}];if(y="x"===f?u.x===p?i:t:u.y===p?t:i,n===r){const t=Math.abs(e[f]-o[f]);if(t<=a){const n=Math.min(a-1,a-t);u[f]===p?v[f]=(l[f]>e[f]?-1:1)*n:x[f]=(h[f]>o[f]?-1:1)*n}}if(n!==r){const e="x"===f?"y":"x",n=u[f]===c[e],o=l[e]>h[e],r=l[e]<h[e];(1===u[f]&&(!n&&o||n&&r)||1!==u[f]&&(!n&&r||n&&o))&&(y="x"===f?t:i)}const s={x:l.x+v.x,y:l.y+v.y},d={x:h.x+x.x,y:h.y+x.y};Math.max(Math.abs(s.x-y[0].x),Math.abs(d.x-y[0].x))>=Math.max(Math.abs(s.y-y[0].y),Math.abs(d.y-y[0].y))?(g=(s.x+d.x)/2,m=y[0].y):(g=y[0].x,m=(s.y+d.y)/2)}return[[e,{x:l.x+v.x,y:l.y+v.y},...y,{x:h.x+x.x,y:h.y+x.y},o],g,m,w,_]}({source:{x:e,y:n},sourcePosition:o,target:{x:r,y:i},targetPosition:a,center:{x:u,y:c},offset:l,stepPosition:h});return[d.reduce(((t,e,n)=>{let o="";return o=n>0&&n<d.length-1?function(t,e,n,o){const r=Math.min(J(t,e)/2,J(e,n)/2,o),{x:i,y:a}=e;if(t.x===i&&i===n.x||t.y===a&&a===n.y)return`L${i} ${a}`;if(t.y===a)return`L ${i+r*(t.x<n.x?-1:1)},${a}Q ${i},${a} ${i},${a+r*(t.y<n.y?1:-1)}`;const s=t.x<n.x?1:-1;return`L ${i},${a+r*(t.y<n.y?-1:1)}Q ${i},${a} ${i+r*s},${a}`}(d[n-1],e,d[n+1],s):`${0===n?"M":"L"}${e.x} ${e.y}`,t+=o}),""),f,p,g,m]},t.getStraightPath=function({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,a,s]=F({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,a,s]},t.getViewportForBounds=O,t.handleConnectionChange=function(t,e,n){if(!n)return;const o=[];t.forEach(((t,n)=>{e?.has(n)||o.push(t)})),o.length&&n(o)},t.handleExpandParent=mt,t.infiniteExtent=n,t.initialConnection={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},t.isCoordinateExtent=H,t.isEdgeBase=h,t.isEdgeVisible=function({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=b(z(t),z(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return S(a,P(i))>0},t.isInputDOMNode=function(t){const e=t.composedPath?.()?.[0]||t.target;return 1===e?.nodeType&&(Y.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey"))},t.isInternalNodeBase=d,t.isMacOs=D,t.isManualZIndexMode=ft,t.isMouseEvent=V,t.isNodeBase=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),t.isNumeric=k,t.isRectObject=t=>k(t.width)&&k(t.height)&&k(t.x)&&k(t.y),t.mergeAriaLabelConfig=function(t){return{...o,...t||{}}},t.nodeHasDimensions=function(t){return void 0!==(t.measured?.width??t.width??t.initialWidth)&&void 0!==(t.measured?.height??t.height??t.initialHeight)},t.nodeToBox=z,t.nodeToRect=E,t.oppositePosition=l,t.panBy=async function({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const a=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[r,i]],o),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)},t.pointToRendererPoint=T,t.reconnectEdge=(t,n,o,r={shouldReplaceId:!0})=>{const{id:i,...a}=t;if(!n.source||!n.target)return e.error006(),o;if(!o.find((e=>e.id===t.id)))return e.error007(i),o;const s=r.getEdgeId||K,u={...a,id:r.shouldReplaceId?s(n):i,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle};return o.filter((t=>t.id!==i)).concat(u)},t.rectToBox=M,t.rendererPointToPoint=$,t.shallowNodeData=function(t,e){if(null===t||null===e)return!1;const n=Array.isArray(t)?t:[t],o=Array.isArray(e)?e:[e];if(n.length!==o.length)return!1;for(let t=0;t<n.length;t++)if(n[t].id!==o[t].id||n[t].type!==o[t].type||!Object.is(n[t].data,o[t].data))return!1;return!0},t.snapPosition=A,t.updateAbsolutePositions=function(t,e,n){const o=ht(ct,n);for(const n of t.values())if(n.parentId)pt(n,t,e,o);else{const t=f(n,o.nodeOrigin),e=H(n.extent)?n.extent:o.nodeExtent,r=v(t,e,B(n));n.internals.positionAbsolute=r}},t.updateConnectionLookup=function(t,e,n){t.clear(),e.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=o,s={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:a},u=`${n}-${i}--${r}-${a}`;yt("source",s,`${r}-${a}--${n}-${i}`,t,n,i),yt("target",s,u,t,r,a),e.set(o.id,o)}},t.updateNodeInternals=function(t,e,n,o,r,i,a){const s=o?.querySelector(".xyflow__viewport");let u=!1;if(!s)return{changes:[],updatedInternals:u};const c=[],l=window.getComputedStyle(s),{m22:h}=new window.DOMMatrixReadOnly(l.transform),d=[];for(const o of t.values()){const t=e.get(o.id);if(!t)continue;if(t.hidden){e.set(t.id,{...t,internals:{...t.internals,handleBounds:void 0}}),u=!0;continue}const s=R(o.nodeElement),l=t.measured.width!==s.width||t.measured.height!==s.height;if(!(!s.width||!s.height||!l&&t.internals.handleBounds&&!o.force)){const f=o.nodeElement.getBoundingClientRect(),p=H(t.extent)?t.extent:i;let{positionAbsolute:g}=t.internals;t.parentId&&"parent"===t.extent?g=x(g,s,e.get(t.parentId)):p&&(g=v(g,p,s));const m={...t,measured:s,internals:{...t.internals,positionAbsolute:g,handleBounds:{source:Z("source",o.nodeElement,f,h,t.id),target:Z("target",o.nodeElement,f,h,t.id)}}};e.set(t.id,m),t.parentId&&pt(m,e,n,{nodeOrigin:r,zIndexMode:a}),u=!0,l&&(c.push({id:t.id,type:"dimensions",dimensions:s}),t.expandParent&&t.parentId&&d.push({id:t.id,parentId:t.parentId,rect:E(m,r)}))}}if(d.length>0){const t=mt(d,e,n,r);c.push(...t)}return{changes:c,updatedInternals:u}},t.withResolvers=function(){let t,e;return{promise:new Promise(((n,o)=>{t=n,e=o})),resolve:t,reject:e}}}));
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).XYFlowSystem={})}(this,(function(t){"use strict";const e={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${"source"===t?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},n=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],o={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var r,i,a;t.ConnectionMode=void 0,(r=t.ConnectionMode||(t.ConnectionMode={})).Strict="strict",r.Loose="loose",t.PanOnScrollMode=void 0,(i=t.PanOnScrollMode||(t.PanOnScrollMode={})).Free="free",i.Vertical="vertical",i.Horizontal="horizontal",t.SelectionMode=void 0,(a=t.SelectionMode||(t.SelectionMode={})).Partial="partial",a.Full="full";var s,u,c;t.ConnectionLineType=void 0,(s=t.ConnectionLineType||(t.ConnectionLineType={})).Bezier="default",s.Straight="straight",s.Step="step",s.SmoothStep="smoothstep",s.SimpleBezier="simplebezier",t.MarkerType=void 0,(u=t.MarkerType||(t.MarkerType={})).Arrow="arrow",u.ArrowClosed="arrowclosed",t.Position=void 0,(c=t.Position||(t.Position={})).Left="left",c.Top="top",c.Right="right",c.Bottom="bottom";const l={[t.Position.Left]:t.Position.Right,[t.Position.Right]:t.Position.Left,[t.Position.Top]:t.Position.Bottom,[t.Position.Bottom]:t.Position.Top};const h=t=>"id"in t&&"source"in t&&"target"in t,d=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),f=(t,e=[0,0])=>{const{width:n,height:o}=B(t),r=t.origin??e,i=n*r[0],a=o*r[1];return{x:t.position.x-i,y:t.position.y-a}},p=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach((t=>{(void 0===e.filter||e.filter(t))&&(n=b(n,z(t)),o=!0)})),o?P(n):{x:0,y:0,width:0,height:0}},g=(t,e)=>{const n=new Set;return t.forEach((t=>{n.add(t.id)})),e.filter((t=>n.has(t.source)||n.has(t.target)))};function m({nodeId:t,nextPosition:n,nodeLookup:o,nodeOrigin:r=[0,0],nodeExtent:i,onError:a}){const s=o.get(t),u=s.parentId?o.get(s.parentId):void 0,{x:c,y:l}=u?u.internals.positionAbsolute:{x:0,y:0},h=s.origin??r;let d=s.extent||i;if("parent"!==s.extent||s.expandParent)u&&H(s.extent)&&(d=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);else if(u){const t=u.measured.width,e=u.measured.height;t&&e&&(d=[[c,l],[c+t,l+e]])}else a?.("005",e.error005());const f=H(d)?v(n,d,s.measured):n;return void 0!==s.measured.width&&void 0!==s.measured.height||a?.("015",e.error015()),{position:{x:f.x-c+(s.measured.width??0)*h[0],y:f.y-l+(s.measured.height??0)*h[1]},positionAbsolute:f}}const y=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),v=(t={x:0,y:0},e,n)=>({x:y(t.x,e[0][0],e[1][0]-(n?.width??0)),y:y(t.y,e[0][1],e[1][1]-(n?.height??0))});function x(t,e,n){const{width:o,height:r}=B(n),{x:i,y:a}=n.internals.positionAbsolute;return v(t,[[i,a],[i+o,a+r]],e)}const w=(t,e,n)=>t<e?y(Math.abs(t-e),1,e)/e:t>n?-y(Math.abs(t-n),1,e)/e:0,_=(t,e,n=15,o=40)=>[w(t.x,o,e.width-o)*n,w(t.y,o,e.height-o)*n],b=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),M=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),P=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),E=(t,e=[0,0])=>{const{x:n,y:o}=d(t)?t.internals.positionAbsolute:f(t,e);return{x:n,y:o,width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}},z=(t,e=[0,0])=>{const{x:n,y:o}=d(t)?t.internals.positionAbsolute:f(t,e);return{x:n,y:o,x2:n+(t.measured?.width??t.width??t.initialWidth??0),y2:o+(t.measured?.height??t.height??t.initialHeight??0)}},N=(t,e)=>P(b(M(t),M(e))),S=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},k=t=>!isNaN(t)&&isFinite(t),I=(t,e)=>{},A=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),T=({x:t,y:e},[n,o,r],i=!1,a=[1,1])=>{const s={x:(t-n)/r,y:(e-o)/r};return i?A(s,a):s},$=({x:t,y:e},[n,o,r])=>({x:t*r+n,y:e*r+o});function C(t,e){if("number"==typeof t)return Math.floor(.5*(e-e/(1+t)));if("string"==typeof t&&t.endsWith("px")){const e=parseFloat(t);if(!Number.isNaN(e))return Math.floor(e)}if("string"==typeof t&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const O=(t,e,n,o,r,i)=>{const a=function(t,e,n){if("string"==typeof t||"number"==typeof t){const o=C(t,n),r=C(t,e);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof t){const o=C(t.top??t.y??0,n),r=C(t.bottom??t.y??0,n),i=C(t.left??t.x??0,e),a=C(t.right??t.x??0,e);return{top:o,right:a,bottom:r,left:i,x:i+a,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,e,n),s=(e-a.x)/t.width,u=(n-a.y)/t.height,c=Math.min(s,u),l=y(c,o,r),h=e/2-(t.x+t.width/2)*l,d=n/2-(t.y+t.height/2)*l,f=function(t,e,n,o,r,i){const{x:a,y:s}=$(t,[e,n,o]),{x:u,y:c}=$({x:t.x+t.width,y:t.y+t.height},[e,n,o]),l=r-u,h=i-c;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(l),bottom:Math.floor(h)}}(t,h,d,l,e,n),p=Math.min(f.left-a.left,0),g=Math.min(f.top-a.top,0);return{x:h-p+Math.min(f.right-a.right,0),y:d-g+Math.min(f.bottom-a.bottom,0),zoom:l}},D=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function H(t){return null!=t&&"parent"!==t}function B(t){return{width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}}function L(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:a}=q(t),s=T({x:i-(r?.left??0),y:a-(r?.top??0)},o),{x:u,y:c}=n?A(s,e):s;return{xSnapped:u,ySnapped:c,...s}}const R=t=>({width:t.offsetWidth,height:t.offsetHeight}),X=t=>t?.getRootNode?.()||window?.document,Y=["INPUT","SELECT","TEXTAREA"];const V=t=>"clientX"in t,q=(t,e)=>{const n=V(t),o=n?t.clientX:t.touches?.[0].clientX,r=n?t.clientY:t.touches?.[0].clientY;return{x:o-(e?.left??0),y:r-(e?.top??0)}},Z=(t,e,n,o,r)=>{const i=e.querySelectorAll(`.${t}`);return i&&i.length?Array.from(i).map((e=>{const i=e.getBoundingClientRect();return{id:e.getAttribute("data-handleid"),type:t,nodeId:r,position:e.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...R(e)}})):null};function G({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:a,targetControlY:s}){const u=.125*t+.375*r+.375*a+.125*n,c=.125*e+.375*i+.375*s+.125*o;return[u,c,Math.abs(u-t),Math.abs(c-e)]}function j(t,e){return t>=0?.5*t:25*e*Math.sqrt(-t)}function W({pos:e,x1:n,y1:o,x2:r,y2:i,c:a}){switch(e){case t.Position.Left:return[n-j(n-r,a),o];case t.Position.Right:return[n+j(r-n,a),o];case t.Position.Top:return[n,o-j(o-i,a)];case t.Position.Bottom:return[n,o+j(i-o,a)]}}function F({sourceX:t,sourceY:e,targetX:n,targetY:o}){const r=Math.abs(n-t)/2,i=n<t?n+r:n-r,a=Math.abs(o-e)/2;return[i,o<e?o+a:o-a,r,a]}const K=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`;const U={[t.Position.Left]:{x:-1,y:0},[t.Position.Right]:{x:1,y:0},[t.Position.Top]:{x:0,y:-1},[t.Position.Bottom]:{x:0,y:1}},Q=({source:e,sourcePosition:n=t.Position.Bottom,target:o})=>n===t.Position.Left||n===t.Position.Right?e.x<o.x?{x:1,y:0}:{x:-1,y:0}:e.y<o.y?{x:0,y:1}:{x:0,y:-1},J=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function tt(t,e,n,o){const r=Math.min(J(t,e)/2,J(e,n)/2,o),{x:i,y:a}=e;if(t.x===i&&i===n.x||t.y===a&&a===n.y)return`L${i} ${a}`;if(t.y===a){return`L ${i+r*(t.x<n.x?-1:1)},${a}Q ${i},${a} ${i},${a+r*(t.y<n.y?1:-1)}`}const s=t.x<n.x?1:-1;return`L ${i},${a+r*(t.y<n.y?-1:1)}Q ${i},${a} ${i+r*s},${a}`}function et(t){return t&&!(!t.internals.handleBounds&&!t.handles?.length)&&!!(t.measured.width||t.width||t.initialWidth)}function nt(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,"source"===o.type?e.push(o):"target"===o.type&&n.push(o);return{source:e,target:n}}function ot(e,n,o=t.Position.Left,r=!1){const i=(n?.x??0)+e.internals.positionAbsolute.x,a=(n?.y??0)+e.internals.positionAbsolute.y,{width:s,height:u}=n??B(e);if(r)return{x:i+s/2,y:a+u/2};switch(n?.position??o){case t.Position.Top:return{x:i+s/2,y:a};case t.Position.Right:return{x:i+s,y:a+u/2};case t.Position.Bottom:return{x:i+s/2,y:a+u};case t.Position.Left:return{x:i,y:a+u/2}}}function rt(t,e){return t&&(e?t.find((t=>t.id===e)):t[0])||null}function it(t,e){if(!t)return"";if("string"==typeof t)return t;return`${e?`${e}__`:""}${Object.keys(t).sort().map((e=>`${e}=${t[e]}`)).join("&")}`}const at={left:0,center:50,right:100},st={top:0,center:50,bottom:100};const ut=1e3,ct=10,lt={nodeOrigin:[0,0],nodeExtent:n,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ht={...lt,checkEquality:!0};function dt(t,e){const n={...t};for(const t in e)void 0!==e[t]&&(n[t]=e[t]);return n}function ft(t,e){if(!t.handles)return t.measured?e?.internals.handleBounds:void 0;const n=[],o=[];for(const e of t.handles){const r={id:e.id,width:e.width??1,height:e.height??1,nodeId:t.id,x:e.x,y:e.y,position:e.position,type:e.type};"source"===e.type?n.push(r):"target"===e.type&&o.push(r)}return{source:n,target:o}}function pt(t){return"manual"===t}function gt(t,e,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:s,zIndexMode:u}=dt(lt,o),c=t.parentId,l=e.get(c);if(!l)return void console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}(t,n),r&&!l.parentId&&void 0===l.internals.rootParentIndex&&"auto"===u&&(l.internals.rootParentIndex=++r.i,l.internals.z=l.internals.z+r.i*ct),r&&void 0!==l.internals.rootParentIndex&&(r.i=l.internals.rootParentIndex);const h=i&&!pt(u)?ut:0,{x:d,y:p,z:g}=function(t,e,n,o,r,i){const{x:a,y:s}=e.internals.positionAbsolute,u=B(t),c=f(t,n),l=H(t.extent)?v(c,t.extent,u):c;let h=v({x:a+l.x,y:s+l.y},o,u);"parent"===t.extent&&(h=x(h,u,e));const d=mt(t,r,i),p=e.internals.z??0;return{x:h.x,y:h.y,z:p>=d?p+1:d}}(t,l,a,s,h,u),{positionAbsolute:m}=t.internals,y=d!==m.x||p!==m.y;(y||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:y?{x:d,y:p}:m,z:g}})}function mt(t,e,n){const o=k(t.zIndex)?t.zIndex:0;return pt(n)?o:o+(t.selected?e:0)}function yt(t,e,n,o=[0,0]){const r=[],i=new Map;for(const n of t){const t=e.get(n.parentId);if(!t)continue;const o=i.get(n.parentId)?.expandedRect??E(t),r=N(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:t})}return i.size>0&&i.forEach((({expandedRect:e,parent:i},a)=>{const s=i.internals.positionAbsolute,u=B(i),c=i.origin??o,l=e.x<s.x?Math.round(Math.abs(s.x-e.x)):0,h=e.y<s.y?Math.round(Math.abs(s.y-e.y)):0,d=Math.max(u.width,Math.round(e.width)),f=Math.max(u.height,Math.round(e.height)),p=(d-u.width)*c[0],g=(f-u.height)*c[1];(l>0||h>0||p||g)&&(r.push({id:a,type:"position",position:{x:i.position.x-l+p,y:i.position.y-h+g}}),n.get(a)?.forEach((e=>{t.some((t=>t.id===e.id))||r.push({id:e.id,type:"position",position:{x:e.position.x+l,y:e.position.y+h}})}))),(u.width<e.width||u.height<e.height||l||h)&&r.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:d+(l?c[0]*l-p:0),height:f+(h?c[1]*h-g:0)}})})),r}function vt(t,e,n,o,r,i){let a=r;const s=o.get(a)||new Map;o.set(a,s.set(n,e)),a=`${r}-${t}`;const u=o.get(a)||new Map;if(o.set(a,u.set(n,e)),i){a=`${r}-${t}-${i}`;const s=o.get(a)||new Map;o.set(a,s.set(n,e))}}var xt={value:()=>{}};function wt(){for(var t,e=0,n=arguments.length,o={};e<n;++e){if(!(t=arguments[e]+"")||t in o||/[\s.]/.test(t))throw new Error("illegal type: "+t);o[t]=[]}return new _t(o)}function _t(t){this._=t}function bt(t,e){for(var n,o=0,r=t.length;o<r;++o)if((n=t[o]).name===e)return n.value}function Mt(t,e,n){for(var o=0,r=t.length;o<r;++o)if(t[o].name===e){t[o]=xt,t=t.slice(0,o).concat(t.slice(o+1));break}return null!=n&&t.push({name:e,value:n}),t}_t.prototype=wt.prototype={constructor:_t,on:function(t,e){var n,o,r=this._,i=(o=r,(t+"").trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!o.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}}))),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=i[a]).type)r[n]=Mt(r[n],t.name,e);else if(null==e)for(n in r)r[n]=Mt(r[n],t.name,null);return this}for(;++a<s;)if((n=(t=i[a]).type)&&(n=bt(r[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new _t(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=0,n=(o=this._[t]).length;i<n;++i)o[i].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)}};var Pt="http://www.w3.org/1999/xhtml",Et={svg:"http://www.w3.org/2000/svg",xhtml:Pt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function zt(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Et.hasOwnProperty(e)?{space:Et[e],local:t}:t}function Nt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Pt&&e.documentElement.namespaceURI===Pt?e.createElement(t):e.createElementNS(n,t)}}function St(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function kt(t){var e=zt(t);return(e.local?St:Nt)(e)}function It(){}function At(t){return null==t?It:function(){return this.querySelector(t)}}function Tt(){return[]}function $t(t){return null==t?Tt:function(){return this.querySelectorAll(t)}}function Ct(t){return function(){return null==(e=t.apply(this,arguments))?[]:Array.isArray(e)?e:Array.from(e);var e}}function Ot(t){return function(){return this.matches(t)}}function Dt(t){return function(e){return e.matches(t)}}var Ht=Array.prototype.find;function Bt(){return this.firstElementChild}var Lt=Array.prototype.filter;function Rt(){return Array.from(this.children)}function Xt(t){return new Array(t.length)}function Yt(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function Vt(t,e,n,o,r,i){for(var a,s=0,u=e.length,c=i.length;s<c;++s)(a=e[s])?(a.__data__=i[s],o[s]=a):n[s]=new Yt(t,i[s]);for(;s<u;++s)(a=e[s])&&(r[s]=a)}function qt(t,e,n,o,r,i,a){var s,u,c,l=new Map,h=e.length,d=i.length,f=new Array(h);for(s=0;s<h;++s)(u=e[s])&&(f[s]=c=a.call(u,u.__data__,s,e)+"",l.has(c)?r[s]=u:l.set(c,u));for(s=0;s<d;++s)c=a.call(t,i[s],s,i)+"",(u=l.get(c))?(o[s]=u,u.__data__=i[s],l.delete(c)):n[s]=new Yt(t,i[s]);for(s=0;s<h;++s)(u=e[s])&&l.get(f[s])===u&&(r[s]=u)}function Zt(t){return t.__data__}function Gt(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function jt(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function Wt(t){return function(){this.removeAttribute(t)}}function Ft(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Kt(t,e){return function(){this.setAttribute(t,e)}}function Ut(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Qt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function Jt(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function te(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function ee(t){return function(){this.style.removeProperty(t)}}function ne(t,e,n){return function(){this.style.setProperty(t,e,n)}}function oe(t,e,n){return function(){var o=e.apply(this,arguments);null==o?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function re(t,e){return t.style.getPropertyValue(e)||te(t).getComputedStyle(t,null).getPropertyValue(e)}function ie(t){return function(){delete this[t]}}function ae(t,e){return function(){this[t]=e}}function se(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ue(t){return t.trim().split(/^|\s+/)}function ce(t){return t.classList||new le(t)}function le(t){this._node=t,this._names=ue(t.getAttribute("class")||"")}function he(t,e){for(var n=ce(t),o=-1,r=e.length;++o<r;)n.add(e[o])}function de(t,e){for(var n=ce(t),o=-1,r=e.length;++o<r;)n.remove(e[o])}function fe(t){return function(){he(this,t)}}function pe(t){return function(){de(this,t)}}function ge(t,e){return function(){(e.apply(this,arguments)?he:de)(this,t)}}function me(){this.textContent=""}function ye(t){return function(){this.textContent=t}}function ve(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function xe(){this.innerHTML=""}function we(t){return function(){this.innerHTML=t}}function _e(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function be(){this.nextSibling&&this.parentNode.appendChild(this)}function Me(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pe(){return null}function Ee(){var t=this.parentNode;t&&t.removeChild(this)}function ze(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ne(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Se(t){return function(){var e=this.__on;if(e){for(var n,o=0,r=-1,i=e.length;o<i;++o)n=e[o],t.type&&n.type!==t.type||n.name!==t.name?e[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?e.length=r:delete this.__on}}}function ke(t,e,n){return function(){var o,r=this.__on,i=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var a=0,s=r.length;a<s;++a)if((o=r[a]).type===t.type&&o.name===t.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=e);this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Ie(t,e,n){var o=te(t),r=o.CustomEvent;"function"==typeof r?r=new r(e,n):(r=o.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function Ae(t,e){return function(){return Ie(this,t,e)}}function Te(t,e){return function(){return Ie(this,t,e.apply(this,arguments))}}Yt.prototype={constructor:Yt,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},le.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var $e=[null];function Ce(t,e){this._groups=t,this._parents=e}function Oe(){return new Ce([[document.documentElement]],$e)}function De(t){return"string"==typeof t?new Ce([[document.querySelector(t)]],[document.documentElement]):new Ce([[t]],$e)}function He(t,e){if(t=function(t){let e;for(;e=t.sourceEvent;)t=e;return t}(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,[(o=o.matrixTransform(e.getScreenCTM().inverse())).x,o.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}Ce.prototype=Oe.prototype={constructor:Ce,select:function(t){"function"!=typeof t&&(t=At(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i,a,s=e[r],u=s.length,c=o[r]=new Array(u),l=0;l<u;++l)(i=s[l])&&(a=t.call(i,i.__data__,l,s))&&("__data__"in i&&(a.__data__=i.__data__),c[l]=a);return new Ce(o,this._parents)},selectAll:function(t){t="function"==typeof t?Ct(t):$t(t);for(var e=this._groups,n=e.length,o=[],r=[],i=0;i<n;++i)for(var a,s=e[i],u=s.length,c=0;c<u;++c)(a=s[c])&&(o.push(t.call(a,a.__data__,c,s)),r.push(a));return new Ce(o,r)},selectChild:function(t){return this.select(null==t?Bt:function(t){return function(){return Ht.call(this.children,t)}}("function"==typeof t?t:Dt(t)))},selectChildren:function(t){return this.selectAll(null==t?Rt:function(t){return function(){return Lt.call(this.children,t)}}("function"==typeof t?t:Dt(t)))},filter:function(t){"function"!=typeof t&&(t=Ot(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i,a=e[r],s=a.length,u=o[r]=[],c=0;c<s;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&u.push(i);return new Ce(o,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,Zt);var n,o=e?qt:Vt,r=this._parents,i=this._groups;"function"!=typeof t&&(n=t,t=function(){return n});for(var a=i.length,s=new Array(a),u=new Array(a),c=new Array(a),l=0;l<a;++l){var h=r[l],d=i[l],f=d.length,p=Gt(t.call(h,h&&h.__data__,l,r)),g=p.length,m=u[l]=new Array(g),y=s[l]=new Array(g);o(h,d,m,y,c[l]=new Array(f),p,e);for(var v,x,w=0,_=0;w<g;++w)if(v=m[w]){for(w>=_&&(_=w+1);!(x=y[_])&&++_<g;);v._next=x||null}}return(s=new Ce(s,r))._enter=u,s._exit=c,s},enter:function(){return new Ce(this._enter||this._groups.map(Xt),this._parents)},exit:function(){return new Ce(this._exit||this._groups.map(Xt),this._parents)},join:function(t,e,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof t?(o=t(o))&&(o=o.selection()):o=o.append(t+""),null!=e&&(r=e(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,r=n.length,i=o.length,a=Math.min(r,i),s=new Array(r),u=0;u<a;++u)for(var c,l=n[u],h=o[u],d=l.length,f=s[u]=new Array(d),p=0;p<d;++p)(c=l[p]||h[p])&&(f[p]=c);for(;u<r;++u)s[u]=n[u];return new Ce(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o,r=t[e],i=r.length-1,a=r[i];--i>=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=jt);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var a,s=n[i],u=s.length,c=r[i]=new Array(u),l=0;l<u;++l)(a=s[l])&&(c[l]=a);c.sort(e)}return new Ce(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],r=0,i=o.length;r<i;++r){var a=o[r];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var r,i=e[n],a=0,s=i.length;a<s;++a)(r=i[a])&&t.call(r,r.__data__,a,i);return this},attr:function(t,e){var n=zt(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==e?n.local?Ft:Wt:"function"==typeof e?n.local?Jt:Qt:n.local?Ut:Kt)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?ee:"function"==typeof e?oe:ne)(t,e,null==n?"":n)):re(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?ie:"function"==typeof e?se:ae)(t,e)):this.node()[t]},classed:function(t,e){var n=ue(t+"");if(arguments.length<2){for(var o=ce(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?ge:e?fe:pe)(n,e))},text:function(t){return arguments.length?this.each(null==t?me:("function"==typeof t?ve:ye)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?xe:("function"==typeof t?_e:we)(t)):this.node().innerHTML},raise:function(){return this.each(be)},lower:function(){return this.each(Me)},append:function(t){var e="function"==typeof t?t:kt(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:kt(t),o=null==e?Pe:"function"==typeof e?e:At(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)}))},remove:function(){return this.each(Ee)},clone:function(t){return this.select(t?Ne:ze)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var o,r,i=function(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}(t+""),a=i.length;if(!(arguments.length<2)){for(s=e?ke:Se,o=0;o<a;++o)this.each(s(i[o],e,n));return this}var s=this.node().__on;if(s)for(var u,c=0,l=s.length;c<l;++c)for(o=0,u=s[c];o<a;++o)if((r=i[o]).type===u.type&&r.name===u.name)return u.value},dispatch:function(t,e){return this.each(("function"==typeof e?Te:Ae)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o,r=t[e],i=0,a=r.length;i<a;++i)(o=r[i])&&(yield o)}};const Be={passive:!1},Le={capture:!0,passive:!1};function Re(t){t.stopImmediatePropagation()}function Xe(t){t.preventDefault(),t.stopImmediatePropagation()}function Ye(t){var e=t.document.documentElement,n=De(t).on("dragstart.drag",Xe,Le);"onselectstart"in e?n.on("selectstart.drag",Xe,Le):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ve(t,e){var n=t.document.documentElement,o=De(t).on("dragstart.drag",null);e&&(o.on("click.drag",Xe,Le),setTimeout((function(){o.on("click.drag",null)}),0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var qe=t=>()=>t;function Ze(t,{sourceEvent:e,subject:n,target:o,identifier:r,active:i,x:a,y:s,dx:u,dy:c,dispatch:l}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:l}})}function Ge(t){return!t.ctrlKey&&!t.button}function je(){return this.parentNode}function We(t,e){return null==e?{x:t.x,y:t.y}:e}function Fe(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ke(){var t,e,n,o,r=Ge,i=je,a=We,s=Fe,u={},c=wt("start","drag","end"),l=0,h=0;function d(t){t.on("mousedown.drag",f).filter(s).on("touchstart.drag",m).on("touchmove.drag",y,Be).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,s){if(!o&&r.call(this,a,s)){var u=x(this,i.call(this,a,s),a,s,"mouse");u&&(De(a.view).on("mousemove.drag",p,Le).on("mouseup.drag",g,Le),Ye(a.view),Re(a),n=!1,t=a.clientX,e=a.clientY,u("start",a))}}function p(o){if(Xe(o),!n){var r=o.clientX-t,i=o.clientY-e;n=r*r+i*i>h}u.mouse("drag",o)}function g(t){De(t.view).on("mousemove.drag mouseup.drag",null),Ve(t.view,n),Xe(t),u.mouse("end",t)}function m(t,e){if(r.call(this,t,e)){var n,o,a=t.changedTouches,s=i.call(this,t,e),u=a.length;for(n=0;n<u;++n)(o=x(this,s,t,e,a[n].identifier,a[n]))&&(Re(t),o("start",t,a[n]))}}function y(t){var e,n,o=t.changedTouches,r=o.length;for(e=0;e<r;++e)(n=u[o[e].identifier])&&(Xe(t),n("drag",t,o[e]))}function v(t){var e,n,r=t.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout((function(){o=null}),500),e=0;e<i;++e)(n=u[r[e].identifier])&&(Re(t),n("end",t,r[e]))}function x(t,e,n,o,r,i){var s,h,f,p=c.copy(),g=He(i||n,e);if(null!=(f=a.call(t,new Ze("beforestart",{sourceEvent:n,target:d,identifier:r,active:l,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),o)))return s=f.x-g[0]||0,h=f.y-g[1]||0,function n(i,a,c){var m,y=g;switch(i){case"start":u[r]=n,m=l++;break;case"end":delete u[r],--l;case"drag":g=He(c||a,e),m=l}p.call(i,t,new Ze(i,{sourceEvent:a,subject:f,target:d,identifier:r,active:m,x:g[0]+s,y:g[1]+h,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),o)}}return d.filter=function(t){return arguments.length?(r="function"==typeof t?t:qe(!!t),d):r},d.container=function(t){return arguments.length?(i="function"==typeof t?t:qe(t),d):i},d.subject=function(t){return arguments.length?(a="function"==typeof t?t:qe(t),d):a},d.touchable=function(t){return arguments.length?(s="function"==typeof t?t:qe(!!t),d):s},d.on=function(){var t=c.on.apply(c,arguments);return t===c?d:t},d.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,d):Math.sqrt(h)},d}function Ue(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return!!n&&(!!n.selected||Ue(n,e))}function Qe(t,e,n){let o=t;do{if(o?.matches?.(e))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Je({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){const r=[];for(const[t,i]of e){const e=n.get(t)?.internals.userNode;e&&r.push({...e,position:i.position,dragging:o})}if(!t)return[r[0],r];const i=n.get(t)?.internals.userNode;return[i?{...i,position:e.get(t)?.position||i.position,dragging:o}:r[0],r]}Ze.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};const tn=250;function en(t,e,n,o){let r=[],i=1/0;const a=function(t,e,n){const o=[],r={x:t.x-n,y:t.y-n,width:2*n,height:2*n};for(const t of e.values())S(r,E(t))>0&&o.push(t);return o}(t,n,e+tn);for(const n of a){const a=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const s of a){if(o.nodeId===s.nodeId&&o.type===s.type&&o.id===s.id)continue;const{x:a,y:u}=ot(n,s,s.position,!0),c=Math.sqrt(Math.pow(a-t.x,2)+Math.pow(u-t.y,2));c>e||(c<i?(r=[{...s,x:a,y:u}],i=c):c===i&&r.push({...s,x:a,y:u}))}}if(!r.length)return null;if(r.length>1){const t="source"===o.type?"target":"source";return r.find((e=>e.type===t))??r[0]}return r[0]}function nn(t,e,n,o,r,i=!1){const a=o.get(t);if(!a)return null;const s="strict"===r?a.internals.handleBounds?.[e]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],u=(n?s?.find((t=>t.id===n)):s?.[0])??null;return u&&i?{...u,...ot(a,u,u.position,!0)}:u}function on(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}const rn=()=>!0;function an(e,{handle:n,connectionMode:o,fromNodeId:r,fromHandleId:i,fromType:a,doc:s,lib:u,flowId:c,isValidConnection:l=rn,nodeLookup:h}){const d="target"===a,f=n?s.querySelector(`.${u}-flow__handle[data-id="${c}-${n?.nodeId}-${n?.id}-${n?.type}"]`):null,{x:p,y:g}=q(e),m=s.elementFromPoint(p,g),y=m?.classList.contains(`${u}-flow__handle`)?m:f,v={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const e=on(void 0,y),n=y.getAttribute("data-nodeid"),a=y.getAttribute("data-handleid"),s=y.classList.contains("connectable"),u=y.classList.contains("connectableend");if(!n||!e)return v;const c={source:d?n:r,sourceHandle:d?a:i,target:d?r:n,targetHandle:d?i:a};v.connection=c;const f=s&&u&&(o===t.ConnectionMode.Strict?d&&"source"===e||!d&&"target"===e:n!==r||a!==i);v.isValid=f&&l(c),v.toHandle=nn(n,e,a,h,o,!0)}return v}const sn={onPointerDown:function(e,{connectionMode:n,connectionRadius:o,handleId:r,nodeId:i,edgeUpdaterType:a,isTarget:s,domNode:u,nodeLookup:c,lib:h,autoPanOnConnect:d,flowId:f,panBy:p,cancelConnection:g,onConnectStart:m,onConnect:y,onConnectEnd:v,isValidConnection:x=rn,onReconnectEnd:w,updateConnection:b,getTransform:M,getFromHandle:P,autoPanSpeed:E,dragThreshold:z=1,handleDomNode:N}){const S=X(e.target);let k,I=0;const{x:A,y:C}=q(e),O=on(a,N),D=u?.getBoundingClientRect();let H=!1;if(!D||!O)return;const B=nn(i,O,r,c,n);if(!B)return;let L=q(e,D),R=!1,Y=null,V=!1,Z=null;function G(){if(!d||!D)return;const[t,e]=_(L,D,E);p({x:t,y:e}),I=requestAnimationFrame(G)}const j={...B,nodeId:i,type:O,position:B.position},W=c.get(i);let F={inProgress:!0,isValid:null,from:ot(W,j,t.Position.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:W,to:L,toHandle:null,toPosition:l[j.position],toNode:null,pointer:L};function K(){H=!0,b(F),m?.(e,{nodeId:i,handleId:r,handleType:O})}function U(e){if(!H){const{x:t,y:n}=q(e),o=t-A,r=n-C;if(!(o*o+r*r>z*z))return;K()}if(!P()||!j)return void Q(e);const a=M();L=q(e,D),k=en(T(L,a,!1,[1,1]),o,c,j),R||(G(),R=!0);const u=an(e,{handle:k,connectionMode:n,fromNodeId:i,fromHandleId:r,fromType:s?"target":"source",isValidConnection:x,doc:S,lib:h,flowId:f,nodeLookup:c});Z=u.handleDomNode,Y=u.connection,V=function(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}(!!k,u.isValid);const d=c.get(i),p=d?ot(d,j,t.Position.Left,!0):F.from,g={...F,from:p,isValid:V,to:u.toHandle&&V?$({x:u.toHandle.x,y:u.toHandle.y},a):L,toHandle:u.toHandle,toPosition:V&&u.toHandle?u.toHandle.position:l[j.position],toNode:u.toHandle?c.get(u.toHandle.nodeId):null,pointer:L};b(g),F=g}function Q(t){if(!("touches"in t&&t.touches.length>0)){if(H){(k||Z)&&Y&&V&&y?.(Y);const{inProgress:e,...n}=F,o={...n,toPosition:F.toHandle?F.toPosition:null};v?.(t,o),a&&w?.(t,o)}g(),cancelAnimationFrame(I),R=!1,V=!1,Y=null,Z=null,S.removeEventListener("mousemove",U),S.removeEventListener("mouseup",Q),S.removeEventListener("touchmove",U),S.removeEventListener("touchend",Q)}}0===z&&K(),S.addEventListener("mousemove",U),S.addEventListener("mouseup",Q),S.addEventListener("touchmove",U),S.addEventListener("touchend",Q)},isValid:an};function un(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function cn(t,e){var n=Object.create(t.prototype);for(var o in e)n[o]=e[o];return n}function ln(){}var hn=.7,dn=1/hn,fn="\\s*([+-]?\\d+)\\s*",pn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",gn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mn=/^#([0-9a-f]{3,8})$/,yn=new RegExp(`^rgb\\(${fn},${fn},${fn}\\)$`),vn=new RegExp(`^rgb\\(${gn},${gn},${gn}\\)$`),xn=new RegExp(`^rgba\\(${fn},${fn},${fn},${pn}\\)$`),wn=new RegExp(`^rgba\\(${gn},${gn},${gn},${pn}\\)$`),_n=new RegExp(`^hsl\\(${pn},${gn},${gn}\\)$`),bn=new RegExp(`^hsla\\(${pn},${gn},${gn},${pn}\\)$`),Mn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Pn(){return this.rgb().formatHex()}function En(){return this.rgb().formatRgb()}function zn(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=mn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Nn(e):3===n?new In(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?Sn(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?Sn(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=yn.exec(t))?new In(e[1],e[2],e[3],1):(e=vn.exec(t))?new In(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=xn.exec(t))?Sn(e[1],e[2],e[3],e[4]):(e=wn.exec(t))?Sn(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=_n.exec(t))?Dn(e[1],e[2]/100,e[3]/100,1):(e=bn.exec(t))?Dn(e[1],e[2]/100,e[3]/100,e[4]):Mn.hasOwnProperty(t)?Nn(Mn[t]):"transparent"===t?new In(NaN,NaN,NaN,0):null}function Nn(t){return new In(t>>16&255,t>>8&255,255&t,1)}function Sn(t,e,n,o){return o<=0&&(t=e=n=NaN),new In(t,e,n,o)}function kn(t,e,n,o){return 1===arguments.length?((r=t)instanceof ln||(r=zn(r)),r?new In((r=r.rgb()).r,r.g,r.b,r.opacity):new In):new In(t,e,n,null==o?1:o);var r}function In(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}function An(){return`#${On(this.r)}${On(this.g)}${On(this.b)}`}function Tn(){const t=$n(this.opacity);return`${1===t?"rgb(":"rgba("}${Cn(this.r)}, ${Cn(this.g)}, ${Cn(this.b)}${1===t?")":`, ${t})`}`}function $n(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Cn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function On(t){return((t=Cn(t))<16?"0":"")+t.toString(16)}function Dn(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Bn(t,e,n,o)}function Hn(t){if(t instanceof Bn)return new Bn(t.h,t.s,t.l,t.opacity);if(t instanceof ln||(t=zn(t)),!t)return new Bn;if(t instanceof Bn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,o=t.b/255,r=Math.min(e,n,o),i=Math.max(e,n,o),a=NaN,s=i-r,u=(i+r)/2;return s?(a=e===i?(n-o)/s+6*(n<o):n===i?(o-e)/s+2:(e-n)/s+4,s/=u<.5?i+r:2-i-r,a*=60):s=u>0&&u<1?0:a,new Bn(a,s,u,t.opacity)}function Bn(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}function Ln(t){return(t=(t||0)%360)<0?t+360:t}function Rn(t){return Math.max(0,Math.min(1,t||0))}function Xn(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}un(ln,zn,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Pn,formatHex:Pn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Hn(this).formatHsl()},formatRgb:En,toString:En}),un(In,kn,cn(ln,{brighter(t){return t=null==t?dn:Math.pow(dn,t),new In(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?hn:Math.pow(hn,t),new In(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new In(Cn(this.r),Cn(this.g),Cn(this.b),$n(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:An,formatHex:An,formatHex8:function(){return`#${On(this.r)}${On(this.g)}${On(this.b)}${On(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Tn,toString:Tn})),un(Bn,(function(t,e,n,o){return 1===arguments.length?Hn(t):new Bn(t,e,n,null==o?1:o)}),cn(ln,{brighter(t){return t=null==t?dn:Math.pow(dn,t),new Bn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?hn:Math.pow(hn,t),new Bn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,r=2*n-o;return new In(Xn(t>=240?t-240:t+120,r,o),Xn(t,r,o),Xn(t<120?t+240:t-120,r,o),this.opacity)},clamp(){return new Bn(Ln(this.h),Rn(this.s),Rn(this.l),$n(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=$n(this.opacity);return`${1===t?"hsl(":"hsla("}${Ln(this.h)}, ${100*Rn(this.s)}%, ${100*Rn(this.l)}%${1===t?")":`, ${t})`}`}}));var Yn=t=>()=>t;function Vn(t){return 1==(t=+t)?qn:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}(e,n,t):Yn(isNaN(e)?n:e)}}function qn(t,e){var n=e-t;return n?function(t,e){return function(n){return t+n*e}}(t,n):Yn(isNaN(t)?e:t)}var Zn=function t(e){var n=Vn(e);function o(t,e){var o=n((t=kn(t)).r,(e=kn(e)).r),r=n(t.g,e.g),i=n(t.b,e.b),a=qn(t.opacity,e.opacity);return function(e){return t.r=o(e),t.g=r(e),t.b=i(e),t.opacity=a(e),t+""}}return o.gamma=t,o}(1);function Gn(t,e){e||(e=[]);var n,o=t?Math.min(e.length,t.length):0,r=e.slice();return function(i){for(n=0;n<o;++n)r[n]=t[n]*(1-i)+e[n]*i;return r}}function jn(t,e){var n,o=e?e.length:0,r=t?Math.min(o,t.length):0,i=new Array(r),a=new Array(o);for(n=0;n<r;++n)i[n]=to(t[n],e[n]);for(;n<o;++n)a[n]=e[n];return function(t){for(n=0;n<r;++n)a[n]=i[n](t);return a}}function Wn(t,e){var n=new Date;return t=+t,e=+e,function(o){return n.setTime(t*(1-o)+e*o),n}}function Fn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Kn(t,e){var n,o={},r={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?o[n]=to(t[n],e[n]):r[n]=e[n];return function(t){for(n in o)r[n]=o[n](t);return r}}var Un=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Qn=new RegExp(Un.source,"g");function Jn(t,e){var n,o,r,i=Un.lastIndex=Qn.lastIndex=0,a=-1,s=[],u=[];for(t+="",e+="";(n=Un.exec(t))&&(o=Qn.exec(e));)(r=o.index)>i&&(r=e.slice(i,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,u.push({i:a,x:Fn(n,o)})),i=Qn.lastIndex;return i<e.length&&(r=e.slice(i),s[a]?s[a]+=r:s[++a]=r),s.length<2?u[0]?function(t){return function(e){return t(e)+""}}(u[0].x):function(t){return function(){return t}}(e):(e=u.length,function(t){for(var n,o=0;o<e;++o)s[(n=u[o]).i]=n.x(t);return s.join("")})}function to(t,e){var n,o,r=typeof e;return null==e||"boolean"===r?Yn(e):("number"===r?Fn:"string"===r?(n=zn(e))?(e=n,Zn):Jn:e instanceof zn?Zn:e instanceof Date?Wn:(o=e,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(e)?jn:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Kn:Fn:Gn))(t,e)}var eo,no=180/Math.PI,oo={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ro(t,e,n,o,r,i){var a,s,u;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(u=t*n+e*o)&&(n-=t*u,o-=e*u),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,u/=s),t*o<e*n&&(t=-t,e=-e,u=-u,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(e,t)*no,skewX:Math.atan(u)*no,scaleX:a,scaleY:s}}function io(t,e,n,o){function r(t){return t.length?t.pop()+" ":""}return function(i,a){var s=[],u=[];return i=t(i),a=t(a),function(t,o,r,i,a,s){if(t!==r||o!==i){var u=a.push("translate(",null,e,null,n);s.push({i:u-4,x:Fn(t,r)},{i:u-2,x:Fn(o,i)})}else(r||i)&&a.push("translate("+r+e+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,s,u),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:Fn(t,e)})):e&&n.push(r(n)+"rotate("+e+o)}(i.rotate,a.rotate,s,u),function(t,e,n,i){t!==e?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:Fn(t,e)}):e&&n.push(r(n)+"skewX("+e+o)}(i.skewX,a.skewX,s,u),function(t,e,n,o,i,a){if(t!==n||e!==o){var s=i.push(r(i)+"scale(",null,",",null,")");a.push({i:s-4,x:Fn(t,n)},{i:s-2,x:Fn(e,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,u),i=a=null,function(t){for(var e,n=-1,o=u.length;++n<o;)s[(e=u[n]).i]=e.x(t);return s.join("")}}}var ao=io((function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?oo:ro(e.a,e.b,e.c,e.d,e.e,e.f)}),"px, ","px)","deg)"),so=io((function(t){return null==t?oo:(eo||(eo=document.createElementNS("http://www.w3.org/2000/svg","g")),eo.setAttribute("transform",t),(t=eo.transform.baseVal.consolidate())?ro((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):oo)}),", ",")",")");function uo(t){return((t=Math.exp(t))+1/t)/2}var co,lo,ho=function t(e,n,o){function r(t,r){var i,a,s=t[0],u=t[1],c=t[2],l=r[0],h=r[1],d=r[2],f=l-s,p=h-u,g=f*f+p*p;if(g<1e-12)a=Math.log(d/c)/e,i=function(t){return[s+t*f,u+t*p,c*Math.exp(e*t*a)]};else{var m=Math.sqrt(g),y=(d*d-c*c+o*g)/(2*c*n*m),v=(d*d-c*c-o*g)/(2*d*n*m),x=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);a=(w-x)/e,i=function(t){var o,r=t*a,i=uo(x),l=c/(n*m)*(i*(o=e*r+x,((o=Math.exp(2*o))-1)/(o+1))-function(t){return((t=Math.exp(t))-1/t)/2}(x));return[s+l*f,u+l*p,c*i/uo(e*r+x)]}}return i.duration=1e3*a*e/Math.SQRT2,i}return r.rho=function(e){var n=Math.max(.001,+e),o=n*n;return t(n,o,o*o)},r}(Math.SQRT2,2,4),fo=0,po=0,go=0,mo=1e3,yo=0,vo=0,xo=0,wo="object"==typeof performance&&performance.now?performance:Date,_o="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function bo(){return vo||(_o(Mo),vo=wo.now()+xo)}function Mo(){vo=0}function Po(){this._call=this._time=this._next=null}function Eo(t,e,n){var o=new Po;return o.restart(t,e,n),o}function zo(){vo=(yo=wo.now())+xo,fo=po=0;try{!function(){bo(),++fo;for(var t,e=co;e;)(t=vo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--fo}()}finally{fo=0,function(){var t,e,n=co,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:co=e);lo=t,So(o)}(),vo=0}}function No(){var t=wo.now(),e=t-yo;e>mo&&(xo-=e,yo=t)}function So(t){fo||(po&&(po=clearTimeout(po)),t-vo>24?(t<1/0&&(po=setTimeout(zo,t-wo.now()-xo)),go&&(go=clearInterval(go))):(go||(yo=wo.now(),go=setInterval(No,mo)),fo=1,_o(zo)))}function ko(t,e,n){var o=new Po;return e=null==e?0:+e,o.restart((n=>{o.stop(),t(n+e)}),e,n),o}Po.prototype=Eo.prototype={constructor:Po,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?bo():+n)+(null==e?0:+e),this._next||lo===this||(lo?lo._next=this:co=this,lo=this),this._call=t,this._time=n,So()},stop:function(){this._call&&(this._call=null,this._time=1/0,So())}};var Io=wt("start","end","cancel","interrupt"),Ao=[],To=0,$o=1,Co=2,Oo=3,Do=4,Ho=5,Bo=6;function Lo(t,e,n,o,r,i){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var o,r=t.__transition;function i(t){n.state=$o,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(i){var c,l,h,d;if(n.state!==$o)return u();for(c in r)if((d=r[c]).name===n.name){if(d.state===Oo)return ko(a);d.state===Do?(d.state=Bo,d.timer.stop(),d.on.call("interrupt",t,t.__data__,d.index,d.group),delete r[c]):+c<e&&(d.state=Bo,d.timer.stop(),d.on.call("cancel",t,t.__data__,d.index,d.group),delete r[c])}if(ko((function(){n.state===Oo&&(n.state=Do,n.timer.restart(s,n.delay,n.time),s(i))})),n.state=Co,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Co){for(n.state=Oo,o=new Array(h=n.tween.length),c=0,l=-1;c<h;++c)(d=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(o[++l]=d);o.length=l+1}}function s(e){for(var r=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(u),n.state=Ho,1),i=-1,a=o.length;++i<a;)o[i].call(t,r);n.state===Ho&&(n.on.call("end",t,t.__data__,n.index,n.group),u())}function u(){for(var o in n.state=Bo,n.timer.stop(),delete r[e],r)return;delete t.__transition}r[e]=n,n.timer=Eo(i,0,n.time)}(t,n,{name:e,index:o,group:r,on:Io,tween:Ao,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:To})}function Ro(t,e){var n=Yo(t,e);if(n.state>To)throw new Error("too late; already scheduled");return n}function Xo(t,e){var n=Yo(t,e);if(n.state>Oo)throw new Error("too late; already running");return n}function Yo(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Vo(t,e){var n,o,r,i=t.__transition,a=!0;if(i){for(r in e=null==e?null:e+"",i)(n=i[r]).name===e?(o=n.state>Co&&n.state<Ho,n.state=Bo,n.timer.stop(),n.on.call(o?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete i[r]):a=!1;a&&delete t.__transition}}function qo(t,e){var n,o;return function(){var r=Xo(this,t),i=r.tween;if(i!==n)for(var a=0,s=(o=n=i).length;a<s;++a)if(o[a].name===e){(o=o.slice()).splice(a,1);break}r.tween=o}}function Zo(t,e,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=Xo(this,t),a=i.tween;if(a!==o){r=(o=a).slice();for(var s={name:e,value:n},u=0,c=r.length;u<c;++u)if(r[u].name===e){r[u]=s;break}u===c&&r.push(s)}i.tween=r}}function Go(t,e,n){var o=t._id;return t.each((function(){var t=Xo(this,o);(t.value||(t.value={}))[e]=n.apply(this,arguments)})),function(t){return Yo(t,o).value[e]}}function jo(t,e){var n;return("number"==typeof e?Fn:e instanceof zn?Zn:(n=zn(e))?(e=n,Zn):Jn)(t,e)}function Wo(t){return function(){this.removeAttribute(t)}}function Fo(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ko(t,e,n){var o,r,i=n+"";return function(){var a=this.getAttribute(t);return a===i?null:a===o?r:r=e(o=a,n)}}function Uo(t,e,n){var o,r,i=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===i?null:a===o?r:r=e(o=a,n)}}function Qo(t,e,n){var o,r,i;return function(){var a,s,u=n(this);if(null!=u)return(a=this.getAttribute(t))===(s=u+"")?null:a===o&&s===r?i:(r=s,i=e(o=a,u));this.removeAttribute(t)}}function Jo(t,e,n){var o,r,i;return function(){var a,s,u=n(this);if(null!=u)return(a=this.getAttributeNS(t.space,t.local))===(s=u+"")?null:a===o&&s===r?i:(r=s,i=e(o=a,u));this.removeAttributeNS(t.space,t.local)}}function tr(t,e){var n,o;function r(){var r=e.apply(this,arguments);return r!==o&&(n=(o=r)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,r)),n}return r._value=e,r}function er(t,e){var n,o;function r(){var r=e.apply(this,arguments);return r!==o&&(n=(o=r)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,r)),n}return r._value=e,r}function nr(t,e){return function(){Ro(this,t).delay=+e.apply(this,arguments)}}function or(t,e){return e=+e,function(){Ro(this,t).delay=e}}function rr(t,e){return function(){Xo(this,t).duration=+e.apply(this,arguments)}}function ir(t,e){return e=+e,function(){Xo(this,t).duration=e}}var ar=Oe.prototype.constructor;function sr(t){return function(){this.style.removeProperty(t)}}var ur=0;function cr(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function lr(){return++ur}var hr=Oe.prototype;cr.prototype={constructor:cr,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=At(t));for(var o=this._groups,r=o.length,i=new Array(r),a=0;a<r;++a)for(var s,u,c=o[a],l=c.length,h=i[a]=new Array(l),d=0;d<l;++d)(s=c[d])&&(u=t.call(s,s.__data__,d,c))&&("__data__"in s&&(u.__data__=s.__data__),h[d]=u,Lo(h[d],e,n,d,h,Yo(s,n)));return new cr(i,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=$t(t));for(var o=this._groups,r=o.length,i=[],a=[],s=0;s<r;++s)for(var u,c=o[s],l=c.length,h=0;h<l;++h)if(u=c[h]){for(var d,f=t.call(u,u.__data__,h,c),p=Yo(u,n),g=0,m=f.length;g<m;++g)(d=f[g])&&Lo(d,e,n,g,f,p);i.push(f),a.push(u)}return new cr(i,a,e,n)},selectChild:hr.selectChild,selectChildren:hr.selectChildren,filter:function(t){"function"!=typeof t&&(t=Ot(t));for(var e=this._groups,n=e.length,o=new Array(n),r=0;r<n;++r)for(var i,a=e[r],s=a.length,u=o[r]=[],c=0;c<s;++c)(i=a[c])&&t.call(i,i.__data__,c,a)&&u.push(i);return new cr(o,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,r=n.length,i=Math.min(o,r),a=new Array(o),s=0;s<i;++s)for(var u,c=e[s],l=n[s],h=c.length,d=a[s]=new Array(h),f=0;f<h;++f)(u=c[f]||l[f])&&(d[f]=u);for(;s<o;++s)a[s]=e[s];return new cr(a,this._parents,this._name,this._id)},selection:function(){return new ar(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=lr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],u=s.length,c=0;c<u;++c)if(a=s[c]){var l=Yo(a,e);Lo(a,t,n,c,s,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new cr(o,this._parents,t,n)},call:hr.call,nodes:hr.nodes,node:hr.node,size:hr.size,empty:hr.empty,each:hr.each,on:function(t,e){var n=this._id;return arguments.length<2?Yo(this.node(),n).on.on(t):this.each(function(t,e,n){var o,r,i=function(t){return(t+"").trim().split(/^|\s+/).every((function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t}))}(e)?Ro:Xo;return function(){var a=i(this,t),s=a.on;s!==o&&(r=(o=s).copy()).on(e,n),a.on=r}}(n,t,e))},attr:function(t,e){var n=zt(t),o="transform"===n?so:jo;return this.attrTween(t,"function"==typeof e?(n.local?Jo:Qo)(n,o,Go(this,"attr."+t,e)):null==e?(n.local?Fo:Wo)(n):(n.local?Uo:Ko)(n,o,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var o=zt(t);return this.tween(n,(o.local?tr:er)(o,e))},style:function(t,e,n){var o="transform"==(t+="")?ao:jo;return null==e?this.styleTween(t,function(t,e){var n,o,r;return function(){var i=re(this,t),a=(this.style.removeProperty(t),re(this,t));return i===a?null:i===n&&a===o?r:r=e(n=i,o=a)}}(t,o)).on("end.style."+t,sr(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var o,r,i;return function(){var a=re(this,t),s=n(this),u=s+"";return null==s&&(this.style.removeProperty(t),u=s=re(this,t)),a===u?null:a===o&&u===r?i:(r=u,i=e(o=a,s))}}(t,o,Go(this,"style."+t,e))).each(function(t,e){var n,o,r,i,a="style."+e,s="end."+a;return function(){var u=Xo(this,t),c=u.on,l=null==u.value[a]?i||(i=sr(e)):void 0;c===n&&r===l||(o=(n=c).copy()).on(s,r=l),u.on=o}}(this._id,t)):this.styleTween(t,function(t,e,n){var o,r,i=n+"";return function(){var a=re(this,t);return a===i?null:a===o?r:r=e(o=a,n)}}(t,o,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==e)return this.tween(o,null);if("function"!=typeof e)throw new Error;return this.tween(o,function(t,e,n){var o,r;function i(){var i=e.apply(this,arguments);return i!==r&&(o=(r=i)&&function(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}(t,i,n)),o}return i._value=e,i}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Go(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function o(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&function(t){return function(e){this.textContent=t.call(this,e)}}(o)),e}return o._value=t,o}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o,r=Yo(this.node(),n).tween,i=0,a=r.length;i<a;++i)if((o=r[i]).name===t)return o.value;return null}return this.each((null==e?qo:Zo)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?nr:or)(e,t)):Yo(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?rr:ir)(e,t)):Yo(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Xo(this,t).ease=e}}(e,t)):Yo(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Xo(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,o=n._id,r=n.size();return new Promise((function(i,a){var s={value:a},u={value:function(){0==--r&&i()}};n.each((function(){var n=Xo(this,o),r=n.on;r!==t&&((e=(t=r).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(u)),n.on=e})),0===r&&i()}))},[Symbol.iterator]:hr[Symbol.iterator]};var dr={time:null,delay:0,duration:250,ease:function(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}};function fr(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}Oe.prototype.interrupt=function(t){return this.each((function(){Vo(this,t)}))},Oe.prototype.transition=function(t){var e,n;t instanceof cr?(e=t._id,t=t._name):(e=lr(),(n=dr).time=bo(),t=null==t?null:t+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],u=s.length,c=0;c<u;++c)(a=s[c])&&Lo(a,t,e,c,s,n||fr(a,e));return new cr(o,this._parents,t,e)};var pr=t=>()=>t;function gr(t,{sourceEvent:e,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function mr(t,e,n){this.k=t,this.x=e,this.y=n}mr.prototype={constructor:mr,scale:function(t){return 1===t?this:new mr(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new mr(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var yr=new mr(1,0,0);function vr(t){for(;!t.__zoom;)if(!(t=t.parentNode))return yr;return t.__zoom}function xr(t){t.stopImmediatePropagation()}function wr(t){t.preventDefault(),t.stopImmediatePropagation()}function _r(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function br(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function Mr(){return this.__zoom||yr}function Pr(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Er(){return navigator.maxTouchPoints||"ontouchstart"in this}function zr(t,e,n){var o=t.invertX(e[0][0])-n[0][0],r=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function Nr(){var t,e,n,o=_r,r=br,i=zr,a=Pr,s=Er,u=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],l=250,h=ho,d=wt("start","zoom","end"),f=500,p=150,g=0,m=10;function y(t){t.property("__zoom",Mr).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",z).filter(s).on("touchstart.zoom",N).on("touchmove.zoom",S).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(t,e){return(e=Math.max(u[0],Math.min(u[1],e)))===t.k?t:new mr(e,t.x,t.y)}function x(t,e,n){var o=e[0]-n[0]*t.k,r=e[1]-n[1]*t.k;return o===t.x&&r===t.y?t:new mr(t.k,o,r)}function w(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function _(t,e,n,o){t.on("start.zoom",(function(){b(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){b(this,arguments).event(o).end()})).tween("zoom",(function(){var t=this,i=arguments,a=b(t,i).event(o),s=r.apply(t,i),u=null==n?w(s):"function"==typeof n?n.apply(t,i):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),l=t.__zoom,d="function"==typeof e?e.apply(t,i):e,f=h(l.invert(u).concat(c/l.k),d.invert(u).concat(c/d.k));return function(t){if(1===t)t=d;else{var e=f(t),n=c/e[2];t=new mr(n,u[0]-e[0]*n,u[1]-e[1]*n)}a.zoom(null,t)}}))}function b(t,e,n){return!n&&t.__zooming||new M(t,e)}function M(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=r.apply(t,e),this.taps=0}function P(t,...e){if(o.apply(this,arguments)){var n=b(this,e).event(t),r=this.__zoom,s=Math.max(u[0],Math.min(u[1],r.k*Math.pow(2,a.apply(this,arguments)))),l=He(t);if(n.wheel)n.mouse[0][0]===l[0]&&n.mouse[0][1]===l[1]||(n.mouse[1]=r.invert(n.mouse[0]=l)),clearTimeout(n.wheel);else{if(r.k===s)return;n.mouse=[l,r.invert(l)],Vo(this),n.start()}wr(t),n.wheel=setTimeout((function(){n.wheel=null,n.end()}),p),n.zoom("mouse",i(x(v(r,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function E(t,...e){if(!n&&o.apply(this,arguments)){var r=t.currentTarget,a=b(this,e,!0).event(t),s=De(t.view).on("mousemove.zoom",(function(t){if(wr(t),!a.moved){var e=t.clientX-l,n=t.clientY-h;a.moved=e*e+n*n>g}a.event(t).zoom("mouse",i(x(a.that.__zoom,a.mouse[0]=He(t,r),a.mouse[1]),a.extent,c))}),!0).on("mouseup.zoom",(function(t){s.on("mousemove.zoom mouseup.zoom",null),Ve(t.view,a.moved),wr(t),a.event(t).end()}),!0),u=He(t,r),l=t.clientX,h=t.clientY;Ye(t.view),xr(t),a.mouse=[u,this.__zoom.invert(u)],Vo(this),a.start()}}function z(t,...e){if(o.apply(this,arguments)){var n=this.__zoom,a=He(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),u=n.k*(t.shiftKey?.5:2),h=i(x(v(n,u),a,s),r.apply(this,e),c);wr(t),l>0?De(this).transition().duration(l).call(_,h,a,t):De(this).call(y.transform,h,a,t)}}function N(n,...r){if(o.apply(this,arguments)){var i,a,s,u,c=n.touches,l=c.length,h=b(this,r,n.changedTouches.length===l).event(n);for(xr(n),a=0;a<l;++a)u=[u=He(s=c[a],this),this.__zoom.invert(u),s.identifier],h.touch0?h.touch1||h.touch0[2]===u[2]||(h.touch1=u,h.taps=0):(h.touch0=u,i=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),i&&(h.taps<2&&(e=u[0],t=setTimeout((function(){t=null}),f)),Vo(this),h.start())}}function S(t,...e){if(this.__zooming){var n,o,r,a,s=b(this,e).event(t),u=t.changedTouches,l=u.length;for(wr(t),n=0;n<l;++n)r=He(o=u[n],this),s.touch0&&s.touch0[2]===o.identifier?s.touch0[0]=r:s.touch1&&s.touch1[2]===o.identifier&&(s.touch1[0]=r);if(o=s.that.__zoom,s.touch1){var h=s.touch0[0],d=s.touch0[1],f=s.touch1[0],p=s.touch1[1],g=(g=f[0]-h[0])*g+(g=f[1]-h[1])*g,m=(m=p[0]-d[0])*m+(m=p[1]-d[1])*m;o=v(o,Math.sqrt(g/m)),r=[(h[0]+f[0])/2,(h[1]+f[1])/2],a=[(d[0]+p[0])/2,(d[1]+p[1])/2]}else{if(!s.touch0)return;r=s.touch0[0],a=s.touch0[1]}s.zoom("touch",i(x(o,r,a),s.extent,c))}}function k(t,...o){if(this.__zooming){var r,i,a=b(this,o).event(t),s=t.changedTouches,u=s.length;for(xr(t),n&&clearTimeout(n),n=setTimeout((function(){n=null}),f),r=0;r<u;++r)i=s[r],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=He(i,this),Math.hypot(e[0]-i[0],e[1]-i[1])<m)){var c=De(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return y.transform=function(t,e,n,o){var r=t.selection?t.selection():t;r.property("__zoom",Mr),t!==r?_(t,e,n,o):r.interrupt().each((function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()}))},y.scaleBy=function(t,e,n,o){y.scaleTo(t,(function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)}),n,o)},y.scaleTo=function(t,e,n,o){y.transform(t,(function(){var t=r.apply(this,arguments),o=this.__zoom,a=null==n?w(t):"function"==typeof n?n.apply(this,arguments):n,s=o.invert(a),u="function"==typeof e?e.apply(this,arguments):e;return i(x(v(o,u),a,s),t,c)}),n,o)},y.translateBy=function(t,e,n,o){y.transform(t,(function(){return i(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)}),null,o)},y.translateTo=function(t,e,n,o,a){y.transform(t,(function(){var t=r.apply(this,arguments),a=this.__zoom,s=null==o?w(t):"function"==typeof o?o.apply(this,arguments):o;return i(yr.translate(s[0],s[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)}),o,a)},M.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=De(this.that).datum();d.call(t,this.that,new gr(t,{sourceEvent:this.sourceEvent,target:y,type:t,transform:this.that.__zoom,dispatch:d}),e)}},y.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:pr(+t),y):a},y.filter=function(t){return arguments.length?(o="function"==typeof t?t:pr(!!t),y):o},y.touchable=function(t){return arguments.length?(s="function"==typeof t?t:pr(!!t),y):s},y.extent=function(t){return arguments.length?(r="function"==typeof t?t:pr([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),y):r},y.scaleExtent=function(t){return arguments.length?(u[0]=+t[0],u[1]=+t[1],y):[u[0],u[1]]},y.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],y):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},y.constrain=function(t){return arguments.length?(i=t,y):i},y.duration=function(t){return arguments.length?(l=+t,y):l},y.interpolate=function(t){return arguments.length?(h=t,y):h},y.on=function(){var t=d.on.apply(d,arguments);return t===d?y:t},y.clickDistance=function(t){return arguments.length?(g=(t=+t)*t,y):Math.sqrt(g)},y.tapDistance=function(t){return arguments.length?(m=+t,y):m},y}vr.prototype=mr.prototype;const Sr=t=>({x:t.x,y:t.y,zoom:t.k}),kr=({x:t,y:e,zoom:n})=>yr.translate(t,e).scale(n),Ir=(t,e)=>t.target.closest(`.${e}`),Ar=(t,e)=>2===e&&Array.isArray(t)&&t.includes(2),Tr=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,$r=(t,e=0,n=Tr,o=(()=>{}))=>{const r="number"==typeof e&&e>0;return r||o(),r?t.transition().duration(e).ease(n).on("end",o):t},Cr=t=>{const e=t.ctrlKey&&D()?10:1;return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*e};var Or;t.ResizeControlVariant=void 0,(Or=t.ResizeControlVariant||(t.ResizeControlVariant={})).Line="line",Or.Handle="handle";function Dr(t){return{isHorizontal:t.includes("right")||t.includes("left"),isVertical:t.includes("bottom")||t.includes("top"),affectsX:t.includes("left"),affectsY:t.includes("top")}}function Hr(t,e){return Math.max(0,e-t)}function Br(t,e){return Math.max(0,t-e)}function Lr(t,e,n){return Math.max(0,e-t,t-n)}function Rr(t,e){return t?!e:e}const Xr={width:0,height:0,x:0,y:0},Yr={...Xr,pointerX:0,pointerY:0,aspectRatio:1};function Vr(t,e,n){const o=e.position.x+t.position.x,r=e.position.y+t.position.y,i=t.measured.width??0,a=t.measured.height??0,s=n[0]*i,u=n[1]*a;return[[o-s,r-u],[o+i-s,r+a-u]]}t.XYDrag=function({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},a=0,s=new Map,u=!1,c={x:0,y:0},l=null,h=!1,d=null,f=!1,g=!1,y=null;return{update:function({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:b,nodeId:P,nodeClickDistance:E=0}){function z({x:t,y:n}){const{nodeLookup:r,nodeExtent:a,snapGrid:u,snapToGrid:c,nodeOrigin:l,onNodeDrag:h,onSelectionDrag:d,onError:f,updateNodePositions:v}=e();i={x:t,y:n};let x=!1;const w=s.size>1,_=w&&a?M(p(s)):null,b=w&&c?function({dragItems:t,snapGrid:e,x:n,y:o}){const r=t.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},a=A(i,e);return{x:a.x-i.x,y:a.y-i.y}}({dragItems:s,snapGrid:u,x:t,y:n}):null;for(const[e,o]of s){if(!r.has(e))continue;let i={x:t-o.distance.x,y:n-o.distance.y};c&&(i=b?{x:Math.round(i.x+b.x),y:Math.round(i.y+b.y)}:A(i,u));let s=null;if(w&&a&&!o.extent&&_){const{positionAbsolute:t}=o.internals,e=t.x-_.x+a[0][0],n=t.x+o.measured.width-_.x2+a[1][0];s=[[e,t.y-_.y+a[0][1]],[n,t.y+o.measured.height-_.y2+a[1][1]]]}const{position:h,positionAbsolute:d}=m({nodeId:e,nextPosition:i,nodeLookup:r,nodeExtent:s||a,nodeOrigin:l,onError:f});x=x||o.position.x!==h.x||o.position.y!==h.y,o.position=h,o.internals.positionAbsolute=d}if(g=g||x,x&&(v(s,!0),y&&(o||h||!P&&d))){const[t,e]=Je({nodeId:P,dragItems:s,nodeLookup:r});o?.(y,s,t,e),h?.(y,t,e),P||d?.(y,e)}}async function N(){if(!l)return;const{transform:t,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=e();if(!r)return u=!1,void cancelAnimationFrame(a);const[s,h]=_(c,l,o);0===s&&0===h||(i.x=(i.x??0)-s/t[2],i.y=(i.y??0)-h/t[2],await n({x:s,y:h})&&z(i)),a=requestAnimationFrame(N)}function S(o){const{nodeLookup:r,multiSelectionActive:a,nodesDraggable:u,transform:c,snapGrid:d,snapToGrid:f,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:y}=e();h=!0,p&&b||a||!P||r.get(P)?.selected||y(),b&&p&&P&&t?.(P);const v=L(o.sourceEvent,{transform:c,snapGrid:d,snapToGrid:f,containerBounds:l});if(i=v,s=function(t,e,n,o){const r=new Map;for(const[i,a]of t)if((a.selected||a.id===o)&&(!a.parentId||!Ue(a,t))&&(a.draggable||e&&void 0===a.draggable)){const e=t.get(i);e&&r.set(i,{id:i,position:e.position||{x:0,y:0},distance:{x:n.x-e.internals.positionAbsolute.x,y:n.y-e.internals.positionAbsolute.y},extent:e.extent,parentId:e.parentId,origin:e.origin,expandParent:e.expandParent,internals:{positionAbsolute:e.internals.positionAbsolute||{x:0,y:0}},measured:{width:e.measured.width??0,height:e.measured.height??0}})}return r}(r,u,v,P),s.size>0&&(n||g||!P&&m)){const[t,e]=Je({nodeId:P,dragItems:s,nodeLookup:r});n?.(o.sourceEvent,s,t,e),g?.(o.sourceEvent,t,e),P||m?.(o.sourceEvent,e)}}d=De(w);const k=Ke().clickDistance(E).on("start",(t=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:a,snapToGrid:s}=e();l=n?.getBoundingClientRect()||null,f=!1,g=!1,y=t.sourceEvent,0===o&&S(t);const u=L(t.sourceEvent,{transform:r,snapGrid:a,snapToGrid:s,containerBounds:l});i=u,c=q(t.sourceEvent,l)})).on("drag",(t=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:a,nodeDragThreshold:d,nodeLookup:p}=e(),g=L(t.sourceEvent,{transform:o,snapGrid:r,snapToGrid:a,containerBounds:l});if(y=t.sourceEvent,("touchmove"===t.sourceEvent.type&&t.sourceEvent.touches.length>1||P&&!p.has(P))&&(f=!0),!f){if(!u&&n&&h&&(u=!0,N()),!h){const e=q(t.sourceEvent,l),n=e.x-c.x,o=e.y-c.y;Math.sqrt(n*n+o*o)>d&&S(t)}(i.x!==g.xSnapped||i.y!==g.ySnapped)&&s&&h&&(c=q(t.sourceEvent,l),z(g))}})).on("end",(t=>{if(h&&!f&&(u=!1,h=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:a}=e();if(g&&(o(s,!1),g=!1),r||i||!P&&a){const[e,o]=Je({nodeId:P,dragItems:s,nodeLookup:n,dragging:!1});r?.(t.sourceEvent,s,e,o),i?.(t.sourceEvent,e,o),P||a?.(t.sourceEvent,o)}}})).filter((t=>{const e=t.target;return!t.button&&(!v||!Qe(e,`.${v}`,w))&&(!x||Qe(e,x,w))}));d.call(k)},destroy:function(){d?.on(".drag",null)}}},t.XYHandle=sn,t.XYMinimap=function({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const r=De(t);return{update:function({translateExtent:t,width:i,height:a,zoomStep:s=1,pannable:u=!0,zoomable:c=!0,inversePan:l=!1}){let h=[0,0];const d=Nr().on("start",(t=>{"mousedown"!==t.sourceEvent.type&&"touchstart"!==t.sourceEvent.type||(h=[t.sourceEvent.clientX??t.sourceEvent.touches[0].clientX,t.sourceEvent.clientY??t.sourceEvent.touches[0].clientY])})).on("zoom",u?r=>{const s=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!e)return;const u=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[u[0]-h[0],u[1]-h[1]];h=u;const d=o()*Math.max(s[2],Math.log(s[2]))*(l?-1:1),f={x:s[0]-c[0]*d,y:s[1]-c[1]*d},p=[[0,0],[i,a]];e.setViewportConstrained({x:f.x,y:f.y,zoom:s[2]},p,t)}:null).on("zoom.wheel",c?t=>{if("wheel"!==t.sourceEvent.type||!e)return;const o=n(),r=t.sourceEvent.ctrlKey&&D()?10:1,i=-t.sourceEvent.deltaY*(1===t.sourceEvent.deltaMode?.05:t.sourceEvent.deltaMode?1:.002)*s,a=o[2]*Math.pow(2,i*r);e.scaleTo(a)}:null);r.call(d,{})},destroy:function(){r.on("zoom",null)},pointer:He}},t.XYPanZoom=function({domNode:e,minZoom:n,maxZoom:o,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:s,onPanZoomEnd:u,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},h=e.getBoundingClientRect(),d=Nr().scaleExtent([n,o]).translateExtent(r),f=De(e).call(d);x({x:i.x,y:i.y,zoom:y(i.zoom,n,o)},[[0,0],[h.width,h.height]],r);const p=f.on("wheel.zoom"),g=f.on("dblclick.zoom");function m(t,e){return f?new Promise((n=>{d?.interpolate("linear"===e?.interpolate?to:ho).transform($r(f,e?.duration,e?.ease,(()=>n(!0))),t)})):Promise.resolve(!1)}function v(){d.on("zoom",null)}async function x(t,e,n){const o=kr(t),r=d?.constrain()(o,e,n);return r&&await m(r),new Promise((t=>t(r)))}return d.wheelDelta(Cr),{update:function({noWheelClassName:e,noPanClassName:n,onPaneContextMenu:o,userSelectionActive:r,panOnScroll:i,panOnDrag:h,panOnScrollMode:m,panOnScrollSpeed:y,preventScrolling:x,zoomOnPinch:w,zoomOnScroll:_,zoomOnDoubleClick:b,zoomActivationKeyPressed:M,lib:P,onTransformChange:E,connectionInProgress:z,paneClickDistance:N,selectionOnDrag:S}){r&&!l.isZoomingOrPanning&&v();const I=i&&!M&&!r;d.clickDistance(S?1/0:!k(N)||N<0?0:N);const A=I?function({zoomPanValues:e,noWheelClassName:n,d3Selection:o,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:a,zoomOnPinch:s,onPanZoomStart:u,onPanZoom:c,onPanZoomEnd:l}){return h=>{if(Ir(h,n))return h.ctrlKey&&h.preventDefault(),!1;h.preventDefault(),h.stopImmediatePropagation();const d=o.property("__zoom").k||1;if(h.ctrlKey&&s){const t=He(h),e=Cr(h),n=d*Math.pow(2,e);return void r.scaleTo(o,n,t,h)}const f=1===h.deltaMode?20:1;let p=i===t.PanOnScrollMode.Vertical?0:h.deltaX*f,g=i===t.PanOnScrollMode.Horizontal?0:h.deltaY*f;!D()&&h.shiftKey&&i!==t.PanOnScrollMode.Vertical&&(p=h.deltaY*f,g=0),r.translateBy(o,-p/d*a,-g/d*a,{internal:!0});const m=Sr(o.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(h,m),e.panScrollTimeout=setTimeout((()=>{l?.(h,m),e.isPanScrolling=!1}),150)):(e.isPanScrolling=!0,u?.(h,m))}}({zoomPanValues:l,noWheelClassName:e,d3Selection:f,d3Zoom:d,panOnScrollMode:m,panOnScrollSpeed:y,zoomOnPinch:w,onPanZoomStart:s,onPanZoom:a,onPanZoomEnd:u}):function({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,a=!e&&i&&!o.ctrlKey,s=Ir(o,t);if(o.ctrlKey&&i&&s&&o.preventDefault(),a||s)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:x,d3ZoomHandler:p});if(f.on("wheel.zoom",A,{passive:!1}),!r){const t=function({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Sr(o.transform);t.mouseButton=o.sourceEvent?.button||0,t.isZoomingOrPanning=!0,t.prevViewport=r,"mousedown"===o.sourceEvent?.type&&e(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});d.on("start",t);const e=function({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{t.usedRightMouseButton=!(!n||!Ar(e,t.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Sr(i.transform))}}({zoomPanValues:l,panOnDrag:h,onPaneContextMenu:!!o,onPanZoom:a,onTransformChange:E});d.on("zoom",e);const n=function({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return a=>{if(!a.sourceEvent?.internal&&(t.isZoomingOrPanning=!1,i&&Ar(e,t.mouseButton??0)&&!t.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),t.usedRightMouseButton=!1,o(!1),r)){const e=Sr(a.transform);t.prevViewport=e,clearTimeout(t.timerId),t.timerId=setTimeout((()=>{r?.(a.sourceEvent,e)}),n?150:0)}}}({zoomPanValues:l,panOnDrag:h,panOnScroll:i,onPaneContextMenu:o,onPanZoomEnd:u,onDraggingChange:c});d.on("end",n)}const T=function({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:s,noPanClassName:u,lib:c,connectionInProgress:l}){return h=>{const d=t||e,f=n&&h.ctrlKey,p="wheel"===h.type;if(1===h.button&&"mousedown"===h.type&&(Ir(h,`${c}-flow__node`)||Ir(h,`${c}-flow__edge`)))return!0;if(!(o||d||r||i||n))return!1;if(a)return!1;if(l&&!p)return!1;if(Ir(h,s)&&p)return!1;if(Ir(h,u)&&(!p||r&&p&&!t))return!1;if(!n&&h.ctrlKey&&p)return!1;if(!n&&"touchstart"===h.type&&h.touches?.length>1)return h.preventDefault(),!1;if(!d&&!r&&!f&&p)return!1;if(!o&&("mousedown"===h.type||"touchstart"===h.type))return!1;if(Array.isArray(o)&&!o.includes(h.button)&&"mousedown"===h.type)return!1;const g=Array.isArray(o)&&o.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||p)&&g}}({zoomActivationKeyPressed:M,panOnDrag:h,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:b,zoomOnPinch:w,userSelectionActive:r,noPanClassName:n,noWheelClassName:e,lib:P,connectionInProgress:z});d.filter(T),b?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)},destroy:v,setViewport:async function(t,e){const n=kr(t);return await m(n,e),new Promise((t=>t(n)))},setViewportConstrained:x,getViewport:function(){const t=f?vr(f.node()):{x:0,y:0,k:1};return{x:t.x,y:t.y,zoom:t.k}},scaleTo:function(t,e){return f?new Promise((n=>{d?.interpolate("linear"===e?.interpolate?to:ho).scaleTo($r(f,e?.duration,e?.ease,(()=>n(!0))),t)})):Promise.resolve(!1)},scaleBy:function(t,e){return f?new Promise((n=>{d?.interpolate("linear"===e?.interpolate?to:ho).scaleBy($r(f,e?.duration,e?.ease,(()=>n(!0))),t)})):Promise.resolve(!1)},setScaleExtent:function(t){d?.scaleExtent(t)},setTranslateExtent:function(t){d?.translateExtent(t)},syncViewport:function(t){if(f){const e=kr(t),n=f.property("__zoom");n.k===t.zoom&&n.x===t.x&&n.y===t.y||d?.transform(f,e,null,{sync:!0})}},setClickDistance:function(t){const e=!k(t)||t<0?0:t;d?.clickDistance(e)}}},t.XYResizer=function({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:r}){const i=De(t);let a={controlDirection:Dr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:t,boundaries:s,keepAspectRatio:u,resizeDirection:c,onResizeStart:l,onResize:h,onResizeEnd:d,shouldResize:f}){let p,g={...Xr},m={...Yr};a={boundaries:s,resizeDirection:c,keepAspectRatio:u,controlDirection:Dr(t)};let y,v,x,w=null,_=[],b=!1;const M=Ke().on("start",(t=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:a,nodeOrigin:s,paneDomNode:u}=n();if(p=o.get(e),!p)return;w=u?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:h}=L(t.sourceEvent,{transform:r,snapGrid:i,snapToGrid:a,containerBounds:w});g={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},m={...g,pointerX:c,pointerY:h,aspectRatio:g.width/g.height},y=void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(y=o.get(p.parentId),v=y&&"parent"===p.extent?function(t){return[[0,0],[t.measured.width,t.measured.height]]}(y):void 0),_=[],x=void 0;for(const[t,n]of o)if(n.parentId===e&&(_.push({id:t,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const t=Vr(n,p,n.origin??s);x=x?[[Math.min(t[0][0],x[0][0]),Math.min(t[0][1],x[0][1])],[Math.max(t[1][0],x[1][0]),Math.max(t[1][1],x[1][1])]]:t}l?.(t,{...g})})).on("drag",(t=>{const{transform:e,snapGrid:r,snapToGrid:i,nodeOrigin:s}=n(),u=L(t.sourceEvent,{transform:e,snapGrid:r,snapToGrid:i,containerBounds:w}),c=[];if(!p)return;const{x:l,y:d,width:M,height:P}=g,E={},z=p.origin??s,{width:N,height:S,x:k,y:I}=function(t,e,n,o,r,i,a,s){let{affectsX:u,affectsY:c}=e;const{isHorizontal:l,isVertical:h}=e,d=l&&h,{xSnapped:f,ySnapped:p}=n,{minWidth:g,maxWidth:m,minHeight:y,maxHeight:v}=o,{x:x,y:w,width:_,height:b,aspectRatio:M}=t;let P=Math.floor(l?f-t.pointerX:0),E=Math.floor(h?p-t.pointerY:0);const z=_+(u?-P:P),N=b+(c?-E:E),S=-i[0]*_,k=-i[1]*b;let I=Lr(z,g,m),A=Lr(N,y,v);if(a){let t=0,e=0;u&&P<0?t=Hr(x+P+S,a[0][0]):!u&&P>0&&(t=Br(x+z+S,a[1][0])),c&&E<0?e=Hr(w+E+k,a[0][1]):!c&&E>0&&(e=Br(w+N+k,a[1][1])),I=Math.max(I,t),A=Math.max(A,e)}if(s){let t=0,e=0;u&&P>0?t=Br(x+P,s[0][0]):!u&&P<0&&(t=Hr(x+z,s[1][0])),c&&E>0?e=Br(w+E,s[0][1]):!c&&E<0&&(e=Hr(w+N,s[1][1])),I=Math.max(I,t),A=Math.max(A,e)}if(r){if(l){const t=Lr(z/M,y,v)*M;if(I=Math.max(I,t),a){let t=0;t=!u&&!c||u&&!c&&d?Br(w+k+z/M,a[1][1])*M:Hr(w+k+(u?P:-P)/M,a[0][1])*M,I=Math.max(I,t)}if(s){let t=0;t=!u&&!c||u&&!c&&d?Hr(w+z/M,s[1][1])*M:Br(w+(u?P:-P)/M,s[0][1])*M,I=Math.max(I,t)}}if(h){const t=Lr(N*M,g,m)/M;if(A=Math.max(A,t),a){let t=0;t=!u&&!c||c&&!u&&d?Br(x+N*M+S,a[1][0])/M:Hr(x+(c?E:-E)*M+S,a[0][0])/M,A=Math.max(A,t)}if(s){let t=0;t=!u&&!c||c&&!u&&d?Hr(x+N*M,s[1][0])/M:Br(x+(c?E:-E)*M,s[0][0])/M,A=Math.max(A,t)}}}E+=E<0?A:-A,P+=P<0?I:-I,r&&(d?z>N*M?E=(Rr(u,c)?-P:P)/M:P=(Rr(u,c)?-E:E)*M:l?(E=P/M,c=u):(P=E*M,u=c));const T=u?x+P:x,$=c?w+E:w;return{width:_+(u?-P:P),height:b+(c?-E:E),x:i[0]*P*(u?-1:1)+T,y:i[1]*E*(c?-1:1)+$}}(m,a.controlDirection,u,a.boundaries,a.keepAspectRatio,z,v,x),A=N!==M,T=S!==P,$=k!==l&&A,C=I!==d&&T;if(!($||C||A||T))return;if(($||C||1===z[0]||1===z[1])&&(E.x=$?k:g.x,E.y=C?I:g.y,g.x=E.x,g.y=E.y,_.length>0)){const t=k-l,e=I-d;for(const n of _)n.position={x:n.position.x-t+z[0]*(N-M),y:n.position.y-e+z[1]*(S-P)},c.push(n)}if((A||T)&&(E.width=!A||a.resizeDirection&&"horizontal"!==a.resizeDirection?g.width:N,E.height=!T||a.resizeDirection&&"vertical"!==a.resizeDirection?g.height:S,g.width=E.width,g.height=E.height),y&&p.expandParent){const t=z[0]*(E.width??0);E.x&&E.x<t&&(g.x=t,m.x=m.x-(E.x-t));const e=z[1]*(E.height??0);E.y&&E.y<e&&(g.y=e,m.y=m.y-(E.y-e))}const O=function({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:r,affectsY:i}){const a=t-e,s=n-o,u=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&r&&(u[0]=-1*u[0]),s&&i&&(u[1]=-1*u[1]),u}({width:g.width,prevWidth:M,height:g.height,prevHeight:P,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),D={...g,direction:O},H=f?.(t,D);!1!==H&&(b=!0,h?.(t,D),o(E,c))})).on("end",(t=>{b&&(d?.(t,{...g}),r?.({...g}),b=!1)}));i.call(M)},destroy:function(){i.on(".drag",null)}}},t.XY_RESIZER_HANDLE_POSITIONS=["top-left","top-right","bottom-left","bottom-right"],t.XY_RESIZER_LINE_POSITIONS=["top","right","bottom","left"],t.addEdge=(t,n,o={})=>{if(!t.source||!t.target)return e.error006(),n;const r=o.getEdgeId||K;let i;return i=h(t)?{...t}:{...t,id:r(t)},((t,e)=>e.some((e=>!(e.source!==t.source||e.target!==t.target||e.sourceHandle!==t.sourceHandle&&(e.sourceHandle||t.sourceHandle)||e.targetHandle!==t.targetHandle&&(e.targetHandle||t.targetHandle)))))(i,n)?n:(null===i.sourceHandle&&delete i.sourceHandle,null===i.targetHandle&&delete i.targetHandle,n.concat(i))},t.adoptUserNodes=function(t,e,n,o={}){const r=dt(ht,o),i={i:0},a=new Map(e),s=r?.elevateNodesOnSelect&&!pt(r.zIndexMode)?ut:0;let u=t.length>0,c=!1;e.clear(),n.clear();for(const l of t){let t=a.get(l.id);if(r.checkEquality&&l===t?.internals.userNode)e.set(l.id,t);else{const n=f(l,r.nodeOrigin),o=H(l.extent)?l.extent:r.nodeExtent,i=v(n,o,B(l));t={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:i,handleBounds:ft(l,t),z:mt(l,s,r.zIndexMode),userNode:l}},e.set(l.id,t)}void 0!==t.measured&&void 0!==t.measured.width&&void 0!==t.measured.height||t.hidden||(u=!1),l.parentId&>(t,e,n,o,i),c||=l.selected??!1}return{nodesInitialized:u,hasSelectedNodes:c}},t.areConnectionMapsEqual=function(t,e){if(!t&&!e)return!0;if(!t||!e||t.size!==e.size)return!1;if(!t.size&&!e.size)return!0;for(const n of t.keys())if(!e.has(n))return!1;return!0},t.areSetsEqual=function(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0},t.boxToRect=P,t.calcAutoPan=_,t.calculateNodePosition=m,t.clamp=y,t.clampPosition=v,t.clampPositionToParent=x,t.createMarkerIds=function(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return t.reduce(((t,a)=>([a.markerStart||o,a.markerEnd||r].forEach((o=>{if(o&&"object"==typeof o){const r=it(o,e);i.has(r)||(t.push({id:r,color:o.color||n,...o}),i.add(r))}})),t)),[]).sort(((t,e)=>t.id.localeCompare(e.id)))},t.defaultAriaLabelConfig=o,t.devWarn=I,t.elementSelectionKeys=["Enter"," ","Escape"],t.errorMessages=e,t.evaluateAbsolutePosition=function(t,e={width:0,height:0},n,o,r){const i={...t},a=o.get(n);if(a){const t=a.origin||r;i.x+=a.internals.positionAbsolute.x-(e.width??0)*t[0],i.y+=a.internals.positionAbsolute.y-(e.height??0)*t[1]}return i},t.fitViewport=async function({nodes:t,width:e,height:n,panZoom:o,minZoom:r,maxZoom:i},a){if(0===t.size)return Promise.resolve(!0);const s=function(t,e){const n=new Map,o=e?.nodes?new Set(e.nodes.map((t=>t.id))):null;return t.forEach((t=>{!t.measured.width||!t.measured.height||!e?.includeHiddenNodes&&t.hidden||o&&!o.has(t.id)||n.set(t.id,t)})),n}(t,a),u=p(s),c=O(u,e,n,a?.minZoom??r,a?.maxZoom??i,a?.padding??.1);return await o.setViewport(c,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)},t.getBezierEdgeCenter=G,t.getBezierPath=function({sourceX:e,sourceY:n,sourcePosition:o=t.Position.Bottom,targetX:r,targetY:i,targetPosition:a=t.Position.Top,curvature:s=.25}){const[u,c]=W({pos:o,x1:e,y1:n,x2:r,y2:i,c:s}),[l,h]=W({pos:a,x1:r,y1:i,x2:e,y2:n,c:s}),[d,f,p,g]=G({sourceX:e,sourceY:n,targetX:r,targetY:i,sourceControlX:u,sourceControlY:c,targetControlX:l,targetControlY:h});return[`M${e},${n} C${u},${c} ${l},${h} ${r},${i}`,d,f,p,g]},t.getBoundsOfBoxes=b,t.getBoundsOfRects=N,t.getConnectedEdges=g,t.getConnectionStatus=function(t){return null===t?null:t?"valid":"invalid"},t.getDimensions=R,t.getEdgeCenter=F,t.getEdgeId=K,t.getEdgePosition=function(n){const{sourceNode:o,targetNode:r}=n;if(!et(o)||!et(r))return null;const i=o.internals.handleBounds||nt(o.handles),a=r.internals.handleBounds||nt(r.handles),s=rt(i?.source??[],n.sourceHandle),u=rt(n.connectionMode===t.ConnectionMode.Strict?a?.target??[]:(a?.target??[]).concat(a?.source??[]),n.targetHandle);if(!s||!u)return n.onError?.("008",e.error008(s?"target":"source",{id:n.id,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle})),null;const c=s?.position||t.Position.Bottom,l=u?.position||t.Position.Top,h=ot(o,s,c),d=ot(r,u,l);return{sourceX:h.x,sourceY:h.y,targetX:d.x,targetY:d.y,sourcePosition:c,targetPosition:l}},t.getEdgeToolbarTransform=function(t,e,n,o="center",r="center"){return`translate(${t}px, ${e}px) scale(${1/n}) translate(${-(at[o]??50)}%, ${-(st[r]??50)}%)`},t.getElementsToRemove=async function({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(t.map((t=>t.id))),a=[];for(const t of n){if(!1===t.deletable)continue;const e=i.has(t.id),n=!e&&t.parentId&&a.find((e=>e.id===t.parentId));(e||n)&&a.push(t)}const s=new Set(e.map((t=>t.id))),u=o.filter((t=>!1!==t.deletable)),c=g(a,u);for(const t of u){s.has(t.id)&&!c.find((e=>e.id===t.id))&&c.push(t)}if(!r)return{edges:c,nodes:a};const l=await r({nodes:a,edges:c});return"boolean"==typeof l?l?{edges:c,nodes:a}:{edges:[],nodes:[]}:l},t.getElevatedEdgeZIndex=function({sourceNode:t,targetNode:e,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){return"manual"===i?o:(r&&n?o+1e3:o)+Math.max(t.parentId||r&&t.selected?t.internals.z:0,e.parentId||r&&e.selected?e.internals.z:0)},t.getEventPosition=q,t.getHandleBounds=Z,t.getHandlePosition=ot,t.getHostForElement=X,t.getIncomers=(t,e,n)=>{if(!t.id)return[];const o=new Set;return n.forEach((e=>{e.target===t.id&&o.add(e.source)})),e.filter((t=>o.has(t.id)))},t.getInternalNodesBounds=p,t.getMarkerId=it,t.getNodeDimensions=B,t.getNodePositionWithOrigin=f,t.getNodeToolbarTransform=function(e,n,o,r,i){let a=.5;"start"===i?a=0:"end"===i&&(a=1);let s=[(e.x+e.width*a)*n.zoom+n.x,e.y*n.zoom+n.y-r],u=[-100*a,-100];switch(o){case t.Position.Right:s=[(e.x+e.width)*n.zoom+n.x+r,(e.y+e.height*a)*n.zoom+n.y],u=[0,-100*a];break;case t.Position.Bottom:s[1]=(e.y+e.height)*n.zoom+n.y+r,u[1]=0;break;case t.Position.Left:s=[e.x*n.zoom+n.x-r,(e.y+e.height*a)*n.zoom+n.y],u=[-100,-100*a]}return`translate(${s[0]}px, ${s[1]}px) translate(${u[0]}%, ${u[1]}%)`},t.getNodesBounds=(t,e={nodeOrigin:[0,0]})=>{if(0===t.length)return{x:0,y:0,width:0,height:0};const n=t.reduce(((t,n)=>{const o="string"==typeof n;let r=e.nodeLookup||o?void 0:n;e.nodeLookup&&(r=o?e.nodeLookup.get(n):d(n)?n:e.nodeLookup.get(n.id));const i=r?z(r,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return b(t,i)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return P(n)},t.getNodesInside=(t,e,[n,o,r]=[0,0,1],i=!1,a=!1)=>{const s={...T(e,[n,o,r]),width:e.width/r,height:e.height/r},u=[];for(const e of t.values()){const{measured:t,selectable:n=!0,hidden:o=!1}=e;if(a&&!n||o)continue;const r=t.width??e.width??e.initialWidth??null,c=t.height??e.height??e.initialHeight??null,l=S(s,E(e)),h=(r??0)*(c??0),d=i&&l>0;(!e.internals.handleBounds||d||l>=h||e.dragging)&&u.push(e)}return u},t.getOutgoers=(t,e,n)=>{if(!t.id)return[];const o=new Set;return n.forEach((e=>{e.source===t.id&&o.add(e.target)})),e.filter((t=>o.has(t.id)))},t.getOverlappingArea=S,t.getPointerPosition=L,t.getSmoothStepPath=function({sourceX:e,sourceY:n,sourcePosition:o=t.Position.Bottom,targetX:r,targetY:i,targetPosition:a=t.Position.Top,borderRadius:s=5,centerX:u,centerY:c,offset:l=20,stepPosition:h=.5}){const[d,f,p,g,m]=function({source:e,sourcePosition:n=t.Position.Bottom,target:o,targetPosition:r=t.Position.Top,center:i,offset:a,stepPosition:s}){const u=U[n],c=U[r],l={x:e.x+u.x*a,y:e.y+u.y*a},h={x:o.x+c.x*a,y:o.y+c.y*a},d=Q({source:l,sourcePosition:n,target:h}),f=0!==d.x?"x":"y",p=d[f];let g,m,y=[];const v={x:0,y:0},x={x:0,y:0},[,,w,_]=F({sourceX:e.x,sourceY:e.y,targetX:o.x,targetY:o.y});if(u[f]*c[f]==-1){"x"===f?(g=i.x??l.x+(h.x-l.x)*s,m=i.y??(l.y+h.y)/2):(g=i.x??(l.x+h.x)/2,m=i.y??l.y+(h.y-l.y)*s);const t=[{x:g,y:l.y},{x:g,y:h.y}],e=[{x:l.x,y:m},{x:h.x,y:m}];y=u[f]===p?"x"===f?t:e:"x"===f?e:t}else{const t=[{x:l.x,y:h.y}],i=[{x:h.x,y:l.y}];if(y="x"===f?u.x===p?i:t:u.y===p?t:i,n===r){const t=Math.abs(e[f]-o[f]);if(t<=a){const n=Math.min(a-1,a-t);u[f]===p?v[f]=(l[f]>e[f]?-1:1)*n:x[f]=(h[f]>o[f]?-1:1)*n}}if(n!==r){const e="x"===f?"y":"x",n=u[f]===c[e],o=l[e]>h[e],r=l[e]<h[e];(1===u[f]&&(!n&&o||n&&r)||1!==u[f]&&(!n&&r||n&&o))&&(y="x"===f?t:i)}const s={x:l.x+v.x,y:l.y+v.y},d={x:h.x+x.x,y:h.y+x.y};Math.max(Math.abs(s.x-y[0].x),Math.abs(d.x-y[0].x))>=Math.max(Math.abs(s.y-y[0].y),Math.abs(d.y-y[0].y))?(g=(s.x+d.x)/2,m=y[0].y):(g=y[0].x,m=(s.y+d.y)/2)}const b={x:l.x+v.x,y:l.y+v.y},M={x:h.x+x.x,y:h.y+x.y};return[[e,...b.x!==y[0].x||b.y!==y[0].y?[b]:[],...y,...M.x!==y[y.length-1].x||M.y!==y[y.length-1].y?[M]:[],o],g,m,w,_]}({source:{x:e,y:n},sourcePosition:o,target:{x:r,y:i},targetPosition:a,center:{x:u,y:c},offset:l,stepPosition:h});let y=`M${d[0].x} ${d[0].y}`;for(let t=1;t<d.length-1;t++)y+=tt(d[t-1],d[t],d[t+1],s);return y+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[y,f,p,g,m]},t.getStraightPath=function({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[r,i,a,s]=F({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,r,i,a,s]},t.getViewportForBounds=O,t.handleConnectionChange=function(t,e,n){if(!n)return;const o=[];t.forEach(((t,n)=>{e?.has(n)||o.push(t)})),o.length&&n(o)},t.handleExpandParent=yt,t.infiniteExtent=n,t.initialConnection={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null},t.isCoordinateExtent=H,t.isEdgeBase=h,t.isEdgeVisible=function({sourceNode:t,targetNode:e,width:n,height:o,transform:r}){const i=b(z(t),z(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return S(a,P(i))>0},t.isInputDOMNode=function(t){const e=t.composedPath?.()?.[0]||t.target;return 1===e?.nodeType&&(Y.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey"))},t.isInternalNodeBase=d,t.isMacOs=D,t.isManualZIndexMode=pt,t.isMouseEvent=V,t.isNodeBase=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),t.isNumeric=k,t.isRectObject=t=>k(t.width)&&k(t.height)&&k(t.x)&&k(t.y),t.mergeAriaLabelConfig=function(t){return{...o,...t||{}}},t.nodeHasDimensions=function(t){return void 0!==(t.measured?.width??t.width??t.initialWidth)&&void 0!==(t.measured?.height??t.height??t.initialHeight)},t.nodeToBox=z,t.nodeToRect=E,t.oppositePosition=l,t.panBy=async function({delta:t,panZoom:e,transform:n,translateExtent:o,width:r,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const a=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[r,i]],o),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)},t.pointToRendererPoint=T,t.reconnectEdge=(t,n,o,r={shouldReplaceId:!0})=>{const{id:i,...a}=t;if(!n.source||!n.target)return e.error006(),o;if(!o.find((e=>e.id===t.id)))return e.error007(i),o;const s=r.getEdgeId||K,u={...a,id:r.shouldReplaceId?s(n):i,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle};return o.filter((t=>t.id!==i)).concat(u)},t.rectToBox=M,t.rendererPointToPoint=$,t.shallowNodeData=function(t,e){if(null===t||null===e)return!1;const n=Array.isArray(t)?t:[t],o=Array.isArray(e)?e:[e];if(n.length!==o.length)return!1;for(let t=0;t<n.length;t++)if(n[t].id!==o[t].id||n[t].type!==o[t].type||!Object.is(n[t].data,o[t].data))return!1;return!0},t.snapPosition=A,t.updateAbsolutePositions=function(t,e,n){const o=dt(lt,n);for(const n of t.values())if(n.parentId)gt(n,t,e,o);else{const t=f(n,o.nodeOrigin),e=H(n.extent)?n.extent:o.nodeExtent,r=v(t,e,B(n));n.internals.positionAbsolute=r}},t.updateConnectionLookup=function(t,e,n){t.clear(),e.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=o,s={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:a},u=`${n}-${i}--${r}-${a}`;vt("source",s,`${r}-${a}--${n}-${i}`,t,n,i),vt("target",s,u,t,r,a),e.set(o.id,o)}},t.updateNodeInternals=function(t,e,n,o,r,i,a){const s=o?.querySelector(".xyflow__viewport");let u=!1;if(!s)return{changes:[],updatedInternals:u};const c=[],l=window.getComputedStyle(s),{m22:h}=new window.DOMMatrixReadOnly(l.transform),d=[];for(const o of t.values()){const t=e.get(o.id);if(!t)continue;if(t.hidden){e.set(t.id,{...t,internals:{...t.internals,handleBounds:void 0}}),u=!0;continue}const s=R(o.nodeElement),l=t.measured.width!==s.width||t.measured.height!==s.height;if(!(!s.width||!s.height||!l&&t.internals.handleBounds&&!o.force)){const f=o.nodeElement.getBoundingClientRect(),p=H(t.extent)?t.extent:i;let{positionAbsolute:g}=t.internals;t.parentId&&"parent"===t.extent?g=x(g,s,e.get(t.parentId)):p&&(g=v(g,p,s));const m={...t,measured:s,internals:{...t.internals,positionAbsolute:g,handleBounds:{source:Z("source",o.nodeElement,f,h,t.id),target:Z("target",o.nodeElement,f,h,t.id)}}};e.set(t.id,m),t.parentId&>(m,e,n,{nodeOrigin:r,zIndexMode:a}),u=!0,l&&(c.push({id:t.id,type:"dimensions",dimensions:s}),t.expandParent&&t.parentId&&d.push({id:t.id,parentId:t.parentId,rect:E(m,r)}))}}if(d.length>0){const t=yt(d,e,n,r);c.push(...t)}return{changes:c,updatedInternals:u}},t.withResolvers=function(){let t,e;return{promise:new Promise(((n,o)=>{t=n,e=o})),resolve:t,reject:e}}}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smoothstep-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/smoothstep-edge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;
|
|
1
|
+
{"version":3,"file":"smoothstep-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/smoothstep-edge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAwMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,YAAgB,EAChB,OAAO,EACP,OAAO,EACP,MAAW,EACX,YAAkB,GACnB,EAAE,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAoB5G"}
|
|
@@ -58,7 +58,7 @@ export declare function getNodeDimensions(node: {
|
|
|
58
58
|
};
|
|
59
59
|
export declare function nodeHasDimensions<NodeType extends NodeBase = NodeBase>(node: NodeType): boolean;
|
|
60
60
|
/**
|
|
61
|
-
* Convert child position to
|
|
61
|
+
* Convert child position to absolute position
|
|
62
62
|
*
|
|
63
63
|
* @internal
|
|
64
64
|
* @param position
|
|
@@ -11,7 +11,11 @@ type UpdateNodesOptions<NodeType extends NodeBase> = {
|
|
|
11
11
|
checkEquality?: boolean;
|
|
12
12
|
};
|
|
13
13
|
export declare function isManualZIndexMode(zIndexMode?: ZIndexMode): boolean;
|
|
14
|
-
|
|
14
|
+
type AdoptUserNodesReturn = {
|
|
15
|
+
nodesInitialized: boolean;
|
|
16
|
+
hasSelectedNodes: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function adoptUserNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): AdoptUserNodesReturn;
|
|
15
19
|
export declare function handleExpandParent(children: ParentExpandChild[], nodeLookup: NodeLookup, parentLookup: ParentLookup, nodeOrigin?: NodeOrigin): (NodeDimensionChange | NodePositionChange)[];
|
|
16
20
|
export declare function updateNodeInternals<NodeType extends InternalNodeBase>(updates: Map<string, InternalNodeUpdate>, nodeLookup: NodeLookup<NodeType>, parentLookup: ParentLookup<NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin, nodeExtent?: CoordinateExtent, zIndexMode?: ZIndexMode): {
|
|
17
21
|
changes: (NodeDimensionChange | NodePositionChange)[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/utils/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,UAAU,EAAE,MAAM,IAAI,CAAC;AAC5F,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,UAAU,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAYlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA8B5C,wBAAgB,uBAAuB,CAAC,QAAQ,SAAS,QAAQ,EAC/D,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAClD,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,QAavC;AAkCD,KAAK,kBAAkB,CAAC,QAAQ,SAAS,QAAQ,IAAI;IACnD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAEnE;AAED,wBAAgB,cAAc,CAAC,QAAQ,SAAS,QAAQ,EACtD,KAAK,EAAE,QAAQ,EAAE,EACjB,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAClD,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,GAAE,kBAAkB,CAAC,QAAQ,CAAM,GACzC,
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/utils/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,UAAU,EAAE,MAAM,IAAI,CAAC;AAC5F,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,UAAU,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAYlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA8B5C,wBAAgB,uBAAuB,CAAC,QAAQ,SAAS,QAAQ,EAC/D,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAClD,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,QAavC;AAkCD,KAAK,kBAAkB,CAAC,QAAQ,SAAS,QAAQ,IAAI;IACnD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,UAAU,GAAG,OAAO,CAEnE;AAED,KAAK,oBAAoB,GAAG;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,wBAAgB,cAAc,CAAC,QAAQ,SAAS,QAAQ,EACtD,KAAK,EAAE,QAAQ,EAAE,EACjB,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAClD,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACtD,OAAO,GAAE,kBAAkB,CAAC,QAAQ,CAAM,GACzC,oBAAoB,CA0DtB;AAyHD,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,UAAU,GAAE,UAAmB,GAC9B,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,EAAE,CAiF9C;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,SAAS,gBAAgB,EACnE,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACxC,UAAU,EAAE,UAAU,CAAC,QAAQ,CAAC,EAChC,YAAY,EAAE,YAAY,CAAC,QAAQ,CAAC,EACpC,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,UAAU,CAAC,EAAE,UAAU,EACvB,UAAU,CAAC,EAAE,gBAAgB,EAC7B,UAAU,CAAC,EAAE,UAAU,GACtB;IAAE,OAAO,EAAE,CAAC,mBAAmB,GAAG,kBAAkB,CAAC,EAAE,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,CAgGtF;AAED,wBAAsB,KAAK,CAAC,EAC1B,KAAK,EACL,OAAO,EACP,SAAS,EACT,eAAe,EACf,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,eAAe,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,EAAE,gBAAgB,CAAC;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBnB;AAwCD,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,QAgBnH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyflow/system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
4
4
|
"description": "xyflow core system that powers React Flow and Svelte Flow.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node-based UI",
|
|
@@ -57,8 +57,8 @@
|
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/node": "^18.7.16",
|
|
59
59
|
"typescript": "5.4.5",
|
|
60
|
-
"@xyflow/rollup-config": "0.0.0",
|
|
61
60
|
"@xyflow/eslint-config": "0.0.1",
|
|
61
|
+
"@xyflow/rollup-config": "0.0.0",
|
|
62
62
|
"@xyflow/tsconfig": "0.0.0"
|
|
63
63
|
},
|
|
64
64
|
"rollup": {
|