MCPcopy
hub / github.com/twitter/labella.js / o

Function o

evaluation/labella-extra.min.js:1–1  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

1!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.labella=e():t.labella=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";t.exports={Node:n(1),Force:n(2),Distributor:n(3),Renderer:n(10),metrics:n(11),util:n(12)}},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),i=function(){function t(e,r,i){n(this,t),this.idealPos=e,this.currentPos=e,this.width=r,this.data=i,this.layerIndex=0}return r(t,[{key:"distanceFrom",value:function(t){var e=this.width/2,n=t.width/2;return Math.max(this.currentPos-e,t.currentPos-n)-Math.min(this.currentPos+e,t.currentPos+n)}},{key:"moveToIdealPosition",value:function(){return this.currentPos=this.idealPos,this}},{key:"displacement",value:function(){return this.idealPos-this.currentPos}},{key:"overlapWithNode",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?0:arguments[1];return this.distanceFrom(t)-e<0}},{key:"overlapWithPoint",value:function(t){var e=this.width/2;return t>=this.currentPos-e&&t<=this.currentPos+e}},{key:"positionBefore",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?0:arguments[1];return t.currentLeft()-this.width/2-e}},{key:"positionAfter",value:function(t){var e=arguments.length<=1||void 0===arguments[1]?0:arguments[1];return t.currentRight()+this.width/2+e}},{key:"currentRight",value:function(){return this.currentPos+this.width/2}},{key:"currentLeft",value:function(){return this.currentPos-this.width/2}},{key:"idealRight",value:function(){return this.idealPos+this.width/2}},{key:"idealLeft",value:function(){return this.idealPos-this.width/2}},{key:"createStub",value:function(e){var n=new t(this.idealPos,e,this.data);return n.currentPos=this.currentPos,n.child=this,this.parent=n,n}},{key:"removeStub",value:function(){return this.parent&&(this.parent.child=null,this.parent=null),this}},{key:"isStub",value:function(){return!!this.child}},{key:"getPathToRoot",value:function(){for(var t=[],e=this;e;)t.push(e),e=e.parent;return t}},{key:"getPathFromRoot",value:function(){return this.getPathToRoot().reverse()}},{key:"getPathToRootLength",value:function(){for(var t=0,e=this;e;){var n=e.parent?e.parent.currentPos:e.idealPos;t+=Math.abs(e.currentPos-n),e=e.parent}return t}},{key:"getRoot",value:function(){for(var t=this,e=this;e;)t=e,e=e.parent;return t}},{key:"getLayerIndex",value:function(){return this.layerIndex}},{key:"clone",value:function(){var e=new t(this.idealPos,this.width,this.data);return e.currentPos=this.currentPos,e.layerIndex=this.layerIndex,e}}]),t}();t.exports=i},function(t,e,n){"use strict";var r=n(3),i=n(4),o=n(8),s={nodeSpacing:3,minPos:0,maxPos:null,algorithm:"overlap",density:.85,stubWidth:1},u=function(t){var e={},n=i.extend({},s),u=new r,a=[],c=null;return e.nodes=function(t){return arguments.length?(a=t,c=null,e):a},e.getLayers=function(){return c},e.options=function(t){if(!arguments.length)return n;n=i.extend(n,t);var o=i.pick(n,Object.keys(r.DEFAULT_OPTIONS));return i.isDefined(n.minPos)&&i.isDefined(n.maxPos)?o.layerWidth=n.maxPos-n.minPos:o.layerWidth=null,u.options(o),e},e.options(t),e.compute=function(){var t=i.pick(n,Object.keys(o.DEFAULT_OPTIONS));return a.forEach(function(t){t.removeStub()}),c=u.distribute(a),c.map(function(e,n){e.forEach(function(t){t.layerIndex=n}),o(e,t)}),e},e.start=function(){console.log("[warning] force.start() is deprecated. Please use force.compute() instead.")},e};u.DEFAULT_OPTIONS=s,t.exports=u},function(t,e,n){"use strict";var r=n(4),i=n(6),o={algorithm:"overlap",layerWidth:1e3,density:.75,nodeSpacing:3,stubWidth:1},s=function(t){var e={};t=r.extend({},o,t),e.options=function(n){return arguments.length?(t=r.extend(t,n),e):t},e.computeRequiredWidth=function(e){return r.sum(e,function(e){return e.width+t.nodeSpacing})-t.nodeSpacing},e.maxWidthPerLayer=function(){return t.density*t.layerWidth},e.needToSplit=function(t){return e.estimateRequiredLayers(t)>1},e.estimateRequiredLayers=function(n){return t.layerWidth?Math.ceil(e.computeRequiredWidth(n)/e.maxWidthPerLayer()):1};var n={simple:function(n){for(var r=e.estimateRequiredLayers(n),i=[],o=0;r>o;o++)i.push([]);return n.forEach(function(e,n){var o=n%r;i[o].push(e);for(var s=e,u=o-1;u>=0;u--)s=s.createStub(t.stubWidth),i[u].push(s)}),i},roundRobin:function(t){var e=[];return e},overlap:function(n){for(var r=[],i=e.maxWidthPerLayer(),o=n.concat(),s=e.computeRequiredWidth(o);s>i;){e.countIdealOverlaps(o);var u=o.concat(),a=s;for(o=[];u.length>2&&a>i;){u.sort(function(t,e){return e.overlapCount-t.overlapCount});var c=u.shift();a-=c.width,a+=t.stubWidth,c.overlaps.forEach(function(t){t.overlapCount--}),o.push(c)}r.push(u),s=e.computeRequiredWidth(o)}o.length>0&&r.push(o);for(var h=r.length-1;h>=1;h--)for(var f=r[h],l=0;l<f.length;l++){var p=f[l];if(!p.isStub())for(var d=p,v=h-1;v>=0;v--)d=d.createStub(t.stubWidth),r[v].push(d)}return r}};return e.countIdealOverlaps=function(e){var n=new i(t.layerWidth/2);return e.forEach(function(t){n.add([t.idealLeft(),t.idealRight(),t])}),e.forEach(function(t){var e=n.search(t.idealLeft(),t.idealRight());t.overlaps=e,t.overlapCount=e.length}),e},e.distribute=function(i){if(!i||0===i.length)return[];if("none"==t.algorithm||!r.isDefined(t.algorithm))return[i];if(!e.needToSplit(i))return[i];if(i=i.concat().sort(function(t,e){return t.idealPos-e.idealPos}),"function"==typeof t.algorithm)return t.algorithm(i,t);if(n.hasOwnProperty(t.algorithm))return n[t.algorithm](i);throw"Unknown algorithm: "+t.algorithm},e};s.DEFAULT_OPTIONS=o,t.exports=s},function(t,e,n){"use strict";var r={isDefined:function(t){return null!==t&&void 0!==t},pick:function(t,e){return e.reduce(function(e,n){return e[n]=t[n],e},{})},sum:function(t,e){return t.map(e).reduce(function(t,e){return t+e},0)}};r.extend=n(5),t.exports=r},function(t,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},r=Object.prototype.hasOwnProperty,i=Object.prototype.toString,o=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"[object Array]"===i.call(t)},s=function(t){if(!t||"[object Object]"!==i.call(t))return!1;var e=r.call(t,"constructor"),n=t.constructor&&t.constructor.prototype&&r.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!e&&!n)return!1;var o;for(o in t);return void 0===o||r.call(t,o)};t.exports=function u(){var t,e,r,i,a,c,h=arguments[0],f=1,l=arguments.length,p=!1;for("boolean"==typeof h?(p=h,h=arguments[1]||{},f=2):("object"!==("undefined"==typeof h?"undefined":n(h))&&"function"!=typeof h||null==h)&&(h={});l>f;++f)if(t=arguments[f],null!=t)for(e in t)r=h[e],i=t[e],h!==i&&(p&&i&&(s(i)||(a=o(i)))?(a?(a=!1,c=r&&o(r)?r:[]):c=r&&s(r)?r:{},h[e]=u(p,c,i)):void 0!==i&&(h[e]=i));return h}},function(t,e,n){"use strict";function r(t,e){if(e||(e={}),this.startKey=e.startKey||0,this.endKey=e.endKey||1,this.intervalHash={},this.pointTree=new c({compare:function(t,e){if(null==t)return-1;if(null==e)return 1;var n=t[0]-e[0];return n>0?1:0==n?0:-1}}),this._autoIncrement=0,!t||"number"!=typeof t)throw new Error("you must specify center index as the 2nd argument.");this.root=new u(t,this)}function i(t,e){return e.end<t.idx?(t.left||(t.left=new u(e.start+e.end>>1,this)),i.call(this,t.left,e)):t.idx<e.start?(t.right||(t.right=new u(e.start+e.end>>1,this)),i.call(this,t.right,e)):t.insert(e)}function o(t,e,n){return t?e<t.idx?(t.starts.every(function(t){var r=t.start<=e;return r&&n.push(t.result()),r}),o.call(this,t.left,e,n)):e>t.idx?(t.ends.every(function(t){var r=t.end>=e;return r&&n.push(t.result()),r}),o.call(this,t.right,e,n)):void t.starts.map(function(t){n.push(t.result())}):void 0}function s(t,e,n){if(0>=e-t)throw new Error("end must be greater than start. start: "+t+", end: "+e);var r={},i=[];o.call(this,this.root,t+e>>1,i,!0),i.forEach(function(t){r[t.id]=!0});for(var s=this.pointTree.bsearch([t,null]),u=this.pointTree;s>=0&&u[s][0]==t;)s--;var a=this.pointTree.bsearch([e,null]);if(a>=0){for(var c=u.length-1;c>=a&&u[a][0]<=e;)a++;u.slice(s+1,a).forEach(function(t){var e=t[1];r[e]=!0},this),Object.keys(r).forEach(function(r){var i=this.intervalHash[r];n.push(i.result(t,e))},this)}}function u(t){this.idx=t,this.starts=new c({compare:function(t,e){if(null==t)return-1;if(null==e)return 1;var n=t.start-e.start;return n>0?1:0==n?0:-1}}),this.ends=new c({compare:function(t,e){if(null==t)return-1;if(null==e)return 1;var n=t.end-e.end;return 0>n?1:0==n?0:-1}})}function a(t,e,n,r){if(this.id=e,this.start=t[n],this.end=t[r],this.data=t,"number"!=typeof this.start||"number"!=typeof this.end)throw new Error("start, end must be number. start: "+this.start+", end: "+this.end);if(this.start>=this.end)throw new Error("start must be smaller than end. start: "+this.start+", end: "+this.end)}var c=n(7);r.prototype.add=function(t,e){if(this.intervalHash[e])throw new Error("id "+e+" is already registered.");if(void 0==e){for(;this.intervalHash[this._autoIncrement];)this._autoIncrement++;e=this._autoIncrement}var n=new a(t,e,this.startKey,this.endKey);this.pointTree.insert([n.start,e]),this.pointTree.insert([n.end,e]),this.intervalHash[e]=n,this._autoIncrement++,i.call(this,this.root,n)},r.prototype.search=function(t,e){var n=[];if("number"!=typeof t)throw new Error(t+": invalid input");if(void 0==e)o.call(this,this.root,t,n);else{if("number"!=typeof e)throw new Error(t+","+e+": invalid input");s.call(this,t,e,n)}return n},r.prototype.remove=function(t){},u.prototype.insert=function(t){this.starts.insert(t),this.ends.insert(t)},a.prototype.result=function(t,e){var n={id:this.id,data:this.data};if("number"==typeof t&&"number"==typeof e){var r=Math.max(this.start,t),i=Math.min(this.end,e),o=i-r;n.rate1=o/(e-t),n.rate2=o/(this.end-this.start)}return n},t.exports=r},function(t,e){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},r=function i(){var t=null,e={},r=arguments;["0","1"].forEach(function(i){var o=r[i];Array.isArray(o)?t=o:o&&"object"==("undefined"==typeof o?"undefined":n(o))&&(e=o)}),"function"==typeof e.filter&&(this._filter=e.filter),"function"==typeof e.compare?this._compare=e.compare:"string"==typeof e.compare&&i.compares[e.compare]&&(this._compare=i.compares[e.compare]),this._unique=!!e.unique,e.resume&&t?t.forEach(function(t,e){this.push(t)},this):t&&this.insert.apply(this,t)};r.create=function(t,e){return new r(t,e)},r.prototype=new Array,r.prototype.constructor=Array.prototype.constructor,r.prototype.insertOne=function(t){var e=this.bsearch(t);return this._unique&&null!=this.key(t,e)?!1:this._filter(t,e)?(this.splice(e+1,0,t),e+1):!1},r.prototype.insert=function(){return Array.prototype.map.call(arguments,function(t){return this.insertOne(t)},this)},r.prototype.remove=function(t){return this.splice(t,1),this},r.prototype.bsearch=function(t){if(!this.length)return-1;for(var e,n=0,r=this.length;r-n>1;){e=Math.floor((n+r)/2);var i=this[e],o=this._compare(t,i);if(0==o)return e;o>0?n=e:r=e}return 0==n&&this._compare(this[0],t)>0?-1:n},r.prototype.key=function(t,e){null==e&&(e=this.bsearch(t));var n=e;if(-1==n||this._compare(this[n],t)<0)return n+1<this.length&&0==this._compare(this[n+1],t)?n+1:null;for(;n>=1&&0==this._compare(this[n-1],t);)n--;return n},r.prototype.keys=function(t,e){var n=[];null==e&&(e=this.bsearch(t));for(var r=e;r>=0&&0==this._compare(this[r],t);)n.push(r),r--;var i=this.length;for(r=e+1;i>r&&0==this._compare(this[r],t);)n.push(r),r++;return n.length?n:null},r.prototype.unique=function(t){if(t)return this.filter(function(t,e){return 0==e||0!=this._compare(this[e-1],t)},this);var e=0;return this.map(function(t,n){return 0==n||0!=this._compare(this[n-1],t)?null:n-e++},this).forEach(function(t){null!=t&&this.remove(t)},this),this},r.prototype.toArray=function(){return this.slice()},r.prototype._filter=function(t,e){return!0},r.compares={number:function(t,e){var n=t-e;return n>0?1:0==n?0:-1},string:function(t,e){return t>e?1:t==e?0:-1}},r.prototype._compare=r.compares.string,t.exports=r},function(t,e,n){"use strict";function r(t){return t[t.length-1]}function i(t){var e=new u.Variable(t.targetPos);return e.node=t,e}function o(t,e){if(t.length>0){e=s.extend(a,e),t.forEach(function(t){t.targetPos=t.parent?t.parent.currentPos:t.idealPos}),t.sort(function(t,e){var n=t.targetPos-e.targetPos;return 0!==n?n:t.isStub()-e.isStub()});for(var n=t.map(i),o=[],c=1;c<n.length;c++){var h,f=n[c-1],l=n[c];h=f.node.isStub()&&l.node.isStub()?(f.node.width+l.node.width)/2+e.lineSpacing:(f.node.width+l.node.width)/2+e.nodeSpacing,o.push(new u.Constraint(f,l,h))}if(s.isDefined(e.minPos)){var p=new u.Variable(e.minPos,1e10),d=n[0];o.push(new u.Constraint(p,d,d.node.width/2)),n.unshift(p)}if(s.isDefined(e.maxPos)){var v=new u.Variable(e.maxPos,1e10),y=r(n);o.push(new u.Constraint(y,v,y.node.width/2)),n.push(v)}var m=new u.Solver(n,o);m.solve(),n.filter(function(t){return t.node}).map(function(t){return t.node.currentPos=Math.round(t.position()),t})}return t}var s=n(4),u=n(9),a={lineSpacing:2,nodeSpacing:3,minPos:0,maxPos:null};o.DEFAULT_OPTIONS=a,t.exports=o},function(t,e){"use strict";var n={},r=function(){function t(t){this.scale=t,this.AB=0,this.AD=0,this.A2=0}return t.prototype.addVariable=function(t){var e=this.scale/t.scale,n=t.offset/t.scale,r=t.weight;this.AB+=r*e*n,this.AD+=r*e*t.desiredPosition,this.A2+=r*e*e},t.prototype.getPosn=function(){return(this.AD-this.AB)/this.A2},t}();n.PositionStats=r;var i=function(){function t(t,e,n,r){void 0===r&&(r=!1),this.left=t,this.right=e,this.gap=n,this.equality=r,this.active=!1,this.unsatisfiable=!1,this.left=t,this.right=e,this.gap=n,this.equality=r}return t.prototype.slack=function(){return this.unsatisfiable?Number.MAX_VALUE:this.right.scale*this.right.position()-this.gap-this.left.scale*this.left.position()},t}();n.Constraint=i;var o=function(){function t(t,e,n){void 0===e&&(e=1),void 0===n&&(n=1),this.desiredPosition=t,this.weight=e,this.scale=n,this.offset=0}return t.prototype.dfdv=function(){return 2*this.weight*(this.position()-this.desiredPosition)},t.prototype.position=function(){return(this.block.ps.scale*this.block.posn+this.offset)/this.scale},t.prototype.visitNeighbours=function(t,e){var n=function(n,r){return n.active&&t!==r&&e(n,r)};this.cOut.forEach(function(t){return n(t,t.right)}),this.cIn.forEach(function(t){return n(t,t.left)})},t}();n.Variable=o;var s=function(){function t(t){this.vars=[],t.offset=0,this.ps=new r(t.scale),this.addVariable(t)}return t.prototype.addVariable=function(t){t.block=this,this.vars.push(t),this.ps.addVariable(t),this.posn=this.ps.getPosn()},t.prototype.updateWeightedPosition=function(){this.ps.AB=this.ps.AD=this.ps.A2=0;for(var t=0,e=this.vars.length;e>t;++t)this.ps.addVariable(this.vars[t]);this.posn=this.ps.getPosn()},t.prototype.compute_lm=function(t,e,n){var r=this,i=t.dfdv();return t.visitNeighbours(e,function(e,o){var s=r.compute_lm(o,t,n);o===e.right?(i+=s*e.left.scale,e.lm=s):(i+=s*e.right.scale,e.lm=-s),n(e)}),i/t.scale},t.prototype.populateSplitBlock=function(t,e){var n=this;t.visitNeighbours(e,function(e,r){r.offset=t.offset+(r===e.right?e.gap:-e.gap),n.addVariable(r),n.populateSplitBlock(r,t)})},t.prototype.traverse=function(t,e,n,r){var i=this;void 0===n&&(n=this.vars[0]),void 0===r&&(r=null),n.visitNeighbours(r,function(r,o){e.push(t(r)),i.traverse(t,e,o,n)})},t.prototype.findMinLM=function(){var t=null;return this.compute_lm(this.vars[0],null,function(e){!e.equality&&(null===t||e.lm<t.lm)&&(t=e)}),t},t.prototype.findMinLMBetween=function(t,e){this.compute_lm(t,null,function(){});var n=null;return this.findPath(t,null,e,function(t,e){!t.equality&&t.right===e&&(null===n||t.lm<n.lm)&&(n=t)}),n},t.prototype.findPath=function(t,e,n,r){var i=this,o=!1;return t.visitNeighbours(e,function(e,s){o||s!==n&&!i.findPath(s,t,n,r)||(o=!0,r(e,s))}),o},t.prototype.isActiveDirectedPathBetween=function(t,e){if(t===e)return!0;for(var n=t.cOut.length;n--;){var r=t.cOut[n];if(r.active&&this.isActiveDirectedPathBetween(r.right,e))return!0}return!1},t.split=function(e){return e.active=!1,[t.createSplitBlock(e.left),t.createSplitBlock(e.right)]},t.createSplitBlock=function(e){var n=new t(e);return n.populateSplitBlock(e,null),n},t.prototype.splitBetween=function(e,n){var r=this.findMinLMBetween(e,n);if(null!==r){var i=t.split(r);return{constraint:r,lb:i[0],rb:i[1]}}return null},t.prototype.mergeAcross=function(t,e,n){e.active=!0;for(var r=0,i=t.vars.length;i>r;++r){var o=t.vars[r];o.offset+=n,this.addVariable(o)}this.posn=this.ps.getPosn()},t.prototype.cost=function(){for(var t=0,e=this.vars.length;e--;){var n=this.vars[e],r=n.position()-n.desiredPosition;t+=r*r*n.weight}return t},t}();n.Block=s;var u=function(){function t(t){this.vs=t;var e=t.length;for(this.list=new Array(e);e--;){var n=new s(t[e]);this.list[e]=n,n.blockInd=e}}return t.prototype.cost=function(){for(var t=0,e=this.list.length;e--;)t+=this.list[e].cost();return t},t.prototype.insert=function(t){t.blockInd=this.list.length,this.list.push(t)},t.prototype.remove=function(t){var e=this.list.length-1,n=this.list[e];this.list.length=e,t!==n&&(this.list[t.blockInd]=n,n.blockInd=t.blockInd)},t.prototype.merge=function(t){var e=t.left.block,n=t.right.block,r=t.right.offset-t.left.offset-t.gap;e.vars.length<n.vars.length?(n.mergeAcross(e,t,r),this.remove(e)):(e.mergeAcross(n,t,-r),this.remove(n))},t.prototype.forEach=function(t){this.list.forEach(t)},t.prototype.updateBlockPositions=function(){this.list.forEach(function(t){return t.updateWeightedPosition()})},t.prototype.split=function(t){var e=this;this.updateBlockPositions(),this.list.forEach(function(n){var r=n.findMinLM();null!==r&&r.lm<a.LAGRANGIAN_TOLERANCE&&(n=r.left.block,s.split(r).forEach(function(t){return e.insert(t)}),e.remove(n),t.push(r))})},t}();n.Blocks=u;var a=function(){function t(t,e){this.vs=t,this.cs=e,this.vs=t,t.forEach(function(t){t.cIn=[],t.cOut=[]}),this.cs=e,e.forEach(function(t){t.left.cOut.push(t),t.right.cIn.push(t)}),this.inactive=e.map(function(t){return t.active=!1,t}),this.bs=null}return t.prototype.cost=function(){return this.bs.cost()},t.prototype.setStartingPositions=function(t){this.inactive=this.cs.map(function(t){return t.active=!1,t}),this.bs=new u(this.vs),this.bs.forEach(function(e,n){return e.posn=t[n]})},t.prototype.setDesiredPositions=function(t){this.vs.forEach(function(e,n){return e.desiredPosition=t[n]})},t.prototype.mostViolated=function(){for(var e=Number.MAX_VALUE,n=null,r=this.inactive,i=r.length,o=i,s=0;i>s;++s){var u=r[s];if(!u.unsatisfiable){var a=u.slack();if((u.equality||e>a)&&(e=a,n=u,o=s,u.equality))break}}return o!==i&&(e<t.ZERO_UPPERBOUND&&!n.active||n.equality)&&(r[o]=r[i-1],r.length=i-1),n},t.prototype.satisfy=function(){null==this.bs&&(this.bs=new u(this.vs)),this.bs.split(this.inactive);for(var e=null;(e=this.mostViolated())&&(e.equality||e.slack()<t.ZERO_UPPERBOUND&&!e.active);){var n=e.left.block,r=e.right.block;if(n!==r)this.bs.merge(e);else{if(n.isActiveDirectedPathBetween(e.right,e.left)){e.unsatisfiable=!0;continue}var i=n.splitBetween(e.left,e.right);if(null===i){e.unsatisfiable=!0;continue}this.bs.insert(i.lb),this.bs.insert(i.rb),this.bs.remove(n),this.inactive.push(i.constraint),e.slack()>=0?this.inactive.push(e):this.bs.merge(e)}}},t.prototype.solve=function(){this.satisfy();for(var t=Number.MAX_VALUE,e=this.bs.cost();Math.abs(t-e)>1e-4;)this.satisfy(),t=e,e=this.bs.cost();return e},t.LAGRANGIAN_TOLERANCE=-1e-4,t.ZERO_UPPERBOUND=-1e-10,t}();n.Solver=a,t.exports=n},function(t,e,n){"use strict";function r(t){this.options=c.extend({layerGap:60,nodeHeight:10,direction:"down"},t)}function i(t){return"L "+t.join(" ")}function o(t){return"M "+t.join(" ")}function s(t,e,n){return"C "+t.join(" ")+" "+e.join(" ")+" "+n.join(" ")}function u(t,e){var n=(t[1]+e[1])/2;return s([t[0],n],[e[0],n],e)}function a(t,e){var n=(t[0]+e[0])/2;return s([n,t[1]],[n,e[1]],e)}var c=n(4);r.prototype.getWaypoints=function(t){var e=this.options,n=e.direction,r=t.getPathFromRoot(),i=e.nodeHeight+e.layerGap;return"left"===n?[[[0,r[0].idealPos]]].concat(r.map(function(t,n){var r=i*(n+1)*-1;return[[r+e.nodeHeight,t.currentPos],[r,t.currentPos]]})):"right"===n?[[[0,r[0].idealPos]]].concat(r.map(function(t,n){var r=i*(n+1);return[[r-e.nodeHeight,t.currentPos],[r,t.currentPos]]})):"up"===n?[[[r[0].idealPos,0]]].concat(r.map(function(t,n){var r=i*(n+1)*-1;return[[t.currentPos,r+e.nodeHeight],[t.currentPos,r]]})):[[[r[0].idealPos,0]]].concat(r.map(function(t,n){var r=i*(n+1);return[[t.currentPos,r-e.nodeHeight],[t.currentPos,r]]}))},r.prototype.layout=function(t){var e=this.options,n=e.layerGap+e.nodeHeight;switch(e.direction){case"left":t.forEach(function(t){var r=t.getLayerIndex()*n+e.layerGap;t.x=-r-e.nodeHeight,t.y=t.currentPos,t.dx=e.nodeHeight,t.dy=t.width});break;case"right":t.forEach(function(t){var r=t.getLayerIndex()*n+e.layerGap;t.x=r,t.y=t.currentPos,t.dx=e.nodeHeight,t.dy=t.width});break;case"up":t.forEach(function(t){var r=t.getLayerIndex()*n+e.layerGap;t.x=t.currentPos,t.y=-r-e.nodeHeight,t.dx=t.width,t.dy=e.nodeHeight});break;default:case"down":t.forEach(function(t){var r=t.getLayerIndex()*n+e.layerGap;t.x=t.currentPos,t.y=r,t.dx=t.width,t.dy=e.nodeHeight})}return t},r.prototype.generatePath=function(t){var e=this.options,n=e.direction,r=this.getWaypoints(t,n),s=[o(r[0][0])];return"left"===n||"right"===n?r.reduce(function(t,e,n){return s.push(a(t[t.length-1],e[0])),n<r.length-1&&s.push(i(e[1])),e}):r.reduce(function(t,e,n){return s.push(u(t[t.length-1],e[0])),n<r.length-1&&s.push(i(e[1])),e}),s.join(" ")},t.exports=r},function(t,e,n){"use strict";function r(t){return 0===t.length||Array.isArray(t[0])?t:[t]}var i=n(4),o={};o.displacement=function(t){if(0===t.length)return 0;var e=r(t);return i.sum(e,function(t){return i.sum(t,function(t){return Math.abs(t.displacement())})})},o.pathLength=function(t){if(0===t.length)return 0;var e=r(t);return i.sum(e,function(t){return i.sum(t,function(t){return t.isStub()?0:Math.abs(t.getPathToRootLength())})})},o.overflowSpace=function(t,e,n){if(0===t.length||!i.isDefined(e)&&!i.isDefined(n))return 0;var o=r(t);return i.sum(o,function(t){return i.sum(t,function(t){var r=t.currentLeft(),o=t.currentRight();if(i.isDefined(e)){if(e>=o)return t.width;if(e>r)return e-r}if(i.isDefined(n)){if(r>=n)return t.width;if(o>n)return o-n}return 0})})},o.overDensitySpace=function(t,e,n,o){if(0===t.length||!i.isDefined(e)||!i.isDefined(n))return 0;o=o||0;var s=e*n,u=r(t);return i.sum(u,function(t){var e=i.sum(t,function(t){return t.width+o})-o;return s>=e?0:e-s})},o.overlapCount=function(t,e){if(0===t.length)return 0;var n=r(t);return i.sum(n,function(t){for(var n=0,r=0;r<t.length;r++)for(var i=r+1;i<t.length;i++)t[r].overlapWithNode(t[i],e)&&n++;return n})},o.overlapSpace=function(t){if(0===t.length)return 0;var e=r(t);return i.sum(e,function(t){for(var e=0,n=0;n<t.length;n++)for(var r=n+1;r<t.length;r++){var i=t[n].distanceFrom(t[r]);e+=0>i?Math.abs(i):0}return e})},o.weightedAllocatedSpace=function(t){if(0===t.length)return 0;var e=r(t);return i.sum(e,function(t,e){return e*i.sum(t,function(t){return t.width})})},t.exports=o},function(t,e,n){"use strict";var r=n(1),i=n(4);t.exports={generateNodes:function(t,e){var n=[];e=i.extend({},{minWidth:20,maxWidth:20,minPos:0,maxPos:800},e);for(var o=e.maxPos-e.minPos,s=e.maxWidth-e.minWidth,u=0;t>u;u++)n.push(new r(Math.floor(Math.random()*o)+e.minPos,Math.floor(Math.random()*s)+e.minWidth));return n}}}])});

Callers 2

uFunction · 0.85

Calls 2

rFunction · 0.85
isStubMethod · 0.80

Tested by

no test coverage detected