{"version":3,"file":"static/js/nm.charts.3733157071e20d6d.js","sources":["webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/accessors.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/array.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/constant.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/count.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/index.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/each.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/eachAfter.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/eachBefore.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/find.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/sum.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/sort.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/path.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/ancestors.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/descendants.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/leaves.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/links.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/hierarchy/iterator.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/cluster.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/stratify.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/tree.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/treemap/binary.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/treemap/sliceDice.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/treemap/resquarify.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/pack/enclose.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/pack/index.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/pack/siblings.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/partition.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/treemap/dice.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/treemap/index.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/treemap/round.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/treemap/slice.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g2plot/node_modules/d3-hierarchy/src/treemap/squarify.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/util/PoweredByUtil.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/draw/BaseRenderer.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/util/ModelUtil.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/util/DiUtil.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/util/LabelUtil.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/RenderUtil.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/draw/BpmnRenderUtil.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/SvgTransformUtil.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/draw/BpmnRenderer.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/Text.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/draw/TextRenderer.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/draw/PathMap.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/i18n/translate/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/i18n/translate/translate.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/layout/LayoutUtil.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/ModelUtil.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/import/Util.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/import/BpmnImporter.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/Event.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/Mouse.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/interaction-events/InteractionEvents.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/Elements.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/outline/Outline.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/selection/Selection.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/selection/SelectionVisuals.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/selection/SelectionBehavior.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/Platform.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/IdGenerator.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/overlays/Overlays.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/overlays/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/change-support/ChangeSupport.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/command/CommandInterceptor.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/root-elements/RootElementsBehavior.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/EscapeUtil.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/util/DrilldownUtil.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/features/drilldown/DrilldownBreadcrumbs.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/features/drilldown/DrilldownCentering.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/features/drilldown/SubprocessCompatibility.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/features/drilldown/DrilldownOverlayBehavior.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/draw/DefaultRenderer.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/core/Canvas.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/Collections.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/core/ElementRegistry.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/model/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/core/ElementFactory.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/core/EventBus.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/core/GraphicsFactory.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/util/GraphicsUtil.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/core/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/draw/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/draw/Styles.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/Diagram.js","webpack://kuika-sample-react-app/../../node_modules/moddle/dist/index.esm.js","webpack://kuika-sample-react-app/../../node_modules/moddle-xml/dist/index.esm.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-moddle/dist/index.esm.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/import/BpmnTreeWalker.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/util/CompatibilityUtil.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/BaseViewer.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/import/Importer.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/Viewer.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/core/index.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/draw/index.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/import/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/selection/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/interaction-events/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/outline/index.js","webpack://kuika-sample-react-app/../../node_modules/bpmn-js/lib/features/drilldown/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/change-support/index.js","webpack://kuika-sample-react-app/../../node_modules/diagram-js/lib/features/root-elements/index.js","webpack://kuika-sample-react-app/../../node_modules/chartjs-plugin-datalabels/dist/chartjs-plugin-datalabels.esm.js","webpack://kuika-sample-react-app/../../node_modules/chartjs-plugin-doughnutlabel-v3/dist/chartjs-plugin-doughnutlabel.esm.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/linear.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/quad.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/cubic.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/poly.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/sin.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/math.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/exp.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/circle.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/bounce.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/back.js","webpack://kuika-sample-react-app/../../node_modules/d3-ease/src/elastic.js","webpack://kuika-sample-react-app/../../node_modules/d3-regression/dist/d3-regression.js","webpack://kuika-sample-react-app/../../node_modules/d3-timer/src/timer.js","webpack://kuika-sample-react-app/./node_modules/react-chartjs-2/dist/index.modern.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/array.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/numberArray.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-color/src/define.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-color/src/color.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/basis.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/constant.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/color.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/rgb.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/basisClosed.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/number.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/string.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/value.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/date.js","webpack://kuika-sample-react-app/../../node_modules/@antv/g-base/node_modules/d3-interpolate/src/object.js","webpack://kuika-sample-react-app/../../node_modules/bizcharts/node_modules/d3-color/src/define.js","webpack://kuika-sample-react-app/../../node_modules/bizcharts/node_modules/d3-color/src/color.js","webpack://kuika-sample-react-app/../../node_modules/canvg/lib/index.es.js","webpack://kuika-sample-react-app/../../node_modules/chart.js/dist/chart.mjs","webpack://kuika-sample-react-app/../../node_modules/chart.js/dist/chunks/helpers.segment.mjs"],"sourcesContent":["export function optional(f) {\n return f == null ? null : required(f);\n}\n\nexport function required(f) {\n if (typeof f !== \"function\") throw new Error;\n return f;\n}\n","export default function(x) {\n return typeof x === \"object\" && \"length\" in x\n ? x // Array, TypedArray, NodeList, array-like\n : Array.from(x); // Map, Set, iterable, string, or anything else\n}\n\nexport function shuffle(array) {\n var m = array.length,\n t,\n i;\n\n while (m) {\n i = Math.random() * m-- | 0;\n t = array[m];\n array[m] = array[i];\n array[i] = t;\n }\n\n return array;\n}\n","export function constantZero() {\n return 0;\n}\n\nexport default function(x) {\n return function() {\n return x;\n };\n}\n","function count(node) {\n var sum = 0,\n children = node.children,\n i = children && children.length;\n if (!i) sum = 1;\n else while (--i >= 0) sum += children[i].value;\n node.value = sum;\n}\n\nexport default function() {\n return this.eachAfter(count);\n}\n","import node_count from \"./count.js\";\nimport node_each from \"./each.js\";\nimport node_eachBefore from \"./eachBefore.js\";\nimport node_eachAfter from \"./eachAfter.js\";\nimport node_find from \"./find.js\";\nimport node_sum from \"./sum.js\";\nimport node_sort from \"./sort.js\";\nimport node_path from \"./path.js\";\nimport node_ancestors from \"./ancestors.js\";\nimport node_descendants from \"./descendants.js\";\nimport node_leaves from \"./leaves.js\";\nimport node_links from \"./links.js\";\nimport node_iterator from \"./iterator.js\";\n\nexport default function hierarchy(data, children) {\n if (data instanceof Map) {\n data = [undefined, data];\n if (children === undefined) children = mapChildren;\n } else if (children === undefined) {\n children = objectChildren;\n }\n\n var root = new Node(data),\n node,\n nodes = [root],\n child,\n childs,\n i,\n n;\n\n while (node = nodes.pop()) {\n if ((childs = children(node.data)) && (n = (childs = Array.from(childs)).length)) {\n node.children = childs;\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = childs[i] = new Node(childs[i]));\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n\n return root.eachBefore(computeHeight);\n}\n\nfunction node_copy() {\n return hierarchy(this).eachBefore(copyData);\n}\n\nfunction objectChildren(d) {\n return d.children;\n}\n\nfunction mapChildren(d) {\n return Array.isArray(d) ? d[1] : null;\n}\n\nfunction copyData(node) {\n if (node.data.value !== undefined) node.value = node.data.value;\n node.data = node.data.data;\n}\n\nexport function computeHeight(node) {\n var height = 0;\n do node.height = height;\n while ((node = node.parent) && (node.height < ++height));\n}\n\nexport function Node(data) {\n this.data = data;\n this.depth =\n this.height = 0;\n this.parent = null;\n}\n\nNode.prototype = hierarchy.prototype = {\n constructor: Node,\n count: node_count,\n each: node_each,\n eachAfter: node_eachAfter,\n eachBefore: node_eachBefore,\n find: node_find,\n sum: node_sum,\n sort: node_sort,\n path: node_path,\n ancestors: node_ancestors,\n descendants: node_descendants,\n leaves: node_leaves,\n links: node_links,\n copy: node_copy,\n [Symbol.iterator]: node_iterator\n};\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], next = [], children, i, n, index = -1;\n while (node = nodes.pop()) {\n next.push(node);\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n nodes.push(children[i]);\n }\n }\n }\n while (node = next.pop()) {\n callback.call(that, node, ++index, this);\n }\n return this;\n}\n","export default function(callback, that) {\n var node = this, nodes = [node], children, i, index = -1;\n while (node = nodes.pop()) {\n callback.call(that, node, ++index, this);\n if (children = node.children) {\n for (i = children.length - 1; i >= 0; --i) {\n nodes.push(children[i]);\n }\n }\n }\n return this;\n}\n","export default function(callback, that) {\n let index = -1;\n for (const node of this) {\n if (callback.call(that, node, ++index, this)) {\n return node;\n }\n }\n}\n","export default function(value) {\n return this.eachAfter(function(node) {\n var sum = +value(node.data) || 0,\n children = node.children,\n i = children && children.length;\n while (--i >= 0) sum += children[i].value;\n node.value = sum;\n });\n}\n","export default function(compare) {\n return this.eachBefore(function(node) {\n if (node.children) {\n node.children.sort(compare);\n }\n });\n}\n","export default function(end) {\n var start = this,\n ancestor = leastCommonAncestor(start, end),\n nodes = [start];\n while (start !== ancestor) {\n start = start.parent;\n nodes.push(start);\n }\n var k = nodes.length;\n while (end !== ancestor) {\n nodes.splice(k, 0, end);\n end = end.parent;\n }\n return nodes;\n}\n\nfunction leastCommonAncestor(a, b) {\n if (a === b) return a;\n var aNodes = a.ancestors(),\n bNodes = b.ancestors(),\n c = null;\n a = aNodes.pop();\n b = bNodes.pop();\n while (a === b) {\n c = a;\n a = aNodes.pop();\n b = bNodes.pop();\n }\n return c;\n}\n","export default function() {\n var node = this, nodes = [node];\n while (node = node.parent) {\n nodes.push(node);\n }\n return nodes;\n}\n","export default function() {\n return Array.from(this);\n}\n","export default function() {\n var leaves = [];\n this.eachBefore(function(node) {\n if (!node.children) {\n leaves.push(node);\n }\n });\n return leaves;\n}\n","export default function() {\n var root = this, links = [];\n root.each(function(node) {\n if (node !== root) { // Don’t include the root’s parent, if any.\n links.push({source: node.parent, target: node});\n }\n });\n return links;\n}\n","export default function*() {\n var node = this, current, next = [node], children, i, n;\n do {\n current = next.reverse(), next = [];\n while (node = current.pop()) {\n yield node;\n if (children = node.children) {\n for (i = 0, n = children.length; i < n; ++i) {\n next.push(children[i]);\n }\n }\n }\n } while (next.length);\n}\n","function defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\nfunction meanX(children) {\n return children.reduce(meanXReduce, 0) / children.length;\n}\n\nfunction meanXReduce(x, c) {\n return x + c.x;\n}\n\nfunction maxY(children) {\n return 1 + children.reduce(maxYReduce, 0);\n}\n\nfunction maxYReduce(y, c) {\n return Math.max(y, c.y);\n}\n\nfunction leafLeft(node) {\n var children;\n while (children = node.children) node = children[0];\n return node;\n}\n\nfunction leafRight(node) {\n var children;\n while (children = node.children) node = children[children.length - 1];\n return node;\n}\n\nexport default function() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = false;\n\n function cluster(root) {\n var previousNode,\n x = 0;\n\n // First walk, computing the initial x & y values.\n root.eachAfter(function(node) {\n var children = node.children;\n if (children) {\n node.x = meanX(children);\n node.y = maxY(children);\n } else {\n node.x = previousNode ? x += separation(node, previousNode) : 0;\n node.y = 0;\n previousNode = node;\n }\n });\n\n var left = leafLeft(root),\n right = leafRight(root),\n x0 = left.x - separation(left, right) / 2,\n x1 = right.x + separation(right, left) / 2;\n\n // Second walk, normalizing x & y to the desired size.\n return root.eachAfter(nodeSize ? function(node) {\n node.x = (node.x - root.x) * dx;\n node.y = (root.y - node.y) * dy;\n } : function(node) {\n node.x = (node.x - x0) / (x1 - x0) * dx;\n node.y = (1 - (root.y ? node.y / root.y : 1)) * dy;\n });\n }\n\n cluster.separation = function(x) {\n return arguments.length ? (separation = x, cluster) : separation;\n };\n\n cluster.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? null : [dx, dy]);\n };\n\n cluster.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], cluster) : (nodeSize ? [dx, dy] : null);\n };\n\n return cluster;\n}\n","import {required} from \"./accessors.js\";\nimport {Node, computeHeight} from \"./hierarchy/index.js\";\n\nvar preroot = {depth: -1},\n ambiguous = {};\n\nfunction defaultId(d) {\n return d.id;\n}\n\nfunction defaultParentId(d) {\n return d.parentId;\n}\n\nexport default function() {\n var id = defaultId,\n parentId = defaultParentId;\n\n function stratify(data) {\n var nodes = Array.from(data),\n n = nodes.length,\n d,\n i,\n root,\n parent,\n node,\n nodeId,\n nodeKey,\n nodeByKey = new Map;\n\n for (i = 0; i < n; ++i) {\n d = nodes[i], node = nodes[i] = new Node(d);\n if ((nodeId = id(d, i, data)) != null && (nodeId += \"\")) {\n nodeKey = node.id = nodeId;\n nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node);\n }\n if ((nodeId = parentId(d, i, data)) != null && (nodeId += \"\")) {\n node.parent = nodeId;\n }\n }\n\n for (i = 0; i < n; ++i) {\n node = nodes[i];\n if (nodeId = node.parent) {\n parent = nodeByKey.get(nodeId);\n if (!parent) throw new Error(\"missing: \" + nodeId);\n if (parent === ambiguous) throw new Error(\"ambiguous: \" + nodeId);\n if (parent.children) parent.children.push(node);\n else parent.children = [node];\n node.parent = parent;\n } else {\n if (root) throw new Error(\"multiple roots\");\n root = node;\n }\n }\n\n if (!root) throw new Error(\"no root\");\n root.parent = preroot;\n root.eachBefore(function(node) { node.depth = node.parent.depth + 1; --n; }).eachBefore(computeHeight);\n root.parent = null;\n if (n > 0) throw new Error(\"cycle\");\n\n return root;\n }\n\n stratify.id = function(x) {\n return arguments.length ? (id = required(x), stratify) : id;\n };\n\n stratify.parentId = function(x) {\n return arguments.length ? (parentId = required(x), stratify) : parentId;\n };\n\n return stratify;\n}\n","import {Node} from \"./hierarchy/index.js\";\n\nfunction defaultSeparation(a, b) {\n return a.parent === b.parent ? 1 : 2;\n}\n\n// function radialSeparation(a, b) {\n// return (a.parent === b.parent ? 1 : 2) / a.depth;\n// }\n\n// This function is used to traverse the left contour of a subtree (or\n// subforest). It returns the successor of v on this contour. This successor is\n// either given by the leftmost child of v or by the thread of v. The function\n// returns null if and only if v is on the highest level of its subtree.\nfunction nextLeft(v) {\n var children = v.children;\n return children ? children[0] : v.t;\n}\n\n// This function works analogously to nextLeft.\nfunction nextRight(v) {\n var children = v.children;\n return children ? children[children.length - 1] : v.t;\n}\n\n// Shifts the current subtree rooted at w+. This is done by increasing\n// prelim(w+) and mod(w+) by shift.\nfunction moveSubtree(wm, wp, shift) {\n var change = shift / (wp.i - wm.i);\n wp.c -= change;\n wp.s += shift;\n wm.c += change;\n wp.z += shift;\n wp.m += shift;\n}\n\n// All other shifts, applied to the smaller subtrees between w- and w+, are\n// performed by this function. To prepare the shifts, we have to adjust\n// change(w+), shift(w+), and change(w-).\nfunction executeShifts(v) {\n var shift = 0,\n change = 0,\n children = v.children,\n i = children.length,\n w;\n while (--i >= 0) {\n w = children[i];\n w.z += shift;\n w.m += shift;\n shift += w.s + (change += w.c);\n }\n}\n\n// If vi-’s ancestor is a sibling of v, returns vi-’s ancestor. Otherwise,\n// returns the specified (default) ancestor.\nfunction nextAncestor(vim, v, ancestor) {\n return vim.a.parent === v.parent ? vim.a : ancestor;\n}\n\nfunction TreeNode(node, i) {\n this._ = node;\n this.parent = null;\n this.children = null;\n this.A = null; // default ancestor\n this.a = this; // ancestor\n this.z = 0; // prelim\n this.m = 0; // mod\n this.c = 0; // change\n this.s = 0; // shift\n this.t = null; // thread\n this.i = i; // number\n}\n\nTreeNode.prototype = Object.create(Node.prototype);\n\nfunction treeRoot(root) {\n var tree = new TreeNode(root, 0),\n node,\n nodes = [tree],\n child,\n children,\n i,\n n;\n\n while (node = nodes.pop()) {\n if (children = node._.children) {\n node.children = new Array(n = children.length);\n for (i = n - 1; i >= 0; --i) {\n nodes.push(child = node.children[i] = new TreeNode(children[i], i));\n child.parent = node;\n }\n }\n }\n\n (tree.parent = new TreeNode(null, 0)).children = [tree];\n return tree;\n}\n\n// Node-link tree diagram using the Reingold-Tilford \"tidy\" algorithm\nexport default function() {\n var separation = defaultSeparation,\n dx = 1,\n dy = 1,\n nodeSize = null;\n\n function tree(root) {\n var t = treeRoot(root);\n\n // Compute the layout using Buchheim et al.’s algorithm.\n t.eachAfter(firstWalk), t.parent.m = -t.z;\n t.eachBefore(secondWalk);\n\n // If a fixed node size is specified, scale x and y.\n if (nodeSize) root.eachBefore(sizeNode);\n\n // If a fixed tree size is specified, scale x and y based on the extent.\n // Compute the left-most, right-most, and depth-most nodes for extents.\n else {\n var left = root,\n right = root,\n bottom = root;\n root.eachBefore(function(node) {\n if (node.x < left.x) left = node;\n if (node.x > right.x) right = node;\n if (node.depth > bottom.depth) bottom = node;\n });\n var s = left === right ? 1 : separation(left, right) / 2,\n tx = s - left.x,\n kx = dx / (right.x + s + tx),\n ky = dy / (bottom.depth || 1);\n root.eachBefore(function(node) {\n node.x = (node.x + tx) * kx;\n node.y = node.depth * ky;\n });\n }\n\n return root;\n }\n\n // Computes a preliminary x-coordinate for v. Before that, FIRST WALK is\n // applied recursively to the children of v, as well as the function\n // APPORTION. After spacing out the children by calling EXECUTE SHIFTS, the\n // node v is placed to the midpoint of its outermost children.\n function firstWalk(v) {\n var children = v.children,\n siblings = v.parent.children,\n w = v.i ? siblings[v.i - 1] : null;\n if (children) {\n executeShifts(v);\n var midpoint = (children[0].z + children[children.length - 1].z) / 2;\n if (w) {\n v.z = w.z + separation(v._, w._);\n v.m = v.z - midpoint;\n } else {\n v.z = midpoint;\n }\n } else if (w) {\n v.z = w.z + separation(v._, w._);\n }\n v.parent.A = apportion(v, w, v.parent.A || siblings[0]);\n }\n\n // Computes all real x-coordinates by summing up the modifiers recursively.\n function secondWalk(v) {\n v._.x = v.z + v.parent.m;\n v.m += v.parent.m;\n }\n\n // The core of the algorithm. Here, a new subtree is combined with the\n // previous subtrees. Threads are used to traverse the inside and outside\n // contours of the left and right subtree up to the highest common level. The\n // vertices used for the traversals are vi+, vi-, vo-, and vo+, where the\n // superscript o means outside and i means inside, the subscript - means left\n // subtree and + means right subtree. For summing up the modifiers along the\n // contour, we use respective variables si+, si-, so-, and so+. Whenever two\n // nodes of the inside contours conflict, we compute the left one of the\n // greatest uncommon ancestors using the function ANCESTOR and call MOVE\n // SUBTREE to shift the subtree and prepare the shifts of smaller subtrees.\n // Finally, we add a new thread (if necessary).\n function apportion(v, w, ancestor) {\n if (w) {\n var vip = v,\n vop = v,\n vim = w,\n vom = vip.parent.children[0],\n sip = vip.m,\n sop = vop.m,\n sim = vim.m,\n som = vom.m,\n shift;\n while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) {\n vom = nextLeft(vom);\n vop = nextRight(vop);\n vop.a = v;\n shift = vim.z + sim - vip.z - sip + separation(vim._, vip._);\n if (shift > 0) {\n moveSubtree(nextAncestor(vim, v, ancestor), v, shift);\n sip += shift;\n sop += shift;\n }\n sim += vim.m;\n sip += vip.m;\n som += vom.m;\n sop += vop.m;\n }\n if (vim && !nextRight(vop)) {\n vop.t = vim;\n vop.m += sim - sop;\n }\n if (vip && !nextLeft(vom)) {\n vom.t = vip;\n vom.m += sip - som;\n ancestor = v;\n }\n }\n return ancestor;\n }\n\n function sizeNode(node) {\n node.x *= dx;\n node.y = node.depth * dy;\n }\n\n tree.separation = function(x) {\n return arguments.length ? (separation = x, tree) : separation;\n };\n\n tree.size = function(x) {\n return arguments.length ? (nodeSize = false, dx = +x[0], dy = +x[1], tree) : (nodeSize ? null : [dx, dy]);\n };\n\n tree.nodeSize = function(x) {\n return arguments.length ? (nodeSize = true, dx = +x[0], dy = +x[1], tree) : (nodeSize ? [dx, dy] : null);\n };\n\n return tree;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n i, n = nodes.length,\n sum, sums = new Array(n + 1);\n\n for (sums[0] = sum = i = 0; i < n; ++i) {\n sums[i + 1] = sum += nodes[i].value;\n }\n\n partition(0, n, parent.value, x0, y0, x1, y1);\n\n function partition(i, j, value, x0, y0, x1, y1) {\n if (i >= j - 1) {\n var node = nodes[i];\n node.x0 = x0, node.y0 = y0;\n node.x1 = x1, node.y1 = y1;\n return;\n }\n\n var valueOffset = sums[i],\n valueTarget = (value / 2) + valueOffset,\n k = i + 1,\n hi = j - 1;\n\n while (k < hi) {\n var mid = k + hi >>> 1;\n if (sums[mid] < valueTarget) k = mid + 1;\n else hi = mid;\n }\n\n if ((valueTarget - sums[k - 1]) < (sums[k] - valueTarget) && i + 1 < k) --k;\n\n var valueLeft = sums[k] - valueOffset,\n valueRight = value - valueLeft;\n\n if ((x1 - x0) > (y1 - y0)) {\n var xk = value ? (x0 * valueRight + x1 * valueLeft) / value : x1;\n partition(i, k, valueLeft, x0, y0, xk, y1);\n partition(k, j, valueRight, xk, y0, x1, y1);\n } else {\n var yk = value ? (y0 * valueRight + y1 * valueLeft) / value : y1;\n partition(i, k, valueLeft, x0, y0, x1, yk);\n partition(k, j, valueRight, x0, yk, x1, y1);\n }\n }\n}\n","import dice from \"./dice.js\";\nimport slice from \"./slice.js\";\n\nexport default function(parent, x0, y0, x1, y1) {\n (parent.depth & 1 ? slice : dice)(parent, x0, y0, x1, y1);\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\nimport {phi, squarifyRatio} from \"./squarify.js\";\n\nexport default (function custom(ratio) {\n\n function resquarify(parent, x0, y0, x1, y1) {\n if ((rows = parent._squarify) && (rows.ratio === ratio)) {\n var rows,\n row,\n nodes,\n i,\n j = -1,\n n,\n m = rows.length,\n value = parent.value;\n\n while (++j < m) {\n row = rows[j], nodes = row.children;\n for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value;\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += (y1 - y0) * row.value / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += (x1 - x0) * row.value / value : x1, y1);\n value -= row.value;\n }\n } else {\n parent._squarify = rows = squarifyRatio(ratio, parent, x0, y0, x1, y1);\n rows.ratio = ratio;\n }\n }\n\n resquarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return resquarify;\n})(phi);\n","import {shuffle} from \"../array.js\";\n\nexport default function(circles) {\n var i = 0, n = (circles = shuffle(Array.from(circles))).length, B = [], p, e;\n\n while (i < n) {\n p = circles[i];\n if (e && enclosesWeak(e, p)) ++i;\n else e = encloseBasis(B = extendBasis(B, p)), i = 0;\n }\n\n return e;\n}\n\nfunction extendBasis(B, p) {\n var i, j;\n\n if (enclosesWeakAll(p, B)) return [p];\n\n // If we get here then B must have at least one element.\n for (i = 0; i < B.length; ++i) {\n if (enclosesNot(p, B[i])\n && enclosesWeakAll(encloseBasis2(B[i], p), B)) {\n return [B[i], p];\n }\n }\n\n // If we get here then B must have at least two elements.\n for (i = 0; i < B.length - 1; ++i) {\n for (j = i + 1; j < B.length; ++j) {\n if (enclosesNot(encloseBasis2(B[i], B[j]), p)\n && enclosesNot(encloseBasis2(B[i], p), B[j])\n && enclosesNot(encloseBasis2(B[j], p), B[i])\n && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) {\n return [B[i], B[j], p];\n }\n }\n }\n\n // If we get here then something is very wrong.\n throw new Error;\n}\n\nfunction enclosesNot(a, b) {\n var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y;\n return dr < 0 || dr * dr < dx * dx + dy * dy;\n}\n\nfunction enclosesWeak(a, b) {\n var dr = a.r - b.r + Math.max(a.r, b.r, 1) * 1e-9, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction enclosesWeakAll(a, B) {\n for (var i = 0; i < B.length; ++i) {\n if (!enclosesWeak(a, B[i])) {\n return false;\n }\n }\n return true;\n}\n\nfunction encloseBasis(B) {\n switch (B.length) {\n case 1: return encloseBasis1(B[0]);\n case 2: return encloseBasis2(B[0], B[1]);\n case 3: return encloseBasis3(B[0], B[1], B[2]);\n }\n}\n\nfunction encloseBasis1(a) {\n return {\n x: a.x,\n y: a.y,\n r: a.r\n };\n}\n\nfunction encloseBasis2(a, b) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x21 = x2 - x1, y21 = y2 - y1, r21 = r2 - r1,\n l = Math.sqrt(x21 * x21 + y21 * y21);\n return {\n x: (x1 + x2 + x21 / l * r21) / 2,\n y: (y1 + y2 + y21 / l * r21) / 2,\n r: (l + r1 + r2) / 2\n };\n}\n\nfunction encloseBasis3(a, b, c) {\n var x1 = a.x, y1 = a.y, r1 = a.r,\n x2 = b.x, y2 = b.y, r2 = b.r,\n x3 = c.x, y3 = c.y, r3 = c.r,\n a2 = x1 - x2,\n a3 = x1 - x3,\n b2 = y1 - y2,\n b3 = y1 - y3,\n c2 = r2 - r1,\n c3 = r3 - r1,\n d1 = x1 * x1 + y1 * y1 - r1 * r1,\n d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2,\n d3 = d1 - x3 * x3 - y3 * y3 + r3 * r3,\n ab = a3 * b2 - a2 * b3,\n xa = (b2 * d3 - b3 * d2) / (ab * 2) - x1,\n xb = (b3 * c2 - b2 * c3) / ab,\n ya = (a3 * d2 - a2 * d3) / (ab * 2) - y1,\n yb = (a2 * c3 - a3 * c2) / ab,\n A = xb * xb + yb * yb - 1,\n B = 2 * (r1 + xa * xb + ya * yb),\n C = xa * xa + ya * ya - r1 * r1,\n r = -(A ? (B + Math.sqrt(B * B - 4 * A * C)) / (2 * A) : C / B);\n return {\n x: x1 + xa + xb * r,\n y: y1 + ya + yb * r,\n r: r\n };\n}\n","import {packEnclose} from \"./siblings.js\";\nimport {optional} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nfunction defaultRadius(d) {\n return Math.sqrt(d.value);\n}\n\nexport default function() {\n var radius = null,\n dx = 1,\n dy = 1,\n padding = constantZero;\n\n function pack(root) {\n root.x = dx / 2, root.y = dy / 2;\n if (radius) {\n root.eachBefore(radiusLeaf(radius))\n .eachAfter(packChildren(padding, 0.5))\n .eachBefore(translateChild(1));\n } else {\n root.eachBefore(radiusLeaf(defaultRadius))\n .eachAfter(packChildren(constantZero, 1))\n .eachAfter(packChildren(padding, root.r / Math.min(dx, dy)))\n .eachBefore(translateChild(Math.min(dx, dy) / (2 * root.r)));\n }\n return root;\n }\n\n pack.radius = function(x) {\n return arguments.length ? (radius = optional(x), pack) : radius;\n };\n\n pack.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], pack) : [dx, dy];\n };\n\n pack.padding = function(x) {\n return arguments.length ? (padding = typeof x === \"function\" ? x : constant(+x), pack) : padding;\n };\n\n return pack;\n}\n\nfunction radiusLeaf(radius) {\n return function(node) {\n if (!node.children) {\n node.r = Math.max(0, +radius(node) || 0);\n }\n };\n}\n\nfunction packChildren(padding, k) {\n return function(node) {\n if (children = node.children) {\n var children,\n i,\n n = children.length,\n r = padding(node) * k || 0,\n e;\n\n if (r) for (i = 0; i < n; ++i) children[i].r += r;\n e = packEnclose(children);\n if (r) for (i = 0; i < n; ++i) children[i].r -= r;\n node.r = e + r;\n }\n };\n}\n\nfunction translateChild(k) {\n return function(node) {\n var parent = node.parent;\n node.r *= k;\n if (parent) {\n node.x = parent.x + k * node.x;\n node.y = parent.y + k * node.y;\n }\n };\n}\n","import array from \"../array.js\";\nimport enclose from \"./enclose.js\";\n\nfunction place(b, a, c) {\n var dx = b.x - a.x, x, a2,\n dy = b.y - a.y, y, b2,\n d2 = dx * dx + dy * dy;\n if (d2) {\n a2 = a.r + c.r, a2 *= a2;\n b2 = b.r + c.r, b2 *= b2;\n if (a2 > b2) {\n x = (d2 + b2 - a2) / (2 * d2);\n y = Math.sqrt(Math.max(0, b2 / d2 - x * x));\n c.x = b.x - x * dx - y * dy;\n c.y = b.y - x * dy + y * dx;\n } else {\n x = (d2 + a2 - b2) / (2 * d2);\n y = Math.sqrt(Math.max(0, a2 / d2 - x * x));\n c.x = a.x + x * dx - y * dy;\n c.y = a.y + x * dy + y * dx;\n }\n } else {\n c.x = a.x + c.r;\n c.y = a.y;\n }\n}\n\nfunction intersects(a, b) {\n var dr = a.r + b.r - 1e-6, dx = b.x - a.x, dy = b.y - a.y;\n return dr > 0 && dr * dr > dx * dx + dy * dy;\n}\n\nfunction score(node) {\n var a = node._,\n b = node.next._,\n ab = a.r + b.r,\n dx = (a.x * b.r + b.x * a.r) / ab,\n dy = (a.y * b.r + b.y * a.r) / ab;\n return dx * dx + dy * dy;\n}\n\nfunction Node(circle) {\n this._ = circle;\n this.next = null;\n this.previous = null;\n}\n\nexport function packEnclose(circles) {\n if (!(n = (circles = array(circles)).length)) return 0;\n\n var a, b, c, n, aa, ca, i, j, k, sj, sk;\n\n // Place the first circle.\n a = circles[0], a.x = 0, a.y = 0;\n if (!(n > 1)) return a.r;\n\n // Place the second circle.\n b = circles[1], a.x = -b.r, b.x = a.r, b.y = 0;\n if (!(n > 2)) return a.r + b.r;\n\n // Place the third circle.\n place(b, a, c = circles[2]);\n\n // Initialize the front-chain using the first three circles a, b and c.\n a = new Node(a), b = new Node(b), c = new Node(c);\n a.next = c.previous = b;\n b.next = a.previous = c;\n c.next = b.previous = a;\n\n // Attempt to place each remaining circle…\n pack: for (i = 3; i < n; ++i) {\n place(a._, b._, c = circles[i]), c = new Node(c);\n\n // Find the closest intersecting circle on the front-chain, if any.\n // “Closeness” is determined by linear distance along the front-chain.\n // “Ahead” or “behind” is likewise determined by linear distance.\n j = b.next, k = a.previous, sj = b._.r, sk = a._.r;\n do {\n if (sj <= sk) {\n if (intersects(j._, c._)) {\n b = j, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sj += j._.r, j = j.next;\n } else {\n if (intersects(k._, c._)) {\n a = k, a.next = b, b.previous = a, --i;\n continue pack;\n }\n sk += k._.r, k = k.previous;\n }\n } while (j !== k.next);\n\n // Success! Insert the new circle c between a and b.\n c.previous = a, c.next = b, a.next = b.previous = b = c;\n\n // Compute the new closest circle pair to the centroid.\n aa = score(a);\n while ((c = c.next) !== b) {\n if ((ca = score(c)) < aa) {\n a = c, aa = ca;\n }\n }\n b = a.next;\n }\n\n // Compute the enclosing circle of the front chain.\n a = [b._], c = b; while ((c = c.next) !== b) a.push(c._); c = enclose(a);\n\n // Translate the circles to put the enclosing circle around the origin.\n for (i = 0; i < n; ++i) a = circles[i], a.x -= c.x, a.y -= c.y;\n\n return c.r;\n}\n\nexport default function(circles) {\n packEnclose(circles);\n return circles;\n}\n","import roundNode from \"./treemap/round.js\";\nimport treemapDice from \"./treemap/dice.js\";\n\nexport default function() {\n var dx = 1,\n dy = 1,\n padding = 0,\n round = false;\n\n function partition(root) {\n var n = root.height + 1;\n root.x0 =\n root.y0 = padding;\n root.x1 = dx;\n root.y1 = dy / n;\n root.eachBefore(positionNode(dy, n));\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(dy, n) {\n return function(node) {\n if (node.children) {\n treemapDice(node, node.x0, dy * (node.depth + 1) / n, node.x1, dy * (node.depth + 2) / n);\n }\n var x0 = node.x0,\n y0 = node.y0,\n x1 = node.x1 - padding,\n y1 = node.y1 - padding;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n };\n }\n\n partition.round = function(x) {\n return arguments.length ? (round = !!x, partition) : round;\n };\n\n partition.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], partition) : [dx, dy];\n };\n\n partition.padding = function(x) {\n return arguments.length ? (padding = +x, partition) : padding;\n };\n\n return partition;\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (x1 - x0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.y0 = y0, node.y1 = y1;\n node.x0 = x0, node.x1 = x0 += node.value * k;\n }\n}\n","import roundNode from \"./round.js\";\nimport squarify from \"./squarify.js\";\nimport {required} from \"../accessors.js\";\nimport constant, {constantZero} from \"../constant.js\";\n\nexport default function() {\n var tile = squarify,\n round = false,\n dx = 1,\n dy = 1,\n paddingStack = [0],\n paddingInner = constantZero,\n paddingTop = constantZero,\n paddingRight = constantZero,\n paddingBottom = constantZero,\n paddingLeft = constantZero;\n\n function treemap(root) {\n root.x0 =\n root.y0 = 0;\n root.x1 = dx;\n root.y1 = dy;\n root.eachBefore(positionNode);\n paddingStack = [0];\n if (round) root.eachBefore(roundNode);\n return root;\n }\n\n function positionNode(node) {\n var p = paddingStack[node.depth],\n x0 = node.x0 + p,\n y0 = node.y0 + p,\n x1 = node.x1 - p,\n y1 = node.y1 - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n node.x0 = x0;\n node.y0 = y0;\n node.x1 = x1;\n node.y1 = y1;\n if (node.children) {\n p = paddingStack[node.depth + 1] = paddingInner(node) / 2;\n x0 += paddingLeft(node) - p;\n y0 += paddingTop(node) - p;\n x1 -= paddingRight(node) - p;\n y1 -= paddingBottom(node) - p;\n if (x1 < x0) x0 = x1 = (x0 + x1) / 2;\n if (y1 < y0) y0 = y1 = (y0 + y1) / 2;\n tile(node, x0, y0, x1, y1);\n }\n }\n\n treemap.round = function(x) {\n return arguments.length ? (round = !!x, treemap) : round;\n };\n\n treemap.size = function(x) {\n return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];\n };\n\n treemap.tile = function(x) {\n return arguments.length ? (tile = required(x), treemap) : tile;\n };\n\n treemap.padding = function(x) {\n return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();\n };\n\n treemap.paddingInner = function(x) {\n return arguments.length ? (paddingInner = typeof x === \"function\" ? x : constant(+x), treemap) : paddingInner;\n };\n\n treemap.paddingOuter = function(x) {\n return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();\n };\n\n treemap.paddingTop = function(x) {\n return arguments.length ? (paddingTop = typeof x === \"function\" ? x : constant(+x), treemap) : paddingTop;\n };\n\n treemap.paddingRight = function(x) {\n return arguments.length ? (paddingRight = typeof x === \"function\" ? x : constant(+x), treemap) : paddingRight;\n };\n\n treemap.paddingBottom = function(x) {\n return arguments.length ? (paddingBottom = typeof x === \"function\" ? x : constant(+x), treemap) : paddingBottom;\n };\n\n treemap.paddingLeft = function(x) {\n return arguments.length ? (paddingLeft = typeof x === \"function\" ? x : constant(+x), treemap) : paddingLeft;\n };\n\n return treemap;\n}\n","export default function(node) {\n node.x0 = Math.round(node.x0);\n node.y0 = Math.round(node.y0);\n node.x1 = Math.round(node.x1);\n node.y1 = Math.round(node.y1);\n}\n","export default function(parent, x0, y0, x1, y1) {\n var nodes = parent.children,\n node,\n i = -1,\n n = nodes.length,\n k = parent.value && (y1 - y0) / parent.value;\n\n while (++i < n) {\n node = nodes[i], node.x0 = x0, node.x1 = x1;\n node.y0 = y0, node.y1 = y0 += node.value * k;\n }\n}\n","import treemapDice from \"./dice.js\";\nimport treemapSlice from \"./slice.js\";\n\nexport var phi = (1 + Math.sqrt(5)) / 2;\n\nexport function squarifyRatio(ratio, parent, x0, y0, x1, y1) {\n var rows = [],\n nodes = parent.children,\n row,\n nodeValue,\n i0 = 0,\n i1 = 0,\n n = nodes.length,\n dx, dy,\n value = parent.value,\n sumValue,\n minValue,\n maxValue,\n newRatio,\n minRatio,\n alpha,\n beta;\n\n while (i0 < n) {\n dx = x1 - x0, dy = y1 - y0;\n\n // Find the next non-empty node.\n do sumValue = nodes[i1++].value; while (!sumValue && i1 < n);\n minValue = maxValue = sumValue;\n alpha = Math.max(dy / dx, dx / dy) / (value * ratio);\n beta = sumValue * sumValue * alpha;\n minRatio = Math.max(maxValue / beta, beta / minValue);\n\n // Keep adding nodes while the aspect ratio maintains or improves.\n for (; i1 < n; ++i1) {\n sumValue += nodeValue = nodes[i1].value;\n if (nodeValue < minValue) minValue = nodeValue;\n if (nodeValue > maxValue) maxValue = nodeValue;\n beta = sumValue * sumValue * alpha;\n newRatio = Math.max(maxValue / beta, beta / minValue);\n if (newRatio > minRatio) { sumValue -= nodeValue; break; }\n minRatio = newRatio;\n }\n\n // Position and record the row orientation.\n rows.push(row = {value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1)});\n if (row.dice) treemapDice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);\n else treemapSlice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);\n value -= sumValue, i0 = i1;\n }\n\n return rows;\n}\n\nexport default (function custom(ratio) {\n\n function squarify(parent, x0, y0, x1, y1) {\n squarifyRatio(ratio, parent, x0, y0, x1, y1);\n }\n\n squarify.ratio = function(x) {\n return custom((x = +x) > 1 ? x : 1);\n };\n\n return squarify;\n})(phi);\n","/**\n * This file must not be changed or exchanged.\n *\n * @see http://bpmn.io/license for more information.\n */\n\nimport {\n assignStyle,\n domify,\n delegate as domDelegate,\n query as domQuery\n} from 'min-dom';\n\n\n// inlined ../../resources/logo.svg\nvar BPMNIO_LOGO_SVG = '';\n\nexport var BPMNIO_IMG = BPMNIO_LOGO_SVG;\n\nexport var LOGO_STYLES = {\n verticalAlign: 'middle'\n};\n\nexport var LINK_STYLES = {\n 'color': '#404040'\n};\n\nvar LIGHTBOX_STYLES = {\n 'zIndex': '1001',\n 'position': 'fixed',\n 'top': '0',\n 'left': '0',\n 'right': '0',\n 'bottom': '0'\n};\n\nvar BACKDROP_STYLES = {\n 'width': '100%',\n 'height': '100%',\n 'background': 'rgba(40,40,40,0.2)'\n};\n\nvar NOTICE_STYLES = {\n 'position': 'absolute',\n 'left': '50%',\n 'top': '40%',\n 'transform': 'translate(-50%)',\n 'width': '260px',\n 'padding': '10px',\n 'background': 'white',\n 'boxShadow': '0 1px 4px rgba(0,0,0,0.3)',\n 'fontFamily': 'Helvetica, Arial, sans-serif',\n 'fontSize': '14px',\n 'display': 'flex',\n 'lineHeight': '1.3'\n};\n\nvar LIGHTBOX_MARKUP =\n '
\n * 'GATEWAY_PARALLEL': {\n * d: 'm {mx},{my} {e.x0},0 0,{e.x1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} ' +\n '-{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z',\n * height: 17.5,\n * width: 17.5,\n * heightElements: [2.5, 7.5],\n * widthElements: [2.5, 7.5]\n * }\n *\n *
It's important to specify a correct height and width for the path as the scaling\n * is based on the ratio between the specified height and width in this object and the\n * height and width that is set as scale target (Note x,y coordinates will be scaled with\n * individual ratios).
\n *The 'heightElements' and 'widthElements' array must contain the values that will be scaled.\n * The scaling is based on the computed ratios.\n * Coordinates on the y axis should be in the heightElement's array, they will be scaled using\n * the computed ratio coefficient.\n * In the parameterized path the scaled values can be accessed through the 'e' object in {} brackets.\n *
Use case is to scale the content of elements (event, gateways) based\n * on the element bounding box's size.\n *
\n *Scaling a path with transform() will also scale the stroke and IE does not support\n * the option 'non-scaling-stroke' to prevent this.\n * Also there are use cases where only some parts of a path should be\n * scaled.
\n *\n * @param {string} pathId The ID of the path.\n * @param {Object} param\n * Example param object scales the path to 60% size of the container (data.width, data.height).\n *
\n * {\n * xScaleFactor: 0.6,\n * yScaleFactor:0.6,\n * containerWidth: data.width,\n * containerHeight: data.height,\n * position: {\n * mx: 0.46,\n * my: 0.2,\n * }\n * }\n *\n *
position: {\n * mx: 0.5,\n * my: 0.5,\n * }\n * Upper left corner of the container\n *
position: {\n * mx: 0.0,\n * my: 0.0,\n * }\n *
hover
and selected
classes to them.\n *\n * @class\n *\n * Makes elements selectable, too.\n *\n * @param {Canvas} canvas\n * @param {EventBus} eventBus\n * @param {Selection} selection\n */\nexport default function SelectionVisuals(canvas, eventBus, selection) {\n this._canvas = canvas;\n\n var self = this;\n\n this._multiSelectionBox = null;\n\n function addMarker(e, cls) {\n canvas.addMarker(e, cls);\n }\n\n function removeMarker(e, cls) {\n canvas.removeMarker(e, cls);\n }\n\n eventBus.on('element.hover', function(event) {\n addMarker(event.element, MARKER_HOVER);\n });\n\n eventBus.on('element.out', function(event) {\n removeMarker(event.element, MARKER_HOVER);\n });\n\n eventBus.on('selection.changed', function(event) {\n\n function deselect(s) {\n removeMarker(s, MARKER_SELECTED);\n }\n\n function select(s) {\n addMarker(s, MARKER_SELECTED);\n }\n\n var oldSelection = event.oldSelection,\n newSelection = event.newSelection;\n\n forEach(oldSelection, function(e) {\n if (newSelection.indexOf(e) === -1) {\n deselect(e);\n }\n });\n\n forEach(newSelection, function(e) {\n if (oldSelection.indexOf(e) === -1) {\n select(e);\n }\n });\n\n self._updateSelectionOutline(newSelection);\n });\n\n\n eventBus.on('element.changed', function(event) {\n if (selection.isSelected(event.element)) {\n self._updateSelectionOutline(selection.get());\n }\n });\n}\n\nSelectionVisuals.$inject = [\n 'canvas',\n 'eventBus',\n 'selection'\n];\n\nSelectionVisuals.prototype._updateSelectionOutline = function(selection) {\n var layer = this._canvas.getLayer('selectionOutline');\n\n svgClear(layer);\n\n var enabled = selection.length > 1;\n\n var container = this._canvas.getContainer();\n\n svgClasses(container)[enabled ? 'add' : 'remove']('djs-multi-select');\n\n if (!enabled) {\n return;\n }\n\n var bBox = addSelectionOutlinePadding(getBBox(selection));\n\n var rect = svgCreate('rect');\n\n svgAttr(rect, assign({\n rx: 3\n }, bBox));\n\n svgClasses(rect).add('djs-selection-outline');\n\n svgAppend(layer, rect);\n};\n\n// helpers //////////\n\nfunction addSelectionOutlinePadding(bBox) {\n return {\n x: bBox.x - SELECTION_OUTLINE_PADDING,\n y: bBox.y - SELECTION_OUTLINE_PADDING,\n width: bBox.width + SELECTION_OUTLINE_PADDING * 2,\n height: bBox.height + SELECTION_OUTLINE_PADDING * 2\n };\n}","import {\n hasPrimaryModifier,\n hasSecondaryModifier,\n isPrimaryButton\n} from '../../util/Mouse';\n\nimport {\n find,\n isArray\n} from 'min-dash';\n\n/**\n * @typedef {import('../../core/Canvas').default} Canvas\n * @typedef {import('../../core/ElementRegistry').default} ElementRegistry\n * @typedef {import('../../core/EventBus').default} EventBus\n * @typedef {import('./Selection').default} Selection\n */\n\n/**\n * @param {EventBus} eventBus\n * @param {Selection} selection\n * @param {Canvas} canvas\n * @param {ElementRegistry} elementRegistry\n */\nexport default function SelectionBehavior(eventBus, selection, canvas, elementRegistry) {\n\n // Select elements on create\n eventBus.on('create.end', 500, function(event) {\n var context = event.context,\n canExecute = context.canExecute,\n elements = context.elements,\n hints = context.hints || {},\n autoSelect = hints.autoSelect;\n\n if (canExecute) {\n if (autoSelect === false) {\n\n // Select no elements\n return;\n }\n\n if (isArray(autoSelect)) {\n selection.select(autoSelect);\n } else {\n\n // Select all elements by default\n selection.select(elements.filter(isShown));\n }\n }\n });\n\n // Select connection targets on connect\n eventBus.on('connect.end', 500, function(event) {\n var context = event.context,\n connection = context.connection;\n\n if (connection) {\n selection.select(connection);\n }\n });\n\n // Select shapes on move\n eventBus.on('shape.move.end', 500, function(event) {\n var previousSelection = event.previousSelection || [];\n\n var shape = elementRegistry.get(event.context.shape.id);\n\n // Always select main shape on move\n var isSelected = find(previousSelection, function(selectedShape) {\n return shape.id === selectedShape.id;\n });\n\n if (!isSelected) {\n selection.select(shape);\n }\n });\n\n // Select elements on click\n eventBus.on('element.click', function(event) {\n\n if (!isPrimaryButton(event)) {\n return;\n }\n\n var element = event.element;\n\n if (element === canvas.getRootElement()) {\n element = null;\n }\n\n var isSelected = selection.isSelected(element),\n isMultiSelect = selection.get().length > 1;\n\n // Add to selection if CTRL or SHIFT pressed\n var add = hasPrimaryModifier(event) || hasSecondaryModifier(event);\n\n if (isSelected && isMultiSelect) {\n if (add) {\n\n // Deselect element\n return selection.deselect(element);\n } else {\n\n // Select element only\n return selection.select(element);\n }\n } else if (!isSelected) {\n\n // Select element\n selection.select(element, add);\n } else {\n\n // Deselect element\n selection.deselect(element);\n }\n });\n}\n\nSelectionBehavior.$inject = [\n 'eventBus',\n 'selection',\n 'canvas',\n 'elementRegistry'\n];\n\n\nfunction isShown(element) {\n return !element.hidden;\n}\n","export function isMac() {\n return (/mac/i).test(navigator.platform);\n}","/**\n * Util that provides unique IDs.\n *\n * @class\n * @constructor\n *\n * The ids can be customized via a given prefix and contain a random value to avoid collisions.\n *\n * @param {string} [prefix] a prefix to prepend to generated ids (for better readability)\n */\nexport default function IdGenerator(prefix) {\n\n this._counter = 0;\n this._prefix = (prefix ? prefix + '-' : '') + Math.floor(Math.random() * 1000000000) + '-';\n}\n\n/**\n * Returns a next unique ID.\n *\n * @return {string} the id\n */\nIdGenerator.prototype.next = function() {\n return this._prefix + (++this._counter);\n};\n","import {\n isArray,\n isString,\n isObject,\n assign,\n forEach,\n find,\n filter,\n matchPattern,\n isDefined\n} from 'min-dash';\n\nimport {\n assignStyle,\n domify,\n classes as domClasses,\n attr as domAttr,\n remove as domRemove,\n clear as domClear\n} from 'min-dom';\n\nimport {\n getBBox\n} from '../../util/Elements';\n\nimport Ids from '../../util/IdGenerator';\n\n// document wide unique overlay ids\nvar ids = new Ids('ov');\n\nvar LOW_PRIORITY = 500;\n\n/**\n * @typedef {import('../../core/Canvas').default} Canvas\n * @typedef {import('../../core/ElementRegistry').default} ElementRegistry\n * @typedef {import('../../core/EventBus').default} EventBus\n *\n * @typedef {import('../../model/Types').Element} Element\n *\n * @typedef { {\n * minZoom?: number,\n * maxZoom?: number\n * } } OverlaysConfigShow\n *\n * @typedef { {\n * min?: number,\n * max?: number\n * } } OverlaysConfigScale\n *\n * @typedef { {\n* id: string,\n* type: string | null,\n* element: Element | string\n* } & OverlayAttrs } Overlay\n*\n * @typedef { {\n * html: HTMLElement | string,\n * position: {\n * top?: number,\n * right?: number,\n * bottom?: number,\n * left?: number\n * }\n * } & OverlaysConfigDefault } OverlayAttrs\n *\n * @typedef { {\n * html: HTMLElement,\n * element: Element,\n * overlays: Overlay[]\n * } } OverlayContainer\n *\n * @typedef {{\n * defaults?: OverlaysConfigDefault\n * }} OverlaysConfig\n *\n * @typedef { {\n * show?: OverlaysConfigShow,\n * scale?: OverlaysConfigScale | boolean\n * } } OverlaysConfigDefault\n *\n * @typedef { {\n * id?: string;\n * element?: Element | string;\n * type?: string;\n * } | string } OverlaysFilter\n */\n\n/**\n * A service that allows users to attach overlays to diagram elements.\n *\n * The overlay service will take care of overlay positioning during updates.\n *\n * @example\n *\n * ```javascript\n * // add a pink badge on the top left of the shape\n *\n * overlays.add(someShape, {\n * position: {\n * top: -5,\n * left: -5\n * },\n * html: '