@next-bricks/diagram 0.43.0 → 0.43.2

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.
Files changed (41) hide show
  1. package/dist/bricks.json +1 -1
  2. package/dist/chunks/3025.d4a92d85.js +3 -0
  3. package/dist/chunks/{3025.6d94cc70.js.map → 3025.d4a92d85.js.map} +1 -1
  4. package/dist/chunks/{3171.633b30e8.js → 3171.2943688e.js} +2 -2
  5. package/dist/chunks/{3171.633b30e8.js.map → 3171.2943688e.js.map} +1 -1
  6. package/dist/chunks/3233.4eabc5cc.js +3 -0
  7. package/dist/chunks/{3233.70157b34.js.map → 3233.4eabc5cc.js.map} +1 -1
  8. package/dist/chunks/3252.d94ce52c.js +2 -0
  9. package/dist/chunks/{3252.0a5098f4.js.map → 3252.d94ce52c.js.map} +1 -1
  10. package/dist/chunks/{3933.fca8ae82.js → 3933.6624dcbe.js} +2 -2
  11. package/dist/chunks/{3933.fca8ae82.js.map → 3933.6624dcbe.js.map} +1 -1
  12. package/dist/chunks/{4837.44f22425.js → 4837.578ffe7d.js} +2 -2
  13. package/dist/chunks/{7218.6822e904.js.map → 4837.578ffe7d.js.map} +1 -1
  14. package/dist/chunks/{5552.ad11237e.js → 5552.e3e4dddb.js} +2 -2
  15. package/dist/chunks/{5552.ad11237e.js.map → 5552.e3e4dddb.js.map} +1 -1
  16. package/dist/chunks/{6314.f35cc928.js → 6314.2c1f22e1.js} +2 -2
  17. package/dist/chunks/{6314.f35cc928.js.map → 6314.2c1f22e1.js.map} +1 -1
  18. package/dist/chunks/{7218.6822e904.js → 7218.0b7934fd.js} +2 -2
  19. package/dist/chunks/{4837.44f22425.js.map → 7218.0b7934fd.js.map} +1 -1
  20. package/dist/chunks/{799.5e6749ba.js → 799.dd5f32fb.js} +3 -3
  21. package/dist/chunks/799.dd5f32fb.js.map +1 -0
  22. package/dist/chunks/{9711.d7bd00df.js → 9711.2d99e6d9.js} +2 -2
  23. package/dist/chunks/{9711.d7bd00df.js.map → 9711.2d99e6d9.js.map} +1 -1
  24. package/dist/chunks/{eo-display-canvas.f874fb2f.js → eo-display-canvas.2b754ef1.js} +2 -2
  25. package/dist/chunks/{eo-display-canvas.f874fb2f.js.map → eo-display-canvas.2b754ef1.js.map} +1 -1
  26. package/dist/chunks/{eo-draw-canvas.84ade234.js → eo-draw-canvas.79b100f8.js} +2 -2
  27. package/dist/chunks/{eo-draw-canvas.84ade234.js.map → eo-draw-canvas.79b100f8.js.map} +1 -1
  28. package/dist/chunks/main.1a8affb8.js +2 -0
  29. package/dist/chunks/{main.9e233da7.js.map → main.1a8affb8.js.map} +1 -1
  30. package/dist/index.05f1b5e3.js +2 -0
  31. package/dist/{index.d6687c6f.js.map → index.05f1b5e3.js.map} +1 -1
  32. package/package.json +3 -3
  33. package/dist/chunks/3025.6d94cc70.js +0 -3
  34. package/dist/chunks/3233.70157b34.js +0 -3
  35. package/dist/chunks/3252.0a5098f4.js +0 -2
  36. package/dist/chunks/799.5e6749ba.js.map +0 -1
  37. package/dist/chunks/main.9e233da7.js +0 -2
  38. package/dist/index.d6687c6f.js +0 -2
  39. /package/dist/chunks/{3025.6d94cc70.js.LICENSE.txt → 3025.d4a92d85.js.LICENSE.txt} +0 -0
  40. /package/dist/chunks/{3233.70157b34.js.LICENSE.txt → 3233.4eabc5cc.js.LICENSE.txt} +0 -0
  41. /package/dist/chunks/{799.5e6749ba.js.LICENSE.txt → 799.dd5f32fb.js.LICENSE.txt} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"chunks/3252.0a5098f4.js","mappings":"gLAYO,SAASA,EAAeC,GAIO,IAChCC,GAL0B,GAC9BC,EAAE,KACFC,EAAI,YACJC,GACqBJ,EAGrB,OAAQG,GACN,IAAK,OACHF,EAAYI,EACZ,MACF,IAAK,OACHJ,EAAYK,EACZ,MACF,QACEL,EAAYM,EAGhB,OAAOC,IAAAA,cAACP,EAAS,CAACC,GAAIA,EAAIE,YAAaA,GACzC,CAEA,SA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AS,MACZA,GAAG,eAAgB,MACnBA,GAAG,QAAS,KAAK,EAGtB,GAAM3C,GAAYiC,GAAcC,EA+ChC,OA1CIlC,GAAYiC,IAGdW,EAAcD,GACZ,qBACC7b,IAEMA,EAAEqN,UAELrN,EAAEgc,2BACEb,IACFnb,EAAE+D,iBACFoV,EAAO8C,YACLH,EACA9b,EAAEkc,YAAc,EAChBlc,EAAEmc,YAAc,IAGtB,IAMNL,EACG/hB,KAAKof,GACL0C,GAAG,SAAU7b,IACZA,EAAE+D,gBAAgB,IAEnB8X,GAAG,gBAAiB,OAEjBR,GAAcC,IAAmBF,GACrCU,EAAcD,GAAG,iBAAkB,MAGhCT,GACHU,EACGD,GAAG,kBAAmB,MACtBA,GAAG,iBAAkB,MACrBA,GAAG,gBAAiB,MAGlBE,EA9CLA,GA8Cc,GACf,CACDT,EACAD,EACAD,EACAxS,EACAuS,EACAjC,EACAC,IAGK,CAAEqC,WAAU3Y,YAAWsW,SAAQhK,aACxC,C,kEC9KIiN,E,MAA0B,GAA4B,KAE1DA,EAAwB5nB,KAAK,CAAC6nB,EAAO/sB,GAAI,86CAK2E,KAEpH,QAAe8sB,EAAwBE,U,kECTnCF,E,MAA0B,GAA4B,KAE1DA,EAAwB5nB,KAAK,CAAC6nB,EAAO/sB,GAAI,kyFAYmkB,KAE5mB,QAAe8sB,EAAwBE,U","sources":["webpack:///./src/diagram/MarkerComponent.tsx","webpack:///./src/diagram/lines/curveLine.ts","webpack:///./src/diagram/lines/getDirectLinePoints.ts","webpack:///./src/diagram/lines/getPolyLinePoints.ts","webpack:///./src/diagram/processors/doTwoNodesOverlap.ts","webpack:///./src/diagram/processors/extractPartialRectTuple.ts","webpack:///./src/draw-canvas/processors/findNodeOrAreaDecorator.ts","webpack:///./src/draw-canvas/EdgeComponent.tsx","webpack:///./src/draw-canvas/NodeComponent.tsx","webpack:///./src/draw-canvas/processors/handleMouseDown.ts","webpack:///./src/draw-canvas/processors/normalizeSnapOptions.ts","webpack:///./src/draw-canvas/decorators/DecoratorArea.tsx","webpack:///./src/draw-canvas/decorators/DecoratorText.tsx","webpack:///./src/draw-canvas/decorators/DecoratorContainer.tsx","webpack:///./src/draw-canvas/decorators/index.tsx","webpack:///./src/draw-canvas/processors/computeContainerRect.ts","webpack:///./src/draw-canvas/CellComponent.tsx","webpack:///./src/draw-canvas/ConnectLineComponent.tsx","webpack:///./src/draw-canvas/HoverStateContext.ts","webpack:///./src/draw-canvas/LineConnectorComponent.tsx","webpack:///./src/draw-canvas/SmartConnectLineComponent.tsx","webpack:///./src/shared/canvas/processors/getConnectLinePoints.ts","webpack:///./src/draw-canvas/constants.ts","webpack:///./src/draw-canvas/processors/asserts.ts","webpack:///./src/draw-canvas/processors/cellToTarget.ts","webpack:///./src/draw-canvas/processors/getUnrelatedCells.ts","webpack:///./src/draw-canvas/processors/handleKeyboard.ts","webpack:///./src/draw-canvas/processors/handleLasso.ts","webpack:///./src/draw-canvas/processors/handleNodeContainedChange.ts","webpack:///./src/draw-canvas/processors/initializeCells.ts","webpack:///./src/draw-canvas/processors/sameTarget.ts","webpack:///./src/draw-canvas/processors/targetIsActive.ts","webpack:///./src/draw-canvas/processors/transformToCenter.ts","webpack:///./src/draw-canvas/processors/updateCells.ts","webpack:///./src/draw-canvas/reducers/cells.ts","webpack:///./src/draw-canvas/reducers/index.ts","webpack:///./src/draw-canvas/reducers/layoutKey.ts","webpack:///./src/shared/canvas/icons/center.svg","webpack:///./src/shared/canvas/icons/zoom-in.svg","webpack:///./src/shared/canvas/icons/zoom-out.svg","webpack:///./src/shared/canvas/ZoomBarComponent.tsx","webpack:///./src/shared/canvas/dagreLayout.ts","webpack:///./src/shared/canvas/forceLayout.ts","webpack:///./src/shared/canvas/processors/getSmartLinePoints.ts","webpack:///./src/shared/canvas/processors/nodeViewToNodeRect.ts","webpack:///./src/shared/canvas/shapes/Rectangle.ts","webpack:///./src/shared/canvas/useActiveTarget.ts","webpack:///./src/draw-canvas/processors/normalizeAlignOrigin.ts","webpack:///./src/shared/canvas/useLayout.ts","webpack:///./src/shared/canvas/useAutoCenter.ts","webpack:///./src/shared/canvas/useLineMarkers.ts","webpack:///./src/shared/canvas/useReady.ts","webpack:///./src/shared/canvas/useZoom.ts","webpack:///./src/shared/canvas/ZoomBarComponent.shadow.css","webpack:///./src/shared/canvas/styles.shadow.css"],"sourcesContent":["import React from \"react\";\nimport type { LineMarkerType } from \"./interfaces\";\n\nexport interface MarkerComponentProps extends BaseMarkerComponentProps {\n type: LineMarkerType;\n}\n\nexport interface BaseMarkerComponentProps {\n id: string;\n strokeColor?: string;\n}\n\nexport function MarkerComponent({\n id,\n type,\n strokeColor,\n}: MarkerComponentProps): JSX.Element {\n let Component: (props: BaseMarkerComponentProps) => JSX.Element;\n\n switch (type) {\n case \"0..1\":\n Component = EntityRelationZeroOrOneMarker;\n break;\n case \"0..N\":\n Component = EntityRelationZeroOrManyMarker;\n break;\n default:\n Component = ArrowMarker;\n }\n\n return <Component id={id} strokeColor={strokeColor} />;\n}\n\nfunction ArrowMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 6 6\"\n refX={5}\n refY={3}\n markerWidth={6}\n markerHeight={6}\n orient=\"auto-start-reverse\"\n strokeLinejoin=\"round\"\n >\n <path\n d=\"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z\"\n stroke={strokeColor}\n strokeWidth={1}\n fill={strokeColor}\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrOneMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrManyMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n","import {\n curveLinear,\n line,\n curveBasis,\n curveBumpX,\n curveBumpY,\n type CurveFactory,\n curveMonotoneX,\n curveNatural,\n curveMonotoneY,\n} from \"d3-shape\";\nimport type { CurveType, NodePosition } from \"../interfaces\";\n\n/**\n * Generate Line from points\n */\nexport function curveLine(\n points: Array<NodePosition> | null | undefined,\n curveType: CurveType | undefined,\n startOffset: number,\n endOffset: number\n): string {\n if (!Array.isArray(points)) {\n return \"\";\n }\n let curveFactory: CurveFactory;\n switch (curveType) {\n case \"curveLinear\":\n curveFactory = curveLinear;\n break;\n case \"curveBumpX\":\n curveFactory = curveBumpX;\n break;\n case \"curveBumpY\":\n curveFactory = curveBumpY;\n break;\n case \"curveMonotoneX\":\n curveFactory = curveMonotoneX;\n break;\n case \"curveMonotoneY\":\n curveFactory = curveMonotoneY;\n break;\n case \"curveNatural\":\n curveFactory = curveNatural;\n break;\n default:\n curveFactory = curveBasis;\n }\n const startOffsets = getOffsets(points[1], points[0], startOffset);\n const endOffsets = getOffsets(\n points[points.length - 2],\n points[points.length - 1],\n endOffset\n );\n const lineFunction = line()\n .x(\n (d, index) =>\n (d as unknown as { x: number }).x -\n (index === 0\n ? startOffsets.x\n : index === points.length - 1\n ? endOffsets.x\n : 0)\n )\n .y(\n (d, index) =>\n (d as unknown as { y: number }).y -\n (index === 0\n ? startOffsets.y\n : index === points.length - 1\n ? endOffsets.y\n : 0)\n )\n .curve(curveFactory);\n return lineFunction(points as unknown as Array<[number, number]>)!;\n}\n\nfunction getOffsets(\n start: NodePosition,\n end: NodePosition,\n offset: number\n): NodePosition {\n if (!offset) {\n return { x: 0, y: 0 };\n }\n const { x: x0, y: y0 } = start;\n const { x: x1, y: y1 } = end;\n const distance = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));\n const ratio = offset / distance;\n return {\n x: (x1 - x0) * ratio,\n y: (y1 - y0) * ratio,\n };\n}\n","import type { NodePosition, NodeRect, PositionTuple } from \"../interfaces\";\nimport { doTwoNodesOverlap } from \"../processors/doTwoNodesOverlap\";\n\ntype LineTuple = [start: PositionTuple, end: PositionTuple];\n\nexport function getDirectLinePoints(\n source: NodeRect,\n target: NodeRect,\n parallelGap?: number\n): NodePosition[] | null {\n // Ignore if two nodes are the same.\n // Ignore if two nodes overlap.\n if (source === target || doTwoNodesOverlap(source, target, 0, 0)) {\n return null;\n }\n\n let p0: PositionTuple;\n let p1: PositionTuple;\n\n let xDiff = 0;\n let yDiff = 0;\n\n if (parallelGap) {\n const dx = target.x - source.x;\n const dy = target.y - source.y;\n const angle = Math.atan2(dy, dx);\n xDiff = (parallelGap / 2) * Math.cos(angle + Math.PI / 2);\n yDiff = (parallelGap / 2) * Math.sin(angle + Math.PI / 2);\n }\n\n const line: LineTuple = [\n [source.x + xDiff, source.y + yDiff],\n [target.x + xDiff, target.y + yDiff],\n ];\n const sourceIntersections = getIntersections(source, line);\n const targetIntersections = getIntersections(target, line);\n\n // Todo: handle when more than one intersection\n if (sourceIntersections.length > 0) {\n p0 = sourceIntersections[0];\n } else {\n p0 = [source.x, source.y];\n }\n if (targetIntersections.length > 0) {\n p1 = targetIntersections[0];\n } else {\n p1 = [target.x, target.y];\n }\n\n return [\n { x: p0[0], y: p0[1] },\n { x: p1[0], y: p1[1] },\n ];\n}\n\nfunction getIntersections(rect: NodeRect, line: LineTuple) {\n const vertices: PositionTuple[] = [\n [rect.x - rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y + rect.height / 2],\n [rect.x - rect.width / 2, rect.y + rect.height / 2],\n ];\n const possibleLines: [start: PositionTuple, end: PositionTuple][] = [];\n for (let i = 0; i < 4; i++) {\n possibleLines.push([vertices[i], vertices[(i + 1) % 4]]);\n }\n const intersections: PositionTuple[] = [];\n for (const item of possibleLines) {\n const intersection = intersect(line[0], line[1], item[0], item[1]);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n return intersections;\n}\n\n// https://paulbourke.net/geometry/pointlineplane/javascript.txt\nfunction intersect(\n [x1, y1]: PositionTuple,\n [x2, y2]: PositionTuple,\n [x3, y3]: PositionTuple,\n [x4, y4]: PositionTuple\n): null | PositionTuple {\n // Check if none of the lines are of length 0\n if ((x1 === x2 && y1 === y2) || (x3 === x4 && y3 === y4)) {\n return null;\n }\n\n const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);\n\n // Lines are parallel\n if (denominator === 0) {\n return null;\n }\n\n const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;\n const ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator;\n\n // is the intersection along the segments\n if (ua < 0 || ua > 1 || ub < 0 || ub > 1) {\n return null;\n }\n\n // Return a object with the x and y coordinates of the intersection\n const x = x1 + ua * (x2 - x1);\n const y = y1 + ua * (y2 - y1);\n\n return [x, y];\n}\n","import type { Direction, NodePosition, NodeRect } from \"../interfaces\";\n\nexport function getPolyLinePoints(\n source: NodeRect,\n target: NodeRect,\n sourceDirection: Direction,\n targetDirection: Direction,\n sourcePosition: number,\n targetPosition: number\n): NodePosition[] {\n const p0 = getCoordinates(source, sourceDirection, sourcePosition);\n const p1 = getCoordinates(target, targetDirection, targetPosition);\n\n let c1: NodePosition;\n let c2: NodePosition | undefined;\n switch (sourceDirection) {\n case \"top\":\n case \"bottom\":\n switch (targetDirection) {\n case \"left\":\n case \"right\":\n c1 = { x: p0.x, y: p1.y };\n break;\n default:\n c1 = { x: p0.x, y: (p0.y + p1.y) / 2 };\n c2 = { x: p1.x, y: c1.y };\n }\n break;\n default:\n switch (targetDirection) {\n case \"top\":\n case \"bottom\":\n c1 = { x: p1.x, y: p0.y };\n break;\n default:\n c1 = { x: (p0.x + p1.x) / 2, y: p0.y };\n c2 = { x: c1.x, y: p1.y };\n }\n }\n\n return [p0, c1, c2, p1].filter(Boolean) as NodePosition[];\n}\n\nfunction getCoordinates(\n node: NodeRect,\n direction: Direction,\n position: number\n): NodePosition {\n const { x, y, width, height } = node;\n switch (direction) {\n case \"top\":\n return {\n x: x - width / 2 + width * position,\n y: y - height / 2,\n };\n case \"bottom\":\n return {\n x: x - width / 2 + width * position,\n y: y + height / 2,\n };\n case \"left\":\n return {\n x: x - width / 2,\n y: y - height / 2 + height * position,\n };\n case \"right\":\n return {\n x: x + width / 2,\n y: y - height / 2 + height * position,\n };\n }\n}\n","import type { NodeRect } from \"../interfaces\";\n\nexport function doTwoNodesOverlap(\n a: NodeRect,\n b: NodeRect,\n paddingA: number,\n paddingB: number\n): boolean {\n const A = paddingA ? getNodesWithPadding(a, paddingA) : a;\n const B = paddingB ? getNodesWithPadding(b, paddingB) : b;\n const left = Math.min(A.x - A.width / 2, B.x - B.width / 2);\n const right = Math.max(A.x + A.width / 2, B.x + B.width / 2);\n const top = Math.min(A.y - A.height / 2, B.y - B.height / 2);\n const bottom = Math.max(A.y + A.height / 2, B.y + B.height / 2);\n return right - left < A.width + B.width && bottom - top < A.height + B.height;\n}\n\nfunction getNodesWithPadding(node: NodeRect, padding: number) {\n return {\n x: node.x - node.width / 2 - padding,\n y: node.y - node.height / 2 - padding,\n width: node.width + padding * 2,\n height: node.height + padding * 2,\n };\n}\n","import type { FullRectTuple, PartialRectTuple } from \"../interfaces\";\n\nexport function extractPartialRectTuple(\n value: PartialRectTuple\n): FullRectTuple {\n if (Array.isArray(value)) {\n const v0 = value[0];\n const v1 = value.length > 1 ? value[1]! : v0;\n const v2 = value.length > 2 ? value[2]! : v0;\n const v3 = value.length > 3 ? value[3]! : v1;\n return [v0, v1, v2, v3];\n }\n return new Array(4).fill(value) as FullRectTuple;\n}\n","import type { Cell, NodeCell, DecoratorCell, NodeId } from \"../interfaces\";\nimport { isNodeOrAreaDecoratorCell } from \"./asserts\";\n\nexport function findNodeOrAreaDecorator(\n cells: Cell[],\n id: NodeId\n): NodeCell | DecoratorCell | undefined {\n return cells.find(\n (cell) => isNodeOrAreaDecoratorCell(cell) && cell.id === id\n ) as NodeCell | DecoratorCell | undefined;\n}\n","import React, { useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport { omitBy } from \"lodash\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n EdgeCell,\n EdgeView,\n} from \"./interfaces\";\nimport { getDirectLinePoints } from \"../diagram/lines/getDirectLinePoints\";\nimport type { NodeRect } from \"../diagram/interfaces\";\nimport { findNode } from \"./processors/findNode\";\nimport { isEdgeCell } from \"./processors/asserts\";\nimport { DEFAULT_LINE_INTERACT_ANIMATE_DURATION } from \"./constants\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { nodeViewToNodeRect } from \"../shared/canvas/processors/nodeViewToNodeRect\";\nimport { getSmartLinePoints } from \"../shared/canvas/processors/getSmartLinePoints\";\nimport { findNodeOrAreaDecorator } from \"./processors/findNodeOrAreaDecorator\";\n\nexport interface EdgeComponentProps {\n edge: EdgeCell;\n cells: Cell[];\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n}\n\nexport function EdgeComponent({\n edge,\n cells,\n lineConfMap,\n}: EdgeComponentProps): JSX.Element | null {\n const pathRef = useRef<SVGPathElement>(null);\n const sourceNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.source),\n [cells, edge.source]\n );\n const targetNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.target),\n [cells, edge.target]\n );\n const lineConf = useMemo(\n () => ({\n ...lineConfMap.get(edge)!,\n ...omitBy(\n edge.view,\n (value, key) => value === undefined || key === \"$markerUrl\"\n ),\n }),\n [edge, lineConfMap]\n );\n\n const parallelGap = useMemo(() => {\n const hasOppositeEdge = cells.some(\n (cell) =>\n isEdgeCell(cell) &&\n cell.source === edge.target &&\n cell.target === edge.source &&\n !(edge.view?.exitPosition && edge.view.entryPosition)\n );\n return hasOppositeEdge ? lineConf.parallelGap : 0;\n }, [cells, edge, lineConf.parallelGap]);\n\n const padding = 5;\n\n const line = useMemo(() => {\n const points =\n sourceNode &&\n targetNode &&\n sourceNode.view.x != null &&\n targetNode.view.x != null\n ? edge.view?.exitPosition && edge.view.entryPosition\n ? getSmartLinePoints(\n sourceNode.view,\n targetNode.view,\n edge.view as Required<\n Pick<EdgeView, \"exitPosition\" | \"entryPosition\">\n >\n )\n : getDirectLinePoints(\n nodeViewToNodeRect(sourceNode.view, padding),\n nodeViewToNodeRect(targetNode.view, padding),\n parallelGap\n )\n : null;\n const fixedLineType = lineConf.type === \"auto\" ? \"polyline\" : lineConf.type;\n return curveLine(\n points,\n fixedLineType === \"curve\" ? lineConf.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [edge.view, lineConf, parallelGap, sourceNode, targetNode]);\n\n if (!line) {\n // This happens when source or target is not found,\n // or when source or target has not been positioned yet.\n return null;\n }\n\n return (\n <>\n <path\n // This `path` is made for expanding interaction area of graph lines.\n d={line}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={lineConf.interactStrokeWidth}\n />\n <path\n ref={pathRef}\n className={classNames(\"line\", {\n dashed: lineConf.dashed,\n [`${lineConf.dashed ? \"dashed\" : \"solid\"}-animation`]:\n lineConf.animate.useAnimate,\n })}\n style={\n {\n \"--time\": `${lineConf.animate.duration ?? DEFAULT_LINE_INTERACT_ANIMATE_DURATION}s`,\n \"--solid-length\": pathRef.current?.getTotalLength?.(),\n } as React.CSSProperties\n }\n d={line}\n fill=\"none\"\n stroke={lineConf.strokeColor}\n strokeWidth={lineConf.strokeWidth}\n markerStart={lineConf.showStartArrow ? lineConf.$markerUrl : \"\"}\n markerEnd={lineConf.showEndArrow ? lineConf.$markerUrl : \"\"}\n />\n <path className=\"line-active-bg\" d={line} fill=\"none\" />\n </>\n );\n}\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { isEqual } from \"lodash\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport type { NodeBrickCell, NodeBrickConf, NodeCell } from \"./interfaces\";\nimport type { SizeTuple } from \"../diagram/interfaces\";\n\nexport interface NodeComponentProps {\n node: NodeCell;\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n onResize(id: string, size: SizeTuple | null): void;\n}\n\nexport function NodeComponent({\n node,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n onResize,\n}: NodeComponentProps): JSX.Element | null {\n const memoizedData = useDeepMemo({ node: { id: node.id, data: node.data } });\n const specifiedUseBrick = (node as NodeBrickCell).useBrick;\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const useBrick = useMemo(() => {\n return degraded\n ? null\n : specifiedUseBrick ??\n defaultNodeBricks?.find((item) =>\n checkIfByTransform(item, memoizedData)\n )?.useBrick;\n }, [degraded, specifiedUseBrick, defaultNodeBricks, memoizedData]);\n\n const label = useMemo<string>(\n () =>\n degraded\n ? String(\n __secret_internals.legacyDoTransform(\n memoizedData,\n degradedNodeLabel ?? \"<% DATA.node.id %>\"\n )\n )\n : \"\",\n [degraded, degradedNodeLabel, memoizedData]\n );\n\n const refCallback = useCallback(\n (element: HTMLElement | null) => {\n const prevObserver = observerRef.current;\n if (prevObserver) {\n prevObserver.disconnect();\n observerRef.current = null;\n }\n if (element) {\n // Todo: correctly wait for `useBrick` in v3 to be rendered (after layout)\n // Wait a macro task to let `useBrick` to be rendered.\n setTimeout(() => {\n const observer = new ResizeObserver(() => {\n onResize(node.id, [element.offsetWidth, element.offsetHeight]);\n });\n observer.observe(element);\n observerRef.current = observer;\n });\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n const degradedRefCallBack = useCallback(\n (g: SVGGElement | null) => {\n if (g) {\n // istanbul ignore next\n const size =\n process.env.NODE_ENV === \"test\"\n ? { width: 60, height: 60 }\n : g.getBBox();\n onResize(node.id, [size.width, size.height]);\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n return useBrick ? (\n <foreignObject\n // Make a large size to avoid the brick inside to be clipped by the foreignObject.\n width={9999}\n height={9999}\n className=\"node\"\n >\n {useBrick && (\n <ReactUseBrick\n useBrick={useBrick}\n data={memoizedData}\n refCallback={refCallback}\n />\n )}\n </foreignObject>\n ) : degraded ? (\n <g className=\"degraded\" ref={degradedRefCallBack}>\n <circle cx={8} cy={8} r={8} />\n <text x={8} y={32}>\n {label}\n </text>\n </g>\n ) : null;\n}\n\nfunction useDeepMemo<T>(value: T): T {\n const [memoizedValue, setMemoizedValue] = useState(value);\n\n useEffect(() => {\n setMemoizedValue((prev) => (isEqual(prev, value) ? prev : value));\n }, [value]);\n\n return memoizedValue;\n}\n","import type { PositionTuple } from \"../../diagram/interfaces\";\nimport type {\n ActiveTarget,\n Cell,\n LayoutOptions,\n DecoratorCell,\n LayoutType,\n NodeCell,\n NodeView,\n} from \"../interfaces\";\nimport type {\n MoveCellPayload,\n ResizeCellPayload,\n} from \"../reducers/interfaces\";\nimport {\n isContainerDecoratorCell,\n isDecoratorCell,\n isEdgeCell,\n isNodeCell,\n} from \"./asserts\";\nimport { cellToTarget } from \"./cellToTarget\";\nimport { normalizeSnapOptions } from \"./normalizeSnapOptions\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport function handleMouseDown(\n event: MouseEvent,\n {\n action,\n cell,\n scale,\n layout,\n layoutOptions,\n activeTarget,\n cells,\n onCellsMoving,\n onCellsMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n }: {\n action: \"move\" | \"resize\";\n cell: Cell;\n scale: number;\n layout?: LayoutType;\n layoutOptions?: LayoutOptions;\n activeTarget: ActiveTarget | null | undefined;\n cells: Cell[];\n onCellsMoving?(info: MoveCellPayload[]): void;\n onCellsMoved?(info: MoveCellPayload[]): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget?(activeTarget: ActiveTarget | null): void;\n }\n) {\n event.stopPropagation();\n // Drag node\n if (action === \"resize\" || !targetIsActive(cell, activeTarget)) {\n onSwitchActiveTarget?.(cellToTarget(cell));\n }\n\n const isAutoLayout = layout === \"force\" || layout === \"dagre\";\n if (isEdgeCell(cell)) {\n return;\n }\n const activeCells: Cell[] = [];\n const actives =\n activeTarget?.type === \"multi\" && action === \"move\"\n ? cells.filter((c) => targetIsActive(c, activeTarget))\n : [cell];\n actives.forEach((a) => {\n activeCells.push(a);\n if (action === \"move\" && isContainerDecoratorCell(a)) {\n activeCells.push(\n ...cells.filter(\n (c) => isNodeCell(c) && c.containerId === a.id && !actives.includes(c)\n )\n );\n }\n });\n const movableActiveCells = activeCells.filter(\n (c) => (isNodeCell(c) && !isAutoLayout) || isDecoratorCell(c)\n ) as (NodeCell | DecoratorCell)[];\n\n if (movableActiveCells.length === 0) {\n return;\n }\n\n const snap = normalizeSnapOptions(layoutOptions?.snap);\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const originals = movableActiveCells.map<{\n cell: NodeCell | DecoratorCell;\n position: PositionTuple;\n center: PositionTuple | null;\n }>((c) => ({\n cell: c,\n position:\n action === \"move\" ? [c.view.x, c.view.y] : [c.view.width, c.view.height],\n center:\n action === \"move\" && !isEdgeCell(c) ? getCenterPosition(c.view) : null,\n }));\n const firstOriginalPosition = originals[0].position;\n let previousPositions = originals.map(({ position }) => position);\n\n // Get the positions of the objects (cells that are not active) to snap to\n let snapToObjectTargets: {\n cell: NodeCell | DecoratorCell;\n center: PositionTuple;\n }[] = [];\n if (action === \"move\" && snap.object) {\n const objectCells = cells.filter(\n (c) => !isEdgeCell(c) && !activeCells.includes(c)\n ) as (NodeCell | DecoratorCell)[];\n snapToObjectTargets = objectCells.map((c) => ({\n cell: c,\n center: getCenterPosition(c.view),\n }));\n }\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [(e.clientX - from[0]) / scale, (e.clientY - from[1]) / scale];\n }\n let moved = false;\n\n const handleMove = (e: MouseEvent, finished?: boolean) => {\n // Respect the scale\n const movement = getMovement(e);\n let newPositions: PositionTuple[];\n let xAlign: [PositionTuple, PositionTuple] | undefined;\n let yAlign: [PositionTuple, PositionTuple] | undefined;\n let xAlignCell: Cell | undefined;\n let yAlignCell: Cell | undefined;\n\n // Use alt key (or option key ⌥ on Mac) to disable snap\n if ((!snap.grid && !snap.object) || e.altKey) {\n // No snap\n newPositions = originals.map(({ position }) => [\n position[0] + movement[0],\n position[1] + movement[1],\n ]);\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n } else {\n // Snap\n let diffX = Infinity;\n let diffY = Infinity;\n const snapMovement: PositionTuple = [...movement];\n\n if (snap.object) {\n const snapToObjectDistance = snap.object.distance;\n let xAlignFrom: PositionTuple | undefined;\n let yAlignFrom: PositionTuple | undefined;\n let xAlignTarget: NodeCell | DecoratorCell | undefined;\n let yAlignTarget: NodeCell | DecoratorCell | undefined;\n let xAlignToY = 0;\n let yAlignToX = 0;\n for (const {\n cell: target,\n center: [x, y],\n } of snapToObjectTargets) {\n for (const { cell: c, center } of originals) {\n const [cx, cy] = center!;\n const dX = Math.abs(cx + movement[0] - x);\n const dY = Math.abs(cy + movement[1] - y);\n const xSnapped = dX < snapToObjectDistance && dX < diffX;\n const ySnapped = dY < snapToObjectDistance && dY < diffY;\n if (xSnapped) {\n diffX = dX;\n snapMovement[0] = x - cx;\n xAlignCell = c;\n xAlignTarget = target;\n xAlignFrom = [x, y];\n xAlignToY = cy;\n }\n if (ySnapped) {\n diffY = dY;\n snapMovement[1] = y - cy;\n yAlignCell = c;\n yAlignTarget = target;\n yAlignFrom = [x, y];\n yAlignToX = cx;\n }\n }\n }\n\n if (xAlignTarget && xAlignTarget === yAlignTarget) {\n // Handle special case when both x and y are snapped to the same target.\n const halfHeight = xAlignTarget.view.height / 2;\n const halfWidth = xAlignTarget.view.width / 2;\n xAlign = [\n [xAlignFrom![0], xAlignFrom![1] - halfHeight],\n [xAlignFrom![0], xAlignFrom![1] + halfHeight],\n ];\n yAlign = [\n [yAlignFrom![0] - halfWidth, yAlignFrom![1]],\n [yAlignFrom![0] + halfWidth, yAlignFrom![1]],\n ];\n } else {\n if (xAlignFrom) {\n xAlign = [xAlignFrom, [xAlignFrom[0], xAlignToY + snapMovement[1]]];\n }\n if (yAlignFrom) {\n yAlign = [yAlignFrom, [yAlignToX + snapMovement[0], yAlignFrom[1]]];\n }\n }\n }\n\n if (snap.grid) {\n const snapToGridSize = snap.grid.size;\n // Use the first cell to decide the snap to grid position\n const firstNewPosition: PositionTuple = [\n Math.round(\n (firstOriginalPosition[0] + movement[0]) / snapToGridSize\n ) * snapToGridSize,\n Math.round(\n (firstOriginalPosition[1] + movement[1]) / snapToGridSize\n ) * snapToGridSize,\n ];\n const snapToGridMovement: PositionTuple = [\n firstNewPosition[0] - firstOriginalPosition[0],\n firstNewPosition[1] - firstOriginalPosition[1],\n ];\n const snapToGridDiffX = Math.abs(snapToGridMovement[0] - movement[0]);\n const snapToGridDiffY = Math.abs(snapToGridMovement[1] - movement[1]);\n if (snapToGridDiffX < diffX) {\n diffX = snapToGridDiffX;\n snapMovement[0] = snapToGridMovement[0];\n xAlign = undefined;\n xAlignCell = undefined;\n }\n if (snapToGridDiffY < diffY) {\n diffY = snapToGridDiffY;\n snapMovement[1] = snapToGridMovement[1];\n yAlign = undefined;\n yAlignCell = undefined;\n }\n }\n\n newPositions = originals.map(({ position }) => [\n Math.round(position[0] + snapMovement[0]),\n Math.round(position[1] + snapMovement[1]),\n ]);\n const changed =\n newPositions[0][0] !== previousPositions[0][0] ||\n newPositions[0][1] !== previousPositions[0][1];\n if (changed) {\n previousPositions = newPositions;\n moved = true;\n }\n }\n\n if (moved) {\n if (action === \"move\") {\n const payloads = originals.map(({ cell: c }, index) => ({\n type: c.type,\n id: c.id,\n x: newPositions[index][0],\n y: newPositions[index][1],\n width: c.view.width,\n height: c.view.height,\n decorator: isDecoratorCell(c) ? c.decorator : undefined,\n guideLines: finished\n ? undefined\n : [\n ...(xAlignCell === c ? [xAlign!] : []),\n ...(yAlignCell === c ? [yAlign!] : []),\n ],\n }));\n (finished ? onCellsMoved : onCellsMoving)?.(payloads);\n } else {\n (finished ? onCellResized : onCellResizing)?.({\n type: cell.type,\n id: cell.id,\n width: newPositions[0][0],\n height: newPositions[0][1],\n });\n }\n }\n };\n\n const onMouseMove = (e: MouseEvent) => {\n handleMove(e);\n };\n const onMouseUp = (e: MouseEvent) => {\n handleMove(e, true);\n moved = false;\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n}\n\nfunction getCenterPosition(view: NodeView): PositionTuple {\n return [view.x + view.width / 2, view.y + view.height / 2];\n}\n","import {\n DEFAULT_SNAP_GRID_SIZE,\n DEFAULT_SNAP_OBJECT_DISTANCE,\n} from \"../constants\";\nimport type {\n SnapOptions,\n SnapToGridOptions,\n SnapToObjectOptions,\n} from \"../interfaces\";\n\nexport interface NormalizedSnapOptions {\n grid: Required<SnapToGridOptions> | null;\n object: Required<SnapToObjectOptions> | null;\n}\n\nexport function normalizeSnapOptions(\n snap: boolean | SnapOptions | undefined\n): NormalizedSnapOptions {\n const intermediateSnap = snap\n ? snap === true\n ? { grid: true, object: true }\n : snap\n : null;\n const snapToGrid = intermediateSnap?.grid\n ? intermediateSnap.grid === true\n ? {}\n : intermediateSnap.grid\n : null;\n const snapToObject = intermediateSnap?.object\n ? intermediateSnap.object === true\n ? {}\n : intermediateSnap.object\n : null;\n return {\n grid: snapToGrid\n ? { size: snapToGrid.size ?? DEFAULT_SNAP_GRID_SIZE }\n : null,\n object: snapToObject\n ? { distance: snapToObject.distance ?? DEFAULT_SNAP_OBJECT_DISTANCE }\n : null,\n };\n}\n","import React, { useEffect } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\n\nexport function DecoratorArea({\n cell,\n transform,\n readOnly,\n layoutOptions,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n}: BasicDecoratorProps): JSX.Element {\n const resizeHandleRef = React.useRef<SVGGElement>(null);\n\n useEffect(() => {\n const resizeHandle = resizeHandleRef.current;\n if (!resizeHandle || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n layoutOptions,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n activeTarget,\n cell,\n cells,\n layoutOptions,\n onCellResized,\n onCellResizing,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n return (\n <g className=\"decorator-area\">\n <rect\n width={cell.view.width}\n height={cell.view.height}\n className=\"area\"\n />\n {!readOnly && (\n <g\n ref={resizeHandleRef}\n className=\"resize-handle\"\n transform={`translate(${cell.view.width - 20} ${cell.view.height - 20})`}\n >\n <rect width={20} height={20} />\n <path d=\"M10 18L18 10 M15 18L18 15\" />\n </g>\n )}\n </g>\n );\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport classNames from \"classnames\";\n\nexport type DecoratorTextProps = Pick<\n BasicDecoratorProps,\n \"cell\" | \"readOnly\" | \"onDecoratorTextEditing\" | \"onDecoratorTextChange\"\n>;\n\nexport function DecoratorText({\n cell,\n readOnly,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: DecoratorTextProps): JSX.Element {\n const label = cell.view.text ?? \"\";\n const [currentLabel, setCurrentLabel] = useState<string>(label);\n const [editingLabel, setEditingLabel] = useState(false);\n const editingLabelInitialized = useRef(false);\n const [shouldEmitLabelChange, setShouldEmitLabelChange] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n const handleEnableEdit = useCallback(\n (e: React.MouseEvent) => {\n if (readOnly) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly]\n );\n\n useEffect(() => {\n const element = ref.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n useEffect(() => {\n const parentElement = ref.current?.parentElement;\n if (parentElement) {\n cell.view.width = parentElement.clientWidth;\n cell.view.height = parentElement.clientHeight;\n }\n }, [currentLabel, cell.id]);\n\n useEffect(() => {\n if (editingLabel && ref.current) {\n ref.current.focus();\n selectAllText(ref.current);\n }\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n useEffect(() => {\n if (editingLabelInitialized.current) {\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n } else {\n editingLabelInitialized.current = true;\n }\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n const handleInput = useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (readOnly) {\n return;\n }\n setCurrentLabel((event.target as HTMLDivElement).textContent!);\n },\n [readOnly]\n );\n\n const handleBlur = useCallback(() => {\n if (readOnly) {\n return;\n }\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n }, [readOnly]);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onDecoratorTextChange?.({\n id: cell.id,\n view: { ...cell.view, text: currentLabel },\n });\n setShouldEmitLabelChange(false);\n }\n }, [cell, currentLabel, onDecoratorTextChange, shouldEmitLabelChange]);\n\n return (\n <foreignObject className=\"decorator-text\">\n <div\n className={classNames(\"text-container\", { editing: editingLabel })}\n onDoubleClick={handleEnableEdit}\n >\n <div\n className=\"text\"\n contentEditable={editingLabel}\n ref={ref}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n );\n}\n\nexport function selectAllText(element: HTMLElement) {\n const range = document.createRange();\n range.selectNodeContents(element);\n const selection = window.getSelection()!;\n selection.removeAllRanges();\n selection.addRange(range);\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\nimport classNames from \"classnames\";\nimport { get } from \"lodash\";\nimport { selectAllText } from \"./DecoratorText\";\nimport { isNoManualLayout } from \"../processors/asserts\";\nimport { uuidV4 } from \"..\";\n\nexport function DecoratorContainer({\n cell,\n transform,\n readOnly,\n layout,\n view,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element {\n const label = get(cell.view, \"text\", \"\");\n const direction = get(cell.view, \"direction\", \"top\");\n const textRef = useRef<HTMLDivElement>(null);\n const resizeHandleRef = React.useRef<SVGGElement>(null);\n const [editingLabel, setEditingLabel] = useState(false);\n const [currentLabel, setCurrentLabel] = useState<string>(label);\n const [shouldEmitLabelChange, setShouldEmitLabelChange] = useState(false);\n const [recomputation, setRecomputation] = useState<string>();\n const [titleForeignRect, setTitleForeignRect] = useState({\n x: 0,\n y: 0,\n width: cell.view.width,\n height: cell.view.height,\n });\n const handleEnableEdit = useCallback(\n (e: React.MouseEvent) => {\n if (readOnly) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly]\n );\n const handleInput = useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (readOnly) {\n return;\n }\n setCurrentLabel((event.target as HTMLDivElement).textContent!);\n },\n [readOnly]\n );\n\n const handleBlur = useCallback(() => {\n if (readOnly) {\n return;\n }\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n setRecomputation(uuidV4());\n }, [readOnly]);\n\n useEffect(() => {\n setCurrentLabel(label);\n }, [label]);\n useEffect(() => {\n const element = textRef.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n\n useEffect(() => {\n const textParentEle = textRef.current?.parentElement;\n if (textParentEle) {\n const { clientWidth, clientHeight } = textParentEle;\n if ([\"left\", \"right\"].includes(direction)) {\n const rect = {\n width: clientWidth,\n height: view.height,\n x: direction === \"left\" ? -clientWidth : view.width,\n y: 0,\n };\n setTitleForeignRect(rect);\n } else {\n const rect = {\n width: view.width,\n height: clientHeight,\n x: 0,\n y: direction === \"top\" ? -clientHeight : view.height,\n };\n setTitleForeignRect(rect);\n }\n }\n }, [view, currentLabel, direction, recomputation]);\n\n useEffect(() => {\n if (editingLabel && textRef.current) {\n textRef.current.focus();\n selectAllText(textRef.current);\n }\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onDecoratorTextChange?.({\n id: cell.id,\n view: { ...view, text: currentLabel },\n });\n setShouldEmitLabelChange(false);\n }\n }, [cell, view, currentLabel, onDecoratorTextChange, shouldEmitLabelChange]);\n\n useEffect(() => {\n const resizeHandle = resizeHandleRef.current;\n if (!resizeHandle || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n activeTarget,\n cell,\n cells,\n onCellResized,\n onCellResizing,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n return (\n <g className=\"decorator-container\">\n <foreignObject {...titleForeignRect}>\n <div\n className={classNames(\"text-container\", {\n editing: editingLabel,\n [[\"left\", \"right\"].includes(direction) ? \"vertical\" : \"horizontal\"]:\n true,\n })}\n onDoubleClick={handleEnableEdit}\n >\n <div\n className=\"text\"\n contentEditable={editingLabel}\n ref={textRef}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n <rect width={view.width} height={view.height} className=\"container\" />\n {!readOnly && !isNoManualLayout(layout) && (\n <g\n ref={resizeHandleRef}\n className=\"resize-handle\"\n transform={`translate(${view.width - 20} ${view.height - 20})`}\n >\n <rect width={20} height={20} />\n <path d=\"M10 18L18 10 M15 18L18 15\" />\n </g>\n )}\n </g>\n );\n}\n","import React from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { DecoratorArea } from \"./DecoratorArea\";\nimport { DecoratorText } from \"./DecoratorText\";\nimport { DecoratorContainer } from \"./DecoratorContainer\";\n\nexport function DecoratorComponent({\n cell,\n view,\n transform,\n readOnly,\n layout,\n layoutOptions,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element | null {\n let SpecifiedComponent: (props: BasicDecoratorProps) => JSX.Element | null;\n\n switch (cell.decorator) {\n case \"container\":\n SpecifiedComponent = DecoratorContainer;\n break;\n case \"area\":\n SpecifiedComponent = DecoratorArea;\n break;\n case \"text\":\n SpecifiedComponent = DecoratorText;\n break;\n // istanbul ignore next\n default:\n // eslint-disable-next-line no-console\n console.error(`Unknown decorator: ${cell.decorator}`);\n return null;\n }\n\n return (\n <SpecifiedComponent\n cell={cell}\n view={view}\n transform={transform}\n readOnly={readOnly}\n layout={layout}\n layoutOptions={layoutOptions}\n activeTarget={activeTarget}\n cells={cells}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n );\n}\n","import { BaseNodeCell } from \"../interfaces\";\n\nexport function computeContainerRect(cells: BaseNodeCell[]) {\n let minX = Infinity,\n minY = Infinity;\n let maxX = -Infinity,\n maxY = -Infinity;\n cells.forEach((cell) => {\n const { x, y, width, height } = cell.view;\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x + width > maxX) maxX = x + width;\n if (y + height > maxY) maxY = y + height;\n });\n if (![minX, maxX, minY, maxY].some((n) => isFinite(n))) return {};\n const padding = 20;\n const width = maxX - minX + padding * 2;\n const height = maxY - minY + padding * 2;\n return {\n x: minX - padding,\n y: minY - padding,\n width: width,\n height: height,\n };\n}\n","import React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n ActiveTarget,\n Cell,\n CellContextMenuDetail,\n ComputedEdgeLineConf,\n DecoratorTextChangeDetail,\n DecoratorView,\n EdgeCell,\n LayoutOptions,\n LayoutType,\n NodeBrickConf,\n NodeCell,\n} from \"./interfaces\";\nimport {\n isContainerDecoratorCell,\n isDecoratorCell,\n isEdgeCell,\n isNoManualLayout,\n isNodeCell,\n} from \"./processors/asserts\";\nimport { EdgeComponent } from \"./EdgeComponent\";\nimport { NodeComponent } from \"./NodeComponent\";\nimport { handleMouseDown } from \"./processors/handleMouseDown\";\nimport type { MoveCellPayload, ResizeCellPayload } from \"./reducers/interfaces\";\nimport { DecoratorComponent } from \"./decorators\";\nimport { cellToTarget } from \"./processors/cellToTarget\";\nimport type { SizeTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { sameTarget } from \"./processors/sameTarget\";\nimport { targetIsActive } from \"./processors/targetIsActive\";\nimport { computeContainerRect } from \"./processors/computeContainerRect\";\nimport { get } from \"lodash\";\nexport interface CellComponentProps {\n layout: LayoutType;\n layoutOptions?: LayoutOptions;\n cell: Cell;\n cells: Cell[];\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n transform: TransformLiteral;\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n activeTarget: ActiveTarget | null | undefined;\n readOnly?: boolean;\n unrelatedCells: Cell[];\n dragNodeToContainerActive?: boolean;\n onCellsMoving?(info: MoveCellPayload[]): void;\n onCellsMoved?(info: MoveCellPayload[]): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget(target: ActiveTarget | null): void;\n onCellContextMenu(detail: CellContextMenuDetail): void;\n onCellClick?(detail: CellContextMenuDetail): void;\n onDecoratorTextEditing?(detail: { id: string; editing: boolean }): void;\n onDecoratorTextChange?(detail: DecoratorTextChangeDetail): void;\n onNodeBrickResize(id: string, size: SizeTuple | null): void;\n onCellMouseEnter?(cell: Cell): void;\n onCellMouseLeave?(cell: Cell): void;\n}\n\nexport function CellComponent({\n layout,\n layoutOptions,\n cell,\n cells,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n lineConfMap,\n activeTarget,\n dragNodeToContainerActive,\n readOnly,\n transform,\n unrelatedCells,\n onCellsMoving,\n onCellsMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onCellContextMenu,\n onCellClick,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n onNodeBrickResize,\n onCellMouseEnter,\n onCellMouseLeave,\n}: CellComponentProps): JSX.Element | null {\n const gRef = useRef<SVGGElement>(null);\n const unrelated = useMemo(\n () => unrelatedCells.some((item) => sameTarget(item, cell)),\n [cell, unrelatedCells]\n );\n // `containerRect` is undefined when it's an edge cell.\n const containerRect = useMemo((): DecoratorView | undefined => {\n if (isContainerDecoratorCell(cell) && isNoManualLayout(layout)) {\n const containCells = cells.filter(\n (c): c is NodeCell => isNodeCell(c) && c.containerId === cell.id\n );\n const view = {\n ...cell.view,\n ...computeContainerRect(containCells),\n };\n cell.view = view; //Update the rect container to make sure Lasso gets the correct size\n return view;\n }\n return isEdgeCell(cell)\n ? undefined\n : get(cell, \"view\", { x: 0, y: 0, width: 0, height: 0 });\n }, [layout, cell, cells]);\n\n useEffect(() => {\n const g = gRef.current;\n if (!g) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n if (\n readOnly ||\n (isContainerDecoratorCell(cell) && isNoManualLayout(layout))\n ) {\n event.stopPropagation();\n } else {\n handleMouseDown(event, {\n layout,\n layoutOptions,\n action: \"move\",\n cell,\n scale: transform.k,\n activeTarget,\n cells,\n onCellsMoving,\n onCellsMoved,\n onSwitchActiveTarget,\n });\n }\n };\n g.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n g.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n layout,\n layoutOptions,\n cell,\n activeTarget,\n cells,\n onCellsMoved,\n onCellsMoving,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n const handleContextMenu = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (readOnly && cell.type === \"decorator\") {\n return;\n }\n event.preventDefault();\n onSwitchActiveTarget(cellToTarget(cell));\n onCellContextMenu({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellContextMenu, onSwitchActiveTarget, readOnly]\n );\n\n const handleCellClick = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (!onCellClick || cell.type === \"decorator\") {\n return;\n }\n onCellClick({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellClick]\n );\n\n const handleMouseEnter = useCallback(() => {\n onCellMouseEnter?.(cell);\n }, [cell, onCellMouseEnter]);\n\n const handleMouseLeave = useCallback(() => {\n onCellMouseLeave?.(cell);\n }, [cell, onCellMouseLeave]);\n return (\n <g\n className={classNames(\"cell\", {\n active: targetIsActive(cell, activeTarget),\n faded: unrelated,\n \"read-only\": readOnly,\n \"container-active\": dragNodeToContainerActive,\n })}\n ref={gRef}\n transform={\n cell.type === \"edge\" || cell.view.x == null\n ? undefined\n : `translate(${containerRect!.x} ${containerRect!.y})`\n }\n onContextMenu={handleContextMenu}\n onClick={handleCellClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {isNodeCell(cell) ? (\n <NodeComponent\n node={cell}\n degraded={degraded}\n degradedNodeLabel={degradedNodeLabel}\n defaultNodeBricks={defaultNodeBricks}\n onResize={onNodeBrickResize}\n />\n ) : isEdgeCell(cell) ? (\n <EdgeComponent edge={cell} cells={cells} lineConfMap={lineConfMap} />\n ) : isDecoratorCell(cell) ? (\n <DecoratorComponent\n cell={cell}\n view={containerRect!}\n transform={transform}\n readOnly={readOnly}\n layout={layout}\n layoutOptions={layoutOptions}\n activeTarget={activeTarget}\n cells={cells}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n ) : null}\n </g>\n );\n}\n","import React, { useEffect, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type { ConnectLineState } from \"./interfaces\";\nimport type { PositionTuple, TransformLiteral } from \"../diagram/interfaces\";\n\nexport interface ConnectLineComponentProps {\n connectLineState: ConnectLineState | null;\n transform: TransformLiteral;\n markerEnd: string;\n onConnect(state: ConnectLineState, to: PositionTuple): void;\n}\n\nexport function ConnectLineComponent({\n connectLineState,\n transform,\n markerEnd,\n onConnect,\n}: ConnectLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n\n useEffect(() => {\n if (connectLineState) {\n setConnectLineTo(connectLineState.from);\n }\n }, [connectLineState]);\n\n useEffect(() => {\n if (connectLineState) {\n const onMouseMove = (e: MouseEvent) => {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo([\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ]);\n };\n const onMouseDown = (e: MouseEvent) => {\n e.stopPropagation();\n };\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n reset();\n onConnect(connectLineState, [\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ]);\n };\n const reset = () => {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mousedown\", onMouseDown, {\n capture: true,\n });\n document.removeEventListener(\"click\", onClick, { capture: true });\n setConnectLineTo(null);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mousedown\", onMouseDown, { capture: true });\n document.addEventListener(\"click\", onClick, { capture: true });\n\n return reset;\n }\n }, [connectLineState, onConnect, transform]);\n\n return (\n <path\n className={classNames(\"connect-line\", {\n connecting:\n !!connectLineState &&\n connectLineTo &&\n // Do not show when the distance of mouse move is less than 5px\n (connectLineTo[0] - connectLineState.from[0]) ** 2 +\n (connectLineTo[1] - connectLineState.from[1]) ** 2 >\n 25,\n })}\n d={\n connectLineState && connectLineTo\n ? `M${connectLineState.from.join(\" \")}L${connectLineTo.join(\" \")}`\n : \"\"\n }\n fill=\"none\"\n stroke=\"gray\"\n strokeWidth={1}\n markerEnd={`url(#${markerEnd})`}\n />\n );\n}\n","import React from \"react\";\nimport type {\n NodeCell,\n NodeConnectPoint,\n SmartConnectLineState,\n} from \"./interfaces\";\nimport type { NodePosition } from \"../diagram/interfaces\";\n\nexport interface HoverState {\n // Currently only support node cell\n cell: NodeCell;\n relativePoints: ReadonlyArray<NodeConnectPoint>;\n points: ReadonlyArray<NodePosition>;\n activePointIndex?: number;\n}\n\nexport const HoverStateContext = React.createContext<{\n rootRef: React.RefObject<SVGSVGElement>;\n smartConnectLineState: SmartConnectLineState | null;\n unsetHoverStateTimeoutRef: React.MutableRefObject<number | null>;\n hoverState: HoverState | null;\n setHoverState: React.Dispatch<React.SetStateAction<HoverState | null>>;\n setSmartConnectLineState: React.Dispatch<\n React.SetStateAction<SmartConnectLineState | null>\n >;\n onConnect?: (\n source: NodeCell,\n target: NodeCell,\n exitPosition: NodePosition,\n entryPosition: NodePosition\n ) => void;\n}>({\n rootRef: { current: null },\n smartConnectLineState: null,\n unsetHoverStateTimeoutRef: { current: null },\n hoverState: null,\n setHoverState: () => {},\n setSmartConnectLineState: () => {},\n});\n\nexport function useHoverStateContext() {\n return React.useContext(HoverStateContext);\n}\n","// istanbul ignore file: experimental\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport type { ActiveTarget, ConnectLineState, NodeCell } from \"./interfaces\";\nimport { targetIsActive } from \"./processors/targetIsActive\";\nimport type { NodePosition, TransformLiteral } from \"../diagram/interfaces\";\n\nconst HELPER_IMAGE =\n \"data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSI1cHgiIGhlaWdodD0iNXB4IiB2ZXJzaW9uPSIxLjEiPjxwYXRoIGQ9Im0gMCAwIEwgNSA1IE0gMCA1IEwgNSAwIiBzdHJva2Utd2lkdGg9IjIiIHN0eWxlPSJzdHJva2Utb3BhY2l0eTowLjQiIHN0cm9rZT0iI2ZmZmZmZiIvPjxwYXRoIGQ9Im0gMCAwIEwgNSA1IE0gMCA1IEwgNSAwIiBzdHJva2U9IiMyOWI2ZjIiLz48L3N2Zz4=\";\nconst HELPER_RADIUS = 5;\nconst HELPER_BG_RADIUS = 8;\nconst HALF_HELPER_RADIUS = HELPER_RADIUS / 2;\n\nexport interface LineConnectorComponentProps {\n activeTarget: ActiveTarget | null;\n transform: TransformLiteral;\n smartConnectLineState: ConnectLineState | null;\n disabled?: boolean;\n}\n\nexport function LineConnectorComponent({\n activeTarget,\n transform,\n smartConnectLineState,\n disabled,\n}: LineConnectorComponentProps): JSX.Element | null {\n const { unsetHoverStateTimeoutRef, hoverState, setHoverState } =\n useHoverStateContext();\n\n const unsetTimeout = useCallback(() => {\n if (unsetHoverStateTimeoutRef.current !== null) {\n clearTimeout(unsetHoverStateTimeoutRef.current);\n unsetHoverStateTimeoutRef.current = null;\n }\n }, [unsetHoverStateTimeoutRef]);\n\n const unsetActivePointIndex = useCallback(() => {\n unsetTimeout();\n setHoverState((prev) =>\n prev?.activePointIndex === undefined\n ? prev\n : { ...hoverState!, activePointIndex: undefined }\n );\n }, [hoverState, setHoverState, unsetTimeout]);\n\n const unsetHoverState = useCallback(() => {\n unsetHoverStateTimeoutRef.current = setTimeout(() => {\n setHoverState(null);\n }) as unknown as number;\n }, [setHoverState, unsetHoverStateTimeoutRef]);\n\n const available =\n !disabled &&\n hoverState &&\n (!!smartConnectLineState || !targetIsActive(hoverState.cell, activeTarget));\n\n const transformedPoints = useMemo(\n () =>\n available\n ? hoverState.points.map((p) => ({\n x: p.x * transform.k + transform.x,\n y: p.y * transform.k + transform.y,\n }))\n : null,\n [available, hoverState?.points, transform]\n );\n\n return (\n <g onMouseEnter={unsetActivePointIndex} onMouseLeave={unsetHoverState}>\n {available && (\n <>\n <rect\n x={hoverState.cell.view.x}\n y={hoverState.cell.view.y}\n width={hoverState.cell.view.width}\n height={hoverState.cell.view.height}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={HELPER_BG_RADIUS * 2}\n pointerEvents=\"stroke\"\n />\n <rect\n x={hoverState.cell.view.x}\n y={hoverState.cell.view.y}\n width={hoverState.cell.view.width}\n height={hoverState.cell.view.height}\n fill=\"none\"\n stroke=\"transparent\"\n />\n {hoverState?.activePointIndex !== undefined && (\n <circle\n cx={transformedPoints![hoverState.activePointIndex].x}\n cy={transformedPoints![hoverState.activePointIndex].y}\n r={HELPER_BG_RADIUS}\n fill=\"lightgreen\"\n fillOpacity={0.5}\n pointerEvents=\"none\"\n />\n )}\n {transformedPoints!.map((point, index) => (\n <ConnectPointComponent\n key={index}\n index={index}\n point={point}\n unsetTimeout={unsetTimeout}\n unsetActivePointIndex={unsetActivePointIndex}\n />\n ))}\n </>\n )}\n </g>\n );\n}\n\ninterface ConnectPointComponentProps {\n index: number;\n point: NodePosition;\n unsetTimeout: () => void;\n unsetActivePointIndex: () => void;\n}\n\nfunction ConnectPointComponent({\n index,\n point,\n unsetTimeout,\n unsetActivePointIndex,\n}: ConnectPointComponentProps): JSX.Element {\n const {\n rootRef,\n smartConnectLineState,\n hoverState,\n setHoverState,\n setSmartConnectLineState,\n onConnect,\n } = useHoverStateContext();\n const ref = useRef<SVGGElement>(null);\n\n useEffect(() => {\n const handleMouseEnter = () => {\n unsetTimeout();\n setHoverState({ ...hoverState!, activePointIndex: index });\n };\n const g = ref.current;\n g?.addEventListener(\"mouseenter\", handleMouseEnter);\n return () => {\n g?.removeEventListener(\"mouseenter\", handleMouseEnter);\n };\n }, [hoverState, index, setHoverState, unsetTimeout]);\n\n useEffect(() => {\n const handleMouseDown = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n const rect = rootRef.current!.getBoundingClientRect();\n const originalPoint = hoverState!.points[index];\n // console.log(\"connect\", originalPoint, rect);\n setSmartConnectLineState({\n source: hoverState!.cell as NodeCell,\n from: [originalPoint.x, originalPoint.y],\n offset: [rect.left, rect.top],\n exitPosition: hoverState!.relativePoints[index],\n });\n };\n const g = ref.current;\n g?.addEventListener(\"mousedown\", handleMouseDown);\n return () => {\n g?.removeEventListener(\"mousedown\", handleMouseDown);\n };\n }, [hoverState, index, rootRef, setSmartConnectLineState]);\n\n useEffect(() => {\n const handleMouseUp = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (smartConnectLineState) {\n if (smartConnectLineState.source !== hoverState?.cell) {\n onConnect?.(\n smartConnectLineState.source,\n hoverState!.cell,\n smartConnectLineState.exitPosition,\n hoverState!.relativePoints[hoverState!.activePointIndex!]\n );\n }\n setSmartConnectLineState(null);\n }\n };\n const g = ref.current;\n g?.addEventListener(\"mouseup\", handleMouseUp);\n return () => {\n g?.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [smartConnectLineState, hoverState, onConnect, setSmartConnectLineState]);\n\n useEffect(() => {\n const g = ref.current;\n g?.addEventListener(\"mouseleave\", unsetActivePointIndex);\n return () => {\n g?.removeEventListener(\"mouseleave\", unsetActivePointIndex);\n };\n }, [unsetActivePointIndex]);\n\n return (\n <g ref={ref}>\n <circle\n cx={point.x}\n cy={point.y}\n r={HELPER_BG_RADIUS}\n fill=\"transparent\"\n />\n <image\n x={point.x - HALF_HELPER_RADIUS}\n y={point.y - HALF_HELPER_RADIUS}\n width={HELPER_RADIUS}\n height={HELPER_RADIUS}\n xlinkHref={HELPER_IMAGE}\n preserveAspectRatio=\"none\"\n />\n </g>\n );\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n ComputedLineConnecterConf,\n SmartConnectLineState,\n} from \"./interfaces\";\nimport type { PositionTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport { getConnectLinePoints } from \"../shared/canvas/processors/getConnectLinePoints\";\n\nexport interface SmartConnectLineComponentProps {\n smartConnectLineState: SmartConnectLineState | null;\n transform: TransformLiteral;\n options: ComputedLineConnecterConf;\n}\n\nexport function SmartConnectLineComponent({\n smartConnectLineState,\n transform,\n options,\n}: SmartConnectLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n const { hoverState, setSmartConnectLineState } = useHoverStateContext();\n\n useEffect(() => {\n if (!smartConnectLineState) {\n return;\n }\n function onMouseMove(e: MouseEvent) {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo([\n (e.clientX - transform.x - smartConnectLineState!.offset[0]) /\n transform.k,\n (e.clientY - transform.y - smartConnectLineState!.offset[1]) /\n transform.k,\n ]);\n }\n function onMouseUp(e: MouseEvent) {\n e.preventDefault();\n reset();\n }\n function reset() {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n setConnectLineTo(null);\n setSmartConnectLineState(null);\n }\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n\n return reset;\n }, [setSmartConnectLineState, smartConnectLineState, transform]);\n\n const line = useMemo(() => {\n const fixedLineType = options.type === \"auto\" ? \"polyline\" : options.type;\n const points = getConnectLinePoints(\n smartConnectLineState,\n connectLineTo,\n hoverState\n );\n return curveLine(\n points,\n fixedLineType === \"curve\" ? options.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [connectLineTo, hoverState, smartConnectLineState, options]);\n\n return (\n <path\n className={classNames(\"connect-line\", {\n connecting: !!(smartConnectLineState && connectLineTo),\n })}\n d={line}\n fill=\"none\"\n stroke={options.strokeColor}\n strokeWidth={options.strokeWidth}\n markerStart={options.showStartArrow ? options.$markerUrl : \"\"}\n markerEnd={options.showEndArrow ? options.$markerUrl : \"\"}\n />\n );\n}\n","import type { NodePosition, PositionTuple } from \"../../../diagram/interfaces\";\nimport type { HoverState } from \"../../../draw-canvas/HoverStateContext\";\nimport type { SmartConnectLineState } from \"../../../draw-canvas/interfaces\";\nimport { getSmartLinePoints } from \"./getSmartLinePoints\";\n\nexport function getConnectLinePoints(\n smartConnectLineState: SmartConnectLineState | null,\n connectLineTo: PositionTuple | null,\n hoverState: HoverState | null\n): NodePosition[] | null {\n if (\n !smartConnectLineState ||\n !(connectLineTo || hoverState?.activePointIndex !== undefined)\n ) {\n return null;\n }\n\n const sourceView = smartConnectLineState.source.view;\n if (hoverState?.activePointIndex !== undefined) {\n return getSmartLinePoints(sourceView, hoverState.cell.view, {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: hoverState.relativePoints[hoverState.activePointIndex!],\n });\n }\n\n const [x1, y1] = connectLineTo!;\n if (y1 < sourceView.y) {\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: { x: 0.5, y: 1 },\n }\n );\n }\n\n if (y1 > sourceView.y + sourceView.height) {\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: { x: 0.5, y: 0 },\n }\n );\n }\n\n if (x1 < sourceView.x) {\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: { x: 1, y: 0.5 },\n }\n );\n }\n\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: { x: 0, y: 0.5 },\n }\n );\n}\n","export const SYMBOL_FOR_SIZE_INITIALIZED = Symbol.for(\"size-initialized\");\nexport const SYMBOL_FOR_LAYOUT_INITIALIZED = Symbol.for(\"layout-initialized\");\nexport const DEFAULT_NODE_SIZE = 20;\nexport const DEFAULT_NODE_GAP = 36;\nexport const DEFAULT_AREA_WIDTH = 180;\nexport const DEFAULT_AREA_HEIGHT = 120;\nexport const DEFAULT_SCALE_RANGE_MIN = 0.5;\nexport const DEFAULT_SCALE_RANGE_MAX = 2;\nexport const DEFAULT_LINE_STROKE_COLOR = \"gray\";\nexport const DEFAULT_LINE_STROKE_WIDTH = 1;\nexport const DEFAULT_LINE_INTERACT_STROKE_WIDTH = 15;\nexport const DEFAULT_LINE_INTERACT_SHOW_START_ARROW = false;\nexport const DEFAULT_LINE_INTERACT_SHOW_END_ARROW = true;\nexport const DEFAULT_LINE_INTERACT_ANIMATE_DURATION = 1;\nexport const DEFAULT_DEGRADED_THRESHOLD = 500;\nexport const DEFAULT_SNAP_GRID_SIZE = 10;\nexport const DEFAULT_SNAP_OBJECT_DISTANCE = 5;\n","import type {\n Cell,\n DecoratorCell,\n EdgeCell,\n InitialCell,\n InitialNodeCell,\n LayoutType,\n NodeCell,\n} from \"../interfaces\";\nimport { MoveCellPayload } from \"../reducers/interfaces\";\n\nexport function isNodeCell(cell: Cell | MoveCellPayload): cell is NodeCell {\n return cell.type === \"node\";\n}\n\nexport function isDecoratorCell(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\";\n}\n\nexport function isInitialNodeCell(cell: InitialCell): cell is InitialNodeCell {\n return cell.type === \"node\";\n}\n\nexport function isEdgeCell(cell: Cell): cell is EdgeCell {\n return cell.type === \"edge\";\n}\n\nexport function isNodeOrEdgeCell(cell: Cell): cell is NodeCell | EdgeCell {\n return cell.type === \"node\" || cell.type === \"edge\";\n}\n\nexport function isNodeOrAreaDecoratorCell(\n cell: Cell\n): cell is NodeCell | DecoratorCell {\n return (\n cell.type === \"node\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n}\nexport function isNodeOrTextDecoratorCell(\n cell: Cell | MoveCellPayload\n): cell is NodeCell | DecoratorCell {\n return (\n cell.type === \"node\" ||\n (cell.type === \"decorator\" && cell.decorator === \"text\")\n );\n}\n\nexport function isTextDecoratorCell(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\" && cell.decorator === \"text\";\n}\nexport function isContainerDecoratorCell(\n cell: Cell | MoveCellPayload\n): cell is DecoratorCell {\n return cell.type === \"decorator\" && cell.decorator === \"container\";\n}\n\nexport function isNoManualLayout(layout: LayoutType) {\n return ![\"manual\", undefined].includes(layout!);\n}\n","import { pick } from \"lodash\";\nimport type { ActiveTargetOfSingular, Cell } from \"../interfaces\";\n\nexport function cellToTarget(cell: Cell): ActiveTargetOfSingular {\n return cell.type === \"edge\"\n ? pick(cell, [\"type\", \"source\", \"target\", \"data\"])\n : pick(cell, [\"type\", \"id\", \"data\"]);\n}\n","import type { ActiveTarget, Cell, ConnectLineState } from \"../interfaces\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport function getUnrelatedCells(\n cells: Cell[],\n connectLineState: ConnectLineState | null,\n activeTarget: ActiveTarget | null,\n allowEdgeToArea?: boolean\n): Cell[] {\n const unrelated: Cell[] = [];\n if (connectLineState) {\n const existedTargets = new Set<string>();\n for (const cell of cells) {\n if (cell.type === \"edge\" && cell.source === connectLineState.source.id) {\n existedTargets.add(cell.target);\n }\n }\n for (const cell of cells) {\n switch (cell.type) {\n case \"node\":\n if (existedTargets.has(cell.id)) {\n unrelated.push(cell);\n }\n break;\n case \"decorator\":\n if (\n !allowEdgeToArea ||\n cell.decorator == \"text\" ||\n existedTargets.has(cell.id)\n ) {\n unrelated.push(cell);\n }\n break;\n default:\n unrelated.push(cell);\n }\n }\n } else {\n switch (activeTarget?.type) {\n case \"multi\": {\n const nodesMap = new Map<string, Cell>();\n const activeNodeIds = new Set<string>();\n const relatedNodeIds = new Set<string>();\n for (const active of activeTarget.targets) {\n if (active.type === \"node\") {\n activeNodeIds.add(active.id);\n relatedNodeIds.add(active.id);\n }\n }\n for (const cell of cells) {\n if (cell.type === \"node\") {\n nodesMap.set(cell.id, cell);\n } else if (cell.type === \"edge\") {\n if (activeNodeIds.has(cell.source)) {\n relatedNodeIds.add(cell.target);\n } else if (activeNodeIds.has(cell.target)) {\n relatedNodeIds.add(cell.source);\n } else if (!targetIsActive(cell, activeTarget)) {\n unrelated.push(cell);\n }\n } else if (!targetIsActive(cell, activeTarget)) {\n unrelated.push(cell);\n }\n }\n for (const [id, cell] of nodesMap) {\n if (!relatedNodeIds.has(id)) {\n unrelated.push(cell);\n }\n }\n break;\n }\n\n case \"node\": {\n const nodesMap = new Map<string, Cell>();\n const relatedNodeIds = new Set<string>([activeTarget.id]);\n for (const cell of cells) {\n if (cell.type === \"node\") {\n nodesMap.set(cell.id, cell);\n } else if (cell.type === \"edge\") {\n if (cell.source === activeTarget.id) {\n relatedNodeIds.add(cell.target);\n } else if (cell.target === activeTarget.id) {\n relatedNodeIds.add(cell.source);\n } else {\n unrelated.push(cell);\n }\n } else {\n unrelated.push(cell);\n }\n }\n for (const [id, cell] of nodesMap) {\n if (!relatedNodeIds.has(id)) {\n unrelated.push(cell);\n }\n }\n break;\n }\n\n case \"edge\":\n for (const cell of cells) {\n if (\n !(cell.type === \"edge\"\n ? targetIsActive(cell, activeTarget)\n : cell.type === \"node\" &&\n (cell.id === activeTarget.source ||\n cell.id === activeTarget.target))\n ) {\n unrelated.push(cell);\n }\n }\n break;\n }\n }\n\n return unrelated;\n}\n","import type { ActiveTarget, Cell } from \"../interfaces\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport type KeyboardAction = KeyboardActionDeleteCells;\n\nexport interface KeyboardActionDeleteCells {\n action: \"delete-cells\";\n cells: Cell[];\n}\n\nexport function handleKeyboard(\n event: KeyboardEvent,\n {\n cells,\n activeTarget,\n }: {\n cells: Cell[];\n activeTarget: ActiveTarget | null | undefined;\n }\n): KeyboardAction | undefined {\n const activeCells = cells.filter((cell) =>\n targetIsActive(cell, activeTarget)\n );\n\n if (activeCells.length === 0) {\n return;\n }\n\n const key =\n event.key ||\n /* istanbul ignore next: compatibility */ event.keyCode ||\n /* istanbul ignore next: compatibility */ event.which;\n\n switch (key) {\n case \"Backspace\":\n case 8:\n case \"Delete\":\n case 46: {\n event.preventDefault();\n event.stopPropagation();\n return {\n action: \"delete-cells\",\n cells: activeCells,\n };\n }\n }\n}\n","import type { PositionTuple, TransformLiteral } from \"../../diagram/interfaces\";\nimport type { NodeView } from \"../interfaces\";\n\nexport interface HandleLassoOptions {\n transform: TransformLiteral;\n offset: PositionTuple;\n onLassoing(rect: NodeView): void;\n onLassoed(rect: NodeView): void;\n}\n\nexport function handleLasso(\n event: MouseEvent,\n { transform, offset, onLassoing, onLassoed }: HandleLassoOptions\n) {\n if (event.ctrlKey || event.button) {\n return;\n }\n\n event.stopPropagation();\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const x0 = (event.clientX - offset[0] - transform.x) / transform.k;\n const y0 = (event.clientY - offset[1] - transform.y) / transform.k;\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [\n (e.clientX - from[0]) / transform.k,\n (e.clientY - from[1]) / transform.k,\n ];\n }\n\n let moved = false;\n\n const handleMove = (e: MouseEvent, finished?: boolean) => {\n // Respect the scale\n const movement = getMovement(e);\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n if (moved) {\n let [width, height] = movement;\n let x = x0;\n let y = y0;\n if (width < 0) {\n x = x0 + width;\n width = -width;\n }\n if (height < 0) {\n y = y0 + height;\n height = -height;\n }\n (finished ? onLassoed : onLassoing)({\n x,\n y,\n width,\n height,\n });\n }\n };\n\n const onMouseMove = (e: MouseEvent) => {\n handleMove(e);\n };\n const onMouseUp = (e: MouseEvent) => {\n handleMove(e, true);\n moved = false;\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n}\n","import { Cell, DecoratorCell, NodeCell } from \"../interfaces\";\nimport { MoveCellPayload } from \"../reducers/interfaces\";\nimport { isContainerDecoratorCell, isNodeCell } from \"./asserts\";\n\nexport function handleNodeContainedChange(\n payloads: MoveCellPayload[],\n cells: Cell[],\n onContainerContainerChange?: (detail: MoveCellPayload[]) => void\n) {\n const nodeCells = cells.filter((c): c is NodeCell => isNodeCell(c));\n const containerIds = payloads\n .filter((p) => isContainerDecoratorCell(p))\n .map((v) => v.id);\n const nodePayloads = payloads.filter((p) => {\n const nodeCell = nodeCells.find((v) => v.id === p.id)!;\n const includeNodeFlag =\n nodeCell?.containerId && containerIds.includes(nodeCell.containerId);\n return isNodeCell(p) && !includeNodeFlag;\n });\n nodePayloads.forEach((payload) => {\n const left = payload.x;\n const right = payload.x + payload.width!;\n const top = payload.y;\n const bottom = payload.y + payload!.height!;\n const containerDecoratorCells = cells.filter(\n (cell): cell is DecoratorCell => isContainerDecoratorCell(cell)\n );\n for (const containerCell of containerDecoratorCells) {\n const containerLeft = containerCell.view.x;\n const containerRight = containerCell.view.x + containerCell.view.width;\n const containerTop = containerCell.view.y;\n const containerBottom = containerCell.view.y + containerCell.view.height;\n if (\n left >= containerLeft &&\n right <= containerRight &&\n top >= containerTop &&\n bottom <= containerBottom\n ) {\n payload.containerCell = containerCell;\n break; //A node can be associated with only one container\n }\n }\n });\n let containedChanges = [];\n containedChanges = nodePayloads.filter((payload) => {\n const nodeCell = nodeCells.find((c) => c.id === payload.id);\n const containerId = nodeCell?.containerId;\n const containerCellId = payload.containerCell?.id;\n //过滤掉一直没有combo关系或者combo关系没有改变的\n return containerId !== containerCellId;\n });\n if (containedChanges.length > 0) {\n onContainerContainerChange?.(containedChanges);\n }\n return containedChanges;\n}\n","import type { SizeTuple } from \"../../diagram/interfaces\";\nimport type { Cell, InitialCell, NodeCell } from \"../interfaces\";\nimport { isInitialNodeCell } from \"./asserts\";\n\nexport function initializeCells(\n initialCells: InitialCell[] | undefined,\n {\n defaultNodeSize,\n }: {\n defaultNodeSize: SizeTuple;\n }\n): Cell[] {\n const originalCells = initialCells ?? [];\n const finalCells: Cell[] = originalCells.map<Cell>((cell) => {\n if (\n !isInitialNodeCell(cell) ||\n (cell.view?.width !== undefined && cell.view?.height !== undefined)\n ) {\n return cell as NodeCell;\n }\n return {\n ...cell,\n view: {\n width: defaultNodeSize[0],\n height: defaultNodeSize[1],\n ...cell.view,\n },\n } as NodeCell;\n });\n return finalCells;\n}\n","import type {\n ActiveTarget,\n ActiveTargetOfEdge,\n ActiveTargetOfMulti,\n ActiveTargetOfNode,\n} from \"../interfaces\";\n\nexport function sameTarget(\n a: ActiveTarget | null | undefined,\n b: ActiveTarget | null | undefined\n): boolean {\n return a\n ? !!b &&\n a.type === b.type &&\n (a.type === \"multi\"\n ? a.targets.length === (b as ActiveTargetOfMulti).targets.length &&\n a.targets.every((targetA) =>\n (b as ActiveTargetOfMulti).targets.some((targetB) =>\n sameTarget(targetA, targetB)\n )\n )\n : a.type === \"node\" || a.type === \"decorator\"\n ? a.id === (b as ActiveTargetOfNode).id\n : a.source === (b as ActiveTargetOfEdge).source &&\n a.target === (b as ActiveTargetOfEdge).target)\n : !b;\n}\n","import type { ActiveTarget, ActiveTargetOfSingular } from \"../interfaces\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function targetIsActive(\n target: ActiveTargetOfSingular,\n activeTarget: ActiveTarget | null | undefined\n): boolean {\n return (\n !!activeTarget &&\n (activeTarget.type === \"multi\"\n ? activeTarget.targets\n : [activeTarget]\n ).some((active) => sameTarget(active, target))\n );\n}\n","import type { TransformLiteral } from \"../../diagram/interfaces\";\nimport type { Cell } from \"../interfaces\";\nimport { isEdgeCell } from \"./asserts\";\n\nexport interface TransformToCenterOptions {\n canvasWidth: number;\n canvasHeight: number;\n scaleRange?: [min: number, max: number];\n}\n\nexport function transformToCenter(\n cells: Cell[],\n { canvasWidth, canvasHeight, scaleRange }: TransformToCenterOptions\n): TransformLiteral {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n let empty = true;\n for (const cell of cells) {\n if (!isEdgeCell(cell)) {\n empty = false;\n const { view } = cell;\n const r = view.x + view.width;\n const b = view.y + view.height;\n if (view.x < left) {\n left = view.x;\n }\n if (r > right) {\n right = r;\n }\n if (view.y < top) {\n top = view.y;\n }\n if (b > bottom) {\n bottom = b;\n }\n }\n }\n\n const width = right - left;\n const height = bottom - top;\n\n const scale =\n scaleRange && !empty && (width > canvasWidth || height > canvasHeight)\n ? Math.max(\n Math.min(canvasWidth / width, canvasHeight / height, scaleRange[1]),\n scaleRange[0]\n )\n : 1;\n\n const x = empty ? 0 : (canvasWidth - width * scale) / 2 - left * scale;\n const y = empty ? 0 : (canvasHeight - height * scale) / 2 - top * scale;\n\n return { x, y, k: scale };\n}\n","import { without } from \"lodash\";\nimport type {\n RangeTuple,\n SizeTuple,\n TransformLiteral,\n} from \"../../diagram/interfaces\";\nimport { DEFAULT_NODE_GAP, SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\nimport type {\n Cell,\n InitialCell,\n LayoutType,\n NodeCell,\n NodeId,\n NodeView,\n} from \"../interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } from \"./asserts\";\nimport { initializeCells } from \"./initializeCells\";\nimport { transformToCenter } from \"./transformToCenter\";\nimport { forceLayout } from \"../../shared/canvas/forceLayout\";\nimport { dagreLayout } from \"../../shared/canvas/dagreLayout\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function updateCells({\n cells,\n layout,\n previousCells,\n defaultNodeSize,\n canvasWidth,\n canvasHeight,\n scaleRange,\n transform,\n reason,\n parent,\n allowEdgeToArea,\n}: {\n cells: InitialCell[] | undefined;\n layout?: LayoutType;\n previousCells: Cell[];\n defaultNodeSize: SizeTuple;\n canvasWidth: number;\n canvasHeight: number;\n scaleRange: RangeTuple;\n transform: TransformLiteral;\n reason?: \"add-related-nodes\";\n parent?: NodeId;\n allowEdgeToArea?: boolean;\n}): {\n cells: Cell[];\n updated: Cell[];\n shouldReCenter: boolean;\n} {\n const isManualLayout = layout !== \"force\" && layout !== \"dagre\";\n const newCells = initializeCells(cells, { defaultNodeSize });\n const updateCandidates: NodeCell[] = [];\n let shouldReCenter = false;\n\n const previousSizeInitializedNodes = new Map<string, NodeCell>();\n let previousShouldCentered = false;\n for (const cell of previousCells) {\n if (isDecoratorCell(cell)) {\n previousShouldCentered = true;\n } else if (isNodeCell(cell)) {\n previousShouldCentered = true;\n if (cell[SYMBOL_FOR_SIZE_INITIALIZED]) {\n previousSizeInitializedNodes.set(cell.id, cell);\n }\n }\n }\n\n const nodesMap = new Map<string, NodeCell>();\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n nodesMap.set(cell.id, cell);\n const previousNode = previousSizeInitializedNodes.get(cell.id);\n if (previousNode) {\n cell.view.width = previousNode.view.width;\n cell.view.height = previousNode.view.height;\n cell[SYMBOL_FOR_SIZE_INITIALIZED] = true;\n }\n }\n }\n\n let handled = false;\n\n if (reason === \"add-related-nodes\" && parent) {\n // Place these unpositioned downstream nodes below the parent node, and\n // on the right side of the positioned siblings.\n const downstreamNodeIds = new Set<string>();\n for (const cell of newCells) {\n if (\n isEdgeCell(cell) &&\n cell.source === parent &&\n cell.target !== parent\n ) {\n downstreamNodeIds.add(cell.target);\n }\n }\n const parentNode = nodesMap.get(parent);\n if (parentNode?.view.x !== undefined && parentNode.view.y !== undefined) {\n handled = true;\n /**\n * 临时解决一次性添加多层的节点手工布局报错\n */\n if (isManualLayout) {\n for (const cell of newCells) {\n if (\n (isNodeCell(cell) && cell.view.x === undefined) ||\n (isNodeCell(cell) && cell.view.y === undefined)\n ) {\n downstreamNodeIds.add(cell.id);\n }\n }\n }\n const downstreamNodes = [...downstreamNodeIds]\n .map((id) => nodesMap.get(id))\n .filter(Boolean) as NodeCell[];\n let rightMostNode: NodeCell | undefined = undefined;\n for (const node of downstreamNodes) {\n if (node.view.x !== undefined && node.view.y !== undefined) {\n // Find the rightmost node that is below the parent node.\n if (\n (!rightMostNode || node.view.x > rightMostNode.view.x) &&\n node.view.y > parentNode.view.y\n ) {\n rightMostNode = node;\n }\n } else {\n // Unpositioned nodes\n updateCandidates.push(node);\n }\n }\n if (updateCandidates.length > 0 && isManualLayout) {\n let nextX: number;\n let nextY: number;\n if (rightMostNode) {\n // Place unpositioned nodes on the right side of the rightmost positioned siblings.\n nextX =\n rightMostNode.view.x + rightMostNode.view.width + DEFAULT_NODE_GAP;\n nextY = rightMostNode.view.y;\n } else {\n // If there are no positioned siblings, just place them below the parent.\n const totalWidth = updateCandidates.reduce(\n (acc, node) => acc + node.view.width + DEFAULT_NODE_GAP,\n -DEFAULT_NODE_GAP\n );\n nextX =\n parentNode.view.x - totalWidth / 2 + parentNode.view.width / 2;\n nextY = parentNode.view.y + parentNode.view.height + DEFAULT_NODE_GAP;\n }\n for (const node of updateCandidates) {\n node.view.x = nextX;\n node.view.y = nextY;\n nextX += node.view.width + DEFAULT_NODE_GAP;\n }\n }\n }\n }\n\n if (!handled) {\n // By default, place unpositioned nodes in a grid.\n let maxWidth = defaultNodeSize[0];\n let maxHeight = defaultNodeSize[1];\n const positionedNodes: NodeCell[] = [];\n let hasDecorators = false;\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n if (cell.view.width > maxWidth) {\n maxWidth = cell.view.width;\n }\n if (cell.view.height > maxHeight) {\n maxHeight = cell.view.height;\n }\n if (cell.view.x === undefined || cell.view.y === undefined) {\n updateCandidates.push(cell);\n } else {\n positionedNodes.push(cell);\n }\n } else if (isDecoratorCell(cell)) {\n hasDecorators = true;\n }\n }\n\n if (isManualLayout) {\n if (!previousShouldCentered) {\n // If the previous cells are not centered, use the centered transform instead.\n transform = transformToCenter(without(newCells, ...updateCandidates), {\n canvasWidth,\n canvasHeight,\n scaleRange,\n });\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n\n // If there is no positioned nodes, or only one while without decorators,\n // then there is no relative positions, we can place the nodes with dagre layout.\n // Otherwise, use the force layout.\n if (\n positionedNodes.length === 0 ||\n (positionedNodes.length === 1 && !hasDecorators)\n ) {\n // The positioned node (if exists) will be updated.\n updateCandidates.push(...positionedNodes);\n ({ getNodeView } = dagreLayout({ cells: newCells, allowEdgeToArea }));\n // Only re-center when there is no cells previous,\n // or the cell ids are not changed (this happens when updateCells called by backend right after dropNode).\n shouldReCenter =\n previousCells.length === 0 ||\n (previousCells.length === newCells.length &&\n previousCells.every((cell, index) =>\n sameTarget(cell, newCells[index])\n ));\n } else {\n ({ getNodeView } = forceLayout({\n cells: newCells,\n fixedPosition: true,\n allowEdgeToArea,\n center: [\n (canvasWidth / 2 - transform.x) / transform.k,\n (canvasHeight / 2 - transform.y) / transform.k,\n ],\n }));\n }\n\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n const view = getNodeView(cell.id);\n cell.view.x = view.x;\n cell.view.y = view.y;\n }\n }\n }\n }\n\n return { cells: newCells, updated: updateCandidates, shouldReCenter };\n}\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\nimport type { Cell, NodeCell } from \"../interfaces\";\nimport { isNodeCell } from \"../processors/asserts\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\n\nexport const cells: Reducer<Cell[], DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"drop-node\":\n return insertCellAfter(\n state,\n action.payload,\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n );\n case \"drop-decorator\": {\n if (action.payload.decorator === \"text\") {\n return [...state, action.payload];\n }\n return insertCellAfter(\n state,\n action.payload,\n (cell) => cell.type === \"decorator\" && cell.decorator === \"area\"\n );\n }\n case \"add-nodes\": {\n const index =\n state.findLastIndex(\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n ) + 1;\n return [\n ...state.slice(0, index),\n ...action.payload,\n ...state.slice(index),\n ];\n }\n case \"add-edge\":\n // Add the edge to just next to the previous last edge or area decorator.\n // If not found, append to the start.\n return insertCellAfter(\n state,\n action.payload,\n (cell) =>\n cell.type === \"edge\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n case \"move-cells\": {\n let matched = false;\n const newState = state.map((cell) => {\n const newCell = action.payload.find(\n (move) => cell.type === move.type && cell.id === move.id\n );\n if (newCell) {\n matched = true;\n return {\n ...(cell as NodeCell),\n view: { ...(cell as NodeCell).view, x: newCell.x, y: newCell.y },\n };\n }\n return cell;\n });\n return matched ? newState : state;\n }\n case \"resize-cell\": {\n const { type, id, width, height } = action.payload;\n const index = state.findIndex(\n (cell) => cell.type === type && cell.id === id\n );\n if (index !== -1) {\n const node = state[index] as NodeCell;\n return [\n ...state.slice(0, index),\n { ...node, view: { ...node.view, width, height } },\n ...state.slice(index + 1),\n ];\n }\n return state;\n }\n case \"update-cells\":\n return action.payload;\n case \"update-node-size\":\n return state.map((cell) =>\n isNodeCell(cell) && cell.id === action.payload.id\n ? {\n ...cell,\n [SYMBOL_FOR_SIZE_INITIALIZED]: true,\n view: action.payload.size\n ? {\n ...cell.view,\n width: action.payload.size[0],\n height: action.payload.size[1],\n }\n : cell.view,\n }\n : cell\n );\n }\n return state;\n};\n\nfunction insertCellAfter(\n cells: Cell[],\n newCell: Cell,\n after: (cell: Cell) => boolean\n) {\n const index = cells.findLastIndex(after) + 1;\n return [...cells.slice(0, index), newCell, ...cells.slice(index)];\n}\n","import { Reducer } from \"react\";\nimport type { DrawCanvasAction, DrawCanvasState } from \"./interfaces\";\nimport { cells } from \"./cells\";\nimport { layoutKey } from \"./layoutKey\";\n\ntype ReducersMapObject<S, A> = {\n [K in keyof S]: Reducer<S[K], A>;\n};\n\nfunction combineReducers<S, A>(\n reducers: ReducersMapObject<S, A>\n): Reducer<S, A> {\n return ((state, action) =>\n Object.fromEntries(\n Object.entries<Reducer<any, A>>(reducers).map(([key, value]) => [\n key,\n value(state[key as keyof S], action),\n ])\n )) as Reducer<S, A>;\n}\n\nexport const rootReducer = combineReducers<DrawCanvasState, DrawCanvasAction>({\n cells,\n layoutKey,\n});\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\n\nexport const layoutKey: Reducer<number, DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"update-node-size\":\n return action.layoutKey;\n default:\n return state;\n }\n};\n","import * as React from \"react\";\nconst SvgCenter = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={24} height={24} viewBox=\"0 0 24 24\" {...props}><path d=\"M12 0a.5.5 0 0 1 .5.5v2.013a9.5 9.5 0 0 1 8.987 8.988L23.5 11.5a.5.5 0 0 1 0 1h-2.013a9.5 9.5 0 0 1-8.987 8.987V23.5a.5.5 0 0 1-1 0v-2.013A9.5 9.5 0 0 1 2.514 12.5H.5a.5.5 0 0 1 0-1h2.013A9.5 9.5 0 0 1 11.5 2.514V.5A.5.5 0 0 1 12 0M3.514 11.5H7.5a.5.5 0 0 1 0 1H3.514a8.5 8.5 0 0 0 7.987 7.986L11.5 16.5a.5.5 0 0 1 1 0v3.986a8.5 8.5 0 0 0 7.986-7.986H16.5a.5.5 0 0 1 0-1h3.986A8.5 8.5 0 0 0 12.5 3.515V7.5a.5.5 0 0 1-1 0V3.514a8.5 8.5 0 0 0-7.986 7.987zm8.486-1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3\" /></svg>;\nexport default SvgCenter;","import * as React from \"react\";\nconst SvgZoomIn = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4h-204.8V281.6a25.6 25.6 0 1 0-51.2 0v204.8h-204.8a25.6 25.6 0 0 0 0 51.2h204.8v204.8a25.6 25.6 0 0 0 51.2 0V537.6h204.8a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomIn;","import * as React from \"react\";\nconst SvgZoomOut = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4H280.064a25.6 25.6 0 1 0 0 51.2h464.384a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomOut;","import React, { useCallback, useMemo, useRef } from \"react\";\nimport { ConfigProvider, Slider, theme } from \"antd\";\nimport { StyleProvider, createCache } from \"@ant-design/cssinjs\";\nimport { useCurrentTheme } from \"@next-core/react-runtime\";\nimport type { RangeTuple } from \"../../diagram/interfaces\";\nimport CenterSVG from \"./icons/center.svg\";\nimport ZoomInSVG from \"./icons/zoom-in.svg\";\nimport ZoomOutSVG from \"./icons/zoom-out.svg\";\n\nexport interface ZoomBarComponentProps {\n shadowRoot: ShadowRoot;\n scale: number;\n scaleRange: RangeTuple;\n onZoomChange(value: number): void;\n onReCenter(): void;\n}\n\nexport function ZoomBarComponent({\n shadowRoot,\n scale,\n scaleRange,\n onZoomChange,\n onReCenter,\n}: ZoomBarComponentProps): JSX.Element | null {\n const currentTheme = useCurrentTheme();\n const cache = useMemo(() => createCache(), []);\n const zoomBarRef = useRef<HTMLDivElement | null>(null);\n const min = scaleRange[0] * 100;\n const max = scaleRange[1] * 100;\n const value = scale * 100;\n const step = 5;\n\n const tooltip = useMemo(() => {\n return {\n formatter: (value: number | undefined) => `${value}%`,\n placement: \"left\" as const,\n getPopupContainer: () => zoomBarRef.current!,\n };\n }, []);\n\n const onZoomIn = useCallback(() => {\n onZoomChange(Math.min(value + step, max));\n }, [max, onZoomChange, value]);\n\n const onZoomOut = useCallback(() => {\n onZoomChange(Math.max(value - step, min));\n }, [min, onZoomChange, value]);\n\n return (\n <ConfigProvider\n theme={{\n algorithm:\n currentTheme === \"dark-v2\"\n ? theme.darkAlgorithm\n : theme.defaultAlgorithm,\n }}\n >\n <StyleProvider\n container={shadowRoot}\n // Auto clear injected styles after unmount\n autoClear\n cache={cache}\n // Set hashPriority to \"high\" to disable `:where()` usage for compatibility\n hashPriority=\"high\"\n >\n <div className=\"zoom-bar\" ref={zoomBarRef}>\n <div className=\"center-button\" onClick={onReCenter} role=\"button\">\n <CenterSVG />\n </div>\n <div className=\"zoom-slider\">\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomIn}>\n <ZoomInSVG />\n </div>\n <Slider\n min={min}\n max={max}\n value={value}\n step={step}\n vertical\n included={false}\n tooltip={tooltip}\n onChange={onZoomChange}\n />\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomOut}>\n <ZoomOutSVG />\n </div>\n </div>\n </div>\n </StyleProvider>\n </ConfigProvider>\n );\n}\n","import { pick } from \"lodash\";\nimport dagre from \"@dagrejs/dagre\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type {\n Cell,\n ForceNode,\n LayoutOptionsDagre,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport {\n isEdgeCell,\n isNodeCell,\n isNodeOrAreaDecoratorCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport type { FullRectTuple } from \"../../diagram/interfaces\";\n\nexport interface DagreLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsDagre;\n allowEdgeToArea?: boolean;\n}\n\nexport function dagreLayout({\n cells,\n layoutOptions,\n allowEdgeToArea,\n}: DagreLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, ...dagreGraphOptions } = {\n nodePadding: 0,\n rankdir: \"TB\",\n ranksep: 50,\n edgesep: 10,\n nodesep: 50,\n // align: undefined,\n ...pick(layoutOptions, [\n \"nodePadding\",\n \"rankdir\",\n \"ranksep\",\n \"edgesep\",\n \"nodesep\",\n \"align\",\n ]),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n\n if (!cells.some(isNodeCell)) {\n // Dagre cannot render empty nodes\n return {\n getNodeView: () => null!,\n nodePaddings,\n };\n }\n\n const graph = new dagre.graphlib.Graph<ForceNode>();\n graph.setGraph(dagreGraphOptions);\n // Default to assigning a new object as a label for each new edge.\n graph.setDefaultEdgeLabel(function () {\n return {};\n });\n for (const cell of cells) {\n if (\n (allowEdgeToArea && isNodeOrAreaDecoratorCell(cell)) ||\n isNodeCell(cell)\n ) {\n graph.setNode(cell.id, {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + nodePaddings[0] + nodePaddings[2],\n });\n } else if (isEdgeCell(cell)) {\n graph.setEdge(cell.source, cell.target);\n }\n }\n dagre.layout(graph);\n\n return {\n getNodeView: (id: NodeId) => graph.node(id),\n nodePaddings,\n };\n}\n","import { pick } from \"lodash\";\nimport {\n forceCollide,\n forceLink,\n forceManyBody,\n forceSimulation,\n forceX,\n forceY,\n type Simulation,\n} from \"d3-force\";\nimport type {\n Cell,\n ForceCollideOptions,\n ForceLink,\n ForceNode,\n LayoutOptionsForce,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport {\n isEdgeCell,\n isNodeCell,\n isNodeOrAreaDecoratorCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type { FullRectTuple, PositionTuple } from \"../../diagram/interfaces\";\n\nexport interface ForceLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsForce;\n center?: PositionTuple;\n fixedPosition?: boolean;\n allowEdgeToArea?: boolean;\n}\n\nexport function forceLayout({\n cells,\n layoutOptions,\n center,\n fixedPosition,\n allowEdgeToArea,\n}: ForceLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, collide } = {\n nodePadding: 0,\n ...pick(layoutOptions, [\"nodePadding\"]),\n collide:\n layoutOptions?.collide !== false\n ? ({\n radiusDiff: 18,\n strength: 1,\n iterations: 1,\n ...(layoutOptions?.collide === true\n ? null\n : (layoutOptions?.collide as ForceCollideOptions)),\n } as Required<ForceCollideOptions>)\n : (false as const),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n const forceNodes: ForceNode[] = [];\n const forceLinks: ForceLink[] = [];\n const nodesMap = new Map<NodeId, ForceNode>();\n for (const cell of cells) {\n if (\n (allowEdgeToArea && isNodeOrAreaDecoratorCell(cell)) ||\n isNodeCell(cell)\n ) {\n const node: ForceNode = {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + nodePaddings[0] + nodePaddings[2],\n ...(fixedPosition ? { fx: cell.view.x, fy: cell.view.y } : null),\n };\n forceNodes.push(node);\n nodesMap.set(node.id, node);\n } else if (isEdgeCell(cell)) {\n forceLinks.push({ source: cell.source, target: cell.target });\n }\n }\n\n const linkSimulation = forceLink<ForceNode, ForceLink>(forceLinks).id(\n (d) => d.id\n );\n const simulation = forceSimulation<ForceNode, ForceLink>(forceNodes)\n .force(\"link\", linkSimulation)\n .force(\"x\", forceX(center?.[0]))\n .force(\"y\", forceY(center?.[1]))\n .force(\"charge\", forceManyBody());\n\n if (collide) {\n simulation.force(\n \"collide\",\n forceCollide<ForceNode>()\n .radius(\n (d) =>\n Math.sqrt(d.width ** 2 + d.height ** 2) / 2 + collide.radiusDiff\n )\n .strength(collide.strength)\n .iterations(collide.iterations)\n );\n }\n\n simulation.stop();\n manuallyTickToTheEnd(simulation);\n\n return {\n getNodeView: (id: NodeId) => nodesMap.get(id) as NodeView,\n nodePaddings,\n };\n}\n\nfunction manuallyTickToTheEnd(\n simulation: Simulation<ForceNode, ForceLink>\n): void {\n // Manually tick to the end.\n simulation.tick(\n Math.ceil(\n Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())\n )\n );\n}\n","import { pull } from \"lodash\";\nimport type { NodePosition } from \"../../../diagram/interfaces\";\nimport { getConnectPointsOfRectangle } from \"../shapes/Rectangle\";\nimport type { EdgeView, NodeView } from \"../../../draw-canvas/interfaces\";\nimport { getPolyLinePoints } from \"../../../diagram/lines/getPolyLinePoints\";\nimport { nodeViewToNodeRect } from \"./nodeViewToNodeRect\";\n\nconst DEFAULT_DIRECTIONS = [\"right\", \"top\", \"left\", \"bottom\"] as const;\n\nexport function getSmartLinePoints(\n sourceView: NodeView,\n targetView: NodeView,\n {\n exitPosition,\n entryPosition,\n }: Required<Pick<EdgeView, \"exitPosition\" | \"entryPosition\">>\n): NodePosition[] {\n const connectPoints = getConnectPointsOfRectangle();\n\n const originalSourceDirections =\n connectPoints.find((p) => p.x === exitPosition.x && p.y === exitPosition.y)\n ?.d ?? DEFAULT_DIRECTIONS;\n const originalTargetDirections =\n connectPoints.find(\n (p) => p.x === entryPosition.x && p.y === entryPosition.y\n )?.d ?? DEFAULT_DIRECTIONS;\n const sourceDirections = [...originalSourceDirections];\n const targetDirections = [...originalTargetDirections];\n\n const sourceX = sourceView.x + exitPosition.x * sourceView.width;\n const sourceY = sourceView.y + exitPosition.y * sourceView.height;\n const targetX = targetView.x + entryPosition.x * targetView.width;\n const targetY = targetView.y + entryPosition.y * targetView.height;\n\n if (sourceX < targetX) {\n pull(sourceDirections, \"left\");\n pull(targetDirections, \"right\");\n } else {\n pull(sourceDirections, \"right\");\n pull(targetDirections, \"left\");\n }\n\n if (sourceY < targetY) {\n pull(sourceDirections, \"top\");\n pull(targetDirections, \"bottom\");\n } else {\n pull(sourceDirections, \"bottom\");\n pull(targetDirections, \"top\");\n }\n\n const sourceDirection = sourceDirections[0] ?? originalSourceDirections[0];\n const targetDirection = targetDirections[0] ?? originalTargetDirections[0];\n\n const sourcePosition =\n sourceDirection === \"left\" || sourceDirection === \"right\"\n ? exitPosition.y\n : exitPosition.x;\n const targetPosition =\n targetDirection === \"left\" || targetDirection === \"right\"\n ? entryPosition.y\n : entryPosition.x;\n\n return getPolyLinePoints(\n nodeViewToNodeRect(sourceView, 0),\n nodeViewToNodeRect(targetView, 0),\n sourceDirection,\n targetDirection,\n sourcePosition,\n targetPosition\n );\n}\n","import type { NodeRect } from \"../../../diagram/interfaces\";\nimport type { NodeView } from \"../../../draw-canvas/interfaces\";\n\nexport function nodeViewToNodeRect(view: NodeView, padding: number): NodeRect {\n return {\n x: view.x + view.width / 2,\n y: view.y + view.height / 2,\n width: view.width + padding,\n height: view.height + padding,\n };\n}\n","import type { NodeConnectPoint } from \"../../../draw-canvas/interfaces\";\n\n// *--*--*--*--*\n// | |\n// * *\n// | |\n// * Rect *\n// | |\n// * *\n// | |\n// *--*--*--*--*\nconst RectangleRelativeConnectPoints: ReadonlyArray<NodeConnectPoint> = [\n {\n x: 0,\n y: 0,\n d: [\"top\", \"left\"],\n },\n { x: 0.5, y: 0, d: [\"top\"] },\n {\n x: 1,\n y: 0,\n d: [\"top\", \"right\"],\n },\n { x: 0, y: 0.5, d: [\"left\"] },\n { x: 1, y: 0.5, d: [\"right\"] },\n {\n x: 0,\n y: 1,\n d: [\"bottom\", \"left\"],\n },\n { x: 0.5, y: 1, d: [\"bottom\"] },\n {\n x: 1,\n y: 1,\n d: [\"bottom\", \"right\"],\n },\n];\n\nexport function getConnectPointsOfRectangle(): ReadonlyArray<NodeConnectPoint> {\n return RectangleRelativeConnectPoints;\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\nimport { sameTarget } from \"../../draw-canvas/processors/sameTarget\";\n\nexport interface UseActiveTargetOptions {\n cellsRef: React.RefObject<SVGGElement>;\n activeTarget?: ActiveTarget | null;\n onActiveTargetChange(target: ActiveTarget | null): void;\n}\n\nexport type UseActiveTargetResult = ActiveTarget | null;\n\nexport function useActiveTarget({\n cellsRef,\n activeTarget: _activeTarget,\n onActiveTargetChange,\n}: UseActiveTargetOptions): UseActiveTargetResult {\n const newActiveTarget = _activeTarget ?? null;\n const [activeTarget, setActiveTarget] = useState<ActiveTarget | null>(\n newActiveTarget\n );\n\n useEffect(() => {\n setActiveTarget((previous) =>\n sameTarget(previous, newActiveTarget) ? previous : newActiveTarget\n );\n }, [newActiveTarget]);\n\n const activeTargetChangeInitialized = useRef(false);\n useEffect(() => {\n if (!activeTargetChangeInitialized.current) {\n activeTargetChangeInitialized.current = true;\n return;\n }\n onActiveTargetChange(activeTarget);\n }, [activeTarget, onActiveTargetChange]);\n\n useEffect(() => {\n if (!activeTarget) {\n return;\n }\n const resetActiveTarget = (e: MouseEvent) => {\n const path = e.composedPath();\n const cellsContainerIndex = path.indexOf(cellsRef.current!);\n // Reset active target to null when clicking outside of the cells container,\n // Or inside the cells container but not on any cell.\n if (cellsContainerIndex <= 0) {\n setActiveTarget(null);\n }\n };\n document.addEventListener(\"click\", resetActiveTarget);\n return () => {\n document.removeEventListener(\"click\", resetActiveTarget);\n };\n }, [activeTarget, cellsRef]);\n\n return activeTarget;\n}\n","import type { AlignOrigin, NormalizedAlignOrigin } from \"../interfaces\";\n\nconst KeywordMap = new Map([\n [\"center\", 0.5],\n [\"left\", 0],\n [\"right\", 1],\n [\"top\", 0],\n [\"bottom\", 1],\n]);\n\nexport function normalizeAlignOrigin(\n alignOrigin: AlignOrigin | undefined\n): NormalizedAlignOrigin {\n const origin = alignOrigin ?? [0.5, 0.5];\n return [\n normalizeAlignAxis(origin[0], \"x\"),\n normalizeAlignAxis(origin[1], \"y\"),\n ];\n}\n\nfunction normalizeAlignAxis(value: string | number, axis: \"x\" | \"y\"): number {\n if (typeof value === \"string\") {\n const newX = KeywordMap.get(value);\n if (newX !== undefined) {\n return newX;\n }\n const matches = value.match(/^(-?\\d+(?:\\.\\d+)?)%$/);\n if (matches) {\n return Number(matches[1]) / 100;\n }\n // eslint-disable-next-line no-console\n console.error(\"Unexpected align origin %s:\", axis, value);\n } else if (typeof value === \"number\") {\n return value;\n } else {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected align origin %s, expected %s, received %s:\",\n axis,\n \"string | number\",\n typeof value,\n value\n );\n }\n\n return 0.5;\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { ZoomBehavior } from \"d3-zoom\";\nimport type {\n Cell,\n LayoutOptions,\n LayoutOptionsForce,\n LayoutOptionsDagre,\n LayoutType,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport type { FullRectTuple, RangeTuple } from \"../../diagram/interfaces\";\nimport { useAutoCenter } from \"./useAutoCenter\";\nimport {\n isNodeCell,\n isNodeOrAreaDecoratorCell,\n isNodeOrEdgeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\nimport type { DrawCanvasAction } from \"../../draw-canvas/reducers/interfaces\";\nimport { forceLayout } from \"./forceLayout\";\nimport { dagreLayout } from \"./dagreLayout\";\nimport { normalizeAlignOrigin } from \"../../draw-canvas/processors/normalizeAlignOrigin\";\n\nexport interface UseLayoutOptions {\n layout: LayoutType;\n layoutOptions?: LayoutOptions;\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n layoutKey: number;\n allowEdgeToArea?: boolean;\n dispatch: (value: DrawCanvasAction) => void;\n}\n\nexport function useLayout({\n layout,\n layoutOptions,\n rootRef,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n layoutKey,\n allowEdgeToArea,\n dispatch,\n}: UseLayoutOptions) {\n const [layoutInitialized, setLayoutInitialized] = useState(\n layout !== \"force\" && layout !== \"dagre\"\n );\n\n const layoutKeyRef = useRef(layoutKey);\n\n const getNextLayoutKey = useCallback(() => {\n return ++layoutKeyRef.current;\n }, []);\n\n const [centered, setCentered] = useAutoCenter({\n rootRef,\n layoutInitialized,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n });\n\n const previousLayoutRef = useRef<Cell[] | null>(null);\n\n useEffect(() => {\n // Wait for all nodes to be size-initialized before layout.\n if (\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n ) ||\n // Skip layout if no cells.\n cells.length === 0\n ) {\n return;\n }\n\n if (layout !== \"force\" && layout !== \"dagre\") {\n setLayoutInitialized(true);\n return;\n }\n\n // DO NOT re-layout if layout key mismatched.\n // DO NOT re-layout if nodes and edges not changed.\n if (\n layoutKeyRef.current !== layoutKey ||\n isSameArray(previousLayoutRef.current, cells.filter(isNodeOrEdgeCell))\n ) {\n // Layout key mismatch happens when this effect is performed after\n // update-node-size dispatched but not yet applied.\n // If didn't ignore mismatched layout, it will cause the update-cells\n // action overwrites those update-node-size actions.\n return;\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n let nodePaddings: FullRectTuple;\n\n if (layout === \"force\") {\n ({ getNodeView, nodePaddings } = forceLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsForce,\n allowEdgeToArea,\n }));\n } else {\n ({ getNodeView, nodePaddings } = dagreLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsDagre,\n allowEdgeToArea,\n }));\n }\n\n const alignOrigin = normalizeAlignOrigin(\n (layoutOptions as LayoutOptionsForce | LayoutOptionsDagre)?.alignOrigin\n );\n\n const newCells: Cell[] = cells.map((cell) => {\n if (\n (allowEdgeToArea && isNodeOrAreaDecoratorCell(cell)) ||\n isNodeCell(cell)\n ) {\n const nodeView = getNodeView(cell.id);\n return {\n ...cell,\n view: {\n ...cell.view,\n x: nodeView.x! - nodeView.width * alignOrigin[0] + nodePaddings[3],\n y: nodeView.y! - nodeView.height * alignOrigin[1] + nodePaddings[0],\n },\n [SYMBOL_FOR_LAYOUT_INITIALIZED]: true,\n };\n }\n return cell;\n });\n previousLayoutRef.current = newCells.filter(isNodeOrEdgeCell);\n\n dispatch({ type: \"update-cells\", payload: newCells });\n // setCentered(false);\n setLayoutInitialized(true);\n }, [cells, dispatch, layout, layoutKey, layoutOptions /* , setCentered */]);\n\n return { centered, setCentered, getNextLayoutKey };\n}\n\nfunction isSameArray<T = unknown>(a: T[] | null, b: T[]): boolean {\n return a?.length === b.length && a.every((v, i) => v === b[i]);\n}\n","import React, { useEffect, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { ZoomTransform, type ZoomBehavior } from \"d3-zoom\";\nimport type { RangeTuple } from \"../../diagram/interfaces\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../../draw-canvas/constants\";\nimport type { Cell } from \"../../draw-canvas/interfaces\";\nimport {\n isDecoratorCell,\n isNodeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport { transformToCenter } from \"../../draw-canvas/processors/transformToCenter\";\n\nexport interface UseAutoCenterOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n layoutInitialized: boolean;\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n}\n\nexport type UseAutoCenterResult = [\n centered: boolean,\n setCentered: React.Dispatch<React.SetStateAction<boolean>>,\n];\n\nexport function useAutoCenter({\n rootRef,\n cells,\n layoutInitialized,\n zoomable,\n zoomer,\n scaleRange,\n}: UseAutoCenterOptions): UseAutoCenterResult {\n const [centered, setCentered] = useState(false);\n\n useEffect(() => {\n const root = rootRef.current;\n if (\n !root ||\n !layoutInitialized ||\n centered ||\n !cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell)) ||\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n )\n ) {\n return;\n }\n const { k, x, y } = transformToCenter(cells, {\n canvasWidth: root.clientWidth,\n canvasHeight: root.clientHeight,\n scaleRange: zoomable ? scaleRange : undefined,\n });\n // istanbul ignore next\n if (process.env.NODE_ENV !== \"test\") {\n // jsdom doesn't support svg baseVal yet.\n // https://github.com/jsdom/jsdom/issues/2531\n zoomer.transform(select(root), new ZoomTransform(k, x, y));\n }\n setCentered(true);\n }, [\n cells,\n centered,\n layoutInitialized,\n rootRef,\n scaleRange,\n zoomable,\n zoomer,\n ]);\n\n useEffect(() => {\n // Reset auto centering when nodes and decorators are all removed.\n if (!cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell))) {\n setCentered(false);\n }\n }, [cells]);\n\n return [centered, setCentered];\n}\n","import { useMemo } from \"react\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { findIndex, isUndefined, omitBy } from \"lodash\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n ComputedLineConnecterConf,\n EdgeCell,\n EdgeLineConf,\n LineConnecterConf,\n LineMarker,\n} from \"../../draw-canvas/interfaces\";\nimport { isEdgeCell } from \"../../draw-canvas/processors/asserts\";\nimport {\n DEFAULT_LINE_STROKE_COLOR,\n DEFAULT_LINE_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n} from \"../../draw-canvas/constants\";\n\nexport interface UseLineMarkersOptions {\n cells: Cell[];\n defaultEdgeLines: EdgeLineConf[] | undefined;\n markerPrefix: string;\n lineConnector?: LineConnecterConf | boolean;\n}\n\nexport function useLineMarkers({\n cells,\n defaultEdgeLines,\n markerPrefix,\n lineConnector,\n}: UseLineMarkersOptions): {\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n lineConnectorConf: ComputedLineConnecterConf | null;\n markers: LineMarker[];\n} {\n return useMemo(() => {\n // Always put the default stroke marker at the first position,\n // since the connecting line will use it.\n const markers: LineMarker[] = [{ strokeColor: DEFAULT_LINE_STROKE_COLOR }];\n\n let lineConnectorConf: ComputedLineConnecterConf | null = null;\n if (lineConnector) {\n lineConnectorConf = {\n ...getDefaultLineConf(),\n ...omitBy(lineConnector === true ? {} : lineConnector, isUndefined),\n } as ComputedLineConnecterConf;\n const markerIndex = addMarker(\n { strokeColor: lineConnectorConf.strokeColor },\n markers\n );\n lineConnectorConf.$markerUrl = `url(#${markerPrefix}${markerIndex})`;\n }\n\n const map = new WeakMap<EdgeCell, ComputedEdgeLineConf>();\n for (const cell of cells) {\n if (isEdgeCell(cell)) {\n const computedLineConf =\n __secret_internals.legacyDoTransform(\n { edge: cell },\n defaultEdgeLines?.find((item) =>\n checkIfByTransform(item, { edge: cell })\n )\n ) ?? {};\n const lineConf = {\n ...getDefaultLineConf(),\n ...omitBy(computedLineConf, isUndefined),\n ...omitBy(cell.view, isUndefined),\n } as ComputedEdgeLineConf;\n if (lineConf.parallelGap === undefined) {\n lineConf.parallelGap = lineConf.interactStrokeWidth;\n }\n const markerIndex = addMarker(\n { strokeColor: lineConf.strokeColor },\n markers\n );\n lineConf.$markerUrl = `url(#${markerPrefix}${markerIndex})`;\n map.set(cell, lineConf);\n }\n }\n return { lineConfMap: map, lineConnectorConf, markers };\n }, [cells, defaultEdgeLines, lineConnector, markerPrefix]);\n}\n\nfunction addMarker(marker: LineMarker, markers: LineMarker[]): number {\n let markerIndex = findIndex(markers, marker);\n if (markerIndex === -1) {\n markerIndex = markers.push(marker) - 1;\n }\n return markerIndex;\n}\n\nfunction getDefaultLineConf() {\n return {\n type: \"auto\",\n dashed: false,\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n strokeWidth: DEFAULT_LINE_STROKE_WIDTH,\n interactStrokeWidth: DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n showStartArrow: DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n showEndArrow: DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n animate: {\n useAnimate: false,\n duration: DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n },\n };\n}\n","import { useMemo } from \"react\";\nimport type { Cell, LayoutType } from \"../../draw-canvas/interfaces\";\nimport { isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\n\nexport interface UseReadyOptions {\n cells: Cell[];\n layout: LayoutType;\n centered: boolean;\n}\n\nexport function useReady({ cells, layout, centered }: UseReadyOptions) {\n const ready = useMemo(\n () =>\n centered &&\n cells.every(\n (cell) =>\n !isNodeCell(cell) ||\n (cell[SYMBOL_FOR_SIZE_INITIALIZED] &&\n ((layout !== \"force\" && layout !== \"dagre\") ||\n cell[SYMBOL_FOR_LAYOUT_INITIALIZED]))\n ),\n [cells, centered, layout]\n );\n return ready;\n}\n","import React, { useEffect, useMemo, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { zoom, type ZoomBehavior } from \"d3-zoom\";\nimport type { RangeTuple, TransformLiteral } from \"../../diagram/interfaces\";\nimport {\n DEFAULT_SCALE_RANGE_MIN,\n DEFAULT_SCALE_RANGE_MAX,\n} from \"../../draw-canvas/constants\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\n\nexport interface UseZoomOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n zoomable?: boolean;\n scrollable?: boolean;\n pannable?: boolean;\n draggable?: boolean;\n ctrlDraggable?: boolean;\n scaleRange?: RangeTuple;\n onSwitchActiveTarget?(target: ActiveTarget | null): void;\n}\n\nexport interface UseZoomResult {\n grabbing: boolean;\n transform: TransformLiteral;\n scaleRange: RangeTuple;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n}\n\nexport function useZoom({\n rootRef,\n zoomable,\n scrollable,\n pannable,\n draggable,\n ctrlDraggable,\n scaleRange: _scaleRange,\n onSwitchActiveTarget,\n}: UseZoomOptions): UseZoomResult {\n const [grabbing, setGrabbing] = useState(false);\n const [transform, setTransform] = useState<TransformLiteral>({\n k: 1,\n x: 0,\n y: 0,\n });\n\n const scaleRange = useMemo(\n () =>\n _scaleRange ??\n ([DEFAULT_SCALE_RANGE_MIN, DEFAULT_SCALE_RANGE_MAX] as RangeTuple),\n [_scaleRange]\n );\n\n const zoomer = useMemo(() => zoom<SVGSVGElement, unknown>(), []);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n let moved = false;\n zoomer\n .scaleExtent(zoomable ? scaleRange : [1, 1])\n .on(\"start\", () => {\n moved = false;\n setGrabbing(true);\n })\n .on(\"zoom\", (e: { transform: TransformLiteral }) => {\n moved = true;\n setTransform(e.transform);\n })\n .on(\"end\", () => {\n setGrabbing(false);\n if (!moved) {\n onSwitchActiveTarget?.(null);\n }\n })\n .filter(\n (event) =>\n (event.type === \"wheel\" ||\n (ctrlDraggable ? draggable || event.ctrlKey : !event.ctrlKey)) &&\n !event.button\n );\n }, [\n onSwitchActiveTarget,\n scaleRange,\n zoomable,\n zoomer,\n ctrlDraggable,\n draggable,\n ]);\n\n useEffect(() => {\n if (ctrlDraggable) {\n const onContextMenu = (e: MouseEvent) => {\n if (e.ctrlKey) {\n e.preventDefault();\n }\n };\n document.addEventListener(\"contextmenu\", onContextMenu, true);\n return () => {\n document.removeEventListener(\"contextmenu\", onContextMenu, true);\n };\n }\n }, [ctrlDraggable]);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n const root = rootRef.current;\n if (!root) {\n return;\n }\n\n const rootSelection = select(root);\n\n const unsetZoom = () => {\n rootSelection\n .on(\".zoom\", null)\n .on(\".zoom.custom\", null)\n .on(\"wheel\", null);\n };\n\n if (!(zoomable || scrollable || pannable)) {\n unsetZoom();\n return;\n }\n\n if (zoomable || scrollable) {\n // Do not override default d3 zoom handler.\n // Only handles *panning*\n rootSelection.on(\n \"wheel.zoom.custom\",\n (e: WheelEvent & { wheelDeltaX: number; wheelDeltaY: number }) => {\n // Mac OS trackpad pinch event is emitted as a wheel.zoom and d3.event.ctrlKey set to true\n if (!e.ctrlKey) {\n // Stop immediate propagation for default d3 zoom handler\n e.stopImmediatePropagation();\n if (scrollable) {\n e.preventDefault();\n zoomer.translateBy(\n rootSelection,\n e.wheelDeltaX / 5,\n e.wheelDeltaY / 5\n );\n }\n }\n // zoomer.scaleBy(rootSelection, Math.pow(2, defaultWheelDelta(e)))\n }\n );\n }\n\n rootSelection\n .call(zoomer)\n .on(\"wheel\", (e: WheelEvent) => {\n e.preventDefault();\n })\n .on(\"dblclick.zoom\", null);\n\n if ((!draggable && !ctrlDraggable) || !pannable) {\n rootSelection.on(\"mousedown.zoom\", null);\n }\n\n if (!pannable) {\n rootSelection\n .on(\"touchstart.zoom\", null)\n .on(\"touchmove.zoom\", null)\n .on(\"touchend.zoom\", null);\n }\n\n return unsetZoom;\n }, [\n ctrlDraggable,\n draggable,\n pannable,\n rootRef,\n scrollable,\n zoomable,\n zoomer,\n ]);\n\n return { grabbing, transform, zoomer, scaleRange };\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.zoom-bar{position:absolute;bottom:20px;right:20px;width:40px;scale:0.8}.zoom-slider,\n.center-button{width:100%;display:flex;align-items:center;border:1px solid var(--antd-background-color-base);border-radius:var(--larger-border-radius);box-shadow:var(--connected-overlay-shadow);background-color:var(--color-fill-bg-container-4)}.zoom-slider{height:140px;padding:8px 0;flex-direction:column}[role=\"button\"]{cursor:pointer}.center-button{justify-content:center;margin-bottom:8px;height:40px}.center-button:hover{border-color:var(--antd-btn-default-hover-border-color)}.center-button path{fill:var(--antd-link-hover-color)}.center-button:hover path{fill:var(--palette-blue-7)}.zoom-button{font-size:16px;line-height:0}.zoom-button svg{width:1em;height:1em;fill:var(--antd-link-hover-color)}.zoom-slider .ant-slider-vertical{padding-inline:5px}.zoom-slider .ant-slider-vertical .ant-slider-rail{width:2px}.zoom-slider .ant-slider-vertical .ant-slider-handle{width:6px;height:6px;inset-inline-start:3px}.zoom-slider .ant-slider .ant-slider-handle:hover::before,\n.zoom-slider .ant-slider .ant-slider-handle:focus::before,\n.zoom-slider .ant-slider .ant-slider-handle::before{width:10px;height:10px;inset-inline-start:-2px}.zoom-slider .ant-slider .ant-slider-handle:hover::after,\n.zoom-slider .ant-slider .ant-slider-handle:focus::after,\n.zoom-slider .ant-slider .ant-slider-handle::after{width:6px;height:6px;inset-block-start:0;inset-inline-start:0}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden;--animation-dasharray:48;--stroke-dashoffset:96;--dasharray:4}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashoffset)}to{stroke-dashoffset:0}}@keyframes solidAnimation{to{stroke-dashoffset:0}}.solid-animation{stroke-dasharray:var(--solid-length);stroke-dashoffset:var(--solid-length);animation:solidAnimation var(--time) linear infinite}.dashed-animation{animation:dashedAnimation var(--time) linear infinite}.decorator-area .area,\n.decorator-container .container{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.cell.active .decorator-container .container,\n.cell:not(.read-only) .decorator-container .container:hover,\n.allowEdgeToArea .decorator-area .area:hover,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:var(--dasharray);stroke-width:1}.container-active .decorator-container .container{stroke:var(--palette-blue-5);stroke-width:1}.cell:not(.read-only){-webkit-user-select:none;user-select:none}.resize-handle{cursor:nwse-resize;opacity:0}.resize-handle rect{fill:transparent;stroke:none}.resize-handle path{fill:none;stroke:var(--palette-gray-5);stroke-width:1.5}.cell.active .decorator-area .resize-handle,\n.decorator-area:hover .resize-handle,\n.decorator-container:hover .resize-handle{opacity:1}.connect-line{pointer-events:none}.connect-line:not(.connecting){display:none}.line.dashed{stroke-dasharray:var(--dasharray)}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}.cell.faded{opacity:0.3}.cell.container-active{opacity:1}.cell .node{pointer-events:none}.cell .node > *{position:fixed;pointer-events:auto}.degraded{pointer-events:bounding-box}.degraded circle{fill:rgb(119,141,195)}.degraded text{text-anchor:middle;fill:var(--antd-text-color)}.cell.active .degraded circle,\n.cell.active .degraded text,\n.degraded:hover circle,\n.degraded:hover text{fill:var(--color-brand)}.decorator-container{--defaultSize:24px}.decorator-container .text-container{display:flex;align-items:center;justify-content:center;padding:0.5em;text-align:center;font-size:16px;background-color:rgba(119,141,195,0.6);overflow:hidden}.decorator-container .horizontal{height:max-content;width:100%}:is(.decorator-container .horizontal) .text{min-height:var(--defaultSize)}.decorator-container .vertical{width:max-content;height:100%;writing-mode:vertical-lr;text-orientation:upright;letter-spacing:4px}:is(.decorator-container .vertical) .text{min-width:var(--defaultSize)}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n"],"names":["MarkerComponent","_ref","Component","id","type","strokeColor","EntityRelationZeroOrOneMarker","EntityRelationZeroOrManyMarker","ArrowMarker","React","_ref2","viewBox","refX","refY","markerWidth","markerHeight","orient","strokeLinejoin","d","stroke","strokeWidth","fill","_ref3","_ref4","curveLine","points","curveType","startOffset","endOffset","Array","isArray","curveFactory","curveLinear","curveBumpX","curveBumpY","curveMonotoneX","curveMonotoneY","curveNatural","curveBasis","startOffsets","getOffsets","endOffsets","length","line","x","index","y","curve","lineFunction","start","end","offset","x0","y0","x1","y1","ratio","Math","sqrt","pow","getDirectLinePoints","source","target","parallelGap","doTwoNodesOverlap","p0","p1","xDiff","yDiff","dx","dy","angle","atan2","cos","PI","sin","sourceIntersections","getIntersections","targetIntersections","rect","vertices","width","height","possibleLines","i","push","intersections","item","intersection","intersect","x2","y2","x3","y3","x4","y4","denominator","ua","ub","getPolyLinePoints","sourceDirection","targetDirection","sourcePosition","targetPosition","getCoordinates","c1","c2","filter","Boolean","node","direction","position","a","b","paddingA","paddingB","A","getNodesWithPadding","B","left","min","right","max","top","bottom","padding","extractPartialRectTuple","value","v0","v1","findNodeOrAreaDecorator","cells","find","cell","isNodeOrAreaDecoratorCell","EdgeComponent","_pathRef$current","_pathRef$current$getT","edge","lineConfMap","pathRef","useRef","sourceNode","useMemo","targetNode","lineConf","get","omitBy","view","key","undefined","some","_edge$view","isEdgeCell","exitPosition","entryPosition","_edge$view2","getSmartLinePoints","nodeViewToNodeRect","fixedLineType","interactStrokeWidth","ref","className","classNames","dashed","animate","useAnimate","style","duration","DEFAULT_LINE_INTERACT_ANIMATE_DURATION","current","getTotalLength","call","markerStart","showStartArrow","$markerUrl","markerEnd","showEndArrow","NodeComponent","degraded","degradedNodeLabel","defaultNodeBricks","onResize","memoizedData","memoizedValue","setMemoizedValue","useState","useEffect","prev","isEqual","useDeepMemo","data","specifiedUseBrick","useBrick","observerRef","_defaultNodeBricks$fi","checkIfByTransform","label","String","__secret_internals","legacyDoTransform","refCallback","useCallback","element","prevObserver","disconnect","setTimeout","observer","ResizeObserver","offsetWidth","offsetHeight","observe","degradedRefCallBack","g","size","getBBox","ReactUseBrick","cx","cy","r","handleMouseDown","event","action","scale","layout","layoutOptions","activeTarget","onCellsMoving","onCellsMoved","onCellResizing","onCellResized","onSwitchActiveTarget","stopPropagation","targetIsActive","cellToTarget","isAutoLayout","activeCells","actives","c","forEach","isContainerDecoratorCell","isNodeCell","containerId","includes","movableActiveCells","isDecoratorCell","snap","intermediateSnap","grid","object","snapToGrid","snapToObject","DEFAULT_SNAP_GRID_SIZE","distance","DEFAULT_SNAP_OBJECT_DISTANCE","normalizeSnapOptions","from","clientX","clientY","originals","map","center","getCenterPosition","firstOriginalPosition","previousPositions","snapToObjectTargets","objectCells","moved","handleMove","e","finished","movement","getMovement","newPositions","xAlign","yAlign","xAlignCell","yAlignCell","altKey","diffX","Infinity","diffY","snapMovement","snapToObjectDistance","xAlignFrom","yAlignFrom","xAlignTarget","yAlignTarget","xAlignToY","yAlignToX","dX","abs","dY","ySnapped","halfHeight","halfWidth","snapToGridSize","firstNewPosition","round","snapToGridMovement","snapToGridDiffX","snapToGridDiffY","_ref6","payloads","_ref5","decorator","guideLines","_ref7","onMouseMove","onMouseUp","document","removeEventListener","addEventListener","DecoratorArea","transform","readOnly","resizeHandleRef","resizeHandle","onMouseDown","k","DecoratorText","onDecoratorTextEditing","onDecoratorTextChange","text","currentLabel","setCurrentLabel","editingLabel","setEditingLabel","editingLabelInitialized","shouldEmitLabelChange","setShouldEmitLabelChange","handleEnableEdit","preventDefault","textContent","_ref$current","parentElement","clientWidth","clientHeight","focus","selectAllText","editing","handleInput","handleBlur","onDoubleClick","contentEditable","onInput","onBlur","range","createRange","selectNodeContents","selection","window","getSelection","removeAllRanges","addRange","DecoratorContainer","textRef","recomputation","setRecomputation","titleForeignRect","setTitleForeignRect","uuidV4","_textRef$current","textParentEle","isNoManualLayout","DecoratorComponent","SpecifiedComponent","console","error","computeContainerRect","minX","minY","maxX","maxY","n","isFinite","CellComponent","dragNodeToContainerActive","unrelatedCells","onCellContextMenu","onCellClick","onNodeBrickResize","onCellMouseEnter","onCellMouseLeave","gRef","unrelated","sameTarget","containerRect","containCells","handleContextMenu","handleCellClick","handleMouseEnter","handleMouseLeave","active","faded","onContextMenu","onClick","onMouseEnter","onMouseLeave","ConnectLineComponent","connectLineState","onConnect","connectLineTo","setConnectLineTo","reset","capture","connecting","join","HoverStateContext","rootRef","smartConnectLineState","unsetHoverStateTimeoutRef","hoverState","setHoverState","setSmartConnectLineState","useHoverStateContext","HELPER_IMAGE","HELPER_RADIUS","HELPER_BG_RADIUS","HALF_HELPER_RADIUS","LineConnectorComponent","disabled","unsetTimeout","clearTimeout","unsetActivePointIndex","activePointIndex","unsetHoverState","available","transformedPoints","p","pointerEvents","fillOpacity","point","ConnectPointComponent","getBoundingClientRect","originalPoint","relativePoints","handleMouseUp","xlinkHref","preserveAspectRatio","SmartConnectLineComponent","options","sourceView","getConnectLinePoints","SYMBOL_FOR_SIZE_INITIALIZED","Symbol","for","SYMBOL_FOR_LAYOUT_INITIALIZED","DEFAULT_NODE_SIZE","DEFAULT_NODE_GAP","DEFAULT_AREA_WIDTH","DEFAULT_AREA_HEIGHT","DEFAULT_SCALE_RANGE_MIN","DEFAULT_SCALE_RANGE_MAX","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_WIDTH","DEFAULT_LINE_INTERACT_STROKE_WIDTH","DEFAULT_LINE_INTERACT_SHOW_START_ARROW","DEFAULT_LINE_INTERACT_SHOW_END_ARROW","DEFAULT_DEGRADED_THRESHOLD","isInitialNodeCell","isNodeOrEdgeCell","isTextDecoratorCell","pick","getUnrelatedCells","allowEdgeToArea","existedTargets","Set","add","has","nodesMap","Map","activeNodeIds","relatedNodeIds","targets","set","handleKeyboard","keyCode","which","handleLasso","onLassoing","onLassoed","ctrlKey","button","handleNodeContainedChange","onContainerContainerChange","nodeCells","containerIds","v","nodePayloads","nodeCell","includeNodeFlag","payload","containerDecoratorCells","containerCell","containerLeft","containerRight","containerTop","containerBottom","containedChanges","_payload$containerCel","initializeCells","initialCells","defaultNodeSize","_cell$view","_cell$view2","every","targetA","targetB","transformToCenter","canvasWidth","canvasHeight","scaleRange","empty","updateCells","previousCells","reason","parent","isManualLayout","newCells","updateCandidates","shouldReCenter","previousSizeInitializedNodes","previousShouldCentered","previousNode","handled","downstreamNodeIds","parentNode","downstreamNodes","rightMostNode","nextX","nextY","totalWidth","reduce","acc","maxWidth","maxHeight","positionedNodes","hasDecorators","getNodeView","without","dagreLayout","forceLayout","fixedPosition","updated","insertCellAfter","newCell","after","findLastIndex","slice","rootReducer","reducers","state","matched","newState","move","findIndex","layoutKey","Object","fromEntries","entries","props","_extends","xmlns","ZoomBarComponent","shadowRoot","onZoomChange","onReCenter","currentTheme","useCurrentTheme","cache","createCache","zoomBarRef","tooltip","formatter","placement","getPopupContainer","onZoomIn","onZoomOut","ConfigProvider","theme","algorithm","darkAlgorithm","defaultAlgorithm","StyleProvider","container","autoClear","hashPriority","role","CenterSVG","ZoomInSVG","Slider","step","vertical","included","onChange","ZoomOutSVG","nodePadding","dagreGraphOptions","rankdir","ranksep","edgesep","nodesep","nodePaddings","graph","dagre","Graph","setGraph","setDefaultEdgeLabel","setNode","setEdge","collide","radiusDiff","strength","iterations","forceNodes","forceLinks","fx","fy","linkSimulation","forceLink","simulation","forceSimulation","force","forceX","forceY","forceManyBody","forceCollide","radius","stop","tick","ceil","log","alphaMin","alphaDecay","manuallyTickToTheEnd","DEFAULT_DIRECTIONS","targetView","_connectPoints$find","_connectPoints$find2","connectPoints","getConnectPointsOfRectangle","originalSourceDirections","originalTargetDirections","sourceDirections","targetDirections","sourceX","sourceY","targetX","targetY","pull","RectangleRelativeConnectPoints","useActiveTarget","cellsRef","_activeTarget","onActiveTargetChange","newActiveTarget","setActiveTarget","previous","activeTargetChangeInitialized","resetActiveTarget","composedPath","indexOf","KeywordMap","normalizeAlignAxis","axis","newX","matches","match","Number","useLayout","zoomable","zoomer","dispatch","layoutInitialized","setLayoutInitialized","layoutKeyRef","getNextLayoutKey","centered","setCentered","root","select","ZoomTransform","useAutoCenter","previousLayoutRef","alignOrigin","origin","normalizeAlignOrigin","nodeView","useLineMarkers","defaultEdgeLines","markerPrefix","lineConnector","markers","lineConnectorConf","getDefaultLineConf","isUndefined","markerIndex","addMarker","WeakMap","computedLineConf","marker","useReady","useZoom","scrollable","pannable","draggable","ctrlDraggable","_scaleRange","grabbing","setGrabbing","setTransform","zoom","scaleExtent","on","rootSelection","unsetZoom","stopImmediatePropagation","translateBy","wheelDeltaX","wheelDeltaY","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
1
+ {"version":3,"file":"chunks/3252.d94ce52c.js","mappings":"gLAYO,SAASA,EAAeC,GAIO,IAChCC,GAL0B,GAC9BC,EAAE,KACFC,EAAI,YACJC,GACqBJ,EAGrB,OAAQG,GACN,IAAK,OACHF,EAAYI,EACZ,MACF,IAAK,OACHJ,EAAYK,EACZ,MACF,QACEL,EAAYM,EAGhB,OAAOC,IAA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AAA,EAAAA,GAAOD,GAEvBoC,EAAYA,KAChBD,EACGD,GAAG,QAAS,MACZA,GAAG,eAAgB,MACnBA,GAAG,QAAS,KAAK,EAGtB,GAAM3C,GAAYiC,GAAcC,EA+ChC,OA1CIlC,GAAYiC,IAGdW,EAAcD,GACZ,qBACC7b,IAEMA,EAAEqN,UAELrN,EAAEgc,2BACEb,IACFnb,EAAE+D,iBACFoV,EAAO8C,YACLH,EACA9b,EAAEkc,YAAc,EAChBlc,EAAEmc,YAAc,IAGtB,IAMNL,EACG/hB,KAAKof,GACL0C,GAAG,SAAU7b,IACZA,EAAE+D,gBAAgB,IAEnB8X,GAAG,gBAAiB,OAEjBR,GAAcC,IAAmBF,GACrCU,EAAcD,GAAG,iBAAkB,MAGhCT,GACHU,EACGD,GAAG,kBAAmB,MACtBA,GAAG,iBAAkB,MACrBA,GAAG,gBAAiB,MAGlBE,EA9CLA,GA8Cc,GACf,CACDT,EACAD,EACAD,EACAxS,EACAuS,EACAjC,EACAC,IAGK,CAAEqC,WAAU3Y,YAAWsW,SAAQhK,aACxC,C,kEC9KIiN,E,MAA0B,GAA4B,KAE1DA,EAAwB5nB,KAAK,CAAC6nB,EAAO/sB,GAAI,86CAK2E,KAEpH,QAAe8sB,EAAwBE,U,kECTnCF,E,MAA0B,GAA4B,KAE1DA,EAAwB5nB,KAAK,CAAC6nB,EAAO/sB,GAAI,kyFAYmkB,KAE5mB,QAAe8sB,EAAwBE,U","sources":["webpack:///./src/diagram/MarkerComponent.tsx","webpack:///./src/diagram/lines/curveLine.ts","webpack:///./src/diagram/lines/getDirectLinePoints.ts","webpack:///./src/diagram/lines/getPolyLinePoints.ts","webpack:///./src/diagram/processors/doTwoNodesOverlap.ts","webpack:///./src/diagram/processors/extractPartialRectTuple.ts","webpack:///./src/draw-canvas/processors/findNodeOrAreaDecorator.ts","webpack:///./src/draw-canvas/EdgeComponent.tsx","webpack:///./src/draw-canvas/NodeComponent.tsx","webpack:///./src/draw-canvas/processors/handleMouseDown.ts","webpack:///./src/draw-canvas/processors/normalizeSnapOptions.ts","webpack:///./src/draw-canvas/decorators/DecoratorArea.tsx","webpack:///./src/draw-canvas/decorators/DecoratorText.tsx","webpack:///./src/draw-canvas/decorators/DecoratorContainer.tsx","webpack:///./src/draw-canvas/decorators/index.tsx","webpack:///./src/draw-canvas/processors/computeContainerRect.ts","webpack:///./src/draw-canvas/CellComponent.tsx","webpack:///./src/draw-canvas/ConnectLineComponent.tsx","webpack:///./src/draw-canvas/HoverStateContext.ts","webpack:///./src/draw-canvas/LineConnectorComponent.tsx","webpack:///./src/draw-canvas/SmartConnectLineComponent.tsx","webpack:///./src/shared/canvas/processors/getConnectLinePoints.ts","webpack:///./src/draw-canvas/constants.ts","webpack:///./src/draw-canvas/processors/asserts.ts","webpack:///./src/draw-canvas/processors/cellToTarget.ts","webpack:///./src/draw-canvas/processors/getUnrelatedCells.ts","webpack:///./src/draw-canvas/processors/handleKeyboard.ts","webpack:///./src/draw-canvas/processors/handleLasso.ts","webpack:///./src/draw-canvas/processors/handleNodeContainedChange.ts","webpack:///./src/draw-canvas/processors/initializeCells.ts","webpack:///./src/draw-canvas/processors/sameTarget.ts","webpack:///./src/draw-canvas/processors/targetIsActive.ts","webpack:///./src/draw-canvas/processors/transformToCenter.ts","webpack:///./src/draw-canvas/processors/updateCells.ts","webpack:///./src/draw-canvas/reducers/cells.ts","webpack:///./src/draw-canvas/reducers/index.ts","webpack:///./src/draw-canvas/reducers/layoutKey.ts","webpack:///./src/shared/canvas/icons/center.svg","webpack:///./src/shared/canvas/icons/zoom-in.svg","webpack:///./src/shared/canvas/icons/zoom-out.svg","webpack:///./src/shared/canvas/ZoomBarComponent.tsx","webpack:///./src/shared/canvas/dagreLayout.ts","webpack:///./src/shared/canvas/forceLayout.ts","webpack:///./src/shared/canvas/processors/getSmartLinePoints.ts","webpack:///./src/shared/canvas/processors/nodeViewToNodeRect.ts","webpack:///./src/shared/canvas/shapes/Rectangle.ts","webpack:///./src/shared/canvas/useActiveTarget.ts","webpack:///./src/draw-canvas/processors/normalizeAlignOrigin.ts","webpack:///./src/shared/canvas/useLayout.ts","webpack:///./src/shared/canvas/useAutoCenter.ts","webpack:///./src/shared/canvas/useLineMarkers.ts","webpack:///./src/shared/canvas/useReady.ts","webpack:///./src/shared/canvas/useZoom.ts","webpack:///./src/shared/canvas/ZoomBarComponent.shadow.css","webpack:///./src/shared/canvas/styles.shadow.css"],"sourcesContent":["import React from \"react\";\nimport type { LineMarkerType } from \"./interfaces\";\n\nexport interface MarkerComponentProps extends BaseMarkerComponentProps {\n type: LineMarkerType;\n}\n\nexport interface BaseMarkerComponentProps {\n id: string;\n strokeColor?: string;\n}\n\nexport function MarkerComponent({\n id,\n type,\n strokeColor,\n}: MarkerComponentProps): JSX.Element {\n let Component: (props: BaseMarkerComponentProps) => JSX.Element;\n\n switch (type) {\n case \"0..1\":\n Component = EntityRelationZeroOrOneMarker;\n break;\n case \"0..N\":\n Component = EntityRelationZeroOrManyMarker;\n break;\n default:\n Component = ArrowMarker;\n }\n\n return <Component id={id} strokeColor={strokeColor} />;\n}\n\nfunction ArrowMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 6 6\"\n refX={5}\n refY={3}\n markerWidth={6}\n markerHeight={6}\n orient=\"auto-start-reverse\"\n strokeLinejoin=\"round\"\n >\n <path\n d=\"M 0.5 0.5 L 5.5 3 L 0.5 5.5 z\"\n stroke={strokeColor}\n strokeWidth={1}\n fill={strokeColor}\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrOneMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 15.5 0.5 V 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n\nfunction EntityRelationZeroOrManyMarker({\n id,\n strokeColor,\n}: BaseMarkerComponentProps): JSX.Element {\n return (\n <marker\n id={id}\n viewBox=\"0 0 21 11\"\n refX={0.5}\n refY={5.5}\n markerWidth={21}\n markerHeight={11}\n orient=\"auto-start-reverse\"\n >\n <path\n d=\"M 5.5 5.5 m 5 0 a 5 5 0 1 0 -10 0 a 5 5 0 1 0 10 0 M 20.5 0.5 L 10.5 5.5 L 20.5 10.5 M 10.5 5.5 H 20.5\"\n stroke={strokeColor}\n strokeWidth={1}\n fill=\"none\"\n />\n </marker>\n );\n}\n","import {\n curveLinear,\n line,\n curveBasis,\n curveBumpX,\n curveBumpY,\n type CurveFactory,\n curveMonotoneX,\n curveNatural,\n curveMonotoneY,\n} from \"d3-shape\";\nimport type { CurveType, NodePosition } from \"../interfaces\";\n\n/**\n * Generate Line from points\n */\nexport function curveLine(\n points: Array<NodePosition> | null | undefined,\n curveType: CurveType | undefined,\n startOffset: number,\n endOffset: number\n): string {\n if (!Array.isArray(points)) {\n return \"\";\n }\n let curveFactory: CurveFactory;\n switch (curveType) {\n case \"curveLinear\":\n curveFactory = curveLinear;\n break;\n case \"curveBumpX\":\n curveFactory = curveBumpX;\n break;\n case \"curveBumpY\":\n curveFactory = curveBumpY;\n break;\n case \"curveMonotoneX\":\n curveFactory = curveMonotoneX;\n break;\n case \"curveMonotoneY\":\n curveFactory = curveMonotoneY;\n break;\n case \"curveNatural\":\n curveFactory = curveNatural;\n break;\n default:\n curveFactory = curveBasis;\n }\n const startOffsets = getOffsets(points[1], points[0], startOffset);\n const endOffsets = getOffsets(\n points[points.length - 2],\n points[points.length - 1],\n endOffset\n );\n const lineFunction = line()\n .x(\n (d, index) =>\n (d as unknown as { x: number }).x -\n (index === 0\n ? startOffsets.x\n : index === points.length - 1\n ? endOffsets.x\n : 0)\n )\n .y(\n (d, index) =>\n (d as unknown as { y: number }).y -\n (index === 0\n ? startOffsets.y\n : index === points.length - 1\n ? endOffsets.y\n : 0)\n )\n .curve(curveFactory);\n return lineFunction(points as unknown as Array<[number, number]>)!;\n}\n\nfunction getOffsets(\n start: NodePosition,\n end: NodePosition,\n offset: number\n): NodePosition {\n if (!offset) {\n return { x: 0, y: 0 };\n }\n const { x: x0, y: y0 } = start;\n const { x: x1, y: y1 } = end;\n const distance = Math.sqrt(Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2));\n const ratio = offset / distance;\n return {\n x: (x1 - x0) * ratio,\n y: (y1 - y0) * ratio,\n };\n}\n","import type { NodePosition, NodeRect, PositionTuple } from \"../interfaces\";\nimport { doTwoNodesOverlap } from \"../processors/doTwoNodesOverlap\";\n\ntype LineTuple = [start: PositionTuple, end: PositionTuple];\n\nexport function getDirectLinePoints(\n source: NodeRect,\n target: NodeRect,\n parallelGap?: number\n): NodePosition[] | null {\n // Ignore if two nodes are the same.\n // Ignore if two nodes overlap.\n if (source === target || doTwoNodesOverlap(source, target, 0, 0)) {\n return null;\n }\n\n let p0: PositionTuple;\n let p1: PositionTuple;\n\n let xDiff = 0;\n let yDiff = 0;\n\n if (parallelGap) {\n const dx = target.x - source.x;\n const dy = target.y - source.y;\n const angle = Math.atan2(dy, dx);\n xDiff = (parallelGap / 2) * Math.cos(angle + Math.PI / 2);\n yDiff = (parallelGap / 2) * Math.sin(angle + Math.PI / 2);\n }\n\n const line: LineTuple = [\n [source.x + xDiff, source.y + yDiff],\n [target.x + xDiff, target.y + yDiff],\n ];\n const sourceIntersections = getIntersections(source, line);\n const targetIntersections = getIntersections(target, line);\n\n // Todo: handle when more than one intersection\n if (sourceIntersections.length > 0) {\n p0 = sourceIntersections[0];\n } else {\n p0 = [source.x, source.y];\n }\n if (targetIntersections.length > 0) {\n p1 = targetIntersections[0];\n } else {\n p1 = [target.x, target.y];\n }\n\n return [\n { x: p0[0], y: p0[1] },\n { x: p1[0], y: p1[1] },\n ];\n}\n\nfunction getIntersections(rect: NodeRect, line: LineTuple) {\n const vertices: PositionTuple[] = [\n [rect.x - rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y - rect.height / 2],\n [rect.x + rect.width / 2, rect.y + rect.height / 2],\n [rect.x - rect.width / 2, rect.y + rect.height / 2],\n ];\n const possibleLines: [start: PositionTuple, end: PositionTuple][] = [];\n for (let i = 0; i < 4; i++) {\n possibleLines.push([vertices[i], vertices[(i + 1) % 4]]);\n }\n const intersections: PositionTuple[] = [];\n for (const item of possibleLines) {\n const intersection = intersect(line[0], line[1], item[0], item[1]);\n if (intersection) {\n intersections.push(intersection);\n }\n }\n return intersections;\n}\n\n// https://paulbourke.net/geometry/pointlineplane/javascript.txt\nfunction intersect(\n [x1, y1]: PositionTuple,\n [x2, y2]: PositionTuple,\n [x3, y3]: PositionTuple,\n [x4, y4]: PositionTuple\n): null | PositionTuple {\n // Check if none of the lines are of length 0\n if ((x1 === x2 && y1 === y2) || (x3 === x4 && y3 === y4)) {\n return null;\n }\n\n const denominator = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);\n\n // Lines are parallel\n if (denominator === 0) {\n return null;\n }\n\n const ua = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denominator;\n const ub = ((x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3)) / denominator;\n\n // is the intersection along the segments\n if (ua < 0 || ua > 1 || ub < 0 || ub > 1) {\n return null;\n }\n\n // Return a object with the x and y coordinates of the intersection\n const x = x1 + ua * (x2 - x1);\n const y = y1 + ua * (y2 - y1);\n\n return [x, y];\n}\n","import type { Direction, NodePosition, NodeRect } from \"../interfaces\";\n\nexport function getPolyLinePoints(\n source: NodeRect,\n target: NodeRect,\n sourceDirection: Direction,\n targetDirection: Direction,\n sourcePosition: number,\n targetPosition: number\n): NodePosition[] {\n const p0 = getCoordinates(source, sourceDirection, sourcePosition);\n const p1 = getCoordinates(target, targetDirection, targetPosition);\n\n let c1: NodePosition;\n let c2: NodePosition | undefined;\n switch (sourceDirection) {\n case \"top\":\n case \"bottom\":\n switch (targetDirection) {\n case \"left\":\n case \"right\":\n c1 = { x: p0.x, y: p1.y };\n break;\n default:\n c1 = { x: p0.x, y: (p0.y + p1.y) / 2 };\n c2 = { x: p1.x, y: c1.y };\n }\n break;\n default:\n switch (targetDirection) {\n case \"top\":\n case \"bottom\":\n c1 = { x: p1.x, y: p0.y };\n break;\n default:\n c1 = { x: (p0.x + p1.x) / 2, y: p0.y };\n c2 = { x: c1.x, y: p1.y };\n }\n }\n\n return [p0, c1, c2, p1].filter(Boolean) as NodePosition[];\n}\n\nfunction getCoordinates(\n node: NodeRect,\n direction: Direction,\n position: number\n): NodePosition {\n const { x, y, width, height } = node;\n switch (direction) {\n case \"top\":\n return {\n x: x - width / 2 + width * position,\n y: y - height / 2,\n };\n case \"bottom\":\n return {\n x: x - width / 2 + width * position,\n y: y + height / 2,\n };\n case \"left\":\n return {\n x: x - width / 2,\n y: y - height / 2 + height * position,\n };\n case \"right\":\n return {\n x: x + width / 2,\n y: y - height / 2 + height * position,\n };\n }\n}\n","import type { NodeRect } from \"../interfaces\";\n\nexport function doTwoNodesOverlap(\n a: NodeRect,\n b: NodeRect,\n paddingA: number,\n paddingB: number\n): boolean {\n const A = paddingA ? getNodesWithPadding(a, paddingA) : a;\n const B = paddingB ? getNodesWithPadding(b, paddingB) : b;\n const left = Math.min(A.x - A.width / 2, B.x - B.width / 2);\n const right = Math.max(A.x + A.width / 2, B.x + B.width / 2);\n const top = Math.min(A.y - A.height / 2, B.y - B.height / 2);\n const bottom = Math.max(A.y + A.height / 2, B.y + B.height / 2);\n return right - left < A.width + B.width && bottom - top < A.height + B.height;\n}\n\nfunction getNodesWithPadding(node: NodeRect, padding: number) {\n return {\n x: node.x - node.width / 2 - padding,\n y: node.y - node.height / 2 - padding,\n width: node.width + padding * 2,\n height: node.height + padding * 2,\n };\n}\n","import type { FullRectTuple, PartialRectTuple } from \"../interfaces\";\n\nexport function extractPartialRectTuple(\n value: PartialRectTuple\n): FullRectTuple {\n if (Array.isArray(value)) {\n const v0 = value[0];\n const v1 = value.length > 1 ? value[1]! : v0;\n const v2 = value.length > 2 ? value[2]! : v0;\n const v3 = value.length > 3 ? value[3]! : v1;\n return [v0, v1, v2, v3];\n }\n return new Array(4).fill(value) as FullRectTuple;\n}\n","import type { Cell, NodeCell, DecoratorCell, NodeId } from \"../interfaces\";\nimport { isNodeOrAreaDecoratorCell } from \"./asserts\";\n\nexport function findNodeOrAreaDecorator(\n cells: Cell[],\n id: NodeId\n): NodeCell | DecoratorCell | undefined {\n return cells.find(\n (cell) => isNodeOrAreaDecoratorCell(cell) && cell.id === id\n ) as NodeCell | DecoratorCell | undefined;\n}\n","import React, { useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport { omitBy } from \"lodash\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n EdgeCell,\n EdgeView,\n} from \"./interfaces\";\nimport { getDirectLinePoints } from \"../diagram/lines/getDirectLinePoints\";\nimport type { NodeRect } from \"../diagram/interfaces\";\nimport { findNode } from \"./processors/findNode\";\nimport { isEdgeCell } from \"./processors/asserts\";\nimport { DEFAULT_LINE_INTERACT_ANIMATE_DURATION } from \"./constants\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { nodeViewToNodeRect } from \"../shared/canvas/processors/nodeViewToNodeRect\";\nimport { getSmartLinePoints } from \"../shared/canvas/processors/getSmartLinePoints\";\nimport { findNodeOrAreaDecorator } from \"./processors/findNodeOrAreaDecorator\";\n\nexport interface EdgeComponentProps {\n edge: EdgeCell;\n cells: Cell[];\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n}\n\nexport function EdgeComponent({\n edge,\n cells,\n lineConfMap,\n}: EdgeComponentProps): JSX.Element | null {\n const pathRef = useRef<SVGPathElement>(null);\n const sourceNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.source),\n [cells, edge.source]\n );\n const targetNode = useMemo(\n () => findNodeOrAreaDecorator(cells, edge.target),\n [cells, edge.target]\n );\n const lineConf = useMemo(\n () => ({\n ...lineConfMap.get(edge)!,\n ...omitBy(\n edge.view,\n (value, key) => value === undefined || key === \"$markerUrl\"\n ),\n }),\n [edge, lineConfMap]\n );\n\n const parallelGap = useMemo(() => {\n const hasOppositeEdge = cells.some(\n (cell) =>\n isEdgeCell(cell) &&\n cell.source === edge.target &&\n cell.target === edge.source &&\n !(edge.view?.exitPosition && edge.view.entryPosition)\n );\n return hasOppositeEdge ? lineConf.parallelGap : 0;\n }, [cells, edge, lineConf.parallelGap]);\n\n const padding = 5;\n\n const line = useMemo(() => {\n const points =\n sourceNode &&\n targetNode &&\n sourceNode.view.x != null &&\n targetNode.view.x != null\n ? edge.view?.exitPosition && edge.view.entryPosition\n ? getSmartLinePoints(\n sourceNode.view,\n targetNode.view,\n edge.view as Required<\n Pick<EdgeView, \"exitPosition\" | \"entryPosition\">\n >\n )\n : getDirectLinePoints(\n nodeViewToNodeRect(sourceNode.view, padding),\n nodeViewToNodeRect(targetNode.view, padding),\n parallelGap\n )\n : null;\n const fixedLineType = lineConf.type === \"auto\" ? \"polyline\" : lineConf.type;\n return curveLine(\n points,\n fixedLineType === \"curve\" ? lineConf.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [edge.view, lineConf, parallelGap, sourceNode, targetNode]);\n\n if (!line) {\n // This happens when source or target is not found,\n // or when source or target has not been positioned yet.\n return null;\n }\n\n return (\n <>\n <path\n // This `path` is made for expanding interaction area of graph lines.\n d={line}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={lineConf.interactStrokeWidth}\n />\n <path\n ref={pathRef}\n className={classNames(\"line\", {\n dashed: lineConf.dashed,\n [`${lineConf.dashed ? \"dashed\" : \"solid\"}-animation`]:\n lineConf.animate.useAnimate,\n })}\n style={\n {\n \"--time\": `${lineConf.animate.duration ?? DEFAULT_LINE_INTERACT_ANIMATE_DURATION}s`,\n \"--solid-length\": pathRef.current?.getTotalLength?.(),\n } as React.CSSProperties\n }\n d={line}\n fill=\"none\"\n stroke={lineConf.strokeColor}\n strokeWidth={lineConf.strokeWidth}\n markerStart={lineConf.showStartArrow ? lineConf.$markerUrl : \"\"}\n markerEnd={lineConf.showEndArrow ? lineConf.$markerUrl : \"\"}\n />\n <path className=\"line-active-bg\" d={line} fill=\"none\" />\n </>\n );\n}\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { isEqual } from \"lodash\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport type { NodeBrickCell, NodeBrickConf, NodeCell } from \"./interfaces\";\nimport type { SizeTuple } from \"../diagram/interfaces\";\n\nexport interface NodeComponentProps {\n node: NodeCell;\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n onResize(id: string, size: SizeTuple | null): void;\n}\n\nexport function NodeComponent({\n node,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n onResize,\n}: NodeComponentProps): JSX.Element | null {\n const memoizedData = useDeepMemo({ node: { id: node.id, data: node.data } });\n const specifiedUseBrick = (node as NodeBrickCell).useBrick;\n const observerRef = useRef<ResizeObserver | null>(null);\n\n const useBrick = useMemo(() => {\n return degraded\n ? null\n : specifiedUseBrick ??\n defaultNodeBricks?.find((item) =>\n checkIfByTransform(item, memoizedData)\n )?.useBrick;\n }, [degraded, specifiedUseBrick, defaultNodeBricks, memoizedData]);\n\n const label = useMemo<string>(\n () =>\n degraded\n ? String(\n __secret_internals.legacyDoTransform(\n memoizedData,\n degradedNodeLabel ?? \"<% DATA.node.id %>\"\n )\n )\n : \"\",\n [degraded, degradedNodeLabel, memoizedData]\n );\n\n const refCallback = useCallback(\n (element: HTMLElement | null) => {\n const prevObserver = observerRef.current;\n if (prevObserver) {\n prevObserver.disconnect();\n observerRef.current = null;\n }\n if (element) {\n // Todo: correctly wait for `useBrick` in v3 to be rendered (after layout)\n // Wait a macro task to let `useBrick` to be rendered.\n setTimeout(() => {\n const observer = new ResizeObserver(() => {\n onResize(node.id, [element.offsetWidth, element.offsetHeight]);\n });\n observer.observe(element);\n observerRef.current = observer;\n });\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n const degradedRefCallBack = useCallback(\n (g: SVGGElement | null) => {\n if (g) {\n // istanbul ignore next\n const size =\n process.env.NODE_ENV === \"test\"\n ? { width: 60, height: 60 }\n : g.getBBox();\n onResize(node.id, [size.width, size.height]);\n } else {\n onResize(node.id, null);\n }\n },\n [node.id, onResize]\n );\n\n return useBrick ? (\n <foreignObject\n // Make a large size to avoid the brick inside to be clipped by the foreignObject.\n width={9999}\n height={9999}\n className=\"node\"\n >\n {useBrick && (\n <ReactUseBrick\n useBrick={useBrick}\n data={memoizedData}\n refCallback={refCallback}\n />\n )}\n </foreignObject>\n ) : degraded ? (\n <g className=\"degraded\" ref={degradedRefCallBack}>\n <circle cx={8} cy={8} r={8} />\n <text x={8} y={32}>\n {label}\n </text>\n </g>\n ) : null;\n}\n\nfunction useDeepMemo<T>(value: T): T {\n const [memoizedValue, setMemoizedValue] = useState(value);\n\n useEffect(() => {\n setMemoizedValue((prev) => (isEqual(prev, value) ? prev : value));\n }, [value]);\n\n return memoizedValue;\n}\n","import type { PositionTuple } from \"../../diagram/interfaces\";\nimport type {\n ActiveTarget,\n Cell,\n LayoutOptions,\n DecoratorCell,\n LayoutType,\n NodeCell,\n NodeView,\n} from \"../interfaces\";\nimport type {\n MoveCellPayload,\n ResizeCellPayload,\n} from \"../reducers/interfaces\";\nimport {\n isContainerDecoratorCell,\n isDecoratorCell,\n isEdgeCell,\n isNodeCell,\n} from \"./asserts\";\nimport { cellToTarget } from \"./cellToTarget\";\nimport { normalizeSnapOptions } from \"./normalizeSnapOptions\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport function handleMouseDown(\n event: MouseEvent,\n {\n action,\n cell,\n scale,\n layout,\n layoutOptions,\n activeTarget,\n cells,\n onCellsMoving,\n onCellsMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n }: {\n action: \"move\" | \"resize\";\n cell: Cell;\n scale: number;\n layout?: LayoutType;\n layoutOptions?: LayoutOptions;\n activeTarget: ActiveTarget | null | undefined;\n cells: Cell[];\n onCellsMoving?(info: MoveCellPayload[]): void;\n onCellsMoved?(info: MoveCellPayload[]): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget?(activeTarget: ActiveTarget | null): void;\n }\n) {\n event.stopPropagation();\n // Drag node\n if (action === \"resize\" || !targetIsActive(cell, activeTarget)) {\n onSwitchActiveTarget?.(cellToTarget(cell));\n }\n\n const isAutoLayout = layout === \"force\" || layout === \"dagre\";\n if (isEdgeCell(cell)) {\n return;\n }\n const activeCells: Cell[] = [];\n const actives =\n activeTarget?.type === \"multi\" && action === \"move\"\n ? cells.filter((c) => targetIsActive(c, activeTarget))\n : [cell];\n actives.forEach((a) => {\n activeCells.push(a);\n if (action === \"move\" && isContainerDecoratorCell(a)) {\n activeCells.push(\n ...cells.filter(\n (c) => isNodeCell(c) && c.containerId === a.id && !actives.includes(c)\n )\n );\n }\n });\n const movableActiveCells = activeCells.filter(\n (c) => (isNodeCell(c) && !isAutoLayout) || isDecoratorCell(c)\n ) as (NodeCell | DecoratorCell)[];\n\n if (movableActiveCells.length === 0) {\n return;\n }\n\n const snap = normalizeSnapOptions(layoutOptions?.snap);\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const originals = movableActiveCells.map<{\n cell: NodeCell | DecoratorCell;\n position: PositionTuple;\n center: PositionTuple | null;\n }>((c) => ({\n cell: c,\n position:\n action === \"move\" ? [c.view.x, c.view.y] : [c.view.width, c.view.height],\n center:\n action === \"move\" && !isEdgeCell(c) ? getCenterPosition(c.view) : null,\n }));\n const firstOriginalPosition = originals[0].position;\n let previousPositions = originals.map(({ position }) => position);\n\n // Get the positions of the objects (cells that are not active) to snap to\n let snapToObjectTargets: {\n cell: NodeCell | DecoratorCell;\n center: PositionTuple;\n }[] = [];\n if (action === \"move\" && snap.object) {\n const objectCells = cells.filter(\n (c) => !isEdgeCell(c) && !activeCells.includes(c)\n ) as (NodeCell | DecoratorCell)[];\n snapToObjectTargets = objectCells.map((c) => ({\n cell: c,\n center: getCenterPosition(c.view),\n }));\n }\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [(e.clientX - from[0]) / scale, (e.clientY - from[1]) / scale];\n }\n let moved = false;\n\n const handleMove = (e: MouseEvent, finished?: boolean) => {\n // Respect the scale\n const movement = getMovement(e);\n let newPositions: PositionTuple[];\n let xAlign: [PositionTuple, PositionTuple] | undefined;\n let yAlign: [PositionTuple, PositionTuple] | undefined;\n let xAlignCell: Cell | undefined;\n let yAlignCell: Cell | undefined;\n\n // Use alt key (or option key ⌥ on Mac) to disable snap\n if ((!snap.grid && !snap.object) || e.altKey) {\n // No snap\n newPositions = originals.map(({ position }) => [\n position[0] + movement[0],\n position[1] + movement[1],\n ]);\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n } else {\n // Snap\n let diffX = Infinity;\n let diffY = Infinity;\n const snapMovement: PositionTuple = [...movement];\n\n if (snap.object) {\n const snapToObjectDistance = snap.object.distance;\n let xAlignFrom: PositionTuple | undefined;\n let yAlignFrom: PositionTuple | undefined;\n let xAlignTarget: NodeCell | DecoratorCell | undefined;\n let yAlignTarget: NodeCell | DecoratorCell | undefined;\n let xAlignToY = 0;\n let yAlignToX = 0;\n for (const {\n cell: target,\n center: [x, y],\n } of snapToObjectTargets) {\n for (const { cell: c, center } of originals) {\n const [cx, cy] = center!;\n const dX = Math.abs(cx + movement[0] - x);\n const dY = Math.abs(cy + movement[1] - y);\n const xSnapped = dX < snapToObjectDistance && dX < diffX;\n const ySnapped = dY < snapToObjectDistance && dY < diffY;\n if (xSnapped) {\n diffX = dX;\n snapMovement[0] = x - cx;\n xAlignCell = c;\n xAlignTarget = target;\n xAlignFrom = [x, y];\n xAlignToY = cy;\n }\n if (ySnapped) {\n diffY = dY;\n snapMovement[1] = y - cy;\n yAlignCell = c;\n yAlignTarget = target;\n yAlignFrom = [x, y];\n yAlignToX = cx;\n }\n }\n }\n\n if (xAlignTarget && xAlignTarget === yAlignTarget) {\n // Handle special case when both x and y are snapped to the same target.\n const halfHeight = xAlignTarget.view.height / 2;\n const halfWidth = xAlignTarget.view.width / 2;\n xAlign = [\n [xAlignFrom![0], xAlignFrom![1] - halfHeight],\n [xAlignFrom![0], xAlignFrom![1] + halfHeight],\n ];\n yAlign = [\n [yAlignFrom![0] - halfWidth, yAlignFrom![1]],\n [yAlignFrom![0] + halfWidth, yAlignFrom![1]],\n ];\n } else {\n if (xAlignFrom) {\n xAlign = [xAlignFrom, [xAlignFrom[0], xAlignToY + snapMovement[1]]];\n }\n if (yAlignFrom) {\n yAlign = [yAlignFrom, [yAlignToX + snapMovement[0], yAlignFrom[1]]];\n }\n }\n }\n\n if (snap.grid) {\n const snapToGridSize = snap.grid.size;\n // Use the first cell to decide the snap to grid position\n const firstNewPosition: PositionTuple = [\n Math.round(\n (firstOriginalPosition[0] + movement[0]) / snapToGridSize\n ) * snapToGridSize,\n Math.round(\n (firstOriginalPosition[1] + movement[1]) / snapToGridSize\n ) * snapToGridSize,\n ];\n const snapToGridMovement: PositionTuple = [\n firstNewPosition[0] - firstOriginalPosition[0],\n firstNewPosition[1] - firstOriginalPosition[1],\n ];\n const snapToGridDiffX = Math.abs(snapToGridMovement[0] - movement[0]);\n const snapToGridDiffY = Math.abs(snapToGridMovement[1] - movement[1]);\n if (snapToGridDiffX < diffX) {\n diffX = snapToGridDiffX;\n snapMovement[0] = snapToGridMovement[0];\n xAlign = undefined;\n xAlignCell = undefined;\n }\n if (snapToGridDiffY < diffY) {\n diffY = snapToGridDiffY;\n snapMovement[1] = snapToGridMovement[1];\n yAlign = undefined;\n yAlignCell = undefined;\n }\n }\n\n newPositions = originals.map(({ position }) => [\n Math.round(position[0] + snapMovement[0]),\n Math.round(position[1] + snapMovement[1]),\n ]);\n const changed =\n newPositions[0][0] !== previousPositions[0][0] ||\n newPositions[0][1] !== previousPositions[0][1];\n if (changed) {\n previousPositions = newPositions;\n moved = true;\n }\n }\n\n if (moved) {\n if (action === \"move\") {\n const payloads = originals.map(({ cell: c }, index) => ({\n type: c.type,\n id: c.id,\n x: newPositions[index][0],\n y: newPositions[index][1],\n width: c.view.width,\n height: c.view.height,\n decorator: isDecoratorCell(c) ? c.decorator : undefined,\n guideLines: finished\n ? undefined\n : [\n ...(xAlignCell === c ? [xAlign!] : []),\n ...(yAlignCell === c ? [yAlign!] : []),\n ],\n }));\n (finished ? onCellsMoved : onCellsMoving)?.(payloads);\n } else {\n (finished ? onCellResized : onCellResizing)?.({\n type: cell.type,\n id: cell.id,\n width: newPositions[0][0],\n height: newPositions[0][1],\n });\n }\n }\n };\n\n const onMouseMove = (e: MouseEvent) => {\n handleMove(e);\n };\n const onMouseUp = (e: MouseEvent) => {\n handleMove(e, true);\n moved = false;\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n}\n\nfunction getCenterPosition(view: NodeView): PositionTuple {\n return [view.x + view.width / 2, view.y + view.height / 2];\n}\n","import {\n DEFAULT_SNAP_GRID_SIZE,\n DEFAULT_SNAP_OBJECT_DISTANCE,\n} from \"../constants\";\nimport type {\n SnapOptions,\n SnapToGridOptions,\n SnapToObjectOptions,\n} from \"../interfaces\";\n\nexport interface NormalizedSnapOptions {\n grid: Required<SnapToGridOptions> | null;\n object: Required<SnapToObjectOptions> | null;\n}\n\nexport function normalizeSnapOptions(\n snap: boolean | SnapOptions | undefined\n): NormalizedSnapOptions {\n const intermediateSnap = snap\n ? snap === true\n ? { grid: true, object: true }\n : snap\n : null;\n const snapToGrid = intermediateSnap?.grid\n ? intermediateSnap.grid === true\n ? {}\n : intermediateSnap.grid\n : null;\n const snapToObject = intermediateSnap?.object\n ? intermediateSnap.object === true\n ? {}\n : intermediateSnap.object\n : null;\n return {\n grid: snapToGrid\n ? { size: snapToGrid.size ?? DEFAULT_SNAP_GRID_SIZE }\n : null,\n object: snapToObject\n ? { distance: snapToObject.distance ?? DEFAULT_SNAP_OBJECT_DISTANCE }\n : null,\n };\n}\n","import React, { useEffect } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\n\nexport function DecoratorArea({\n cell,\n transform,\n readOnly,\n layoutOptions,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n}: BasicDecoratorProps): JSX.Element {\n const resizeHandleRef = React.useRef<SVGGElement>(null);\n\n useEffect(() => {\n const resizeHandle = resizeHandleRef.current;\n if (!resizeHandle || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n layoutOptions,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n activeTarget,\n cell,\n cells,\n layoutOptions,\n onCellResized,\n onCellResizing,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n return (\n <g className=\"decorator-area\">\n <rect\n width={cell.view.width}\n height={cell.view.height}\n className=\"area\"\n />\n {!readOnly && (\n <g\n ref={resizeHandleRef}\n className=\"resize-handle\"\n transform={`translate(${cell.view.width - 20} ${cell.view.height - 20})`}\n >\n <rect width={20} height={20} />\n <path d=\"M10 18L18 10 M15 18L18 15\" />\n </g>\n )}\n </g>\n );\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport classNames from \"classnames\";\n\nexport type DecoratorTextProps = Pick<\n BasicDecoratorProps,\n \"cell\" | \"readOnly\" | \"onDecoratorTextEditing\" | \"onDecoratorTextChange\"\n>;\n\nexport function DecoratorText({\n cell,\n readOnly,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: DecoratorTextProps): JSX.Element {\n const label = cell.view.text ?? \"\";\n const [currentLabel, setCurrentLabel] = useState<string>(label);\n const [editingLabel, setEditingLabel] = useState(false);\n const editingLabelInitialized = useRef(false);\n const [shouldEmitLabelChange, setShouldEmitLabelChange] = useState(false);\n const ref = useRef<HTMLDivElement>(null);\n\n const handleEnableEdit = useCallback(\n (e: React.MouseEvent) => {\n if (readOnly) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly]\n );\n\n useEffect(() => {\n const element = ref.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n useEffect(() => {\n const parentElement = ref.current?.parentElement;\n if (parentElement) {\n cell.view.width = parentElement.clientWidth;\n cell.view.height = parentElement.clientHeight;\n }\n }, [currentLabel, cell.id]);\n\n useEffect(() => {\n if (editingLabel && ref.current) {\n ref.current.focus();\n selectAllText(ref.current);\n }\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n useEffect(() => {\n if (editingLabelInitialized.current) {\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n } else {\n editingLabelInitialized.current = true;\n }\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n const handleInput = useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (readOnly) {\n return;\n }\n setCurrentLabel((event.target as HTMLDivElement).textContent!);\n },\n [readOnly]\n );\n\n const handleBlur = useCallback(() => {\n if (readOnly) {\n return;\n }\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n }, [readOnly]);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onDecoratorTextChange?.({\n id: cell.id,\n view: { ...cell.view, text: currentLabel },\n });\n setShouldEmitLabelChange(false);\n }\n }, [cell, currentLabel, onDecoratorTextChange, shouldEmitLabelChange]);\n\n return (\n <foreignObject className=\"decorator-text\">\n <div\n className={classNames(\"text-container\", { editing: editingLabel })}\n onDoubleClick={handleEnableEdit}\n >\n <div\n className=\"text\"\n contentEditable={editingLabel}\n ref={ref}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n );\n}\n\nexport function selectAllText(element: HTMLElement) {\n const range = document.createRange();\n range.selectNodeContents(element);\n const selection = window.getSelection()!;\n selection.removeAllRanges();\n selection.addRange(range);\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { handleMouseDown } from \"../processors/handleMouseDown\";\nimport classNames from \"classnames\";\nimport { get } from \"lodash\";\nimport { selectAllText } from \"./DecoratorText\";\nimport { isNoManualLayout } from \"../processors/asserts\";\nimport { uuidV4 } from \"..\";\n\nexport function DecoratorContainer({\n cell,\n transform,\n readOnly,\n layout,\n view,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element {\n const label = get(cell.view, \"text\", \"\");\n const direction = get(cell.view, \"direction\", \"top\");\n const textRef = useRef<HTMLDivElement>(null);\n const resizeHandleRef = React.useRef<SVGGElement>(null);\n const [editingLabel, setEditingLabel] = useState(false);\n const [currentLabel, setCurrentLabel] = useState<string>(label);\n const [shouldEmitLabelChange, setShouldEmitLabelChange] = useState(false);\n const [recomputation, setRecomputation] = useState<string>();\n const [titleForeignRect, setTitleForeignRect] = useState({\n x: 0,\n y: 0,\n width: cell.view.width,\n height: cell.view.height,\n });\n const handleEnableEdit = useCallback(\n (e: React.MouseEvent) => {\n if (readOnly) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n setEditingLabel(true);\n },\n [readOnly]\n );\n const handleInput = useCallback(\n (event: React.FormEvent<HTMLDivElement>) => {\n if (readOnly) {\n return;\n }\n setCurrentLabel((event.target as HTMLDivElement).textContent!);\n },\n [readOnly]\n );\n\n const handleBlur = useCallback(() => {\n if (readOnly) {\n return;\n }\n setEditingLabel(false);\n setShouldEmitLabelChange(true);\n setRecomputation(uuidV4());\n }, [readOnly]);\n\n useEffect(() => {\n setCurrentLabel(label);\n }, [label]);\n useEffect(() => {\n const element = textRef.current;\n if (element && element.textContent !== currentLabel) {\n element.textContent = currentLabel;\n }\n }, [currentLabel]);\n\n useEffect(() => {\n const textParentEle = textRef.current?.parentElement;\n if (textParentEle) {\n const { clientWidth, clientHeight } = textParentEle;\n if ([\"left\", \"right\"].includes(direction)) {\n const rect = {\n width: clientWidth,\n height: view.height,\n x: direction === \"left\" ? -clientWidth : view.width,\n y: 0,\n };\n setTitleForeignRect(rect);\n } else {\n const rect = {\n width: view.width,\n height: clientHeight,\n x: 0,\n y: direction === \"top\" ? -clientHeight : view.height,\n };\n setTitleForeignRect(rect);\n }\n }\n }, [view, currentLabel, direction, recomputation]);\n\n useEffect(() => {\n if (editingLabel && textRef.current) {\n textRef.current.focus();\n selectAllText(textRef.current);\n }\n onDecoratorTextEditing?.({ id: cell.id, editing: editingLabel });\n }, [cell.id, editingLabel, onDecoratorTextEditing]);\n\n useEffect(() => {\n if (shouldEmitLabelChange) {\n onDecoratorTextChange?.({\n id: cell.id,\n view: { ...view, text: currentLabel },\n });\n setShouldEmitLabelChange(false);\n }\n }, [cell, view, currentLabel, onDecoratorTextChange, shouldEmitLabelChange]);\n\n useEffect(() => {\n const resizeHandle = resizeHandleRef.current;\n if (!resizeHandle || readOnly) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n handleMouseDown(event, {\n action: \"resize\",\n cell,\n scale: transform.k,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n });\n };\n resizeHandle.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n resizeHandle.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n activeTarget,\n cell,\n cells,\n onCellResized,\n onCellResizing,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n return (\n <g className=\"decorator-container\">\n <foreignObject {...titleForeignRect}>\n <div\n className={classNames(\"text-container\", {\n editing: editingLabel,\n [[\"left\", \"right\"].includes(direction) ? \"vertical\" : \"horizontal\"]:\n true,\n })}\n onDoubleClick={handleEnableEdit}\n >\n <div\n className=\"text\"\n contentEditable={editingLabel}\n ref={textRef}\n onInput={handleInput}\n onBlur={handleBlur}\n />\n </div>\n </foreignObject>\n <rect width={view.width} height={view.height} className=\"container\" />\n {!readOnly && !isNoManualLayout(layout) && (\n <g\n ref={resizeHandleRef}\n className=\"resize-handle\"\n transform={`translate(${view.width - 20} ${view.height - 20})`}\n >\n <rect width={20} height={20} />\n <path d=\"M10 18L18 10 M15 18L18 15\" />\n </g>\n )}\n </g>\n );\n}\n","import React from \"react\";\nimport type { BasicDecoratorProps } from \"../interfaces\";\nimport { DecoratorArea } from \"./DecoratorArea\";\nimport { DecoratorText } from \"./DecoratorText\";\nimport { DecoratorContainer } from \"./DecoratorContainer\";\n\nexport function DecoratorComponent({\n cell,\n view,\n transform,\n readOnly,\n layout,\n layoutOptions,\n activeTarget,\n cells,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n}: BasicDecoratorProps): JSX.Element | null {\n let SpecifiedComponent: (props: BasicDecoratorProps) => JSX.Element | null;\n\n switch (cell.decorator) {\n case \"container\":\n SpecifiedComponent = DecoratorContainer;\n break;\n case \"area\":\n SpecifiedComponent = DecoratorArea;\n break;\n case \"text\":\n SpecifiedComponent = DecoratorText;\n break;\n // istanbul ignore next\n default:\n // eslint-disable-next-line no-console\n console.error(`Unknown decorator: ${cell.decorator}`);\n return null;\n }\n\n return (\n <SpecifiedComponent\n cell={cell}\n view={view}\n transform={transform}\n readOnly={readOnly}\n layout={layout}\n layoutOptions={layoutOptions}\n activeTarget={activeTarget}\n cells={cells}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n );\n}\n","import { BaseNodeCell } from \"../interfaces\";\n\nexport function computeContainerRect(cells: BaseNodeCell[]) {\n let minX = Infinity,\n minY = Infinity;\n let maxX = -Infinity,\n maxY = -Infinity;\n cells.forEach((cell) => {\n const { x, y, width, height } = cell.view;\n if (x < minX) minX = x;\n if (y < minY) minY = y;\n if (x + width > maxX) maxX = x + width;\n if (y + height > maxY) maxY = y + height;\n });\n if (![minX, maxX, minY, maxY].some((n) => isFinite(n))) return {};\n const padding = 20;\n const width = maxX - minX + padding * 2;\n const height = maxY - minY + padding * 2;\n return {\n x: minX - padding,\n y: minY - padding,\n width: width,\n height: height,\n };\n}\n","import React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n ActiveTarget,\n Cell,\n CellContextMenuDetail,\n ComputedEdgeLineConf,\n DecoratorTextChangeDetail,\n DecoratorView,\n EdgeCell,\n LayoutOptions,\n LayoutType,\n NodeBrickConf,\n NodeCell,\n} from \"./interfaces\";\nimport {\n isContainerDecoratorCell,\n isDecoratorCell,\n isEdgeCell,\n isNoManualLayout,\n isNodeCell,\n} from \"./processors/asserts\";\nimport { EdgeComponent } from \"./EdgeComponent\";\nimport { NodeComponent } from \"./NodeComponent\";\nimport { handleMouseDown } from \"./processors/handleMouseDown\";\nimport type { MoveCellPayload, ResizeCellPayload } from \"./reducers/interfaces\";\nimport { DecoratorComponent } from \"./decorators\";\nimport { cellToTarget } from \"./processors/cellToTarget\";\nimport type { SizeTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { sameTarget } from \"./processors/sameTarget\";\nimport { targetIsActive } from \"./processors/targetIsActive\";\nimport { computeContainerRect } from \"./processors/computeContainerRect\";\nimport { get } from \"lodash\";\nexport interface CellComponentProps {\n layout: LayoutType;\n layoutOptions?: LayoutOptions;\n cell: Cell;\n cells: Cell[];\n degraded: boolean;\n degradedNodeLabel?: string;\n defaultNodeBricks?: NodeBrickConf[];\n transform: TransformLiteral;\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n activeTarget: ActiveTarget | null | undefined;\n readOnly?: boolean;\n unrelatedCells: Cell[];\n dragNodeToContainerActive?: boolean;\n onCellsMoving?(info: MoveCellPayload[]): void;\n onCellsMoved?(info: MoveCellPayload[]): void;\n onCellResizing?(info: ResizeCellPayload): void;\n onCellResized?(info: ResizeCellPayload): void;\n onSwitchActiveTarget(target: ActiveTarget | null): void;\n onCellContextMenu(detail: CellContextMenuDetail): void;\n onCellClick?(detail: CellContextMenuDetail): void;\n onDecoratorTextEditing?(detail: { id: string; editing: boolean }): void;\n onDecoratorTextChange?(detail: DecoratorTextChangeDetail): void;\n onNodeBrickResize(id: string, size: SizeTuple | null): void;\n onCellMouseEnter?(cell: Cell): void;\n onCellMouseLeave?(cell: Cell): void;\n}\n\nexport function CellComponent({\n layout,\n layoutOptions,\n cell,\n cells,\n degraded,\n degradedNodeLabel,\n defaultNodeBricks,\n lineConfMap,\n activeTarget,\n dragNodeToContainerActive,\n readOnly,\n transform,\n unrelatedCells,\n onCellsMoving,\n onCellsMoved,\n onCellResizing,\n onCellResized,\n onSwitchActiveTarget,\n onCellContextMenu,\n onCellClick,\n onDecoratorTextEditing,\n onDecoratorTextChange,\n onNodeBrickResize,\n onCellMouseEnter,\n onCellMouseLeave,\n}: CellComponentProps): JSX.Element | null {\n const gRef = useRef<SVGGElement>(null);\n const unrelated = useMemo(\n () => unrelatedCells.some((item) => sameTarget(item, cell)),\n [cell, unrelatedCells]\n );\n // `containerRect` is undefined when it's an edge cell.\n const containerRect = useMemo((): DecoratorView | undefined => {\n if (isContainerDecoratorCell(cell) && isNoManualLayout(layout)) {\n const containCells = cells.filter(\n (c): c is NodeCell => isNodeCell(c) && c.containerId === cell.id\n );\n const view = {\n ...cell.view,\n ...computeContainerRect(containCells),\n };\n cell.view = view; //Update the rect container to make sure Lasso gets the correct size\n return view;\n }\n return isEdgeCell(cell)\n ? undefined\n : get(cell, \"view\", { x: 0, y: 0, width: 0, height: 0 });\n }, [layout, cell, cells]);\n\n useEffect(() => {\n const g = gRef.current;\n if (!g) {\n return;\n }\n const onMouseDown = (event: MouseEvent) => {\n if (\n readOnly ||\n (isContainerDecoratorCell(cell) && isNoManualLayout(layout))\n ) {\n event.stopPropagation();\n } else {\n handleMouseDown(event, {\n layout,\n layoutOptions,\n action: \"move\",\n cell,\n scale: transform.k,\n activeTarget,\n cells,\n onCellsMoving,\n onCellsMoved,\n onSwitchActiveTarget,\n });\n }\n };\n g.addEventListener(\"mousedown\", onMouseDown);\n return () => {\n g.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [\n layout,\n layoutOptions,\n cell,\n activeTarget,\n cells,\n onCellsMoved,\n onCellsMoving,\n onSwitchActiveTarget,\n readOnly,\n transform.k,\n ]);\n\n const handleContextMenu = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (readOnly && cell.type === \"decorator\") {\n return;\n }\n event.preventDefault();\n onSwitchActiveTarget(cellToTarget(cell));\n onCellContextMenu({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellContextMenu, onSwitchActiveTarget, readOnly]\n );\n\n const handleCellClick = useCallback(\n (event: React.MouseEvent<SVGGElement>) => {\n if (!onCellClick || cell.type === \"decorator\") {\n return;\n }\n onCellClick({\n cell,\n clientX: event.clientX,\n clientY: event.clientY,\n });\n },\n [cell, onCellClick]\n );\n\n const handleMouseEnter = useCallback(() => {\n onCellMouseEnter?.(cell);\n }, [cell, onCellMouseEnter]);\n\n const handleMouseLeave = useCallback(() => {\n onCellMouseLeave?.(cell);\n }, [cell, onCellMouseLeave]);\n return (\n <g\n className={classNames(\"cell\", {\n active: targetIsActive(cell, activeTarget),\n faded: unrelated,\n \"read-only\": readOnly,\n \"container-active\": dragNodeToContainerActive,\n })}\n ref={gRef}\n transform={\n cell.type === \"edge\" || cell.view.x == null\n ? undefined\n : `translate(${containerRect!.x} ${containerRect!.y})`\n }\n onContextMenu={handleContextMenu}\n onClick={handleCellClick}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n >\n {isNodeCell(cell) ? (\n <NodeComponent\n node={cell}\n degraded={degraded}\n degradedNodeLabel={degradedNodeLabel}\n defaultNodeBricks={defaultNodeBricks}\n onResize={onNodeBrickResize}\n />\n ) : isEdgeCell(cell) ? (\n <EdgeComponent edge={cell} cells={cells} lineConfMap={lineConfMap} />\n ) : isDecoratorCell(cell) ? (\n <DecoratorComponent\n cell={cell}\n view={containerRect!}\n transform={transform}\n readOnly={readOnly}\n layout={layout}\n layoutOptions={layoutOptions}\n activeTarget={activeTarget}\n cells={cells}\n onCellResizing={onCellResizing}\n onCellResized={onCellResized}\n onSwitchActiveTarget={onSwitchActiveTarget}\n onDecoratorTextEditing={onDecoratorTextEditing}\n onDecoratorTextChange={onDecoratorTextChange}\n />\n ) : null}\n </g>\n );\n}\n","import React, { useEffect, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type { ConnectLineState } from \"./interfaces\";\nimport type { PositionTuple, TransformLiteral } from \"../diagram/interfaces\";\n\nexport interface ConnectLineComponentProps {\n connectLineState: ConnectLineState | null;\n transform: TransformLiteral;\n markerEnd: string;\n onConnect(state: ConnectLineState, to: PositionTuple): void;\n}\n\nexport function ConnectLineComponent({\n connectLineState,\n transform,\n markerEnd,\n onConnect,\n}: ConnectLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n\n useEffect(() => {\n if (connectLineState) {\n setConnectLineTo(connectLineState.from);\n }\n }, [connectLineState]);\n\n useEffect(() => {\n if (connectLineState) {\n const onMouseMove = (e: MouseEvent) => {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo([\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ]);\n };\n const onMouseDown = (e: MouseEvent) => {\n e.stopPropagation();\n };\n const onClick = (e: MouseEvent) => {\n e.stopPropagation();\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n reset();\n onConnect(connectLineState, [\n (e.clientX - transform.x - connectLineState.offset[0]) / transform.k,\n (e.clientY - transform.y - connectLineState.offset[1]) / transform.k,\n ]);\n };\n const reset = () => {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mousedown\", onMouseDown, {\n capture: true,\n });\n document.removeEventListener(\"click\", onClick, { capture: true });\n setConnectLineTo(null);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mousedown\", onMouseDown, { capture: true });\n document.addEventListener(\"click\", onClick, { capture: true });\n\n return reset;\n }\n }, [connectLineState, onConnect, transform]);\n\n return (\n <path\n className={classNames(\"connect-line\", {\n connecting:\n !!connectLineState &&\n connectLineTo &&\n // Do not show when the distance of mouse move is less than 5px\n (connectLineTo[0] - connectLineState.from[0]) ** 2 +\n (connectLineTo[1] - connectLineState.from[1]) ** 2 >\n 25,\n })}\n d={\n connectLineState && connectLineTo\n ? `M${connectLineState.from.join(\" \")}L${connectLineTo.join(\" \")}`\n : \"\"\n }\n fill=\"none\"\n stroke=\"gray\"\n strokeWidth={1}\n markerEnd={`url(#${markerEnd})`}\n />\n );\n}\n","import React from \"react\";\nimport type {\n NodeCell,\n NodeConnectPoint,\n SmartConnectLineState,\n} from \"./interfaces\";\nimport type { NodePosition } from \"../diagram/interfaces\";\n\nexport interface HoverState {\n // Currently only support node cell\n cell: NodeCell;\n relativePoints: ReadonlyArray<NodeConnectPoint>;\n points: ReadonlyArray<NodePosition>;\n activePointIndex?: number;\n}\n\nexport const HoverStateContext = React.createContext<{\n rootRef: React.RefObject<SVGSVGElement>;\n smartConnectLineState: SmartConnectLineState | null;\n unsetHoverStateTimeoutRef: React.MutableRefObject<number | null>;\n hoverState: HoverState | null;\n setHoverState: React.Dispatch<React.SetStateAction<HoverState | null>>;\n setSmartConnectLineState: React.Dispatch<\n React.SetStateAction<SmartConnectLineState | null>\n >;\n onConnect?: (\n source: NodeCell,\n target: NodeCell,\n exitPosition: NodePosition,\n entryPosition: NodePosition\n ) => void;\n}>({\n rootRef: { current: null },\n smartConnectLineState: null,\n unsetHoverStateTimeoutRef: { current: null },\n hoverState: null,\n setHoverState: () => {},\n setSmartConnectLineState: () => {},\n});\n\nexport function useHoverStateContext() {\n return React.useContext(HoverStateContext);\n}\n","// istanbul ignore file: experimental\nimport React, { useCallback, useEffect, useMemo, useRef } from \"react\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport type { ActiveTarget, ConnectLineState, NodeCell } from \"./interfaces\";\nimport { targetIsActive } from \"./processors/targetIsActive\";\nimport type { NodePosition, TransformLiteral } from \"../diagram/interfaces\";\n\nconst HELPER_IMAGE =\n \"data:image/svg+xml;base64,PCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj48c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHdpZHRoPSI1cHgiIGhlaWdodD0iNXB4IiB2ZXJzaW9uPSIxLjEiPjxwYXRoIGQ9Im0gMCAwIEwgNSA1IE0gMCA1IEwgNSAwIiBzdHJva2Utd2lkdGg9IjIiIHN0eWxlPSJzdHJva2Utb3BhY2l0eTowLjQiIHN0cm9rZT0iI2ZmZmZmZiIvPjxwYXRoIGQ9Im0gMCAwIEwgNSA1IE0gMCA1IEwgNSAwIiBzdHJva2U9IiMyOWI2ZjIiLz48L3N2Zz4=\";\nconst HELPER_RADIUS = 5;\nconst HELPER_BG_RADIUS = 8;\nconst HALF_HELPER_RADIUS = HELPER_RADIUS / 2;\n\nexport interface LineConnectorComponentProps {\n activeTarget: ActiveTarget | null;\n transform: TransformLiteral;\n smartConnectLineState: ConnectLineState | null;\n disabled?: boolean;\n}\n\nexport function LineConnectorComponent({\n activeTarget,\n transform,\n smartConnectLineState,\n disabled,\n}: LineConnectorComponentProps): JSX.Element | null {\n const { unsetHoverStateTimeoutRef, hoverState, setHoverState } =\n useHoverStateContext();\n\n const unsetTimeout = useCallback(() => {\n if (unsetHoverStateTimeoutRef.current !== null) {\n clearTimeout(unsetHoverStateTimeoutRef.current);\n unsetHoverStateTimeoutRef.current = null;\n }\n }, [unsetHoverStateTimeoutRef]);\n\n const unsetActivePointIndex = useCallback(() => {\n unsetTimeout();\n setHoverState((prev) =>\n prev?.activePointIndex === undefined\n ? prev\n : { ...hoverState!, activePointIndex: undefined }\n );\n }, [hoverState, setHoverState, unsetTimeout]);\n\n const unsetHoverState = useCallback(() => {\n unsetHoverStateTimeoutRef.current = setTimeout(() => {\n setHoverState(null);\n }) as unknown as number;\n }, [setHoverState, unsetHoverStateTimeoutRef]);\n\n const available =\n !disabled &&\n hoverState &&\n (!!smartConnectLineState || !targetIsActive(hoverState.cell, activeTarget));\n\n const transformedPoints = useMemo(\n () =>\n available\n ? hoverState.points.map((p) => ({\n x: p.x * transform.k + transform.x,\n y: p.y * transform.k + transform.y,\n }))\n : null,\n [available, hoverState?.points, transform]\n );\n\n return (\n <g onMouseEnter={unsetActivePointIndex} onMouseLeave={unsetHoverState}>\n {available && (\n <>\n <rect\n x={hoverState.cell.view.x}\n y={hoverState.cell.view.y}\n width={hoverState.cell.view.width}\n height={hoverState.cell.view.height}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={HELPER_BG_RADIUS * 2}\n pointerEvents=\"stroke\"\n />\n <rect\n x={hoverState.cell.view.x}\n y={hoverState.cell.view.y}\n width={hoverState.cell.view.width}\n height={hoverState.cell.view.height}\n fill=\"none\"\n stroke=\"transparent\"\n />\n {hoverState?.activePointIndex !== undefined && (\n <circle\n cx={transformedPoints![hoverState.activePointIndex].x}\n cy={transformedPoints![hoverState.activePointIndex].y}\n r={HELPER_BG_RADIUS}\n fill=\"lightgreen\"\n fillOpacity={0.5}\n pointerEvents=\"none\"\n />\n )}\n {transformedPoints!.map((point, index) => (\n <ConnectPointComponent\n key={index}\n index={index}\n point={point}\n unsetTimeout={unsetTimeout}\n unsetActivePointIndex={unsetActivePointIndex}\n />\n ))}\n </>\n )}\n </g>\n );\n}\n\ninterface ConnectPointComponentProps {\n index: number;\n point: NodePosition;\n unsetTimeout: () => void;\n unsetActivePointIndex: () => void;\n}\n\nfunction ConnectPointComponent({\n index,\n point,\n unsetTimeout,\n unsetActivePointIndex,\n}: ConnectPointComponentProps): JSX.Element {\n const {\n rootRef,\n smartConnectLineState,\n hoverState,\n setHoverState,\n setSmartConnectLineState,\n onConnect,\n } = useHoverStateContext();\n const ref = useRef<SVGGElement>(null);\n\n useEffect(() => {\n const handleMouseEnter = () => {\n unsetTimeout();\n setHoverState({ ...hoverState!, activePointIndex: index });\n };\n const g = ref.current;\n g?.addEventListener(\"mouseenter\", handleMouseEnter);\n return () => {\n g?.removeEventListener(\"mouseenter\", handleMouseEnter);\n };\n }, [hoverState, index, setHoverState, unsetTimeout]);\n\n useEffect(() => {\n const handleMouseDown = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n const rect = rootRef.current!.getBoundingClientRect();\n const originalPoint = hoverState!.points[index];\n // console.log(\"connect\", originalPoint, rect);\n setSmartConnectLineState({\n source: hoverState!.cell as NodeCell,\n from: [originalPoint.x, originalPoint.y],\n offset: [rect.left, rect.top],\n exitPosition: hoverState!.relativePoints[index],\n });\n };\n const g = ref.current;\n g?.addEventListener(\"mousedown\", handleMouseDown);\n return () => {\n g?.removeEventListener(\"mousedown\", handleMouseDown);\n };\n }, [hoverState, index, rootRef, setSmartConnectLineState]);\n\n useEffect(() => {\n const handleMouseUp = (e: MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n if (smartConnectLineState) {\n if (smartConnectLineState.source !== hoverState?.cell) {\n onConnect?.(\n smartConnectLineState.source,\n hoverState!.cell,\n smartConnectLineState.exitPosition,\n hoverState!.relativePoints[hoverState!.activePointIndex!]\n );\n }\n setSmartConnectLineState(null);\n }\n };\n const g = ref.current;\n g?.addEventListener(\"mouseup\", handleMouseUp);\n return () => {\n g?.removeEventListener(\"mouseup\", handleMouseUp);\n };\n }, [smartConnectLineState, hoverState, onConnect, setSmartConnectLineState]);\n\n useEffect(() => {\n const g = ref.current;\n g?.addEventListener(\"mouseleave\", unsetActivePointIndex);\n return () => {\n g?.removeEventListener(\"mouseleave\", unsetActivePointIndex);\n };\n }, [unsetActivePointIndex]);\n\n return (\n <g ref={ref}>\n <circle\n cx={point.x}\n cy={point.y}\n r={HELPER_BG_RADIUS}\n fill=\"transparent\"\n />\n <image\n x={point.x - HALF_HELPER_RADIUS}\n y={point.y - HALF_HELPER_RADIUS}\n width={HELPER_RADIUS}\n height={HELPER_RADIUS}\n xlinkHref={HELPER_IMAGE}\n preserveAspectRatio=\"none\"\n />\n </g>\n );\n}\n","// istanbul ignore file: experimental\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport classNames from \"classnames\";\nimport type {\n ComputedLineConnecterConf,\n SmartConnectLineState,\n} from \"./interfaces\";\nimport type { PositionTuple, TransformLiteral } from \"../diagram/interfaces\";\nimport { curveLine } from \"../diagram/lines/curveLine\";\nimport { useHoverStateContext } from \"./HoverStateContext\";\nimport { getConnectLinePoints } from \"../shared/canvas/processors/getConnectLinePoints\";\n\nexport interface SmartConnectLineComponentProps {\n smartConnectLineState: SmartConnectLineState | null;\n transform: TransformLiteral;\n options: ComputedLineConnecterConf;\n}\n\nexport function SmartConnectLineComponent({\n smartConnectLineState,\n transform,\n options,\n}: SmartConnectLineComponentProps): JSX.Element {\n const [connectLineTo, setConnectLineTo] = useState<PositionTuple | null>(\n null\n );\n const { hoverState, setSmartConnectLineState } = useHoverStateContext();\n\n useEffect(() => {\n if (!smartConnectLineState) {\n return;\n }\n function onMouseMove(e: MouseEvent) {\n // Set connect line to based on the mouse position and the transform\n setConnectLineTo([\n (e.clientX - transform.x - smartConnectLineState!.offset[0]) /\n transform.k,\n (e.clientY - transform.y - smartConnectLineState!.offset[1]) /\n transform.k,\n ]);\n }\n function onMouseUp(e: MouseEvent) {\n e.preventDefault();\n reset();\n }\n function reset() {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n setConnectLineTo(null);\n setSmartConnectLineState(null);\n }\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n\n return reset;\n }, [setSmartConnectLineState, smartConnectLineState, transform]);\n\n const line = useMemo(() => {\n const fixedLineType = options.type === \"auto\" ? \"polyline\" : options.type;\n const points = getConnectLinePoints(\n smartConnectLineState,\n connectLineTo,\n hoverState\n );\n return curveLine(\n points,\n fixedLineType === \"curve\" ? options.curveType : \"curveLinear\",\n 0,\n 1\n );\n }, [connectLineTo, hoverState, smartConnectLineState, options]);\n\n return (\n <path\n className={classNames(\"connect-line\", {\n connecting: !!(smartConnectLineState && connectLineTo),\n })}\n d={line}\n fill=\"none\"\n stroke={options.strokeColor}\n strokeWidth={options.strokeWidth}\n markerStart={options.showStartArrow ? options.$markerUrl : \"\"}\n markerEnd={options.showEndArrow ? options.$markerUrl : \"\"}\n />\n );\n}\n","import type { NodePosition, PositionTuple } from \"../../../diagram/interfaces\";\nimport type { HoverState } from \"../../../draw-canvas/HoverStateContext\";\nimport type { SmartConnectLineState } from \"../../../draw-canvas/interfaces\";\nimport { getSmartLinePoints } from \"./getSmartLinePoints\";\n\nexport function getConnectLinePoints(\n smartConnectLineState: SmartConnectLineState | null,\n connectLineTo: PositionTuple | null,\n hoverState: HoverState | null\n): NodePosition[] | null {\n if (\n !smartConnectLineState ||\n !(connectLineTo || hoverState?.activePointIndex !== undefined)\n ) {\n return null;\n }\n\n const sourceView = smartConnectLineState.source.view;\n if (hoverState?.activePointIndex !== undefined) {\n return getSmartLinePoints(sourceView, hoverState.cell.view, {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: hoverState.relativePoints[hoverState.activePointIndex!],\n });\n }\n\n const [x1, y1] = connectLineTo!;\n if (y1 < sourceView.y) {\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: { x: 0.5, y: 1 },\n }\n );\n }\n\n if (y1 > sourceView.y + sourceView.height) {\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: { x: 0.5, y: 0 },\n }\n );\n }\n\n if (x1 < sourceView.x) {\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: { x: 1, y: 0.5 },\n }\n );\n }\n\n return getSmartLinePoints(\n sourceView,\n { x: x1, y: y1, width: 0, height: 0 },\n {\n exitPosition: smartConnectLineState.exitPosition,\n entryPosition: { x: 0, y: 0.5 },\n }\n );\n}\n","export const SYMBOL_FOR_SIZE_INITIALIZED = Symbol.for(\"size-initialized\");\nexport const SYMBOL_FOR_LAYOUT_INITIALIZED = Symbol.for(\"layout-initialized\");\nexport const DEFAULT_NODE_SIZE = 20;\nexport const DEFAULT_NODE_GAP = 36;\nexport const DEFAULT_AREA_WIDTH = 180;\nexport const DEFAULT_AREA_HEIGHT = 120;\nexport const DEFAULT_SCALE_RANGE_MIN = 0.5;\nexport const DEFAULT_SCALE_RANGE_MAX = 2;\nexport const DEFAULT_LINE_STROKE_COLOR = \"gray\";\nexport const DEFAULT_LINE_STROKE_WIDTH = 1;\nexport const DEFAULT_LINE_INTERACT_STROKE_WIDTH = 15;\nexport const DEFAULT_LINE_INTERACT_SHOW_START_ARROW = false;\nexport const DEFAULT_LINE_INTERACT_SHOW_END_ARROW = true;\nexport const DEFAULT_LINE_INTERACT_ANIMATE_DURATION = 1;\nexport const DEFAULT_DEGRADED_THRESHOLD = 500;\nexport const DEFAULT_SNAP_GRID_SIZE = 10;\nexport const DEFAULT_SNAP_OBJECT_DISTANCE = 5;\n","import type {\n Cell,\n DecoratorCell,\n EdgeCell,\n InitialCell,\n InitialNodeCell,\n LayoutType,\n NodeCell,\n} from \"../interfaces\";\nimport { MoveCellPayload } from \"../reducers/interfaces\";\n\nexport function isNodeCell(cell: Cell | MoveCellPayload): cell is NodeCell {\n return cell.type === \"node\";\n}\n\nexport function isDecoratorCell(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\";\n}\n\nexport function isInitialNodeCell(cell: InitialCell): cell is InitialNodeCell {\n return cell.type === \"node\";\n}\n\nexport function isEdgeCell(cell: Cell): cell is EdgeCell {\n return cell.type === \"edge\";\n}\n\nexport function isNodeOrEdgeCell(cell: Cell): cell is NodeCell | EdgeCell {\n return cell.type === \"node\" || cell.type === \"edge\";\n}\n\nexport function isNodeOrAreaDecoratorCell(\n cell: Cell\n): cell is NodeCell | DecoratorCell {\n return (\n cell.type === \"node\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n}\nexport function isNodeOrTextDecoratorCell(\n cell: Cell | MoveCellPayload\n): cell is NodeCell | DecoratorCell {\n return (\n cell.type === \"node\" ||\n (cell.type === \"decorator\" && cell.decorator === \"text\")\n );\n}\n\nexport function isTextDecoratorCell(cell: Cell): cell is DecoratorCell {\n return cell.type === \"decorator\" && cell.decorator === \"text\";\n}\nexport function isContainerDecoratorCell(\n cell: Cell | MoveCellPayload\n): cell is DecoratorCell {\n return cell.type === \"decorator\" && cell.decorator === \"container\";\n}\n\nexport function isNoManualLayout(layout: LayoutType) {\n return ![\"manual\", undefined].includes(layout!);\n}\n","import { pick } from \"lodash\";\nimport type { ActiveTargetOfSingular, Cell } from \"../interfaces\";\n\nexport function cellToTarget(cell: Cell): ActiveTargetOfSingular {\n return cell.type === \"edge\"\n ? pick(cell, [\"type\", \"source\", \"target\", \"data\"])\n : pick(cell, [\"type\", \"id\", \"data\"]);\n}\n","import type { ActiveTarget, Cell, ConnectLineState } from \"../interfaces\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport function getUnrelatedCells(\n cells: Cell[],\n connectLineState: ConnectLineState | null,\n activeTarget: ActiveTarget | null,\n allowEdgeToArea?: boolean\n): Cell[] {\n const unrelated: Cell[] = [];\n if (connectLineState) {\n const existedTargets = new Set<string>();\n for (const cell of cells) {\n if (cell.type === \"edge\" && cell.source === connectLineState.source.id) {\n existedTargets.add(cell.target);\n }\n }\n for (const cell of cells) {\n switch (cell.type) {\n case \"node\":\n if (existedTargets.has(cell.id)) {\n unrelated.push(cell);\n }\n break;\n case \"decorator\":\n if (\n !allowEdgeToArea ||\n cell.decorator == \"text\" ||\n existedTargets.has(cell.id)\n ) {\n unrelated.push(cell);\n }\n break;\n default:\n unrelated.push(cell);\n }\n }\n } else {\n switch (activeTarget?.type) {\n case \"multi\": {\n const nodesMap = new Map<string, Cell>();\n const activeNodeIds = new Set<string>();\n const relatedNodeIds = new Set<string>();\n for (const active of activeTarget.targets) {\n if (active.type === \"node\") {\n activeNodeIds.add(active.id);\n relatedNodeIds.add(active.id);\n }\n }\n for (const cell of cells) {\n if (cell.type === \"node\") {\n nodesMap.set(cell.id, cell);\n } else if (cell.type === \"edge\") {\n if (activeNodeIds.has(cell.source)) {\n relatedNodeIds.add(cell.target);\n } else if (activeNodeIds.has(cell.target)) {\n relatedNodeIds.add(cell.source);\n } else if (!targetIsActive(cell, activeTarget)) {\n unrelated.push(cell);\n }\n } else if (!targetIsActive(cell, activeTarget)) {\n unrelated.push(cell);\n }\n }\n for (const [id, cell] of nodesMap) {\n if (!relatedNodeIds.has(id)) {\n unrelated.push(cell);\n }\n }\n break;\n }\n\n case \"node\": {\n const nodesMap = new Map<string, Cell>();\n const relatedNodeIds = new Set<string>([activeTarget.id]);\n for (const cell of cells) {\n if (cell.type === \"node\") {\n nodesMap.set(cell.id, cell);\n } else if (cell.type === \"edge\") {\n if (cell.source === activeTarget.id) {\n relatedNodeIds.add(cell.target);\n } else if (cell.target === activeTarget.id) {\n relatedNodeIds.add(cell.source);\n } else {\n unrelated.push(cell);\n }\n } else {\n unrelated.push(cell);\n }\n }\n for (const [id, cell] of nodesMap) {\n if (!relatedNodeIds.has(id)) {\n unrelated.push(cell);\n }\n }\n break;\n }\n\n case \"edge\":\n for (const cell of cells) {\n if (\n !(cell.type === \"edge\"\n ? targetIsActive(cell, activeTarget)\n : cell.type === \"node\" &&\n (cell.id === activeTarget.source ||\n cell.id === activeTarget.target))\n ) {\n unrelated.push(cell);\n }\n }\n break;\n }\n }\n\n return unrelated;\n}\n","import type { ActiveTarget, Cell } from \"../interfaces\";\nimport { targetIsActive } from \"./targetIsActive\";\n\nexport type KeyboardAction = KeyboardActionDeleteCells;\n\nexport interface KeyboardActionDeleteCells {\n action: \"delete-cells\";\n cells: Cell[];\n}\n\nexport function handleKeyboard(\n event: KeyboardEvent,\n {\n cells,\n activeTarget,\n }: {\n cells: Cell[];\n activeTarget: ActiveTarget | null | undefined;\n }\n): KeyboardAction | undefined {\n const activeCells = cells.filter((cell) =>\n targetIsActive(cell, activeTarget)\n );\n\n if (activeCells.length === 0) {\n return;\n }\n\n const key =\n event.key ||\n /* istanbul ignore next: compatibility */ event.keyCode ||\n /* istanbul ignore next: compatibility */ event.which;\n\n switch (key) {\n case \"Backspace\":\n case 8:\n case \"Delete\":\n case 46: {\n event.preventDefault();\n event.stopPropagation();\n return {\n action: \"delete-cells\",\n cells: activeCells,\n };\n }\n }\n}\n","import type { PositionTuple, TransformLiteral } from \"../../diagram/interfaces\";\nimport type { NodeView } from \"../interfaces\";\n\nexport interface HandleLassoOptions {\n transform: TransformLiteral;\n offset: PositionTuple;\n onLassoing(rect: NodeView): void;\n onLassoed(rect: NodeView): void;\n}\n\nexport function handleLasso(\n event: MouseEvent,\n { transform, offset, onLassoing, onLassoed }: HandleLassoOptions\n) {\n if (event.ctrlKey || event.button) {\n return;\n }\n\n event.stopPropagation();\n\n const from: PositionTuple = [event.clientX, event.clientY];\n const x0 = (event.clientX - offset[0] - transform.x) / transform.k;\n const y0 = (event.clientY - offset[1] - transform.y) / transform.k;\n\n function getMovement(e: MouseEvent): PositionTuple {\n return [\n (e.clientX - from[0]) / transform.k,\n (e.clientY - from[1]) / transform.k,\n ];\n }\n\n let moved = false;\n\n const handleMove = (e: MouseEvent, finished?: boolean) => {\n // Respect the scale\n const movement = getMovement(e);\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n }\n if (moved) {\n let [width, height] = movement;\n let x = x0;\n let y = y0;\n if (width < 0) {\n x = x0 + width;\n width = -width;\n }\n if (height < 0) {\n y = y0 + height;\n height = -height;\n }\n (finished ? onLassoed : onLassoing)({\n x,\n y,\n width,\n height,\n });\n }\n };\n\n const onMouseMove = (e: MouseEvent) => {\n handleMove(e);\n };\n const onMouseUp = (e: MouseEvent) => {\n handleMove(e, true);\n moved = false;\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n}\n","import { Cell, DecoratorCell, NodeCell } from \"../interfaces\";\nimport { MoveCellPayload } from \"../reducers/interfaces\";\nimport { isContainerDecoratorCell, isNodeCell } from \"./asserts\";\n\nexport function handleNodeContainedChange(\n payloads: MoveCellPayload[],\n cells: Cell[],\n onContainerContainerChange?: (detail: MoveCellPayload[]) => void\n) {\n const nodeCells = cells.filter((c): c is NodeCell => isNodeCell(c));\n const containerIds = payloads\n .filter((p) => isContainerDecoratorCell(p))\n .map((v) => v.id);\n const nodePayloads = payloads.filter((p) => {\n const nodeCell = nodeCells.find((v) => v.id === p.id)!;\n const includeNodeFlag =\n nodeCell?.containerId && containerIds.includes(nodeCell.containerId);\n return isNodeCell(p) && !includeNodeFlag;\n });\n nodePayloads.forEach((payload) => {\n const left = payload.x;\n const right = payload.x + payload.width!;\n const top = payload.y;\n const bottom = payload.y + payload!.height!;\n const containerDecoratorCells = cells.filter(\n (cell): cell is DecoratorCell => isContainerDecoratorCell(cell)\n );\n for (const containerCell of containerDecoratorCells) {\n const containerLeft = containerCell.view.x;\n const containerRight = containerCell.view.x + containerCell.view.width;\n const containerTop = containerCell.view.y;\n const containerBottom = containerCell.view.y + containerCell.view.height;\n if (\n left >= containerLeft &&\n right <= containerRight &&\n top >= containerTop &&\n bottom <= containerBottom\n ) {\n payload.containerCell = containerCell;\n break; //A node can be associated with only one container\n }\n }\n });\n let containedChanges = [];\n containedChanges = nodePayloads.filter((payload) => {\n const nodeCell = nodeCells.find((c) => c.id === payload.id);\n const containerId = nodeCell?.containerId;\n const containerCellId = payload.containerCell?.id;\n //过滤掉一直没有combo关系或者combo关系没有改变的\n return containerId !== containerCellId;\n });\n if (containedChanges.length > 0) {\n onContainerContainerChange?.(containedChanges);\n }\n return containedChanges;\n}\n","import type { SizeTuple } from \"../../diagram/interfaces\";\nimport type { Cell, InitialCell, NodeCell } from \"../interfaces\";\nimport { isInitialNodeCell } from \"./asserts\";\n\nexport function initializeCells(\n initialCells: InitialCell[] | undefined,\n {\n defaultNodeSize,\n }: {\n defaultNodeSize: SizeTuple;\n }\n): Cell[] {\n const originalCells = initialCells ?? [];\n const finalCells: Cell[] = originalCells.map<Cell>((cell) => {\n if (\n !isInitialNodeCell(cell) ||\n (cell.view?.width !== undefined && cell.view?.height !== undefined)\n ) {\n return cell as NodeCell;\n }\n return {\n ...cell,\n view: {\n width: defaultNodeSize[0],\n height: defaultNodeSize[1],\n ...cell.view,\n },\n } as NodeCell;\n });\n return finalCells;\n}\n","import type {\n ActiveTarget,\n ActiveTargetOfEdge,\n ActiveTargetOfMulti,\n ActiveTargetOfNode,\n} from \"../interfaces\";\n\nexport function sameTarget(\n a: ActiveTarget | null | undefined,\n b: ActiveTarget | null | undefined\n): boolean {\n return a\n ? !!b &&\n a.type === b.type &&\n (a.type === \"multi\"\n ? a.targets.length === (b as ActiveTargetOfMulti).targets.length &&\n a.targets.every((targetA) =>\n (b as ActiveTargetOfMulti).targets.some((targetB) =>\n sameTarget(targetA, targetB)\n )\n )\n : a.type === \"node\" || a.type === \"decorator\"\n ? a.id === (b as ActiveTargetOfNode).id\n : a.source === (b as ActiveTargetOfEdge).source &&\n a.target === (b as ActiveTargetOfEdge).target)\n : !b;\n}\n","import type { ActiveTarget, ActiveTargetOfSingular } from \"../interfaces\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function targetIsActive(\n target: ActiveTargetOfSingular,\n activeTarget: ActiveTarget | null | undefined\n): boolean {\n return (\n !!activeTarget &&\n (activeTarget.type === \"multi\"\n ? activeTarget.targets\n : [activeTarget]\n ).some((active) => sameTarget(active, target))\n );\n}\n","import type { TransformLiteral } from \"../../diagram/interfaces\";\nimport type { Cell } from \"../interfaces\";\nimport { isEdgeCell } from \"./asserts\";\n\nexport interface TransformToCenterOptions {\n canvasWidth: number;\n canvasHeight: number;\n scaleRange?: [min: number, max: number];\n}\n\nexport function transformToCenter(\n cells: Cell[],\n { canvasWidth, canvasHeight, scaleRange }: TransformToCenterOptions\n): TransformLiteral {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n let empty = true;\n for (const cell of cells) {\n if (!isEdgeCell(cell)) {\n empty = false;\n const { view } = cell;\n const r = view.x + view.width;\n const b = view.y + view.height;\n if (view.x < left) {\n left = view.x;\n }\n if (r > right) {\n right = r;\n }\n if (view.y < top) {\n top = view.y;\n }\n if (b > bottom) {\n bottom = b;\n }\n }\n }\n\n const width = right - left;\n const height = bottom - top;\n\n const scale =\n scaleRange && !empty && (width > canvasWidth || height > canvasHeight)\n ? Math.max(\n Math.min(canvasWidth / width, canvasHeight / height, scaleRange[1]),\n scaleRange[0]\n )\n : 1;\n\n const x = empty ? 0 : (canvasWidth - width * scale) / 2 - left * scale;\n const y = empty ? 0 : (canvasHeight - height * scale) / 2 - top * scale;\n\n return { x, y, k: scale };\n}\n","import { without } from \"lodash\";\nimport type {\n RangeTuple,\n SizeTuple,\n TransformLiteral,\n} from \"../../diagram/interfaces\";\nimport { DEFAULT_NODE_GAP, SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\nimport type {\n Cell,\n InitialCell,\n LayoutType,\n NodeCell,\n NodeId,\n NodeView,\n} from \"../interfaces\";\nimport { isDecoratorCell, isEdgeCell, isNodeCell } from \"./asserts\";\nimport { initializeCells } from \"./initializeCells\";\nimport { transformToCenter } from \"./transformToCenter\";\nimport { forceLayout } from \"../../shared/canvas/forceLayout\";\nimport { dagreLayout } from \"../../shared/canvas/dagreLayout\";\nimport { sameTarget } from \"./sameTarget\";\n\nexport function updateCells({\n cells,\n layout,\n previousCells,\n defaultNodeSize,\n canvasWidth,\n canvasHeight,\n scaleRange,\n transform,\n reason,\n parent,\n allowEdgeToArea,\n}: {\n cells: InitialCell[] | undefined;\n layout?: LayoutType;\n previousCells: Cell[];\n defaultNodeSize: SizeTuple;\n canvasWidth: number;\n canvasHeight: number;\n scaleRange: RangeTuple;\n transform: TransformLiteral;\n reason?: \"add-related-nodes\";\n parent?: NodeId;\n allowEdgeToArea?: boolean;\n}): {\n cells: Cell[];\n updated: Cell[];\n shouldReCenter: boolean;\n} {\n const isManualLayout = layout !== \"force\" && layout !== \"dagre\";\n const newCells = initializeCells(cells, { defaultNodeSize });\n const updateCandidates: NodeCell[] = [];\n let shouldReCenter = false;\n\n const previousSizeInitializedNodes = new Map<string, NodeCell>();\n let previousShouldCentered = false;\n for (const cell of previousCells) {\n if (isDecoratorCell(cell)) {\n previousShouldCentered = true;\n } else if (isNodeCell(cell)) {\n previousShouldCentered = true;\n if (cell[SYMBOL_FOR_SIZE_INITIALIZED]) {\n previousSizeInitializedNodes.set(cell.id, cell);\n }\n }\n }\n\n const nodesMap = new Map<string, NodeCell>();\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n nodesMap.set(cell.id, cell);\n const previousNode = previousSizeInitializedNodes.get(cell.id);\n if (previousNode) {\n cell.view.width = previousNode.view.width;\n cell.view.height = previousNode.view.height;\n cell[SYMBOL_FOR_SIZE_INITIALIZED] = true;\n }\n }\n }\n\n let handled = false;\n\n if (reason === \"add-related-nodes\" && parent) {\n // Place these unpositioned downstream nodes below the parent node, and\n // on the right side of the positioned siblings.\n const downstreamNodeIds = new Set<string>();\n for (const cell of newCells) {\n if (\n isEdgeCell(cell) &&\n cell.source === parent &&\n cell.target !== parent\n ) {\n downstreamNodeIds.add(cell.target);\n }\n }\n const parentNode = nodesMap.get(parent);\n if (parentNode?.view.x !== undefined && parentNode.view.y !== undefined) {\n handled = true;\n /**\n * 临时解决一次性添加多层的节点手工布局报错\n */\n if (isManualLayout) {\n for (const cell of newCells) {\n if (\n (isNodeCell(cell) && cell.view.x === undefined) ||\n (isNodeCell(cell) && cell.view.y === undefined)\n ) {\n downstreamNodeIds.add(cell.id);\n }\n }\n }\n const downstreamNodes = [...downstreamNodeIds]\n .map((id) => nodesMap.get(id))\n .filter(Boolean) as NodeCell[];\n let rightMostNode: NodeCell | undefined = undefined;\n for (const node of downstreamNodes) {\n if (node.view.x !== undefined && node.view.y !== undefined) {\n // Find the rightmost node that is below the parent node.\n if (\n (!rightMostNode || node.view.x > rightMostNode.view.x) &&\n node.view.y > parentNode.view.y\n ) {\n rightMostNode = node;\n }\n } else {\n // Unpositioned nodes\n updateCandidates.push(node);\n }\n }\n if (updateCandidates.length > 0 && isManualLayout) {\n let nextX: number;\n let nextY: number;\n if (rightMostNode) {\n // Place unpositioned nodes on the right side of the rightmost positioned siblings.\n nextX =\n rightMostNode.view.x + rightMostNode.view.width + DEFAULT_NODE_GAP;\n nextY = rightMostNode.view.y;\n } else {\n // If there are no positioned siblings, just place them below the parent.\n const totalWidth = updateCandidates.reduce(\n (acc, node) => acc + node.view.width + DEFAULT_NODE_GAP,\n -DEFAULT_NODE_GAP\n );\n nextX =\n parentNode.view.x - totalWidth / 2 + parentNode.view.width / 2;\n nextY = parentNode.view.y + parentNode.view.height + DEFAULT_NODE_GAP;\n }\n for (const node of updateCandidates) {\n node.view.x = nextX;\n node.view.y = nextY;\n nextX += node.view.width + DEFAULT_NODE_GAP;\n }\n }\n }\n }\n\n if (!handled) {\n // By default, place unpositioned nodes in a grid.\n let maxWidth = defaultNodeSize[0];\n let maxHeight = defaultNodeSize[1];\n const positionedNodes: NodeCell[] = [];\n let hasDecorators = false;\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n if (cell.view.width > maxWidth) {\n maxWidth = cell.view.width;\n }\n if (cell.view.height > maxHeight) {\n maxHeight = cell.view.height;\n }\n if (cell.view.x === undefined || cell.view.y === undefined) {\n updateCandidates.push(cell);\n } else {\n positionedNodes.push(cell);\n }\n } else if (isDecoratorCell(cell)) {\n hasDecorators = true;\n }\n }\n\n if (isManualLayout) {\n if (!previousShouldCentered) {\n // If the previous cells are not centered, use the centered transform instead.\n transform = transformToCenter(without(newCells, ...updateCandidates), {\n canvasWidth,\n canvasHeight,\n scaleRange,\n });\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n\n // If there is no positioned nodes, or only one while without decorators,\n // then there is no relative positions, we can place the nodes with dagre layout.\n // Otherwise, use the force layout.\n if (\n positionedNodes.length === 0 ||\n (positionedNodes.length === 1 && !hasDecorators)\n ) {\n // The positioned node (if exists) will be updated.\n updateCandidates.push(...positionedNodes);\n ({ getNodeView } = dagreLayout({ cells: newCells, allowEdgeToArea }));\n // Only re-center when there is no cells previous,\n // or the cell ids are not changed (this happens when updateCells called by backend right after dropNode).\n shouldReCenter =\n previousCells.length === 0 ||\n (previousCells.length === newCells.length &&\n previousCells.every((cell, index) =>\n sameTarget(cell, newCells[index])\n ));\n } else {\n ({ getNodeView } = forceLayout({\n cells: newCells,\n fixedPosition: true,\n allowEdgeToArea,\n center: [\n (canvasWidth / 2 - transform.x) / transform.k,\n (canvasHeight / 2 - transform.y) / transform.k,\n ],\n }));\n }\n\n for (const cell of newCells) {\n if (isNodeCell(cell)) {\n const view = getNodeView(cell.id);\n cell.view.x = view.x;\n cell.view.y = view.y;\n }\n }\n }\n }\n\n return { cells: newCells, updated: updateCandidates, shouldReCenter };\n}\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\nimport type { Cell, NodeCell } from \"../interfaces\";\nimport { isNodeCell } from \"../processors/asserts\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../constants\";\n\nexport const cells: Reducer<Cell[], DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"drop-node\":\n return insertCellAfter(\n state,\n action.payload,\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n );\n case \"drop-decorator\": {\n if (action.payload.decorator === \"text\") {\n return [...state, action.payload];\n }\n return insertCellAfter(\n state,\n action.payload,\n (cell) => cell.type === \"decorator\" && cell.decorator === \"area\"\n );\n }\n case \"add-nodes\": {\n const index =\n state.findLastIndex(\n (cell) => !(cell.type === \"decorator\" && cell.decorator === \"text\")\n ) + 1;\n return [\n ...state.slice(0, index),\n ...action.payload,\n ...state.slice(index),\n ];\n }\n case \"add-edge\":\n // Add the edge to just next to the previous last edge or area decorator.\n // If not found, append to the start.\n return insertCellAfter(\n state,\n action.payload,\n (cell) =>\n cell.type === \"edge\" ||\n (cell.type === \"decorator\" && cell.decorator === \"area\")\n );\n case \"move-cells\": {\n let matched = false;\n const newState = state.map((cell) => {\n const newCell = action.payload.find(\n (move) => cell.type === move.type && cell.id === move.id\n );\n if (newCell) {\n matched = true;\n return {\n ...(cell as NodeCell),\n view: { ...(cell as NodeCell).view, x: newCell.x, y: newCell.y },\n };\n }\n return cell;\n });\n return matched ? newState : state;\n }\n case \"resize-cell\": {\n const { type, id, width, height } = action.payload;\n const index = state.findIndex(\n (cell) => cell.type === type && cell.id === id\n );\n if (index !== -1) {\n const node = state[index] as NodeCell;\n return [\n ...state.slice(0, index),\n { ...node, view: { ...node.view, width, height } },\n ...state.slice(index + 1),\n ];\n }\n return state;\n }\n case \"update-cells\":\n return action.payload;\n case \"update-node-size\":\n return state.map((cell) =>\n isNodeCell(cell) && cell.id === action.payload.id\n ? {\n ...cell,\n [SYMBOL_FOR_SIZE_INITIALIZED]: true,\n view: action.payload.size\n ? {\n ...cell.view,\n width: action.payload.size[0],\n height: action.payload.size[1],\n }\n : cell.view,\n }\n : cell\n );\n }\n return state;\n};\n\nfunction insertCellAfter(\n cells: Cell[],\n newCell: Cell,\n after: (cell: Cell) => boolean\n) {\n const index = cells.findLastIndex(after) + 1;\n return [...cells.slice(0, index), newCell, ...cells.slice(index)];\n}\n","import { Reducer } from \"react\";\nimport type { DrawCanvasAction, DrawCanvasState } from \"./interfaces\";\nimport { cells } from \"./cells\";\nimport { layoutKey } from \"./layoutKey\";\n\ntype ReducersMapObject<S, A> = {\n [K in keyof S]: Reducer<S[K], A>;\n};\n\nfunction combineReducers<S, A>(\n reducers: ReducersMapObject<S, A>\n): Reducer<S, A> {\n return ((state, action) =>\n Object.fromEntries(\n Object.entries<Reducer<any, A>>(reducers).map(([key, value]) => [\n key,\n value(state[key as keyof S], action),\n ])\n )) as Reducer<S, A>;\n}\n\nexport const rootReducer = combineReducers<DrawCanvasState, DrawCanvasAction>({\n cells,\n layoutKey,\n});\n","import type { Reducer } from \"react\";\nimport type { DrawCanvasAction } from \"./interfaces\";\n\nexport const layoutKey: Reducer<number, DrawCanvasAction> = (state, action) => {\n switch (action.type) {\n case \"update-node-size\":\n return action.layoutKey;\n default:\n return state;\n }\n};\n","import * as React from \"react\";\nconst SvgCenter = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={24} height={24} viewBox=\"0 0 24 24\" {...props}><path d=\"M12 0a.5.5 0 0 1 .5.5v2.013a9.5 9.5 0 0 1 8.987 8.988L23.5 11.5a.5.5 0 0 1 0 1h-2.013a9.5 9.5 0 0 1-8.987 8.987V23.5a.5.5 0 0 1-1 0v-2.013A9.5 9.5 0 0 1 2.514 12.5H.5a.5.5 0 0 1 0-1h2.013A9.5 9.5 0 0 1 11.5 2.514V.5A.5.5 0 0 1 12 0M3.514 11.5H7.5a.5.5 0 0 1 0 1H3.514a8.5 8.5 0 0 0 7.987 7.986L11.5 16.5a.5.5 0 0 1 1 0v3.986a8.5 8.5 0 0 0 7.986-7.986H16.5a.5.5 0 0 1 0-1h3.986A8.5 8.5 0 0 0 12.5 3.515V7.5a.5.5 0 0 1-1 0V3.514a8.5 8.5 0 0 0-7.986 7.987zm8.486-1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3\" /></svg>;\nexport default SvgCenter;","import * as React from \"react\";\nconst SvgZoomIn = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4h-204.8V281.6a25.6 25.6 0 1 0-51.2 0v204.8h-204.8a25.6 25.6 0 0 0 0 51.2h204.8v204.8a25.6 25.6 0 0 0 51.2 0V537.6h204.8a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomIn;","import * as React from \"react\";\nconst SvgZoomOut = props => <svg xmlns=\"http://www.w3.org/2000/svg\" width={128} height={128} className=\"icon\" viewBox=\"0 0 1024 1024\" {...props}><path d=\"M512 76.8A435.2 435.2 0 1 0 947.2 512 435.71 435.71 0 0 0 512 76.8m0 819.2a384 384 0 1 1 384-384 384 384 0 0 1-384 384\" /><path d=\"M744.448 486.4H280.064a25.6 25.6 0 1 0 0 51.2h464.384a25.6 25.6 0 0 0 0-51.2\" /></svg>;\nexport default SvgZoomOut;","import React, { useCallback, useMemo, useRef } from \"react\";\nimport { ConfigProvider, Slider, theme } from \"antd\";\nimport { StyleProvider, createCache } from \"@ant-design/cssinjs\";\nimport { useCurrentTheme } from \"@next-core/react-runtime\";\nimport type { RangeTuple } from \"../../diagram/interfaces\";\nimport CenterSVG from \"./icons/center.svg\";\nimport ZoomInSVG from \"./icons/zoom-in.svg\";\nimport ZoomOutSVG from \"./icons/zoom-out.svg\";\n\nexport interface ZoomBarComponentProps {\n shadowRoot: ShadowRoot;\n scale: number;\n scaleRange: RangeTuple;\n onZoomChange(value: number): void;\n onReCenter(): void;\n}\n\nexport function ZoomBarComponent({\n shadowRoot,\n scale,\n scaleRange,\n onZoomChange,\n onReCenter,\n}: ZoomBarComponentProps): JSX.Element | null {\n const currentTheme = useCurrentTheme();\n const cache = useMemo(() => createCache(), []);\n const zoomBarRef = useRef<HTMLDivElement | null>(null);\n const min = scaleRange[0] * 100;\n const max = scaleRange[1] * 100;\n const value = scale * 100;\n const step = 5;\n\n const tooltip = useMemo(() => {\n return {\n formatter: (value: number | undefined) => `${value}%`,\n placement: \"left\" as const,\n getPopupContainer: () => zoomBarRef.current!,\n };\n }, []);\n\n const onZoomIn = useCallback(() => {\n onZoomChange(Math.min(value + step, max));\n }, [max, onZoomChange, value]);\n\n const onZoomOut = useCallback(() => {\n onZoomChange(Math.max(value - step, min));\n }, [min, onZoomChange, value]);\n\n return (\n <ConfigProvider\n theme={{\n algorithm:\n currentTheme === \"dark-v2\"\n ? theme.darkAlgorithm\n : theme.defaultAlgorithm,\n }}\n >\n <StyleProvider\n container={shadowRoot}\n // Auto clear injected styles after unmount\n autoClear\n cache={cache}\n // Set hashPriority to \"high\" to disable `:where()` usage for compatibility\n hashPriority=\"high\"\n >\n <div className=\"zoom-bar\" ref={zoomBarRef}>\n <div className=\"center-button\" onClick={onReCenter} role=\"button\">\n <CenterSVG />\n </div>\n <div className=\"zoom-slider\">\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomIn}>\n <ZoomInSVG />\n </div>\n <Slider\n min={min}\n max={max}\n value={value}\n step={step}\n vertical\n included={false}\n tooltip={tooltip}\n onChange={onZoomChange}\n />\n <div className=\"zoom-button\" role=\"button\" onClick={onZoomOut}>\n <ZoomOutSVG />\n </div>\n </div>\n </div>\n </StyleProvider>\n </ConfigProvider>\n );\n}\n","import { pick } from \"lodash\";\nimport dagre from \"@dagrejs/dagre\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type {\n Cell,\n ForceNode,\n LayoutOptionsDagre,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport {\n isEdgeCell,\n isNodeCell,\n isNodeOrAreaDecoratorCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport type { FullRectTuple } from \"../../diagram/interfaces\";\n\nexport interface DagreLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsDagre;\n allowEdgeToArea?: boolean;\n}\n\nexport function dagreLayout({\n cells,\n layoutOptions,\n allowEdgeToArea,\n}: DagreLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, ...dagreGraphOptions } = {\n nodePadding: 0,\n rankdir: \"TB\",\n ranksep: 50,\n edgesep: 10,\n nodesep: 50,\n // align: undefined,\n ...pick(layoutOptions, [\n \"nodePadding\",\n \"rankdir\",\n \"ranksep\",\n \"edgesep\",\n \"nodesep\",\n \"align\",\n ]),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n\n if (!cells.some(isNodeCell)) {\n // Dagre cannot render empty nodes\n return {\n getNodeView: () => null!,\n nodePaddings,\n };\n }\n\n const graph = new dagre.graphlib.Graph<ForceNode>();\n graph.setGraph(dagreGraphOptions);\n // Default to assigning a new object as a label for each new edge.\n graph.setDefaultEdgeLabel(function () {\n return {};\n });\n for (const cell of cells) {\n if (\n (allowEdgeToArea && isNodeOrAreaDecoratorCell(cell)) ||\n isNodeCell(cell)\n ) {\n graph.setNode(cell.id, {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + nodePaddings[0] + nodePaddings[2],\n });\n } else if (isEdgeCell(cell)) {\n graph.setEdge(cell.source, cell.target);\n }\n }\n dagre.layout(graph);\n\n return {\n getNodeView: (id: NodeId) => graph.node(id),\n nodePaddings,\n };\n}\n","import { pick } from \"lodash\";\nimport {\n forceCollide,\n forceLink,\n forceManyBody,\n forceSimulation,\n forceX,\n forceY,\n type Simulation,\n} from \"d3-force\";\nimport type {\n Cell,\n ForceCollideOptions,\n ForceLink,\n ForceNode,\n LayoutOptionsForce,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport {\n isEdgeCell,\n isNodeCell,\n isNodeOrAreaDecoratorCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport { extractPartialRectTuple } from \"../../diagram/processors/extractPartialRectTuple\";\nimport type { FullRectTuple, PositionTuple } from \"../../diagram/interfaces\";\n\nexport interface ForceLayoutOptions {\n cells: Cell[];\n layoutOptions?: LayoutOptionsForce;\n center?: PositionTuple;\n fixedPosition?: boolean;\n allowEdgeToArea?: boolean;\n}\n\nexport function forceLayout({\n cells,\n layoutOptions,\n center,\n fixedPosition,\n allowEdgeToArea,\n}: ForceLayoutOptions): {\n getNodeView: (id: NodeId) => NodeView;\n nodePaddings: FullRectTuple;\n} {\n const { nodePadding, collide } = {\n nodePadding: 0,\n ...pick(layoutOptions, [\"nodePadding\"]),\n collide:\n layoutOptions?.collide !== false\n ? ({\n radiusDiff: 18,\n strength: 1,\n iterations: 1,\n ...(layoutOptions?.collide === true\n ? null\n : (layoutOptions?.collide as ForceCollideOptions)),\n } as Required<ForceCollideOptions>)\n : (false as const),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n const forceNodes: ForceNode[] = [];\n const forceLinks: ForceLink[] = [];\n const nodesMap = new Map<NodeId, ForceNode>();\n for (const cell of cells) {\n if (\n (allowEdgeToArea && isNodeOrAreaDecoratorCell(cell)) ||\n isNodeCell(cell)\n ) {\n const node: ForceNode = {\n id: cell.id,\n width: cell.view.width + nodePaddings[1] + nodePaddings[3],\n height: cell.view.height + nodePaddings[0] + nodePaddings[2],\n ...(fixedPosition ? { fx: cell.view.x, fy: cell.view.y } : null),\n };\n forceNodes.push(node);\n nodesMap.set(node.id, node);\n } else if (isEdgeCell(cell)) {\n forceLinks.push({ source: cell.source, target: cell.target });\n }\n }\n\n const linkSimulation = forceLink<ForceNode, ForceLink>(forceLinks).id(\n (d) => d.id\n );\n const simulation = forceSimulation<ForceNode, ForceLink>(forceNodes)\n .force(\"link\", linkSimulation)\n .force(\"x\", forceX(center?.[0]))\n .force(\"y\", forceY(center?.[1]))\n .force(\"charge\", forceManyBody());\n\n if (collide) {\n simulation.force(\n \"collide\",\n forceCollide<ForceNode>()\n .radius(\n (d) =>\n Math.sqrt(d.width ** 2 + d.height ** 2) / 2 + collide.radiusDiff\n )\n .strength(collide.strength)\n .iterations(collide.iterations)\n );\n }\n\n simulation.stop();\n manuallyTickToTheEnd(simulation);\n\n return {\n getNodeView: (id: NodeId) => nodesMap.get(id) as NodeView,\n nodePaddings,\n };\n}\n\nfunction manuallyTickToTheEnd(\n simulation: Simulation<ForceNode, ForceLink>\n): void {\n // Manually tick to the end.\n simulation.tick(\n Math.ceil(\n Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())\n )\n );\n}\n","import { pull } from \"lodash\";\nimport type { NodePosition } from \"../../../diagram/interfaces\";\nimport { getConnectPointsOfRectangle } from \"../shapes/Rectangle\";\nimport type { EdgeView, NodeView } from \"../../../draw-canvas/interfaces\";\nimport { getPolyLinePoints } from \"../../../diagram/lines/getPolyLinePoints\";\nimport { nodeViewToNodeRect } from \"./nodeViewToNodeRect\";\n\nconst DEFAULT_DIRECTIONS = [\"right\", \"top\", \"left\", \"bottom\"] as const;\n\nexport function getSmartLinePoints(\n sourceView: NodeView,\n targetView: NodeView,\n {\n exitPosition,\n entryPosition,\n }: Required<Pick<EdgeView, \"exitPosition\" | \"entryPosition\">>\n): NodePosition[] {\n const connectPoints = getConnectPointsOfRectangle();\n\n const originalSourceDirections =\n connectPoints.find((p) => p.x === exitPosition.x && p.y === exitPosition.y)\n ?.d ?? DEFAULT_DIRECTIONS;\n const originalTargetDirections =\n connectPoints.find(\n (p) => p.x === entryPosition.x && p.y === entryPosition.y\n )?.d ?? DEFAULT_DIRECTIONS;\n const sourceDirections = [...originalSourceDirections];\n const targetDirections = [...originalTargetDirections];\n\n const sourceX = sourceView.x + exitPosition.x * sourceView.width;\n const sourceY = sourceView.y + exitPosition.y * sourceView.height;\n const targetX = targetView.x + entryPosition.x * targetView.width;\n const targetY = targetView.y + entryPosition.y * targetView.height;\n\n if (sourceX < targetX) {\n pull(sourceDirections, \"left\");\n pull(targetDirections, \"right\");\n } else {\n pull(sourceDirections, \"right\");\n pull(targetDirections, \"left\");\n }\n\n if (sourceY < targetY) {\n pull(sourceDirections, \"top\");\n pull(targetDirections, \"bottom\");\n } else {\n pull(sourceDirections, \"bottom\");\n pull(targetDirections, \"top\");\n }\n\n const sourceDirection = sourceDirections[0] ?? originalSourceDirections[0];\n const targetDirection = targetDirections[0] ?? originalTargetDirections[0];\n\n const sourcePosition =\n sourceDirection === \"left\" || sourceDirection === \"right\"\n ? exitPosition.y\n : exitPosition.x;\n const targetPosition =\n targetDirection === \"left\" || targetDirection === \"right\"\n ? entryPosition.y\n : entryPosition.x;\n\n return getPolyLinePoints(\n nodeViewToNodeRect(sourceView, 0),\n nodeViewToNodeRect(targetView, 0),\n sourceDirection,\n targetDirection,\n sourcePosition,\n targetPosition\n );\n}\n","import type { NodeRect } from \"../../../diagram/interfaces\";\nimport type { NodeView } from \"../../../draw-canvas/interfaces\";\n\nexport function nodeViewToNodeRect(view: NodeView, padding: number): NodeRect {\n return {\n x: view.x + view.width / 2,\n y: view.y + view.height / 2,\n width: view.width + padding,\n height: view.height + padding,\n };\n}\n","import type { NodeConnectPoint } from \"../../../draw-canvas/interfaces\";\n\n// *--*--*--*--*\n// | |\n// * *\n// | |\n// * Rect *\n// | |\n// * *\n// | |\n// *--*--*--*--*\nconst RectangleRelativeConnectPoints: ReadonlyArray<NodeConnectPoint> = [\n {\n x: 0,\n y: 0,\n d: [\"top\", \"left\"],\n },\n { x: 0.5, y: 0, d: [\"top\"] },\n {\n x: 1,\n y: 0,\n d: [\"top\", \"right\"],\n },\n { x: 0, y: 0.5, d: [\"left\"] },\n { x: 1, y: 0.5, d: [\"right\"] },\n {\n x: 0,\n y: 1,\n d: [\"bottom\", \"left\"],\n },\n { x: 0.5, y: 1, d: [\"bottom\"] },\n {\n x: 1,\n y: 1,\n d: [\"bottom\", \"right\"],\n },\n];\n\nexport function getConnectPointsOfRectangle(): ReadonlyArray<NodeConnectPoint> {\n return RectangleRelativeConnectPoints;\n}\n","import React, { useEffect, useRef, useState } from \"react\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\nimport { sameTarget } from \"../../draw-canvas/processors/sameTarget\";\n\nexport interface UseActiveTargetOptions {\n cellsRef: React.RefObject<SVGGElement>;\n activeTarget?: ActiveTarget | null;\n onActiveTargetChange(target: ActiveTarget | null): void;\n}\n\nexport type UseActiveTargetResult = ActiveTarget | null;\n\nexport function useActiveTarget({\n cellsRef,\n activeTarget: _activeTarget,\n onActiveTargetChange,\n}: UseActiveTargetOptions): UseActiveTargetResult {\n const newActiveTarget = _activeTarget ?? null;\n const [activeTarget, setActiveTarget] = useState<ActiveTarget | null>(\n newActiveTarget\n );\n\n useEffect(() => {\n setActiveTarget((previous) =>\n sameTarget(previous, newActiveTarget) ? previous : newActiveTarget\n );\n }, [newActiveTarget]);\n\n const activeTargetChangeInitialized = useRef(false);\n useEffect(() => {\n if (!activeTargetChangeInitialized.current) {\n activeTargetChangeInitialized.current = true;\n return;\n }\n onActiveTargetChange(activeTarget);\n }, [activeTarget, onActiveTargetChange]);\n\n useEffect(() => {\n if (!activeTarget) {\n return;\n }\n const resetActiveTarget = (e: MouseEvent) => {\n const path = e.composedPath();\n const cellsContainerIndex = path.indexOf(cellsRef.current!);\n // Reset active target to null when clicking outside of the cells container,\n // Or inside the cells container but not on any cell.\n if (cellsContainerIndex <= 0) {\n setActiveTarget(null);\n }\n };\n document.addEventListener(\"click\", resetActiveTarget);\n return () => {\n document.removeEventListener(\"click\", resetActiveTarget);\n };\n }, [activeTarget, cellsRef]);\n\n return activeTarget;\n}\n","import type { AlignOrigin, NormalizedAlignOrigin } from \"../interfaces\";\n\nconst KeywordMap = new Map([\n [\"center\", 0.5],\n [\"left\", 0],\n [\"right\", 1],\n [\"top\", 0],\n [\"bottom\", 1],\n]);\n\nexport function normalizeAlignOrigin(\n alignOrigin: AlignOrigin | undefined\n): NormalizedAlignOrigin {\n const origin = alignOrigin ?? [0.5, 0.5];\n return [\n normalizeAlignAxis(origin[0], \"x\"),\n normalizeAlignAxis(origin[1], \"y\"),\n ];\n}\n\nfunction normalizeAlignAxis(value: string | number, axis: \"x\" | \"y\"): number {\n if (typeof value === \"string\") {\n const newX = KeywordMap.get(value);\n if (newX !== undefined) {\n return newX;\n }\n const matches = value.match(/^(-?\\d+(?:\\.\\d+)?)%$/);\n if (matches) {\n return Number(matches[1]) / 100;\n }\n // eslint-disable-next-line no-console\n console.error(\"Unexpected align origin %s:\", axis, value);\n } else if (typeof value === \"number\") {\n return value;\n } else {\n // eslint-disable-next-line no-console\n console.error(\n \"Unexpected align origin %s, expected %s, received %s:\",\n axis,\n \"string | number\",\n typeof value,\n value\n );\n }\n\n return 0.5;\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport type { ZoomBehavior } from \"d3-zoom\";\nimport type {\n Cell,\n LayoutOptions,\n LayoutOptionsForce,\n LayoutOptionsDagre,\n LayoutType,\n NodeId,\n NodeView,\n} from \"../../draw-canvas/interfaces\";\nimport type { FullRectTuple, RangeTuple } from \"../../diagram/interfaces\";\nimport { useAutoCenter } from \"./useAutoCenter\";\nimport {\n isNodeCell,\n isNodeOrAreaDecoratorCell,\n isNodeOrEdgeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\nimport type { DrawCanvasAction } from \"../../draw-canvas/reducers/interfaces\";\nimport { forceLayout } from \"./forceLayout\";\nimport { dagreLayout } from \"./dagreLayout\";\nimport { normalizeAlignOrigin } from \"../../draw-canvas/processors/normalizeAlignOrigin\";\n\nexport interface UseLayoutOptions {\n layout: LayoutType;\n layoutOptions?: LayoutOptions;\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n layoutKey: number;\n allowEdgeToArea?: boolean;\n dispatch: (value: DrawCanvasAction) => void;\n}\n\nexport function useLayout({\n layout,\n layoutOptions,\n rootRef,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n layoutKey,\n allowEdgeToArea,\n dispatch,\n}: UseLayoutOptions) {\n const [layoutInitialized, setLayoutInitialized] = useState(\n layout !== \"force\" && layout !== \"dagre\"\n );\n\n const layoutKeyRef = useRef(layoutKey);\n\n const getNextLayoutKey = useCallback(() => {\n return ++layoutKeyRef.current;\n }, []);\n\n const [centered, setCentered] = useAutoCenter({\n rootRef,\n layoutInitialized,\n cells,\n zoomable,\n zoomer,\n scaleRange,\n });\n\n const previousLayoutRef = useRef<Cell[] | null>(null);\n\n useEffect(() => {\n // Wait for all nodes to be size-initialized before layout.\n if (\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n ) ||\n // Skip layout if no cells.\n cells.length === 0\n ) {\n return;\n }\n\n if (layout !== \"force\" && layout !== \"dagre\") {\n setLayoutInitialized(true);\n return;\n }\n\n // DO NOT re-layout if layout key mismatched.\n // DO NOT re-layout if nodes and edges not changed.\n if (\n layoutKeyRef.current !== layoutKey ||\n isSameArray(previousLayoutRef.current, cells.filter(isNodeOrEdgeCell))\n ) {\n // Layout key mismatch happens when this effect is performed after\n // update-node-size dispatched but not yet applied.\n // If didn't ignore mismatched layout, it will cause the update-cells\n // action overwrites those update-node-size actions.\n return;\n }\n\n let getNodeView: (id: NodeId) => NodeView;\n let nodePaddings: FullRectTuple;\n\n if (layout === \"force\") {\n ({ getNodeView, nodePaddings } = forceLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsForce,\n allowEdgeToArea,\n }));\n } else {\n ({ getNodeView, nodePaddings } = dagreLayout({\n cells,\n layoutOptions: layoutOptions as LayoutOptionsDagre,\n allowEdgeToArea,\n }));\n }\n\n const alignOrigin = normalizeAlignOrigin(\n (layoutOptions as LayoutOptionsForce | LayoutOptionsDagre)?.alignOrigin\n );\n\n const newCells: Cell[] = cells.map((cell) => {\n if (\n (allowEdgeToArea && isNodeOrAreaDecoratorCell(cell)) ||\n isNodeCell(cell)\n ) {\n const nodeView = getNodeView(cell.id);\n return {\n ...cell,\n view: {\n ...cell.view,\n x: nodeView.x! - nodeView.width * alignOrigin[0] + nodePaddings[3],\n y: nodeView.y! - nodeView.height * alignOrigin[1] + nodePaddings[0],\n },\n [SYMBOL_FOR_LAYOUT_INITIALIZED]: true,\n };\n }\n return cell;\n });\n previousLayoutRef.current = newCells.filter(isNodeOrEdgeCell);\n\n dispatch({ type: \"update-cells\", payload: newCells });\n // setCentered(false);\n setLayoutInitialized(true);\n }, [cells, dispatch, layout, layoutKey, layoutOptions /* , setCentered */]);\n\n return { centered, setCentered, getNextLayoutKey };\n}\n\nfunction isSameArray<T = unknown>(a: T[] | null, b: T[]): boolean {\n return a?.length === b.length && a.every((v, i) => v === b[i]);\n}\n","import React, { useEffect, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { ZoomTransform, type ZoomBehavior } from \"d3-zoom\";\nimport type { RangeTuple } from \"../../diagram/interfaces\";\nimport { SYMBOL_FOR_SIZE_INITIALIZED } from \"../../draw-canvas/constants\";\nimport type { Cell } from \"../../draw-canvas/interfaces\";\nimport {\n isDecoratorCell,\n isNodeCell,\n} from \"../../draw-canvas/processors/asserts\";\nimport { transformToCenter } from \"../../draw-canvas/processors/transformToCenter\";\n\nexport interface UseAutoCenterOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n cells: Cell[];\n layoutInitialized: boolean;\n zoomable?: boolean;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n scaleRange: RangeTuple;\n}\n\nexport type UseAutoCenterResult = [\n centered: boolean,\n setCentered: React.Dispatch<React.SetStateAction<boolean>>,\n];\n\nexport function useAutoCenter({\n rootRef,\n cells,\n layoutInitialized,\n zoomable,\n zoomer,\n scaleRange,\n}: UseAutoCenterOptions): UseAutoCenterResult {\n const [centered, setCentered] = useState(false);\n\n useEffect(() => {\n const root = rootRef.current;\n if (\n !root ||\n !layoutInitialized ||\n centered ||\n !cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell)) ||\n cells.some(\n (cell) => isNodeCell(cell) && !cell[SYMBOL_FOR_SIZE_INITIALIZED]\n )\n ) {\n return;\n }\n const { k, x, y } = transformToCenter(cells, {\n canvasWidth: root.clientWidth,\n canvasHeight: root.clientHeight,\n scaleRange: zoomable ? scaleRange : undefined,\n });\n // istanbul ignore next\n if (process.env.NODE_ENV !== \"test\") {\n // jsdom doesn't support svg baseVal yet.\n // https://github.com/jsdom/jsdom/issues/2531\n zoomer.transform(select(root), new ZoomTransform(k, x, y));\n }\n setCentered(true);\n }, [\n cells,\n centered,\n layoutInitialized,\n rootRef,\n scaleRange,\n zoomable,\n zoomer,\n ]);\n\n useEffect(() => {\n // Reset auto centering when nodes and decorators are all removed.\n if (!cells.some((cell) => isNodeCell(cell) || isDecoratorCell(cell))) {\n setCentered(false);\n }\n }, [cells]);\n\n return [centered, setCentered];\n}\n","import { useMemo } from \"react\";\nimport { __secret_internals, checkIfByTransform } from \"@next-core/runtime\";\nimport { findIndex, isUndefined, omitBy } from \"lodash\";\nimport type {\n Cell,\n ComputedEdgeLineConf,\n ComputedLineConnecterConf,\n EdgeCell,\n EdgeLineConf,\n LineConnecterConf,\n LineMarker,\n} from \"../../draw-canvas/interfaces\";\nimport { isEdgeCell } from \"../../draw-canvas/processors/asserts\";\nimport {\n DEFAULT_LINE_STROKE_COLOR,\n DEFAULT_LINE_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n} from \"../../draw-canvas/constants\";\n\nexport interface UseLineMarkersOptions {\n cells: Cell[];\n defaultEdgeLines: EdgeLineConf[] | undefined;\n markerPrefix: string;\n lineConnector?: LineConnecterConf | boolean;\n}\n\nexport function useLineMarkers({\n cells,\n defaultEdgeLines,\n markerPrefix,\n lineConnector,\n}: UseLineMarkersOptions): {\n lineConfMap: WeakMap<EdgeCell, ComputedEdgeLineConf>;\n lineConnectorConf: ComputedLineConnecterConf | null;\n markers: LineMarker[];\n} {\n return useMemo(() => {\n // Always put the default stroke marker at the first position,\n // since the connecting line will use it.\n const markers: LineMarker[] = [{ strokeColor: DEFAULT_LINE_STROKE_COLOR }];\n\n let lineConnectorConf: ComputedLineConnecterConf | null = null;\n if (lineConnector) {\n lineConnectorConf = {\n ...getDefaultLineConf(),\n ...omitBy(lineConnector === true ? {} : lineConnector, isUndefined),\n } as ComputedLineConnecterConf;\n const markerIndex = addMarker(\n { strokeColor: lineConnectorConf.strokeColor },\n markers\n );\n lineConnectorConf.$markerUrl = `url(#${markerPrefix}${markerIndex})`;\n }\n\n const map = new WeakMap<EdgeCell, ComputedEdgeLineConf>();\n for (const cell of cells) {\n if (isEdgeCell(cell)) {\n const computedLineConf =\n __secret_internals.legacyDoTransform(\n { edge: cell },\n defaultEdgeLines?.find((item) =>\n checkIfByTransform(item, { edge: cell })\n )\n ) ?? {};\n const lineConf = {\n ...getDefaultLineConf(),\n ...omitBy(computedLineConf, isUndefined),\n ...omitBy(cell.view, isUndefined),\n } as ComputedEdgeLineConf;\n if (lineConf.parallelGap === undefined) {\n lineConf.parallelGap = lineConf.interactStrokeWidth;\n }\n const markerIndex = addMarker(\n { strokeColor: lineConf.strokeColor },\n markers\n );\n lineConf.$markerUrl = `url(#${markerPrefix}${markerIndex})`;\n map.set(cell, lineConf);\n }\n }\n return { lineConfMap: map, lineConnectorConf, markers };\n }, [cells, defaultEdgeLines, lineConnector, markerPrefix]);\n}\n\nfunction addMarker(marker: LineMarker, markers: LineMarker[]): number {\n let markerIndex = findIndex(markers, marker);\n if (markerIndex === -1) {\n markerIndex = markers.push(marker) - 1;\n }\n return markerIndex;\n}\n\nfunction getDefaultLineConf() {\n return {\n type: \"auto\",\n dashed: false,\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n strokeWidth: DEFAULT_LINE_STROKE_WIDTH,\n interactStrokeWidth: DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n showStartArrow: DEFAULT_LINE_INTERACT_SHOW_START_ARROW,\n showEndArrow: DEFAULT_LINE_INTERACT_SHOW_END_ARROW,\n animate: {\n useAnimate: false,\n duration: DEFAULT_LINE_INTERACT_ANIMATE_DURATION,\n },\n };\n}\n","import { useMemo } from \"react\";\nimport type { Cell, LayoutType } from \"../../draw-canvas/interfaces\";\nimport { isNodeCell } from \"../../draw-canvas/processors/asserts\";\nimport {\n SYMBOL_FOR_LAYOUT_INITIALIZED,\n SYMBOL_FOR_SIZE_INITIALIZED,\n} from \"../../draw-canvas/constants\";\n\nexport interface UseReadyOptions {\n cells: Cell[];\n layout: LayoutType;\n centered: boolean;\n}\n\nexport function useReady({ cells, layout, centered }: UseReadyOptions) {\n const ready = useMemo(\n () =>\n centered &&\n cells.every(\n (cell) =>\n !isNodeCell(cell) ||\n (cell[SYMBOL_FOR_SIZE_INITIALIZED] &&\n ((layout !== \"force\" && layout !== \"dagre\") ||\n cell[SYMBOL_FOR_LAYOUT_INITIALIZED]))\n ),\n [cells, centered, layout]\n );\n return ready;\n}\n","import React, { useEffect, useMemo, useState } from \"react\";\nimport { select } from \"d3-selection\";\nimport { zoom, type ZoomBehavior } from \"d3-zoom\";\nimport type { RangeTuple, TransformLiteral } from \"../../diagram/interfaces\";\nimport {\n DEFAULT_SCALE_RANGE_MIN,\n DEFAULT_SCALE_RANGE_MAX,\n} from \"../../draw-canvas/constants\";\nimport type { ActiveTarget } from \"../../draw-canvas/interfaces\";\n\nexport interface UseZoomOptions {\n rootRef: React.RefObject<SVGSVGElement>;\n zoomable?: boolean;\n scrollable?: boolean;\n pannable?: boolean;\n draggable?: boolean;\n ctrlDraggable?: boolean;\n scaleRange?: RangeTuple;\n onSwitchActiveTarget?(target: ActiveTarget | null): void;\n}\n\nexport interface UseZoomResult {\n grabbing: boolean;\n transform: TransformLiteral;\n scaleRange: RangeTuple;\n zoomer: ZoomBehavior<SVGSVGElement, unknown>;\n}\n\nexport function useZoom({\n rootRef,\n zoomable,\n scrollable,\n pannable,\n draggable,\n ctrlDraggable,\n scaleRange: _scaleRange,\n onSwitchActiveTarget,\n}: UseZoomOptions): UseZoomResult {\n const [grabbing, setGrabbing] = useState(false);\n const [transform, setTransform] = useState<TransformLiteral>({\n k: 1,\n x: 0,\n y: 0,\n });\n\n const scaleRange = useMemo(\n () =>\n _scaleRange ??\n ([DEFAULT_SCALE_RANGE_MIN, DEFAULT_SCALE_RANGE_MAX] as RangeTuple),\n [_scaleRange]\n );\n\n const zoomer = useMemo(() => zoom<SVGSVGElement, unknown>(), []);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n let moved = false;\n zoomer\n .scaleExtent(zoomable ? scaleRange : [1, 1])\n .on(\"start\", () => {\n moved = false;\n setGrabbing(true);\n })\n .on(\"zoom\", (e: { transform: TransformLiteral }) => {\n moved = true;\n setTransform(e.transform);\n })\n .on(\"end\", () => {\n setGrabbing(false);\n if (!moved) {\n onSwitchActiveTarget?.(null);\n }\n })\n .filter(\n (event) =>\n (event.type === \"wheel\" ||\n (ctrlDraggable ? draggable || event.ctrlKey : !event.ctrlKey)) &&\n !event.button\n );\n }, [\n onSwitchActiveTarget,\n scaleRange,\n zoomable,\n zoomer,\n ctrlDraggable,\n draggable,\n ]);\n\n useEffect(() => {\n if (ctrlDraggable) {\n const onContextMenu = (e: MouseEvent) => {\n if (e.ctrlKey) {\n e.preventDefault();\n }\n };\n document.addEventListener(\"contextmenu\", onContextMenu, true);\n return () => {\n document.removeEventListener(\"contextmenu\", onContextMenu, true);\n };\n }\n }, [ctrlDraggable]);\n\n // istanbul ignore next: d3-zoom currently hard to test\n useEffect(() => {\n const root = rootRef.current;\n if (!root) {\n return;\n }\n\n const rootSelection = select(root);\n\n const unsetZoom = () => {\n rootSelection\n .on(\".zoom\", null)\n .on(\".zoom.custom\", null)\n .on(\"wheel\", null);\n };\n\n if (!(zoomable || scrollable || pannable)) {\n unsetZoom();\n return;\n }\n\n if (zoomable || scrollable) {\n // Do not override default d3 zoom handler.\n // Only handles *panning*\n rootSelection.on(\n \"wheel.zoom.custom\",\n (e: WheelEvent & { wheelDeltaX: number; wheelDeltaY: number }) => {\n // Mac OS trackpad pinch event is emitted as a wheel.zoom and d3.event.ctrlKey set to true\n if (!e.ctrlKey) {\n // Stop immediate propagation for default d3 zoom handler\n e.stopImmediatePropagation();\n if (scrollable) {\n e.preventDefault();\n zoomer.translateBy(\n rootSelection,\n e.wheelDeltaX / 5,\n e.wheelDeltaY / 5\n );\n }\n }\n // zoomer.scaleBy(rootSelection, Math.pow(2, defaultWheelDelta(e)))\n }\n );\n }\n\n rootSelection\n .call(zoomer)\n .on(\"wheel\", (e: WheelEvent) => {\n e.preventDefault();\n })\n .on(\"dblclick.zoom\", null);\n\n if ((!draggable && !ctrlDraggable) || !pannable) {\n rootSelection.on(\"mousedown.zoom\", null);\n }\n\n if (!pannable) {\n rootSelection\n .on(\"touchstart.zoom\", null)\n .on(\"touchmove.zoom\", null)\n .on(\"touchend.zoom\", null);\n }\n\n return unsetZoom;\n }, [\n ctrlDraggable,\n draggable,\n pannable,\n rootRef,\n scrollable,\n zoomable,\n zoomer,\n ]);\n\n return { grabbing, transform, zoomer, scaleRange };\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.zoom-bar{position:absolute;bottom:20px;right:20px;width:40px;scale:0.8}.zoom-slider,\n.center-button{width:100%;display:flex;align-items:center;border:1px solid var(--antd-background-color-base);border-radius:var(--larger-border-radius);box-shadow:var(--connected-overlay-shadow);background-color:var(--color-fill-bg-container-4)}.zoom-slider{height:140px;padding:8px 0;flex-direction:column}[role=\"button\"]{cursor:pointer}.center-button{justify-content:center;margin-bottom:8px;height:40px}.center-button:hover{border-color:var(--antd-btn-default-hover-border-color)}.center-button path{fill:var(--antd-link-hover-color)}.center-button:hover path{fill:var(--palette-blue-7)}.zoom-button{font-size:16px;line-height:0}.zoom-button svg{width:1em;height:1em;fill:var(--antd-link-hover-color)}.zoom-slider .ant-slider-vertical{padding-inline:5px}.zoom-slider .ant-slider-vertical .ant-slider-rail{width:2px}.zoom-slider .ant-slider-vertical .ant-slider-handle{width:6px;height:6px;inset-inline-start:3px}.zoom-slider .ant-slider .ant-slider-handle:hover::before,\n.zoom-slider .ant-slider .ant-slider-handle:focus::before,\n.zoom-slider .ant-slider .ant-slider-handle::before{width:10px;height:10px;inset-inline-start:-2px}.zoom-slider .ant-slider .ant-slider-handle:hover::after,\n.zoom-slider .ant-slider .ant-slider-handle:focus::after,\n.zoom-slider .ant-slider .ant-slider-handle::after{width:6px;height:6px;inset-block-start:0;inset-inline-start:0}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `*{box-sizing:border-box}:host{display:block;position:relative;overflow:hidden;--animation-dasharray:48;--stroke-dashoffset:96;--dasharray:4}:host,\n.root{width:100%;height:100%}:host([hidden]){display:none}.root{opacity:0}.root.ready{opacity:1}.root:focus{outline:none}@keyframes dashedAnimation{0%{stroke-dashoffset:var(--stroke-dashoffset)}to{stroke-dashoffset:0}}@keyframes solidAnimation{to{stroke-dashoffset:0}}.solid-animation{stroke-dasharray:var(--solid-length);stroke-dashoffset:var(--solid-length);animation:solidAnimation var(--time) linear infinite}.dashed-animation{animation:dashedAnimation var(--time) linear infinite}.decorator-area .area,\n.decorator-container .container{fill:rgba(119,141,195,0.1);stroke:none;stroke-width:0}.node,\n.decorator-text{overflow:visible}.cell.active .decorator-area .area,\n.cell.active .decorator-container .container,\n.cell:not(.read-only) .decorator-container .container:hover,\n.allowEdgeToArea .decorator-area .area:hover,\n.cell.active .line-active-bg{stroke:var(--palette-blue-5);stroke-dasharray:var(--dasharray);stroke-width:1}.container-active .decorator-container .container{stroke:var(--palette-blue-5);stroke-width:1}.cell:not(.read-only){-webkit-user-select:none;user-select:none}.resize-handle{cursor:nwse-resize;opacity:0}.resize-handle rect{fill:transparent;stroke:none}.resize-handle path{fill:none;stroke:var(--palette-gray-5);stroke-width:1.5}.cell.active .decorator-area .resize-handle,\n.decorator-area:hover .resize-handle,\n.decorator-container:hover .resize-handle{opacity:1}.connect-line{pointer-events:none}.connect-line:not(.connecting){display:none}.line.dashed{stroke-dasharray:var(--dasharray)}.cell.active .decorator-text .text-container{outline:1px dashed var(--palette-blue-5)}.decorator-text .text-container{width:max-content;padding:0.5em}.decorator-text .text:focus{outline:none}.cell.faded{opacity:0.3}.cell.container-active{opacity:1}.cell .node{pointer-events:none}.cell .node > *{position:fixed;pointer-events:auto}.degraded{pointer-events:bounding-box}.degraded circle{fill:rgb(119,141,195)}.degraded text{text-anchor:middle;fill:var(--antd-text-color)}.cell.active .degraded circle,\n.cell.active .degraded text,\n.degraded:hover circle,\n.degraded:hover text{fill:var(--color-brand)}.decorator-container{--defaultSize:24px}.decorator-container .text-container{display:flex;align-items:center;justify-content:center;padding:0.5em;text-align:center;font-size:16px;background-color:rgba(119,141,195,0.6);overflow:hidden}.decorator-container .horizontal{height:max-content;width:100%}:is(.decorator-container .horizontal) .text{min-height:var(--defaultSize)}.decorator-container .vertical{width:max-content;height:100%;writing-mode:vertical-lr;text-orientation:upright;letter-spacing:4px}:is(.decorator-container .vertical) .text{min-width:var(--defaultSize)}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n"],"names":["MarkerComponent","_ref","Component","id","type","strokeColor","EntityRelationZeroOrOneMarker","EntityRelationZeroOrManyMarker","ArrowMarker","React","_ref2","viewBox","refX","refY","markerWidth","markerHeight","orient","strokeLinejoin","d","stroke","strokeWidth","fill","_ref3","_ref4","curveLine","points","curveType","startOffset","endOffset","Array","isArray","curveFactory","curveLinear","curveBumpX","curveBumpY","curveMonotoneX","curveMonotoneY","curveNatural","curveBasis","startOffsets","getOffsets","endOffsets","length","line","x","index","y","curve","lineFunction","start","end","offset","x0","y0","x1","y1","ratio","Math","sqrt","pow","getDirectLinePoints","source","target","parallelGap","doTwoNodesOverlap","p0","p1","xDiff","yDiff","dx","dy","angle","atan2","cos","PI","sin","sourceIntersections","getIntersections","targetIntersections","rect","vertices","width","height","possibleLines","i","push","intersections","item","intersection","intersect","x2","y2","x3","y3","x4","y4","denominator","ua","ub","getPolyLinePoints","sourceDirection","targetDirection","sourcePosition","targetPosition","getCoordinates","c1","c2","filter","Boolean","node","direction","position","a","b","paddingA","paddingB","A","getNodesWithPadding","B","left","min","right","max","top","bottom","padding","extractPartialRectTuple","value","v0","v1","findNodeOrAreaDecorator","cells","find","cell","isNodeOrAreaDecoratorCell","EdgeComponent","_pathRef$current","_pathRef$current$getT","edge","lineConfMap","pathRef","useRef","sourceNode","useMemo","targetNode","lineConf","get","omitBy","view","key","undefined","some","_edge$view","isEdgeCell","exitPosition","entryPosition","_edge$view2","getSmartLinePoints","nodeViewToNodeRect","fixedLineType","interactStrokeWidth","ref","className","classNames","dashed","animate","useAnimate","style","duration","DEFAULT_LINE_INTERACT_ANIMATE_DURATION","current","getTotalLength","call","markerStart","showStartArrow","$markerUrl","markerEnd","showEndArrow","NodeComponent","degraded","degradedNodeLabel","defaultNodeBricks","onResize","memoizedData","memoizedValue","setMemoizedValue","useState","useEffect","prev","isEqual","useDeepMemo","data","specifiedUseBrick","useBrick","observerRef","_defaultNodeBricks$fi","checkIfByTransform","label","String","__secret_internals","legacyDoTransform","refCallback","useCallback","element","prevObserver","disconnect","setTimeout","observer","ResizeObserver","offsetWidth","offsetHeight","observe","degradedRefCallBack","g","size","getBBox","ReactUseBrick","cx","cy","r","handleMouseDown","event","action","scale","layout","layoutOptions","activeTarget","onCellsMoving","onCellsMoved","onCellResizing","onCellResized","onSwitchActiveTarget","stopPropagation","targetIsActive","cellToTarget","isAutoLayout","activeCells","actives","c","forEach","isContainerDecoratorCell","isNodeCell","containerId","includes","movableActiveCells","isDecoratorCell","snap","intermediateSnap","grid","object","snapToGrid","snapToObject","DEFAULT_SNAP_GRID_SIZE","distance","DEFAULT_SNAP_OBJECT_DISTANCE","normalizeSnapOptions","from","clientX","clientY","originals","map","center","getCenterPosition","firstOriginalPosition","previousPositions","snapToObjectTargets","objectCells","moved","handleMove","e","finished","movement","getMovement","newPositions","xAlign","yAlign","xAlignCell","yAlignCell","altKey","diffX","Infinity","diffY","snapMovement","snapToObjectDistance","xAlignFrom","yAlignFrom","xAlignTarget","yAlignTarget","xAlignToY","yAlignToX","dX","abs","dY","ySnapped","halfHeight","halfWidth","snapToGridSize","firstNewPosition","round","snapToGridMovement","snapToGridDiffX","snapToGridDiffY","_ref6","payloads","_ref5","decorator","guideLines","_ref7","onMouseMove","onMouseUp","document","removeEventListener","addEventListener","DecoratorArea","transform","readOnly","resizeHandleRef","resizeHandle","onMouseDown","k","DecoratorText","onDecoratorTextEditing","onDecoratorTextChange","text","currentLabel","setCurrentLabel","editingLabel","setEditingLabel","editingLabelInitialized","shouldEmitLabelChange","setShouldEmitLabelChange","handleEnableEdit","preventDefault","textContent","_ref$current","parentElement","clientWidth","clientHeight","focus","selectAllText","editing","handleInput","handleBlur","onDoubleClick","contentEditable","onInput","onBlur","range","createRange","selectNodeContents","selection","window","getSelection","removeAllRanges","addRange","DecoratorContainer","textRef","recomputation","setRecomputation","titleForeignRect","setTitleForeignRect","uuidV4","_textRef$current","textParentEle","isNoManualLayout","DecoratorComponent","SpecifiedComponent","console","error","computeContainerRect","minX","minY","maxX","maxY","n","isFinite","CellComponent","dragNodeToContainerActive","unrelatedCells","onCellContextMenu","onCellClick","onNodeBrickResize","onCellMouseEnter","onCellMouseLeave","gRef","unrelated","sameTarget","containerRect","containCells","handleContextMenu","handleCellClick","handleMouseEnter","handleMouseLeave","active","faded","onContextMenu","onClick","onMouseEnter","onMouseLeave","ConnectLineComponent","connectLineState","onConnect","connectLineTo","setConnectLineTo","reset","capture","connecting","join","HoverStateContext","rootRef","smartConnectLineState","unsetHoverStateTimeoutRef","hoverState","setHoverState","setSmartConnectLineState","useHoverStateContext","HELPER_IMAGE","HELPER_RADIUS","HELPER_BG_RADIUS","HALF_HELPER_RADIUS","LineConnectorComponent","disabled","unsetTimeout","clearTimeout","unsetActivePointIndex","activePointIndex","unsetHoverState","available","transformedPoints","p","pointerEvents","fillOpacity","point","ConnectPointComponent","getBoundingClientRect","originalPoint","relativePoints","handleMouseUp","xlinkHref","preserveAspectRatio","SmartConnectLineComponent","options","sourceView","getConnectLinePoints","SYMBOL_FOR_SIZE_INITIALIZED","Symbol","for","SYMBOL_FOR_LAYOUT_INITIALIZED","DEFAULT_NODE_SIZE","DEFAULT_NODE_GAP","DEFAULT_AREA_WIDTH","DEFAULT_AREA_HEIGHT","DEFAULT_SCALE_RANGE_MIN","DEFAULT_SCALE_RANGE_MAX","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_WIDTH","DEFAULT_LINE_INTERACT_STROKE_WIDTH","DEFAULT_LINE_INTERACT_SHOW_START_ARROW","DEFAULT_LINE_INTERACT_SHOW_END_ARROW","DEFAULT_DEGRADED_THRESHOLD","isInitialNodeCell","isNodeOrEdgeCell","isTextDecoratorCell","pick","getUnrelatedCells","allowEdgeToArea","existedTargets","Set","add","has","nodesMap","Map","activeNodeIds","relatedNodeIds","targets","set","handleKeyboard","keyCode","which","handleLasso","onLassoing","onLassoed","ctrlKey","button","handleNodeContainedChange","onContainerContainerChange","nodeCells","containerIds","v","nodePayloads","nodeCell","includeNodeFlag","payload","containerDecoratorCells","containerCell","containerLeft","containerRight","containerTop","containerBottom","containedChanges","_payload$containerCel","initializeCells","initialCells","defaultNodeSize","_cell$view","_cell$view2","every","targetA","targetB","transformToCenter","canvasWidth","canvasHeight","scaleRange","empty","updateCells","previousCells","reason","parent","isManualLayout","newCells","updateCandidates","shouldReCenter","previousSizeInitializedNodes","previousShouldCentered","previousNode","handled","downstreamNodeIds","parentNode","downstreamNodes","rightMostNode","nextX","nextY","totalWidth","reduce","acc","maxWidth","maxHeight","positionedNodes","hasDecorators","getNodeView","without","dagreLayout","forceLayout","fixedPosition","updated","insertCellAfter","newCell","after","findLastIndex","slice","rootReducer","reducers","state","matched","newState","move","findIndex","layoutKey","Object","fromEntries","entries","props","_extends","xmlns","ZoomBarComponent","shadowRoot","onZoomChange","onReCenter","currentTheme","useCurrentTheme","cache","createCache","zoomBarRef","tooltip","formatter","placement","getPopupContainer","onZoomIn","onZoomOut","ConfigProvider","theme","algorithm","darkAlgorithm","defaultAlgorithm","StyleProvider","container","autoClear","hashPriority","role","CenterSVG","ZoomInSVG","Slider","step","vertical","included","onChange","ZoomOutSVG","nodePadding","dagreGraphOptions","rankdir","ranksep","edgesep","nodesep","nodePaddings","graph","dagre","Graph","setGraph","setDefaultEdgeLabel","setNode","setEdge","collide","radiusDiff","strength","iterations","forceNodes","forceLinks","fx","fy","linkSimulation","forceLink","simulation","forceSimulation","force","forceX","forceY","forceManyBody","forceCollide","radius","stop","tick","ceil","log","alphaMin","alphaDecay","manuallyTickToTheEnd","DEFAULT_DIRECTIONS","targetView","_connectPoints$find","_connectPoints$find2","connectPoints","getConnectPointsOfRectangle","originalSourceDirections","originalTargetDirections","sourceDirections","targetDirections","sourceX","sourceY","targetX","targetY","pull","RectangleRelativeConnectPoints","useActiveTarget","cellsRef","_activeTarget","onActiveTargetChange","newActiveTarget","setActiveTarget","previous","activeTargetChangeInitialized","resetActiveTarget","composedPath","indexOf","KeywordMap","normalizeAlignAxis","axis","newX","matches","match","Number","useLayout","zoomable","zoomer","dispatch","layoutInitialized","setLayoutInitialized","layoutKeyRef","getNextLayoutKey","centered","setCentered","root","select","ZoomTransform","useAutoCenter","previousLayoutRef","alignOrigin","origin","normalizeAlignOrigin","nodeView","useLineMarkers","defaultEdgeLines","markerPrefix","lineConnector","markers","lineConnectorConf","getDefaultLineConf","isUndefined","markerIndex","addMarker","WeakMap","computedLineConf","marker","useReady","useZoom","scrollable","pannable","draggable","ctrlDraggable","_scaleRange","grabbing","setGrabbing","setTransform","zoom","scaleExtent","on","rootSelection","unsetZoom","stopImmediatePropagation","translateBy","wheelDeltaX","wheelDeltaY","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}