{"version":3,"file":"hierarchy.js","sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap fdf0235dd5b3914417f2","webpack:///./src/util.js","webpack:///./src/layout/base.js","webpack:///./src/layout/do-layout.js","webpack:///./src/layout/hierarchy.js","webpack:///./src/layout/separate-root.js","webpack:///./src/index.js","webpack:///./src/compact-box.js","webpack:///./node_modules/@antv/util/lib/mix.js","webpack:///./src/layout/non-layered-tidy.js","webpack:///./src/dendrogram.js","webpack:///./src/layout/dendrogram.js","webpack:///./src/indented.js","webpack:///./src/layout/indented.js","webpack:///./src/mindmap.js","webpack:///./src/layout/mindmap.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Hierarchy\"] = factory();\n\telse\n\t\troot[\"Hierarchy\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap fdf0235dd5b3914417f2","var assign = require('@antv/util/lib/mix');\n\nmodule.exports = {\n assign: assign\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/util.js\n// module id = 0\n// module chunks = 0","var hierarchy = require('./hierarchy');\n\nvar Layout =\n/*#__PURE__*/\nfunction () {\n function Layout(root, options) {\n if (options === void 0) {\n options = {};\n }\n\n var me = this;\n me.options = options;\n me.rootNode = hierarchy(root, options);\n }\n\n var _proto = Layout.prototype;\n\n _proto.execute = function execute() {\n throw new Error('please override this method');\n };\n\n return Layout;\n}();\n\nmodule.exports = Layout;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout/base.js\n// module id = 1\n// module chunks = 0","var separateTree = require('./separate-root');\n\nvar VALID_DIRECTIONS = ['LR', // left to right\n'RL', // right to left\n'TB', // top to bottom\n'BT', // bottom to top\n'H', // horizontal\n'V' // vertical\n];\nvar HORIZONTAL_DIRECTIONS = ['LR', 'RL', 'H'];\n\nvar isHorizontal = function isHorizontal(direction) {\n return HORIZONTAL_DIRECTIONS.indexOf(direction) > -1;\n};\n\nvar DEFAULT_DIRECTION = VALID_DIRECTIONS[0];\n\nmodule.exports = function (root, options, layoutAlgrithm) {\n var direction = options.direction || DEFAULT_DIRECTION;\n options.isHorizontal = isHorizontal(direction);\n\n if (direction && VALID_DIRECTIONS.indexOf(direction) === -1) {\n throw new TypeError(\"Invalid direction: \" + direction);\n }\n\n if (direction === VALID_DIRECTIONS[0]) {\n // LR\n layoutAlgrithm(root, options);\n } else if (direction === VALID_DIRECTIONS[1]) {\n // RL\n layoutAlgrithm(root, options);\n root.right2left();\n } else if (direction === VALID_DIRECTIONS[2]) {\n // TB\n layoutAlgrithm(root, options);\n } else if (direction === VALID_DIRECTIONS[3]) {\n // BT\n layoutAlgrithm(root, options);\n root.bottom2top();\n } else if (direction === VALID_DIRECTIONS[4] || direction === VALID_DIRECTIONS[5]) {\n // H or V\n // separate into left and right trees\n var _separateTree = separateTree(root, options),\n left = _separateTree.left,\n right = _separateTree.right; // do layout for left and right trees\n\n\n layoutAlgrithm(left, options);\n layoutAlgrithm(right, options);\n options.isHorizontal ? left.right2left() : left.bottom2top(); // combine left and right trees\n\n right.translate(left.x - right.x, left.y - right.y); // translate root\n\n root.x = left.x;\n root.y = right.y;\n var bb = root.getBoundingBox();\n\n if (options.isHorizontal) {\n if (bb.top < 0) {\n root.translate(0, -bb.top);\n }\n } else {\n if (bb.left < 0) {\n root.translate(-bb.left, 0);\n }\n }\n }\n\n root.translate(-(root.x + root.width / 2 + root.hgap), -(root.y + root.height / 2 + root.vgap));\n return root;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout/do-layout.js\n// module id = 2\n// module chunks = 0","/* eslint-disable no-cond-assign */\nvar util = require('../util');\n\nvar PEM = 18;\nvar DEFAULT_HEIGHT = PEM * 2;\nvar DEFAULT_GAP = PEM;\nvar DEFAULT_OPTIONS = {\n getId: function getId(d) {\n return d.id || d.name;\n },\n getHGap: function getHGap(d) {\n return d.hgap || DEFAULT_GAP;\n },\n getVGap: function getVGap(d) {\n return d.vgap || DEFAULT_GAP;\n },\n getChildren: function getChildren(d) {\n return d.children;\n },\n getHeight: function getHeight(d) {\n return d.height || DEFAULT_HEIGHT;\n },\n getWidth: function getWidth(d) {\n var name = d.name || ' ';\n return d.width || name.split('').length * PEM; // FIXME DO NOT get width like this\n }\n};\n\nfunction Node(data, options) {\n var me = this;\n me.vgap = me.hgap = 0;\n if (data instanceof Node) return data;\n me.data = data;\n /*\n * Gaps: filling space between nodes\n * (x, y) ----------------------\n * | vgap |\n * | -------------------- h\n * | h | | e\n * | g | | i\n * | a | | g\n * | p | | h\n * | --------------------- t\n * | |\n * -----------width------------\n */\n\n var hgap = options.getHGap(data);\n var vgap = options.getVGap(data);\n me.width = options.getWidth(data);\n me.height = options.getHeight(data);\n me.id = options.getId(data);\n me.x = me.y = 0;\n me.depth = 0;\n\n if (!me.children) {\n me.children = [];\n }\n\n me.addGap(hgap, vgap);\n return me;\n}\n\nutil.assign(Node.prototype, {\n isRoot: function isRoot() {\n return this.depth === 0;\n },\n isLeaf: function isLeaf() {\n return this.children.length === 0;\n },\n addGap: function addGap(hgap, vgap) {\n var me = this;\n me.hgap += hgap;\n me.vgap += vgap;\n me.width += 2 * hgap;\n me.height += 2 * vgap;\n },\n eachNode: function eachNode(callback) {\n // Depth First traverse\n var me = this;\n var nodes = [me];\n var current;\n\n while (current = nodes.pop()) {\n callback(current);\n nodes = nodes.concat(current.children);\n }\n },\n DFTraverse: function DFTraverse(callback) {\n // Depth First traverse\n this.eachNode(callback);\n },\n BFTraverse: function BFTraverse(callback) {\n // Breadth First traverse\n var me = this;\n var nodes = [me];\n var current;\n\n while (current = nodes.shift()) {\n callback(current);\n nodes = nodes.concat(current.children);\n }\n },\n getBoundingBox: function getBoundingBox() {\n // BBox for just one tree node\n var bb = {\n left: Number.MAX_VALUE,\n top: Number.MAX_VALUE,\n width: 0,\n height: 0\n };\n this.eachNode(function (node) {\n bb.left = Math.min(bb.left, node.x);\n bb.top = Math.min(bb.top, node.y);\n bb.width = Math.max(bb.width, node.x + node.width);\n bb.height = Math.max(bb.height, node.y + node.height);\n });\n return bb;\n },\n // translate\n translate: function translate(tx, ty) {\n if (tx === void 0) {\n tx = 0;\n }\n\n if (ty === void 0) {\n ty = 0;\n }\n\n this.eachNode(function (node) {\n node.x += tx;\n node.y += ty;\n });\n },\n right2left: function right2left() {\n var me = this;\n var bb = me.getBoundingBox();\n me.eachNode(function (node) {\n node.x = node.x - (node.x - bb.left) * 2 - node.width; // node.x = - node.x;\n });\n me.translate(bb.width, 0);\n },\n bottom2top: function bottom2top() {\n var me = this;\n var bb = me.getBoundingBox();\n me.eachNode(function (node) {\n node.y = node.y - (node.y - bb.top) * 2 - node.height; // node.y = - node.y;\n });\n me.translate(0, bb.height);\n }\n});\n\nfunction hierarchy(data, options, isolated) {\n if (options === void 0) {\n options = {};\n }\n\n options = util.assign({}, DEFAULT_OPTIONS, options);\n var root = new Node(data, options);\n var nodes = [root];\n var node;\n\n if (!isolated && !data.collapsed) {\n while (node = nodes.pop()) {\n if (!node.data.collapsed) {\n var children = options.getChildren(node.data);\n var length = children ? children.length : 0;\n node.children = new Array(length);\n\n if (children && length) {\n for (var i = 0; i < length; i++) {\n var child = new Node(children[i], options);\n node.children[i] = child;\n nodes.push(child);\n child.parent = node;\n child.depth = node.depth + 1;\n }\n }\n }\n }\n }\n\n return root;\n}\n\nmodule.exports = hierarchy;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout/hierarchy.js\n// module id = 3\n// module chunks = 0","var hierarchy = require('./hierarchy');\n\nmodule.exports = function (root, options) {\n // separate into left and right trees\n var left = hierarchy(root.data, options, true); // root only\n\n var right = hierarchy(root.data, options, true); // root only\n // automatically\n\n var treeSize = root.children.length;\n var rightTreeSize = Math.round(treeSize / 2); // separate left and right tree by meta data\n\n var getSide = options.getSide || function (child, index) {\n if (index < rightTreeSize) {\n return 'right';\n }\n\n return 'left';\n };\n\n for (var i = 0; i < treeSize; i++) {\n var child = root.children[i];\n var side = getSide(child, i);\n\n if (side === 'right') {\n right.children.push(child);\n } else {\n left.children.push(child);\n }\n }\n\n left.eachNode(function (node) {\n if (!node.isRoot()) {\n node.side = 'left';\n }\n });\n right.eachNode(function (node) {\n if (!node.isRoot()) {\n node.side = 'right';\n }\n });\n return {\n left: left,\n right: right\n };\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout/separate-root.js\n// module id = 4\n// module chunks = 0","var hierarchy = {\n compactBox: require('./compact-box'),\n dendrogram: require('./dendrogram'),\n indented: require('./indented'),\n mindmap: require('./mindmap')\n};\nmodule.exports = hierarchy;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/index.js\n// module id = 5\n// module chunks = 0","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar TreeLayout = require('./layout/base');\n\nvar nonLayeredTidyTree = require('./layout/non-layered-tidy');\n\nvar doTreeLayout = require('./layout/do-layout');\n\nvar util = require('./util');\n\nvar CompactBoxTreeLayout =\n/*#__PURE__*/\nfunction (_TreeLayout) {\n _inheritsLoose(CompactBoxTreeLayout, _TreeLayout);\n\n function CompactBoxTreeLayout() {\n return _TreeLayout.apply(this, arguments) || this;\n }\n\n var _proto = CompactBoxTreeLayout.prototype;\n\n _proto.execute = function execute() {\n var me = this;\n return doTreeLayout(me.rootNode, me.options, nonLayeredTidyTree);\n };\n\n return CompactBoxTreeLayout;\n}(TreeLayout);\n\nvar DEFAULT_OPTIONS = {};\n\nfunction compactBoxLayout(root, options) {\n options = util.assign({}, DEFAULT_OPTIONS, options);\n return new CompactBoxTreeLayout(root, options).execute();\n}\n\nmodule.exports = compactBoxLayout;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/compact-box.js\n// module id = 6\n// module chunks = 0","function _mix(dist, obj) {\n for (var key in obj) {\n if (obj.hasOwnProperty(key) && key !== 'constructor' && obj[key] !== undefined) {\n dist[key] = obj[key];\n }\n }\n}\n\nvar mix = function mix(dist, src1, src2, src3) {\n if (src1) _mix(dist, src1);\n if (src2) _mix(dist, src2);\n if (src3) _mix(dist, src3);\n return dist;\n};\n\nmodule.exports = mix;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/@antv/util/lib/mix.js\n// module id = 7\n// module chunks = 0","// wrap tree node\nfunction WrappedTree(w, h, y, c) {\n if (c === void 0) {\n c = [];\n }\n\n var me = this; // size\n\n me.w = w || 0;\n me.h = h || 0; // position\n\n me.y = y || 0;\n me.x = 0; // children\n\n me.c = c || [];\n me.cs = c.length; // modified\n\n me.prelim = 0;\n me.mod = 0;\n me.shift = 0;\n me.change = 0; // left/right tree\n\n me.tl = null;\n me.tr = null; // extreme left/right tree\n\n me.el = null;\n me.er = null; // modified left/right tree\n\n me.msel = 0;\n me.mser = 0;\n}\n\nWrappedTree.fromNode = function (root, isHorizontal) {\n if (!root) return null;\n var children = [];\n root.children.forEach(function (child) {\n children.push(WrappedTree.fromNode(child, isHorizontal));\n });\n if (isHorizontal) return new WrappedTree(root.height, root.width, root.x, children);\n return new WrappedTree(root.width, root.height, root.y, children);\n}; // node utils\n\n\nfunction moveRight(node, move, isHorizontal) {\n if (isHorizontal) {\n node.y += move;\n } else {\n node.x += move;\n }\n\n node.children.forEach(function (child) {\n moveRight(child, move, isHorizontal);\n });\n}\n\nfunction getMin(node, isHorizontal) {\n var res = isHorizontal ? node.y : node.x;\n node.children.forEach(function (child) {\n res = Math.min(getMin(child, isHorizontal), res);\n });\n return res;\n}\n\nfunction normalize(node, isHorizontal) {\n var min = getMin(node, isHorizontal);\n moveRight(node, -min, isHorizontal);\n}\n\nfunction convertBack(converted\n/* WrappedTree */\n, root\n/* TreeNode */\n, isHorizontal) {\n if (isHorizontal) {\n root.y = converted.x;\n } else {\n root.x = converted.x;\n }\n\n converted.c.forEach(function (child, i) {\n convertBack(child, root.children[i], isHorizontal);\n });\n}\n\nfunction layer(node, isHorizontal, d) {\n if (d === void 0) {\n d = 0;\n }\n\n if (isHorizontal) {\n node.x = d;\n d += node.width;\n } else {\n node.y = d;\n d += node.height;\n }\n\n node.children.forEach(function (child) {\n layer(child, isHorizontal, d);\n });\n}\n\nmodule.exports = function (root, options) {\n if (options === void 0) {\n options = {};\n }\n\n var isHorizontal = options.isHorizontal;\n\n function firstWalk(t) {\n if (t.cs === 0) {\n setExtremes(t);\n return;\n }\n\n firstWalk(t.c[0]);\n var ih = updateIYL(bottom(t.c[0].el), 0, null);\n\n for (var i = 1; i < t.cs; ++i) {\n firstWalk(t.c[i]);\n var min = bottom(t.c[i].er);\n separate(t, i, ih);\n ih = updateIYL(min, i, ih);\n }\n\n positionRoot(t);\n setExtremes(t);\n }\n\n function setExtremes(t) {\n if (t.cs === 0) {\n t.el = t;\n t.er = t;\n t.msel = t.mser = 0;\n } else {\n t.el = t.c[0].el;\n t.msel = t.c[0].msel;\n t.er = t.c[t.cs - 1].er;\n t.mser = t.c[t.cs - 1].mser;\n }\n }\n\n function separate(t, i, ih) {\n var sr = t.c[i - 1];\n var mssr = sr.mod;\n var cl = t.c[i];\n var mscl = cl.mod;\n\n while (sr !== null && cl !== null) {\n if (bottom(sr) > ih.low) ih = ih.nxt;\n var dist = mssr + sr.prelim + sr.w - (mscl + cl.prelim);\n\n if (dist > 0) {\n mscl += dist;\n moveSubtree(t, i, ih.index, dist);\n }\n\n var sy = bottom(sr);\n var cy = bottom(cl);\n\n if (sy <= cy) {\n sr = nextRightContour(sr);\n if (sr !== null) mssr += sr.mod;\n }\n\n if (sy >= cy) {\n cl = nextLeftContour(cl);\n if (cl !== null) mscl += cl.mod;\n }\n }\n\n if (!sr && !!cl) {\n setLeftThread(t, i, cl, mscl);\n } else if (!!sr && !cl) {\n setRightThread(t, i, sr, mssr);\n }\n }\n\n function moveSubtree(t, i, si, dist) {\n t.c[i].mod += dist;\n t.c[i].msel += dist;\n t.c[i].mser += dist;\n distributeExtra(t, i, si, dist);\n }\n\n function nextLeftContour(t) {\n return t.cs === 0 ? t.tl : t.c[0];\n }\n\n function nextRightContour(t) {\n return t.cs === 0 ? t.tr : t.c[t.cs - 1];\n }\n\n function bottom(t) {\n return t.y + t.h;\n }\n\n function setLeftThread(t, i, cl, modsumcl) {\n var li = t.c[0].el;\n li.tl = cl;\n var diff = modsumcl - cl.mod - t.c[0].msel;\n li.mod += diff;\n li.prelim -= diff;\n t.c[0].el = t.c[i].el;\n t.c[0].msel = t.c[i].msel;\n }\n\n function setRightThread(t, i, sr, modsumsr) {\n var ri = t.c[i].er;\n ri.tr = sr;\n var diff = modsumsr - sr.mod - t.c[i].mser;\n ri.mod += diff;\n ri.prelim -= diff;\n t.c[i].er = t.c[i - 1].er;\n t.c[i].mser = t.c[i - 1].mser;\n }\n\n function positionRoot(t) {\n t.prelim = (t.c[0].prelim + t.c[0].mod + t.c[t.cs - 1].mod + t.c[t.cs - 1].prelim + t.c[t.cs - 1].w) / 2 - t.w / 2;\n }\n\n function secondWalk(t, modsum) {\n modsum += t.mod;\n t.x = t.prelim + modsum;\n addChildSpacing(t);\n\n for (var i = 0; i < t.cs; i++) {\n secondWalk(t.c[i], modsum);\n }\n }\n\n function distributeExtra(t, i, si, dist) {\n if (si !== i - 1) {\n var nr = i - si;\n t.c[si + 1].shift += dist / nr;\n t.c[i].shift -= dist / nr;\n t.c[i].change -= dist - dist / nr;\n }\n }\n\n function addChildSpacing(t) {\n var d = 0;\n var modsumdelta = 0;\n\n for (var i = 0; i < t.cs; i++) {\n d += t.c[i].shift;\n modsumdelta += d + t.c[i].change;\n t.c[i].mod += modsumdelta;\n }\n }\n\n function updateIYL(low, index, ih) {\n while (ih !== null && low >= ih.low) {\n ih = ih.nxt;\n }\n\n return {\n low: low,\n index: index,\n nxt: ih\n };\n } // do layout\n\n\n layer(root, isHorizontal);\n var wt = WrappedTree.fromNode(root, isHorizontal);\n firstWalk(wt);\n secondWalk(wt, 0);\n convertBack(wt, root, isHorizontal);\n normalize(root, isHorizontal);\n return root;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout/non-layered-tidy.js\n// module id = 8\n// module chunks = 0","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar TreeLayout = require('./layout/base');\n\nvar dendrogram = require('./layout/dendrogram');\n\nvar doTreeLayout = require('./layout/do-layout');\n\nvar util = require('./util');\n\nvar DendrogramLayout =\n/*#__PURE__*/\nfunction (_TreeLayout) {\n _inheritsLoose(DendrogramLayout, _TreeLayout);\n\n function DendrogramLayout() {\n return _TreeLayout.apply(this, arguments) || this;\n }\n\n var _proto = DendrogramLayout.prototype;\n\n _proto.execute = function execute() {\n var me = this;\n me.rootNode.width = 0;\n return doTreeLayout(me.rootNode, me.options, dendrogram);\n };\n\n return DendrogramLayout;\n}(TreeLayout);\n\nvar DEFAULT_OPTIONS = {};\n\nfunction dendrogramLayout(root, options) {\n options = util.assign({}, DEFAULT_OPTIONS, options);\n return new DendrogramLayout(root, options).execute();\n}\n\nmodule.exports = dendrogramLayout;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/dendrogram.js\n// module id = 9\n// module chunks = 0","// wrap tree node\n// TODO considering size\nvar util = require('../util');\n\nfunction WrappedTree(height, children) {\n if (height === void 0) {\n height = 0;\n }\n\n if (children === void 0) {\n children = [];\n }\n\n var me = this;\n me.x = me.y = 0;\n me.leftChild = me.rightChild = null;\n me.height = 0;\n me.children = children;\n}\n\nvar DEFAULT_OPTIONS = {\n isHorizontal: true,\n nodeSep: 20,\n nodeSize: 20,\n rankSep: 200,\n subTreeSep: 10\n};\n\nfunction convertBack(converted\n/* WrappedTree */\n, root\n/* TreeNode */\n, isHorizontal) {\n if (isHorizontal) {\n root.x = converted.x;\n root.y = converted.y;\n } else {\n root.x = converted.y;\n root.y = converted.x;\n }\n\n converted.children.forEach(function (child, i) {\n convertBack(child, root.children[i], isHorizontal);\n });\n}\n\nmodule.exports = function (root, options) {\n if (options === void 0) {\n options = {};\n }\n\n options = util.assign({}, DEFAULT_OPTIONS, options);\n var maxDepth = 0;\n\n function wrappedTreeFromNode(n) {\n if (!n) return null;\n n.width = 0;\n\n if (n.depth && n.depth > maxDepth) {\n maxDepth = n.depth; // get the max depth\n }\n\n var children = n.children;\n var childrenCount = children.length;\n var t = new WrappedTree(n.height, []);\n children.forEach(function (child, i) {\n var childWT = wrappedTreeFromNode(child);\n t.children.push(childWT);\n\n if (i === 0) {\n // t.leftChild = childWT.leftChild ? childWT.leftChild : childWT\n t.leftChild = childWT;\n }\n\n if (i === childrenCount - 1) {\n // t.rightChild = childWT.rightChild ? childWT.rightChild : childWT\n t.rightChild = childWT;\n }\n });\n t.originNode = n;\n t.isLeaf = n.isLeaf();\n return t;\n }\n\n function getDrawingDepth(t) {\n if (t.isLeaf || t.children.length === 0) {\n t.drawingDepth = maxDepth;\n } else {\n var depths = t.children.map(function (child) {\n return getDrawingDepth(child);\n });\n var minChildDepth = Math.min.apply(null, depths);\n t.drawingDepth = minChildDepth - 1;\n }\n\n return t.drawingDepth;\n }\n\n var prevLeaf;\n\n function position(t) {\n t.x = t.drawingDepth * options.rankSep;\n\n if (t.isLeaf) {\n t.y = 0;\n\n if (prevLeaf) {\n t.y = prevLeaf.y + prevLeaf.height + options.nodeSep;\n\n if (t.originNode.parent !== prevLeaf.originNode.parent) {\n t.y += options.subTreeSep;\n }\n }\n\n prevLeaf = t;\n } else {\n t.children.forEach(function (child) {\n position(child);\n });\n t.y = (t.leftChild.y + t.rightChild.y) / 2;\n }\n } // wrap node\n\n\n var wt = wrappedTreeFromNode(root); // get depth for drawing\n\n getDrawingDepth(wt); // get position\n\n position(wt); // get x, y\n\n convertBack(wt, root, options.isHorizontal);\n return root;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout/dendrogram.js\n// module id = 10\n// module chunks = 0","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar TreeLayout = require('./layout/base');\n\nvar indentedTree = require('./layout/indented');\n\nvar separateTree = require('./layout/separate-root');\n\nvar util = require('./util');\n\nvar VALID_DIRECTIONS = ['LR', // left to right\n'RL', // right to left\n'H' // horizontal\n];\nvar DEFAULT_DIRECTION = VALID_DIRECTIONS[0];\n\nvar IndentedLayout =\n/*#__PURE__*/\nfunction (_TreeLayout) {\n _inheritsLoose(IndentedLayout, _TreeLayout);\n\n function IndentedLayout() {\n return _TreeLayout.apply(this, arguments) || this;\n }\n\n var _proto = IndentedLayout.prototype;\n\n _proto.execute = function execute() {\n var me = this;\n var options = me.options;\n var root = me.rootNode;\n options.isHorizontal = true;\n var indent = options.indent;\n var direction = options.direction || DEFAULT_DIRECTION;\n\n if (direction && VALID_DIRECTIONS.indexOf(direction) === -1) {\n throw new TypeError(\"Invalid direction: \" + direction);\n }\n\n if (direction === VALID_DIRECTIONS[0]) {\n // LR\n indentedTree(root, indent);\n } else if (direction === VALID_DIRECTIONS[1]) {\n // RL\n indentedTree(root, indent);\n root.right2left();\n } else if (direction === VALID_DIRECTIONS[2]) {\n // H\n // separate into left and right trees\n var _separateTree = separateTree(root, options),\n left = _separateTree.left,\n right = _separateTree.right;\n\n indentedTree(left, indent);\n left.right2left();\n indentedTree(right, indent);\n var bbox = left.getBoundingBox();\n right.translate(bbox.width, 0);\n root.x = right.x - root.width / 2;\n }\n\n return root;\n };\n\n return IndentedLayout;\n}(TreeLayout);\n\nvar DEFAULT_OPTIONS = {};\n\nfunction indentedLayout(root, options) {\n options = util.assign({}, DEFAULT_OPTIONS, options);\n return new IndentedLayout(root, options).execute();\n}\n\nmodule.exports = indentedLayout;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/indented.js\n// module id = 11\n// module chunks = 0","var DEFAULT_INDENT = 20;\n\nfunction positionNode(node, previousNode, dx) {\n node.x += dx * node.depth;\n node.y = previousNode ? previousNode.y + previousNode.height : 0;\n}\n\nmodule.exports = function (root, indent) {\n if (indent === void 0) {\n indent = DEFAULT_INDENT;\n }\n\n var previousNode = null;\n root.eachNode(function (node) {\n positionNode(node, previousNode, indent);\n previousNode = node;\n });\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout/indented.js\n// module id = 12\n// module chunks = 0","function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar TreeLayout = require('./layout/base');\n\nvar mindmap = require('./layout/mindmap');\n\nvar doTreeLayout = require('./layout/do-layout');\n\nvar util = require('./util');\n\nvar MindmapLayout =\n/*#__PURE__*/\nfunction (_TreeLayout) {\n _inheritsLoose(MindmapLayout, _TreeLayout);\n\n function MindmapLayout() {\n return _TreeLayout.apply(this, arguments) || this;\n }\n\n var _proto = MindmapLayout.prototype;\n\n _proto.execute = function execute() {\n var me = this;\n return doTreeLayout(me.rootNode, me.options, mindmap);\n };\n\n return MindmapLayout;\n}(TreeLayout);\n\nvar DEFAULT_OPTIONS = {};\n\nfunction mindmapLayout(root, options) {\n options = util.assign({}, DEFAULT_OPTIONS, options);\n return new MindmapLayout(root, options).execute();\n}\n\nmodule.exports = mindmapLayout;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/mindmap.js\n// module id = 13\n// module chunks = 0","var util = require('../util');\n\nfunction secondWalk(node, options) {\n var totalHeight = 0;\n\n if (!node.children.length) {\n totalHeight = node.height;\n } else {\n node.children.forEach(function (c) {\n totalHeight += secondWalk(c, options);\n });\n }\n\n node._subTreeSep = options.getSubTreeSep(node.data);\n node.totalHeight = Math.max(node.height, totalHeight) + 2 * node._subTreeSep;\n return node.totalHeight;\n}\n\nfunction thirdWalk(node) {\n var children = node.children;\n var len = children.length;\n\n if (len) {\n children.forEach(function (c) {\n thirdWalk(c);\n });\n var first = children[0];\n var last = children[len - 1];\n var childrenHeight = last.y - first.y + last.height;\n var childrenTotalHeight = 0;\n children.forEach(function (child) {\n childrenTotalHeight += child.totalHeight;\n });\n\n if (childrenHeight > node.height) {\n // 当子节点总高度大于父节点高度\n node.y = first.y + childrenHeight / 2 - node.height / 2;\n } else if (children.length !== 1 || node.height > childrenTotalHeight) {\n // 多于一个子节点或者父节点大于所有子节点的总高度\n var offset = node.y + (node.height - childrenHeight) / 2 - first.y;\n children.forEach(function (c) {\n c.translate(0, offset);\n });\n } else {\n // 只有一个子节点\n node.y = (first.y + first.height / 2 + last.y + last.height / 2) / 2 - node.height / 2;\n }\n }\n}\n\nvar DEFAULT_OPTIONS = {\n getSubTreeSep: function getSubTreeSep() {\n return 0;\n }\n};\n\nmodule.exports = function (root, options) {\n if (options === void 0) {\n options = {};\n }\n\n options = util.assign({}, DEFAULT_OPTIONS, options);\n root.parent = {\n x: 0,\n width: 0,\n height: 0,\n y: 0\n }; // first walk\n\n root.BFTraverse(function (node) {\n node.x = node.parent.x + node.parent.width; // simply get x\n });\n root.parent = null; // second walk\n\n secondWalk(root, options); // assign sub tree totalHeight\n // adjusting\n // separating nodes\n\n root.startY = 0;\n root.y = root.totalHeight / 2 - root.height / 2;\n root.eachNode(function (node) {\n var children = node.children;\n var len = children.length;\n\n if (len) {\n var first = children[0];\n first.startY = node.startY + node._subTreeSep;\n\n if (len === 1) {\n first.y = node.y + node.height / 2 - first.height / 2;\n } else {\n first.y = first.startY + first.totalHeight / 2 - first.height / 2;\n\n for (var i = 1; i < len; i++) {\n var c = children[i];\n c.startY = children[i - 1].startY + children[i - 1].totalHeight;\n c.y = c.startY + c.totalHeight / 2 - c.height / 2;\n }\n }\n }\n }); // third walk\n\n thirdWalk(root);\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./src/layout/mindmap.js\n// module id = 14\n// module chunks = 0"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC7DA;AACA;AACA;AACA;AACA;;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACxBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACzLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AC/QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACpIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AC1EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}