UNPKG

mermaid

Version:

Markdownish syntax for generating flowcharts

2 lines 230 kB
!function e(t,r,n){function i(a,o){if(!r[a]){if(!t[a]){var s="function"==typeof require&&require;if(!o&&s)return s(a,!0);if(u)return u(a,!0);throw new Error("Cannot find module '"+a+"'")}var c=r[a]={exports:{}};t[a][0].call(c.exports,function(e){var r=t[a][1][e];return i(r?r:e)},c,c.exports,e,t,r,n)}return r[a].exports}for(var u="function"==typeof require&&require,a=0;a<n.length;a++)i(n[a]);return i}({1:[function(e,t){t.exports={graphlib:e("./lib/graphlib"),dagre:e("./lib/dagre"),intersect:e("./lib/intersect"),render:e("./lib/render"),util:e("./lib/util"),version:e("./lib/version")}},{"./lib/dagre":8,"./lib/graphlib":9,"./lib/intersect":10,"./lib/render":23,"./lib/util":25,"./lib/version":26}],2:[function(e,t){function r(e,t,r,n){var u=e.append("marker").attr("id",t).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),a=u.append("path").attr("d","M 0 0 L 10 5 L 0 10 z").style("stroke-width",1).style("stroke-dasharray","1,0");i.applyStyle(a,r[n+"Style"])}function n(e,t,r,n){var u=e.append("marker").attr("id",t).attr("viewBox","0 0 10 10").attr("refX",9).attr("refY",5).attr("markerUnits","strokeWidth").attr("markerWidth",8).attr("markerHeight",6).attr("orient","auto"),a=u.append("path").attr("d","M 0 0 L 10 5 L 0 10 L 4 5 z").style("stroke-width",1).style("stroke-dasharray","1,0");i.applyStyle(a,r[n+"Style"])}var i=e("./util");t.exports={"default":r,normal:r,vee:n}},{"./util":25}],3:[function(e,t){function r(e,t){var r=t.nodes().filter(function(e){return n.isSubgraph(t,e)}),i=e.selectAll("g.cluster").data(r,function(e){return e});i.enter().append("g").attr("class","cluster").style("opacity",0).append("rect"),n.applyTransition(i.exit(),t).style("opacity",0).remove(),n.applyTransition(i,t).style("opacity",1),n.applyTransition(i.selectAll("rect"),t).attr("width",function(e){return t.node(e).width}).attr("height",function(e){return t.node(e).height}).attr("x",function(e){var r=t.node(e);return r.x-r.width/2}).attr("y",function(e){var r=t.node(e);return r.y-r.height/2})}var n=e("./util");t.exports=r},{"./util":25}],4:[function(e,t){"use strict";function r(e,t){var r=e.selectAll("g.edgeLabel").data(t.edges(),function(e){return u.edgeToId(e)}).classed("update",!0);return r.selectAll("*").remove(),r.enter().append("g").classed("edgeLabel",!0).style("opacity",0),r.each(function(e){var r=t.edge(e),u=i(a.select(this),t.edge(e),0,0).classed("label",!0),o=u.node().getBBox();r.labelId&&u.attr("id",r.labelId),n.has(r,"width")||(r.width=o.width),n.has(r,"height")||(r.height=o.height)}),u.applyTransition(r.exit(),t).style("opacity",0).remove(),r}var n=e("./lodash"),i=e("./label/add-label"),u=e("./util"),a=e("./d3");t.exports=r},{"./d3":7,"./label/add-label":18,"./lodash":20,"./util":25}],5:[function(e,t){"use strict";function r(e,t,r){var i=e.selectAll("g.edgePath").data(t.edges(),function(e){return l.edgeToId(e)}).classed("update",!0);return a(i,t),o(i,t),l.applyTransition(i,t).style("opacity",1),i.selectAll("path.path").each(function(e){var r=t.edge(e);r.arrowheadId=s.uniqueId("arrowhead");var i=h.select(this).attr("marker-end",function(){return"url(#"+r.arrowheadId+")"}).style("fill","none");l.applyTransition(i,t).attr("d",function(e){return n(t,e)}),r.id&&i.attr("id",r.id),l.applyStyle(i,r.style)}),i.selectAll("defs *").remove(),i.selectAll("defs").each(function(e){var n=t.edge(e),i=r[n.arrowhead];i(h.select(this),n.arrowheadId,n,"arrowhead")}),i}function n(e,t){var r=e.edge(t),n=e.node(t.v),u=e.node(t.w),a=r.points.slice(1,r.points.length-1);return a.unshift(c(n,a[0])),a.push(c(u,a[a.length-1])),i(r,a)}function i(e,t){var r=h.svg.line().x(function(e){return e.x}).y(function(e){return e.y});return s.has(e,"lineInterpolate")&&r.interpolate(e.lineInterpolate),s.has(e,"lineTension")&&r.tension(Number(e.lineTension)),r(t)}function u(e){var t=e.getBBox(),r=e.getTransformToElement(e.ownerSVGElement).translate(t.width/2,t.height/2);return{x:r.e,y:r.f}}function a(e,t){var r=e.enter().append("g").attr("class","edgePath").style("opacity",0);r.append("path").attr("class","path").attr("d",function(e){var r=t.edge(e),n=t.node(e.v).elem,a=s.range(r.points.length).map(function(){return u(n)});return i(r,a)}),r.append("defs")}function o(e,t){var r=e.exit();l.applyTransition(r,t).style("opacity",0).remove(),l.applyTransition(r.select("path.path"),t).attr("d",function(e){var r=t.node(e.v);if(r){var n=s.range(this.pathSegList.length).map(function(){return r});return i({},n)}return h.select(this).attr("d")})}var s=e("./lodash"),c=e("./intersect/intersect-node"),l=e("./util"),h=e("./d3");t.exports=r},{"./d3":7,"./intersect/intersect-node":14,"./lodash":20,"./util":25}],6:[function(e,t){"use strict";function r(e,t,r){var o=t.nodes().filter(function(e){return!u.isSubgraph(t,e)}),s=e.selectAll("g.node").data(o,function(e){return e}).classed("update",!0);return s.selectAll("*").remove(),s.enter().append("g").attr("class","node").style("opacity",0),s.each(function(e){var o=t.node(e),s=a.select(this),c=s.append("g").attr("class","label"),l=i(c,o),h=r[o.shape],d=l.node().getBBox();o.elem=this,o.id&&s.attr("id",o.id),o.labelId&&c.attr("id",o.labelId),u.applyClass(s,o.class,(s.classed("update")?"update ":"")+"node"),n.has(o,"width")&&(d.width=o.width),n.has(o,"height")&&(d.height=o.height),d.width+=o.paddingLeft+o.paddingRight,d.height+=o.paddingTop+o.paddingBottom,c.attr("transform","translate("+(o.paddingLeft-o.paddingRight)/2+","+(o.paddingTop-o.paddingBottom)/2+")");var p=h(a.select(this),d,o);u.applyStyle(p,o.style);var f=p.node().getBBox();o.width=f.width,o.height=f.height}),u.applyTransition(s.exit(),t).style("opacity",0).remove(),s}var n=e("./lodash"),i=e("./label/add-label"),u=e("./util"),a=e("./d3");t.exports=r},{"./d3":7,"./label/add-label":18,"./lodash":20,"./util":25}],7:[function(e,t){t.exports=window.d3},{}],8:[function(e,t){var r;if(e)try{r=e("dagre")}catch(n){}r||(r=window.dagre),t.exports=r},{dagre:27}],9:[function(e,t){var r;if(e)try{r=e("graphlib")}catch(n){}r||(r=window.graphlib),t.exports=r},{graphlib:77}],10:[function(e,t){t.exports={node:e("./intersect-node"),circle:e("./intersect-circle"),ellipse:e("./intersect-ellipse"),polygon:e("./intersect-polygon"),rect:e("./intersect-rect")}},{"./intersect-circle":11,"./intersect-ellipse":12,"./intersect-node":14,"./intersect-polygon":15,"./intersect-rect":16}],11:[function(e,t){function r(e,t,r){return n(e,t,t,r)}var n=e("./intersect-ellipse");t.exports=r},{"./intersect-ellipse":12}],12:[function(e,t){function r(e,t,r,n){var i=e.x,u=e.y,a=i-n.x,o=u-n.y,s=Math.sqrt(t*t*o*o+r*r*a*a),c=Math.abs(t*r*a/s);n.x<i&&(c=-c);var l=Math.abs(t*r*o/s);return n.y<u&&(l=-l),{x:i+c,y:u+l}}t.exports=r},{}],13:[function(e,t){function r(e,t,r,i){var u,a,o,s,c,l,h,d,p,f,g,y,m,v,b;return u=t.y-e.y,o=e.x-t.x,c=t.x*e.y-e.x*t.y,p=u*r.x+o*r.y+c,f=u*i.x+o*i.y+c,0!==p&&0!==f&&n(p,f)||(a=i.y-r.y,s=r.x-i.x,l=i.x*r.y-r.x*i.y,h=a*e.x+s*e.yy+l,d=a*t.x+s*t.y+l,0!==h&&0!==d&&n(h,d)||(g=u*s-a*o,0===g))?void 0:(y=Math.abs(g/2),m=o*l-s*c,v=0>m?(m-y)/g:(m+y)/g,m=a*c-u*l,b=0>m?(m-y)/g:(m+y)/g,{x:v,y:b})}function n(e,t){return e*t>0}t.exports=r},{}],14:[function(e,t){function r(e,t){return e.intersect(t)}t.exports=r},{}],15:[function(e,t){function r(e,t,r){var i=e.x,u=e.y,a=[],o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY;t.forEach(function(e){o=Math.min(o,e.x),s=Math.min(s,e.y)});for(var c=i-e.width/2-o,l=u-e.height/2-s,h=0;h<t.length;h++){var d=t[h],p=t[h<t.length-1?h+1:0],f=n(e,r,{x:c+d.x,y:l+d.y},{x:c+p.x,y:l+p.y});f&&a.push(f)}return a.length?(a.length>1&&a.sort(function(e,t){var n=e.x-r.x,i=e.y-r.y,u=Math.sqrt(n*n+i*i),a=t.x-r.x,o=t.y-r.y,s=Math.sqrt(a*a+o*o);return s>u?-1:u===s?0:1}),a[0]):(console.log("NO INTERSECTION FOUND, RETURN NODE CENTER",e),e)}var n=e("./intersect-line");t.exports=r},{"./intersect-line":13}],16:[function(e,t){function r(e,t){var r,n,i=e.x,u=e.y,a=t.x-i,o=t.y-u,s=e.width/2,c=e.height/2;return Math.abs(o)*s>Math.abs(a)*c?(0>o&&(c=-c),r=0===o?0:c*a/o,n=c):(0>a&&(s=-s),r=s,n=0===a?0:s*o/a),{x:i+r,y:u+n}}t.exports=r},{}],17:[function(e,t){function r(e,t){var r=e.append("foreignObject").attr("width","100000"),i=r.append("xhtml:div"),u=t.label;switch(typeof u){case"function":i.insert(u);break;case"object":i.insert(function(){return u});break;default:i.html(u)}n.applyStyle(i,t.labelStyle),i.style("display","inline-block"),i.style("white-space","nowrap");var a,o;return i.each(function(){a=this.clientWidth,o=this.clientHeight}),r.attr("width",a).attr("height",o),r}var n=e("../util");t.exports=r},{"../util":25}],18:[function(e,t){function r(e,t){var r=t.label,u=e.append("g");"string"!=typeof r||"html"===t.labelType?i(u,t):n(u,t);var a=u.node().getBBox();return u.attr("transform","translate("+-a.width/2+","+-a.height/2+")"),u}var n=e("./add-text-label"),i=e("./add-html-label");t.exports=r},{"./add-html-label":17,"./add-text-label":19}],19:[function(e,t){function r(e,t){for(var r=e.append("text"),u=n(t.label).split("\n"),a=0;a<u.length;a++)r.append("tspan").attr("xml:space","preserve").attr("dy","1em").attr("x","1").text(u[a]);return i.applyStyle(r,t.labelStyle),r}function n(e){for(var t,r="",n=!1,i=0;i<e.length;++i)if(t=e[i],n){switch(t){case"n":r+="\n";break;default:r+=t}n=!1}else"\\"===t?n=!0:r+=t;return r}var i=e("../util");t.exports=r},{"../util":25}],20:[function(e,t){var r;if(e)try{r=e("lodash")}catch(n){}r||(r=window._),t.exports=r},{lodash:101}],21:[function(e,t){"use strict";function r(e,t){function r(e){var r=t.edge(e);return u.has(r,"x")?"translate("+r.x+","+r.y+")":""}var a=e.filter(function(){return!i.select(this).classed("update")});a.attr("transform",r),n.applyTransition(e,t).style("opacity",1).attr("transform",r)}var n=e("./util"),i=e("./d3"),u=e("./lodash");t.exports=r},{"./d3":7,"./lodash":20,"./util":25}],22:[function(e,t){"use strict";function r(e,t){function r(e){var r=t.node(e);return"translate("+r.x+","+r.y+")"}var u=e.filter(function(){return!i.select(this).classed("update")});u.attr("transform",r),n.applyTransition(e,t).style("opacity",1).attr("transform",r)}var n=e("./util"),i=e("./d3");t.exports=r},{"./d3":7,"./util":25}],23:[function(e,t){function r(){var t=e("./create-nodes"),r=e("./create-clusters"),a=e("./create-edge-labels"),s=e("./create-edge-paths"),c=e("./position-nodes"),l=e("./position-edge-labels"),h=e("./shapes"),d=e("./arrows"),p=function(e,p){n(p);var f=u(e,"output"),g=u(f,"clusters"),y=u(f,"edgePaths"),m=a(u(f,"edgeLabels"),p),v=t(u(f,"nodes"),p,h);o(p),c(v,p),l(m,p),s(y,p,d),r(g,p),i(p)};return p.createNodes=function(e){return arguments.length?(t=e,p):t},p.createClusters=function(e){return arguments.length?(r=e,p):r},p.createEdgeLabels=function(e){return arguments.length?(a=e,p):a},p.createEdgePaths=function(e){return arguments.length?(s=e,p):s},p.shapes=function(e){return arguments.length?(h=e,p):h},p.arrows=function(e){return arguments.length?(d=e,p):d},p}function n(e){e.nodes().forEach(function(t){var r=e.node(t);a.has(r,"label")||(r.label=t),a.has(r,"paddingX")&&a.defaults(r,{paddingLeft:r.paddingX,paddingRight:r.paddingX}),a.has(r,"paddingY")&&a.defaults(r,{paddingTop:r.paddingY,paddingBottom:r.paddingY}),a.has(r,"padding")&&a.defaults(r,{paddingLeft:r.padding,paddingRight:r.padding,paddingTop:r.padding,paddingBottom:r.padding}),a.defaults(r,s),a.each(["paddingLeft","paddingRight","paddingTop","paddingBottom"],function(e){r[e]=Number(r[e])}),a.has(r,"width")&&(r._prevWidth=r.width),a.has(r,"height")&&(r._prevHeight=r.height)}),e.edges().forEach(function(t){var r=e.edge(t);a.has(r,"label")||(r.label=""),a.defaults(r,c)})}function i(e){a.each(e.nodes(),function(t){var r=e.node(t);a.has(r,"_prevWidth")?r.width=r._prevWidth:delete r.width,a.has(r,"_prevHeight")?r.height=r._prevHeight:delete r.height,delete r._prevWidth,delete r._prevHeight})}function u(e,t){var r=e.select("g."+t);return r.empty()&&(r=e.append("g").attr("class",t)),r}var a=e("./lodash"),o=e("./dagre").layout;t.exports=r;var s={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},c={arrowhead:"normal",lineInterpolate:"linear"}},{"./arrows":2,"./create-clusters":3,"./create-edge-labels":4,"./create-edge-paths":5,"./create-nodes":6,"./dagre":8,"./lodash":20,"./position-edge-labels":21,"./position-nodes":22,"./shapes":24}],24:[function(e,t){"use strict";function r(e,t,r){var n=e.insert("rect",":first-child").attr("rx",r.rx).attr("ry",r.ry).attr("x",-t.width/2).attr("y",-t.height/2).attr("width",t.width).attr("height",t.height);return r.intersect=function(e){return u(r,e)},n}function n(e,t,r){var n=t.width/2,i=t.height/2,u=e.insert("ellipse",":first-child").attr("x",-t.width/2).attr("y",-t.height/2).attr("rx",n).attr("ry",i);return r.intersect=function(e){return a(r,n,i,e)},u}function i(e,t,r){var n=Math.max(t.width,t.height)/2,i=e.insert("circle",":first-child").attr("x",-t.width/2).attr("y",-t.height/2).attr("r",n);return r.intersect=function(e){return o(r,n,e)},i}var u=e("./intersect/intersect-rect"),a=e("./intersect/intersect-ellipse"),o=e("./intersect/intersect-circle");t.exports={rect:r,ellipse:n,circle:i}},{"./intersect/intersect-circle":11,"./intersect/intersect-ellipse":12,"./intersect/intersect-rect":16}],25:[function(e,t){function r(e,t){return!!e.children(t).length}function n(e){return i(e.v)+":"+i(e.w)+":"+i(e.name)}function i(e){return e?String(e).replace(c,"\\:"):""}function u(e,t){t&&e.attr("style",t)}function a(e,t,r){t&&e.attr("class",t).attr("class",r+" "+e.attr("class"))}function o(e,t){var r=t.graph();if(s.isPlainObject(r)){var n=r.transition;if(s.isFunction(n))return n(e)}return e}var s=e("./lodash");t.exports={isSubgraph:r,edgeToId:n,applyStyle:u,applyClass:a,applyTransition:o};var c=/:/g},{"./lodash":20}],26:[function(e,t){t.exports="0.3.2"},{}],27:[function(e,t){t.exports={graphlib:e("./lib/graphlib"),layout:e("./lib/layout"),debug:e("./lib/debug"),util:{time:e("./lib/util").time,notime:e("./lib/util").notime},version:e("./lib/version")}},{"./lib/debug":32,"./lib/graphlib":33,"./lib/layout":35,"./lib/util":55,"./lib/version":56}],28:[function(e,t){"use strict";function r(e){function t(e){return function(t){return e.edge(t).weight}}var r="greedy"===e.graph().acyclicer?a(e,t(e)):n(e);u.each(r,function(t){var r=e.edge(t);e.removeEdge(t),r.forwardName=t.name,r.reversed=!0,e.setEdge(t.w,t.v,r,u.uniqueId("rev"))})}function n(e){function t(a){u.has(i,a)||(i[a]=!0,n[a]=!0,u.each(e.outEdges(a),function(e){u.has(n,e.w)?r.push(e):t(e.w)}),delete n[a])}var r=[],n={},i={};return u.each(e.nodes(),t),r}function i(e){u.each(e.edges(),function(t){var r=e.edge(t);if(r.reversed){e.removeEdge(t);var n=r.forwardName;delete r.reversed,delete r.forwardName,e.setEdge(t.w,t.v,r,n)}})}var u=e("./lodash"),a=e("./greedy-fas");t.exports={run:r,undo:i}},{"./greedy-fas":34,"./lodash":36}],29:[function(e,t){function r(e){function t(r){var u=e.children(r),a=e.node(r);if(u.length&&i.each(u,t),i.has(a,"minRank")){a.borderLeft=[],a.borderRight=[];for(var o=a.minRank,s=a.maxRank+1;s>o;++o)n(e,"borderLeft","_bl",r,a,o),n(e,"borderRight","_br",r,a,o)}}i.each(e.children(),t)}function n(e,t,r,n,i,a){var o={width:0,height:0,rank:a},s=i[t][a-1],c=u.addDummyNode(e,"border",o,r);i[t][a]=c,e.setParent(c,n),s&&e.setEdge(s,c,{weight:1})}var i=e("./lodash"),u=e("./util");t.exports=r},{"./lodash":36,"./util":55}],30:[function(e,t){"use strict";function r(e){var t=e.graph().rankdir.toLowerCase();("lr"===t||"rl"===t)&&i(e)}function n(e){var t=e.graph().rankdir.toLowerCase();("bt"===t||"rl"===t)&&a(e),("lr"===t||"rl"===t)&&(s(e),i(e))}function i(e){l.each(e.nodes(),function(t){u(e.node(t))}),l.each(e.edges(),function(t){u(e.edge(t))})}function u(e){var t=e.width;e.width=e.height,e.height=t}function a(e){l.each(e.nodes(),function(t){o(e.node(t))}),l.each(e.edges(),function(t){var r=e.edge(t);l.each(r.points,o),l.has(r,"y")&&o(r)})}function o(e){e.y=-e.y}function s(e){l.each(e.nodes(),function(t){c(e.node(t))}),l.each(e.edges(),function(t){var r=e.edge(t);l.each(r.points,c),l.has(r,"x")&&c(r)})}function c(e){var t=e.x;e.x=e.y,e.y=t}var l=e("./lodash");t.exports={adjust:r,undo:n}},{"./lodash":36}],31:[function(e,t){function r(){var e={};e._next=e._prev=e,this._sentinel=e}function n(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function i(e,t){return"_next"!==e&&"_prev"!==e?t:void 0}t.exports=r,r.prototype.dequeue=function(){var e=this._sentinel,t=e._prev;return t!==e?(n(t),t):void 0},r.prototype.enqueue=function(e){var t=this._sentinel;e._prev&&e._next&&n(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t},r.prototype.toString=function(){for(var e=[],t=this._sentinel,r=t._prev;r!==t;)e.push(JSON.stringify(r,i)),r=r._prev;return"["+e.join(", ")+"]"}},{}],32:[function(e,t){function r(e){var t=i.buildLayerMatrix(e),r=new u({compound:!0,multigraph:!0}).setGraph({});return n.each(e.nodes(),function(t){r.setNode(t,{label:t}),r.setParent(t,"layer"+e.node(t).rank)}),n.each(e.edges(),function(e){r.setEdge(e.v,e.w,{},e.name)}),n.each(t,function(e,t){var i="layer"+t;r.setNode(i,{rank:"same"}),n.reduce(e,function(e,t){return r.setEdge(e,t,{style:"invis"}),t})}),r}var n=e("./lodash"),i=e("./util"),u=e("./graphlib").Graph;t.exports={debugOrdering:r}},{"./graphlib":33,"./lodash":36,"./util":55}],33:[function(e,t){t.exports=e(9)},{graphlib:57}],34:[function(e,t){function r(e,t){if(e.nodeCount()<=1)return[];var r=u(e,t||l),i=n(r.graph,r.buckets,r.zeroIdx);return o.flatten(o.map(i,function(t){return e.outEdges(t.v,t.w)}),!0)}function n(e,t,r){for(var n,u=[],a=t[t.length-1],o=t[0];e.nodeCount();){for(;n=o.dequeue();)i(e,t,r,n);for(;n=a.dequeue();)i(e,t,r,n);if(e.nodeCount())for(var s=t.length-2;s>0;--s)if(n=t[s].dequeue()){u=u.concat(i(e,t,r,n,!0));break}}return u}function i(e,t,r,n,i){var u=i?[]:void 0;return o.each(e.inEdges(n.v),function(n){var o=e.edge(n),s=e.node(n.v);i&&u.push({v:n.v,w:n.w}),s.out-=o,a(t,r,s)}),o.each(e.outEdges(n.v),function(n){var i=e.edge(n),u=n.w,o=e.node(u);o.in-=i,a(t,r,o)}),e.removeNode(n.v),u}function u(e,t){var r=new s,n=0,i=0;o.each(e.nodes(),function(e){r.setNode(e,{v:e,"in":0,out:0})}),o.each(e.edges(),function(e){var u=r.edge(e.v,e.w)||0,a=t(e),o=u+a;r.setEdge(e.v,e.w,o),i=Math.max(i,r.node(e.v).out+=a),n=Math.max(n,r.node(e.w).in+=a)});var u=o.range(i+n+3).map(function(){return new c}),l=n+1;return o.each(r.nodes(),function(e){a(u,l,r.node(e))}),{graph:r,buckets:u,zeroIdx:l}}function a(e,t,r){r.out?r.in?e[r.out-r.in+t].enqueue(r):e[e.length-1].enqueue(r):e[0].enqueue(r)}var o=e("./lodash"),s=e("./graphlib").Graph,c=e("./data/list");t.exports=r;var l=o.constant(1)},{"./data/list":31,"./graphlib":33,"./lodash":36}],35:[function(e,t){"use strict";function r(e,t){var r=t&&t.debugTiming?T.time:T.notime;r("layout",function(){var t=r(" buildLayoutGraph",function(){return u(e)});r(" runLayout",function(){n(t,r)}),r(" updateInputGraph",function(){i(e,t)})})}function n(e,t){t(" makeSpaceForEdgeLabels",function(){a(e)}),t(" removeSelfEdges",function(){g(e)}),t(" acyclic",function(){w.run(e)}),t(" nestingGraph.run",function(){C.run(e)}),t(" rank",function(){x(T.asNonCompoundGraph(e))}),t(" injectEdgeLabelProxies",function(){o(e)}),t(" removeEmptyRanks",function(){k(e)}),t(" nestingGraph.cleanup",function(){C.cleanup(e)}),t(" normalizeRanks",function(){_(e)}),t(" assignRankMinMax",function(){s(e)}),t(" removeEdgeLabelProxies",function(){c(e)}),t(" normalize.run",function(){E.run(e)}),t(" parentDummyChains",function(){D(e)}),t(" addBorderSegments",function(){F(e)}),t(" order",function(){L(e)}),t(" insertSelfEdges",function(){y(e)}),t(" adjustCoordinateSystem",function(){B.adjust(e)}),t(" position",function(){S(e)}),t(" positionSelfEdges",function(){m(e)}),t(" removeBorderNodes",function(){f(e)}),t(" normalize.undo",function(){E.undo(e)}),t(" fixupEdgeLabelCoords",function(){d(e)}),t(" undoCoordinateSystem",function(){B.undo(e)}),t(" translateGraph",function(){l(e)}),t(" assignNodeIntersects",function(){h(e)}),t(" reversePoints",function(){p(e)}),t(" acyclic.undo",function(){w.undo(e)})}function i(e,t){A.each(e.nodes(),function(r){var n=e.node(r),i=t.node(r);n&&(n.x=i.x,n.y=i.y,t.children(r).length&&(n.width=i.width,n.height=i.height))}),A.each(e.edges(),function(r){var n=e.edge(r),i=t.edge(r);n.points=i.points,A.has(i,"x")&&(n.x=i.x,n.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}function u(e){var t=new N({multigraph:!0,compound:!0}),r=b(e.graph());return t.setGraph(A.merge({},I,v(r,q),A.pick(r,R))),A.each(e.nodes(),function(r){var n=b(e.node(r));t.setNode(r,A.defaults(v(n,O),P)),t.setParent(r,e.parent(r))}),A.each(e.edges(),function(r){var n=b(e.edge(r));t.setEdge(r,A.merge({},M,v(n,j),A.pick(n,U)))}),t}function a(e){var t=e.graph();t.ranksep/=2,A.each(e.edges(),function(r){var n=e.edge(r);n.minlen*=2,"c"!==n.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?n.width+=n.labeloffset:n.height+=n.labeloffset)})}function o(e){A.each(e.edges(),function(t){var r=e.edge(t);if(r.width&&r.height){var n=e.node(t.v),i=e.node(t.w),u={rank:(i.rank-n.rank)/2+n.rank,e:t};T.addDummyNode(e,"edge-proxy",u,"_ep")}})}function s(e){var t=0;A.each(e.nodes(),function(r){var n=e.node(r);n.borderTop&&(n.minRank=e.node(n.borderTop).rank,n.maxRank=e.node(n.borderBottom).rank,t=A.max(t,n.maxRank))}),e.graph().maxRank=t}function c(e){A.each(e.nodes(),function(t){var r=e.node(t);"edge-proxy"===r.dummy&&(e.edge(r.e).labelRank=r.rank,e.removeNode(t))})}function l(e){function t(e){var t=e.x,a=e.y,o=e.width,s=e.height;r=Math.min(r,t-o/2),n=Math.max(n,t+o/2),i=Math.min(i,a-s/2),u=Math.max(u,a+s/2)}var r=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,u=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;A.each(e.nodes(),function(r){t(e.node(r))}),A.each(e.edges(),function(r){var n=e.edge(r);A.has(n,"x")&&t(n)}),r-=o,i-=s,A.each(e.nodes(),function(t){var n=e.node(t);n.x-=r,n.y-=i}),A.each(e.edges(),function(t){var n=e.edge(t);A.each(n.points,function(e){e.x-=r,e.y-=i}),A.has(n,"x")&&(n.x-=r),A.has(n,"y")&&(n.y-=i)}),a.width=n-r+o,a.height=u-i+s}function h(e){A.each(e.edges(),function(t){var r,n,i=e.edge(t),u=e.node(t.v),a=e.node(t.w);i.points?(r=i.points[0],n=i.points[i.points.length-1]):(i.points=[],r=a,n=u),i.points.unshift(T.intersectRect(u,r)),i.points.push(T.intersectRect(a,n))})}function d(e){A.each(e.edges(),function(t){var r=e.edge(t);if(A.has(r,"x"))switch(("l"===r.labelpos||"r"===r.labelpos)&&(r.width-=r.labeloffset),r.labelpos){case"l":r.x-=r.width/2+r.labeloffset;break;case"r":r.x+=r.width/2+r.labeloffset}})}function p(e){A.each(e.edges(),function(t){var r=e.edge(t);r.reversed&&r.points.reverse()})}function f(e){A.each(e.nodes(),function(t){if(e.children(t).length){var r=e.node(t),n=e.node(r.borderTop),i=e.node(r.borderBottom),u=e.node(A.last(r.borderLeft)),a=e.node(A.last(r.borderRight));r.width=Math.abs(a.x-u.x),r.height=Math.abs(i.y-n.y),r.x=u.x+r.width/2,r.y=n.y+r.height/2}}),A.each(e.nodes(),function(t){"border"===e.node(t).dummy&&e.removeNode(t)})}function g(e){A.each(e.edges(),function(t){if(t.v===t.w){var r=e.node(t.v);r.selfEdges||(r.selfEdges=[]),r.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function y(e){var t=T.buildLayerMatrix(e);A.each(t,function(t){var r=0;A.each(t,function(t,n){var i=e.node(t);i.order=n+r,A.each(i.selfEdges,function(t){T.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:i.rank,order:n+ ++r,e:t.e,label:t.label},"_se")}),delete i.selfEdges})})}function m(e){A.each(e.nodes(),function(t){var r=e.node(t);if("selfedge"===r.dummy){var n=e.node(r.e.v),i=n.x+n.width/2,u=n.y,a=r.x-i,o=n.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*a/3,y:u-o},{x:i+5*a/6,y:u-o},{x:i+a,y:u},{x:i+5*a/6,y:u+o},{x:i+2*a/3,y:u+o}],r.label.x=r.x,r.label.y=r.y}})}function v(e,t){return A.mapValues(A.pick(e,t),Number)}function b(e){var t={};return A.each(e,function(e,r){t[r.toLowerCase()]=e}),t}var A=e("./lodash"),w=e("./acyclic"),E=e("./normalize"),x=e("./rank"),_=e("./util").normalizeRanks,D=e("./parent-dummy-chains"),k=e("./util").removeEmptyRanks,C=e("./nesting-graph"),F=e("./add-border-segments"),B=e("./coordinate-system"),L=e("./order"),S=e("./position"),T=e("./util"),N=e("./graphlib").Graph;t.exports=r;var q=["nodesep","edgesep","ranksep","marginx","marginy"],I={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},R=["acyclicer","ranker","rankdir","align"],O=["width","height"],P={width:0,height:0},j=["minlen","weight","width","height","labeloffset"],M={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},U=["labelpos"]},{"./acyclic":28,"./add-border-segments":29,"./coordinate-system":30,"./graphlib":33,"./lodash":36,"./nesting-graph":37,"./normalize":38,"./order":43,"./parent-dummy-chains":48,"./position":50,"./rank":52,"./util":55}],36:[function(e,t){t.exports=e(20)},{lodash:101}],37:[function(e,t){function r(e){var t=s.addDummyNode(e,"root",{},"_root"),r=i(e),a=o.max(r)-1,c=2*a+1;e.graph().nestingRoot=t,o.each(e.edges(),function(t){e.edge(t).minlen*=c});var l=u(e)+1;o.each(e.children(),function(i){n(e,t,c,l,a,r,i)}),e.graph().nodeRankFactor=c}function n(e,t,r,i,u,a,c){var l=e.children(c);if(!l.length)return void(c!==t&&e.setEdge(t,c,{weight:0,minlen:r}));var h=s.addBorderNode(e,"_bt"),d=s.addBorderNode(e,"_bb"),p=e.node(c);e.setParent(h,c),p.borderTop=h,e.setParent(d,c),p.borderBottom=d,o.each(l,function(o){n(e,t,r,i,u,a,o);var s=e.node(o),l=s.borderTop?s.borderTop:o,p=s.borderBottom?s.borderBottom:o,f=s.borderTop?i:2*i,g=l!==p?1:u-a[c]+1;e.setEdge(h,l,{weight:f,minlen:g,nestingEdge:!0}),e.setEdge(p,d,{weight:f,minlen:g,nestingEdge:!0})}),e.parent(c)||e.setEdge(t,h,{weight:0,minlen:u+a[c]})}function i(e){function t(n,i){var u=e.children(n);u&&u.length&&o.each(u,function(e){t(e,i+1)}),r[n]=i}var r={};return o.each(e.children(),function(e){t(e,1)}),r}function u(e){return o.reduce(e.edges(),function(t,r){return t+e.edge(r).weight},0)}function a(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,o.each(e.edges(),function(t){var r=e.edge(t);r.nestingEdge&&e.removeEdge(t)})}var o=e("./lodash"),s=e("./util");t.exports={run:r,cleanup:a}},{"./lodash":36,"./util":55}],38:[function(e,t){"use strict";function r(e){e.graph().dummyChains=[],u.each(e.edges(),function(t){n(e,t)})}function n(e,t){var r=t.v,n=e.node(r).rank,i=t.w,u=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(u!==n+1){e.removeEdge(t);var l,h,d;for(d=0,++n;u>n;++d,++n)s.points=[],h={width:0,height:0,edgeLabel:s,edgeObj:t,rank:n},l=a.addDummyNode(e,"edge",h,"_d"),n===c&&(h.width=s.width,h.height=s.height,h.dummy="edge-label",h.labelpos=s.labelpos),e.setEdge(r,l,{weight:s.weight},o),0===d&&e.graph().dummyChains.push(l),r=l;e.setEdge(r,i,{weight:s.weight},o)}}function i(e){u.each(e.graph().dummyChains,function(t){var r,n=e.node(t),i=n.edgeLabel;for(e.setEdge(n.edgeObj,i);n.dummy;)r=e.successors(t)[0],e.removeNode(t),i.points.push({x:n.x,y:n.y}),"edge-label"===n.dummy&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),t=r,n=e.node(t)})}var u=e("./lodash"),a=e("./util");t.exports={run:r,undo:i}},{"./lodash":36,"./util":55}],39:[function(e,t){function r(e,t,r){var i,u={};n.each(r,function(r){for(var n,a,o=e.parent(r);o;){if(n=e.parent(o),n?(a=u[n],u[n]=o):(a=i,i=o),a&&a!==o)return void t.setEdge(a,o);o=n}})}var n=e("../lodash");t.exports=r},{"../lodash":36}],40:[function(e,t){function r(e,t){return n.map(t,function(t){var r=e.inEdges(t);if(r.length){var i=n.reduce(r,function(t,r){var n=e.edge(r),i=e.node(r.v);return{sum:t.sum+n.weight*i.order,weight:t.weight+n.weight}},{sum:0,weight:0});return{v:t,barycenter:i.sum/i.weight,weight:i.weight}}return{v:t}})}var n=e("../lodash");t.exports=r},{"../lodash":36}],41:[function(e,t){function r(e,t,r){var a=n(e),o=new u({compound:!0}).setGraph({root:a}).setDefaultNodeLabel(function(t){return e.node(t)});return i.each(e.nodes(),function(n){var u=e.node(n),s=e.parent(n);(u.rank===t||u.minRank<=t&&t<=u.maxRank)&&(o.setNode(n),o.setParent(n,s||a),i.each(e[r](n),function(t){var r=t.v===n?t.w:t.v,u=o.edge(r,n),a=i.isUndefined(u)?0:u.weight;o.setEdge(r,n,{weight:e.edge(t).weight+a})}),i.has(u,"minRank")&&o.setNode(n,{borderLeft:u.borderLeft[t],borderRight:u.borderRight[t]}))}),o}function n(e){for(var t;e.hasNode(t=i.uniqueId("_root")););return t}var i=e("../lodash"),u=e("../graphlib").Graph;t.exports=r},{"../graphlib":33,"../lodash":36}],42:[function(e,t){"use strict";function r(e,t){for(var r=0,i=1;i<t.length;++i)r+=n(e,t[i-1],t[i]);return r}function n(e,t,r){for(var n=i.zipObject(r,i.map(r,function(e,t){return t})),u=i.flatten(i.map(t,function(t){return i.chain(e.outEdges(t)).map(function(t){return{pos:n[t.w],weight:e.edge(t).weight}}).sortBy("pos").value()}),!0),a=1;a<r.length;)a<<=1;var o=2*a-1;a-=1;var s=i.map(new Array(o),function(){return 0}),c=0;return i.each(u.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var r=0;t>0;)t%2&&(r+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*r})),c}var i=e("../lodash");t.exports=r},{"../lodash":36}],43:[function(e,t){"use strict";function r(e){var t=p.maxRank(e),r=n(e,a.range(1,t+1),"inEdges"),c=n(e,a.range(t-1,-1,-1),"outEdges"),l=o(e);u(e,l);for(var h,d=Number.POSITIVE_INFINITY,f=0,g=0;4>g;++f,++g){i(f%2?r:c,f%4>=2),l=p.buildLayerMatrix(e);var y=s(e,l);d>y&&(g=0,h=a.cloneDeep(l),d=y)}u(e,h)}function n(e,t,r){return a.map(t,function(t){return l(e,t,r)})}function i(e,t){var r=new d;a.each(e,function(e){var n=e.graph().root,i=c(e,n,r,t);a.each(i.vs,function(t,r){e.node(t).order=r}),h(e,r,i.vs)})}function u(e,t){a.each(t,function(t){a.each(t,function(t,r){e.node(t).order=r})})}var a=e("../lodash"),o=e("./init-order"),s=e("./cross-count"),c=e("./sort-subgraph"),l=e("./build-layer-graph"),h=e("./add-subgraph-constraints"),d=e("../graphlib").Graph,p=e("../util");t.exports=r},{"../graphlib":33,"../lodash":36,"../util":55,"./add-subgraph-constraints":39,"./build-layer-graph":41,"./cross-count":42,"./init-order":44,"./sort-subgraph":46}],44:[function(e,t){"use strict";function r(e){function t(i){if(!n.has(r,i)){r[i]=!0;var u=e.node(i);a[u.rank].push(i),n.each(e.successors(i),t)}}var r={},i=n.filter(e.nodes(),function(t){return!e.children(t).length}),u=n.max(n.map(i,function(t){return e.node(t).rank})),a=n.map(n.range(u+1),function(){return[]}),o=n.sortBy(i,function(t){return e.node(t).rank});return n.each(o,t),a}var n=e("../lodash");t.exports=r},{"../lodash":36}],45:[function(e,t){"use strict";function r(e,t){var r={};u.each(e,function(e,t){var n=r[e.v]={indegree:0,"in":[],out:[],vs:[e.v],i:t};u.isUndefined(e.barycenter)||(n.barycenter=e.barycenter,n.weight=e.weight)}),u.each(t.edges(),function(e){var t=r[e.v],n=r[e.w];u.isUndefined(t)||u.isUndefined(n)||(n.indegree++,t.out.push(r[e.w]))});var i=u.filter(r,function(e){return!e.indegree});return n(i)}function n(e){function t(e){return function(t){t.merged||(u.isUndefined(t.barycenter)||u.isUndefined(e.barycenter)||t.barycenter>=e.barycenter)&&i(e,t)}}function r(t){return function(r){r.in.push(t),0===--r.indegree&&e.push(r)}}for(var n=[];e.length;){var a=e.pop();n.push(a),u.each(a.in.reverse(),t(a)),u.each(a.out,r(a))}return u.chain(n).filter(function(e){return!e.merged}).map(function(e){return u.pick(e,["vs","i","barycenter","weight"])}).value()}function i(e,t){var r=0,n=0;e.weight&&(r+=e.barycenter*e.weight,n+=e.weight),t.weight&&(r+=t.barycenter*t.weight,n+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=r/n,e.weight=n,e.i=Math.min(t.i,e.i),t.merged=!0}var u=e("../lodash");t.exports=r},{"../lodash":36}],46:[function(e,t){function r(e,t,c,l){var h=e.children(t),d=e.node(t),p=d?d.borderLeft:void 0,f=d?d.borderRight:void 0,g={};p&&(h=u.filter(h,function(e){return e!==p&&e!==f}));var y=a(e,h);u.each(y,function(t){if(e.children(t.v).length){var n=r(e,t.v,c,l);g[t.v]=n,u.has(n,"barycenter")&&i(t,n)}});var m=o(y,c);n(m,g);var v=s(m,l);if(p&&(v.vs=u.flatten([p,v.vs,f],!0),e.predecessors(p).length)){var b=e.node(e.predecessors(p)[0]),A=e.node(e.predecessors(f)[0]);u.has(v,"barycenter")||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+b.order+A.order)/(v.weight+2),v.weight+=2 }return v}function n(e,t){u.each(e,function(e){e.vs=u.flatten(e.vs.map(function(e){return t[e]?t[e].vs:e}),!0)})}function i(e,t){u.isUndefined(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}var u=e("../lodash"),a=e("./barycenter"),o=e("./resolve-conflicts"),s=e("./sort");t.exports=r},{"../lodash":36,"./barycenter":40,"./resolve-conflicts":45,"./sort":47}],47:[function(e,t){function r(e,t){var r=a.partition(e,function(e){return u.has(e,"barycenter")}),o=r.lhs,s=u.sortBy(r.rhs,function(e){return-e.i}),c=[],l=0,h=0,d=0;o.sort(i(!!t)),d=n(c,s,d),u.each(o,function(e){d+=e.vs.length,c.push(e.vs),l+=e.barycenter*e.weight,h+=e.weight,d=n(c,s,d)});var p={vs:u.flatten(c,!0)};return h&&(p.barycenter=l/h,p.weight=h),p}function n(e,t,r){for(var n;t.length&&(n=u.last(t)).i<=r;)t.pop(),e.push(n.vs),r++;return r}function i(e){return function(t,r){return t.barycenter<r.barycenter?-1:t.barycenter>r.barycenter?1:e?r.i-t.i:t.i-r.i}}var u=e("../lodash"),a=e("../util");t.exports=r},{"../lodash":36,"../util":55}],48:[function(e,t){function r(e){var t=i(e);u.each(e.graph().dummyChains,function(r){for(var i=e.node(r),u=i.edgeObj,a=n(e,t,u.v,u.w),o=a.path,s=a.lca,c=0,l=o[c],h=!0;r!==u.w;){if(i=e.node(r),h){for(;(l=o[c])!==s&&e.node(l).maxRank<i.rank;)c++;l===s&&(h=!1)}if(!h){for(;c<o.length-1&&e.node(l=o[c+1]).minRank<=i.rank;)c++;l=o[c]}e.setParent(r,l),r=e.successors(r)[0]}})}function n(e,t,r,n){var i,u,a=[],o=[],s=Math.min(t[r].low,t[n].low),c=Math.max(t[r].lim,t[n].lim);i=r;do i=e.parent(i),a.push(i);while(i&&(t[i].low>s||c>t[i].lim));for(u=i,i=n;(i=e.parent(i))!==u;)o.push(i);return{path:a.concat(o.reverse()),lca:u}}function i(e){function t(i){var a=n;u.each(e.children(i),t),r[i]={low:a,lim:n++}}var r={},n=0;return u.each(e.children(),t),r}var u=e("./lodash");t.exports=r},{"./lodash":36}],49:[function(e,t){"use strict";function r(e,t){function r(t,r){var a=0,o=0,s=t.length,c=y.last(r);return y.each(r,function(t,l){var h=i(e,t),d=h?e.node(h).order:s;(h||t===c)&&(y.each(r.slice(o,l+1),function(t){y.each(e.predecessors(t),function(r){var i=e.node(r),o=i.order;!(a>o||o>d)||i.dummy&&e.node(t).dummy||u(n,r,t)})}),o=l+1,a=d)}),r}var n={};return y.reduce(t,r),n}function n(e,t){function r(t,r,n,a,o){var s;y.each(y.range(r,n),function(r){s=t[r],e.node(s).dummy&&y.each(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&u(i,t,s)})})}function n(t,n){var i,u=-1,a=0;return y.each(n,function(o,s){if("border"===e.node(o).dummy){var c=e.predecessors(o);c.length&&(i=e.node(c[0]).order,r(n,a,s,u,i),a=s,u=i)}r(n,a,n.length,i,t.length)}),n}var i={};return y.reduce(t,n),i}function i(e,t){return e.node(t).dummy?y.find(e.predecessors(t),function(t){return e.node(t).dummy}):void 0}function u(e,t,r){if(t>r){var n=t;t=r,r=n}var i=e[t];i||(e[t]=i={}),i[r]=!0}function a(e,t,r){if(t>r){var n=t;t=r,r=n}return y.has(e[t],r)}function o(e,t,r,n){var i={},u={},o={};return y.each(t,function(e){y.each(e,function(e,t){i[e]=e,u[e]=e,o[e]=t})}),y.each(t,function(e){var t=-1;y.each(e,function(e){var s=n(e);if(s.length){s=y.sortBy(s,function(e){return o[e]});for(var c=(s.length-1)/2,l=Math.floor(c),h=Math.ceil(c);h>=l;++l){var d=s[l];u[e]===e&&t<o[d]&&!a(r,e,d)&&(u[d]=e,u[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:u}}function s(e,t,r,n,i){var u={},a={},o={},s={},l={},h=e.graph(),d=f(h.nodesep,h.edgesep,i);return y.each(t,function(e){y.each(e,function(t,r){o[t]=t,u[t]=Number.POSITIVE_INFINITY,l[t]=e[r-1]})}),y.each(e.nodes(),function(i){r[i]===i&&c(e,t,d,r,n,u,a,o,l,s,i)}),y.each(t,function(e){y.each(e,function(e){if(s[e]=s[r[e]],e===r[e]&&u[o[r[e]]]<Number.POSITIVE_INFINITY){s[e]+=u[o[r[e]]];var t=a[o[r[e]]];t&&u[t]!==Number.POSITIVE_INFINITY&&(s[e]+=u[t])}})}),s}function c(e,t,r,n,i,u,a,o,s,l,h){if(!y.has(l,h)){l[h]=0;var d,p=h;do{if(s[p]){d=n[s[p]],c(e,t,r,n,i,u,a,o,s,l,d),o[h]===h&&(o[h]=o[d]);var f=r(e,p,s[p]);o[h]!==o[d]?(u[o[d]]=Math.min(u[o[d]],l[h]-l[d]-f),a[o[d]]=o[h]):l[h]=Math.max(l[h],l[d]+f)}p=i[p]}while(p!==h)}}function l(e,t){return y.min(t,function(t){var r=y.min(t,function(t,r){return t-g(e,r)/2}),n=y.max(t,function(t,r){return t+g(e,r)/2});return n-r})}function h(e,t){var r=y.min(t),n=y.max(t);y.each(["u","d"],function(i){y.each(["l","r"],function(u){var a,o=i+u,s=e[o];s!==t&&(a="l"===u?r-y.min(s):n-y.max(s),a&&(e[o]=y.mapValues(s,function(e){return e+a})))})})}function d(e,t){return y.mapValues(e.ul,function(r,n){if(t)return e[t.toLowerCase()][n];var i=y.sortBy(y.pluck(e,n));return(i[1]+i[2])/2})}function p(e){var t,i=m.buildLayerMatrix(e),u=y.merge(r(e,i),n(e,i)),a={};y.each(["u","d"],function(r){t="u"===r?i:y.values(i).reverse(),y.each(["l","r"],function(n){"r"===n&&(t=y.map(t,function(e){return y.values(e).reverse()}));var i=y.bind("u"===r?e.predecessors:e.successors,e),c=o(e,t,u,i),l=s(e,t,c.root,c.align,"r"===n);"r"===n&&(l=y.mapValues(l,function(e){return-e})),a[r+n]=l})});var c=l(e,a);return h(a,c),d(a,e.graph().align)}function f(e,t,r){return function(n,i,u){var a,o=n.node(i),s=n.node(u),c=0;if(c+=o.width/2,y.has(o,"labelpos"))switch(o.labelpos.toLowerCase()){case"l":a=-o.width/2;break;case"r":a=o.width/2}if(a&&(c+=r?a:-a),a=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,y.has(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=s.width/2;break;case"r":a=-s.width/2}return a&&(c+=r?a:-a),a=0,c}}function g(e,t){return e.node(t).width}var y=e("../lodash"),m=e("../util");t.exports={positionX:p,findType1Conflicts:r,findType2Conflicts:n,addConflict:u,hasConflict:a,verticalAlignment:o,horizontalCompaction:s,alignCoordinates:h,findSmallestWidthAlignment:l,balance:d}},{"../lodash":36,"../util":55}],50:[function(e,t){"use strict";function r(e){e=u.asNonCompoundGraph(e),n(e),i.each(a(e),function(t,r){e.node(r).x=t})}function n(e){var t=u.buildLayerMatrix(e),r=e.graph().ranksep,n=0;i.each(t,function(t){var u=i.max(i.map(t,function(t){return e.node(t).height}));i.each(t,function(t){e.node(t).y=n+u/2}),n+=u+r})}var i=e("../lodash"),u=e("../util"),a=e("./bk").positionX;t.exports=r},{"../lodash":36,"../util":55,"./bk":49}],51:[function(e,t){"use strict";function r(e){var t=new o({directed:!1}),r=e.nodes()[0],a=e.nodeCount();t.setNode(r,{});for(var c,l;n(t,e)<a;)c=i(t,e),l=t.hasNode(c.v)?s(e,c):-s(e,c),u(t,e,l);return t}function n(e,t){function r(n){a.each(t.nodeEdges(n),function(i){var u=i.v,a=n===u?i.w:u;e.hasNode(a)||s(t,i)||(e.setNode(a,{}),e.setEdge(n,a,{}),r(a))})}return a.each(e.nodes(),r),e.nodeCount()}function i(e,t){return a.min(t.edges(),function(r){return e.hasNode(r.v)!==e.hasNode(r.w)?s(t,r):void 0})}function u(e,t,r){a.each(e.nodes(),function(e){t.node(e).rank+=r})}var a=e("../lodash"),o=e("../graphlib").Graph,s=e("./util").slack;t.exports=r},{"../graphlib":33,"../lodash":36,"./util":54}],52:[function(e,t){"use strict";function r(e){switch(e.graph().ranker){case"network-simplex":i(e);break;case"tight-tree":n(e);break;case"longest-path":c(e);break;default:i(e)}}function n(e){a(e),o(e)}function i(e){s(e)}var u=e("./util"),a=u.longestPath,o=e("./feasible-tree"),s=e("./network-simplex");t.exports=r;var c=a},{"./feasible-tree":51,"./network-simplex":53,"./util":54}],53:[function(e,t){"use strict";function r(e){e=A(e),m(e);var t=g(e);a(t),n(t,e);for(var r,i;r=s(t);)i=c(t,e,r),l(t,e,r,i)}function n(e,t){var r=b(e,e.nodes());r=r.slice(0,r.length-1),f.each(r,function(r){i(e,t,r)})}function i(e,t,r){var n=e.node(r),i=n.parent;e.edge(r,i).cutvalue=u(e,t,r)}function u(e,t,r){var n=e.node(r),i=n.parent,u=!0,a=t.edge(r,i),o=0;return a||(u=!1,a=t.edge(i,r)),o=a.weight,f.each(t.nodeEdges(r),function(n){var a=n.v===r,s=a?n.w:n.v;if(s!==i){var c=a===u,l=t.edge(n).weight;if(o+=c?l:-l,d(e,r,s)){var h=e.edge(r,s).cutvalue;o+=c?-h:h}}}),o}function a(e,t){arguments.length<2&&(t=e.nodes()[0]),o(e,{},1,t)}function o(e,t,r,n,i){var u=r,a=e.node(n);return t[n]=!0,f.each(e.neighbors(n),function(i){f.has(t,i)||(r=o(e,t,r,i,n))}),a.low=u,a.lim=r++,i?a.parent=i:delete a.parent,r}function s(e){return f.find(e.edges(),function(t){return e.edge(t).cutvalue<0})}function c(e,t,r){var n=r.v,i=r.w;t.hasEdge(n,i)||(n=r.w,i=r.v);var u=e.node(n),a=e.node(i),o=u,s=!1;u.lim>a.lim&&(o=a,s=!0);var c=f.filter(t.edges(),function(t){return s===p(e,e.node(t.v),o)&&s!==p(e,e.node(t.w),o)});return f.min(c,function(e){return y(t,e)})}function l(e,t,r,i){var u=r.v,o=r.w;e.removeEdge(u,o),e.setEdge(i.v,i.w,{}),a(e),n(e,t),h(e,t)}function h(e,t){var r=f.find(e.nodes(),function(e){return!t.node(e).parent}),n=v(e,r);n=n.slice(1),f.each(n,function(r){var n=e.node(r).parent,i=t.edge(r,n),u=!1;i||(i=t.edge(n,r),u=!0),t.node(r).rank=t.node(n).rank+(u?i.minlen:-i.minlen)})}function d(e,t,r){return e.hasEdge(t,r)}function p(e,t,r){return r.low<=t.lim&&t.lim<=r.lim}var f=e("../lodash"),g=e("./feasible-tree"),y=e("./util").slack,m=e("./util").longestPath,v=e("../graphlib").alg.preorder,b=e("../graphlib").alg.postorder,A=e("../util").simplify;t.exports=r,r.initLowLimValues=a,r.initCutValues=n,r.calcCutValue=u,r.leaveEdge=s,r.enterEdge=c,r.exchangeEdges=l},{"../graphlib":33,"../lodash":36,"../util":55,"./feasible-tree":51,"./util":54}],54:[function(e,t){"use strict";function r(e){function t(n){var u=e.node(n);if(i.has(r,n))return u.rank;r[n]=!0;var a=i.min(i.map(e.outEdges(n),function(r){return t(r.w)-e.edge(r).minlen}));return a===Number.POSITIVE_INFINITY&&(a=0),u.rank=a}var r={};i.each(e.sources(),t)}function n(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var i=e("../lodash");t.exports={longestPath:r,slack:n}},{"../lodash":36}],55:[function(e,t){"use strict";function r(e,t,r,n){var i;do i=y.uniqueId(n);while(e.hasNode(i));return r.dummy=t,e.setNode(i,r),i}function n(e){var t=(new m).setGraph(e.graph());return y.each(e.nodes(),function(r){t.setNode(r,e.node(r))}),y.each(e.edges(),function(r){var n=t.edge(r.v,r.w)||{weight:0,minlen:1},i=e.edge(r);t.setEdge(r.v,r.w,{weight:n.weight+i.weight,minlen:Math.max(n.minlen,i.minlen)})}),t}function i(e){var t=new m({multigraph:e.isMultigraph()}).setGraph(e.graph());return y.each(e.nodes(),function(r){e.children(r).length||t.setNode(r,e.node(r))}),y.each(e.edges(),function(r){t.setEdge(r,e.edge(r))}),t}function u(e){var t=y.map(e.nodes(),function(t){var r={};return y.each(e.outEdges(t),function(t){r[t.w]=(r[t.w]||0)+e.edge(t).weight}),r});return y.zipObject(e.nodes(),t)}function a(e){var t=y.map(e.nodes(),function(t){var r={};return y.each(e.inEdges(t),function(t){r[t.v]=(r[t.v]||0)+e.edge(t).weight}),r});return y.zipObject(e.nodes(),t)}function o(e,t){var r=e.x,n=e.y,i=t.x-r,u=t.y-n,a=e.width/2,o=e.height/2;if(!i&&!u)throw new Error("Not possible to find intersection inside of the rectangle");var s,c;return Math.abs(u)*a>Math.abs(i)*o?(0>u&&(o=-o),s=o*i/u,c=o):(0>i&&(a=-a),s=a,c=a*u/i),{x:r+s,y:n+c}}function s(e){var t=y.map(y.range(d(e)+1),function(){return[]});return y.each(e.nodes(),function(r){var n=e.node(r),i=n.rank;y.isUndefined(i)||(t[i][n.order]=r)}),t}function c(e){var t=y.min(y.map(e.nodes(),function(t){return e.node(t).rank}));y.each(e.nodes(),function(r){var n=e.node(r);y.has(n,"rank")&&(n.rank-=t)})}function l(e){var t=y.min(y.map(e.nodes(),function(t){return e.node(t).rank})),r=[];y.each(e.nodes(),function(n){var i=e.node(n).rank-t;y.has(r,i)||(r[i]=[]),r[i].push(n)});var n=0,i=e.graph().nodeRankFactor;y.each(r,function(t,r){y.isUndefined(t)&&r%i!==0?--n:n&&y.each(t,function(t){e.node(t).rank+=n})})}function h(e,t,n,i){var u={width:0,height:0};return arguments.length>=4&&(u.rank=n,u.order=i),r(e,"border",u,t)}function d(e){return y.max(y.map(e.nodes(),function(t){var r=e.node(t).rank;return y.isUndefined(r)?void 0:r}))}function p(e,t){var r={lhs:[],rhs:[]};return y.each(e,function(e){t(e)?r.lhs.push(e):r.rhs.push(e)}),r}function f(e,t){var r=y.now();try{return t()}finally{console.log(e+" time: "+(y.now()-r)+"ms")}}function g(e,t){return t()}var y=e("./lodash"),m=e("./graphlib").Graph;t.exports={addDummyNode:r,simplify:n,asNonCompoundGraph:i,successorWeights:u,predecessorWeights:a,intersectRect:o,buildLayerMatrix:s,normalizeRanks:c,removeEmptyRanks:l,addBorderNode:h,maxRank:d,partition:p,time:f,notime:g}},{"./graphlib":33,"./lodash":36}],56:[function(e,t){t.exports="0.6.4"},{}],57:[function(e,t){var r=e("./lib");t.exports={Graph:r.Graph,json:e("./lib/json"),alg:e("./lib/alg"),version:r.version}},{"./lib":73,"./lib/alg":64,"./lib/json":74}],58:[function(e,t){function r(e){function t(u){n.has(i,u)||(i[u]=!0,r.push(u),n.each(e.successors(u),t),n.each(e.predecessors(u),t))}var r,i={},u=[];return n.each(e.nodes(),function(e){r=[],t(e),r.length&&u.push(r)}),u}var n=e("../lodash");t.exports=r},{"../lodash":75}],59:[function(e,t){function r(e,t,r){i.isArray(t)||(t=[t]);var u=[],a={};return i.each(t,function(t){if(!e.hasNode(t))throw new Error("Graph does not have node: "+t);n(e,t,"post"===r,a,u)}),u}function n(e,t,r,u,a){i.has(u,t)||(u[t]=!0,r||a.push(t),i.each(e.neighbors(t),function(t){n(e,t,r,u,a)}),r&&a.push(t))}var i=e("../lodash");t.exports=r},{"../lodash":75}],60:[function(e,t){function r(e,t,r){return i.transform(e.nodes(),function(i,u){i[u]=n(e,u,t,r)},{})}var n=e("./dijkstra"),i=e("../lodash");t.exports=r},{"../lodash":75,"./dijkstra":61}],61:[function(e,t){function r(e,t,r,i){return n(e,String(t),r||a,i||function(t){return e.outEdges(t)})}function n(e,t,r,n){var i,a,o={},s=new u,c=function(e){var t=e.v!==i?e.v:e.w,n=o[t],u=r(e),c=a.distance+u;if(0>u)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+u);c<n.distance&&(n.distance=c,n.predecessor=i,s.decrease(t,c))};for(e.nodes().forEach(function(e){var r=e===t?0:Number.POSITIVE_INFINITY;o[e]={distance:r},s.add(e,r)});s.size()>0&&(i=s.removeMin(),a=o[i],a.distance!==Number.POSITIVE_INFINITY);)n(i).forEach(c);return o}var i=e("../lodash"),u=e("../data/priority-queue");t.exports=r;var a=i.constant(1)},{"../data/priority-queue":71,"../lodash":75}],62:[function(e,t){function r(e){return n.filter(i(e),function(e){return e.length>1})}var n=e("../lodash"),i=e("./tarjan");t.exports=r},{"../lodash":75,"./tarjan":69}],63:[function(e,t){function r(e,t,r){return n(e,t||u,r||function(t){return e.outEdges(t)})}function n(e,t,r){var n={},i=e.nodes();return i.forEach(function(e){n[e]={},n[e][e]={distance:0},i.forEach(function(t){e!==t&&(n[e][t]={distance:Number.POSITIVE_INFINITY})}),r(e).forEach(function(r){var i=r.v===e?r.w:r.v,u=t(r);n[e][i]={distance:u,predecessor:e}})}),i.forEach(function(e){var t=n[e];i.forEach(function(r){var u=n[r];i.forEach(function(r){var n=u[e],i=t[r],a=u[r],o=n.distance+i.distance;o<a.distance&&(a.distance=o,a.predecessor=i.predecessor)})})}),n}var i=e("../lodash");t.exports=r;var u=i.constant(1)},{"../lodash":75}],64:[function(e,t){t.exports={components:e("./components"),dijkstra:e("./dijkstra"),dijkstraAll:e("./dijkstra-all"),findCycles:e("./find-cycles"),floydWarshall:e("./floyd-warshall"),isAcyclic:e("./is-acyclic"),postorder:e("./postorder"),preorder:e("./preorder"),prim:e("./prim"),tarjan:e("./tarjan"),topsort:e("./topsort")}},{"./components":58,"./dijkstra":61,"./dijkstra-all":60,"./find-cycles":62,"./floyd-warshall":63,"./is-acyclic":65,"./postorder":66,"./preorder":67,"./prim":68,"./tarjan":69,"./topsort":70}],65:[function(e,t){function r(e){try{n(e)}catch(t){if(t instanceof n.CycleException)return!1;throw t}return!0}var n=e("./topsort");t.exports=r},{"./topsort":70}],66:[function(e,t){function r(e,t){return n(e,t,"post")}var n=e("./dfs");t.exports=r},{"./dfs":59}],67:[function(e,t){function r(e,t){return n(e,t,"pre")}var n=e("./dfs");t.exports=r},{"./dfs":59}],68:[function(e,t){function r(e,t){function r(e){var r=e.v===a?e.w:e.v,n=c.priority(r);if(void 0!==n){var i=t(e);n>i&&(s[r]=a,c.decrease(r,i))}}var a,o=new i,s={},c=new u;if(0===e.nodeCount())return o;n.each(e.nodes(),function(e){c.add(e,Number.POSITIVE_INFINITY),o.setNode(e)}),c.decrease(e.nodes()[0],0);for(var l=!1;c.size()>0;){if(a=c.removeMin(),n.has(s,a))o.setEdge(a,s[a]);else{if(l)throw new Error("Input graph is not connected: "+e);l=!0}e.nodeEdges(a).forEach(r)}return o}var n=e("../lodash"),i=e("../graph"),u=e("../data/priority-queue");t.exports=r},{"../data/priority-queue":71,"../graph":72,"../lodash":75}],69:[function(e,t){function r(e){function t(o){var s=u[o]={onStack:!0,lowlink:r,index:r++};if(i.push(o),e.successors(o).forEach(function(e){n.has(u,e)?u[e].onStack&&(s.lowlink=Math.min(s.lowlink,u[e].index)):(t(e),s.lowlink=Math.min(s.lowlink,u[e].lowlink))}),s.lowlink===s.index){var c,l=[];do c=i.pop(),u[c].onStack=!1,l.push(c);while(o!==c);a.push(l)}}var r=0,i=[],u={},a=[];return e.nodes().forEach(function(e){n.has(u,e)||t(e)}),a}var n=e("../lodash");t.exports=r},{"../lodash":75}],70:[function(e,t){function r(e){function t(o){if(i.has(u,o))throw new n;i.has(r,o)||(u[o]=!0,r[o]=!0,i.each(e.predecessors(o),t),delete u[o],a.push(o))}var r={},u={},a=[];if(i.each(e.sinks(),t),i.size(r)!==e.nodeCount())throw new n;return a}function n(){}var i=e("../lodash");t.exports=r,r.CycleException=n},{"../lodash":75}],71:[function(e,t){function r(){this._arr=[],this._keyIndices={}}var n=e("../lodash");t.exports=r,r.prototype.size=function(){return this._arr.length},r.prototype.keys=function(){return this._arr.map(function(e){return e.key})},r.prototype.has=function(e){return n.has(this._keyIndices,e)},r.prototype.priority=function(e){var t=this._keyIndices[e];return void 0!==t?this._arr[t].priority:void 0},r.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},r.prototype.add=function(e,t){var r=this._keyIndices;if(e=String(e),!n.has(r,e)){var i=this._arr,u=i.length;return r[e]=u,i.push({key:e,priority:t}),this._decrease(u),!0}return!1},r.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},r.prototype.decrease=function(e