cullmann.io/themes/blowfish/assets/lib/mermaid/flowDiagram-26e970a7.js.map

1 line
90 KiB
Plaintext

{"version":3,"file":"flowDiagram-26e970a7.js","sources":["../../../node_modules/.pnpm/d3-fetch@3.0.1/node_modules/d3-fetch/src/text.js","../../../node_modules/.pnpm/d3-fetch@3.0.1/node_modules/d3-fetch/src/xml.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/arrows.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/label/add-svg-label.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/label/add-text-label.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/label/add-label.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/create-clusters.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/create-edge-labels.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-node.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/create-edge-paths.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/create-nodes.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/position-clusters.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/position-edge-labels.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/position-nodes.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-ellipse.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-circle.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-line.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-polygon.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/intersect/intersect-rect.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/shapes.js","../../../node_modules/.pnpm/dagre-d3-es@7.0.9/node_modules/dagre-d3-es/src/dagre-js/render.js","../src/diagrams/flowchart/flowChartShapes.js","../src/diagrams/flowchart/flowRenderer.js","../src/diagrams/flowchart/flowDiagram.ts"],"sourcesContent":["function responseText(response) {\n if (!response.ok) throw new Error(response.status + \" \" + response.statusText);\n return response.text();\n}\n\nexport default function(input, init) {\n return fetch(input, init).then(responseText);\n}\n","import text from \"./text.js\";\n\nfunction parser(type) {\n return (input, init) => text(input, init)\n .then(text => (new DOMParser).parseFromString(text, type));\n}\n\nexport default parser(\"application/xml\");\n\nexport var html = parser(\"text/html\");\n\nexport var svg = parser(\"image/svg+xml\");\n","import * as util from './util.js';\n\nexport { arrows, setArrows };\n\nvar arrows = {\n normal,\n vee,\n undirected,\n};\n\nfunction setArrows(value) {\n arrows = value;\n}\n\nfunction normal(parent, id, edge, type) {\n var marker = parent\n .append('marker')\n .attr('id', id)\n .attr('viewBox', '0 0 10 10')\n .attr('refX', 9)\n .attr('refY', 5)\n .attr('markerUnits', 'strokeWidth')\n .attr('markerWidth', 8)\n .attr('markerHeight', 6)\n .attr('orient', 'auto');\n\n var path = marker\n .append('path')\n .attr('d', 'M 0 0 L 10 5 L 0 10 z')\n .style('stroke-width', 1)\n .style('stroke-dasharray', '1,0');\n util.applyStyle(path, edge[type + 'Style']);\n if (edge[type + 'Class']) {\n path.attr('class', edge[type + 'Class']);\n }\n}\n\nfunction vee(parent, id, edge, type) {\n var marker = parent\n .append('marker')\n .attr('id', id)\n .attr('viewBox', '0 0 10 10')\n .attr('refX', 9)\n .attr('refY', 5)\n .attr('markerUnits', 'strokeWidth')\n .attr('markerWidth', 8)\n .attr('markerHeight', 6)\n .attr('orient', 'auto');\n\n var path = marker\n .append('path')\n .attr('d', 'M 0 0 L 10 5 L 0 10 L 4 5 z')\n .style('stroke-width', 1)\n .style('stroke-dasharray', '1,0');\n util.applyStyle(path, edge[type + 'Style']);\n if (edge[type + 'Class']) {\n path.attr('class', edge[type + 'Class']);\n }\n}\n\nfunction undirected(parent, id, edge, type) {\n var marker = parent\n .append('marker')\n .attr('id', id)\n .attr('viewBox', '0 0 10 10')\n .attr('refX', 9)\n .attr('refY', 5)\n .attr('markerUnits', 'strokeWidth')\n .attr('markerWidth', 8)\n .attr('markerHeight', 6)\n .attr('orient', 'auto');\n\n var path = marker\n .append('path')\n .attr('d', 'M 0 5 L 10 5')\n .style('stroke-width', 1)\n .style('stroke-dasharray', '1,0');\n util.applyStyle(path, edge[type + 'Style']);\n if (edge[type + 'Class']) {\n path.attr('class', edge[type + 'Class']);\n }\n}\n","import * as util from '../util.js';\n\nexport { addSVGLabel };\n\nfunction addSVGLabel(root, node) {\n var domNode = root;\n\n domNode.node().appendChild(node.label);\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n","import * as util from '../util.js';\n\nexport { addTextLabel };\n\n/*\n * Attaches a text label to the specified root. Handles escape sequences.\n */\nfunction addTextLabel(root, node) {\n var domNode = root.append('text');\n\n var lines = processEscapeSequences(node.label).split('\\n');\n for (var i = 0; i < lines.length; i++) {\n domNode\n .append('tspan')\n .attr('xml:space', 'preserve')\n .attr('dy', '1em')\n .attr('x', '1')\n .text(lines[i]);\n }\n\n util.applyStyle(domNode, node.labelStyle);\n\n return domNode;\n}\n\nfunction processEscapeSequences(text) {\n var newText = '';\n var escaped = false;\n var ch;\n for (var i = 0; i < text.length; ++i) {\n ch = text[i];\n if (escaped) {\n switch (ch) {\n case 'n':\n newText += '\\n';\n break;\n default:\n newText += ch;\n }\n escaped = false;\n } else if (ch === '\\\\') {\n escaped = true;\n } else {\n newText += ch;\n }\n }\n return newText;\n}\n","import { addHtmlLabel } from './add-html-label.js';\nimport { addSVGLabel } from './add-svg-label.js';\nimport { addTextLabel } from './add-text-label.js';\n\nexport { addLabel };\n\nfunction addLabel(root, node, location) {\n var label = node.label;\n var labelSvg = root.append('g');\n\n // Allow the label to be a string, a function that returns a DOM element, or\n // a DOM element itself.\n if (node.labelType === 'svg') {\n addSVGLabel(labelSvg, node);\n } else if (typeof label !== 'string' || node.labelType === 'html') {\n addHtmlLabel(labelSvg, node);\n } else {\n addTextLabel(labelSvg, node);\n }\n\n var labelBBox = labelSvg.node().getBBox();\n var y;\n switch (location) {\n case 'top':\n y = -node.height / 2;\n break;\n case 'bottom':\n y = node.height / 2 - labelBBox.height;\n break;\n default:\n y = -labelBBox.height / 2;\n }\n labelSvg.attr('transform', 'translate(' + -labelBBox.width / 2 + ',' + y + ')');\n\n return labelSvg;\n}\n","import * as d3 from 'd3';\nimport { addLabel } from './label/add-label.js';\nimport * as util from './util.js';\n\nexport { createClusters, setCreateClusters };\n\nvar createClusters = function (selection, g) {\n var clusters = g.nodes().filter(function (v) {\n return util.isSubgraph(g, v);\n });\n var svgClusters = selection.selectAll('g.cluster').data(clusters, function (v) {\n return v;\n });\n\n util.applyTransition(svgClusters.exit(), g).style('opacity', 0).remove();\n\n var enterSelection = svgClusters\n .enter()\n .append('g')\n .attr('class', 'cluster')\n .attr('id', function (v) {\n var node = g.node(v);\n return node.id;\n })\n .style('opacity', 0)\n .each(function (v) {\n var node = g.node(v);\n var thisGroup = d3.select(this);\n d3.select(this).append('rect');\n var labelGroup = thisGroup.append('g').attr('class', 'label');\n addLabel(labelGroup, node, node.clusterLabelPos);\n });\n\n svgClusters = svgClusters.merge(enterSelection);\n\n svgClusters = util.applyTransition(svgClusters, g).style('opacity', 1);\n\n svgClusters.selectAll('rect').each(function (c) {\n var node = g.node(c);\n var domCluster = d3.select(this);\n util.applyStyle(domCluster, node.style);\n });\n\n return svgClusters;\n};\n\nfunction setCreateClusters(value) {\n createClusters = value;\n}\n","import * as d3 from 'd3';\nimport * as _ from 'lodash-es';\nimport { addLabel } from './label/add-label.js';\nimport * as util from './util.js';\n\nexport { createEdgeLabels, setCreateEdgeLabels };\n\nlet createEdgeLabels = function (selection, g) {\n var svgEdgeLabels = selection\n .selectAll('g.edgeLabel')\n .data(g.edges(), function (e) {\n return util.edgeToId(e);\n })\n .classed('update', true);\n\n svgEdgeLabels.exit().remove();\n svgEdgeLabels.enter().append('g').classed('edgeLabel', true).style('opacity', 0);\n\n svgEdgeLabels = selection.selectAll('g.edgeLabel');\n\n svgEdgeLabels.each(function (e) {\n var root = d3.select(this);\n root.select('.label').remove();\n var edge = g.edge(e);\n var label = addLabel(root, g.edge(e), 0).classed('label', true);\n var bbox = label.node().getBBox();\n\n if (edge.labelId) {\n label.attr('id', edge.labelId);\n }\n if (!_.has(edge, 'width')) {\n edge.width = bbox.width;\n }\n if (!_.has(edge, 'height')) {\n edge.height = bbox.height;\n }\n });\n\n var exitSelection;\n\n if (svgEdgeLabels.exit) {\n exitSelection = svgEdgeLabels.exit();\n } else {\n exitSelection = svgEdgeLabels.selectAll(null); // empty selection\n }\n\n util.applyTransition(exitSelection, g).style('opacity', 0).remove();\n\n return svgEdgeLabels;\n};\n\nfunction setCreateEdgeLabels(value) {\n createEdgeLabels = value;\n}\n","export { intersectNode };\n\nfunction intersectNode(node, point) {\n return node.intersect(point);\n}\n","import * as d3 from 'd3';\nimport * as _ from 'lodash-es';\nimport { intersectNode } from './intersect/intersect-node.js';\nimport * as util from './util.js';\n\nexport { createEdgePaths, setCreateEdgePaths };\n\nvar createEdgePaths = function (selection, g, arrows) {\n var previousPaths = selection\n .selectAll('g.edgePath')\n .data(g.edges(), function (e) {\n return util.edgeToId(e);\n })\n .classed('update', true);\n\n var newPaths = enter(previousPaths, g);\n exit(previousPaths, g);\n\n var svgPaths = previousPaths.merge !== undefined ? previousPaths.merge(newPaths) : previousPaths;\n util.applyTransition(svgPaths, g).style('opacity', 1);\n\n // Save DOM element in the path group, and set ID and class\n svgPaths.each(function (e) {\n var domEdge = d3.select(this);\n var edge = g.edge(e);\n edge.elem = this;\n\n if (edge.id) {\n domEdge.attr('id', edge.id);\n }\n\n util.applyClass(\n domEdge,\n edge['class'],\n (domEdge.classed('update') ? 'update ' : '') + 'edgePath'\n );\n });\n\n svgPaths.selectAll('path.path').each(function (e) {\n var edge = g.edge(e);\n edge.arrowheadId = _.uniqueId('arrowhead');\n\n var domEdge = d3\n .select(this)\n .attr('marker-end', function () {\n return 'url(' + makeFragmentRef(location.href, edge.arrowheadId) + ')';\n })\n .style('fill', 'none');\n\n util.applyTransition(domEdge, g).attr('d', function (e) {\n return calcPoints(g, e);\n });\n\n util.applyStyle(domEdge, edge.style);\n });\n\n svgPaths.selectAll('defs *').remove();\n svgPaths.selectAll('defs').each(function (e) {\n var edge = g.edge(e);\n var arrowhead = arrows[edge.arrowhead];\n arrowhead(d3.select(this), edge.arrowheadId, edge, 'arrowhead');\n });\n\n return svgPaths;\n};\n\nfunction setCreateEdgePaths(value) {\n createEdgePaths = value;\n}\n\nfunction makeFragmentRef(url, fragmentId) {\n var baseUrl = url.split('#')[0];\n return baseUrl + '#' + fragmentId;\n}\n\nfunction calcPoints(g, e) {\n var edge = g.edge(e);\n var tail = g.node(e.v);\n var head = g.node(e.w);\n var points = edge.points.slice(1, edge.points.length - 1);\n points.unshift(intersectNode(tail, points[0]));\n points.push(intersectNode(head, points[points.length - 1]));\n\n return createLine(edge, points);\n}\n\nfunction createLine(edge, points) {\n // @ts-expect-error\n var line = (d3.line || d3.svg.line)()\n .x(function (d) {\n return d.x;\n })\n .y(function (d) {\n return d.y;\n });\n\n (line.curve || line.interpolate)(edge.curve);\n\n return line(points);\n}\n\nfunction getCoords(elem) {\n var bbox = elem.getBBox();\n var matrix = elem.ownerSVGElement\n .getScreenCTM()\n .inverse()\n .multiply(elem.getScreenCTM())\n .translate(bbox.width / 2, bbox.height / 2);\n return { x: matrix.e, y: matrix.f };\n}\n\nfunction enter(svgPaths, g) {\n var svgPathsEnter = svgPaths.enter().append('g').attr('class', 'edgePath').style('opacity', 0);\n svgPathsEnter\n .append('path')\n .attr('class', 'path')\n .attr('d', function (e) {\n var edge = g.edge(e);\n var sourceElem = g.node(e.v).elem;\n var points = _.range(edge.points.length).map(function () {\n return getCoords(sourceElem);\n });\n return createLine(edge, points);\n });\n svgPathsEnter.append('defs');\n return svgPathsEnter;\n}\n\nfunction exit(svgPaths, g) {\n var svgPathExit = svgPaths.exit();\n util.applyTransition(svgPathExit, g).style('opacity', 0).remove();\n}\n","import * as d3 from 'd3';\nimport * as _ from 'lodash-es';\nimport { addLabel } from './label/add-label.js';\nimport * as util from './util.js';\n\nexport { createNodes, setCreateNodes };\n\nvar createNodes = function (selection, g, shapes) {\n var simpleNodes = g.nodes().filter(function (v) {\n return !util.isSubgraph(g, v);\n });\n var svgNodes = selection\n .selectAll('g.node')\n .data(simpleNodes, function (v) {\n return v;\n })\n .classed('update', true);\n\n svgNodes.exit().remove();\n\n svgNodes.enter().append('g').attr('class', 'node').style('opacity', 0);\n\n svgNodes = selection.selectAll('g.node');\n\n svgNodes.each(function (v) {\n var node = g.node(v);\n var thisGroup = d3.select(this);\n util.applyClass(\n thisGroup,\n node['class'],\n (thisGroup.classed('update') ? 'update ' : '') + 'node'\n );\n\n thisGroup.select('g.label').remove();\n var labelGroup = thisGroup.append('g').attr('class', 'label');\n var labelDom = addLabel(labelGroup, node);\n var shape = shapes[node.shape];\n var bbox = _.pick(labelDom.node().getBBox(), 'width', 'height');\n\n node.elem = this;\n\n if (node.id) {\n thisGroup.attr('id', node.id);\n }\n if (node.labelId) {\n labelGroup.attr('id', node.labelId);\n }\n\n if (_.has(node, 'width')) {\n bbox.width = node.width;\n }\n if (_.has(node, 'height')) {\n bbox.height = node.height;\n }\n\n bbox.width += node.paddingLeft + node.paddingRight;\n bbox.height += node.paddingTop + node.paddingBottom;\n labelGroup.attr(\n 'transform',\n 'translate(' +\n (node.paddingLeft - node.paddingRight) / 2 +\n ',' +\n (node.paddingTop - node.paddingBottom) / 2 +\n ')'\n );\n\n var root = d3.select(this);\n root.select('.label-container').remove();\n var shapeSvg = shape(root, bbox, node).classed('label-container', true);\n util.applyStyle(shapeSvg, node.style);\n\n var shapeBBox = shapeSvg.node().getBBox();\n node.width = shapeBBox.width;\n node.height = shapeBBox.height;\n });\n\n var exitSelection;\n\n if (svgNodes.exit) {\n exitSelection = svgNodes.exit();\n } else {\n exitSelection = svgNodes.selectAll(null); // empty selection\n }\n\n util.applyTransition(exitSelection, g).style('opacity', 0).remove();\n\n return svgNodes;\n};\n\nfunction setCreateNodes(value) {\n createNodes = value;\n}\n","import * as d3 from 'd3';\nimport * as util from './util.js';\n\nexport { positionClusters };\n\nfunction positionClusters(selection, g) {\n var created = selection.filter(function () {\n return !d3.select(this).classed('update');\n });\n\n function translate(v) {\n var node = g.node(v);\n return 'translate(' + node.x + ',' + node.y + ')';\n }\n\n created.attr('transform', translate);\n\n util.applyTransition(selection, g).style('opacity', 1).attr('transform', translate);\n\n util\n .applyTransition(created.selectAll('rect'), g)\n .attr('width', function (v) {\n return g.node(v).width;\n })\n .attr('height', function (v) {\n return g.node(v).height;\n })\n .attr('x', function (v) {\n var node = g.node(v);\n return -node.width / 2;\n })\n .attr('y', function (v) {\n var node = g.node(v);\n return -node.height / 2;\n });\n}\n","import * as d3 from 'd3';\nimport * as _ from 'lodash-es';\nimport * as util from './util.js';\n\nexport { positionEdgeLabels };\n\nfunction positionEdgeLabels(selection, g) {\n var created = selection.filter(function () {\n return !d3.select(this).classed('update');\n });\n\n function translate(e) {\n var edge = g.edge(e);\n return _.has(edge, 'x') ? 'translate(' + edge.x + ',' + edge.y + ')' : '';\n }\n\n created.attr('transform', translate);\n\n util.applyTransition(selection, g).style('opacity', 1).attr('transform', translate);\n}\n","import * as d3 from 'd3';\nimport * as util from './util.js';\n\nexport { positionNodes };\n\nfunction positionNodes(selection, g) {\n var created = selection.filter(function () {\n return !d3.select(this).classed('update');\n });\n\n function translate(v) {\n var node = g.node(v);\n return 'translate(' + node.x + ',' + node.y + ')';\n }\n\n created.attr('transform', translate);\n\n util.applyTransition(selection, g).style('opacity', 1).attr('transform', translate);\n}\n","export { intersectEllipse };\n\nfunction intersectEllipse(node, rx, ry, point) {\n // Formulae from: http://mathworld.wolfram.com/Ellipse-LineIntersection.html\n\n var cx = node.x;\n var cy = node.y;\n\n var px = cx - point.x;\n var py = cy - point.y;\n\n var det = Math.sqrt(rx * rx * py * py + ry * ry * px * px);\n\n var dx = Math.abs((rx * ry * px) / det);\n if (point.x < cx) {\n dx = -dx;\n }\n var dy = Math.abs((rx * ry * py) / det);\n if (point.y < cy) {\n dy = -dy;\n }\n\n return { x: cx + dx, y: cy + dy };\n}\n","import { intersectEllipse } from './intersect-ellipse.js';\n\nexport { intersectCircle };\n\nfunction intersectCircle(node, rx, point) {\n return intersectEllipse(node, rx, rx, point);\n}\n","export { intersectLine };\n\n/*\n * Returns the point at which two lines, p and q, intersect or returns\n * undefined if they do not intersect.\n */\nfunction intersectLine(p1, p2, q1, q2) {\n // Algorithm from J. Avro, (ed.) Graphics Gems, No 2, Morgan Kaufmann, 1994,\n // p7 and p473.\n\n var a1, a2, b1, b2, c1, c2;\n var r1, r2, r3, r4;\n var denom, offset, num;\n var x, y;\n\n // Compute a1, b1, c1, where line joining points 1 and 2 is F(x,y) = a1 x +\n // b1 y + c1 = 0.\n a1 = p2.y - p1.y;\n b1 = p1.x - p2.x;\n c1 = p2.x * p1.y - p1.x * p2.y;\n\n // Compute r3 and r4.\n r3 = a1 * q1.x + b1 * q1.y + c1;\n r4 = a1 * q2.x + b1 * q2.y + c1;\n\n // Check signs of r3 and r4. If both point 3 and point 4 lie on\n // same side of line 1, the line segments do not intersect.\n if (r3 !== 0 && r4 !== 0 && sameSign(r3, r4)) {\n return /*DONT_INTERSECT*/;\n }\n\n // Compute a2, b2, c2 where line joining points 3 and 4 is G(x,y) = a2 x + b2 y + c2 = 0\n a2 = q2.y - q1.y;\n b2 = q1.x - q2.x;\n c2 = q2.x * q1.y - q1.x * q2.y;\n\n // Compute r1 and r2\n r1 = a2 * p1.x + b2 * p1.y + c2;\n r2 = a2 * p2.x + b2 * p2.y + c2;\n\n // Check signs of r1 and r2. If both point 1 and point 2 lie\n // on same side of second line segment, the line segments do\n // not intersect.\n if (r1 !== 0 && r2 !== 0 && sameSign(r1, r2)) {\n return /*DONT_INTERSECT*/;\n }\n\n // Line segments intersect: compute intersection point.\n denom = a1 * b2 - a2 * b1;\n if (denom === 0) {\n return /*COLLINEAR*/;\n }\n\n offset = Math.abs(denom / 2);\n\n // The denom/2 is to get rounding instead of truncating. It\n // is added or subtracted to the numerator, depending upon the\n // sign of the numerator.\n num = b1 * c2 - b2 * c1;\n x = num < 0 ? (num - offset) / denom : (num + offset) / denom;\n\n num = a2 * c1 - a1 * c2;\n y = num < 0 ? (num - offset) / denom : (num + offset) / denom;\n\n return { x: x, y: y };\n}\n\nfunction sameSign(r1, r2) {\n return r1 * r2 > 0;\n}\n","import { intersectLine } from './intersect-line.js';\n\nexport { intersectPolygon };\n\n/*\n * Returns the point ({x, y}) at which the point argument intersects with the\n * node argument assuming that it has the shape specified by polygon.\n */\nfunction intersectPolygon(node, polyPoints, point) {\n var x1 = node.x;\n var y1 = node.y;\n\n var intersections = [];\n\n var minX = Number.POSITIVE_INFINITY;\n var minY = Number.POSITIVE_INFINITY;\n polyPoints.forEach(function (entry) {\n minX = Math.min(minX, entry.x);\n minY = Math.min(minY, entry.y);\n });\n\n var left = x1 - node.width / 2 - minX;\n var top = y1 - node.height / 2 - minY;\n\n for (var i = 0; i < polyPoints.length; i++) {\n var p1 = polyPoints[i];\n var p2 = polyPoints[i < polyPoints.length - 1 ? i + 1 : 0];\n var intersect = intersectLine(\n node,\n point,\n { x: left + p1.x, y: top + p1.y },\n { x: left + p2.x, y: top + p2.y }\n );\n if (intersect) {\n intersections.push(intersect);\n }\n }\n\n if (!intersections.length) {\n console.log('NO INTERSECTION FOUND, RETURN NODE CENTER', node);\n return node;\n }\n\n if (intersections.length > 1) {\n // More intersections, find the one nearest to edge end point\n intersections.sort(function (p, q) {\n var pdx = p.x - point.x;\n var pdy = p.y - point.y;\n var distp = Math.sqrt(pdx * pdx + pdy * pdy);\n\n var qdx = q.x - point.x;\n var qdy = q.y - point.y;\n var distq = Math.sqrt(qdx * qdx + qdy * qdy);\n\n return distp < distq ? -1 : distp === distq ? 0 : 1;\n });\n }\n return intersections[0];\n}\n","export { intersectRect };\n\nfunction intersectRect(node, point) {\n var x = node.x;\n var y = node.y;\n\n // Rectangle intersection algorithm from:\n // http://math.stackexchange.com/questions/108113/find-edge-between-two-boxes\n var dx = point.x - x;\n var dy = point.y - y;\n var w = node.width / 2;\n var h = node.height / 2;\n\n var sx, sy;\n if (Math.abs(dy) * w > Math.abs(dx) * h) {\n // Intersection is top or bottom of rect.\n if (dy < 0) {\n h = -h;\n }\n sx = dy === 0 ? 0 : (h * dx) / dy;\n sy = h;\n } else {\n // Intersection is left or right of rect.\n if (dx < 0) {\n w = -w;\n }\n sx = w;\n sy = dx === 0 ? 0 : (w * dy) / dx;\n }\n\n return { x: x + sx, y: y + sy };\n}\n","import { intersectCircle } from './intersect/intersect-circle.js';\nimport { intersectEllipse } from './intersect/intersect-ellipse.js';\nimport { intersectPolygon } from './intersect/intersect-polygon.js';\nimport { intersectRect } from './intersect/intersect-rect.js';\n\nexport { shapes, setShapes };\n\nvar shapes = {\n rect,\n ellipse,\n circle,\n diamond,\n};\n\nfunction setShapes(value) {\n shapes = value;\n}\n\nfunction rect(parent, bbox, node) {\n var shapeSvg = parent\n .insert('rect', ':first-child')\n .attr('rx', node.rx)\n .attr('ry', node.ry)\n .attr('x', -bbox.width / 2)\n .attr('y', -bbox.height / 2)\n .attr('width', bbox.width)\n .attr('height', bbox.height);\n\n node.intersect = function (point) {\n return intersectRect(node, point);\n };\n\n return shapeSvg;\n}\n\nfunction ellipse(parent, bbox, node) {\n var rx = bbox.width / 2;\n var ry = bbox.height / 2;\n var shapeSvg = parent\n .insert('ellipse', ':first-child')\n .attr('x', -bbox.width / 2)\n .attr('y', -bbox.height / 2)\n .attr('rx', rx)\n .attr('ry', ry);\n\n node.intersect = function (point) {\n return intersectEllipse(node, rx, ry, point);\n };\n\n return shapeSvg;\n}\n\nfunction circle(parent, bbox, node) {\n var r = Math.max(bbox.width, bbox.height) / 2;\n var shapeSvg = parent\n .insert('circle', ':first-child')\n .attr('x', -bbox.width / 2)\n .attr('y', -bbox.height / 2)\n .attr('r', r);\n\n node.intersect = function (point) {\n return intersectCircle(node, r, point);\n };\n\n return shapeSvg;\n}\n\n// Circumscribe an ellipse for the bounding box with a diamond shape. I derived\n// the function to calculate the diamond shape from:\n// http://mathforum.org/kb/message.jspa?messageID=3750236\nfunction diamond(parent, bbox, node) {\n var w = (bbox.width * Math.SQRT2) / 2;\n var h = (bbox.height * Math.SQRT2) / 2;\n var points = [\n { x: 0, y: -h },\n { x: -w, y: 0 },\n { x: 0, y: h },\n { x: w, y: 0 },\n ];\n var shapeSvg = parent.insert('polygon', ':first-child').attr(\n 'points',\n points\n .map(function (p) {\n return p.x + ',' + p.y;\n })\n .join(' ')\n );\n\n node.intersect = function (p) {\n return intersectPolygon(node, points, p);\n };\n\n return shapeSvg;\n}\n","import * as d3 from 'd3';\nimport * as _ from 'lodash-es';\nimport { layout } from '../dagre/index.js';\nimport { arrows, setArrows } from './arrows.js';\nimport { createClusters, setCreateClusters } from './create-clusters.js';\nimport { createEdgeLabels, setCreateEdgeLabels } from './create-edge-labels.js';\nimport { createEdgePaths, setCreateEdgePaths } from './create-edge-paths.js';\nimport { createNodes, setCreateNodes } from './create-nodes.js';\nimport { positionClusters } from './position-clusters.js';\nimport { positionEdgeLabels } from './position-edge-labels.js';\nimport { positionNodes } from './position-nodes.js';\nimport { shapes, setShapes } from './shapes.js';\n\nexport { render };\n\n// This design is based on http://bost.ocks.org/mike/chart/.\nfunction render() {\n var fn = function (svg, g) {\n preProcessGraph(g);\n\n var outputGroup = createOrSelectGroup(svg, 'output');\n var clustersGroup = createOrSelectGroup(outputGroup, 'clusters');\n var edgePathsGroup = createOrSelectGroup(outputGroup, 'edgePaths');\n var edgeLabels = createEdgeLabels(createOrSelectGroup(outputGroup, 'edgeLabels'), g);\n var nodes = createNodes(createOrSelectGroup(outputGroup, 'nodes'), g, shapes);\n\n layout(g);\n\n positionNodes(nodes, g);\n positionEdgeLabels(edgeLabels, g);\n createEdgePaths(edgePathsGroup, g, arrows);\n\n var clusters = createClusters(clustersGroup, g);\n positionClusters(clusters, g);\n\n postProcessGraph(g);\n };\n\n fn.createNodes = function (value) {\n if (!arguments.length) return createNodes;\n setCreateNodes(value);\n return fn;\n };\n\n fn.createClusters = function (value) {\n if (!arguments.length) return createClusters;\n setCreateClusters(value);\n return fn;\n };\n\n fn.createEdgeLabels = function (value) {\n if (!arguments.length) return createEdgeLabels;\n setCreateEdgeLabels(value);\n return fn;\n };\n\n fn.createEdgePaths = function (value) {\n if (!arguments.length) return createEdgePaths;\n setCreateEdgePaths(value);\n return fn;\n };\n\n fn.shapes = function (value) {\n if (!arguments.length) return shapes;\n setShapes(value);\n return fn;\n };\n\n fn.arrows = function (value) {\n if (!arguments.length) return arrows;\n setArrows(value);\n return fn;\n };\n\n return fn;\n}\n\nvar NODE_DEFAULT_ATTRS = {\n paddingLeft: 10,\n paddingRight: 10,\n paddingTop: 10,\n paddingBottom: 10,\n rx: 0,\n ry: 0,\n shape: 'rect',\n};\n\nvar EDGE_DEFAULT_ATTRS = {\n arrowhead: 'normal',\n curve: d3.curveLinear,\n};\n\nfunction preProcessGraph(g) {\n g.nodes().forEach(function (v) {\n var node = g.node(v);\n if (!_.has(node, 'label') && !g.children(v).length) {\n node.label = v;\n }\n\n if (_.has(node, 'paddingX')) {\n _.defaults(node, {\n paddingLeft: node.paddingX,\n paddingRight: node.paddingX,\n });\n }\n\n if (_.has(node, 'paddingY')) {\n _.defaults(node, {\n paddingTop: node.paddingY,\n paddingBottom: node.paddingY,\n });\n }\n\n if (_.has(node, 'padding')) {\n _.defaults(node, {\n paddingLeft: node.padding,\n paddingRight: node.padding,\n paddingTop: node.padding,\n paddingBottom: node.padding,\n });\n }\n\n _.defaults(node, NODE_DEFAULT_ATTRS);\n\n _.each(['paddingLeft', 'paddingRight', 'paddingTop', 'paddingBottom'], function (k) {\n node[k] = Number(node[k]);\n });\n\n // Save dimensions for restore during post-processing\n if (_.has(node, 'width')) {\n node._prevWidth = node.width;\n }\n if (_.has(node, 'height')) {\n node._prevHeight = node.height;\n }\n });\n\n g.edges().forEach(function (e) {\n var edge = g.edge(e);\n if (!_.has(edge, 'label')) {\n edge.label = '';\n }\n _.defaults(edge, EDGE_DEFAULT_ATTRS);\n });\n}\n\nfunction postProcessGraph(g) {\n _.each(g.nodes(), function (v) {\n var node = g.node(v);\n\n // Restore original dimensions\n if (_.has(node, '_prevWidth')) {\n node.width = node._prevWidth;\n } else {\n delete node.width;\n }\n\n if (_.has(node, '_prevHeight')) {\n node.height = node._prevHeight;\n } else {\n delete node.height;\n }\n\n delete node._prevWidth;\n delete node._prevHeight;\n });\n}\n\nfunction createOrSelectGroup(root, name) {\n var selection = root.select('g.' + name);\n if (selection.empty()) {\n selection = root.append('g').attr('class', name);\n }\n return selection;\n}\n","import { intersectPolygon } from 'dagre-d3-es/src/dagre-js/intersect/intersect-polygon.js';\nimport { intersectRect } from 'dagre-d3-es/src/dagre-js/intersect/intersect-rect.js';\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction question(parent, bbox, node) {\n const w = bbox.width;\n const h = bbox.height;\n const s = (w + h) * 0.9;\n const points = [\n { x: s / 2, y: 0 },\n { x: s, y: -s / 2 },\n { x: s / 2, y: -s },\n { x: 0, y: -s / 2 },\n ];\n const shapeSvg = insertPolygonShape(parent, s, s, points);\n node.intersect = function (point) {\n return intersectPolygon(node, points, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction hexagon(parent, bbox, node) {\n const f = 4;\n const h = bbox.height;\n const m = h / f;\n const w = bbox.width + 2 * m;\n const points = [\n { x: m, y: 0 },\n { x: w - m, y: 0 },\n { x: w, y: -h / 2 },\n { x: w - m, y: -h },\n { x: m, y: -h },\n { x: 0, y: -h / 2 },\n ];\n const shapeSvg = insertPolygonShape(parent, w, h, points);\n node.intersect = function (point) {\n return intersectPolygon(node, points, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction rect_left_inv_arrow(parent, bbox, node) {\n const w = bbox.width;\n const h = bbox.height;\n const points = [\n { x: -h / 2, y: 0 },\n { x: w, y: 0 },\n { x: w, y: -h },\n { x: -h / 2, y: -h },\n { x: 0, y: -h / 2 },\n ];\n const shapeSvg = insertPolygonShape(parent, w, h, points);\n node.intersect = function (point) {\n return intersectPolygon(node, points, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction lean_right(parent, bbox, node) {\n const w = bbox.width;\n const h = bbox.height;\n const points = [\n { x: (-2 * h) / 6, y: 0 },\n { x: w - h / 6, y: 0 },\n { x: w + (2 * h) / 6, y: -h },\n { x: h / 6, y: -h },\n ];\n const shapeSvg = insertPolygonShape(parent, w, h, points);\n node.intersect = function (point) {\n return intersectPolygon(node, points, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction lean_left(parent, bbox, node) {\n const w = bbox.width;\n const h = bbox.height;\n const points = [\n { x: (2 * h) / 6, y: 0 },\n { x: w + h / 6, y: 0 },\n { x: w - (2 * h) / 6, y: -h },\n { x: -h / 6, y: -h },\n ];\n const shapeSvg = insertPolygonShape(parent, w, h, points);\n node.intersect = function (point) {\n return intersectPolygon(node, points, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction trapezoid(parent, bbox, node) {\n const w = bbox.width;\n const h = bbox.height;\n const points = [\n { x: (-2 * h) / 6, y: 0 },\n { x: w + (2 * h) / 6, y: 0 },\n { x: w - h / 6, y: -h },\n { x: h / 6, y: -h },\n ];\n const shapeSvg = insertPolygonShape(parent, w, h, points);\n node.intersect = function (point) {\n return intersectPolygon(node, points, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction inv_trapezoid(parent, bbox, node) {\n const w = bbox.width;\n const h = bbox.height;\n const points = [\n { x: h / 6, y: 0 },\n { x: w - h / 6, y: 0 },\n { x: w + (2 * h) / 6, y: -h },\n { x: (-2 * h) / 6, y: -h },\n ];\n const shapeSvg = insertPolygonShape(parent, w, h, points);\n node.intersect = function (point) {\n return intersectPolygon(node, points, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction rect_right_inv_arrow(parent, bbox, node) {\n const w = bbox.width;\n const h = bbox.height;\n const points = [\n { x: 0, y: 0 },\n { x: w + h / 2, y: 0 },\n { x: w, y: -h / 2 },\n { x: w + h / 2, y: -h },\n { x: 0, y: -h },\n ];\n const shapeSvg = insertPolygonShape(parent, w, h, points);\n node.intersect = function (point) {\n return intersectPolygon(node, points, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction stadium(parent, bbox, node) {\n const h = bbox.height;\n const w = bbox.width + h / 4;\n\n const shapeSvg = parent\n .insert('rect', ':first-child')\n .attr('rx', h / 2)\n .attr('ry', h / 2)\n .attr('x', -w / 2)\n .attr('y', -h / 2)\n .attr('width', w)\n .attr('height', h);\n\n node.intersect = function (point) {\n return intersectRect(node, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction subroutine(parent, bbox, node) {\n const w = bbox.width;\n const h = bbox.height;\n const points = [\n { x: 0, y: 0 },\n { x: w, y: 0 },\n { x: w, y: -h },\n { x: 0, y: -h },\n { x: 0, y: 0 },\n { x: -8, y: 0 },\n { x: w + 8, y: 0 },\n { x: w + 8, y: -h },\n { x: -8, y: -h },\n { x: -8, y: 0 },\n ];\n const shapeSvg = insertPolygonShape(parent, w, h, points);\n node.intersect = function (point) {\n return intersectPolygon(node, points, point);\n };\n return shapeSvg;\n}\n\n/**\n * @param parent\n * @param bbox\n * @param node\n */\nfunction cylinder(parent, bbox, node) {\n const w = bbox.width;\n const rx = w / 2;\n const ry = rx / (2.5 + w / 50);\n const h = bbox.height + ry;\n\n const shape =\n 'M 0,' +\n ry +\n ' a ' +\n rx +\n ',' +\n ry +\n ' 0,0,0 ' +\n w +\n ' 0 a ' +\n rx +\n ',' +\n ry +\n ' 0,0,0 ' +\n -w +\n ' 0 l 0,' +\n h +\n ' a ' +\n rx +\n ',' +\n ry +\n ' 0,0,0 ' +\n w +\n ' 0 l 0,' +\n -h;\n\n const shapeSvg = parent\n .attr('label-offset-y', ry)\n .insert('path', ':first-child')\n .attr('d', shape)\n .attr('transform', 'translate(' + -w / 2 + ',' + -(h / 2 + ry) + ')');\n\n node.intersect = function (point) {\n const pos = intersectRect(node, point);\n const x = pos.x - node.x;\n\n if (\n rx != 0 &&\n (Math.abs(x) < node.width / 2 ||\n (Math.abs(x) == node.width / 2 && Math.abs(pos.y - node.y) > node.height / 2 - ry))\n ) {\n // ellipsis equation: x*x / a*a + y*y / b*b = 1\n // solve for y to get adjusted value for pos.y\n let y = ry * ry * (1 - (x * x) / (rx * rx));\n if (y != 0) {\n y = Math.sqrt(y);\n }\n y = ry - y;\n if (point.y - node.y > 0) {\n y = -y;\n }\n\n pos.y += y;\n }\n\n return pos;\n };\n\n return shapeSvg;\n}\n\n/** @param render */\nexport function addToRender(render) {\n render.shapes().question = question;\n render.shapes().hexagon = hexagon;\n render.shapes().stadium = stadium;\n render.shapes().subroutine = subroutine;\n render.shapes().cylinder = cylinder;\n\n // Add custom shape for box with inverted arrow on left side\n render.shapes().rect_left_inv_arrow = rect_left_inv_arrow;\n\n // Add custom shape for box with inverted arrow on left side\n render.shapes().lean_right = lean_right;\n\n // Add custom shape for box with inverted arrow on left side\n render.shapes().lean_left = lean_left;\n\n // Add custom shape for box with inverted arrow on left side\n render.shapes().trapezoid = trapezoid;\n\n // Add custom shape for box with inverted arrow on left side\n render.shapes().inv_trapezoid = inv_trapezoid;\n\n // Add custom shape for box with inverted arrow on right side\n render.shapes().rect_right_inv_arrow = rect_right_inv_arrow;\n}\n\n/** @param addShape */\nexport function addToRenderV2(addShape) {\n addShape({ question });\n addShape({ hexagon });\n addShape({ stadium });\n addShape({ subroutine });\n addShape({ cylinder });\n\n // Add custom shape for box with inverted arrow on left side\n addShape({ rect_left_inv_arrow });\n\n // Add custom shape for box with inverted arrow on left side\n addShape({ lean_right });\n\n // Add custom shape for box with inverted arrow on left side\n addShape({ lean_left });\n\n // Add custom shape for box with inverted arrow on left side\n addShape({ trapezoid });\n\n // Add custom shape for box with inverted arrow on left side\n addShape({ inv_trapezoid });\n\n // Add custom shape for box with inverted arrow on right side\n addShape({ rect_right_inv_arrow });\n}\n\n/**\n * @param parent\n * @param w\n * @param h\n * @param points\n */\nfunction insertPolygonShape(parent, w, h, points) {\n return parent\n .insert('polygon', ':first-child')\n .attr(\n 'points',\n points\n .map(function (d) {\n return d.x + ',' + d.y;\n })\n .join(' ')\n )\n .attr('transform', 'translate(' + -w / 2 + ',' + h / 2 + ')');\n}\n\nexport default {\n addToRender,\n addToRenderV2,\n};\n","import * as graphlib from 'dagre-d3-es/src/graphlib/index.js';\nimport { select, curveLinear, selectAll } from 'd3';\nimport { getConfig } from '../../config';\nimport { render as Render } from 'dagre-d3-es';\nimport { applyStyle } from 'dagre-d3-es/src/dagre-js/util.js';\nimport { addHtmlLabel } from 'dagre-d3-es/src/dagre-js/label/add-html-label.js';\nimport { log } from '../../logger';\nimport common, { evaluate } from '../common/common';\nimport { interpolateToCurve, getStylesFromArray } from '../../utils';\nimport { setupGraphViewbox } from '../../setupGraphViewbox';\nimport flowChartShapes from './flowChartShapes';\n\nconst conf = {};\nexport const setConf = function (cnf) {\n const keys = Object.keys(cnf);\n for (const key of keys) {\n conf[key] = cnf[key];\n }\n};\n\n/**\n * Function that adds the vertices found in the graph definition to the graph to be rendered.\n *\n * @param vert Object containing the vertices.\n * @param g The graph that is to be drawn.\n * @param svgId\n * @param root\n * @param _doc\n * @param diagObj\n */\nexport const addVertices = function (vert, g, svgId, root, _doc, diagObj) {\n const svg = !root ? select(`[id=\"${svgId}\"]`) : root.select(`[id=\"${svgId}\"]`);\n const doc = !_doc ? document : _doc;\n const keys = Object.keys(vert);\n\n // Iterate through each item in the vertex object (containing all the vertices found) in the graph definition\n keys.forEach(function (id) {\n const vertex = vert[id];\n\n /**\n * Variable for storing the classes for the vertex\n *\n * @type {string}\n */\n let classStr = 'default';\n if (vertex.classes.length > 0) {\n classStr = vertex.classes.join(' ');\n }\n\n const styles = getStylesFromArray(vertex.styles);\n\n // Use vertex id as text in the box if no text is provided by the graph definition\n let vertexText = vertex.text !== undefined ? vertex.text : vertex.id;\n\n // We create a SVG label, either by delegating to addHtmlLabel or manually\n let vertexNode;\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n // TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?\n const node = {\n label: vertexText.replace(\n /fa[blrs]?:fa-[\\w-]+/g,\n (s) => `<i class='${s.replace(':', ' ')}'></i>`\n ),\n };\n vertexNode = addHtmlLabel(svg, node).node();\n vertexNode.parentNode.removeChild(vertexNode);\n } else {\n const svgLabel = doc.createElementNS('http://www.w3.org/2000/svg', 'text');\n svgLabel.setAttribute('style', styles.labelStyle.replace('color:', 'fill:'));\n\n const rows = vertexText.split(common.lineBreakRegex);\n\n for (const row of rows) {\n const tspan = doc.createElementNS('http://www.w3.org/2000/svg', 'tspan');\n tspan.setAttributeNS('http://www.w3.org/XML/1998/namespace', 'xml:space', 'preserve');\n tspan.setAttribute('dy', '1em');\n tspan.setAttribute('x', '1');\n tspan.textContent = row;\n svgLabel.appendChild(tspan);\n }\n vertexNode = svgLabel;\n }\n\n let radious = 0;\n let _shape = '';\n // Set the shape based parameters\n switch (vertex.type) {\n case 'round':\n radious = 5;\n _shape = 'rect';\n break;\n case 'square':\n _shape = 'rect';\n break;\n case 'diamond':\n _shape = 'question';\n break;\n case 'hexagon':\n _shape = 'hexagon';\n break;\n case 'odd':\n _shape = 'rect_left_inv_arrow';\n break;\n case 'lean_right':\n _shape = 'lean_right';\n break;\n case 'lean_left':\n _shape = 'lean_left';\n break;\n case 'trapezoid':\n _shape = 'trapezoid';\n break;\n case 'inv_trapezoid':\n _shape = 'inv_trapezoid';\n break;\n case 'odd_right':\n _shape = 'rect_left_inv_arrow';\n break;\n case 'circle':\n _shape = 'circle';\n break;\n case 'ellipse':\n _shape = 'ellipse';\n break;\n case 'stadium':\n _shape = 'stadium';\n break;\n case 'subroutine':\n _shape = 'subroutine';\n break;\n case 'cylinder':\n _shape = 'cylinder';\n break;\n case 'group':\n _shape = 'rect';\n break;\n default:\n _shape = 'rect';\n }\n // Add the node\n log.warn('Adding node', vertex.id, vertex.domId);\n g.setNode(diagObj.db.lookUpDomId(vertex.id), {\n labelType: 'svg',\n labelStyle: styles.labelStyle,\n shape: _shape,\n label: vertexNode,\n rx: radious,\n ry: radious,\n class: classStr,\n style: styles.style,\n id: diagObj.db.lookUpDomId(vertex.id),\n });\n });\n};\n\n/**\n * Add edges to graph based on parsed graph definition\n *\n * @param {object} edges The edges to add to the graph\n * @param {object} g The graph object\n * @param diagObj\n */\nexport const addEdges = function (edges, g, diagObj) {\n let cnt = 0;\n\n let defaultStyle;\n let defaultLabelStyle;\n\n if (edges.defaultStyle !== undefined) {\n const defaultStyles = getStylesFromArray(edges.defaultStyle);\n defaultStyle = defaultStyles.style;\n defaultLabelStyle = defaultStyles.labelStyle;\n }\n\n edges.forEach(function (edge) {\n cnt++;\n\n // Identify Link\n var linkId = 'L-' + edge.start + '-' + edge.end;\n var linkNameStart = 'LS-' + edge.start;\n var linkNameEnd = 'LE-' + edge.end;\n\n const edgeData = {};\n\n // Set link type for rendering\n if (edge.type === 'arrow_open') {\n edgeData.arrowhead = 'none';\n } else {\n edgeData.arrowhead = 'normal';\n }\n\n let style = '';\n let labelStyle = '';\n\n if (edge.style !== undefined) {\n const styles = getStylesFromArray(edge.style);\n style = styles.style;\n labelStyle = styles.labelStyle;\n } else {\n switch (edge.stroke) {\n case 'normal':\n style = 'fill:none';\n if (defaultStyle !== undefined) {\n style = defaultStyle;\n }\n if (defaultLabelStyle !== undefined) {\n labelStyle = defaultLabelStyle;\n }\n break;\n case 'dotted':\n style = 'fill:none;stroke-width:2px;stroke-dasharray:3;';\n break;\n case 'thick':\n style = ' stroke-width: 3.5px;fill:none';\n break;\n }\n }\n\n edgeData.style = style;\n edgeData.labelStyle = labelStyle;\n\n if (edge.interpolate !== undefined) {\n edgeData.curve = interpolateToCurve(edge.interpolate, curveLinear);\n } else if (edges.defaultInterpolate !== undefined) {\n edgeData.curve = interpolateToCurve(edges.defaultInterpolate, curveLinear);\n } else {\n edgeData.curve = interpolateToCurve(conf.curve, curveLinear);\n }\n\n if (edge.text === undefined) {\n if (edge.style !== undefined) {\n edgeData.arrowheadStyle = 'fill: #333';\n }\n } else {\n edgeData.arrowheadStyle = 'fill: #333';\n edgeData.labelpos = 'c';\n\n if (evaluate(getConfig().flowchart.htmlLabels)) {\n edgeData.labelType = 'html';\n edgeData.label = `<span id=\"L-${linkId}\" class=\"edgeLabel L-${linkNameStart}' L-${linkNameEnd}\" style=\"${\n edgeData.labelStyle\n }\">${edge.text.replace(\n /fa[blrs]?:fa-[\\w-]+/g,\n (s) => `<i class='${s.replace(':', ' ')}'></i>`\n )}</span>`;\n } else {\n edgeData.labelType = 'text';\n edgeData.label = edge.text.replace(common.lineBreakRegex, '\\n');\n\n if (edge.style === undefined) {\n edgeData.style = edgeData.style || 'stroke: #333; stroke-width: 1.5px;fill:none';\n }\n\n edgeData.labelStyle = edgeData.labelStyle.replace('color:', 'fill:');\n }\n }\n\n edgeData.id = linkId;\n edgeData.class = linkNameStart + ' ' + linkNameEnd;\n edgeData.minlen = edge.length || 1;\n\n // Add the edge to the graph\n g.setEdge(diagObj.db.lookUpDomId(edge.start), diagObj.db.lookUpDomId(edge.end), edgeData, cnt);\n });\n};\n\n/**\n * Returns the all the styles from classDef statements in the graph definition.\n *\n * @param text\n * @param diagObj\n * @returns {object} ClassDef styles\n */\nexport const getClasses = function (text, diagObj) {\n log.info('Extracting classes');\n diagObj.db.clear();\n try {\n // Parse the graph definition\n diagObj.parse(text);\n return diagObj.db.getClasses();\n } catch (e) {\n log.error(e);\n return {};\n }\n};\n\n/**\n * Draws a flowchart in the tag with id: id based on the graph definition in text.\n *\n * @param text\n * @param id\n * @param _version\n * @param diagObj\n */\nexport const draw = function (text, id, _version, diagObj) {\n log.info('Drawing flowchart');\n diagObj.db.clear();\n const { securityLevel, flowchart: conf } = getConfig();\n let sandboxElement;\n if (securityLevel === 'sandbox') {\n sandboxElement = select('#i' + id);\n }\n const root =\n securityLevel === 'sandbox'\n ? select(sandboxElement.nodes()[0].contentDocument.body)\n : select('body');\n const doc = securityLevel === 'sandbox' ? sandboxElement.nodes()[0].contentDocument : document;\n\n // Parse the graph definition\n try {\n diagObj.parser.parse(text);\n } catch (err) {\n log.debug('Parsing failed');\n }\n\n // Fetch the default direction, use TD if none was found\n let dir = diagObj.db.getDirection();\n if (dir === undefined) {\n dir = 'TD';\n }\n const nodeSpacing = conf.nodeSpacing || 50;\n const rankSpacing = conf.rankSpacing || 50;\n\n // Create the input mermaid.graph\n const g = new graphlib.Graph({\n multigraph: true,\n compound: true,\n })\n .setGraph({\n rankdir: dir,\n nodesep: nodeSpacing,\n ranksep: rankSpacing,\n marginx: 8,\n marginy: 8,\n })\n .setDefaultEdgeLabel(function () {\n return {};\n });\n\n let subG;\n const subGraphs = diagObj.db.getSubGraphs();\n for (let i = subGraphs.length - 1; i >= 0; i--) {\n subG = subGraphs[i];\n diagObj.db.addVertex(subG.id, subG.title, 'group', undefined, subG.classes);\n }\n\n // Fetch the vertices/nodes and edges/links from the parsed graph definition\n const vert = diagObj.db.getVertices();\n log.warn('Get vertices', vert);\n\n const edges = diagObj.db.getEdges();\n\n let i = 0;\n for (i = subGraphs.length - 1; i >= 0; i--) {\n subG = subGraphs[i];\n\n selectAll('cluster').append('text');\n\n for (let j = 0; j < subG.nodes.length; j++) {\n log.warn(\n 'Setting subgraph',\n subG.nodes[j],\n diagObj.db.lookUpDomId(subG.nodes[j]),\n diagObj.db.lookUpDomId(subG.id)\n );\n g.setParent(diagObj.db.lookUpDomId(subG.nodes[j]), diagObj.db.lookUpDomId(subG.id));\n }\n }\n addVertices(vert, g, id, root, doc, diagObj);\n addEdges(edges, g, diagObj);\n\n // Create the renderer\n const render = new Render();\n\n // Add custom shapes\n flowChartShapes.addToRender(render);\n\n // Add our custom arrow - an empty arrowhead\n render.arrows().none = function normal(parent, id, edge, type) {\n const marker = parent\n .append('marker')\n .attr('id', id)\n .attr('viewBox', '0 0 10 10')\n .attr('refX', 9)\n .attr('refY', 5)\n .attr('markerUnits', 'strokeWidth')\n .attr('markerWidth', 8)\n .attr('markerHeight', 6)\n .attr('orient', 'auto');\n\n const path = marker.append('path').attr('d', 'M 0 0 L 0 0 L 0 0 z');\n applyStyle(path, edge[type + 'Style']);\n };\n\n // Override normal arrowhead defined in d3. Remove style & add class to allow css styling.\n render.arrows().normal = function normal(parent, id) {\n const marker = parent\n .append('marker')\n .attr('id', id)\n .attr('viewBox', '0 0 10 10')\n .attr('refX', 9)\n .attr('refY', 5)\n .attr('markerUnits', 'strokeWidth')\n .attr('markerWidth', 8)\n .attr('markerHeight', 6)\n .attr('orient', 'auto');\n\n marker\n .append('path')\n .attr('d', 'M 0 0 L 10 5 L 0 10 z')\n .attr('class', 'arrowheadPath')\n .style('stroke-width', 1)\n .style('stroke-dasharray', '1,0');\n };\n\n // Set up an SVG group so that we can translate the final graph.\n const svg = root.select(`[id=\"${id}\"]`);\n\n // Run the renderer. This is what draws the final graph.\n const element = root.select('#' + id + ' g');\n render(element, g);\n\n element.selectAll('g.node').attr('title', function () {\n return diagObj.db.getTooltip(this.id);\n });\n\n // Index nodes\n diagObj.db.indexNodes('subGraph' + i);\n\n // reposition labels\n for (i = 0; i < subGraphs.length; i++) {\n subG = subGraphs[i];\n if (subG.title !== 'undefined') {\n const clusterRects = doc.querySelectorAll(\n '#' + id + ' [id=\"' + diagObj.db.lookUpDomId(subG.id) + '\"] rect'\n );\n const clusterEl = doc.querySelectorAll(\n '#' + id + ' [id=\"' + diagObj.db.lookUpDomId(subG.id) + '\"]'\n );\n\n const xPos = clusterRects[0].x.baseVal.value;\n const yPos = clusterRects[0].y.baseVal.value;\n const _width = clusterRects[0].width.baseVal.value;\n const cluster = select(clusterEl[0]);\n const te = cluster.select('.label');\n te.attr('transform', `translate(${xPos + _width / 2}, ${yPos + 14})`);\n te.attr('id', id + 'Text');\n\n for (let j = 0; j < subG.classes.length; j++) {\n clusterEl[0].classList.add(subG.classes[j]);\n }\n }\n }\n\n // Add label rects for non html labels\n if (!conf.htmlLabels) {\n const labels = doc.querySelectorAll('[id=\"' + id + '\"] .edgeLabel .label');\n for (const label of labels) {\n // Get dimensions of label\n const dim = label.getBBox();\n\n const rect = doc.createElementNS('http://www.w3.org/2000/svg', 'rect');\n rect.setAttribute('rx', 0);\n rect.setAttribute('ry', 0);\n rect.setAttribute('width', dim.width);\n rect.setAttribute('height', dim.height);\n // rect.setAttribute('style', 'fill:#e8e8e8;');\n\n label.insertBefore(rect, label.firstChild);\n }\n }\n setupGraphViewbox(g, svg, conf.diagramPadding, conf.useMaxWidth);\n\n // If node has a link, wrap it in an anchor SVG object.\n const keys = Object.keys(vert);\n keys.forEach(function (key) {\n const vertex = vert[key];\n\n if (vertex.link) {\n const node = root.select('#' + id + ' [id=\"' + diagObj.db.lookUpDomId(key) + '\"]');\n if (node) {\n const link = doc.createElementNS('http://www.w3.org/2000/svg', 'a');\n link.setAttributeNS('http://www.w3.org/2000/svg', 'class', vertex.classes.join(' '));\n link.setAttributeNS('http://www.w3.org/2000/svg', 'href', vertex.link);\n link.setAttributeNS('http://www.w3.org/2000/svg', 'rel', 'noopener');\n if (securityLevel === 'sandbox') {\n link.setAttributeNS('http://www.w3.org/2000/svg', 'target', '_top');\n } else if (vertex.linkTarget) {\n link.setAttributeNS('http://www.w3.org/2000/svg', 'target', vertex.linkTarget);\n }\n\n const linkNode = node.insert(function () {\n return link;\n }, ':first-child');\n\n const shape = node.select('.label-container');\n if (shape) {\n linkNode.append(function () {\n return shape.node();\n });\n }\n\n const label = node.select('.label');\n if (label) {\n linkNode.append(function () {\n return label.node();\n });\n }\n }\n }\n });\n};\n\nexport default {\n setConf,\n addVertices,\n addEdges,\n getClasses,\n draw,\n};\n","// @ts-ignore: TODO Fix ts errors\nimport flowParser from './parser/flow';\nimport flowDb from './flowDb';\nimport flowRenderer from './flowRenderer';\nimport flowRendererV2 from './flowRenderer-v2';\nimport flowStyles from './styles';\nimport { MermaidConfig } from '../../config.type';\n\nexport const diagram = {\n parser: flowParser,\n db: flowDb,\n renderer: flowRendererV2,\n styles: flowStyles,\n init: (cnf: MermaidConfig) => {\n if (!cnf.flowchart) {\n cnf.flowchart = {};\n }\n // TODO, broken as of 2022-09-14 (13809b50251845475e6dca65cc395761be38fbd2)\n cnf.flowchart.arrowMarkerAbsolute = cnf.arrowMarkerAbsolute;\n flowRenderer.setConf(cnf.flowchart);\n flowDb.clear();\n flowDb.setGen('gen-1');\n },\n};\n"],"names":["responseText","response","text","input","init","parser","type","svg","arrows","normal","vee","undirected","setArrows","value","parent","id","edge","marker","path","util.applyStyle","addSVGLabel","root","node","domNode","addTextLabel","lines","processEscapeSequences","i","newText","escaped","ch","addLabel","location","label","labelSvg","addHtmlLabel","labelBBox","y","createClusters","selection","g","clusters","v","util.isSubgraph","svgClusters","util.applyTransition","enterSelection","thisGroup","d3.select","labelGroup","c","domCluster","setCreateClusters","createEdgeLabels","svgEdgeLabels","e","util.edgeToId","bbox","_.has","exitSelection","setCreateEdgeLabels","intersectNode","point","createEdgePaths","previousPaths","newPaths","enter","exit","svgPaths","domEdge","util.applyClass","_.uniqueId","d3\n .select","makeFragmentRef","calcPoints","arrowhead","setCreateEdgePaths","url","fragmentId","baseUrl","tail","head","points","createLine","line","d3.line","d3.svg","d","getCoords","elem","matrix","svgPathsEnter","sourceElem","_.range","svgPathExit","createNodes","shapes","simpleNodes","svgNodes","labelDom","shape","_.pick","shapeSvg","shapeBBox","setCreateNodes","positionClusters","created","translate","util\n .applyTransition","positionEdgeLabels","positionNodes","intersectEllipse","rx","ry","cx","cy","px","py","det","dx","dy","intersectCircle","intersectLine","p1","p2","q1","q2","a1","a2","b1","b2","c1","c2","r1","r2","r3","r4","denom","offset","num","x","sameSign","intersectPolygon","polyPoints","x1","y1","intersections","minX","minY","entry","left","top","intersect","q","pdx","pdy","distp","qdx","qdy","distq","intersectRect","w","h","sx","sy","rect","ellipse","circle","diamond","setShapes","r","p","render","fn","preProcessGraph","outputGroup","createOrSelectGroup","clustersGroup","edgePathsGroup","edgeLabels","nodes","layout","postProcessGraph","NODE_DEFAULT_ATTRS","EDGE_DEFAULT_ATTRS","d3.curveLinear","_.defaults","_.each","k","name","question","insertPolygonShape","hexagon","m","rect_left_inv_arrow","lean_right","lean_left","trapezoid","inv_trapezoid","rect_right_inv_arrow","stadium","subroutine","cylinder","pos","addToRender","addToRenderV2","addShape","flowChartShapes","conf","setConf","cnf","keys","key","addVertices","vert","svgId","_doc","diagObj","select","doc","vertex","classStr","styles","getStylesFromArray","vertexText","vertexNode","evaluate","getConfig","s","svgLabel","rows","common","row","tspan","radious","_shape","log","addEdges","edges","cnt","defaultStyle","defaultLabelStyle","defaultStyles","linkId","linkNameStart","linkNameEnd","edgeData","style","labelStyle","interpolateToCurve","curveLinear","getClasses","draw","_version","securityLevel","sandboxElement","dir","nodeSpacing","rankSpacing","graphlib.Graph","subG","subGraphs","selectAll","j","Render","applyStyle","element","clusterRects","clusterEl","xPos","yPos","_width","te","labels","dim","setupGraphViewbox","link","linkNode","flowRenderer","diagram","flowParser","flowDb","flowRendererV2","flowStyles"],"mappings":";;;;;;;;;;;;;;;;AAAA,SAASA,GAAaC,GAAU;AAC9B,MAAI,CAACA,EAAS;AAAI,UAAM,IAAI,MAAMA,EAAS,SAAS,MAAMA,EAAS,UAAU;AAC7E,SAAOA,EAAS;AAClB;AAEe,SAAAC,GAASC,GAAOC,GAAM;AACnC,SAAO,MAAMD,GAAOC,CAAI,EAAE,KAAKJ,EAAY;AAC7C;ACLA,SAASK,GAAOC,GAAM;AACpB,SAAO,CAACH,GAAOC,MAASF,GAAKC,GAAOC,CAAI,EACrC,KAAK,CAAAF,MAAS,IAAI,YAAW,gBAAgBA,GAAMI,CAAI,CAAC;AAC7D;AAMO,IAAIC,KAAMF,GAAO,eAAe,GCPnCG,IAAS;AAAA,EACX,QAAAC;AAAA,EACA,KAAAC;AAAA,EACA,YAAAC;AACF;AAEA,SAASC,GAAUC,GAAO;AACxB,EAAAL,IAASK;AACX;AAEA,SAASJ,GAAOK,GAAQC,GAAIC,GAAMV,GAAM;AACtC,MAAIW,IAASH,EACV,OAAO,QAAQ,EACf,KAAK,MAAMC,CAAE,EACb,KAAK,WAAW,WAAW,EAC3B,KAAK,QAAQ,CAAC,EACd,KAAK,QAAQ,CAAC,EACd,KAAK,eAAe,aAAa,EACjC,KAAK,eAAe,CAAC,EACrB,KAAK,gBAAgB,CAAC,EACtB,KAAK,UAAU,MAAM,GAEpBG,IAAOD,EACR,OAAO,MAAM,EACb,KAAK,KAAK,uBAAuB,EACjC,MAAM,gBAAgB,CAAC,EACvB,MAAM,oBAAoB,KAAK;AAClCE,EAAAA,EAAgBD,GAAMF,EAAKV,IAAO,OAAO,CAAC,GACtCU,EAAKV,IAAO,OAAO,KACrBY,EAAK,KAAK,SAASF,EAAKV,IAAO,OAAO,CAAC;AAE3C;AAEA,SAASI,GAAII,GAAQC,GAAIC,GAAMV,GAAM;AACnC,MA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