Skip to content

Instantly share code, notes, and snippets.

@rpgove
Last active April 15, 2024 10:12
Show Gist options
  • Save rpgove/0060ff3b656618e9136b to your computer and use it in GitHub Desktop.
Save rpgove/0060ff3b656618e9136b to your computer and use it in GitHub Desktop.
Using the elbow method to determine the optimal number of clusters for k-means clustering

K-means is a simple unsupervised machine learning algorithm that groups a dataset into a user-specified number (k) of clusters. The algorithm is somewhat naive--it clusters the data into k clusters, even if k is not the right number of clusters to use. Therefore, when using k-means clustering, users need some way to determine whether they are using the right number of clusters.

One method to validate the number of clusters is the elbow method. The idea of the elbow method is to run k-means clustering on the dataset for a range of values of k (say, k from 1 to 10 in the examples above), and for each value of k calculate the sum of squared errors (SSE). Like this:

var sse = {};
for (var k = 1; k <= maxK; ++k) {
    sse[k] = 0;
    clusters = kmeans(dataset, k);
    clusters.forEach(function(cluster) {
        mean = clusterMean(cluster);
        cluster.forEach(function(datapoint) {
            sse[k] += Math.pow(datapoint - mean, 2);
        });
    });
}

Then, plot a line chart of the SSE for each value of k. If the line chart looks like an arm, then the "elbow" on the arm is the value of k that is the best. The idea is that we want a small SSE, but that the SSE tends to decrease toward 0 as we increase k (the SSE is 0 when k is equal to the number of data points in the dataset, because then each data point is its own cluster, and there is no error between it and the center of its cluster). So our goal is to choose a small value of k that still has a low SSE, and the elbow usually represents where we start to have diminishing returns by increasing k.

Note Dataset A on the left. At the top we see a number line plotting each point in the dataset, and below we see an elbow chart showing the SSE after running k-means clustering for k going from 1 to 10. We see a pretty clear elbow at k = 3, indicating that 3 is the best number of clusters.

However, the elbow method doesn't always work well; especially if the data is not very clustered. Notice how the elbow chart for Dataset B does not have a clear elbow. Instead, we see a fairly smooth curve, and it's unclear what is the best value of k to choose. In cases like this, we might try a different method for determining the optimal k, such as computing silhouette scores, or we might reevaluate whether clustering is the right thing to do on our data.

This has practical applications for other methods too, such as determining the best number of classes to use in the Jenks natural breaks algorithm for building color scales in choropleth maps.

You can paste in your own comma-separated list of numbers in the input fields above and click "Parse datasets" to see your numbers plotted and their corresponding elbow charts.

<!DOCTYPE html>
<meta charset="utf-8">
<style>
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
overflow: hidden;
font-size: 12px;
font-family: Arial, sans-serif;
}
#maindiv {
width: 960px;
height: 380px;
}
.dataset-a, .dataset-b {
display: inline-block;
width: 400px;
padding: 0 0 0 50px;
}
#button {
margin: 20px 50px;
}
#error {
margin: 20px 50px;
font-size: 20px;
color: red;
}
</style>
<body>
<script src="moebio_framework.min.js"></script>
<script>
var uniform = [0.2334, 0.4229, 0.2938, 0.9500, 0.3745, 0.3985, 0.3158, 0.4228, 0.2844, 0.3871, 0.5104, 0.3336, 0.2984, 0.2859, 0.4372, 0.8939, 0.4119, 0.5078, 0.9713, 0.3784, 0.3209, 0.3385, 0.5550, 0.5868, 0.3276, 0.8119, 0.7752, 0.9800, 0.5759, 0.3898, 0.4301, 0.3909, 0.4792, 0.4215, 0.6487, 0.0861, 0.1373, 0.1443, 0.2952, 0.2803, 0.1996, 0.1195, 0.1100, 0.0133, 0.2272, 0.2399, 0.1183, 0.1424, 0.1873, 0.1649, 0.8907, 0.9081, 0.8240, 0.8495, 0.9040, 0.7813, 0.6995, 0.8918, 0.8165, 0.9883];
var clustered = [0.5249, 0.6735, 0.5593, 0.4187, 0.6349, 0.4788, 0.4559, 0.4861, 0.5759, 0.4410, 0.5357, 0.4725, 0.6527, 0.4988, 0.3397, 0.4526, 0.4674, 0.6161, 0.5081, 0.5519, 0.5172, 0.5021, 0.4984, 0.5105, 0.8681, 0.7942, 0.8389, 0.8748, 0.8194, 0.9015, 0.8505, 0.7642, 0.9134, 0.8259, 0.8268, 0.7230, 0.8689, 0.8446, 0.7744, 0.8332, 0.8390, 0.8287, 0.1935, 0.2151, 0.0994, 0.1380, 0.1832, 0.1630, 0.1317, 0.1394, 0.2956, 0.2004, 0.1353, 0.2359, 0.1413, 0.1669, 0.1399, 0.1719, 0.1799, 0.1672];
var elbowData = {};
var maxK = 10;
var newData = false;
var g;
function computeData() {
// Reset elbowData
elbowData = {};
uniformNL = mo.NumberList.fromArray(uniform);
clusteredNL = mo.NumberList.fromArray(clustered);
// Compute k-means clusters for k from 1 to 10, and populate the elbowData
// for each dataset and each value of k
for (var k = 1; k <= maxK; ++k) {
uniformKMeans = mo.NumberListOperators.linearKMeans(uniformNL, k);
clusteredKMeans = mo.NumberListOperators.linearKMeans(clusteredNL, k);
function SSE(datasetName, numClusters) {
return function(dataset) {
// Sum up the sum of squared errors for each cluster
sse = 0;
for (var c = 0; c < dataset.length; ++c) {
mean = dataset[c].getAverage();
sse += dataset[c].subtract(mean).pow(2).getNorm();
}
elbowData[datasetName] = elbowData[datasetName] || [];
elbowData[datasetName].push([numClusters, sse]);
}
}
// Compute sum of squared errors for each cluster
SSE('uniform', k)(uniformKMeans);
SSE('clustered', k)(clusteredKMeans);
}
}
function drawNumberLine(g, dataset, label, offset) {
var lineLen = 350;
var tickLen = 5;
var x = 50 + (offset || 0);
var y = 80;
var radius = 5;
var min = 0;
var max = 1;
if (newData) {
min = mo.NumberList.fromArray(dataset).getMin();
max = mo.NumberList.fromArray(dataset).getMax();
}
var range = max - min;
g.setStroke('#777');
g.setFill('rgba(125,125,125,0.5)');
// x-axis
g.line(x, y, x + lineLen, y);
// Ticks
g.line(x, y, x, y + tickLen);
g.line(x + lineLen / 2, y, x + lineLen / 2, y + tickLen);
g.line(x + lineLen, y, x + lineLen, y + tickLen);
// Draw each data point
dataset.forEach(function(d) {
g.fCircle(x + ((d - min) / range) * lineLen, y - 1.5 * radius, radius);
})
// Labels
g.setText('#555', 12, 'Arial', "center");
g.fText(min.toFixed(2), x, y + tickLen);
g.fText(((min + max) / 2).toFixed(2), x + lineLen / 2, y + tickLen);
g.fText(max.toFixed(2), x + lineLen, y + tickLen);
g.setText('#555', 16, 'Arial', 'center', 'bottom', 'bold');
g.fText(label, x + lineLen / 2, y - 4 * radius);
}
function drawElbowChart(g, datasetName, offset) {
var xLineLen = 350;
var yLineLen = 200;
var tickLen = 5;
var x = 50 + (offset || 0);
var y = 130;
var elbow = elbowData[datasetName];
var sseMax = elbow.map(function(pair) { return pair[1] });
sseMax = mo.NumberList.fromArray(sseMax).getMax();
g.setStroke("#777");
// Draw axes
g.line(x, y + yLineLen, x + xLineLen, y + yLineLen);
g.line(x, y + yLineLen, x, y)
// x-axis ticks and labels
for (var i = 1; i <= maxK; ++i) {
var xTick = Math.floor((i / maxK) * xLineLen);
g.line(x + xTick, y + yLineLen, x + xTick, y + yLineLen + tickLen);
g.setText('#555', 12, 'Arial', "center");
g.fText(i, x + xTick, y + yLineLen + tickLen);
}
// Axis title
g.fText("Number of clusters (k)", x + xLineLen / 2, y + yLineLen + tickLen + 12);
g.fTextRotated("Sum of squared errors", x - 16, y + yLineLen / 2, -Math.PI / 2);
g.setStroke("#333");
// Draw sum of square errors
for (var i = 1; i < elbow.length; ++i) {
var a = elbow[i - 1];
var b = elbow[i];
var xA = (a[0] / maxK) * xLineLen + x;
var yA = (1 - a[1] / sseMax) * yLineLen + y;
var xB = (b[0] / maxK) * xLineLen + x;
var yB = (1 - b[1] / sseMax) * yLineLen + y;
g.line(xA, yA, xB, yB);
}
}
function setup() {
g = new mo.Graphics({
container: "#maindiv",
dimensions: {
width: 960,
height: 380
},
init: computeData,
cycle: function() {
this.setText('#555', 18, 'Arial', 'center', 'bottom', 'bold');
this.fText("K-means clustering SSE vs. number of clusters for two random datasets", 450, 20);
this.setStroke("#aaa");
this.line(150, 25, 750, 25);
drawNumberLine(this, clustered, "Dataset A");
drawNumberLine(this, uniform, "Dataset B", 450);
drawElbowChart(this, 'clustered');
drawElbowChart(this, 'uniform', 450);
}
});
g.setBackgroundColor('white');
}
function inputChange() {
function parseInput(id) {
input = document.getElementById("input-" + id);
value = input.value;
dataset = value.split(",").map(function(d) {
val = Number(d);
if (isNaN(val) || !isFinite(val) || d.trim().length === 0) {
throw "Error parsing Dataset " + id.toUpperCase();
}
return val;
});
if (id == "a") {
clustered = dataset;
} else {
uniform = dataset;
}
}
try {
var id = "a";
parseInput(id);
id = "b";
parseInput(id);
computeData();
newData = true;
var errorDiv = document.getElementById('error');
error.innerHTML = "";
} catch (e) {
var errorDiv = document.getElementById('error');
error.innerHTML = e;
}
}
window.onload = function() {
var inputA = document.getElementById('input-a');
var inputB = document.getElementById('input-b');
inputA.value = clustered.join(", ");
inputB.value = uniform.join(", ");
setup();
}
</script>
<div id="maindiv"></div>
<div class="dataset-a">
Dataset A: <input type="text" id="input-a" size="45">
</div>
<div class="dataset-b">
Dataset B: <input type="text" id="input-b" size="45">
</div>
<div id="button">
<button type="button" onclick="inputChange()">Parse datasets</button>
</div>
<div id="error"></div>
!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define("mo",["exports"],b):b(a.mo={})}(this,function(exports){"use strict";function DataModel(){Object.apply(this),this.type="DataModel"}function LoadEvent(){Object.apply(this),this.result=null,this.errorType=0,this.errorMessage="",this.url=""}function Loader(){}function Node(a,b){this.id=null==a?"":a,this.name=null!=b?b:"",this.type="Node",this.nodeType=null,this.x=0,this.y=0,this.z=0,this.nodeList=new NodeList,this.relationList=new RelationList,this.toNodeList=new NodeList,this.toRelationList=new RelationList,this.fromNodeList=new NodeList,this.fromRelationList=new RelationList,this.weight=1,this.descentWeight=1,this.level=0,this.parent=null,this.vx=0,this.vy=0,this.vz=0,this.ax=0,this.ay=0,this.az=0}function ColorOperators(){}function List(){DataModel.apply(this);var a,b=[],c=arguments.length;for(a=0;c>a;a++)b.push(arguments[a]);return b=List.fromArray(b)}function ColorList(){var a,b=[],c=arguments.length;for(a=0;c>a;a++)b[a]=arguments[a];var d=List.apply(this,b);return d=ColorList.fromArray(d)}function _Point(a,b){DataModel.apply(this,arguments),this.type="Point",this.x=Number(a)||0,this.y=Number(b)||0}function Interval(a,b){DataModel.apply(this,arguments),this.x=Number(a),this.y=Number(b),this.type="Interval"}function NumberList(){for(var a=[],b=arguments.length,c=0;b>c;c++)a[c]=Number(arguments[c]);var d=List.apply(this,a);return d=NumberList.fromArray(d)}function DateList(){for(var a=[],b=0;b<arguments.length;b++)a[b]=Number(arguments[b]);var c=List.apply(this,a);return c=DateList.fromArray(c)}function Polygon3D(){var a=List.apply(this,arguments);return a=Polygon3D.fromArray(a)}function Rectangle(a,b,c,d){DataModel.apply(this),this.name="",this.type="Rectangle",this.x=Number(a)||0,this.y=Number(b)||0,this.width=Number(c)||0,this.height=Number(d)||0}function _Polygon(){var a=List.apply(this,arguments);return a=_Polygon.fromArray(a)}function Table(){var a,b=[],c=arguments.length;for(a=0;c>a;a++)b[a]=new List(arguments[a]);var d=List.apply(this,b);return d=Table.fromArray(d)}function NumberTable(){var a,b,c,d=[];if(arguments.length>0&&Number(arguments[0])==arguments[0])for(b=[],c=0;c<arguments[0];c++)b.push(new NumberList);else{for(c=0;null!=arguments[c];c++)a=NumberList.fromArray(arguments[c]),a.name=arguments[c].name,d[c]=a;b=Table.apply(this,d)}return b=NumberTable.fromArray(b)}function StringList(){for(var a=[],b=0;b<arguments.length;b++)a[b]=String(arguments[b]);var c=List.apply(this,a);return c=StringList.fromArray(c)}function MD5(){}function Relation(a,b,c,d,e,f){Node.call(this,a,b),this.type="Relation",this.node0=c,this.node1=d,this.weight=null==e?1:e,this.content=null==f?"":f}function NumberOperators(){}function NumberListGenerators(){}function ListConversions(){}function RectangleList(){var a=List.apply(this,arguments);return a=RectangleList.fromArray(a)}function ListGenerators(){}function NumberListOperators(){}function ColorScales(){}function ListOperators(){}function ColorListGenerators(){}function StringOperators(){}function Network(){this.type="Network",this.nodeList=new NodeList,this.relationList=new RelationList}function DateOperators(){}function NetworkEncodings(){}function _processProperty(a,b){switch(a){case"color":if("rgb"==b.substr(0,3)){var c=ColorOperators.colorStringToRGB(b);return c.join(",")}return b}return b=String(b).replace(/\n/g,"\\n")}function setStructureLocalStorage(a,b,c){var d,e=_typeOf(a);switch(e){case"string":d=a;break;case"Network":d=NetworkEncodings.encodeGDF(a);break;default:e="object",d=JSON.stringify(a)}var f={id:b,type:e,comments:c,date:new Date,code:d},g=JSON.stringify(f);localStorage.setItem(b,g)}function getStructureLocalStorageFromSeed(a,b){return getStructureLocalStorage(MD5.hex_md5(a),b)}function getStructureLocalStorage(a,b){b=b||!1;var c=localStorage.getItem(a);if(null==c)return null;var d;try{d=JSON.parse(c)}catch(e){return null}if(null==d.type&&null==d.code)return null;var f,g=d.type,h=d.code;switch(g){case"string":f=h;break;case"Network":f=NetworkEncodings.decodeGDF(h);break;case"object":f=JSON.parse(h)}return b?(d.object=f,d.size=d.code.length,d.date=new Date(d.date),d):f}function NodeList(){var a=NodeList.fromArray([]);if(arguments&&arguments.length>0){var b=Array.prototype.slice.call(arguments);b.forEach(function(b){a.addNode(b)})}return a}function RelationList(){var a=NodeList.apply(this,arguments);return a.name="",a=RelationList.fromArray(a)}function _typeOf(a){if(null==a)return null;var b=typeof a;return"object"!==b?b:null!=a.type?a.type:"[object Array]"==Object.prototype.toString.call(a)?"Array":null!=a.getDate?"date":"Object"}function instantiate(a,b){switch(a){case"number":case"string":return window[a](b);case"date":if(!b||0===b.length)return new Date;if(1==b.length){if(b[0].match(/\d*.-\d*.-\d*\D\d*.:\d*.:\d*/)){var c=b[0].split(" ");return c[0]=c[0].split("-"),c[1]?c[1]=c[1].split(":"):c[1]=new Array(0,0,0),new Date(Date.UTC(c[0][0],Number(c[0][1])-1,c[0][2],c[1][0],c[1][1],c[1][2]))}return"NaN"!=Number(b[0])?new Date(Number(b[0])):new Date(b[0])}return new Date(Date.UTC.apply(null,b));case"boolean":return window[a]("false"==b||"0"==b?!1:!0);case"List":case"Table":case"StringList":case"NumberList":case"NumberTable":case"NodeList":case"RelationList":case"Polygon":case"Polygon3D":case"PolygonList":case"DateList":case"ColorList":return typeDict[a].apply(new typeDict[a],b);case null:case void 0:case"undefined":return null}var d,e,f;return f=window[a],e=function(){},e.prototype=f.prototype,d=new e,f.apply(d,b),d}function _createDataModelsInfoDictionaries(){var a,b;for(_shortFromTypeDictionary={},_colorFromTypeDictionary={},_lightColorFromTypeDictionary={},a=0;null!=dataModelsInfo[a];a++)b=dataModelsInfo[a].type,_shortFromTypeDictionary[b]=dataModelsInfo[a]["short"],_colorFromTypeDictionary[b]=ColorOperators.interpolateColors(dataModelsInfo[a].color,"black",.2),_lightColorFromTypeDictionary[b]=ColorOperators.interpolateColors(dataModelsInfo[a].color,"white",.35),b=b.toLowerCase(),_shortFromTypeDictionary[b]=dataModelsInfo[a]["short"],_colorFromTypeDictionary[b]=ColorOperators.interpolateColors(dataModelsInfo[a].color,"black",.2),_lightColorFromTypeDictionary[b]=ColorOperators.interpolateColors(dataModelsInfo[a].color,"white",.35)}function getShortNameFromDataModelType(a){return null==_shortFromTypeDictionary&&_createDataModelsInfoDictionaries(),_shortFromTypeDictionary[a]}function getColorFromDataModelType(a){return null==_shortFromTypeDictionary&&_createDataModelsInfoDictionaries(),_colorFromTypeDictionary[a]}function getLightColorFromDataModelType(a){return null==_shortFromTypeDictionary&&_createDataModelsInfoDictionaries(),_lightColorFromTypeDictionary[a]}function getTextFromObject(a,b){if(null==a)return"Null";if(a.isList){if(0===a.length)return"[]";var c=a.toString();if(c.length>160){var d,e;for(c="[",d=0;null!=a[d]&&6>d;d++)e=getTextFromObject(a[d],_typeOf(a[d])),e.length>40&&(e=e.substr(0,40)+(a[d].isList?"…]":"…")),c+=(0!==d?", ":"")+e;a.length>6&&(c+=",…"),c+="]"}return c}switch(b){case"date":return DateOperators.dateToString(a);case"DateInterval":return DateOperators.dateToString(a.date0)+" - "+DateOperators.dateToString(a.date1);case"string":return(a.length>160?a.substr(0,159)+"…":a).replace(/\n/g,"↩");case"number":return String(a);default:return"{}"}}function instantiateWithSameType(a,b){return instantiate(_typeOf(a),b)}function isArray(a){return"object"!=typeof a?!1:-1==a.constructor.toString().indexOf("Array")?!1:!0}function evalJavaScriptFunction(functionText,args,scope){if(null!=functionText&&""!=functionText){for(var res,myFunction,good=!0,message="",error,realCode,lines=functionText.split("\n"),i=0;null!=lines[i];i++)lines[i]=lines[i].trim(),(""===lines[i]||"/"==lines[i].substr(1))&&(lines.splice(i,1),i--);var isFunction=-1!=lines[0].indexOf("function");functionText=lines.join("\n"),realCode=isFunction?scope?"scope.myFunction = "+functionText:"myFunction = "+functionText:scope?"scope.myVar = "+functionText:"myVar = "+functionText;try{isFunction?(eval(realCode),res=scope?scope.myFunction.apply(scope,args):myFunction.apply(this,args)):(eval(realCode),res=scope?scope.myVar:myVar)}catch(err){good=!1,message=err.message,res=null,error=err}var resultObject={result:res,success:good,errorMessage:message,error:error};return resultObject}}function argumentsToArray(a){return Array.prototype.slice.call(a,0)}function PolygonList(){var a=Table.apply(this,arguments);return a=PolygonList.fromArray(a)}function TableEncodings(){}function MatrixGenerators(){}function Matrix(a,b,c,d,e,f){DataModel.apply(this,arguments),this.name="",this.type="Matrix",this.a=null==a?1:a,this.b=null==b?0:b,this.c=null==c?0:c,this.d=null==d?1:d,this.tx=null==e?0:e,this.ty=null==f?0:f}function Axis2D(a,b){b=null==b?new Rectangle(0,0,1,1):b,DataModel.apply(this,arguments),this.departureFrame=a,this.arrivalFrame=b,this.pW=void 0,this.pH=void 0,this.setFrames(a,b),this.type="Axis2D"}function Axis(a,b){a=null==a?new Interval(0,1):a,b=null==b?new Interval(0,1):b,DataModel.apply(this,arguments),this.departureInterval=a,this.arrivalInterval=b,this.setDepartureInterval(a),this.setArrivalInterval(b),this.type="Axis"}function DateInterval(a,b){DataModel.apply(this,arguments),this.date0=a,this.date1=b,this.type="DateInterval"}function DateAxis(a,b){b=null==b?new Interval(0,1):b,DataModel.apply(this,arguments),this.departureDateInterval=a,this.arrivalInterval=b,this.time0=void 0,this.time1=void 0,this.dTime=void 0,this.arrivalAmplitude=void 0,this.setDepartureDateInterval(a),this.setArrivalInterval(b),this.type="DateAxis"}function Tree(){Network.apply(this),this.type="Tree",this.nLevels=0,this._createRelation=this.createRelation,this.createRelation=this._newCreateRelation}function PointOperators(){}function Point3D(a,b,c){_Point.apply(this,arguments),this.type="Point3D",this.z=c}function GeometryOperators(){}function Triangle(a,b,c){this.a=a,this.b=b,this.c=c;var d,e,f,g,h=b.x-a.x,i=b.y-a.y,j=c.x-a.x,k=c.y-a.y,l=h*(a.x+b.x)+i*(a.y+b.y),m=j*(a.x+c.x)+k*(a.y+c.y),n=2*(h*(c.y-b.y)-i*(c.x-b.x));Math.abs(n)<1e-6?(d=Math.min(a.x,b.x,c.x),e=Math.min(a.y,b.y,c.y),f=.5*(Math.max(a.x,b.x,c.x)-d),g=.5*(Math.max(a.y,b.y,c.y)-e),this.x=d+f,this.y=e+g,this.r=f*f+g*g):(this.x=(k*l-i*m)/n,this.y=(h*m-j*l)/n,f=this.x-a.x,g=this.y-a.y,this.r=f*f+g*g)}function byX(a,b){return b.x-a.x}function dedup(a){var b,c,d,e,f,g=a.length;a:for(;g;)for(c=a[--g],b=a[--g],d=g;d;)if(f=a[--d],e=a[--d],b===e&&c===f||b===f&&c===e){a.splice(g,2),a.splice(d,2),g-=2;continue a}}function _triangulate(a){if(a.length<3)return[];a.sort(byX);for(var b=a.length-1,c=a[b].x,d=a[0].x,e=a[b].y,f=e;b--;)a[b].y<e&&(e=a[b].y),a[b].y>f&&(f=a[b].y);var g,h,i,j=d-c,k=f-e,l=j>k?j:k,m=.5*(d+c),n=.5*(f+e),o=[new Triangle({x:m-20*l,y:n-l,__sentinel:!0},{x:m,y:n+20*l,__sentinel:!0},{x:m+20*l,y:n-l,__sentinel:!0})],p=[],q=[];for(b=a.length;b--;){for(q.length=0,g=o.length;g--;)j=a[b].x-o[g].x,j>0&&j*j>o[g].r?(p.push(o[g]),o.splice(g,1)):(k=a[b].y-o[g].y,j*j+k*k>o[g].r||(q.push(o[g].a,o[g].b,o[g].b,o[g].c,o[g].c,o[g].a),o.splice(g,1)));for(dedup(q),g=q.length;g;)i=q[--g],h=q[--g],o.push(new Triangle(h,i,a[b]))}for(Array.prototype.push.apply(p,o),b=p.length;b--;)(p[b].a.__sentinel||p[b].b.__sentinel||p[b].c.__sentinel)&&p.splice(b,1);return p}function PolygonOperators(){}function CountryList(){var a=NodeList.apply(this,arguments);return a.name="",a=CountryList.fromArray(a)}function CountryOperators(){}function Country(a,b){Node.apply(this,[a,b]),this.type="Country",this.id=a,this.name=b,this.shortName=void 0,this.continentName=void 0,this.isoCode=void 0,this.alternativeNames=void 0,this.wikipediaUrl=void 0,this.flagImageUrl=void 0,this.smallFlagImageUrl=void 0,this.recognized=!1,this.geoCenter=void 0,this.polygonList=void 0,this.simplePolygonList=void 0,this.longestPolygon=void 0,this.longestSimplePolygon=void 0,this._simplifiedNames=void 0,this._simplifiedId=void 0,this._simplifiedName=void 0,this._frame=void 0}function Polygon3DList(){var a=List.apply(this,arguments);return a=Polygon3DList.fromArray(a)}function ColorScale(a){DataModel.apply(this,arguments),this.name="",this.type="ColorScale",this.colorScaleFunction=a?a:ColorScales.blackScale}function Space2D(a,b){a=null==a?{}:a,this.graphics=b,this.center=null==a.center?new _Point(0,0):a.center,this.scale=1,a.interactionActive&&this.activeInteraction(),this.MIN_SCALE=null==a.minScale?.05:a.minScale,this.MAX_SCALE=null==a.maxScale?20:a.maxScale,this.active=a.interactionActive}function DateListConversions(){}function DateListOperators(){}function GeoOperators(){}function CountryListOperators(){}function RectangleOperators(){}function PolygonListOperators(){}function PolygonListEncodings(){}function PolygonGenerators(){}function GeometryConversions(){}function ColorScaleGenerators(){}function ColorListOperators(){}function ColorGenerators(){}function TableOperators(){}function TableGenerators(){}function TableConversions(){}function NumberTableOperators(){}function NumberTableFlowOperators(){}function NumberTableConversions(){}function IntervalListOperators(){}function IntervalTableOperators(){}function NumberListConversions(){}function NetworkConversions(){}function StringListConversions(){}function ObjectConversions(){}function ObjectOperators(){}function StringListOperators(){}function StringConversions(){}function TreeEncodings(){}function TreeConversions(){}function NetworkOperators(){}function NetworkGenerators(){}function DrawTextsAdvanced(){}function DrawTexts(){}function DrawSimpleVis(){}function Draw(){}function Graphics(a){this.container=a.container,"string"==typeof this.container&&(this.container=document.querySelector(this.container)),this.dimensions=a.dimensions,this.init=a.init||noOperation,this.cycle=a.cycle||noOperation,this.onResize=a.onResize||noOperation,this._cycleInterval=void 0===a.cycleInterval?30:a.cycleInterval,a.noLoop&&(this._cycleInterval=0),this._initialize(!a.noStart)}function noOperation(){}function resizeThrottler(a,b){var c;return function(d){c||(c=setTimeout(function(){c=null,a(d)},b))}}function ifDef(a,b){return void 0!==a&&null!==a?a:b}function FastHtml(){}function TextFieldHTML(a){a=null==a?{}:a,this.x=null==a.x?300:a.x,this.y=null==a.y?2:a.y,this.width=null==a.width?200:a.width,this.textColor=null==a.textColor?"black":a.textColor,this.backgroundColor=a.backgroundColor,this.linkFunction=a.linkFunction,this.target=a.target,this.fastHTMLactive=null==a.fastHTMLactive?!0:a.fastHTMLactive,this.text=void 0,this._prevX=void 0,this._prevY=void 0,this._prevWidth=void 0,this._prevHeight=void 0,this.zIndex=33,this.main=document.getElementById("maindiv"),this.div=document.createElement("div2"),this.div.setAttribute("style","position:absolute;top:"+this.y+"px;left:"+this.x+"px;z-index:"+this.zIndex+";"),this.main.appendChild(this.div),this.setText(null==a.text?"":a.text),this.draw(),null!=this.target&&null!=this.linkFunction&&(FastHtml.target=this.target,FastHtml.linkFunction=this.linkFunction)}function TextBox(a,b){a=null==a?{}:a,this.graphics=b,this.x=null==a.x?300:a.x,this.y=null==a.y?2:a.y,this.width=null==a.width?200:a.width,this.text=null==a.text?"":a.text,this.fontColor=null==a.fontColor?"black":a.fontColor,this.fontSize=null==a.fontSize?"14":a.fontSize,this.fontName=null==a.fontName?"arial":a.fontName,this.warnFunction=a.warnFunction,this.target=a.target,this.lineHeight=null==a.lineHeight?14:a.lineHeight,this.backgroundColor=a.backgroundColor,this.boxMargin=null==a.boxMargin?5:a.boxMargin,this.lineWidth=null==a.lineWidth?1:a.lineWidth,this.maxWidth=void 0,this.links=void 0,this.linksType=void 0,this.pointPairs=void 0,this.overLink=void 0,this.setText(this.text),this.graphics.on("mouseup",this.mouseUp,this)}function InputTextFieldHTML(a,b){this.id=null==a.id?0:a.id,this.graphics=b,this.target=a.target,this.x=null==a.x?0:a.x,this.y=null==a.y?0:a.y,this.width=null==a.width?200:a.width,this.height=null==a.height?20:a.height,this.fontSize=null==a.fontSize?16:a.fontSize,this.enterFunction=a.enterFunction,this.changeFunction=a.changeFunction,this.focusFunction=a.focusFunction,this.blurFunction=a.blurFunction,this.text=a.text,this.textarea=null==a.textarea?!0:a.textarea,this.readOnly=null==a.readOnly?!1:a.readOnly,this.border=null==a.border?!0:a.border,this.password=a.password,this.zIndex=30,this.textColor=null==a.textColor?"black":a.textColor,this.backgroundColor="#FFFFFF",this.main=b.container,this.div=document.createElement("div2"),this.textarea?this.DOMtext=document.createElement("textarea"):this.DOMtext=document.createElement("input"),this.password?this.DOMtext.setAttribute("type","password"):this.DOMtext.setAttribute("type","text"),this.div.setAttribute("style","position:absolute;top:"+this.y+"px;left:"+this.x+"px;z-index:"+this.zIndex+";"),this.border||this.DOMtext.setAttribute("style","border:none"),this.div.setAttribute("rows","1"),this.main.appendChild(this.div),this.div.appendChild(this.DOMtext),this.DOMtext.parent=this,this.added=!0,this.DOMtext.readOnly=this.readOnly,this.DOMtext.onfocus=function(){this.parent._onFocus(this.parent)},this.DOMtext.onblur=function(){this.parent._onBlur(this.parent)},this.DOMtext.value="",this.div.addEventListener("keydown",this.onKeyDown,this),this.focus=!1,null!=this.changeFunction&&this.setChangeFunction(this.changeFunction,this.target),null!=this.enterFunction&&this.setEnterFunction(this.enterFunction,this.target),null!=this.focusFunction&&this.setFocusFunction(this.focusFunction,this.target),null!=this.blurFunction&&this.setBlurFunction(this.blurFunction,this.target),null!=this.text?this.setText(this.text):this.draw()}function DragDetection(a,b){this.mode=a.mode||0,this.listenerFunction=a.listenerFunction,this.target=a.target,this.areaVerificationFunction=a.areaVerificationFunction,this.graphics=b,this.factor=null==a.factor?1:a.factor,this.center=new _Point(0,0),this.graphics.on("mousedown",this.onMouse,this),this.graphics.on("mouseup",this.onMouse,this),this.dragging=!1,this.mouseClickPosition=new _Point,this.mousePosition=new _Point,this.r=0,this.a=0,this.idInterval=null,this.dragVector=new _Point}function MultiLoader(){this.urlList=null,this.onComplete=null,this.iLoaded=0,this.target=null,this.loading=!1,this.indexLoading=void 0,this.datasLoaded=null,this.imagesLoaded=null,this.priorityWeights=void 0,this.associativeArray=[],this.url_to_image={},this.simulateDelay=!1,this.DELAY_MILLISECONDS=1e3,this.timer=void 0}function Navigator(){}function detectUserAgent(){if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){if(userAgent="IE",userAgentVersion=Number(RegExp.$1),9>userAgentVersion)return null}else/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)?(userAgent="FIREFOX",userAgentVersion=Number(RegExp.$1)):null!=navigator.userAgent.match(/Chrome/)?(userAgent="CHROME",userAgentVersion=Number(RegExp.$1)):/Mozilla[\/\s](\d+\.\d+)/.test(navigator.userAgent)||null!=navigator.userAgent.match(/Mozilla/)?(userAgent="MOZILLA",userAgentVersion=Number(RegExp.$1)):null!=navigator.userAgent.match(/Safari/)?(userAgent="Safari",userAgentVersion=Number(RegExp.$1)):null!=navigator.userAgent.match(/iPad/i)?userAgent="IOS":null!=navigator.userAgent.match(/iPhone/i)&&(userAgent="IOS")}function StringUtils(){}function JSONUtils(){}function ConsoleTools(){}function Forces(a){this.k=a.k?a.k:.01,this.dEqSprings=a.dEqSprings?a.dEqSprings:100,this.dEqRepulsors=a.dEqRepulsors?a.dEqRepulsors:500,this.friction=a.friction?a.friction:.8,this.nodeList=new NodeList,this.forcesList=new List,this.equilibriumDistances=new NumberList,this.forcesTypeList=new List,this.fromNodeList=new NodeList,this.toNodeList=new NodeList,this._i0=0}function Engine3D(a){a=null==a?{}:a,this.lens=null==a.lens?300:a.lens,this._freeRotation=!1,this.setBasis(new Polygon3D(new Point3D(1,0,0),new Point3D(0,1,0),new Point3D(0,0,1))),this._cuttingPlane=10,null!=a.angles&&this.setAngles(a.angles)}function CountryListDraw(){}function CircleDraw(){}function ColorsDraw(){}function ListDraw(){}function NumberListDraw(){}function IntervalTableDraw(){}function NumberTableDraw(){}function StringDraw(){}function ObjectDraw(){}function StringListVisOperators(){}function StringListDraw(){}function TreeDraw(){}function NetworkDraw(){}DataModel.prototype={},DataModel.prototype.constructor=DataModel,DataModel.prototype.destroy=function(){delete this.type,delete this.name},DataModel.prototype.setType=function(a){this.type=a},DataModel.prototype.getType=function(){return this.type},DataModel.prototype.toString=function(){},LoadEvent.prototype={},LoadEvent.prototype.constructor=LoadEvent,Loader.proxy="",Loader.cacheActive=!1,Loader.associativeByUrls={},Loader.REPORT_LOADING=!1,Loader.n_loading=0,Loader.LOCAL_STORAGE_ENABLED=!1,Loader.PHPurl="http://intuitionanalytics.com/tests/proxy.php?url=",Loader.loadData=function(a,b,c,d,e,f){if(Loader.REPORT_LOADING&&console.log("[L] load data:",a),Loader.n_loading++,Loader.LOCAL_STORAGE_ENABLED){var g=localStorage.getItem(a);if(g){var h=new LoadEvent;h.url=a,h.param=d,h.result=g,b.call(k,h)}}Loader.REPORT_LOADING&&console.log("Loader.loadData | url:",a);var i="http"==String(a).substr(0,4),j=new XMLHttpRequest,k=c?c:arguments.callee,l=function(){if(Loader.REPORT_LOADING&&console.log("[L] Loader.loadData | onLoadComplete, req.readyState, req.status:",j.readyState,j.status),4==j.readyState){Loader.n_loading--;var c=new LoadEvent;c.url=a,c.param=d,200==j.status||0===j.status&&null!==j.responseText?(c.result=j.responseText,Loader.REPORT_LOADING&&console.log("[L] ---> onLoadData.call(target, e)"),b.call(k,c)):(Loader.REPORT_LOADING&&console.log("[L] [!] There was a problem retrieving the data ["+j.status+"]:\n"+j.statusText),c.errorType=j.status,c.errorMessage="[!] There was a problem retrieving the data ["+j.status+"]:"+j.statusText,b.call(k,c))}};if(window.XMLHttpRequest&&!window.ActiveXObject)try{j=new XMLHttpRequest}catch(m){j=!1}else if(window.ActiveXObject)try{j=new window.ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(n){try{j=new window.ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(o){try{j=new window.ActiveXObject("Msxml2.XMLHTTP")}catch(p){try{j=new window.ActiveXObject("Microsoft.XMLHTTP")}catch(q){j=!1}}}}j&&(f===!0&&(j.withCredentials=!0),j.onreadystatechange=l,i?j.open("GET",Loader.proxy+a,!0):j.open("GET",a,!0),e=e||"",j.send(e))},Loader.loadImage=function(a,b,c,d){Loader.n_loading++,Loader.REPORT_LOADING&&console.log("Loader.loadImage | url:",a);var e=c?c:arguments.callee,f=document.createElement("img");if(this.cacheActive)if(null!=this.associativeByUrls[a]){Loader.n_loading--;var g=new LoadEvent;g.result=this.associativeByUrls[a],g.url=a,g.param=d,b.call(e,g)}else var h=!0,i=this.associativeByUrls;f.onload=function(){Loader.n_loading--;var c=new LoadEvent;c.result=f,c.url=a,c.param=d,h&&(i[a]=f),b.call(e,c)},f.onerror=function(){Loader.n_loading--;var c=new LoadEvent;c.result=null,c.errorType=1,c.errorMessage="There was a problem retrieving the image ["+f.src+"]:",c.url=a,c.param=d,b.call(e,c)},f.src=Loader.proxy+a},Loader.loadXML=function(a,b){function c(){Loader.n_loading--,4==d.readyState&&(200==d.status||0===d.status?e(d.responseXML):console.log("[L] There was a problem retrieving the XML data:\n"+d.statusText))}Loader.n_loading++;var d=new XMLHttpRequest,e=b;if(Loader.REPORT_LOADING&&console.log("[L] loadXML, url:",a),window.XMLHttpRequest&&!window.ActiveXObject)try{d=new XMLHttpRequest}catch(f){d=!1}else if(window.ActiveXObject)try{d=new window.ActiveXObject("Msxml2.XMLHTTP")}catch(f){try{d=new window.ActiveXObject("Microsoft.XMLHTTP")}catch(g){d=!1}}d&&(d.onreadystatechange=c,d.open("GET",a,!0),d.send(""))},Loader.sendContentToVariableToPhp=function(a,b,c,d,e,f){var g=b+"="+encodeURIComponent(c);Loader.sendDataToPhp(a,g,d,e,f)},Loader.sendContentsToVariablesToPhp=function(a,b,c,d,e,f){for(var g=b[0]+"="+encodeURIComponent(c[0]),h=1;null!=b[h];h++)g+="&"+b[h]+"="+encodeURIComponent(c[h]);Loader.sendDataToPhp(a,g,d,e,f)},Loader.sendDataToPhp=function(a,b,c,d,e){var f=new XMLHttpRequest;f.open("POST",a,!0),f.setRequestHeader("Content-type","application/x-www-form-urlencoded"),f.send(b);var g=d?d:arguments.callee,h=function(){if(Loader.REPORT_LOADING&&console.log("[L] Loader.loadData | onLoadComplete, req.responseText:",f.responseText),4==f.readyState){Loader.n_loading--;var b=new LoadEvent;b.url=a,b.param=e,200==f.status||0===f.status&&null!=f.responseText?(b.result=f.responseText,c.call(g,b)):(Loader.REPORT_LOADING&&console.log("[L] [!] There was a problem retrieving the data ["+f.status+"]:\n"+f.statusText),b.errorType=f.status,b.errorMessage="[!] There was a problem retrieving the data ["+f.status+"]:"+f.statusText,c.call(g,b))}};f.onreadystatechange=h},Node.prototype=new DataModel,Node.prototype.constructor=Node,Node.prototype.cleanRelations=function(){this.nodeList=new NodeList,this.relationList=new RelationList,this.toNodeList=new NodeList,this.toRelationList=new RelationList,this.fromNodeList=new NodeList,this.fromRelationList=new RelationList},Node.prototype.destroy=function(){DataModel.prototype.destroy.call(this),delete this.id,delete this.name,delete this.nodeType,delete this.x,delete this.y,delete this.z,delete this.nodeList,delete this.relationList,delete this.toNodeList,delete this.toNodeList,delete this.fromNodeList,delete this.fromRelationList,delete this.parent,delete this.weight,delete this.descentWeight,delete this.level,delete this.vx,delete this.vy,delete this.vz,delete this.ax,delete this.ay,delete this.az},Node.prototype.getDegree=function(){return this.relationList.length},Node.prototype.getParent=function(){return this.parent},Node.prototype.getLeaves=function(){var a=new NodeList,b=function(c){return 0===c.toNodeList.length?void a.addNode(c):void c.toNodeList.forEach(b)};return b(this),a},Node.prototype.loadImage=function(a){Loader.loadImage(a,function(a){this.image=a.result},this)},Node.prototype.clone=function(){var a=new Node(this.id,this.name);return a.x=this.x,a.y=this.y,a.z=this.z,a.nodeType=this.nodeType,a.weight=this.weight,a.descentWeight=this.descentWeight,a},ColorOperators.interpolateColors=function(a,b,c){var d=ColorOperators.interpolateColorsRGB(ColorOperators.colorStringToRGB(a),ColorOperators.colorStringToRGB(b),c);return ColorOperators.RGBtoHEX(d[0],d[1],d[2])},ColorOperators.interpolateColorsRGB=function(a,b,c){var d=1-c;return[Math.floor(d*a[0]+c*b[0]),Math.floor(d*a[1]+c*b[1]),Math.floor(d*a[2]+c*b[2])]},ColorOperators.HEXtoRGB=function(a){return[parseInt(a.substr(1,2),16),parseInt(a.substr(3,2),16),parseInt(a.substr(5,2),16)]},ColorOperators.RGBtoHEX=function(a,b,c){return"#"+ColorOperators.toHex(a)+ColorOperators.toHex(b)+ColorOperators.toHex(c)},ColorOperators.RGBArrayToString=function(a){return"rgb("+a[0]+","+a[1]+","+a[2]+")"},ColorOperators.colorStringToHEX=function(a){var b=ColorOperators.colorStringToRGB(a);return ColorOperators.RGBtoHEX(b[0],b[1],b[2])},ColorOperators.numberToHex=function(a){for(var b=a.toString(16);b.length<2;)b="0"+b;return b},ColorOperators.uinttoRGB=function(a){var b=new Array(a>>16,(a>>8)-(a>>16<<8),a-(a>>8<<8));return b},ColorOperators.uinttoHEX=function(a){var b=ColorOperators.uinttoRGB(a),c=ColorOperators.RGBToHEX(b[0],b[1],b[2]);return c},ColorOperators.RGBtouint=function(a,b,c){return Number(a)<<16|Number(b)<<8|Number(c)},ColorOperators.HEXtouint=function(a){var b=ColorOperators.HEXtoRGB(a),c=ColorOperators.RGBtouint(b[0],b[1],b[2]);return c},ColorOperators.grayByLevel=function(a){return a=Math.floor(255*a),"rgb("+a+","+a+","+a+")"},ColorOperators.HEXtoHSV=function(a){var b=ColorOperators.HEXtoRGB(a);return ColorOperators.RGBtoHSV(b[0],b[1],b[2])},ColorOperators.HSVtoHEX=function(a,b,c){var d=ColorOperators.HSVtoRGB(a,b,c);return ColorOperators.RGBtoHEX(d[0],d[1],d[2])},ColorOperators.HSLtoHEX=function(a,b,c){var d=ColorOperators.HSLtoRGB(a,b,c);return ColorOperators.RGBtoHEX(d[0],d[1],d[2])},ColorOperators.RGBtoHSV=function(a,b,c){var d,e,f,g=Math.min(Math.min(a,b),c),h=Math.max(Math.max(a,b),c);f=h/255;var i=h-g;return 0===i?new Array(0,0,a/255):0===h?(e=0,d=-1,new Array(d,e,f)):(e=i/h,d=a==h?(b-c)/i:b==h?2+(c-a)/i:4+(a-b)/i,d*=60,0>d&&(d+=360),new Array(d,e,f))},ColorOperators.HSVtoRGB=function(a,b,c){a=a?a:0,b=b?b:0,c=c?c:0;var d,e,f,g,h,i,j,k;if(0===b)return d=e=f=c,[Math.floor(255*d),Math.floor(255*e),Math.floor(255*f)];switch(a/=60,g=Math.floor(a),h=a-g,i=c*(1-b),j=c*(1-b*h),k=c*(1-b*(1-h)),g){case 0:d=c,e=k,f=i;break;case 1:d=j,e=c,f=i;break;case 2:d=i,e=c,f=k;break;case 3:d=i,e=j,f=c;break;case 4:d=k,e=i,f=c;break;default:d=c,e=i,f=j}return new Array(Math.floor(255*d),Math.floor(255*e),Math.floor(255*f))},ColorOperators.HSLtoRGB=function(a,b,c){function d(a,b,c){return 0>c&&(c+=1),c>1&&(c-=1),1/6>c?a+6*(b-a)*c:.5>c?b:2/3>c?a+(b-a)*(2/3-c)*6:a}var e,f,g;if(0===b)e=f=g=c;else{var h=.5>c?c*(1+b):c+b-c*b,i=2*c-h;e=d(i,h,a/360+1/3),f=d(i,h,a/360),g=d(i,h,a/360-1/3)}return[Math.floor(255*e),Math.floor(255*f),Math.floor(255*g)]},ColorOperators.invertColorRGB=function(a,b,c){return[255-a,255-b,255-c]},ColorOperators.addAlpha=function(a,b){var c=ColorOperators.colorStringToRGB(a);return null==c?"black":"rgba("+c[0]+","+c[1]+","+c[2]+","+b+")"},ColorOperators.invertColor=function(a){var b=ColorOperators.colorStringToRGB(a);return b=ColorOperators.invertColorRGB(b[0],b[1],b[2]),ColorOperators.RGBtoHEX(b[0],b[1],b[2])},ColorOperators.toHex=function(a){for(var b=a.toString(16);b.length<2;)b="0"+b;return b},ColorOperators.getRandomColor=function(){return"rgb("+String(Math.floor(256*Math.random()))+","+String(Math.floor(256*Math.random()))+","+String(Math.floor(256*Math.random()))+")"},ColorOperators.colorStringToRGB=function(a){"#"==a.charAt(0)&&(a=a.substr(1,6)),a=a.replace(/ /g,""),a=a.toLowerCase();var b={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",
salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"};null!=b[a]&&(a=b[a]);for(var c=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^rgba\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3}),[\.0123456789]+\)$/,process:function(a){return[parseInt(a[1]),parseInt(a[2]),parseInt(a[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/,process:function(a){return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,process:function(a){return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)]}}],d=0;d<c.length;d++){var e=c[d].re,f=c[d].process,g=e.exec(a);if(g)return f(g)}return null},List.prototype=new DataModel,List.prototype.constructor=List,List.fromArray=function(a){return a.type="List",a.name=a.name||"",a.setType=List.prototype.setType,a.setArray=List.prototype.setArray,a.toArray=List.prototype.toArray,a._constructor=List,a.getImproved=List.prototype.getImproved,a.isEquivalent=List.prototype.isEquivalent,a.getTypeOfElements=List.prototype.getTypeOfElements,a.getTypes=List.prototype.getTypes,a.getType=List.prototype.getType,a.getLengths=List.prototype.getLengths,a.getWithoutRepetitions=List.prototype.getWithoutRepetitions,a.getSimplified=List.prototype.getSimplified,a.getFrequenciesTable=List.prototype.getFrequenciesTable,a.allElementsEqual=List.prototype.allElementsEqual,a.countElement=List.prototype.countElement,a.countOccurrences=List.prototype.countOccurrences,a.getMostRepeatedElement=List.prototype.getMostRepeatedElement,a.getMin=List.prototype.getMin,a.getMax=List.prototype.getMax,a.indexesOf=List.prototype.indexesOf,a.indexOfElements=List.prototype.indexOfElements,a.indexOfByPropertyValue=List.prototype.indexOfByPropertyValue,a.getFirstElementByName=List.prototype.getFirstElementByName,a.getElementsByNames=List.prototype.getElementsByNames,a.getFirstElementByPropertyValue=List.prototype.getFirstElementByPropertyValue,a.add=List.prototype.add,a.multiply=List.prototype.multiply,a.getElementNumberOfOccurrences=List.prototype.getElementNumberOfOccurrences,a.getPropertyValues=List.prototype.getPropertyValues,a.getRandomElement=List.prototype.getRandomElement,a.getRandomElements=List.prototype.getRandomElements,a.containsElement=List.prototype.containsElement,a.indexOfElement=List.prototype.indexOfElement,a.isSorted=List.prototype.isSorted,a.sortIndexed=List.prototype.sortIndexed,a.sortOnIndexes=List.prototype.sortOnIndexes,a.getReversed=List.prototype.getReversed,a.getSortedByProperty=List.prototype.getSortedByProperty,a.getSorted=List.prototype.getSorted,a.getSortedByList=List.prototype.getSortedByList,a.getSortedRandom=List.prototype.getSortedRandom,a.getSubList=List.prototype.getSubList,a.getSubListByIndexes=List.prototype.getSubListByIndexes,a.getSubListByType=List.prototype.getSubListByType,a.getFilteredByPropertyValue=List.prototype.getFilteredByPropertyValue,a.getFilteredByBooleanList=List.prototype.getFilteredByBooleanList,a.clone=List.prototype.clone,a.toString=List.prototype.toString,a.getNames=List.prototype.getNames,a.applyFunction=List.prototype.applyFunction,a.getWithoutElementAtIndex=List.prototype.getWithoutElementAtIndex,a.getWithoutElement=List.prototype.getWithoutElement,a.getWithoutElements=List.prototype.getWithoutElements,a.getWithoutElementsAtIndexes=List.prototype.getWithoutElementsAtIndexes,a.getFilteredByFunction=List.prototype.getFilteredByFunction,a._concat=Array.prototype.concat,a.concat=List.prototype.concat,a.pushIfUnique=List.prototype.pushIfUnique,a.removeElement=List.prototype.removeElement,a.removeElementAtIndex=List.prototype.removeElementAtIndex,a.removeElementsAtIndexes=List.prototype.removeElementsAtIndexes,a.removeElements=List.prototype.removeElements,a.removeRepetitions=List.prototype.removeRepetitions,a.replace=List.prototype.replace,a.assignNames=List.prototype.assignNames,a._splice=Array.prototype.splice,a.splice=List.prototype.splice,a.isList=!0,a.destroy=List.prototype.destroy,a},List.prototype.getImproved=function(){if(0===this.length)return this;var a,b=this.getTypeOfElements();switch(b){case"number":a=NumberList.fromArray(this,!1);break;case"string":a=StringList.fromArray(this,!1);break;case"Rectangle":return this;case"date":a=DateList.fromArray(this,!1);break;case"List":case"DateList":case"IntervalList":case"StringList":case"Table":a=Table.fromArray(this,!1);break;case"NumberList":a=NumberTable.fromArray(this,!1);break;case"Point":a=_Polygon.fromArray(this,!1);break;case"Polygon":a=PolygonList.fromArray(this,!1);break;case"Node":a=NodeList.fromArray(this,!1);break;case"Relation":a=RelationList.fromArray(this,!1)}var c=this.length;if(null===a||""===a){var d,e=!0;for(d=0;c>d;d++)if(!this[d].isList){e=!1;break}e&&(a=Table.fromArray(this,!1))}return null!=a?(a.name=this.name,a):this},List.prototype.toArray=function(){var a=this.slice(0);return a.name=this.name,a.type=this.type,a},List.prototype.isEquivalent=function(a){if(this.length!=a.length)return!1;var b,c=this.length;for(b=0;c>b;b++)if(this[b]!=a[b])return!1;return!0},List.prototype.getLengths=function(){return null},List.prototype.getTypeOfElements=function(){for(var a=_typeOf(this[0]),b=this.length,c=1;b>c;c++)if(_typeOf(this[c])!=a)return"";return a},List.prototype.getTypes=function(){for(var a=new StringList,b=this.length,c=0;b>c;c++)a[c]=_typeOf(this[c]);return a},List.prototype.toString=function(){for(var a="[",b=0;b<this.length-1;b++)a+=this[b]+", ";return a+=this[this.length-1]+"]"},List.prototype.getNames=function(){for(var a=new StringList,b=this.length,c=0;b>c;c++)a[c]=this[c].name;return a},List.prototype.getReversed=function(){for(var a=instantiateWithSameType(this),b=this.length,c=0;b>c;c++)a.unshift(this[c]);return a},List.prototype.getSubList=function(){var a,b;if(null!=arguments[0]){if(arguments[0].isList)return this.getSubListByIndexes(arguments[0]);if(arguments.length>2)return this.getSubListByIndexes(arguments);a="number"==_typeOf(arguments[0])?null!=_typeOf(arguments[1])&&"number"==_typeOf(arguments[1])?new Interval(arguments[0],arguments[1]):new Interval(arguments[0],this.length-1):arguments[0];var c,d=new Interval(Math.max(Math.min(Math.floor(a.x),this.length),0),Math.max(Math.min(Math.floor(a.y),this.length-1),0));if("NumberList"==this.type)return c=NumberList.fromArray(this.slice(a.x,a.y+1),!1),c.name=this.name,c;if("StringList"==this.type)return c=StringList.fromArray(this.slice(a.x,a.y+1),!1),c.name=this.name,c;var e=this.type;if(c="List"==e||"Table"==e?new List:instantiate(e),"NodeList"==e)for(b=d.x;b<=d.y;b++)c.addNode(this[b]);else for(b=d.x;b<=d.y;b++)c.push(this[b]);return c.name=this.name,"List"==e||"Table"==e?c.getImproved():c}},List.prototype.getSubListByType=function(a){var b=new List;return b.name=this.name,this.forEach(function(c){_typeOf(c)==a&&b.push(c)}),b.getImproved()},List.prototype.getSubListByIndexes=function(){if(this.length<1)return this;var a;if(a="number"==_typeOf(arguments[0])?arguments:arguments[0],null!=a){var b,c=this.type;if(b="List"==c?new List:instantiate(_typeOf(this)),0===a.length)return b;b.name=this.name;var d,e=this.length,f=a.length;if("NodeList"==c)for(d=0;f>d;d++)a[d]<e&&b.addNode(this[(a[d]+this.length)%this.length]);else for(d=0;f>d;d++)a[d]<e&&b.push(this[(a[d]+this.length)%this.length]);return"List"==c||"Table"==c?b.getImproved():b}},List.prototype.getElementNumberOfOccurrences=function(a){for(var b=0,c=0,d=this.indexOf(a,c);d>-1;)b++,c=d+1,d=this.indexOf(a,c);return b},List.prototype.clone=function(){var a,b=instantiateWithSameType(this),c=this.length;for(a=0;c>a;a++)b.push(this[a]);return b.name=this.name,b},List.prototype.getWithoutRepetitions=function(){var a,b,c=instantiateWithSameType(this),d=this.length;for(c.name=this.name,b={},a=0;d>a;a++)b[this[a]]||(c.push(this[a]),b[this[a]]=!0);return c},List.prototype.getSimplified=function(a,b){if(a){var c,d=this.getFrequenciesTable(),e=ListOperators.getSingleIndexDictionaryForList(d[0]),f=this.length;null==b&&(b="other");var g="StringList"==this.type?new StringList:new List;for(g.name=this.name,c=0;f>c;c++)g.push(e[this[c]]<a-1?this[c]:b);return g}},List.prototype.countElement=function(a){for(var b=0,c=this.length,d=0;c>d;d++)a==this[d]&&b++;return b},List.prototype.countOccurrences=function(){for(var a=new NumberList,b=this.length,c=0;b>c;c++)a[c]=this.indexesOf(this[c]).length;return a},List.prototype.getFrequenciesTable=function(a,b,c){a=null==a?!0:a;var d,e,f=new Table,g=new List,h=new NumberList;f[0]=g,f[1]=h,f._indexesDictionary={};var i=this.length;for(d=0;i>d;d++)e=f._indexesDictionary[this[d]],null==e&&(e=g.length,g[e]=this[d],h[e]=0,f._indexesDictionary[this[d]]=e),h[e]++;if(a&&(f[0]=g.getSortedByList(h,!1),f[1]=h.getSorted(!1),f._indexesDictionary=null),b&&(f[2]=NumberListOperators.normalizedToSum(f[1])),c){var j=new ColorList;for(i=f[0].length,d=0;i>d;d++)j[d]=ColorListGenerators._HARDCODED_CATEGORICAL_COLORS[d%ColorListGenerators._HARDCODED_CATEGORICAL_COLORS.length];f.push(j)}return f},List.prototype.allElementsEqual=function(){var a;if(this.length<2)return!0;var b=this[0],c=this.length;for(a=1;c>a;a++)if(this[a]!=b)return!1;return!0},List.prototype.getMostRepeatedElement=function(){return this.getFrequenciesTable(!0)[0][0]},List.prototype.getMin=function(){if(0===this.length)return null;var a,b=this[0],c=this.length;for(a=1;c>a;a++)b=Math.min(b,this[a]);return b},List.prototype.getMax=function(){if(0===this.length)return null;var a,b=this[0],c=this.length;for(a=1;c>a;a++)b=Math.max(b,this[a]);return b},List.prototype.add=function(a){if(a.constructor==Number){var b,c=this.length,d=instantiateWithSameType(this);for(b=0;c>b;b++)d.push(this[b]+a);return d}},List.prototype.getRandomElement=function(){return this[Math.floor(this.length*Math.random())]},List.prototype.getRandomElements=function(a,b){b=null==b?!0:b,a=Math.min(a,this.length);for(var c,d=instantiateWithSameType(this);d.length<a;)c=this[Math.floor(this.length*Math.random())],b&&-1!=d.indexOf(c)||d.push(c);return d},List.prototype.containsElement=function(a){var b,c=this.length;for(b=0;c>b;b++)if(this[b]==a)return!0;return!1},List.prototype.indexOfElement=function(a){var b,c=this.length;for(b=0;c>b;b++)if(this[b]==a)return b;return-1},List.prototype.getPropertyValues=function(a,b){var c=new List;c.name=a;for(var d,e=this.length,f=0;e>f;f++)d=this[f][a],c[f]=null==d?b:d;return c.getImproved()},List.prototype.isSorted=function(a){a=null==a?!0:Boolean(a);var b,c=this.length;if(a){for(b=1;c>b;b++)if(this[b]<this[b-1]&&console.log("~ non sorted elements i, i-1, (ascending):",b,this[b],this[b-1]),this[b]<this[b-1])return!1}else for(b=1;c>b;b++)if(this[b]>this[b-1])return!1;return!0},List.prototype.sortIndexed=function(){var a,b=[],c=this.length;for(a=0;c>a;a++)b.push({index:a,value:this[a]});var d=function(a,b){var c=a.value,d=b.value;return c-d};b=b.sort(d);var e=new NumberList;for(a=0;a<b.length;a++)e.push(b[a].index);return e},List.prototype.sortOnIndexes=function(a){var b=instantiateWithSameType(this);b.name=this.name;var c;for(c=0;null!=this[c];c++)-1!=a[c]&&b.push(this[a[c]]);return b},List.prototype.getSortedByProperty=function(a,b){b=null==b?!0:b;var c;return c=b?function(b,c){return b[a]-c[a]}:function(b,c){return c[a]-b[a]},this.clone().sort(c)},List.prototype.getSorted=function(a){return this.getSortedByList(this,a)},List.prototype.getSortedByList=function(a,b,c){if(null==a)return null;b=null==b?!0:b;var d,e=[],f=this.length;if(c&&"NumberList"==a.type)for(d=0;f>d;d++)e[d]=[this[d],a[d]+1e4*Math.random()*Number.MIN_VALUE,d];else for(d=0;f>d;d++)e[d]=[this[d],a[d],d];var g;g=b?function(a,b){return a[1]-b[1]}:function(a,b){return b[1]-a[1]},e=e.sort(g);var h=instantiateWithSameType(this);for(h.name=this.name,d=0;f>d;d++)h[d]=e[d][0];return h},List.prototype.getSortedRandom=function(){var a=this.clone();return a.name=this.name,a.sort(function(){return Math.random()-.5}),a},List.prototype.indexesOf=function(a){for(var b=this.indexOf(a),c=new NumberList;-1!=b;)c.push(b),b=this.indexOf(a,b+1);return c},List.prototype.indexOfElements=function(a){for(var b=new NumberList,c=a.length,d=0;c>d;d++)b[d]=this.indexOf(a[d]);return b},List.prototype.getFirstElementByName=function(a,b){for(var c=this.length,d=0;c>d;d++)if(this[d].name==a)return b?d:this[d];return b?-1:null},List.prototype.getElementsByNames=function(a,b){var c,d=b?new NumberList:new List,e=this.length;return a.forEach(function(a){for(c=0;e>c;c++)if(this[c].name==a){d.push(b?c:this[c]);break}d.push(b?-1:null)}),b?d:d.getImproved()},List.prototype.getFirstElementByPropertyValue=function(a,b){for(var c=this.length,d=0;c>d;d++)if(this[d][a]==b)return this[d];return null},List.prototype.indexOfByPropertyValue=function(a,b){for(var c=this.length,d=0;c>d;d++)if(this[d][a]==b)return d;return-1},List.prototype.getFilteredByBooleanList=function(a){var b=new List;b.name=this.name;var c,d=this.length;for(c=0;d>c;c++)a[c]&&b.push(this[c]);return b.getImproved()},List.prototype.getFilteredByPropertyValue=function(a,b,c){c=null==c?"equal":c;var d=new List;d.name="filtered_"+this.name;var e,f=this.length;switch(c){case"equal":for(e=0;f>e;e++)this[e][a]==b&&d.push(this[e]);break;case"different":for(e=0;f>e;e++)this[e][a]!=b&&d.push(this[e]);break;case"greater":for(e=0;f>e;e++)this[e][a]>b&&d.push(this[e]);break;case"lower":for(e=0;f>e;e++)this[e][a]<b&&d.push(this[e])}return d.getImproved()},List.prototype.applyFunction=function(a){var b=new List;b.name=this.name;var c,d=this.length;for(c=0;d>c;c++)b[c]=a(this[c]);return b.getImproved()},List.prototype.getWithoutElementsAtIndexes=function(a){var b,c,d=this.length;for(c="List"==this.type?new List:instantiate(_typeOf(this)),b=0;d>b;b++)-1==a.indexOf(b)&&c.push(this[b]);return"List"==this.type?c.getImproved():c},List.prototype.getWithoutElementAtIndex=function(a){var b,c=this.length;b="List"==this.type?new List:instantiateWithSameType(this);for(var d=0;c>d;d++)d!=a&&b.push(this[d]);return b.name=this.name,"List"==this.type?b.getImproved():b},List.prototype.getWithoutElement=function(a){var b=this.indexOf(a);if(-1==b)return this;var c;c="List"==this.type?new List:instantiateWithSameType(this),c.name=this.name;var d,e=this.length;for(d=0;e>d;d++)d!=b&&c.push(this[d]);return"List"==this.type?c.getImproved():c},List.prototype.getWithoutElements=function(a){var b,c,d=this.length;b="List"==this.type?new List:instantiateWithSameType(this);var e=ListOperators.getBooleanDictionaryForList(a);for(c=0;d>c;c++)e[this[c]]||b.push(this[c]);return b.name=this.name,"List"==this.type?b.getImproved():b},List.prototype.getFilteredByFunction=function(a){for(var b=instantiateWithSameType(this),c=this.length,d=0;c>d;d++)a(this[d])&&b.push(this[d]);return b.name=this.name,"List"==this.type?b.getImproved():b},List.prototype.concat=function(){if(null==arguments[0])return this;if(arguments[0].type==this.type){if("NumberList"==this.type)return NumberList.fromArray(this._concat.apply(this,arguments),!1);if("StringList"==this.type)return StringList.fromArray(this._concat.apply(this,arguments),!1);if("DateList"==this.type)return DateList.fromArray(this._concat.apply(this,arguments),!1);if("Table"==this.type)return Table.fromArray(this._concat.apply(this,arguments),!1);if("NumberTable"==this.type)return NumberTable.fromArray(this._concat.apply(this,arguments),!1);if("NodeList"==this.type){var a,b=this.clone(),c=arguments[0],d=c.length;for(a=0;d>a;a++)b.addNode(c[a]);return b}}return List.fromArray(this._concat.apply(this,arguments)).getImproved()},List.prototype.pushIfUnique=function(a){-1==this.indexOf(a)&&this.push(a)},List.prototype.removeElements=function(a){var b,c={},d=this.length,e=a.length;for(b=0;e>b;b++)c[a[b]]=!0;for(b=0;d>b;b++)c[this[b]]&&(this.splice(b,1),b--)},List.prototype.removeElement=function(a){var b=this.indexOf(a);-1!=b&&this.splice(b,1)},List.prototype.removeElementAtIndex=function(a){this.splice(a,1)},List.prototype.removeElementsAtIndexes=function(a){a=a.sort(function(a,b){return a-b});for(var b=0;null!=a[b];b++)this.splice(a[b]-b,1)},List.prototype.removeRepetitions=function(){for(var a=this.length,b=0;a>b;b++)-1!=this.indexOf(this[b],b+1)&&this.splice(b,1)},List.prototype.replace=function(a,b){for(var c=this.length,d=0;c>d;d++)this[d]==a&&(this[d]=b)},List.prototype.assignNames=function(a){if(null==a)return this;var b,c=a.length,d=this.length;for(b=0;d>b;b++)this[b].name=a[b%c];return this},List.prototype.splice=function(){switch(this.type){case"NumberList":return NumberList.fromArray(this._splice.apply(this,arguments));case"StringList":return StringList.fromArray(this._splice.apply(this,arguments));case"NodeList":return NodeList.fromArray(this._splice.apply(this,arguments));case"DateList":return DateList.fromArray(this._splice.apply(this,arguments))}return List.fromArray(this._splice.apply(this,arguments)).getImproved()},List.prototype.destroy=function(){for(var a=this.length,b=0;a>b;b++)delete this[b]},ColorList.prototype=new List,ColorList.prototype.constructor=ColorList,ColorList.fromArray=function(a){var b=List.fromArray(a);return b.type="ColorList",b.getRgbArrays=ColorList.prototype.getRgbArrays,b.getInterpolated=ColorList.prototype.getInterpolated,b.getInverted=ColorList.prototype.getInverted,b.addAlpha=ColorList.prototype.addAlpha,b},ColorList.prototype.getRgbArrays=function(){for(var a=new List,b=this.length,c=0;b>c;c++)a[c]=ColorOperators.colorStringToRGB(this[c]);return a},ColorList.prototype.getInterpolated=function(a,b){for(var c=new ColorList,d=this.length,e=0;d>e;e++)c[e]=ColorOperators.interpolateColors(this[e],a,b);return c.name=this.name,c},ColorList.prototype.getInverted=function(){for(var a=new ColorList,b=this.length,c=0;b>c;c++)a[c]=ColorOperators.invertColor(this[c]);return a.name=this.name,a},ColorList.prototype.addAlpha=function(a){for(var b=new ColorList,c=this.length,d=0;c>d;d++)b[d]=ColorOperators.addAlpha(this[d],a);return b.name=this.name,b},_Point.prototype=new DataModel,_Point.prototype.constructor=_Point,_Point.prototype.getNorm=function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},_Point.prototype.getAngle=function(){return Math.atan2(this.y,this.x)},_Point.prototype.factor=function(a){return a>=0||0>a?new _Point(this.x*a,this.y*a):null!=a.type&&"Point"==a.type?new _Point(this.x*a.x,this.y*a.y):void 0},_Point.prototype.normalize=function(){var a=Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2));return new _Point(this.x/a,this.y/a)},_Point.prototype.normalizeToValue=function(a){var b=a/Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2));return new _Point(this.x*b,this.y*b)},_Point.prototype.subtract=function(a){return new _Point(this.x-a.x,this.y-a.y)},_Point.prototype.add=function(a){return new _Point(a.x+this.x,a.y+this.y)},_Point.prototype.addCoordinates=function(a,b){return new _Point(a+this.x,b+this.y)},_Point.prototype.distanceToPoint=function(a){return Math.sqrt(Math.pow(this.x-a.x,2)+Math.pow(this.y-a.y,2))},_Point.prototype.distanceToPointSquared=function(a){return Math.pow(this.x-a.x,2)+Math.pow(this.y-a.y,2)},_Point.prototype.angleToPoint=function(a){return Math.atan2(a.y-this.y,a.x-this.x)},_Point.prototype.expandFromPoint=function(a,b){return new _Point(a.x+b*(this.x-a.x),a.y+b*(this.y-a.y))},_Point.prototype.interpolate=function(a,b){return new _Point((1-b)*this.x+b*a.x,(1-b)*this.y+b*a.y)},_Point.prototype.cross=function(a){return this.x*a.y-this.y*a.x},_Point.prototype.dot=function(a){return this.x*a.x+this.y*a.y},_Point.prototype.getRotated=function(a,b){return b=null==b?new _Point:b,new _Point(Math.cos(a)*(this.x-b.x)-Math.sin(a)*(this.y-b.y)+b.x,Math.sin(a)*(this.x-b.x)+Math.cos(a)*(this.y-b.y)+b.y)},_Point.prototype.clone=function(){return new _Point(this.x,this.y)},_Point.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")"},_Point.prototype.destroy=function(){delete this.type,delete this.name,delete this.x,delete this.y},Interval.prototype=new _Point,Interval.prototype.constructor=Interval,Interval.prototype.getMin=function(){return Math.min(this.x,this.y)},Interval.prototype.getMax=function(){return Math.max(this.x,this.y)},Interval.prototype.getAmplitude=function(){return Math.abs(this.y-this.x)},Interval.prototype.getSignedAmplitude=function(){return this.y-this.x},Interval.prototype.getMiddle=function(){return.5*(this.x+this.y)},Interval.prototype.getRandom=function(){return this.x+(this.y-this.x)*Math.random()},Interval.prototype.getSign=function(){return this.x==this.y?0:Math.abs(this.y-this.x)/(this.y-this.x)},Interval.prototype.getScaled=function(a){var b=.5*(this.y-this.x),c=.5*(this.x+this.y);return new Interval(c-b*a,c+b*a)},Interval.prototype.getScaledFromProportion=function(a,b){var c=1-b,d=b*(this.y-this.x),e=c*(this.y-this.x),f=c*this.x+b*this.y;return new Interval(f-d*a,f+e*a)},Interval.prototype.add=function(a){return new Interval(this.x+a,this.y+a)},Interval.prototype.invert=function(){var a=this.x;this.x=this.y,this.y=a},Interval.prototype.getInterpolatedValue=function(a){return a*Number(this.getSignedAmplitude())+this.x},Interval.prototype.getInverseInterpolatedValue=function(a){return(a-this.x)/this.getSignedAmplitude()},Interval.prototype.getInterpolatedValues=function(a){for(var b=[],c=a.length,d=0;c>d;d++)b.push(this.getInterpolatedValue(a[d]));return b},Interval.prototype.getInverseInterpolatedValues=function(a){for(var b=[],c=a.length,d=0;c>d;d++)b.push(this.getInverseInterpolatedValue(a[d]));return b},Interval.prototype.intersect=function(a){return new Interval(Math.max(this.x,a.x),Math.min(this.y,a.y))},Interval.prototype.clone=function(){var a=new Interval(this.x,this.y);return a.name=name,a},Interval.prototype.contains=function(a){return this.y>this.x?a>=this.x&&a<=this.y:a>=this.y&&a<=this.y},Interval.prototype.isEquivalent=function(a){return this.x==a.x&&this.y==a.y},Interval.prototype.toString=function(){return"Interval[x:"+this.x+"| y:"+this.y+"| amplitude:"+this.getAmplitude()+"]"},NumberList.prototype=new List,NumberList.prototype.constructor=NumberList,NumberList.fromArray=function(a,b){b=null==b?!0:b;var c=List.fromArray(a),d=c.length;if(b)for(var e=0;d>e;e++)c[e]=Number(c[e]);return c.type="NumberList",c.unit=NumberList.prototype.unit,c.tenPower=NumberList.prototype.tenPower,c.getMin=NumberList.prototype.getMin,c.getMax=NumberList.prototype.getMax,c.getAmplitude=NumberList.prototype.getAmplitude,c.getMinMaxInterval=NumberList.prototype.getMinMaxInterval,c.getSum=NumberList.prototype.getSum,c.getProduct=NumberList.prototype.getProduct,c.getInterval=NumberList.prototype.getInterval,c.getNumbersSimplified=NumberList.prototype.getNumbersSimplified,c.getAverage=NumberList.prototype.getAverage,c.getNorm=NumberList.prototype.getNorm,c.getStandardDeviation=NumberList.prototype.getStandardDeviation,c.getVariance=NumberList.prototype.getVariance,c.getMedian=NumberList.prototype.getMedian,c.getQuantiles=NumberList.prototype.getQuantiles,c.getSorted=NumberList.prototype.getSorted,c.getSortIndexes=NumberList.prototype.getSortIndexes,c.factor=NumberList.prototype.factor,c.add=NumberList.prototype.add,c.subtract=NumberList.prototype.subtract,c.divide=NumberList.prototype.divide,c.sqrt=NumberList.prototype.sqrt,c.pow=NumberList.prototype.pow,c.log=NumberList.prototype.log,c.floor=NumberList.prototype.floor,c.isEquivalent=NumberList.prototype.isEquivalent,c.approach=NumberList.prototype.approach,c.clone=NumberList.prototype.clone,c},NumberList.prototype.unit="",NumberList.prototype.tenPower=0,NumberList.prototype.getMin=function(){if(0===this.length)return null;var a,b=this[0];for(a=1;a<this.length;a++)b=Math.min(b,this[a]);return b},NumberList.prototype.getMax=function(){if(0===this.length)return null;var a,b=this[0],c=this.length;for(a=1;c>a;a++)b=Math.max(b,this[a]);return b},NumberList.prototype.getAmplitude=function(){if(0===this.length)return 0;for(var a=this[0],b=this[0],c=this.length,d=1;c>d;d++)a=Math.min(a,this[d]),b=Math.max(b,this[d]);return b-a},NumberList.prototype.getMinMaxInterval=function(){return new Interval(this.getMin(),this.getMax())},NumberList.prototype.getSum=function(){if(0===this.length)return 0;var a,b=this[0],c=this.length;for(a=1;c>a;a++)b+=this[a];return b},NumberList.prototype.getProduct=function(){if(0===this.length)return null;var a,b=this[0],c=this.length;for(a=1;c>a;a++)b*=this[a];return b},NumberList.prototype.getInterval=function(){if(0===this.length)return null;for(var a=this[0],b=this[0],c=this.length,d=1;c>d;d++)a=Math.max(a,this[d]),b=Math.min(b,this[d]);var e=new Interval(b,a);return e},NumberList.prototype.getNumbersSimplified=function(a,b){var c,d,e,f=this.length;switch(a=a||0,b=b||0,c=new NumberList,c.name=this.name,a){case 0:var g=Math.pow(10,b);this.forEach(function(a){c.push(Math.floor(a/g)*g)});break;case 1:case 2:b=Math.min(b||10,Math.floor(this.length/2));var h,i=this.getQuantiles(b),j=i.length;for(d=0;f>d;d++)if(h=this[d],h<i[0])1==a?c.push(0):c.push(i._min);else for(e=0;j>e;e++)if(h>=i[e]&&(e+1==i.length||h<i[e+1])){1==a?c.push(e+1):c.push(i[e]);break}1==a&&(c.name=this.name+" (n quantile)");break;case 3:for(c.name=this.name+" (order of magnitude)",d=0;f>d;d++)c.push(Math.floor(Math.log(this[d])/Math.log(10)));break;case 4:for(c.name=this.name+" (rounded by order of magnitude)",d=0;f>d;d++)c.push(Math.pow(10,Math.floor(Math.log(this[d])/Math.log(10))));break;case 5:for(b=b||1,c.name=this.name+" (significant digits)",d=0;f>d;d++)c.push(Number(this[d].toPrecision(b)))}return c},NumberList.prototype.toPolygon=function(){if(0===this.length)return null;for(var a=new Polygon,b=0;null!=this[b+1];b+=2)a.push(new Point(this[b],this[b+1]));return a},NumberList.prototype.getAverage=function(){return this.getSum()/this.length},NumberList.prototype.getGeometricMean=function(){for(var a=0,b=this.length,c=0;b>c;c++)a+=Math.log(this[c]);return Math.pow(Math.E,a/this.length)},NumberList.prototype.getNorm=function(){for(var a=0,b=this.length,c=0;b>c;c++)a+=Math.pow(this[c],2);return Math.sqrt(a)},NumberList.prototype.getVariance=function(){for(var a=0,b=this.getAverage(),c=this.length,d=0;c>d;d++)a+=Math.pow(this[d]-b,2);return a/this.length},NumberList.prototype.getStandardDeviation=function(){return Math.sqrt(this.getVariance())},NumberList.prototype.getMedian=function(){var a=this.getSorted(!0),b=(this.length-1)/2,c=Math.floor(b),d=b==c;return d?a[b]:.5*a[c]+.5*a[c+1]},NumberList.prototype.getQuantiles=function(a){for(var b=this.getSorted(!0),c=this.length/a,d=Math.floor(c),e=c==d,f=new NumberList,g=0;a-1>g;g++)f[g]=e?b[(g+1)*c]:.5*b[(g+1)*d]+.5*b[(g+1)*d+1];return f._sorted=b,f._min=b[0],f._max=b[b.length-1],f},NumberList.prototype.getSorted=function(a){return a=null==a?!0:a,a?NumberList.fromArray(this.slice().sort(function(a,b){return a-b}),!1):NumberList.fromArray(this.slice().sort(function(a,b){return b-a}),!1)},NumberList.prototype.getSortIndexes=function(a){null==a&&(a=!0);var b=[],c=new NumberList,d=this.length;if(0===this.length)return c;for(var e=0;d>e;e++)b.push([e,this[e]]);for(a?b.sort(function(a,b){return a[1]<b[1]?1:-1}):b.sort(function(a,b){return a[1]<b[1]?-1:1}),e=0;null!=b[e];e++)c.push(b[e][0]);return c.name=this.name,c},NumberList.prototype.factor=function(a){var b,c=new NumberList,d=this.length;if(isArray(a))for(b=0;d>b;b++)c.push(this[b]*a[b%this.length]);else for(b=0;d>b;b++)c.push(this[b]*a);return c.name=this.name,c},NumberList.prototype.add=function(a){var b,c=new NumberList,d=_typeOf(a),e=this.length;switch(d){case"number":for(b=0;e>b;b++)c[b]=this[b]+a;break;case"NumberList":for(b=0;e>b;b++)c[b]=this[b]+a[b%a.length]}return c.name=this.name,c},NumberList.prototype.subtract=function(a){var b,c=new NumberList,d=_typeOf(a),e=this.length;switch(d){case"number":for(b=0;e>b;b++)c[b]=this[b]-a;break;case"NumberList":for(b=0;e>b;b++)c[b]=this[b]-a[b%a.length]}return c.name=this.name,c},NumberList.prototype.divide=function(a){var b,c=new NumberList,d=_typeOf(a),e=this.length;switch(d){case"number":for(b=0;e>b;b++)c[b]=this[b]/a;break;case"NumberList":for(b=0;e>b;b++)c[b]=this[b]/a[b%a.length]}return c.name=this.name,c},NumberList.prototype.sqrt=function(){var a,b=new NumberList,c=this.length;for(a=0;c>a;a++)b.push(Math.sqrt(this[a]));return b.name=this.name,b},NumberList.prototype.pow=function(a){var b,c=new NumberList,d=this.length;for(b=0;d>b;b++)c.push(Math.pow(this[b],a));return c.name=this.name,c},NumberList.prototype.log=function(a){a=a||0;var b,c=new NumberList,d=this.length;for(b=0;d>b;b++)c[b]=Math.log(this[b]+a);return c.name=this.name,c},NumberList.prototype.floor=function(){var a,b=new NumberList,c=this.length;for(a=0;c>a;a++)b.push(Math.floor(this[a]));return b.name=this.name,b},NumberList.prototype.approach=function(a,b){b=b||.5;var c,d=1-b;for(c=0;null!=this[c];c++)this[c]=d*this[c]+b*a[c]},NumberList.prototype.isEquivalent=function(a){var b=this.length;if(a.length!=b)return!1;for(var c=0;b>c;c++)if(this[c]!=a[c])return!1;return!0},NumberList.prototype.approach=function(a,b){b=b||.5;var c,d=1-b,e=this.length;for(c=0;e>c;c++)this[c]=d*this[c]+b*a[c];return!0},NumberList.prototype.clone=function(){var a=NumberList.fromArray(this.slice(),!1);return a.name=this.name,a},DateList.prototype=new List,DateList.prototype.constructor=DateList,DateList.fromArray=function(a,b){b=null==b?!0:b;var c=List.fromArray(a);if(b)for(var d=0;d<c.length;d++)c[d]=new Date(c[d]);return c.type="DateList",c.getTimes=DateList.prototype.getTimes,c.getMin=DateList.prototype.getMin,c.getMax=DateList.prototype.getMax,c},DateList.prototype.getTimes=function(){var a,b=new NumberList;for(a=0;null!=this[a];a++)b.push(this[a].getTime());return b},DateList.prototype.getMin=function(){if(0===this.length)return null;var a,b=this[0];for(a=1;null!=this[a];a++)b=b<this[a]?b:this[a];return b},DateList.prototype.getMax=function(){if(0===this.length)return null;var a,b=this[0];for(a=1;null!=this[a];a++)b=b>this[a]?b:this[a];return b},Polygon3D.prototype=new List,Polygon3D.prototype.constructor=Polygon3D,Polygon3D.fromArray=function(a){var b=List.fromArray(a);return b.type="Polygon3D",b},Rectangle.prototype=new DataModel,Rectangle.prototype.constructor=Rectangle,Rectangle.prototype.getRight=function(){return this.x+this.width},Rectangle.prototype.getBottom=function(){return this.y+this.height},Rectangle.prototype.setRight=function(a){this.width=a-this.x},Rectangle.prototype.setBottom=function(a){this.height=a-this.y},Rectangle.prototype.getTopLeft=function(){return new _Point(this.x,this.y)},Rectangle.prototype.getTopRight=function(){return new _Point(this.x+this.width,this.y)},Rectangle.prototype.getBottomRight=function(){return new _Point(this.x+this.width,this.y+this.height)},Rectangle.prototype.getBottomLeft=function(){return new _Point(this.x,this.y+this.height)},Rectangle.prototype.getCenter=function(){return new _Point(this.x+.5*this.width,this.y+.5*this.height)},Rectangle.prototype.getRandomPoint=function(){return new _Point(this.x+Math.random()*this.width,this.y+Math.random()*this.height)},Rectangle.prototype.getIntersection=function(a){if(a.x+a.width<this.x||a.x>this.x+this.width||a.y+a.height<this.y||a.y>this.y+this.height)return null;var b=Math.max(a.x,this.x),c=Math.max(a.y,this.y);return new Rectangle(b,c,Math.min(a.x+a.width,this.x+this.width)-b,Math.min(a.y+a.height,this.y+this.height)-c)},Rectangle.prototype.interpolate=function(a,b){var c=1-b;return new Rectangle(c*this.x+b*a.x,c*this.y+b*a.y,c*this.width+b*a.width,c*this.height+b*a.height)},Rectangle.prototype.getRatio=function(){return Math.max(this.width,this.height)/Math.min(this.width,this.height)},Rectangle.prototype.getArea=function(){return this.width*this.height},Rectangle.prototype.containsPoint=function(a){return this.x<=a.x&&this.x+this.width>=a.x&&this.y<=a.y&&this.y+this.height>=a.y;
},Rectangle.prototype.pointIsOnBorder=function(a,b){if(b=null==b?1:b,a.x>=this.x-b&&a.x<=this.x+this.width+b){if(a.y>=this.y-b&&a.y<=this.y+b)return!0;if(a.y>=this.y+this.height-b&&a.y<=this.y+this.height+b)return!0;if(a.y>=this.y-b&&a.y<=this.y+this.height+b&&(a.x<this.x+b||a.x>this.x+this.width-b))return!0}return!1},Rectangle.prototype.getNormalRectangle=function(){return new Rectangle(Math.min(this.x,this.x+this.width),Math.min(this.y,this.y+this.height),Math.abs(this.width),Math.abs(this.height))},Rectangle.prototype.intersectsRectangle=function(a){return this.x+this.width>=a.x&&this.y+this.height>=a.y&&a.x+a.width>=this.x&&a.y+a.height>=this.y},Rectangle.prototype.expand=function(a,b){return b=b||new _Point(this.x+.5*this.width,this.y+.5*this.height),new Rectangle((this.x-b.x)*a+b.x,(this.y-b.y)*a+b.y,this.width*a,this.height*a)},Rectangle.prototype.isEqual=function(a){return this.x==a.x&&this.y==a.y&&this.width==a.width&&this.height==a.height},Rectangle.prototype.clone=function(){return new Rectangle(this.x,this.y,this.width,this.height)},Rectangle.prototype.toString=function(){return"(x="+this.x+", y="+this.y+", w="+this.width+", h="+this.height+")"},Rectangle.prototype.destroy=function(){delete this.x,delete this.y,delete this.width,delete this.height},_Polygon.prototype=new List,_Polygon.prototype.constructor=_Polygon,_Polygon.fromArray=function(a){var b=List.fromArray(a);return b.type="Polygon",b.getFrame=_Polygon.prototype.getFrame,b.getBarycenter=_Polygon.prototype.getBarycenter,b.add=_Polygon.prototype.add,b.factor=_Polygon.prototype.factor,b.getRotated=_Polygon.prototype.getRotated,b.getClosestPoint=_Polygon.prototype.getClosestPoint,b.toNumberList=_Polygon.prototype.toNumberList,b.containsPoint=_Polygon.prototype.containsPoint,b.approach=_Polygon.prototype.approach,b.clone=_Polygon.prototype.clone,b},_Polygon.prototype.getFrame=function(){if(0===this.length)return null;for(var a,b=new Rectangle(this[0].x,this[0].y,this[0].x,this[0].y),c=1;null!=this[c];c++)a=this[c],b.x=Math.min(b.x,a.x),b.y=Math.min(b.y,a.y),b.width=Math.max(b.width,a.x),b.height=Math.max(b.height,a.y);return b.width-=b.x,b.height-=b.y,b},_Polygon.prototype.getBarycenter=function(a){var b;a=null==a?!0:a;var c=1-Number(a);if(0===this.length)return null;var d=new _Point(this[0].x,this[0].y);for(b=1;null!=this[b+c];b++)d.x+=this[b].x,d.y+=this[b].y;return d.x/=this.length,d.y/=this.length,d},_Polygon.prototype.add=function(a){var b,c=_typeOf(a);switch(c){case"Point":var d=new _Polygon;for(b=0;null!=this[b];b++)d[b]=this[b].add(a);return d.name=this.name,d}},_Polygon.prototype.factor=function(a){var b,c=new _Polygon;if(c.name=this.name,a>=0||0>a){for(b=0;null!=this[b];b++)c[b]=new _Point(this[b].x*a,this[b].y*a);return c}if(null!=a.type&&"Point"==a.type){for(b=0;null!=this[b];b++)c[b]=new _Point(this[b].x*a.x,this[b].y*a.y);return c}return null},_Polygon.prototype.getRotated=function(a,b){b=null==b?new _Point:b;for(var c=new _Polygon,d=0;null!=this[d];d++)c[d]=new _Point(Math.cos(a)*(this[d].x-b.x)-Math.sin(a)*(this[d].y-b.y)+b.x,Math.sin(a)*(this[d].x-b.x)+Math.cos(a)*(this[d].y-b.y)+b.y);return c.name=this.name,c},_Polygon.prototype.getClosestPoint=function(a){for(var b,c=this[0],d=Math.pow(a.x-c.x,2)+Math.pow(a.y-c.y,2),e=1;null!=this[e];e++)b=Math.pow(a.x-this[e].x,2)+Math.pow(a.y-this[e].y,2),d>b&&(d=b,c=this[e]);return c},_Polygon.prototype.toNumberList=function(){var a,b=new NumberList;for(a=0;null!=this[a];a++)b[2*a]=this[a].x,b[2*a+1]=this[a].y;return b},_Polygon.prototype.containsPoint=function(a){var b,c,d,e;for(e=!1,b=-1,d=this.length,c=d-1;++b<d;c=b)(this[b].y<=a.y&&a.y<this[c].y||this[c].y<=a.y&&a.y<this[b].y)&&a.x<(this[c].x-this[b].x)*(a.y-this[b].y)/(this[c].y-this[b].y)+this[b].x&&(e=!e);return e},_Polygon.prototype.approach=function(a,b){b=b||.5;var c=1-b;this.forEach(function(d,e){d.x=c*d.x+b*a[e].x,d.y=c*d.y+b*a[e].y})},_Polygon.prototype.clone=function(){for(var a=new _Polygon,b=0;null!=this[b];b++)a[b]=this[b].clone();return a.name=this.name,a},Table.prototype=new List,Table.prototype.constructor=Table,Table.fromArray=function(a){var b=List.fromArray(a);return b.type="Table",b.applyFunction=Table.prototype.applyFunction,b.getRow=Table.prototype.getRow,b.getRows=Table.prototype.getRows,b.getLengths=Table.prototype.getLengths,b.getListLength=Table.prototype.getListLength,b.sliceRows=Table.prototype.sliceRows,b.getSubListsByIndexes=Table.prototype.getSubListsByIndexes,b.getWithoutRow=Table.prototype.getWithoutRow,b.getWithoutRows=Table.prototype.getWithoutRows,b.getTransposed=Table.prototype.getTransposed,b.getListsSortedByList=Table.prototype.getListsSortedByList,b.sortListsByList=Table.prototype.sortListsByList,b.clone=Table.prototype.clone,b.cloneWithEmptyLists=Table.prototype.cloneWithEmptyLists,b.print=Table.prototype.print,b.removeRow=Table.prototype.removeRow,b.destroy=Table.prototype.destroy,b.isTable=!0,b},Table.prototype.applyFunction=function(a){var b,c=new Table;for(c.name=this.name,b=0;null!=this[b];b++)c[b]=this[b].applyFunction(a);return c.getImproved()},Table.prototype.getRow=function(a){var b,c=new List,d=this.length;for(b=0;d>b;b++)c[b]=this[b][a];return c.getImproved()},Table.prototype.getListLength=function(a){return a=a||0,a>=this.length?void 0:this[a].length},Table.prototype.getLengths=function(){for(var a=new NumberList,b=this.length,c=0;b>c;c++)a[c]=null==this[c]?0:this[c].length;return a},Table.prototype.sliceRows=function(a,b){b=null==b?this[0].length-1:b;var c,d,e=new Table,f=this.length;for(e.name=this.name,c=0;f>c;c++)d=this[c].getSubList(a,b),d.name=this[c].name,e.push(d);return e.getImproved()},Table.prototype.getSubListsByIndexes=function(a){var b,c=new Table,d=this.length;for(b=0;d>b;b++)c.push(this[b].getSubListByIndexes(a));return c.getImproved()},Table.prototype.getRows=function(a){return Table.prototype.getSubListsByIndexes(a)},Table.prototype.getWithoutRow=function(a){var b=new Table,c=this.length;b.name=this.name;for(var d=0;c>d;d++)b[d]=List.fromArray(this[d].slice(0,a).concat(this[d].slice(a+1))).getImproved(),b[d].name=this[d].name;return b.getImproved()},Table.prototype.getWithoutRows=function(a){var b,c=new Table,d=this.length;c.name=this.name;for(var e=0;d>e;e++){c[e]=new List,b=this[e].length;for(var f=0;b>f;f++)-1==a.indexOf(f)&&c[e].push(this[e][f]);c[e].name=this[e].name}return c.getImproved()},Table.prototype.getListsSortedByList=function(a,b){if(null!=a){var c,d=instantiateWithSameType(this),e=a.isList?a.clone():this[a],f=this.length;for(c=0;f>c;c++)d.push(this[c].getSortedByList(e,b));return d}},Table.prototype.getTransposed=function(a){var b,c=a?this.getSubList(1):this,d=c.length,e=instantiate(_typeOf(c));if(0===c.length)return e;var f,g,h;for(f=0;d>f;f++)for(h=c[f],b=h.length,g=0;b>g;g++)0===f&&(e[g]=new List),e[g][f]=c[f][g];for(b=c[0].length,g=0;b>g;g++)e[g]=e[g].getImproved();if(a)for(b=this[0].length,g=0;b>g;g++)e[g].name=String(this[0][g]);return e},Table.prototype.removeRow=function(a){for(var b=0;null!=this[b];b++)this[b].splice(a,1)},Table.prototype.clone=function(){var a,b=this.length,c=instantiateWithSameType(this);for(c.name=this.name,a=0;b>a;a++)c.push(this[a].clone());return c},Table.prototype.cloneWithEmptyLists=function(){var a,b,c=this.length,d=instantiateWithSameType(this);for(d.name=this.name,a=0;c>a;a++)b=instantiateWithSameType(this[a]),b.name=this[a].name,d.push(b);return d},Table.prototype.destroy=function(){for(var a=0;null!=this[a];a++)this[a].destroy(),delete this[a]},Table.prototype.print=function(){console.log("///////////// <"+this.name+"////////////////////////////////////////////////////"),console.log(TableEncodings.TableToCSV(this,null,!0)),console.log("/////////////"+this.name+"> ////////////////////////////////////////////////////")},NumberTable.prototype=new Table,NumberTable.prototype.constructor=NumberTable,NumberTable.fromArray=function(a){var b=Table.fromArray(a);return b.type="NumberTable",b.getSums=NumberTable.prototype.getSums,b.getRowsSums=NumberTable.prototype.getRowsSums,b.getAverages=NumberTable.prototype.getAverages,b.getRowsAverages=NumberTable.prototype.getRowsAverages,b.getIntervals=NumberTable.prototype.getIntervals,b.factor=NumberTable.prototype.factor,b.add=NumberTable.prototype.add,b.getMax=NumberTable.prototype.getMax,b.getMin=NumberTable.prototype.getMin,b.getMinMaxInterval=NumberTable.prototype.getMinMaxInterval,b.getCovarianceMatrix=NumberTable.prototype.getCovarianceMatrix,b},NumberTable.prototype.getMax=function(){if(0===this.length)return null;var a,b=this[0].getMax();for(a=1;null!=this[a];a++)b=Math.max(this[a].getMax(),b);return b},NumberTable.prototype.getMin=function(){if(0===this.length)return null;var a,b=this[0].getMin();for(a=1;null!=this[a];a++)b=Math.min(this[a].getMin(),b);return b},NumberTable.prototype.getMinMaxInterval=function(){if(0===this.length)return null;for(var a=this[0].getMinMaxInterval(),b=1;null!=this[b];b++){var c=this[b].getMinMaxInterval();a.x=Math.min(a.x,c.x),a.y=Math.max(a.y,c.y)}return a},NumberTable.prototype.getSums=function(){for(var a=new NumberList,b=0;null!=this[b];b++)a[b]=this[b].getSum();return a},NumberTable.prototype.getRowsSums=function(){for(var a,b=this[0].clone(),c=1;null!=this[c];c++){a=this[c];for(var d=0;null!=a[d];d++)b[d]+=a[d]}return b},NumberTable.prototype.getAverages=function(){for(var a=new NumberList,b=0;null!=this[b];b++)a[b]=this[b].getAverage();return a},NumberTable.prototype.getRowsAverages=function(){var a,b,c,d,e=this.length,f=this[0].clone().factor(1/e);for(b=1;e>b;b++)for(a=this[b],d=a.length,c=0;d>c;c++)f[c]+=a[c]/e;return f},NumberTable.prototype.getIntervals=function(){var a,b,c=this.length,d=new List;for(b=0;c>b;b++)a=this[b],d.push(a.getInterval());return d},NumberTable.prototype.factor=function(a){var b,c,d=new NumberTable,e=this.length;switch(_typeOf(a)){case"number":for(b=0;e>b;b++)c=this[b],d[b]=c.factor(a);break;case"NumberList":for(b=0;e>b;b++)c=this[b],d[b]=c.factor(a[b])}return d.name=this.name,d},NumberTable.prototype.add=function(a){var b,c,d=new NumberTable,e=this.length;for(c=0;e>c;c++)b=this[c],d[c]=b.add(a);return d.name=this.name,d},StringList.prototype=new List,StringList.prototype.constructor=StringList,StringList.fromArray=function(a,b){b=null==b?!0:b;var c=List.fromArray(a);if(b)for(var d=0;d<c.length;d++)c[d]=String(c[d]);return c.type="StringList",c.getLengths=StringList.prototype.getLengths,c.toLowerCase=StringList.prototype.toLowerCase,c.toUpperCase=StringList.prototype.toUpperCase,c.append=StringList.prototype.append,c.getSurrounded=StringList.prototype.getSurrounded,c.replace=StringList.prototype.replace,c.getConcatenated=StringList.prototype.getConcatenated,c.trim=StringList.prototype.trim,c.clone=StringList.prototype.clone,c},StringList.prototype.getLengths=function(){var a=new NumberList;return this.forEach(function(b){a.push(b.length)}),a},StringList.prototype.append=function(a,b){b=null==b?!0:b;var c=new StringList;c.name=this.name;var d,e="StringList"==_typeOf(a);if(b)for(d=0;null!=this[d];d++)c[d]=this[d]+(e?a[d]:a);else for(d=0;null!=this[d];d++)c[d]=(e?a[d]:a)+this[d];return c},StringList.prototype.getSurrounded=function(a,b){var c=new StringList;c.name=this.name;var d,e=Array.isArray(a),f=Array.isArray(b);for(d=0;null!=this[d];d++)c[d]=(e?a[d]:a)+this[d]+(f?b[d]:b);return c},StringList.prototype.replace=function(a,b){if(null==a)return this;var c,d=new StringList,e=this.length;for(d.name=this.name,c=0;e>c;c++)d[c]=this[c].replace(a,b);return d},StringList.prototype.getConcatenated=function(a){var b,c="",d=this.length;for(b=0;d>b;b++)c+=this[b],b<this.length-1&&(c+=a);return c},StringList.prototype.toLowerCase=function(){var a=new StringList;a.name=this.name;var b,c=this.length;for(b=0;c>b;b++)a[b]=this[b].toLowerCase();return a},StringList.prototype.toUpperCase=function(){var a=new StringList;a.name=this.name;var b,c=this.length;for(b=0;c>b;b++)a[b]=this[b].toUpperCase();return a},StringList.prototype.trim=function(){var a,b=this.length,c=new StringList;for(a=0;b>a;a++)c[a]=this[a].trim();return c.name=this.name,c},StringList.prototype.clone=function(){var a=StringList.fromArray(this.slice(),!1);return a.name=this.name,a},MD5.hex_md5=function(a){return this.rstr2hex(this.rstr_md5(this.str2rstr_utf8(a)))},MD5.b64_md5=function(a){return this.rstr2b64(this.rstr_md5(this.str2rstr_utf8(a)))},MD5.any_md5=function(a,b){return this.rstr2any(this.rstr_md5(this.str2rstr_utf8(a)),b)},MD5.hex_hmac_md5=function(a,b){return this.rstr2hex(this.rstr_hmac_md5(this.str2rstr_utf8(a),this.str2rstr_utf8(b)))},MD5.b64_hmac_md5=function(a,b){return this.rstr2b64(this.rstr_hmac_md5(this.str2rstr_utf8(a),this.str2rstr_utf8(b)))},MD5.any_hmac_md5=function(a,b,c){return this.rstr2any(this.rstr_hmac_md5(this.str2rstr_utf8(a),this.str2rstr_utf8(b)),c)},MD5.md5_vm_test=function(){return"900150983cd24fb0d6963f7d28e17f72"==this.hex_md5("abc").toLowerCase()},MD5.rstr_md5=function(a){return this.binl2rstr(this.binl_md5(this.rstr2binl(a),8*a.length))},MD5.rstr_hmac_md5=function(a,b){var c=this.rstr2binl(a);c.length>16&&(c=this.binl_md5(c,8*a.length));for(var d=Array(16),e=Array(16),f=0;16>f;f++)d[f]=909522486^c[f],e[f]=1549556828^c[f];var g=this.binl_md5(d.concat(this.rstr2binl(b)),512+8*b.length);return this.binl2rstr(this.binl_md5(e.concat(g),640))},MD5.rstr2hex=function(a){for(var b,c=0,d=c?"0123456789ABCDEF":"0123456789abcdef",e="",f=0;f<a.length;f++)b=a.charCodeAt(f),e+=d.charAt(b>>>4&15)+d.charAt(15&b);return e},MD5.rstr2b64=function(a){for(var b="",c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d="",e=a.length,f=0;e>f;f+=3)for(var g=a.charCodeAt(f)<<16|(e>f+1?a.charCodeAt(f+1)<<8:0)|(e>f+2?a.charCodeAt(f+2):0),h=0;4>h;h++)d+=8*f+6*h>8*a.length?b:c.charAt(g>>>6*(3-h)&63);return d},MD5.rstr2any=function(a,b){var c,d,e,f,g,h=b.length,i=Array(Math.ceil(a.length/2));for(c=0;c<i.length;c++)i[c]=a.charCodeAt(2*c)<<8|a.charCodeAt(2*c+1);var j=Math.ceil(8*a.length/(Math.log(b.length)/Math.log(2))),k=Array(j);for(d=0;j>d;d++){for(g=Array(),f=0,c=0;c<i.length;c++)f=(f<<16)+i[c],e=Math.floor(f/h),f-=e*h,(g.length>0||e>0)&&(g[g.length]=e);k[d]=f,i=g}var l="";for(c=k.length-1;c>=0;c--)l+=b.charAt(k[c]);return l},MD5.str2rstr_utf8=function(a){for(var b,c,d="",e=-1;++e<a.length;)b=a.charCodeAt(e),c=e+1<a.length?a.charCodeAt(e+1):0,b>=55296&&56319>=b&&c>=56320&&57343>=c&&(b=65536+((1023&b)<<10)+(1023&c),e++),127>=b?d+=String.fromCharCode(b):2047>=b?d+=String.fromCharCode(192|b>>>6&31,128|63&b):65535>=b?d+=String.fromCharCode(224|b>>>12&15,128|b>>>6&63,128|63&b):2097151>=b&&(d+=String.fromCharCode(240|b>>>18&7,128|b>>>12&63,128|b>>>6&63,128|63&b));return d},MD5.str2rstr_utf16le=function(a){for(var b="",c=0;c<a.length;c++)b+=String.fromCharCode(255&a.charCodeAt(c),a.charCodeAt(c)>>>8&255);return b},MD5.str2rstr_utf16be=function(a){for(var b="",c=0;c<a.length;c++)b+=String.fromCharCode(a.charCodeAt(c)>>>8&255,255&a.charCodeAt(c));return b},MD5.rstr2binl=function(a){var b,c=Array(a.length>>2);for(b=0;b<c.length;b++)c[b]=0;for(b=0;b<8*a.length;b+=8)c[b>>5]|=(255&a.charCodeAt(b/8))<<b%32;return c},MD5.binl2rstr=function(a){for(var b="",c=0;c<32*a.length;c+=8)b+=String.fromCharCode(a[c>>5]>>>c%32&255);return b},MD5.binl_md5=function(a,b){a[b>>5]|=128<<b%32,a[(b+64>>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,f=271733878,g=0;g<a.length;g+=16){var h=c,i=d,j=e,k=f;c=this.md5_ff(c,d,e,f,a[g+0],7,-680876936),f=this.md5_ff(f,c,d,e,a[g+1],12,-389564586),e=this.md5_ff(e,f,c,d,a[g+2],17,606105819),d=this.md5_ff(d,e,f,c,a[g+3],22,-1044525330),c=this.md5_ff(c,d,e,f,a[g+4],7,-176418897),f=this.md5_ff(f,c,d,e,a[g+5],12,1200080426),e=this.md5_ff(e,f,c,d,a[g+6],17,-1473231341),d=this.md5_ff(d,e,f,c,a[g+7],22,-45705983),c=this.md5_ff(c,d,e,f,a[g+8],7,1770035416),f=this.md5_ff(f,c,d,e,a[g+9],12,-1958414417),e=this.md5_ff(e,f,c,d,a[g+10],17,-42063),d=this.md5_ff(d,e,f,c,a[g+11],22,-1990404162),c=this.md5_ff(c,d,e,f,a[g+12],7,1804603682),f=this.md5_ff(f,c,d,e,a[g+13],12,-40341101),e=this.md5_ff(e,f,c,d,a[g+14],17,-1502002290),d=this.md5_ff(d,e,f,c,a[g+15],22,1236535329),c=this.md5_gg(c,d,e,f,a[g+1],5,-165796510),f=this.md5_gg(f,c,d,e,a[g+6],9,-1069501632),e=this.md5_gg(e,f,c,d,a[g+11],14,643717713),d=this.md5_gg(d,e,f,c,a[g+0],20,-373897302),c=this.md5_gg(c,d,e,f,a[g+5],5,-701558691),f=this.md5_gg(f,c,d,e,a[g+10],9,38016083),e=this.md5_gg(e,f,c,d,a[g+15],14,-660478335),d=this.md5_gg(d,e,f,c,a[g+4],20,-405537848),c=this.md5_gg(c,d,e,f,a[g+9],5,568446438),f=this.md5_gg(f,c,d,e,a[g+14],9,-1019803690),e=this.md5_gg(e,f,c,d,a[g+3],14,-187363961),d=this.md5_gg(d,e,f,c,a[g+8],20,1163531501),c=this.md5_gg(c,d,e,f,a[g+13],5,-1444681467),f=this.md5_gg(f,c,d,e,a[g+2],9,-51403784),e=this.md5_gg(e,f,c,d,a[g+7],14,1735328473),d=this.md5_gg(d,e,f,c,a[g+12],20,-1926607734),c=this.md5_hh(c,d,e,f,a[g+5],4,-378558),f=this.md5_hh(f,c,d,e,a[g+8],11,-2022574463),e=this.md5_hh(e,f,c,d,a[g+11],16,1839030562),d=this.md5_hh(d,e,f,c,a[g+14],23,-35309556),c=this.md5_hh(c,d,e,f,a[g+1],4,-1530992060),f=this.md5_hh(f,c,d,e,a[g+4],11,1272893353),e=this.md5_hh(e,f,c,d,a[g+7],16,-155497632),d=this.md5_hh(d,e,f,c,a[g+10],23,-1094730640),c=this.md5_hh(c,d,e,f,a[g+13],4,681279174),f=this.md5_hh(f,c,d,e,a[g+0],11,-358537222),e=this.md5_hh(e,f,c,d,a[g+3],16,-722521979),d=this.md5_hh(d,e,f,c,a[g+6],23,76029189),c=this.md5_hh(c,d,e,f,a[g+9],4,-640364487),f=this.md5_hh(f,c,d,e,a[g+12],11,-421815835),e=this.md5_hh(e,f,c,d,a[g+15],16,530742520),d=this.md5_hh(d,e,f,c,a[g+2],23,-995338651),c=this.md5_ii(c,d,e,f,a[g+0],6,-198630844),f=this.md5_ii(f,c,d,e,a[g+7],10,1126891415),e=this.md5_ii(e,f,c,d,a[g+14],15,-1416354905),d=this.md5_ii(d,e,f,c,a[g+5],21,-57434055),c=this.md5_ii(c,d,e,f,a[g+12],6,1700485571),f=this.md5_ii(f,c,d,e,a[g+3],10,-1894986606),e=this.md5_ii(e,f,c,d,a[g+10],15,-1051523),d=this.md5_ii(d,e,f,c,a[g+1],21,-2054922799),c=this.md5_ii(c,d,e,f,a[g+8],6,1873313359),f=this.md5_ii(f,c,d,e,a[g+15],10,-30611744),e=this.md5_ii(e,f,c,d,a[g+6],15,-1560198380),d=this.md5_ii(d,e,f,c,a[g+13],21,1309151649),c=this.md5_ii(c,d,e,f,a[g+4],6,-145523070),f=this.md5_ii(f,c,d,e,a[g+11],10,-1120210379),e=this.md5_ii(e,f,c,d,a[g+2],15,718787259),d=this.md5_ii(d,e,f,c,a[g+9],21,-343485551),c=this.safe_add(c,h),d=this.safe_add(d,i),e=this.safe_add(e,j),f=this.safe_add(f,k)}return Array(c,d,e,f)},MD5.md5_cmn=function(a,b,c,d,e,f){return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(b,a),this.safe_add(d,f)),e),c)},MD5.md5_ff=function(a,b,c,d,e,f,g){return this.md5_cmn(b&c|~b&d,a,b,e,f,g)},MD5.md5_gg=function(a,b,c,d,e,f,g){return this.md5_cmn(b&d|c&~d,a,b,e,f,g)},MD5.md5_hh=function(a,b,c,d,e,f,g){return this.md5_cmn(b^c^d,a,b,e,f,g)},MD5.md5_ii=function(a,b,c,d,e,f,g){return this.md5_cmn(c^(b|~d),a,b,e,f,g)},MD5.safe_add=function(a,b){var c=(65535&a)+(65535&b),d=(a>>16)+(b>>16)+(c>>16);return d<<16|65535&c},MD5.bit_rol=function(a,b){return a<<b|a>>>32-b},Relation.prototype=Object.create(Node.prototype),Relation.prototype.constructor=Relation,Relation.prototype.destroy=function(){Node.prototype.destroy.call(this),delete this.node0,delete this.node1,delete this.content},Relation.prototype.getOther=function(a){return a==this.node0?this.node1:this.node0},Relation.prototype.clone=function(){var a=new Relation(this.id,this.name,this.node0,this.node1);return a.x=this.x,a.y=this.y,a.z=this.z,a.nodeType=this.nodeType,a.weight=this.weight,a.descentWeight=this.descentWeight,a},NumberOperators.numberToString=function(a,b){for(var c=a.toFixed(b);"0"==c.charAt(c.length-1);)c=c.substring(0,c.length-1);return"."==c.charAt(c.length-1)&&(c=c.substring(0,c.length-1)),c},NumberOperators.getRandomWithSeed=function(a){return a=(9301*a+49297)%233280,a/233280},NumberOperators.numberFromBinaryPositions=function(a){var b,c=0;for(b=0;null!=a[b];b++)c+=Math.pow(2,a[b]);return c},NumberOperators.numberFromBinaryValues=function(a){for(var b=0,c=a.length,d=0;c>d;d++)b+=1==a[d]?Math.pow(2,c-(d+1)):0;return b},NumberOperators.powersOfTwoDecomposition=function(a,b){for(var c,d=new NumberList,e=0;a>e;)c=Math.floor(Math.log(a)/Math.LN2),d[c]=1,a-=Math.pow(2,c);b=Math.max(d.length,null==b?0:b);for(var f=0;b>f;f++)d[f]=1==d[f]?1:0;return d},NumberOperators.positionsFromBinaryValues=function(a){var b,c=new NumberList;for(b=0;null!=a[b];b++)1==a[b]&&c.push(b);return c},NumberOperators._Alea=function(){return function(a){var b=0,c=0,d=0,e=1;0===a.length&&(a=[+new Date]);var f=NumberOperators._Mash();b=f(" "),c=f(" "),d=f(" ");for(var g=0;g<a.length;g++)b-=f(a[g]),0>b&&(b+=1),c-=f(a[g]),0>c&&(c+=1),d-=f(a[g]),0>d&&(d+=1);f=null;var h=function(){var a=2091639*b+2.3283064365386963e-10*e;return b=c,c=d,d=a-(e=0|a)};return h.uint32=function(){return 4294967296*h()},h.fract53=function(){return h()+1.1102230246251565e-16*(2097152*h()|0)},h.version="Alea 0.9",h.args=a,h}(Array.prototype.slice.call(arguments))},NumberOperators._Mash=function(){var a=4022871197,b=function(b){b=b.toString();for(var c=0;c<b.length;c++){a+=b.charCodeAt(c);var d=.02519603282416938*a;a=d>>>0,d-=a,d*=a,a=d>>>0,d-=a,a+=4294967296*d}return 2.3283064365386963e-10*(a>>>0)};return b.version="Mash 0.9",b},NumberOperators.random=new NumberOperators._Alea,NumberOperators.stackRandom=[],NumberOperators.randomSeed=function(a){NumberOperators.stackRandom.push(NumberOperators.random),NumberOperators.stackRandom.length>100&&NumberOperators.stackRandom.shift(),NumberOperators.random=new NumberOperators._Alea("my",a,"seeds"),NumberOperators.lastNormal=NaN},NumberOperators.randomSeedPop=function(){NumberOperators.stackRandom.length>0&&(NumberOperators.random=NumberOperators.stackRandom.pop())},NumberOperators.powerLaw=function(a,b,c){var d=NumberOperators.random(),e=Math.pow((Math.pow(b,c+1)-Math.pow(a,c+1))*d+Math.pow(a,c+1),1/(c+1));return e},NumberOperators.exponential=function(a,b){for(var c=-Math.log(NumberOperators.random())/a;c>1&&b;)c=-Math.log(NumberOperators.random())/a;return c},NumberOperators.pareto=function(a){var b=NumberOperators.random();return 1/Math.pow(1-b,1/a)},NumberOperators.normal=function(a,b){var c=NumberOperators.lastNormal;if(NumberOperators.lastNormal=NaN,!c){var d=2*NumberOperators.random()*Math.PI,e=Math.sqrt(-2*Math.log(1-NumberOperators.random()));c=Math.cos(d)*e,NumberOperators.lastNormal=Math.sin(d)*e}return a+c*b},NumberOperators.weibull=function(a,b,c){for(var d=1-NumberOperators.random(),e=a*Math.pow(-Math.log(d),1/b);e>1&&c;)d=1-NumberOperators.random(),e=a*Math.pow(-Math.log(d),1/b);return e},NumberOperators.betaPERT=function(a,b,c,d){var e=b-a;if(0==e)return a;var f,g=(a+b+d*c)/(d+2);f=Math.abs(g-c)<1e-4?d/2+1:(g-a)*(2*c-a-b)/((c-g)*(b-a));var h=f*(b-g)/(g-a);return NumberOperators.rbeta(f,h)*e+a},NumberOperators.rbeta=function(a,b){var c=NumberOperators.rgamma(a,1);return c/(c+NumberOperators.rgamma(b,1))},NumberOperators.SG_MAGICCONST=1+Math.log(4.5),NumberOperators.LOG4=Math.log(4),NumberOperators.rgamma=function(a,b){var c,d;if(!(a>1)){if(1==a){for(var e=NumberOperators.random();1e-7>=e;)e=NumberOperators.random();return-Math.log(e)*b}for(;;){var f=NumberOperators.random(),g=(Math.E+a)/Math.E,h=g*f;d=1>=h?Math.pow(h,1/a):-Math.log((g-h)/a);var i=NumberOperators.random();if(h>1){if(i<=Math.pow(d,a-1))break}else if(i<=Math.exp(-d))break}return d*b}for(var j=Math.sqrt(2*a-1),k=a-NumberOperators.LOG4,l=a+j;;){var m=NumberOperators.random();if(m>1e-7&&.9999999>m){var n=1-NumberOperators.random();c=Math.log(m/(1-m))/j,d=a*Math.exp(c);var o=m*m*n,p=k+l*c-d;if(p+NumberOperators.SG_MAGICCONST-4.5*o>=0||p>=Math.log(o))return d*b}}},NumberListGenerators.createSortedNumberList=function(a,b,c){b=b||0,c=c||1,0===c&&(c=1);var d,e=new NumberList;for(d=0;a>d;d++)e.push(b+d*c);return e},NumberListGenerators.createNumberListWithinInterval=function(a,b,c,d){null==b&&(b=new Interval(0,1)),c=null==c?0:c;var e,f=new NumberList,g=b.getAmplitude(),h=Number(b.getMin());switch(c){case 0:for(e=0;a>e;e++)f.push(h+Number(Math.random()*g))}return f},NumberListGenerators.createRandomNormalDistribution=function(a,b,c){var d,e=new mo.NumberList;for(d=0;a>d;d++)e.push(NumberOperators.normal(b,c));return e},NumberListGenerators.createRandomBetaPERTDistribution=function(a,b,c,d,e,f){b=null==b?0:b,c=null==c?1:c,d=null==d?.5:d,e=null==e?1:e,f&&NumberOperators.randomSeed(f);var g,h=new mo.NumberList;for(g=0;a>g;g++)h.push(NumberOperators.betaPERT(b,c,d,e));return f&&NumberOperators.randomSeedPop(),h},NumberListGenerators.createRandomBimodalDistribution=function(a,b,c,d,e,f,g,h){b=null==b?0:b,c=null==c?1:c,d=null==d?.25:d,e=null==e?.75:e,f=null==f?1:f,g=null==g?.5:g,h&&NumberOperators.randomSeed(h);var i,j=new mo.NumberList;for(i=0;a>i;i++)NumberOperators.random()>g?j.push(NumberOperators.betaPERT(b,c,d,f)):j.push(NumberOperators.betaPERT(b,c,e,f));return h&&NumberOperators.randomSeedPop(),j},NumberListGenerators.createRandomNumberList=function(a,b,c,d){c=null==c?-1:c,b=null==b?new Interval(0,1):b;for(var e=new NumberList,f=b.getAmplitude(),g=-1==c?Math.random:new NumberOperators._Alea("my",c,"seeds"),h=0;a>h;h++)e[h]=null==d?g()*f+b.x:d(g()*f+b.x);return e},ListConversions.toNumberList=function(a){if(null!=a){var b,c=new NumberList,d=a.length;for(c.name=a.name,b=0;d>b;b++)c[b]=Number(a[b]);return c}},ListConversions.toStringList=function(a){if(null!=a){var b,c=a.length,d=new StringList;for(d.name=a.name,b=0;c>b;b++)d[b]=String(a[b]);return d}},RectangleList.prototype=new List,RectangleList.prototype.constructor=RectangleList,RectangleList.fromArray=function(a){var b=List.fromArray(a);return b.type="RectangleList",b.getFrame=RectangleList.prototype.getFrame,b.add=RectangleList.prototype.add,b.factor=RectangleList.prototype.factor,b.getAddedArea=RectangleList.prototype.getAddedArea,b.getIntersectionArea=RectangleList.prototype.getIntersectionArea,b},RectangleList.prototype.getFrame=function(){if(0===this.length)return null;var a=this[0].clone();a.width=a.getRight(),a.height=a.getBottom();for(var b=1;null!=this[b];b++)a.x=Math.min(a.x,this[b].x),a.y=Math.min(a.y,this[b].y),a.width=Math.max(this[b].getRight(),a.width),a.height=Math.max(this[b].getBottom(),a.height);return a.width-=a.x,a.height-=a.y,a},RectangleList.prototype.add=function(){},RectangleList.prototype.factor=function(){},RectangleList.prototype.getAddedArea=function(){},RectangleList.prototype.getIntersectionArea=function(){for(var a,b,c,d=0,e=0;null!=this[e+1];e++){a=this[e];for(var f=e+1;null!=this[f];f++)b=this[f],c=a.getIntersection(b),d+=null==c?0:c.getArea()}return d},ListGenerators.createListWithSameElement=function(a,b,c){var d;switch(_typeOf(b)){case"number":d=new NumberList;break;case"List":d=new Table;break;case"NumberList":d=new NumberTable;break;case"Rectangle":d=new RectangleList;break;case"string":d=new StringList;break;case"boolean":d=new List;break;default:d=new List}var e;for(e=0;a>e;e++)d[e]=b;return d.name=c,d},ListGenerators.createIterationSequence=function(a,b,c){for(var d=ListGenerators.createListWithSameElement(1,b),e=1;a>e;e++)d[e]=c(d[e-1]);return d},NumberListOperators.dotProduct=function(a,b){var c,d=0,e=Math.min(a.length,b.length);for(c=0;e>c;c++)d+=a[c]*b[c];return d},NumberListOperators.linearRegression=function(a,b,c){c=null==c||c>1?0:c;var d=new NumberList;if(null==a||null==b||a.length!=b.length||0===a.length)return 0===c?d:new _Point;for(var e=0,f=0,g=0,h=0,i=0,j=a.length,k=0;j>k;k++)e+=a[k],f+=b[k],g+=a[k]*a[k],h+=a[k]*b[k],i+=b[k]*b[k];var l=(j*h-e*f)/(j*g-e*e),m=f/j-l*e/j;if(1==c)return new _Point(l,m);var n=Math.pow((j*h-e*f)/Math.sqrt((j*g-e*e)*(j*i-f*f)),2);return d.push(l),d.push(m),d.push(n),d.push(j),d},NumberListOperators.distance=function(a,b){var c,d=0,e=Math.min(a.length,b.length);for(c=0;e>c;c++)d+=Math.pow(a[c]-b[c],2);return Math.sqrt(d)},NumberListOperators.cosineSimilarity=function(a,b){var c=a.getNorm()*b.getNorm();return 0===c?0:a.dotProduct(b)/c},NumberListOperators.covariance=function(a,b){if(null!=a&&null!=b){var c,d=Math.min(a.length,b.length),e=a.getAverage(),f=b.getAverage(),g=0;for(c=0;d>c;c++)g+=(a[c]-e)*(b[c]-f);return g/d}},NumberListOperators.standardDeviationBetweenTwoNumberLists=function(a,b){if(null!=a&&null!=b){var c,d=0,e=Math.min(a.length,b.length);for(c=0;e>c;c++)d+=Math.pow(a[c]-b[c],2);return d/e}},NumberListOperators.pearsonProductMomentCorrelation=function(a,b){if(null!=a&&null!=b){var c=a.getStandardDeviation()*b.getStandardDeviation();return 0===c?0:NumberListOperators.covariance(a,b)/c}},NumberListOperators.normalizedToSum=function(a,b,c){if(null!=a){b=null==b?1:b;var d=new NumberList;if(d.name=a.name,0===a.length)return d;var e;if(c=null==c?a.getSum():c,0===c)return a.clone();for(e=0;e<a.length;e++)d.push(b*a[e]/c);return d}},NumberListOperators.normalized=function(a,b){if(null!=a){if(b=null==b?1:b,0===a.length)return null;var c,d=a.getMinMaxInterval(),e=d.getAmplitude(),f=new NumberList;for(c=0;c<a.length;c++)f.push(b*((a[c]-d.x)/e));return f.name=a.name,f}},NumberListOperators.normalizedByZScore=function(a){if(null!=a){if(0===a.length)return null;var b,c=a.getAverage(),d=a.getStandardDeviation();0==d&&(d=1);var e=new NumberList;for(b=0;b<a.length;b++)e.push((a[b]-c)/d);return e.name=a.name,e}},NumberListOperators.normalizedToMax=function(a,b){if(null!=a){if(b=null==b?1:b,0===a.length)return null;var c=a.getMax();if(0===c&&(c=a.getMin(),0===c))return ListGenerators.createListWithSameElement(a.length,0);for(var d=new NumberList,e=0;null!=a[e];e++)d.push(b*(a[e]/c));return d.name=a.name,d}},NumberListOperators.shorten=function(a,b){if(null==a)return null;if(null==b||b>=a.length)return a;var c,d,e,f,g=a.length/b,h=new NumberList,i=Math.floor(g);for(h.name=a.name,d=0;b>d;d++){for(f=Math.floor(d*g),c=0,e=0;i>e;e++)c+=a[f+e];h[d]=c/i}return h},NumberListOperators.simplify=function(a,b,c){b=b||0,c=c||0;var d=new NumberList;switch(d.name=a.name,b){case 0:var e=Math.pow(10,c);a.forEach(function(a){d.push(Math.floor(a/e)*e)});break;case 1:}return d},NumberListOperators.linearKMeans=function(a,b,c){if(null==a||null==b||0>=b)return null;var d,e,f,g,h,i,j,k=a.getInterval(),l=k.x,m=k.y,n=new NumberTable,o=(m-l)/b,p=1e3,q=new NumberList,r=new NumberList,s=new NumberList,t=a.length,u=1+m-l;for(d=0;b>d;d++)n[d]=new NumberList,r[d]=l+(d+.5)*o;for(j=0;p>j;j++){for(d=0;b>d;d++)s[d]=0,q[d]=r[d],r[d]=0;for(d=0;t>d;d++){for(g=a[d],i=u,f=0,e=0;b>e;e++)h=Math.abs(g-q[e]),i>h&&(i=h,f=e);j==p-1&&(c?n[f].push(d):n[f].push(g)),s[f]++,r[f]=((s[f]-1)*r[f]+g)/s[f]}}return n},NumberListOperators.averageSmoother=function(a,b,c){if(null!=a){c=null==c?1:c,b=null==b?.1:b,b=Math.max(Math.min(b,.5),0);var d,e=1-2*b,f=a.length-1,g=a.clone(),h=function(c,d,g){g[d]=e*c+(d>0?a[d-1]*b:0)+(f>d?a[d+1]*b:0)},i=function(a,c,d){d[c]=e*a+(c>0?d[c-1]*b:0)+(f>c?d[c+1]*b:0)};for(d=0;c>d;d++)0===d?g.forEach(h):g.forEach(i);return g.name=a.name,g}},NumberListOperators.filterNumberListByInterval=function(a,b,c,d,e,f){return null},NumberListOperators.filterNumberListByNumber=function(a,b,c,d){d=d||!1;var e,f=new NumberList;if(d)switch(c){case"<":for(e=0;null!=a[e];e++)a[e]<b&&f.push(e);break;case"<=":for(e=0;null!=a[e];e++)a[e]<=b&&f.push(e);break;case">":for(e=0;null!=a[e];e++)a[e]>b&&f.push(e);break;case">=":for(e=0;null!=a[e];e++)a[e]>=b&&f.push(e);break;case"==":for(e=0;null!=a[e];e++)a[e]==b&&f.push(e);break;case"!=":for(e=0;null!=a[e];e++)a[e]!=b&&f.push(e)}else switch(c){case"<":for(e=0;null!=a[e];e++)a[e]<b&&f.push(a[e]);break;case"<=":for(e=0;null!=a[e];e++)a[e]<=b&&f.push(a[e]);break;case">":for(e=0;null!=a[e];e++)a[e]>b&&f.push(a[e]);break;case">=":for(e=0;null!=a[e];e++)a[e]>=b&&f.push(a[e]);break;case"==":for(e=0;null!=a[e];e++)a[e]==b&&f.push(a[e]);break;case"!=":for(e=0;null!=a[e];e++)a[e]!=b&&f.push(a[e])}return f},NumberListOperators.frameFromTwoNumberLists=function(a,b){if(null!=a&&null!=b){var c=a.getInterval(),d=b.getInterval();return new Rectangle(c.x,d.x,c.getAmplitude(),d.getAmplitude())}},NumberListOperators.rangeCounts=function(a,b,c){if(null!=a){b=null==b?100:b,c=null==c?a.getInterval():c;for(var d,e,f=ListGenerators.createListWithSameElement(b,0),g=a.length,h=0;g>h;h++)d=c.getInverseInterpolatedValue(a[h]),e=Math.min(Math.floor(d*b),b-1),
f[e]++;return f}},ColorScales.blackScale=function(){return"black"},ColorScales.grayscale=function(a){var b=ColorOperators.interpolateColorsRGB([0,0,0],[255,255,255],a);return ColorOperators.RGBtoHEX(b[0],b[1],b[2])},ColorScales.antiGrayscale=function(a){var b=ColorOperators.interpolateColorsRGB([255,255,255],[0,0,0],a);return ColorOperators.RGBtoHEX(b[0],b[1],b[2])},ColorScales.antiTemperature=function(a){return ColorScales.temperature(1-a)},ColorScales.temperature=function(a){var b="#FFFFFF";return b=.2>a?ColorOperators.interpolateColors("#000000",ColorOperators.HSVtoHEX(234,1,1),5*a):a>.85?ColorOperators.interpolateColors(ColorOperators.HSVtoHEX(0,1,1),"#FFFFFF",(a-.85)/.15):ColorOperators.HSVtoHEX(Math.round(360*(.65-(a-.2))),1,1)},ColorScales.sqrtTemperature=function(a){return ColorScales.temperature(Math.sqrt(a))},ColorScales.sqrt4Temperature=function(a){return ColorScales.temperature(Math.pow(a,.25))},ColorScales.quadraticTemperature=function(a){return ColorScales.temperature(Math.pow(a,2))},ColorScales.cubicTemperature=function(a){return ColorScales.temperature(Math.pow(a,3))},ColorScales.greenToRed=function(a){var b=ColorOperators.interpolateColorsRGB([50,255,50],[255,50,50],a);return ColorOperators.RGBtoHEX(b[0],b[1],b[2])},ColorScales.greenToBlue=function(a){var b=ColorOperators.interpolateColorsRGB([50,255,50],[50,50,255],a);return ColorOperators.RGBtoHEX(b[0],b[1],b[2])},ColorScales.grayToOrange=function(a){return"rgb("+Math.floor(100+155*a)+","+Math.floor(100+10*a)+","+Math.floor(100-100*a)+")"},ColorScales.sqrt4GrayToOrange=function(a){return ColorScales.grayToOrange(Math.pow(a,.25))},ColorScales.blueToRed=function(a){return"rgb("+Math.floor(255*a)+",0,"+Math.floor(255*(1-a))+")"},ColorScales.blueToRedAlpha=function(a){return"rgba("+Math.floor(255*a)+",0,"+Math.floor(255*(1-a))+", 0.5)"},ColorScales.whiteToRed=function(a){var b=Math.floor(255-255*a);return"rgb(255,"+b+","+b+")"},ColorScales.redToBlue=function(a){var b=ColorOperators.interpolateColorsRGB([255,0,0],[0,0,255],a);return ColorOperators.RGBtoHEX(b[0],b[1],b[2])},ColorScales.greenWhiteRed=function(a){var b=[0,0,0];return b=.5>a?ColorOperators.interpolateColorsRGB([50,255,50],[255,255,255],2*a):ColorOperators.interpolateColorsRGB([255,255,255],[255,50,50],2*(a-.5)),"rgb("+b[0]+","+b[1]+","+b[2]+")"},ColorScales.blueWhiteRed=function(a){var b=.5>a?Math.floor(510*a):255,c=.5>a?Math.floor(510*a):Math.floor(510*(1-a)),d=.5>a?255:Math.floor(510*(1-a));return"rgb("+b+","+c+","+d+")"},ColorScales.grayBlackOrange=function(a){var b=[0,0,0];return b=.5>a?ColorOperators.interpolateColorsRGB([100,100,100],[0,0,0],2*a):ColorOperators.interpolateColorsRGB([0,0,0],[255,110,0],2*(a-.5)),"rgb("+b[0]+","+b[1]+","+b[2]+")"},ColorScales.grayWhiteOrange=function(a){var b=[0,0,0];return b=.5>a?ColorOperators.interpolateColorsRGB([100,100,100],[255,255,255],2*a):ColorOperators.interpolateColorsRGB([255,255,255],[255,110,0],2*(a-.5)),"rgb("+b[0]+","+b[1]+","+b[2]+")"},ColorScales.solar=function(a){var b=ColorOperators.interpolateColorsRGB([0,0,0],ColorOperators.interpolateColorsRGB([255,0,0],[255,255,0],a),Math.pow(.99*a+.01,.2));return ColorOperators.RGBtoHEX(b[0],b[1],b[2])},ColorScales.antiSolar=function(a){return ColorOperators.invertColor(ColorScales.solar(a))},ListOperators.getElement=function(a,b){return null==a?null:(b=null==b?0:b%a.length,a[b])},ListOperators.getFirstElements=function(a,b){return null==a?null:(b=null==b?0:Number(b),[{type:"Object",name:"first value",description:"first value",value:a[b+0]},{type:"Object",name:"second value",description:"second value",value:a[b+1]},{type:"Object",name:"third value",description:"third value",value:a[b+2]},{type:"Object",name:"fourth value",description:"fourth value",value:a[b+3]},{type:"Object",name:"fifth value",description:"fifth value",value:a[b+4]},{type:"Object",name:"sixth value",description:"sixth value",value:a[b+5]},{type:"Object",name:"seventh value",description:"seventh value",value:a[b+6]},{type:"Object",name:"eight value",description:"eight value",value:a[b+7]},{type:"Object",name:"ninth value",description:"ninth value",value:a[b+8]},{type:"Object",name:"tenth value",description:"tenth value",value:a[b+9]}])},ListOperators.containSameElements=function(a,b){if(null==a||null==b)return null;var c,d=a.length;if(d==b.length){for(c=0;d>c;c++)if(a[c]!=b[c])return!1;return!0}},ListOperators.indexOf=function(a,b){return a.indexOf(b)},ListOperators.concat=function(){if(null==arguments||0===arguments.length||null==arguments[0])return null;if(1==arguments.length)return arguments[0];var a,b=arguments[0].concat(arguments[1]);for(a=2;arguments[a];a++)b=b.concat(arguments[a]);return b.getImproved()},ListOperators.assemble=function(){return List.fromArray(Array.prototype.slice.call(arguments,0)).getImproved()},ListOperators.reverse=function(a){return a.getReversed()},ListOperators.getBooleanDictionaryForList=function(a){if(null!=a){var b={};return a.forEach(function(a){b[a]=!0}),b}},ListOperators.getSingleIndexDictionaryForList=function(a){if(null!=a){var b,c=a.length,d={};for(b=0;c>b;b++)d[a[b]]=b;return d}},ListOperators.getIndexesDictionary=function(a){var b={};return a.forEach(function(a,c){null==b[a]&&(b[a]=new NumberList),b[a].push(c)}),b},ListOperators.getIndexesTable=function(a){var b=new Table;b[0]=new List,b[1]=new NumberTable;var c,d={};return a.forEach(function(a,e){c=d[a],null==c?(b[0].push(a),b[1].push(new NumberList(e)),d[a]=b[0].length-1):b[1][c].push(e)}),b[0]=b[0].getImproved(),b},ListOperators.buildDictionaryObjectForDictionary=function(a){if(!(null==a||a.length<2)){var b={};return a[0].forEach(function(c,d){b[c]=a[1][d]}),b}},ListOperators.translateWithDictionary=function(a,b,c){if(!(null==a||null==b||b.length<2)){var d=ListOperators.buildDictionaryObjectForDictionary(b),e=ListOperators.translateWithDictionaryObject(a,d,c);return e.dictionaryObject=d,e}},ListOperators.translateWithDictionaryObject=function(a,b,c){if(null!=a&&null!=b){var d,e=new List,f=a.length;for(d=0;f>d;d++)e[d]=b[a[d]];if(null!=c){var g=a.length;for(d=0;g>d;d++)null==e[d]&&(e[d]=c)}return e.name=a.name,e.getImproved()}},ListOperators.sortListByNumberList=function(a,b,c){if(null==c&&(c=!0),0===b.length)return a;var d,e=[],f=instantiate(_typeOf(a));for(d=0;null!=a[d];d++)e.push([a[d],b[d],d]);for(c?e.sort(function(a,b){return b[1]-a[1]}):e.sort(function(a,b){return a[1]-b[1]}),d=0;null!=e[d];d++)f.push(e[d][0]);return f.name=a.name,f},ListOperators.getRankings=function(a,b,c){if(null==a)return null;b=null==b?!0:b;var d=NumberListGenerators.createSortedNumberList(a.length);d=d.getSortedByList(a,b,c);var e,f=new NumberList,g=a.length;for(e=0;g>e;e++)f[d[e]]=e;return f.name="rankings",f},ListOperators.sortListByIndexes=function(a,b){var c=instantiate(_typeOf(a));c.name=a.name;var d,e=a.length;for(d=0;e>d;d++)c.push(a[b[d]]);return c},ListOperators.concatWithoutRepetitions=function(){var a=arguments.length;if(0!==a){if(1==a)return arguments[0];var b,c,d,e,f=arguments[0].clone(),g=ListOperators.getBooleanDictionaryForList(f);for(b=1;a>b;b++)for(d=arguments[b],e=d.length,c=0;e>c;c++)g[d[c]]||f.push(d[c]);return f.getImproved()}},ListOperators.slidingWindowOnList=function(a,b,c,d){d=d||0;var e,f,g,h=new Table,i=a.length;switch(c=Math.max(1,c),d){case 0:for(f=0;i>f;f+=c)if(i>=f+b){for(e=new List,g=0;b>g;g++)e.push(a[f+g]);h.push(e.getImproved())}break;case 1:for(f=0;i>f;f+=c){for(e=new List,g=0;g<Math.min(b,i-f);g++)e.push(a[f+g]);h.push(e.getImproved())}break;case 2:for(f=0;i>f;f+=c){for(e=new List,g=0;b>g;g++)e.push(a[(f+g)%i]);h.push(e.getImproved())}}return h.getImproved()},ListOperators.getNewListForObjectType=function(a){var b=new List;return b[0]=a,instantiateWithSameType(b.getImproved())},ListOperators.union=function(a,b){if(null!=a&&null!=b){var c,d,e=new List,f=a.length,g=b.length;if("NodeList"==a.type||"NodeList"==b.type){for(e=new NodeList,e=a.clone(),c=0;g>c;c++)null==a.getNodeById(b[c].id)&&e.addNode(b[c]);return e}var h={};for(c=0;f>c;c++)h[a[c]]=a[c];for(c=0;g>c;c++)h[b[c]]=b[c];for(d in h)e.push(h[d]);return e.getImproved()}},ListOperators.intersection=function(a,b){if(null!=a&&null!=b){var c,d,e,f=b.length;if("NodeList"==a.type&&"NodeList"==b.type)return c=new NodeList,a.forEach(function(a){b.getNodeById(a.id)&&c.addNode(a)}),c;var g=ListOperators.getBooleanDictionaryForList(a),h={};for(c=new List,d=0;f>d;d++)e=b[d],g[e]&&null==h[e]&&(h[e]=!0,c.push(e));return c.getImproved()}},ListOperators.getCommonElements=function(a,b){for(var c="NumberList"==a.type&&"NumberList"==b.type,d="StringList"==a.type&&"StringList"==b.type,e=c?new NumberList:d?new StringList:new List,f=a.length<b.length?a:b,g=a==f?b:a,h=0;null!=f[h];h++)-1!=g.indexOf(f[h])&&e.push(f[h]);return c||d?e:e.getImproved()},ListOperators.jaccardIndex=function(a,b){return ListOperators.intersection(a,b).length/ListOperators.union(a,b).length},ListOperators.jaccardDistance=function(a,b){return 1-ListOperators.jaccardIndex(a,b)},ListOperators.aggregateList=function(a,b,c,d){if(null==a||null==b)return null;var e=new Table;if(null==d&&(d=ListOperators.getIndexesTable(a)),11==c)return d;if(e[0]=d[0],0===c&&a==b)return e[1]=d[0],e;c=null==c?0:c;var f,g;switch(c){case 0:return e[1]=new List,d[1].forEach(function(a){e[1].push(b[a[0]])}),e[1]=e[1].getImproved(),e;case 1:return e[1]=new NumberList,d[1].forEach(function(a){e[1].push(a.length)}),e;case 2:case 3:var h;return e[1]=new NumberList,d[1].forEach(function(a){h=0,a.forEach(function(a){h+=b[a]}),3==c&&(h/=a.length),e[1].push(h)}),e;case 4:var i;return e[1]=new NumberList,d[1].forEach(function(a){i=99999999999,a.forEach(function(a){i=Math.min(i,b[a])}),e[1].push(i)}),e;case 5:var j;return e[1]=new NumberList,d[1].forEach(function(a){j=-99999999999,a.forEach(function(a){j=Math.max(j,b[a])}),e[1].push(j)}),e;case 6:var k;return e=ListOperators.aggregateList(a,b,3,d),d[1].forEach(function(a,c){h=0,k=e[1][c],a.forEach(function(a){h+=Math.pow(b[a]-k,2)}),e[1][c]=Math.sqrt(h/a.length)}),e;case 7:return e[1]=new Table,d[1].forEach(function(a){f=new List,e[1].push(f),a.forEach(function(a){f.push(b[a])}),f=f.getImproved()}),e.getImproved();case 8:return e[1]=new List,d[1].forEach(function(a){e[1].push(b[a[a.length-1]])}),e[1]=e[1].getImproved(),e;case 9:return e[1]=new List,g=ListOperators.aggregateList(a,b,7,d),g[1].forEach(function(a){e[1].push(a.getMostRepeatedElement())}),e[1]=e[1].getImproved(),e;case 10:return e[1]=new List,d[1].forEach(function(a){e[1].push(b[a[Math.floor(Math.random()*a.length)]])}),e[1]=e[1].getImproved(),e;case 11:break;case 12:return e[1]=new NumberList,g=ListOperators.aggregateList(a,b,7,d),g[1].forEach(function(a){e[1].push(a.getWithoutRepetitions().length)}),e;case 13:return e[1]=new List,g=ListOperators.aggregateList(a,b,7,d),g[1].forEach(function(a){e[1].push(a.getWithoutRepetitions())}),e[1]=e[1].getImproved(),e;case 14:return e[1]=new StringList,g=ListOperators.aggregateList(a,b,7,d),g[1].forEach(function(a){e[1].push(a.join(", "))}),e;case 15:return e[1]=new StringList,g=ListOperators.aggregateList(a,b,7,d),g[1].forEach(function(a){e[1].push(a.getWithoutRepetitions().join(", "))}),e}return null},ListOperators.subCategoricalAnalysis=function(a,b){if(null!=a&&null!=b){var c,d,e,f={},g=!0;for(e=0;null!=a[e];e++)if(c=a[e],d=f[c],null==d)f[c]=b[e];else if(d!=b[e]){g=!1;break}f={};var h=!0;for(e=0;null!=b[e];e++)if(c=b[e],d=f[c],null==d)f[c]=a[e];else if(d!=a[e]){h=!1;break}return h&&g?1:g?2:h?3:0}},ListOperators.getListEntropy=function(a,b,c){if(null!=a){if(a.length<2)return 1==a.length?(a._mostRepresentedValue=a[0],a._biggestProbability=1,null!=b&&(a._P_valueFollowing=a[0]==b?1:0)):null!=b&&(a._P_valueFollowing=0),0;null==c&&(c=a.getFrequenciesTable(!0)),a._mostRepresentedValue=c[0][0];var d=a.length;if(a._biggestProbability=c[1][0]/d,1==c[0].length)return a._P_valueFollowing=a[0]==b?1:0,0;var e,f,g=0,h=Math.log(c[0].length),i=c[1].length;for(e=0;i>e;e++)f=c[1][e],g-=f/d*Math.log(f/d)/h;if(null!=b){var j=c[0].indexOf(b);a._P_valueFollowing=-1==j?0:c[1][j]/d}return g}},ListOperators.getInformationGain=function(a,b){if(null==a||null==b||a.length!=b.length)return null;var c=ListOperators.getListEntropy(b),d={},e=[],f=a.length;return a.forEach(function(a,c){null==d[a]&&(d[a]=new List,e.push(d[a])),d[a].push(b[c])}),e.forEach(function(a){c-=a.length/f*ListOperators.getListEntropy(a)}),c},ListOperators.getInformationGainAnalysis=function(a,b){if(null==a||null==b||a.length!=b.length)return null;var c,d=ListOperators.getListEntropy(b),e={},f=[],g=a.length,h=new List;return a.forEach(function(a,c){null==e[a]&&(e[a]=new List,f.push(e[a])),e[a].push(b[c])}),f.forEach(function(a){c=ListOperators.getListEntropy(a),d-=a.length/g*c,h.push({children:a,entropy:c,infoGain:d})}),h},ListOperators.groupElements=function(a,b,c,d){if(a){var e=ListOperators._groupElements_Base(a,null,b,c,d);return e}},ListOperators.groupElementsByPropertyValue=function(a,b,c,d,e){if(a){var f=ListOperators._groupElements_Base(a,b,c,d,e);return f}},ListOperators._groupElements_Base=function(a,b,c,d,e){if(a){void 0==d&&(d=0);var f,g,h,i,j,k={},l=new Table;for(j=0;j<a.length;j++)g=a[j],f=void 0==b?g:g[b],void 0===k[f]&&(k[f]=new List,k[f].name=f,k[f].valProperty=f,l.push(k[f])),0===d?k[f].push(g):1==d&&k[f].push(j),(void 0===h||h>f)&&(h=f),(void 0===i||f>i)&&(i=f);if(e){var m=0;for(j=h;i>j;j++)void 0===k[j]&&(k[j]=new List,k[j].name=j,k[j].valProperty=j,l.push(k[j]),m++)}return c&&(l=l.getSortedByProperty("name")),l}},ListOperators.getReport=function(a,b){var c,d="\n"+(b>0?StringOperators.repeatString(" ",b):""),e=b>0?d+"////report of instance of List////":"///////////report of instance of List//////////",f=a.length;if(e+=d+"name: "+a.name,e+=d+"type: "+a.type,0===f)return e+=d+"single element: ["+a[0]+"]";switch(e+=d+"length: "+f,e+=d+"first element: ["+a[0]+"]",a.type){case"NumberList":var g=a.getMin(),h=a.getMax();a.min=g,a.max=h;var i=a.getAverage();a.average=i,e+=d+"min: "+g,e+=d+"max: "+h,e+=d+"average: "+i,101>f&&(e+=d+"numbers: "+a.join(", "));break;case"StringList":case"List":case"ColorList":var j=a.getFrequenciesTable(!0);for(a._freqTable=j,e+=d+"number of different elements: "+j[0].length,e+=j[0].length<10?d+"elements frequency:":d+"some elements frequency:",c=0;null!=j[0][c]&&10>c;c++)e+=d+" ["+String(j[0][c])+"]: "+j[1][c];var k;k="List"==a.type?a.join("], ["):ListConversions.toStringList(a).join("], ["),k.length<2e3&&(e+=d+"strings: ["+k+"]")}return e},ListOperators.getReportHtml=function(a,b){var c,d="<br>"+(b>0?StringOperators.repeatString("&nbsp",b):""),e=b>0?"":'<b><font style="font-size:18px">list report</f></b>',f=a.length;if(e+=a.name?d+"name: <b>"+a.name+"</b>":d+"<i>no name</i>",e+=d+"type: <b>"+a.type+"</b>",0===f)return e+=d+"single element: [<b>"+a[0]+"</b>]";switch(e+=d+"length: <b>"+f+"</b>",e+=d+"first element: [<b>"+a[0]+"</b>]",a.type){case"NumberList":var g=9999999,h=-9999999,i=0,j=new NumberList,k=0,l=0,m=-99999,n=Math.max(Math.floor(a.length/50),1);for(a.forEach(function(a){g=Math.min(g,a),h=Math.max(h,a),i+=a,l+=a,k++,k==n&&(l/=k,m=Math.max(m,l),j.push(l),l=0,k=0)}),0!==k&&(l/=k,m=Math.max(m,l),j.push(l)),j=j.factor(1/m),i/=a.length,a.min=g,a.max=h,a.average=i,e+=d+"min: <b>"+g+"</b>",e+=d+"max: <b>"+h+"</b>",e+=d+"average: <b>"+i+"</b>",101>f&&(e+=d+"numbers: <b>"+a.join("</b>, <b>")+"</b>"),e+=d,c=0;null!=j[c];c++)e+='<font style="font-size:7px"><font color="'+ColorOperators.colorStringToHEX(ColorScales.grayToOrange(j[c]))+'">█</f></f>';break;case"StringList":case"List":case"ColorList":var o=a.getFrequenciesTable(!0);a._freqTable=o;var p=ColorListGenerators.createCategoricalColors(2,o[0].length);for(e+=d+"entropy: <b>"+NumberOperators.numberToString(ListOperators.getListEntropy(a,null,o),4)+"</b>",e+=d+"number of different elements: <b>"+o[0].length+"</b>",e+=o[0].length<10?d+"elements frequency:":d+"some elements frequency:",c=0;null!=o[0][c]&&10>c;c++)e+=d+" [<b>"+String(o[0][c])+'</b>]: <font style="font-size:10px"><b><font color="'+ColorOperators.colorStringToHEX(p[c])+'">'+o[1][c]+"</f></b></f>";var q;q="List"==a.type?a.join("], ["):ListConversions.toStringList(a).join("], ["),q.length<2e3&&(e+=d+"contents: ["+q+"]");var r=NumberListOperators.normalizedToSum(o[1]),s=StringOperators.createsCategoricalColorsBlocksHtml(r,55,p);e+=d,e+='<font style="font-size:7px">'+s+"</f>"}return e},ColorListGenerators._HARDCODED_CATEGORICAL_COLORS=new ColorList("#d62728","#1f77b4","#2ca02c","#ff7f00","#9467bd","#bcbd22","#8c564b","#17becf","#dd4411","#206010","#e377c2","#2200bb","#dd8811","#ff220e","#1f66a3","#8c453a","#2ba01c","#dfc500","#945600","#ff008b","#e37700","#7f7f7f"),ColorListGenerators.createDefaultCategoricalColorList=function(a,b,c,d){b=null==b?1:b,d=null==d?!1:d;var e=ColorListGenerators.createCategoricalColors(2,a,null,null,null,null,null,d);return 1>b&&(e=e.addAlpha(b)),c&&(e=e.getInverted()),e},ColorListGenerators.colorsForCategoricalList=function(a){return ColorListGenerators.createCategoricalColorListForList(a)[0].value},ColorListGenerators.createCategoricalColorListForList=function(a,b,c,d,e,f,g){if(!a)return new ColorList;c||(c=1),d||(d="#fff"),e||(e=0),g=null==g?!1:g,a=List.fromArray(a);var h,i=a.getWithoutRepetitions();h=b&&0!==e?b.getInterpolated(d,e):ColorListGenerators.createCategoricalColors(2,i.length,null,c,d,e,b,g),1>c&&(h=h.addAlpha(c)),f&&(h=h.getInverted());var j=Table.fromArray([i,h]),k=ListOperators.buildDictionaryObjectForDictionary(j),l=ListOperators.translateWithDictionary(a,j,"black");return l=ColorList.fromArray(l),[{value:l,type:"ColorList"},{value:i,type:i.type},{value:h,type:"ColorList"},{value:new Table(i,l),type:"Table"},{value:k,type:"Object"}]},ColorListGenerators.createColorListFromNumberList=function(a,b,c){if(null==a)return null;c=null==c?0:c,b=null==b?ColorScales.grayToOrange:b;var d,e,f=new ColorList;switch(c){case 0:d=NumberListOperators.normalizedToMax(a);break;case 1:break;case 2:}for(e=0;null!=d[e];e++)f.push(b(d[e]));return f},ColorListGenerators.createColorListWithSingleColor=function(a,b){for(var c=new ColorList,d=0;a>d;d++)c.push(b);return c},ColorListGenerators.createColorListSpectrum=function(a,b,c){a=null==a?8:a,b=null==b?1:b,c=null==c?1:c;for(var d,e=new ColorList,f=0;a>f;f++)d=360*f/a,e.push(ColorOperators.HSVtoHEX(d,b,c));return e},ColorListGenerators.createCategoricalColors=function(a,b,c,d,e,f,g,h){c=null==c?ColorScales.temperature:c,h=null==h?!1:h;var i,j=new ColorList;switch(a){case 0:for(i=0;b>i;i++)j[i]=c(i/(b-1));break;case 1:var k=NumberListGenerators.createRandomNumberList(b,null,0);for(i=0;b>i;i++)j[i]=c(k[i]);break;case 2:g=null==g?ColorListGenerators._HARDCODED_CATEGORICAL_COLORS:g;var l;for(i=0;b>i;i++)if(j[i]=g[i%g.length],h&&i>=g.length){l=Math.floor(i/g.length);for(var m=0;l>m;m++)j[i]=ColorOperators.interpolateColors(j[i],"black",.2)}break;case 3:j=ColorListGenerators.createColorListSpectrum(b);break;case 4:case 5:var n,m,o,p=NumberListGenerators.createRandomNumberList(1001,null,0),q=NumberListGenerators.createSortedNumberList(b),r=NumberListGenerators.createRandomNumberList(b,null,0),s=ListOperators.sortListByNumberList(q,r),t=Math.floor(2*b)+100,u=Math.floor(.6*b)+5,v=4==a,w=4==a,x=ColorListGenerators._evaluationFunction(s,v,w),y=s,z=0;for(i=0;t>i;i++){for(m=0;u>m;m++)n=ColorListGenerators._sortingVariation(s,p[z],p[z+1]),z=(z+2)%1001,o=ColorListGenerators._evaluationFunction(n,v,w),o>x&&(y=n,x=o);s=y}if(4==a){var A=ColorListGenerators.createColorListSpectrum(b);for(i=0;b>i;i++)j.push(A[s[i]])}else for(i=0;b>i;i++)j.push(c(1/b+s[i]/(b+1)))}return null!=e&&null!=f&&(j=j.getInterpolated(e,f)),d&&(j=j.addAlpha(d)),j},ColorListGenerators._sortingVariation=function(a,b,c){var d=a.clone(),e=Math.floor(b*d.length),f=Math.floor(c*d.length),g=d[f];return d[f]=d[e],d[e]=g,d},ColorListGenerators._evaluationFunction=function(a,b,c){for(var d,e,f,g=0,h=a.length,i=Math.floor(h/2),j=c?4:1,k=1;j>=k;k++)for(f=k*k,d=0;null!=a[d+k];d++)e=Math.abs(a[d+k]-a[d]),b&&e>i&&(e=h-e),g+=Math.sqrt(e/f);return g},ColorListGenerators.createCategoricalColorListDictionaryObject=function(a,b,c,d,e,f){if(null!=a){var g=a.getWithoutRepetitions(),h=ColorListGenerators.createCategoricalColors(2,g.length,null,c,d,e,b);f&&(h=h.getInverted());var i,j={},k=h.length;for(i=0;k>i;i++)j[g[i]]=h[i];return j}},StringOperators.ENTER=String.fromCharCode(13),StringOperators.ENTER2=String.fromCharCode(10),StringOperators.ENTER3=String.fromCharCode(8232),StringOperators.SPACE=String.fromCharCode(32),StringOperators.SPACE2=String.fromCharCode(160),StringOperators.TAB=" ",StringOperators.TAB2=String.fromCharCode(9),StringOperators.LINK_REGEX=/(^|\s+)(https*\:\/\/\S+[^\.\s+])/,StringOperators.MAIL_REGEX=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,StringOperators.STOP_WORDS=StringList.fromArray("t,s,mt,rt,re,m,http,amp,a,able,about,across,after,all,almost,also,am,among,an,and,any,are,as,at,be,because,been,but,by,can,cannot,could,dear,did,do,does,either,else,ever,every,for,from,get,got,had,has,have,he,her,hers,him,his,how,however,i,if,in,into,is,it,its,just,least,let,like,likely,may,me,might,most,must,my,neither,no,nor,not,of,off,often,on,or,other,our,own,rather,said,say,says,she,should,since,so,some,than,that,the,their,them,then,there,these,they,this,tis,to,too,twas,us,wants,was,we,were,what,when,where,which,while,who,whom,why,will,with,would,yet,you,your".split(",")),StringOperators.split=function(a,b){return null==b?StringOperators.splitByEnter(a):StringList.fromArray(a.split(b))},StringOperators.splitByEnter=function(a){if(null==a)return null;var b=StringOperators.splitString(a,"\n");return b.length>1?b:(b=StringOperators.splitString(a,StringOperators.ENTER2),b.length>1?b:(b=StringOperators.splitString(a,StringOperators.ENTER3),b.length>1?b:new StringList(a)))},StringOperators.replaceStringInText=function(a,b,c){return null==a||null==b||null==c?null:(b instanceof RegExp||(b=new RegExp(b,"g")),a.replace(b,c))},StringOperators.replaceStringsInText=function(a,b,c,d){if(null==a||null==b||null==c)return null;var e,f,g=a,h=b.length;for(e=0;h>e;e++)f=b[e],f instanceof RegExp||(f=d?new RegExp("\\b"+f+"\\b","g"):new RegExp(f,"g")),g=g.replace(f,c);return g},StringOperators.getWords=function(a,b,c,d,e,f,g){if(null==a)return null;var h;g=g||0,b=null==b?!0:b,d=null==d?!0:d,e=null==e?!0:e,f=null==f?0:f;var i,j;e&&(h=a.match(StringOperators.LINK_REGEX)),a=a.toLowerCase().replace(StringOperators.LINK_REGEX,"");var k=a.match(/\w+/g);if(null==k)return new StringList;k=StringList.fromArray(k),e&&null!=h&&(k=k.concat(h)),k=StringList.fromArray(k).replace(/ /g,"");var l;if(null!=c){l=k.length;var m=c.length;for(i=0;l>i;i++)for(j=0;m>j;j++)if("string"==typeof c[j]){if(c[j]==k[i]){k.splice(i,1),i--,l=k.length;break}}else if(c[j].test(k[i])){k.splice(i,1),i--,l=k.length;break}}if(g>0)for(l=k.length,i=0;l>i;i++)k[i].length<g&&(k.splice(i,1),i--,l=k.length);if(d){if(b)return k=k.getFrequenciesTable(!0)[0],0!==f&&(k=k.substr(0,f)),k;var n=k.getFrequenciesTable();return k=k.getSortedByList(n),0!==f&&(k=k.substr(0,f)),k}return b&&(k=k.getWithoutRepetitions()),0!==f&&(k=k.splice(0,f)),k},StringOperators.substr=function(a,b,c){return b=b||0,a.substr(b,c)},StringOperators.splitString=function(a,b){return null==a?null:(null==b&&(b=","),"string"==typeof b&&(b=b.replace("\\n","\n")),-1==a.indexOf(b)?new StringList(a):StringList.fromArray(a.split(b)))},StringOperators.getFirstTextBetweenStrings=function(a,b,c){var d=a.indexOf(b);if(-1==d)return null;if(""===c||null==c)return a.substr(d+b.length);var e=a.indexOf(c,d+b.length+1);return-1==e?a.substring(d+b.length):a.substr(d+b.length,e-(d+b.length))},StringOperators.getAllTextsBetweenStrings=function(a,b,c){if(-1==a.indexOf(b))return new StringList;var d,e,f,g=a.split(b),h=g.length,i=new StringList;for(f=1;h>f;f++)d=g[f],c==b?i.push(d):(e=d.indexOf(c),e>=0&&i.push(d.substr(0,e)));return i},StringOperators.countWordsDichotomyAnalysis=function(a,b,c,d){var e=0;return b.forEach(function(b){e-=StringOperators.countWordOccurrences(a,b)}),c.forEach(function(b){e+=StringOperators.countWordOccurrences(a,b)}),d&&(e/=a.length),e},StringOperators.getLinksFromHtml=function(a,b,c){var d=document.createElement("html");d.innerHTML=a;var e,f,g,h,i,j,k,l,m=d.getElementsByTagName("a"),n=new StringList;for(b=""===b?null:b,c=null==c?!1:c,b&&(b=b.trim(),".html"==b.substr(-5)&&(i=b.split("/"),b=i.slice(0,i.length-1).join("/")),"/"==b.indexOf(-1)&&(b=b.substr(0,b.length-1)),i=b.split("/"),l=b.replace("//","**").split("/")[0].replace("**","//")),e=0;e<m.length;e++)if(f=g=m[e].getAttribute("href"),null!=g){for(-1!=g.indexOf("=")&&(g=g.split("=")[0]),b&&-1==g.indexOf("http://")&&-1==g.indexOf("https://")&&-1==g.indexOf("wwww.")&&-1==g.indexOf("file:")&&-1==g.indexOf("gopher:")&&0!==g.indexOf("//")&&(g="../../../"==g.substr(0,9)?i.slice(0,i.length-3).join("/")+"/"+g.substr(9):"../../"==g.substr(0,6)?i.slice(0,i.length-2).join("/")+"/"+g.substr(6):"../"==g.substr(0,3)?i.slice(0,i.length-1).join("/")+"/"+g.substr(3):"/"==g.charAt(0)?l+g:b+"/"+g),c&&-1!=g.indexOf("#")&&(g=g.split("#")[0]),"/"==g.substr(-1)&&(g=g.substr(0,g.length-1)),h=g.indexOf("/../");-1!=h;)k=g.split("/../"),j=k[0].replace("//","**").split("/"),g=j.slice(0,j.length-1).join("/").replace("**","//")+("/"+k.slice(1).join("/../")),h=g.indexOf("/../");-1!=g.indexOf("./")&&(j=g.replace("//","**").split("/"),"."==j[0].substr(-1)&&(j[0]=j[0].substr(0,j[0].length-1),g=j.join("/").replace("**","//"))),g=g.trim(),"/"==g.substr(-1)&&(g=g.substr(0,g.length-1)),g!=b&&n.push(g)}return n=n.getWithoutRepetitions()},StringOperators.textContainsString=function(a,b,c,d){return a=d?b:a.toLowerCase(),b=d?b:b.toLowerCase(),c?a.match(new RegExp("\\b"+b+"\\b")).length>0:-1!=a.indexOf(b)},StringOperators.logInConsole=function(a,b){b=null==b?!0:b,b&&console.log("///////////////////////////////////////////////////"),console.log(a),b&&console.log("///////////////////////////////////////////////////")},StringOperators.getParenthesisContents=function(a,b){for(var c=new StringList,d=a,e=StringOperators.getFirstParenthesisContentWithIndexes(a,b),f=0;""!==e.content&&e.index1<d.length-1&&f<a.length;)c.push(e.content),d=d.substr(e.index1+2),e=StringOperators.getFirstParenthesisContentWithIndexes(d,b),f++;return c},StringOperators.getFirstParenthesisContent=function(a,b){return StringOperators.getFirstParenthesisContentWithIndexes(a,b).content},StringOperators.getFirstParenthesisContentWithIndexes=function(a,b){var c=b?"[":"(",d=b?"]":")",e=b?/\[/g:/\(/g,f=b?/\]/g:/\)/g,g=a.indexOf(c);if(-1==g)return{content:"",index0:0,index1:0};for(var h=a.indexOf(d),i=a.substring(g+1,h),j=i.match(e),k=i.match(f),l=(null==j?0:j.length)-(null==k?0:k.length),m=0;(l>0||-1==h)&&m<a.length;)h=a.indexOf(d,h),i=a.substring(g+1,h+1),h++,j=i.match(e),k=i.match(f),l=(null==j?0:j.length)-(null==k?0:k.length),m++;return h=a.indexOf(d,h),{content:-1==h?a.substring(g+1):a.substring(g+1,h),index0:g+1,index1:-1==h?a.length-1:h-1}},StringOperators.placeString=function(a,b,c){return a.substr(0,c)+b+a.substr(c+b.length)},StringOperators.insertString=function(a,b,c){return a.substr(0,c)+b+a.substr(c)},StringOperators.cleanText=function(a,b,c,d,e,f,g,h,i){return null==a?null:(b&&(a=StringOperators.removeEnters(a,d)),c&&(a=StringOperators.removeTabs(a,d)),e&&(a=StringOperators.removePunctuation(a)),f&&(a=a.toLowerCase()),null!=g&&(a=StringOperators.replaceStringsInText(a,g,"",!0)),h&&(a=StringOperators.removeDoubleSpaces(a)),i&&(a=StringOperators.removeAccentsAndDiacritics(a)),a)},StringOperators.removeEnters=function(a,b){return b=null==b?"":b,a.replace(/(\StringOperators.ENTER|\StringOperators.ENTER2|\StringOperators.ENTER3)/gi,b)},StringOperators.removeTabs=function(a,b){return b=b||"",a.replace(/(\StringOperators.TAB|\StringOperators.TAB2|\t)/gi,b)},StringOperators.removePunctuation=function(a,b){return b=b||"",a.replace(/[:,.;?!\(\)\"\']/gi,b)},StringOperators.removeDoubleSpaces=function(a){for(var b=a,c=RegExp(/ /);c.test(b);)b=b.replace(c," ");return b},StringOperators.removeInitialRepeatedCharacter=function(a,b){for(;a.charAt(0)==b;)a=a.substr(1);return a},StringOperators.removeHtmlTags=function(a){var b=document.createElement("DIV");return b.innerHTML=a,b.textContent||b.innerText},StringOperators.removeLinks=function(a){a+=" ";var b=/https*:\/\/[a-zA-Z0-9\/\.]+( |:|;|\r|\t|\n|\v)/g;return a.replace(b," ").substr(0,a.length-2)},StringOperators.removeQuotes=function(a){return'"'==a.charAt(0)&&(a=a.substr(1)),'"'==a.charAt(a.length-1)&&(a=a.substr(0,a.length-1)),a},StringOperators.removeAccentsAndDiacritics=function(a){var b=a.replace(new RegExp(/[àáâãäå]/g),"a");return b=b.replace(new RegExp(/æ/g),"ae"),b=b.replace(new RegExp(/ç/g),"c"),b=b.replace(new RegExp(/[èéêë]/g),"e"),b=b.replace(new RegExp(/[ìíîï]/g),"i"),b=b.replace(new RegExp(/ñ/g),"n"),b=b.replace(new RegExp(/[òóôõö]/g),"o"),b=b.replace(new RegExp(/œ/g),"oe"),b=b.replace(new RegExp(/[ùúûü]/g),"u"),b=b.replace(new RegExp(/[ýÿ]/g),"y"),b=b.replace(new RegExp(/[ÀÁÂÄÃ]/g),"A"),b=b.replace(new RegExp(/Æ/g),"AE"),b=b.replace(new RegExp(/Ç/g),"c"),b=b.replace(new RegExp(/[ÈÉÊË]/g),"E"),b=b.replace(new RegExp(/[ÌÍÎÏ]/g),"I"),b=b.replace(new RegExp(/Ñ/g),"N"),b=b.replace(new RegExp(/[ÒÓÔÖÕ]/g),"O"),b=b.replace(new RegExp(/Œ/g),"OE"),b=b.replace(new RegExp(/[ÙÚÛÜ]/g),"U"),b=b.replace(new RegExp(/[Ÿ]/g),"Y")},StringOperators.getWordsOccurrencesTable=function(a,b,c,d,e){if(null!=a){if(0===a.length)return new Table(new StringList,new NumberList);var f,g=StringOperators.getWords(a,!1,b,!1,c,d,e);return f=null!=d?g.getFrequenciesTable(!0).sliceRows(0,d-1):g.getFrequenciesTable(!0)}},StringOperators.indexesOf=function(a,b){var c=a.indexOf(b);if(-1==c)return new NumberList;var d=new NumberList(c);for(c=a.indexOf(b,c+1);-1!=c;)d.push(c),c=a.indexOf(b,c+1);return d},StringOperators.repeatString=function(a,b){var c,d="";for(c=0;b>c;c++)d+=a;return d},StringOperators.countOccurrences=function(a,b,c){if(c)return StringOperators.countWordOccurrences(a,b);for(var d=0,e=a.indexOf(b);-1!=e;)d++,e=a.indexOf(b,e+b.length);return d},StringOperators.countWordOccurrences=function(a,b){var c=new RegExp("\\b"+b+"\\b");return StringOperators.countRegexOccurrences(a,c)},StringOperators.countRegexOccurrences=function(a,b){var c=a.match(b);return null==c?0:c.length},StringOperators.countStringsOccurrences=function(a,b,c){if(null!=a&&null!=b){var d,e=new NumberList,f=b.length;for(d=0;f>d;d++)c?e[d]=StringOperators.countRegexOccurrences(a,new RegExp("\\b"+b[d]+"\\b")):e[d]=StringOperators.countOccurrences(a,b[d]);return e}},StringOperators.validateEmail=function(a){return StringOperators.MAIL_REGEX.test(a)},StringOperators.validateUrl=function(a){return StringOperators.LINK_REGEX.test(a)},StringOperators.createsCategoricalColorsBlocksHtml=function(a,b,c,d){if(null==a)return"";var e="";return b=null==b?20:b,c=null==c?ColorListGenerators.createDefaultCategoricalColorList(a.length):c,d=null==d?"█":d,a.forEach(function(a,f){a=Math.floor(a*b)+(a*b-Math.floor(a*b)>Math.random()?1:0),e+='<font color="'+ColorOperators.colorStringToHEX(c[f])+'">';for(var g=0;a>g;g++)e+=d;e+="</f>"}),e},Network.prototype=new DataModel,Network.prototype.constructor=Network,Network.prototype.getNodes=function(){return this.nodeList},Network.prototype.getRelations=function(){return this.relationList},Network.prototype.getNodesIds=function(){return this.nodeList.getIds()},Network.prototype.addNode=function(a){this.nodeList.addNode(a)},Network.prototype.getNodeByName=function(a){return this.nodeList.getNodeByName(a)},Network.prototype.getNodeById=function(a){return this.nodeList.getNodeById(a)},Network.prototype.createRelation=function(a,b,c,d,e){this.addRelation(new Relation(c,c,a,b,d,e))},Network.prototype.addRelation=function(a){this.relationList.addNode(a),a.node0.nodeList.addNode(a.node1),a.node0.relationList.addNode(a),a.node0.toNodeList.addNode(a.node1),a.node0.toRelationList.addNode(a),a.node1.nodeList.addNode(a.node0),a.node1.relationList.addNode(a),
a.node1.fromNodeList.addNode(a.node0),a.node1.fromRelationList.addNode(a)},Network.prototype.connect=function(a,b,c,d,e){c=c||a.id+"_"+b.id,d=d||1;var f=new Relation(c,c,a,b,d);return this.addRelation(f),f.content=e,f},Network.prototype.removeNode=function(a){this.removeNodeRelations(a),this.nodeList.removeNode(a)},Network.prototype.removeNodeRelations=function(a){for(var b=0;null!=a.relationList[b];b++)this.removeRelation(a.relationList[b]),b--},Network.prototype.removeNodes=function(){this.nodeList.deleteNodes(),this.relationList.deleteNodes()},Network.prototype.removeRelation=function(a){this.relationList.removeElement(a),a.node0.nodeList.removeNode(a.node1),a.node0.relationList.removeRelation(a),a.node0.toNodeList.removeNode(a.node1),a.node0.toRelationList.removeRelation(a),a.node1.nodeList.removeNode(a.node0),a.node1.relationList.removeRelation(a),a.node1.fromNodeList.removeNode(a.node0),a.node1.fromRelationList.removeRelation(a)},Network.prototype.removeIsolatedNodes=function(a){var b,c=0;for(a=null==a?1:a,b=0;null!=this.nodeList[b];b++)this.nodeList[b].getDegree()<a&&(this.nodeList[b]._toRemove=!0);for(b=0;null!=this.nodeList[b];b++)this.nodeList[b]._toRemove&&(this.removeNode(this.nodeList[b]),c++,b--);return c},Network.prototype.lightClone=function(){var a=new Network;return a.nodeList=this.nodeList,a.relationList=this.relationList,a},Network.prototype.clone=function(a,b,c,d){var e,f,g=new Network;return c=null==c?"":String(c),d=null==d?"":String(d),this.nodeList.forEach(function(b){e=new Node(c+b.id,d+b.name),""!==c&&(e.basicId=b.id),""!==d&&(e.basicName=b.name),a&&a.forEach(function(a){null!=b[a]&&(e[a]=b[a])}),g.addNode(e)}),this.relationList.forEach(function(a){f=new Relation(c+a.id,d+a.name,g.nodeList.getNodeById(c+a.node0.id),g.nodeList.getNodeById(c+a.node1.id)),""!==c&&(f.basicId=a.id),""!==d&&(f.basicName=a.name),b&&b.forEach(function(b){null!=a[b]&&(f[b]=a[b])}),g.addRelation(f)}),g},Network.prototype.destroy=function(){delete this.type,this.nodeList.destroy(),this.relationList.destroy(),delete this.nodeList,delete this.relationList},DateOperators.millisecondsToHours=1/36e5,DateOperators.millisecondsToDays=1/864e5,DateOperators.millisecondsToWeeks=1/6048e5,DateOperators.millisecondsToYears=3.169e-11,DateOperators.MONTH_NAMES=["january","february","march","april","may","june","july","august","september","october","november","december"],DateOperators.MONTH_NAMES_SHORT=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],DateOperators.MONTH_NDAYS=[31,28,31,30,31,30,31,31,30,31,30,31],DateOperators.WEEK_NAMES=["monday","tuesday","wednesday","thursday","friday","saturday","sunday"],DateOperators.stringToDate=function(a,b,c){if(c=null==c?"-":c,b=null==b?1:b,b=Number(b),1==b)return"-"!=c&&(a=a.replace(new RegExp(a,"g"),"-")),new Date(a);var d,e=a.split(c);switch(b){case 0:return new Date(Number(e[2]),Number(e[0])-1,Number(e[1]));case 1:return new Date(a);case 2:return d=Number(e[2]),d=d>=0?d+2e3:d+1900,new Date(d,Number(e[0])-1,Number(e[1]));case 3:return d=Number(e[0]),d=d>=0?d+2e3:d+1900,new Date(d,Number(e[1])-1,Number(e[2]));case 4:return d=Number(e[2]),d=d>=0?d+2e3:d+1900,new Date(d,Number(e[1])-1,Number(e[0]));case 5:return d=Number(e[2]),new Date(d,Number(e[1])-1,Number(e[0]))}},DateOperators.dateToString=function(a,b,c){c=null==c?"-":c,b=null==b?0:b;var d=a.getFullYear(),e=a.getMonth()+1,f=a.getDate();switch(b){case 0:return e+c+f+c+d;case 1:return d+c+e+c+f}},DateOperators.currentDate=function(){return new Date},DateOperators.addDaysToDate=function(a,b){return new Date(a.getTime()+b/DateOperators.millisecondsToDays)},DateOperators.addMillisecondsToDate=function(a,b){return new Date(a.getTime()+b)},DateOperators.parseDate=function(a){return new Date(Date.parse(a.replace(/\./g,"-")))},DateOperators.parseDates=function(a){var b,c=new DateList;for(b=0;null!=a[b];b++)c.push(this.parseDate(a[b]));return c},DateOperators.hoursBetweenDates=function(a,b){return(b.getTime()-a.getTime())*DateOperators.millisecondsToHours},DateOperators.daysBetweenDates=function(a,b){return(b.getTime()-a.getTime())*DateOperators.millisecondsToDays},DateOperators.weeksBetweenDates=function(a,b){return(b.getTime()-a.getTime())*DateOperators.millisecondsToWeeks},DateOperators.yearsBetweenDates=function(a,b){return(b.getTime()-a.getTime())*DateOperators.millisecondsToYears},DateOperators.nDayInYear=function(a){return Math.floor((a.getTime()-new Date(a.getFullYear(),0,1).getTime())*DateOperators.millisecondsToDays)},DateOperators.getDateDaysAgo=function(a){return DateOperators.addDaysToDate(new Date,-a)},DateOperators.getWeekInYear=function(a){var b=new Date(a.getFullYear(),0,1);return Math.ceil(((a-b)/864e5+b.getDay()+1)/7)},DateOperators.getNDaysInMonth=function(a,b){return new Date(b,a,0).getDate()},NetworkEncodings.nodeNameSeparators=["|",":"," is "," are ",".",","],NetworkEncodings.decodeNoteWork=function(a){if(null!=a){if(""===a)return new Network;console.log("\n\n*************////////// decodeNoteWork //////////*************");var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=[],v=[],w=[],x=new Network,y=new StringList;x.nodesPropertiesNames=new StringList,x.relationsPropertiesNames=new StringList,k=a.split(/\n/g),k.forEach(function(a,b){k[b]=a.trim()}),a=k.join("\n");for(var z=0;"\n"==a.charAt(0);)a=a.substr(1),z++;var A=a;for(i=A.search(/\n\n./g);-1!=i;)y.push(A.substr(0,i)),A=A.substr(i+2),i=A.search(/\n\n./g);y.push(A);var B;y.forEach(function(a){if(-1==a.indexOf("\n")?(d=a,k=null):(k=a.split(/\n/g),d=k[0]),B=d,"\n"==d||""===d||" "==d||" "==d);else if(0===d.indexOf("//"))null==w[z]&&(w[z]=[]),w[z].push({type:"comment",iStart:0,iEnd:d.length});else if("relations colors:"==d||"groups colors:"==d||"categories colors:"==d)k&&k.slice(1).forEach(function(a,b){i=a.indexOf(":"),"relations colors:"==B&&-1!=i&&null!=ColorOperators.colorStringToRGB(a.split(":")[1])&&(u.push(a),null==w[z+b]&&(w[z+b]=[]),w[z+b].push({type:"relation_color",iStart:0,iEnd:a.length})),"groups colors:"!=B&&"categories colors:"!=B||-1==i||null==ColorOperators.colorStringToRGB(a.split(":")[1])||(v.push(a),null==w[z+b]&&(w[z+b]=[]),w[z+b].push({type:"relation_color",iStart:0,iEnd:a.length}))});else{for(j=99999999,i=d.indexOf(NetworkEncodings.nodeNameSeparators[0]),-1!=i&&(j=i,o=NetworkEncodings.nodeNameSeparators[0]),c=1;c<NetworkEncodings.nodeNameSeparators.length;)i=d.indexOf(NetworkEncodings.nodeNameSeparators[c]),-1!=i&&(j=Math.min(i,j),o=NetworkEncodings.nodeNameSeparators[c]),c++;i=99999999==j?-1:j,h=-1==i?d:d.substr(0,i),h=h.trim(),""!==h&&(f=NetworkEncodings._simplifyForNoteWork(h),l=x.nodeList.getNodeById(f),q=-1==i?d.length:i,null==l?(l=new Node(f,h),l._nLine=z,x.addNode(l),l.content=-1!=i?d.substr(i+o.length).trim():"",l._lines=k?k.slice(1):new StringList,l.position=x.nodeList.length-1,null==w[z]&&(w[z]=[]),w[z].push({type:"node_name",iStart:0,iEnd:q})):(null!=k&&(l._lines=l._lines.concat(k.slice(1))),l.content+=-1!=i?" | "+d.substr(i+o.length).trim():"",null==w[z]&&(w[z]=[]),w[z].push({type:"node_name_repeated",iStart:0,iEnd:q})))}z+=(k?k.length:1)+1});for(var C=!0;C;){C=!1;a:for(b=0;null!=x.nodeList[b];b++)for(l=x.nodeList[b],c=0;null!=l._lines[c];c++)if(d=l._lines[c],0===d.indexOf("=")){if(g=NetworkEncodings._simplifyForNoteWork(d.substr(1)),m=x.nodeList.getNodeById(g),m&&l!=m){C=!0,l._lines=m._lines.concat(m._lines),x.nodeList.removeNode(m),x.nodeList.ids[m.id]=l;break a}x.nodeList.ids[g]=m,l._otherIds||(l._otherIds=[]),l._otherIds.push(g)}}return x.nodeList.forEach(function(a){z=a._nLine,a._lines.forEach(function(b,d){-1!=b.indexOf("=")||(b.indexOf(":")>0?(e=b.trim(),r=StringOperators.removeAccentsAndDiacritics(e.split(":")[0]).replace(/\s/g,"_"),s=b.split(":")[1].trim(),s==String(Number(s))&&(s=Number(s)),null!=s&&(a[r]=s,-1==x.nodesPropertiesNames.indexOf(r)&&x.nodesPropertiesNames.push(r))):(e=b,x.nodeList.forEach(function(g){if(p=NetworkEncodings._regexWordForNoteWork(g.id),i=e.search(p),-1==i&&g._otherIds)for(c=0;null!=g._otherIds[c]&&(p=NetworkEncodings._regexWordForNoteWork(g._otherIds[c]),i=e.search(p),-1==i);c++);if(-1!=i)if(q=i+e.substr(i).match(p)[0].length,n=x.relationList.getFirstRelationBetweenNodes(a,g,!0),null!=n)t=n.node0.name+" "+b,n.content+=" | "+t,null==w[z+d+1]&&(w[z+d+1]=[]),w[z+d+1].push({type:"node_name_in_repeated_relation",iStart:i,iEnd:q});else if(n=x.relationList.getFirstRelationBetweenNodes(g,a,!0),null==n||n.content!=t){var h=b;p=NetworkEncodings._regexWordForNoteWork(a.id),i=h.search(p),-1!=i&&(h=h.substr(i),h=h.replace(p,"").trim()),p=NetworkEncodings._regexWordForNoteWork(g.id),i=h.search(p),h="… "+h.substr(0,i).trim()+" …",f=b,n=new Relation(b,h,a,g),t=n.node0.name+" "+b,n.content=t,x.addRelation(n),null==w[z+d+1]&&(w[z+d+1]=[]),w[z+d+1].push({type:"node_name_in_relation",iStart:i,iEnd:q})}})))}),a.positionWeight=Math.pow(x.nodeList.length-a.position-1/x.nodeList.length,2),a.combinedWeight=a.positionWeight+.1*a.nodeList.length}),u.forEach(function(a){i=a.indexOf(":");var b=a.substr(0,i).split(",");b.forEach(function(b){var c=a.substr(i+1);x.relationList.forEach(function(a){-1!=a.name.indexOf(b)&&(a.color=c)})})}),v.forEach(function(a){i=a.indexOf(":");var b=a.substr(0,i).split(",");b.forEach(function(b){var c=a.substr(i+1);x.nodeList.forEach(function(a){a.group==b&&(a.color=c),a.category==b&&(a.color=c)})})}),x.colorSegments=w,x}},NetworkEncodings._simplifyForNoteWork=function(a){return a=a.toLowerCase(),"es"==a.substr(a.length-2)?a=a.substr(0,a.length-1):"s"==a.charAt(a.length-1)&&(a=a.substr(0,a.length-1)),a.trim()},NetworkEncodings._regexWordForNoteWork=function(a,b){b=null==b?!0:b;try{return new RegExp("(\\b)("+a+"|"+a+"s|"+a+"es)(\\b)",b?"gi":"i")}catch(c){return null}},NetworkEncodings.encodeNoteWork=function(a,b,c,d){if(null!=a){var e,f,g,h="";return b=b||", ",c=c||[],d=d||[],a.nodeList.forEach(function(a){h+=a.name,a.content&&""!==a.content&&(h+=b+a.content),h+="\n",c.forEach(function(b){null!=a[b]&&(h+=b+":"+String(a[b])+"\n")}),g=new StringList,a.toRelationList.forEach(function(a){var b=null!=a.content&&""!==a.content||!a.description?a.content:a.description;b&&""!==b?(e=NetworkEncodings._regexWordForNoteWork(a.node1.name),f=b+(null!=e&&-1==b.search(e)?" "+a.node1.name:"")):f="connected with "+a.node1.name,-1==g.indexOf(f)&&(h+=f,h+="\n",g.push(f))}),h+="\n"}),h}},NetworkEncodings.decodeGDF=function(a){if(null!=a&&""!==a){var b=new Network,c=a.split("\n");if(0===c.length)return null;var d,e,f,g,h,i=c[0].substr(8).split(",");for(e=1;null!=c[e];e++){if(d=c[e],"edgedef>"==d.substr(0,8)){h=e+1;break}d=NetworkEncodings.replaceChomasInLine(d),g=d.split(",");var j=new Node(String(g[0]),String(g[1]));for(f=0;null!=i[f]&&null!=g[f];f++)"weight"==i[f]?j.weight=Number(g[f]):"x"==i[f]?j.x=Number(g[f]):"y"==i[f]?j.y=Number(g[f]):j[i[f]]=g[f].replace(/\*CHOMA\*/g,",");b.addNode(j)}var k=c[h-1].substr(8).split(",");for(e=h;null!=c[e];e++)if(d=c[e],d=NetworkEncodings.replaceChomasInLine(d),g=d.split(","),g.length>=2){var l=b.nodeList.getNodeById(String(g[0])),m=b.nodeList.getNodeById(String(g[1]));if(null==l||null==m)console.log("NetworkEncodings.decodeGDF | [!] problems with nodes ids:",g[0],g[1],"at line",e);else{var n=l.id+"_"+m.id+"_"+Math.floor(999999*Math.random()),o=new Relation(n,n,l,m);for(f=2;null!=k[f]&&null!=g[f];f++)"weight"==k[f]?o.weight=Number(g[f]):o[k[f]]=g[f].replace(/\*CHOMA\*/g,",");b.addRelation(o)}}return b}},NetworkEncodings.encodeGDF=function(a,b,c){if(null!=a){b=null==b?new StringList:b,c=null==c?new StringList:c;var d,e,f,g="nodedef>id"+(b.length>0?",":"")+b.join(",");for(d=0;null!=a.nodeList[d];d++)for(f=a.nodeList[d],g+="\n"+f.id,e=0;null!=b[e];e++)g+="string"==typeof f[b[e]]?',"'+f[b[e]]+'"':","+f[b[e]];g+="\nedgedef>id0,id1"+(c.length>0?",":"")+c.join(",");var h;for(d=0;null!=a.relationList[d];d++)for(h=a.relationList[d],g+="\n"+h.node0.id+","+h.node1.id,e=0;null!=c[e];e++)g+="string"==typeof h[c[e]]?',"'+h[c[e]]+'"':","+h[c[e]];return g}},NetworkEncodings.decodeGML=function(a){if(null==a)return null;a=a.substr(a.indexOf("[")+1);var b,c,d,e,f,g,h,i,j=new Network,k=a.search(/\bedge\b/),l=a.substr(0,k),m=a.substr(k),n=l,o=StringOperators.getParenthesisContents(n,!0);for(h=0;null!=o[h];h++)for(o[h]=StringOperators.removeInitialRepeatedCharacter(o[h],"\n"),o[h]=StringOperators.removeInitialRepeatedCharacter(o[h],"\r"),e=o[h].indexOf("graphics"),-1!=e&&(f=o[h].indexOf("]"),b=o[h].substring(e,f+1),o[h]=o[h].substr(0,e)+o[h].substr(f+1),b=StringOperators.getFirstParenthesisContent(b,!0),o[h]=o[h]+b),c=o[h].split("\n"),c[0]=NetworkEncodings._cleanLineBeginning(c[0]),d=c[0].split(" "),g=new Node(StringOperators.removeQuotes(d[1]),StringOperators.removeQuotes(d[1])),j.addNode(g),i=1;null!=c[i];i++)c[i]=NetworkEncodings._cleanLineBeginning(c[i]),c[i]=NetworkEncodings._replaceSpacesInLine(c[i]),""!==c[i]&&(d=c[i].split(" "),"label"==d[0]&&(d[0]="name"),g[d[0]]='"'==d[1].charAt(0)?StringOperators.removeQuotes(d[1]).replace(/\*SPACE\*/g," "):Number(d[1]));n=m,o=StringOperators.getParenthesisContents(n,!0);var p,q,r,s,t,u=j.nodeList;for(h=0;null!=o[h];h++)for(o[h]=StringOperators.removeInitialRepeatedCharacter(o[h],"\n"),o[h]=StringOperators.removeInitialRepeatedCharacter(o[h],"\r"),c=o[h].split("\n"),p=null,q=null,t=null,i=0;null!=c[i];i++)c[i]=NetworkEncodings._cleanLineBeginning(c[i]),""!==c[i]&&(d=c[i].split(" "),"source"==d[0]&&(p=StringOperators.removeQuotes(d[1])),"target"==d[0]&&(q=StringOperators.removeQuotes(d[1])),null==t?null!=p&&null!=q&&(r=u.getNodeById(p),s=u.getNodeById(q),null!=r&&null!=s&&(t=new Relation(p+" "+q,"",r,s),j.addRelation(t))):("value"==d[0]&&(d[0]="weight"),t[d[0]]='"'==d[1].charAt(0)?StringOperators.removeQuotes(d[1]):Number(d[1])));return j},NetworkEncodings._cleanLineBeginning=function(a){return a=StringOperators.removeInitialRepeatedCharacter(a,"\n"),a=StringOperators.removeInitialRepeatedCharacter(a,"\r"),a=StringOperators.removeInitialRepeatedCharacter(a," "),a=StringOperators.removeInitialRepeatedCharacter(a," ")},NetworkEncodings.encodeGML=function(a,b,c,d){if(null!=a){d=null==d?!0:d,b=null==b?new StringList:b,c=null==c?new StringList:c;var e,f,g,h,i,j="graph\n[",k=" ";for(e=0;null!=a.nodeList[e];e++){for(g=a.nodeList[e],j+="\n"+k+"node\n"+k+"[",k=" ",j+=d?"\n"+k+"id "+e:"\n"+k+'id "'+g.id+'"',""!==g.name&&(j+="\n"+k+'label "'+g.name+'"'),f=0;null!=b[f];f++)i=g[b[f]],null!=i&&(i.getMonth&&(i=DateOperators.dateToString(i)),h="string"==typeof i,h&&(i=i.replace(/\n/g,"\\n").replace(/\"/g,"'")),j+="\n"+k+b[f]+" "+(h?'"'+i+'"':i));k=" ",j+="\n"+k+"]"}var l;for(e=0;null!=a.relationList[e];e++){for(l=a.relationList[e],j+="\n"+k+"edge\n"+k+"[",k=" ",d?(j+="\n"+k+"source "+a.nodeList.indexOf(l.node0),j+="\n"+k+"target "+a.nodeList.indexOf(l.node1)):(j+="\n"+k+'source "'+l.node0.id+'"',j+="\n"+k+'target "'+l.node1.id+'"'),f=0;null!=c[f];f++)i=l[c[f]],null!=i&&(i.getMonth&&(i=DateOperators.dateToString(i)),h="string"==typeof i,h&&(i=i.replace(/\n/g,"\\n").replace(/\"|“|”/g,"'")),j+="\n"+k+c[f]+" "+(h?'"'+i+'"':i));k=" ",j+="\n"+k+"]"}return j+="\n]"}},NetworkEncodings.decodeSYM=function(a){var b,c,d=StringOperators.splitByEnter(a);d=null==d?[]:d;var e,f,g,h,i,j,k,l,m,n,o=/((?:NODE|RELATION)|GROUP)\s*([A-Za-z0-9_,\s]*)/,p=new Network,q=new Table,r=[],s=[],t=[];for(b=0;null!=d[b];b++){var u=o.exec(d[b]);if(null!=u)switch(u[1]){case"NODE":for(f=u[2],e="name:"==d[b+1].substr(0,5)?d[b+1].substr(5).trim():"",e=e.replace(/\\n/g,"\n").replace(/\\'/g,"'"),g=new Node(f,e),p.addNode(g),c=b+1;c<d.length&&-1!=d[c].indexOf(":");)l=d[c].split(":"),m=l[0],n=l.slice(1).join(":"),"name"!=m&&(n=n.trim(),g[m]=String(Number(n))==n?Number(n):n,"string"==typeof g[m]&&(g[m]=g[m].replace(/\\n/g,"\n").replace(/\\'/g,"'")),-1==r.indexOf(m)&&r.push(m)),c++;null!=g.color&&/.+,.+,.+/.test(g.color)&&(g.color="rgb("+g.color+")"),null!=g.group&&(j=q.getFirstElementByPropertyValue("name",g.group),null==j&&(j=new NodeList,j.name=g.group,j.name=j.name.replace(/\\n/g,"\n").replace(/\\'/g,"'"),q.push(j)),j.addNode(g));break;case"RELATION":var v=u[2].replace(/\s/g,"").split(",");if(g=p.nodeList.getNodeById(v[0]),h=p.nodeList.getNodeById(v[1]),null!=g&&null!=h)for(i=new Relation(g.id+"_"+h.id,g.id+"_"+h.id,g,h),p.addRelation(i),c=b+1;c<d.length&&-1!=d[c].indexOf(":");)l=d[c].split(":"),m=l[0],n=l.slice(1).join(":").trim(),"name"!=m&&(n=n.trim(),i[m]=String(Number(n))==n?Number(n):n,"string"==typeof i[m]&&(i[m]=i[m].replace(/\\n/g,"\n").replace(/\\'/g,"'")),-1==s.indexOf(m)&&s.push(m)),c++;null!=i&&null!=i.color&&(i.color="rgb("+i.color+")");break;case"GROUP":for(k=d[b].substr(5).trim(),j=q.getFirstElementByPropertyValue("name",k),null==j&&(j=new NodeList,j.name=k,q.push(j)),c=b+1;c<d.length&&-1!=d[c].indexOf(":");)l=d[c].split(":"),"name"!=l[0]&&(l[1]=l[1].trim(),j[l[0]]=String(Number(l[1]))==l[1]?Number(l[1]):l[1],-1==t.indexOf(l[0])&&t.push(l[0])),c++;/.+,.+,.+/.test(j.color)&&(j.color="rgb("+j.color+")")}}for(b=0;null!=q[b];b++)for(j=q[b],null==j.color&&(j.color=ColorListGenerators._HARDCODED_CATEGORICAL_COLORS[b%ColorListGenerators._HARDCODED_CATEGORICAL_COLORS.length]),c=0;null!=j[c];c++)g=j[c],null==g.color&&(g.color=j.color);return p.groups=q,p.nodePropertiesNames=r,p.relationPropertiesNames=s,p.groupsPropertiesNames=t,p},NetworkEncodings.encodeSYM=function(a,b,c,d,e){c=null==c?new StringList:c,d=null==d?new StringList:d;var f,g,h,i,j="";for(f=0;null!=a.nodeList[f];f++)for(h=a.nodeList[f],j+=(0===f?"":"\n\n")+"NODE "+h.id,""!==h.name&&(j+="\nname:"+h.name.replace(/\n/g,"\\n")),g=0;null!=c[g];g++)i=c[g],null!=h[i]&&(j+="\n"+i+":"+_processProperty(i,h[i]));var k;for(f=0;null!=a.relationList[f];f++)for(k=a.relationList[f],j+="\n\nRELATION "+k.node0.id+", "+k.node1.id,g=0;null!=d[g];g++)i=d[g],null!=k[i]&&(j+="\n"+i+":"+_processProperty(i,k[i]));if(null==b)return j;var l;for(f=0;null!=b[f];f++)for(l=b[f],j+="\n\nGROUP "+l.name,g=0;null!=e[g];g++)i=e[g],null!=l[i]&&(j+="\n"+i+":"+_processProperty(i,l[i]));return j},NetworkEncodings.replaceChomasInLine=function(a,b){var c=a.split('"');if(c.length<2)return a;var d,e,f;switch(b=null==b?",":b){case",":f=/,/g;break;case";":f=/;/g}for(e=0;null!=c[e];e++)d=.5*e!=Math.floor(.5*e),d&&(c[e]=c[e].replace(f,"*CHOMA*"));return a=StringList.fromArray(c).getConcatenated("")},NetworkEncodings._replaceSpacesInLine=function(a){var b=a.split('"');if(b.length<2)return a;var c,d;for(d=0;null!=b[d];d++)c=.5*d!=Math.floor(.5*d),c&&(b[d]=b[d].replace(/ /g,"*SPACE*"));return a=StringList.fromArray(b).getConcatenated('"')};var dataModelsInfo=[{type:"Null","short":"Ø",category:"object",level:"0",write:"true",inherits:null,color:"#ffffff"},{type:"Object","short":"{}",category:"object",level:"0",write:"true",inherits:null,to:"String",color:"#C0BFBF"},{type:"Function","short":"F",category:"object",level:"0",inherits:null,color:"#C0BFBF"},{type:"Boolean","short":"b",category:"boolean",level:"0",write:"true",inherits:null,to:"Number",color:"#4F60AB"},{type:"Number","short":"#",category:"number",level:"0",write:"true",inherits:null,to:"String",color:"#5DA1D8"},{type:"Interval","short":"##",category:"number",level:"0.5",write:"true",inherits:null,to:"Point",contains:"Number",color:"#386080"},{type:"Array","short":"[]",category:"object",level:"1",inherits:null,to:"List",contains:"Object,Null",color:"#80807F"},{type:"List","short":"L",category:"object",level:"1",inherits:"Array",contains:"Object",comments:"A List is an Array that doesn't contain nulls, and with enhanced functionalities",color:"#80807F"},{type:"Table","short":"T",category:"object",level:"2",inherits:"List",contains:"List",comments:"A Table is a List of Lists",color:"#80807F"},{type:"BooleanList","short":"bL",category:"boolean",level:"1",inherits:"List",to:"NumberList",contains:"Boolean",color:"#3A4780"},{type:"NumberList","short":"#L",category:"number",level:"1",write:"true",inherits:"List",to:"StringList",contains:"Number",color:"#386080"},{type:"NumberTable","short":"#T",category:"number",level:"2",write:"true",inherits:"Table",to:"Network",contains:"NumberList",color:"#386080"},{type:"String","short":"s",category:"string",level:"0",write:"true",inherits:null,color:"#8BC63F"},{type:"StringList","short":"sL",category:"string",level:"1",write:"true",inherits:"List",contains:"String",color:"#5A8039"},{type:"StringTable","short":"sT",category:"string",level:"2",inherits:"Table",contains:"StringList",color:"#5A8039"},{type:"Date","short":"d",category:"date",level:"0.5",write:"true",inherits:null,to:"Number,String",color:"#7AC8A3"},{type:"DateInterval","short":"dd",category:"date",level:"0.75",inherits:null,to:"Interval",contains:"Date",color:"#218052"},{type:"DateList","short":"dL",category:"date",level:"1.5",inherits:"List",to:"NumberList,StringList",contains:"Date",color:"#218052"},{type:"Point","short":".",category:"geometry",level:"0.5",write:"true",inherits:null,to:"Interval",contains:"Number",color:"#9D59A4"},{type:"Rectangle","short":"t",category:"geometry",level:"0.5",inherits:null,to:"Polygon",contains:"Number",color:"#9D59A4"},{type:"Polygon","short":".L",category:"geometry",level:"1.5",inherits:"List",to:"NumberTable",contains:"Point",comments:"A Polygon is a List of Points",color:"#76297F"},{type:"RectangleList","short":"tL",category:"geometry",level:"1.5",inherits:null,to:"MultiPolygon",contains:"Rectangle",color:"#76297F"},{type:"MultiPolygon","short":".T",category:"geometry",level:"2.5",inherits:"Table",contains:"Polygon",comments:"A MultiPolygon is a List of Polygons",color:"#76297F"},{type:"Point3D","short":"3",category:"geometry",level:"0.5",write:"true",inherits:"Point",to:"NumberList",contains:"Number",color:"#9D59A4"},{type:"Polygon3D","short":"3L",category:"geometry",level:"1.5",inherits:"List",to:"NumberTable",contains:"Point3D",color:"#76297F"},{type:"MultiPolygon3D","short":"3T",category:"geometry",level:"2.5",inherits:"Table",contains:"Polygon3D",color:"#76297F"},{type:"Color","short":"c",category:"color",level:"0",inherits:null,to:"String",comments:"a Color is just a string that can be interpreted as color",color:"#EE4488"},{type:"ColorScale","short":"cS",category:"color",level:"0",write:"true",inherits:"Function",color:"#802046"},{type:"ColorList","short":"cL",category:"color",level:"1",write:"true",inherits:"List",to:"StringList",contains:"Color",color:"#802046"},{type:"Image","short":"i",category:"graphic",level:"0",inherits:null,color:"#802046"},{type:"ImageList","short":"iL",category:"graphic",level:"1",inherits:"List",contains:"Image",color:"#802046"},{type:"Node","short":"n",category:"structure",level:"0",inherits:null,color:"#FAA542"},{type:"Relation","short":"r",category:"structure",level:"0.5",inherits:"Node",contains:"Node",color:"#FAA542"},{type:"NodeList","short":"nL",category:"structure",level:"1",inherits:"List",contains:"Node",color:"#805522"},{type:"RelationList","short":"rL",category:"structure",level:"1.5",inherits:"NodeList",contains:"Relation",color:"#805522"},{type:"Network","short":"Nt",category:"structure",level:"2",inherits:null,to:"Table",contains:"NodeList,RelationList",color:"#805522"},{type:"Tree","short":"Tr",category:"structure",level:"2",inherits:"Network",to:"Table",contains:"NodeList,RelationList",color:"#805522"}],TwoPi=2*Math.PI,HalfPi=.5*Math.PI,radToGrad=180/Math.PI,gradToRad=Math.PI/180;NodeList.prototype=new List,NodeList.prototype.constructor=NodeList,NodeList.fromArray=function(a,b){b=null==b?!1:b;var c=List.fromArray(a);if(b)for(var d=c.length,e=0;d>e;e++)c[e]="Node"==_typeOf(c[e])?c[e]:new Node(String(c[e]),String(c[e]));return c.type="NodeList",c.ids={},Array(),c.deleteNodes=NodeList.prototype.deleteNodes,c.addNode=NodeList.prototype.addNode,c.addNodes=NodeList.prototype.addNodes,c.removeNode=NodeList.prototype.removeNode,c.removeNodeAtIndex=NodeList.prototype.removeNodeAtIndex,c.getNodeByName=NodeList.prototype.getNodeByName,c.getNodeById=NodeList.prototype.getNodeById,c.getNodesByIds=NodeList.prototype.getNodesByIds,c.getNewId=NodeList.prototype.getNewId,c.normalizeWeights=NodeList.prototype.normalizeWeights,c.getWeights=NodeList.prototype.getWeights,c.getIds=NodeList.prototype.getIds,c.getDegrees=NodeList.prototype.getDegrees,c.getPolygon=NodeList.prototype.getPolygon,c._push=Array.prototype.push,c.push=function(a){console.log("with nodeList, use addNode instead of push");var b;b.push(a)},c.getWithoutRepetitions=NodeList.prototype.getWithoutRepetitions,c.removeElements=NodeList.prototype.removeElements,c.clone=NodeList.prototype.clone,c},NodeList.prototype.removeNodes=function(){var a,b=this.length;for(a=0;b>a;a++)this.ids[this[a].id]=null,this.removeElement(this[a])},NodeList.prototype.addNode=function(a){this.ids[a.id]=a,this._push(a)},NodeList.prototype.addNodes=function(a){var b;for(b=0;null!=a[b];b++)this.addNode(a[b])},NodeList.prototype.removeNode=function(a){this.ids[a.id]=null,this.removeElement(a)},NodeList.prototype.removeNodeAtIndex=function(a){this.ids[this[a].id]=null,this.splice(a,1)},NodeList.prototype.normalizeWeights=function(){var a,b=-9999999,c=this.length;for(a=0;c>a;a++)b=Math.max(this[a].weight,b);for(a=0;c>a;a++)this[a].weight/=b},NodeList.prototype.getNodeByName=function(a){var b,c=this.length;for(b=0;c>b;b++)if(this[b].name==a)return this[b];return null},NodeList.prototype.getNodeById=function(a){return this.ids[a]},NodeList.prototype.getNodesByIds=function(a){for(var b,c=new NodeList,d=a.length,e=0;d>e;e++)b=this.ids[a[e]],null!=b&&c.addNode(b);return c},NodeList.prototype.getWeights=function(){var a,b=new NumberList;for(a=0;null!=this[a];a++)b[a]=this[a].weight;return b},NodeList.prototype.getIds=function(){for(var a=new StringList,b=this.length,c=0;b>c;c++)a[c]=this[c].id;return a},NodeList.prototype.getDegrees=function(){for(var a=new NumberList,b=0;null!=this[b];b++)a[b]=this[b].nodeList.length;return a},NodeList.prototype.getPolygon=function(a){for(var b=new _Polygon,c=0;null!=this[c];c++)b[c]=new _Point(this[c].x+a.cX,this[c].y+a.cY);return b},NodeList.prototype.getNewId=function(){for(var a=this.length+1,b=0;a>b;b++)if(null==this.getNodeById(String(b)))return String(b)},NodeList.prototype.clone=function(){var a,b=new NodeList,c=this.length;for(a=0;c>a;a++)b.addNode(this[a]);return b.name=this.name,b},NodeList.prototype.getWithoutRepetitions=function(){var a,b=new NodeList;for(b.name=this.name,a=0;null!=this[a];a++)null==b.getNodeById(this[a].id)&&b.addNode(this[a]);return b},NodeList.prototype.removeElements=function(a){var b;for(b=0;null!=this[b];b++)null!=a.getNodeById(this[b].id)&&(this.ids[this[b].id]=null,this.splice(b,1),b--)},RelationList.prototype=new NodeList,RelationList.prototype.constructor=RelationList,RelationList.fromArray=function(a){var b=NodeList.fromArray(a);return b.type="RelationList",b.addRelation=RelationList.prototype.addRelation,b.addRelationIfNew=RelationList.prototype.addRelationIfNew,b.removeRelation=RelationList.prototype.removeRelation,b.getRelationsWithNode=RelationList.prototype.getRelationsWithNode,b.getFirstRelationBetweenNodes=RelationList.prototype.getFirstRelationBetweenNodes,b.getFirstRelationByIds=RelationList.prototype.getFirstRelationByIds,b.getAllRelationsBetweenNodes=RelationList.prototype.getAllRelationsBetweenNodes,b.getRelatedNodesToNode=RelationList.prototype.getRelatedNodesToNode,b.nodesAreConnected=RelationList.prototype.nodesAreConnected,b},RelationList.prototype.addRelation=function(a){this.addNode(a)},RelationList.prototype.removeRelation=function(a){this.removeNode(a)},RelationList.prototype.getRelationsWithNode=function(a){var b,c=[];for(b=0;null!=this[b];b++){var d=this[b];(d.node0==a||d.node1==a)&&c.push(d)}return c},RelationList.prototype.getRelatedNodesToNode=function(a){var b,c=new NodeList;for(b=0;b<this.length;b++){var d=this[b];d.node0.id==a.id&&c.push(d.node1),d.node1.id==a.id&&c.push(d.node0)}return c},RelationList.prototype.getAllRelationsBetweenNodes=function(a,b,c){var d;c=null==c?!1:c;var e=[];for(d=0;null!=this[d];d++){var f=this[d];(f.node0==a&&f.node1==b||!c&&f.node0==b&&f.node1==a)&&e.push(f)}return e},RelationList.prototype.nodesAreConnected=function(a,b,c){return null!=a.toNodeList.getNodeById(b.id)?!0:!c&&null!=b.toNodeList.getNodeById(a.id)},RelationList.prototype.getFirstRelationBetweenNodes=function(a,b,c){c=null==c?!1:c;for(var d=0;null!=this[d];d++)if(this[d].node0.id==a.id&&this[d].node1.id==b.id||!c&&this[d].node1.id==a.id&&this[d].node0.id==b.id)return this[d];return null},RelationList.prototype.getFirstRelationByIds=function(a,b,c){var d,e,f=c||!1;for(d=0;null!=this[d];d++)if(e=this[d],e.node0.id==a&&e.node1.id==b)return e;if(f)return null;for(d=0;null!=this[d];d++)if(e=this[d],e.node0.id==b&&e.node1.id==a)return e;return null};var typeDict={List:List,Table:Table,StringList:StringList,NumberList:NumberList,NumberTable:NumberTable,NodeList:NodeList,RelationList:RelationList,Polygon:_Polygon,Polygon3D:Polygon3D,DateList:DateList,ColorList:ColorList},TYPES_SHORT_NAMES_DICTIONARY={Null:"Ø",Object:"{}",Function:"F",Boolean:"b",Number:"#",Interval:"##",Array:"[]",List:"L",Table:"T",BooleanList:"bL",NumberList:"#L",NumberTable:"#T",String:"s",StringList:"sL",StringTable:"sT",Date:"d",DateInterval:"dd",DateList:"dL",Point:".",Rectangle:"t",Polygon:".L",RectangleList:"tL",MultiPolygon:".T",Point3D:"3",Polygon3D:"3L",MultiPolygon3D:"3T",Color:"c",ColorScale:"cS",ColorList:"cL",Image:"i",ImageList:"iL",Node:"n",Relation:"r",NodeList:"nL",RelationList:"rL",Network:"Nt",Tree:"Tr"},_shortFromTypeDictionary,_colorFromTypeDictionary,_lightColorFromTypeDictionary;PolygonList.prototype=new Table,PolygonList.prototype.constructor=PolygonList,PolygonList.fromArray=function(a){var b=Table.fromArray(a);return b.type="PolygonList",b.getFrame=PolygonList.prototype.getFrame,b.add=PolygonList.prototype.add,b.factor=PolygonList.prototype.factor,b.clone=PolygonList.prototype.clone,b.getString=PolygonList.prototype.getString,b},PolygonList.prototype.getFrame=function(){if(0===this.length)return null;for(var a=this[0].getFrame(),b=new Rectangle(a.x,a.y,a.getRight(),a.getBottom()),c=1;null!=this[c];c++)a=this[c].getFrame(),b.x=Math.min(b.x,a.x),b.y=Math.min(b.y,a.y),b.width=Math.max(b.width,a.getRight()),b.height=Math.max(b.height,a.getBottom());return b.width-=b.x,b.height-=b.y,b},PolygonList.prototype.add=function(a){var b,c=_typeOf(a);switch(c){case"Point":var d=new PolygonList;for(b=0;null!=this[b];b++)d[b]=this[b].add(a);return d.name=this.name,d}},PolygonList.prototype.factor=function(a){for(var b=new PolygonList,c=0;null!=this[c];c++)b[c]=this[c].factor(a);return b.name=this.name,b},PolygonList.prototype.clone=function(){for(var a=new PolygonList,b=0;null!=this[b];b++)a[b]=this[b].clone();return a.name=this.name,a},TableEncodings.ENTER=String.fromCharCode(13),TableEncodings.ENTER2=String.fromCharCode(10),TableEncodings.ENTER3=String.fromCharCode(8232),TableEncodings.SPACE=String.fromCharCode(32),TableEncodings.SPACE2=String.fromCharCode(160),TableEncodings.TAB=" ",TableEncodings.TAB2=String.fromCharCode(9),TableEncodings.CSVtoTable=function(a,b,c,d,e){if(null==a)return null;d=null==d?"":d,e=null==e?!0:e;var f,g,h=null==b?!1:b;if(null==a)return null;if(""===a)return new Table;a=a.replace(/\$/g,"");var i=a.split('"');for(f=1;null!=i[f];f+=2)i[f]=i[f].replace(/\n/g,"*ENTER*");a=i.join('"');var j=TableEncodings.ENTER2,k=a.split(j);1==k.length&&(j=TableEncodings.ENTER,k=a.split(j),1==k.length&&(j=TableEncodings.ENTER3,k=a.split(j))),c=null==c?",":c;var l=new Table,m=c;if(null==a||""===a||" "==a||0===k.length)return null;var n,o=0;h&&(o=1,n=k[0].split(m));var p,q,r;for(f=o;f<k.length;f++)if(!(k[f].length<2)){var s=NetworkEncodings.replaceChomasInLine(k[f],c).split(m);for(g=0;g<s.length;g++){l[g]=null==l[g]?new List:l[g],h&&1==f&&(l[g].name=(null==n[g]?"":TableEncodings._removeQuotes(n[g])).trim());var t=h?f-1:f;q=s[g].replace(/\*CHOMA\*/g,c).replace(/\*ENTER\*/g,"\n"),q=""===q?d:q,q=String(q),r=Number(q.replace(",",".")),p=r||0===r&&""!==q?r:q,"string"==typeof p&&(p=TableEncodings._removeQuotes(p)),l[g][t]=p}}for(f=0;null!=l[f];f++)l[f]=l[f].getImproved(),e&&"List"==l[f].type&&(l[f]=ListConversions.toStringList(l[f]));
return l=l.getImproved()},TableEncodings._removeQuotes=function(a){return 0===a.length?a:('"'!=a.charAt(0)&&"'"!=a.charAt(0)||'"'!=a.charAt(a.length-1)&&"'"!=a.charAt(a.length-1)||(a=a.substr(1,a.length-2)),a)},TableEncodings.TableToCSV=function(a,b,c){b=b||",";var d,e,f,g;if(null==a)return null;var h,i=ListGenerators.createListWithSameElement(a[0].length,"");for(d=0;null!=a[d];d++)for(f=a[d],g=f.type,h=d!=a.length-1,e=0;null!=f[e];e++){switch(g){case"NumberList":i[e]+=f[e];break;default:i[e]+='"'+f[e]+'"'}h&&(i[e]+=b)}var j="";if(c){for(d=0;null!=a[d];d++)f=a[d],j+='"'+f.name+'"',d!=a.length-1&&(j+=b);j+="\n"}return j+i.getConcatenated("\n")},MatrixGenerators.createMatrixFromTrianglesMapping=function(a,b,c,d,e,f){var g,h,i,j;if(b.y!=a.y){var k=(c.y-a.y)/(b.y-a.y);g=(f.x-d.x-(e.x-d.x)*k)/(c.x-a.x-(b.x-a.x)*k),h=k*(e.x-d.x)/(c.y-a.y)-g*(b.x-a.x)/(b.y-a.y),i=(f.y-d.y-(e.y-d.y)*k)/(c.x-a.x-(b.x-a.x)*k),j=k*(e.y-d.y)/(c.y-a.y)-i*(b.x-a.x)/(b.y-a.y)}else g=(e.x-d.x)/(b.x-a.x),h=(f.x-d.x)/(c.y-a.y)-g*(c.x-a.x)/(c.y-a.y),i=(e.y-d.y)/(b.x-a.x),j=(f.y-d.y)/(c.y-a.y)-i*(c.x-a.x)/(c.y-a.y);return new Matrix(g,i,h,j,d.x-g*a.x-h*a.y,d.y-i*a.x-j*a.y)},MatrixGenerators.applyTransformationOnCanvasFromPoints=function(a,b,c,d,e,f,g){var h,i,j,k;if(c.y!=b.y){var l=(d.y-b.y)/(c.y-b.y);h=(g.x-e.x-(f.x-e.x)*l)/(d.x-b.x-(c.x-b.x)*l),i=l*(f.x-e.x)/(d.y-b.y)-h*(c.x-b.x)/(c.y-b.y),j=(g.y-e.y-(f.y-e.y)*l)/(d.x-b.x-(c.x-b.x)*l),k=l*(f.y-e.y)/(d.y-b.y)-j*(c.x-b.x)/(c.y-b.y)}else h=(f.x-e.x)/(c.x-b.x),i=(g.x-e.x)/(d.y-b.y)-h*(d.x-b.x)/(d.y-b.y),j=(f.y-e.y)/(c.x-b.x),k=(g.y-e.y)/(d.y-b.y)-j*(d.x-b.x)/(d.y-b.y);a.transform(h,j,i,k,e.x-h*b.x-i*b.y,e.y-j*b.x-k*b.y)},MatrixGenerators.createRotationMatrix=function(a,b){var c=new Matrix(Math.cos(a),Math.sin(a),-Math.sin(a),Math.cos(a));return b&&(c=MatrixGenerators.createTranslationMatrix(b.x,b.y).concat(c).concat(MatrixGenerators.createTranslationMatrix(-b.x,-b.y))),c},MatrixGenerators.createScaleMatrix=function(a,b,c){b=b||a;var d=new Matrix(a,0,0,b);return c&&(d=Matrix.createTranslationMatrix(c.x,c.y).concat(d).concat(Matrix.createTranslationMatrix(-c.x,-c.y))),d},MatrixGenerators.createTranslationMatrix=function(a,b){return new Matrix(1,0,0,1,a,b)},Matrix.prototype=new DataModel,Matrix.prototype.constructor=Matrix,Matrix.prototype.transformPoint=function(a){return new _Point(this.a*a.x+this.c*a.y+this.tx,this.b*a.x+this.d*a.y+this.ty)},Matrix.prototype.concat=function(a){return new Matrix(this.a*a.a+this.c*a.b,this.b*a.a+this.d*a.b,this.a*a.c+this.c*a.d,this.b*a.c+this.d*a.d,this.a*a.tx+this.c*a.ty+this.tx,this.b*a.tx+this.d*a.ty+this.ty)},Matrix.prototype.deltaTransformPoint=function(a){return _Point(this.a*a.x+this.c*a.y,this.b*a.x+this.d*a.y)},Matrix.prototype.getInverse=function(){var a=this.a*this.d-this.b*this.c;return new Matrix(this.d/a,-this.b/a,-this.c/a,this.a/a,(this.c*this.ty-this.d*this.tx)/a,(this.b*this.tx-this.a*this.ty)/a)},Matrix.prototype.rotate=function(a,b){return this.concat(MatrixGenerators.createRotationMatrix(a,b))},Matrix.prototype.scale=function(a,b,c){return this.concat(MatrixGenerators.createScaleMatrix(a,b,c))},Matrix.prototype.translate=function(a,b){return this.concat(MatrixGenerators.createTranslationMatrix(a,b))},Axis2D.prototype=new DataModel,Axis2D.prototype.constructor=Axis2D,Axis2D.prototype.setFrames=function(a,b){this.departureFrame=a,this.arrivalFrame=b,this._update()},Axis2D.prototype.setDepartureFrame=function(a){this.departureFrame=a,this._update()},Axis2D.prototype.setArrivalFrame=function(a){this.arrivalFrame=a,this._update()},Axis2D.prototype.project=function(a){return new _Point((a.x-this.departureFrame.x)*this.pW+this.arrivalFrame.x,(a.y-this.departureFrame.y)*this.pH+this.arrivalFrame.y)},Axis2D.prototype.projectX=function(a){return(a-this.departureFrame.x)*this.pW+this.arrivalFrame.x},Axis2D.prototype.projectY=function(a){return(a-this.departureFrame.y)*this.pH+this.arrivalFrame.y},Axis2D.prototype.inverseProject=function(a){return new _Point((a.x-this.arrivalFrame.x)/this.pW+this.departureFrame.x,(a.y-this.arrivalFrame.y)/this.pH+this.departureFrame.y)},Axis2D.prototype.inverseProjectX=function(a){return(a-this.arrivalFrame.x)/this.pW+this.departureFrame.x},Axis2D.prototype.inverseProjectY=function(a){return(a-this.arrivalFrame.y)/this.pH+this.departureFrame.y},Axis2D.prototype.move=function(a,b){this.arrivalFrame.x+=a,this.arrivalFrame.y+=b,this._update()},Axis2D.prototype.scale=function(a,b,c){this.arrivalFrame=this.arrivalFrame.expand(a,new _Point(b,c)),this._update()},Axis2D.prototype._update=function(){this.pW=this.arrivalFrame.width/this.departureFrame.width,this.pH=this.arrivalFrame.height/this.departureFrame.height},Axis2D.prototype.toString=function(){return"Axis2D["+this.departureFrame.toString()+", "+this.arrivalFrame.toString()+"]"},Axis.prototype=new DataModel,Axis.prototype.constructor=Axis,Axis.prototype.setDepartureInterval=function(a){this.departureInterval=a,console.log("--> departureInterval",a),this.departureAmplitude=a.getSignedAmplitude()},Axis.prototype.setArrivalInterval=function(a){this.arrivalInterval=a,this.arrivalAmplitude=a.getSignedAmplitude()},Axis.prototype.project=function(a){return this.arrivalInterval.x+this.arrivalAmplitude*(a-this.departureInterval.x)/this.departureAmplitude},Axis.prototype.update=function(){this.departureAmplitude=this.departureInterval.getSignedAmplitude(),this.arrivalAmplitude=this.arrivalInterval.getSignedAmplitude()},Axis.prototype.toString=function(){return"Axis["+this.departureInterval.toString()+", "+this.arrivalInterval.toString()+"]"},DateInterval.prototype=new DataModel,DateInterval.prototype.constructor=DateInterval,DateInterval.prototype.toString=function(){return"DateInterval["+this.date0+", "+this.date1+"]"},DateInterval.prototype.getMax=function(){return this.date1>this.date0?this.date1:this.date0},DateInterval.prototype.getMin=function(){return this.date0<this.date1?this.date0:this.date1},DateInterval.prototype.getTimesInterval=function(){return new Interval(this.date0.getTime(),this.date1.getTime())},DateInterval.prototype.getProduct=function(a){if(null!=a){if("Interval"==a.type){var b=this.date0.getTime(),c=this.date1.getTime(),d=c-b;return new DateInterval(new Date(b+a.x*d),new Date(b+a.y*d))}return null}},DateAxis.prototype=new DataModel,DateAxis.prototype.constructor=DateAxis,DateAxis.prototype.setDepartureDateInterval=function(a){this.departureDateInterval=a,this.time0=this.departureDateInterval.date0.getTime(),this.time1=this.departureDateInterval.date1.getTime(),this.dTime=this.time1-this.time0},DateAxis.prototype.setArrivalInterval=function(a){this.arrivalInterval=a,this.arrivalAmplitude=a.getAmplitude()},DateAxis.prototype.project=function(a){return this.arrivalInterval.x+this.arrivalAmplitude*(a.getTime()-this.time0)/this.dTime},DateAxis.prototype.update=function(){this.time0=this.departureDateInterval.date0.getTime(),this.time1=this.departureDateInterval.date1.getTime(),this.dTime=this.time1-this.time0,this.arrivalAmplitude=this.arrivalInterval.getAmplitude()},DateAxis.prototype.toString=function(){return"DateAxis["+this.departureDateInterval.toString()+", "+this.arrivalInterval.toString()+"]"},Tree.prototype=new Network,Tree.prototype.constructor=Tree,Tree.prototype.addNodeToTree=function(a,b){if(this.addNode(a),null==b)a.level=0,a.parent=null;else{var c=new Relation(b.id+"_"+a.id,b.id+"_"+a.id,b,a);this.addRelation(c),a.level=b.level+1,a.parent=b}this.nLevels=Math.max(this.nLevels,a.level+1)},Network.prototype._newCreateRelation=function(a,b,c,d){null==c&&(c=this.relationList.getNewId()),this._createRelation(a,b,c,d),b.level=a.level+1,b.parent=a,this.nLevels=Math.max(this.nLevels,b.level+1)},Tree.prototype.addFather=function(a,b){return null!=b.parent||-1==this.nodeList.indexOf(b)?!1:(this.addNode(a),b.parent=a,b.level=1,this.nLevels=Math.max(this.nLevels,1),void this.createRelation(a,b))},Tree.prototype.getNodesByLevel=function(a){for(var b=new NodeList,c=0;null!=this.nodeList[c];c++)this.nodeList[c].level==a&&b.addNode(this.nodeList[c]);return b},Tree.prototype.getLeaves=function(a){var b=new NodeList;if(a){if(0===a.toNodeList.length)return b.addNode(a),b;var c=function(a){0===a.toNodeList.length?b.addNode(a):a.toNodeList.forEach(c)};a.toNodeList.forEach(c)}else this.nodeList.forEach(function(a){0===a.toNodeList.length&&b.addNode(a)});return b},Tree.prototype.assignDescentWeightsToNodes=function(){this._assignDescentWeightsToNode(this.nodeList[0])},Tree.prototype._assignDescentWeightsToNode=function(a){var b;if(0===a.toNodeList.length)return a.descentWeight=1,1;for(b=0;null!=a.toNodeList[b];b++)a.descentWeight+=this._assignDescentWeightsToNode(a.toNodeList[b]);return a.descentWeight},Tree.prototype.getReport=function(){return"Tree contains "+this.nodeList.length+" nodes and "+this.relationList.length+" relations"},PointOperators.angleBetweenVectors=function(a,b){return Math.atan2(b.y,b.x)-Math.atan2(a.y,a.x)},PointOperators.angleFromTwoPoints=function(a,b){return Math.atan2(b.y-a.y,b.x-a.x)},PointOperators.dot=function(a,b){return a.x*b.x+a.y*b.y},PointOperators.twoPointsInterpolation=function(a,b,c){return new _Point((1-c)*a.x+c*b.x,(1-c)*a.y+c*b.y)},Point3D.prototype=new _Point,Point3D.prototype.constructor=Point3D,Point3D.prototype.distanceToPoint3D=function(a){return Math.sqrt(Math.pow(Math.abs(this.x-a.x),2)+Math.pow(Math.abs(this.y-a.y),2)+Math.pow(Math.abs(this.z-a.z),2))},Point3D.prototype.distanceToPointSquared=function(a){return Math.pow(Math.abs(this.x-a.x),2)+Math.pow(Math.abs(this.y-a.y),2)+Math.pow(Math.abs(this.z-a.z),2)},Point3D.prototype.getNorm=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},Point3D.prototype.normalizeToValue=function(a){var b=a/Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2)+Math.pow(this.z,2));return new Point3D(this.x*b,this.y*b,this.z*b)},Point3D.prototype.cross=function(a){var b=this.y*a.z-this.z*a.y,c=this.z*a.x-this.x*a.z,d=this.x*a.y-this.y*a.x;return new Point3D(b,c,d)},Point3D.prototype.dot=function(a){return this.x*a.x+this.y*a.y+this.z*a.z},Point3D.prototype.add=function(a){return new Point3D(a.x+this.x,a.y+this.y,a.z+this.z)},Point3D.prototype.subtract=function(a){return new Point3D(this.x-a.x,this.y-a.y,this.z-a.z)},Point3D.prototype.factor=function(a){return new Point3D(this.x*a,this.y*a,this.z*a)},Point3D.prototype.interpolate=function(a,b){return new Point3D((1-b)*this.x+b*a.x,(1-b)*this.y+b*a.y,(1-b)*this.z+b*a.z)},Point3D.prototype.getAngles=function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z),b=.5*Math.PI-Math.atan2(this.z/a,this.y/a),c=-Math.asin(this.x/a);return b<-Math.PI&&(b+=2*Math.PI),b>Math.PI&&(b-=2*Math.PI),c<-Math.PI&&(c+=2*Math.PI),c>Math.PI&&(c-=2*Math.PI),new Point3D(b,c,0)},Point3D.prototype.getInverseAngles=function(){var a=Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z),b=-.5*Math.PI+Math.atan2(-this.z/a,-this.y/a),c=Math.asin(-this.x/a);return b<-Math.PI&&(b+=2*Math.PI),b>Math.PI&&(b-=2*Math.PI),c<-Math.PI&&(c+=2*Math.PI),c>Math.PI&&(c-=2*Math.PI),new Point3D(b,c,0)},Point3D.prototype.clone=function(){return new Point3D(this.x,this.y,this.z)},Point3D.prototype.toString=function(){return"(x="+this.x+", y="+this.y+", z="+this.z+")"},Point3D.prototype.destroy=function(){delete this.type,delete this.name,delete this.x,delete this.y,delete this.z},GeometryOperators.getSoftenControlPoints=function(a,b,c,d){d=d||10;var e=PointOperators.angleFromTwoPoints(a,c),f=new _Point(b.x-d*Math.cos(e),b.y-d*Math.sin(e)),g=new _Point(b.x+d*Math.cos(e),b.y+d*Math.sin(e));return[f,g]},GeometryOperators.bezierCurvePoints=function(a,b,c,d,e,f,g,h,i){var j=1-i,k=j*a+i*c,l=j*b+i*d,m=j*c+i*e,n=j*d+i*f,o=j*e+i*g,p=j*f+i*h,q=j*k+i*m,r=j*l+i*n,s=j*m+i*o,t=j*n+i*p;return new _Point(i*s+j*q,i*t+j*r)},GeometryOperators.trueBezierCurveHeightHorizontalControlPoints=function(a,b,c,d,e,f,g){var h=b-a;if(g=(g-a)/h,e=(e-a)/h,f=(f-a)/h,null==GeometryOperators._bezierSimpleCurveTable){var i,j;for(GeometryOperators._bezierSimpleCurveTable=new NumberList,i=1;1e4>i;i++)j=GeometryOperators.bezierCurvePoints(0,0,e,0,f,1,1,1,i/1e4),GeometryOperators._bezierSimpleCurveTable[Math.floor(1e3*j.x)]=j.y;GeometryOperators._bezierSimpleCurveTable[0]=0,GeometryOperators._bezierSimpleCurveTable[1]=1}return GeometryOperators._bezierSimpleCurveTable[Math.floor(1e3*g)]*(d-c)+c},GeometryOperators.bezierCurveHeightHorizontalControlPoints=function(a,b,c,d,e){var f=Math.cos(Math.PI*(e-1)),g=f>0?1:-1;return(.5+.5*Math.pow(f*g,.6)*g)*(d-a)+a},GeometryOperators.distanceToBezierCurve=function(a,b,c,d,e,f,g,h,i,j){var k,l,m,n=.01,o=0,p=1,q=new _Point(a,b),r=GeometryOperators.bezierCurvePoints(a,b,c,d,e,f,g,h,n),s=new _Point(g,h),t=Math.pow(q.x-i.x,2)+Math.pow(q.y-i.y,2),u=Math.pow(r.x-i.x,2)+Math.pow(r.y-i.y,2),v=Math.pow(s.x-i.x,2)+Math.pow(s.y-i.y,2);for(k=0;10>k;k++)l=GeometryOperators.bezierCurvePoints(a,b,c,d,e,f,g,h,.5*(o+p)),m=GeometryOperators.bezierCurvePoints(a,b,c,d,e,f,g,h,.5*(o+p)+n),t=Math.pow(l.x-i.x,2)+Math.pow(l.y-i.y,2),u=Math.pow(m.x-i.x,2)+Math.pow(m.y-i.y,2),u>t?(p=.5*(o+p),s=GeometryOperators.bezierCurvePoints(a,b,c,d,e,f,g,h,p),v=Math.pow(s.x-i.x,2)+Math.pow(s.y-i.y,2)):(o=.5*(o+p),q=GeometryOperators.bezierCurvePoints(a,b,c,d,e,f,g,h,o),t=Math.pow(q.x-i.x,2)+Math.pow(q.y-i.y,2));return j?s:Math.sqrt(Math.min(t,v))},GeometryOperators.triangleContainsPoint=function(a,b,c,d){var e=(a.x-d.x)*(b.y-d.y)-(b.x-d.x)*(a.y-d.y),f=(b.x-d.x)*(c.y-d.y)-(c.x-d.x)*(b.y-d.y),g=(c.x-d.x)*(a.y-d.y)-(a.x-d.x)*(c.y-d.y);return e>0&&f>0&&g>0||e>=0&&f>=0&&g>=0},GeometryOperators.triangleArea=function(a){return Math.abs(a.a.x*(a.b.y-a.c.y)+a.b.x*(a.c.y-a.a.y)+a.c.x*(a.a.y-a.b.y))/2},GeometryOperators.lineFromTwoPoints=function(a,b){if(a.x==b.x)return new _Point(1/0,a.x);var c=(b.y-a.y)/(b.x-a.x);return new _Point(c,a.y-c*a.x)},GeometryOperators.distancePointToLine=function(a,b){var c,d;0===b.x?(c=1/0,d=a.x):(c=-1/b.x,d=a.y-c*a.x);var e=GeometryOperators.intersectionLines(b,new _Point(c,d));return Math.sqrt(Math.pow(a.x-e.x,2)+Math.pow(a.y-e.y,2))},GeometryOperators.distancePointToSegment=function(a,b,c){var d,e,f=b.x==c.x?1/0:(c.y-b.y)/(c.x-b.x),g=f==1/0?new _Point(1/0,b.x):new _Point(f,b.y-f*b.x);0===g.x?(d=1/0,e=a.x):(d=-1/g.x,e=a.y-d*a.x);var h=GeometryOperators.intersectionLines(g,new _Point(d,e));return h.x>=Math.min(b.x,c.x)&&h.x<=Math.max(b.x,c.x)?a.distanceToPoint(h):Math.min(a.distanceToPoint(b),a.distanceToPoint(c))},GeometryOperators.intersectionLines=function(a,b){if(a.x==b.x)return a.y==b.y?a.x==1/0?new _Point(a.y,0):new _Point(0,a.y):null;if(a.x==1/0)return new _Point(a.y,b.x*a.y+b.y);if(b.x==1/0)return new _Point(b.y,a.x*b.y+a.y);var c=(b.y-a.y)/(a.x-b.x);return new _Point(c,a.x*c+a.y)},GeometryOperators.VennCircles=function(a,b,c,d,e){var f,g,h=Math.sqrt(a/Math.PI),i=Math.sqrt(b/Math.PI),j=GeometryOperators.circleDistancesFromCommonArea(h,i,c,e);if(d){var k=(j*j+Math.pow(h,2)-Math.pow(i,2))/(2*j);f=new Point3D(-k,0,h),g=new Point3D(j-k,0,i)}else f=new Point3D(.5*-j,0,h),g=new Point3D(.5*j,0,i);return 0===c&&(f.x-=.1*j,g.x+=.1*j),new Polygon3D(f,g)},GeometryOperators.circleDistancesFromCommonArea=function(a,b,c,d){d=d||.1;for(var e=Math.max(a,b)-Math.min(a,b),f=a+b,g=.5*(e+f),h=0,i=GeometryOperators.circlesCommonArea(a,b,g);Math.abs(i-c)>d&&200>h;)i>c?(e=g,g=.5*(f+g)):(f=g,g=.5*(g+e)),h++,i=GeometryOperators.circlesCommonArea(a,b,g);return g},GeometryOperators.circlesCommonArea=function(a,b,c){if(c>=a+b)return 0;if(c+Math.min(a,b)<=Math.max(a,b))return Math.PI*Math.pow(Math.min(a,b),2);var d=Math.pow(c,2),e=Math.pow(a,2),f=Math.pow(b,2);return e*Math.acos((d+e-f)/(2*c*a))+f*Math.acos((d+f-e)/(2*c*b))-.5*Math.sqrt((-c+a+b)*(c+a-b)*(c-a+b)*(c+a+b))},GeometryOperators.circlesLensAngles=function(a,b){if(b.x<a.x){var c=b.clone();b=a.clone(),a=c}if(b.x+b.z<=a.x+a.z)return null;if(a.x-a.z>=b.x-b.z)return null;var d=b.x-a.x,e=(d*d+Math.pow(a.z,2)-Math.pow(b.z,2))/(2*d),f=Math.acos(e/a.z),g=a.z*Math.sin(f),h=Math.asin(g/b.z);return a.x+e<b.x?new NumberList(-f,f,Math.PI-h,Math.PI+h):new NumberList(-f,f,h,-h)},GeometryOperators.delauney=function(a){return _triangulate(a)},PolygonOperators.hull=function(a,b){b=null==b?!1:b;var c,d,e,f=a,g=f.length,h=0,i=new _Polygon;if(b&&(e=new NumberList),f=PolygonOperators.sortOnXY(f),b){for(c=0;g>c;c++){for(;h>=2&&PolygonOperators.crossProduct3Points(i[h-2],i[h-1],f[c])<=0;)h--;i[h++]=f[c],e[h-1]=c}for(c=g-2,d=h+1;c>=0;c--){for(;h>=d&&PolygonOperators.crossProduct3Points(i[h-2],i[h-1],f[c])<=0;)h--;i[h++]=f[c],e[h-1]=c}return NumberList.fromArray(e.getSubList(new Interval(0,h-2)))}for(c=0;g>c;c++){for(;h>=2&&PolygonOperators.crossProduct3Points(i[h-2],i[h-1],f[c])<=0;)h--;i[h++]=f[c]}for(c=g-2,d=h+1;c>=0;c--){for(;h>=d&&PolygonOperators.crossProduct3Points(i[h-2],i[h-1],f[c])<=0;)h--;i[h++]=f[c]}return _Polygon.fromArray(i.getSubList(new Interval(0,h-2)))},PolygonOperators.buildDendrogramFromPolygon=function(a){var b,c,d,e,f,g=new Tree,h=new NodeList,i=new _Polygon;a.forEach(function(a,c){b=new Node("point_"+c,"point_"+c),b.weight=1,b.barycenter=a,b.point=a,b.polygon=new _Polygon(a),g.addNode(b),i.push(b),h.push(b)}),g.nodeList=g.nodeList.getReversed();for(var j,k=function(a,b){var d=new Node("("+a.id+","+b.id+")","("+a.id+","+b.id+")");return d.polygon=a.polygon.concat(b.polygon),d.weight=d.polygon.length,c=a.weight+b.weight,d.barycenter=new _Point((a.weight*a.barycenter.x+b.weight*b.barycenter.x)/c,(a.weight*a.barycenter.y+b.weight*b.barycenter.y)/c),g.addNode(d),g._newCreateRelation(d,a),g._newCreateRelation(d,b),d};i.length>1;)j=PolygonOperators._findClosestNodes(i),e=i[j[0]],f=i[j[1]],d=k(e,f),d.distance=j.distance,console.log("distance:",d.distance),i.splice(j[0],1),i.splice(j[1]-1,1),i.push(d);g.nodeList=g.nodeList.getReversed();var l=function(a,b){a.level=b+1,a.toNodeList.forEach(function(b){l(b,a.level)})};return l(g.nodeList[0],-1),g.leaves=h,g},PolygonOperators._findClosestNodes=function(a){var b,c,d,e,f=9999999999;for(b=0;null!=a[b+1];b++)for(c=b+1;null!=a[c];c++)d=Math.pow(a[b].barycenter.x-a[c].barycenter.x,2)+Math.pow(a[b].barycenter.y-a[c].barycenter.y,2),f>d&&(f=d,e=[b,c]);return e.distance=f,e},PolygonOperators.sortOnXY=function(a){return a.sort(function(a,b){return a.x<b.x?-1:a.x==b.x&&a.y<b.y?-1:1})},PolygonOperators.crossProduct3Points=function(a,b,c){return(b.x-a.x)*(c.y-a.y)-(b.y-a.y)*(c.x-a.x)},PolygonOperators.expandFromBarycenter=function(a,b){for(var c=new _Polygon,d=a.getBarycenter(),e=0;null!=a[e];e++)c[e]=a[e].expandFromPoint(d,b);return c},PolygonOperators.expandInAngles=function(a,b){for(var c,d,e,f=new _Polygon,g=a[a.length-1],h=a[0],i=a[1],j=.5*Math.atan2(h.y-i.y,h.x-i.x)+.5*Math.atan2(h.y-g.y,h.x-g.x),k=a.containsPoint(new _Point(h.x+Math.floor(b)*Math.cos(j),h.y+Math.floor(b)*Math.sin(j)))?-1:1,l=0;null!=a[l];l++)g=a[(l-1+a.length)%a.length],h=a[l],i=a[(l+1)%a.length],c=Math.atan2(h.y-i.y,h.x-i.x),d=Math.atan2(h.y-g.y,h.x-g.x),e=Math.abs(d-c)<Math.PI?-1:1,j=.5*c+.5*d,f[l]=new _Point(h.x+k*e*b*Math.cos(j),h.y+k*e*b*Math.sin(j));return f},PolygonOperators.simplifyPolygon=function(a,b){b=null==b||0===b||void 0===b?1:b;var c,d,e,f,g,h=a.clone(),i=a.length;for(g=0;i>g;g++)c=h[g],d=h[(g+1)%i],e=h[(g+2)%i],f=GeometryOperators.lineFromTwoPoints(c,e),GeometryOperators.distancePointToLine(d,f)<b&&(h=h.getWithoutElementAtIndex((g+1)%i),g--),i=h.length;return h},PolygonOperators.bezierPolygonContainsPoint=function(a,b,c,d){var e=a.getFrame();d.clearContext(),d.context.fillStyle="black",d.context.fillRect(0,0,e.width,e.height),null!=c&&(d.context.strokeStyle="black",d.context.lineWidth=c),d.context.fillStyle="white",d.context.beginPath(),d.drawBezierPolygon(a,-e.x,-e.y),d.context.fill(),null!=c&&d.context.stroke();var f=d.context.getImageData(b.x-e.x,b.y-e.y,1,1).data;return d.clearContext(),f[0]>0},PolygonOperators.getBezierPolygonBestCenter=function(a,b,c){b=null==b?500:b;var d=a.getFrame();c.context.fillStyle="black",c.context.fillRect(0,0,d.width,d.height),c.context.fillStyle="white",c.context.beginPath(),c.drawBezierPolygon(a,-d.x,-d.y),c.context.fill();for(var e,f,g,h,i=0,j=0;b>j;j++)for(e=d.getRandomPoint(),f=0;TwoPi>=f;f+=.1){g=f;var k=c.context.getImageData(e.x+g*Math.cos(f)-d.x,e.y+g*Math.sin(f)-d.y,1,1).data;if(0===k[0]){g>i&&(i=g,h=e);break}}return h},PolygonOperators.convexHull=function(a,b){var c=this.hull(a,!0),d=NumberListGenerators.createSortedNumberList(a.length);d=d.getWithoutElementsAtIndexes(c);for(var e,f,g,h,i,j,k,l,m,n=new _Point,o=b-1,p=c.length;b>o;){for(o=999999999,e=0;p>e;e++)for(g=a[c[e]],h=a[c[(e+1)%c.length]],n.x=.5*(g.x+h.x),n.y=.5*(g.y+h.y),m=Math.sqrt(Math.pow(h.x-g.x,2)+Math.pow(h.y-g.y,2)),f=0;null!=d[f];f++)i=a[d[f]],j=(Math.sqrt(Math.pow(i.x-g.x,2)+Math.pow(i.y-g.y,2))+Math.sqrt(Math.pow(i.x-h.x,2)+Math.pow(i.y-h.y,2)))/Math.pow(m,2),o>j&&(o=j,k=e,l=f);for(e=p-1;e>k;e--)c[e+1]=c[e];if(c[k+1]=d[l],d.splice(l,1),0===d.length)return c;p++}return c},PolygonOperators.controlPointsFromPointsAnglesIntensities=function(a,b,c){for(var d=new _Polygon,e=0;null!=a[e];e++)e>0&&d.push(new _Point(a[e].x-c[e]*Math.cos(b[e]),a[e].y-c[e]*Math.sin(b[e]))),e<a.length-1&&d.push(new _Point(a[e].x+c[e]*Math.cos(b[e]),a[e].y+c[e]*Math.sin(b[e])));return d},PolygonOperators.placePointsInsidePolygon=function(a,b,c){var d=new _Polygon,e=a.getFrame();switch(c=c||0){case 0:for(var f;d.length<b;)f=new _Point(e.x+Math.random()*e.width,e.y+Math.random()*e.height),PolygonOperators.polygonContainsPoint(a,f)&&d.push(f);return d}},PolygonOperators.placePointsInsideBezierPolygon=function(a,b,c,d){var e=new _Polygon,f=a.getFrame();switch(c=c||0){case 0:for(var g,h=0;e.length<b&&1e3>h;)g=new _Point(f.x+Math.random()*f.width,f.y+Math.random()*f.height),h++,PolygonOperators.bezierPolygonContainsPoint(a,g,d)&&(e.push(g),h=0);return e}},CountryList.prototype=new NodeList,CountryList.prototype.constructor=CountryList,CountryList.fromArray=function(a){var b=NodeList.fromArray(a);return b.type="CountryList",b.getCountryFromName=CountryList.prototype.getCountryFromName,b.removeAntarctica=CountryList.prototype.removeAntarctica,b.removeTinyPolygonsFromCountries=CountryList.prototype.removeTinyPolygonsFromCountries,b.removeTinyCountries=CountryList.prototype.removeTinyCountries,b.simplifyAntarctica=CountryList.prototype.simplifyAntarctica,b.assignValuesToCountriesFromTable=CountryList.prototype.assignValuesToCountriesFromTable,b.simplifyPolygons=CountryList.prototype.simplifyPolygons,b},CountryList.prototype.getCountryFromName=function(a){for(var b=0;null!=this[b];b++)if(this[b].nameMatches(a))return this[b];return null},CountryList.prototype.removeAntarctica=function(){this.removeNode(this.getNodeById("AQ"))},CountryList.prototype.removeTinyPolygonsFromCountries=function(a){a=.2;for(var b,c,d=0;null!=this[d];d++)for(b=this[d],c=0;null!=b.polygonList[c];c++)b.polygonList[c].getFrame().getArea()<a&&(b.polygonList.splice(c,1),c--)},CountryList.prototype.removeTinyCountries=function(a){a=.5;for(var b,c,d,e=0;null!=this[e];e++){for(b=this[e],d=!0,c=0;null!=b.polygonList[c];c++)if(b.polygonList[c].getFrame().getArea()>a){d=!1;break}d&&(this.removeNode(this[e]),e--)}},CountryList.prototype.simplifyPolygons=function(a){for(var b,c,d,e,f=0;null!=this[f];f++){for(b=this[f],d=0,c=0;null!=b.polygonList[c];c++)b.polygonList[c]=PolygonOperators.simplifyPolygon(b.polygonList[c],a),b.polygonList[c].length<3?(b.polygonList.splice(c,1),c--):b.polygonList[c].length>d&&(d=b.polygonList[c].length,e=c);b.longestPolygon.destroy(),b.longestPolygon=b.polygonList[e]}},CountryList.prototype.simplifyAntarctica=function(){var a=this.getNodeById("AQ").simplePolygonList;null!=a&&(a[0].splice(10,1),a[0].splice(10,1)),a=this.getNodeById("AQ").polygonList},CountryList.prototype.assignValuesToCountriesFromTable=function(a,b){for(var c,d,e=0;null!=a[0][e];e++)if(d=this.getCountryFromName(a[0][e]),null!=d)for(c=1;null!=a[c];c++)d[a[c].name]=a[c][e]==b?null:a[c][e]},CountryOperators.getSimplifiedName=function(a){return a.replace(/[\.\- ,\']/g,"").toLowerCase()},CountryOperators.getSimplifiedNames=function(a){for(var b,c=new StringList,d=0;null!=a[d];d++)b=this.getSimplifiedName(a[d]),""!==b&&c.pushIfUnique(b);return c},Country.prototype=new Node,Country.prototype.constructor=Country,Country.prototype.generatesSimplifiedNames=function(){this._simplifiedNames=CountryOperators.getSimplifiedNames(this.alternativeNames),this._simplifiedId=CountryOperators.getSimplifiedName(this.id),this._simplifiedName=CountryOperators.getSimplifiedName(this.name),this.shortName=this.name.replace("Democratic Republic","D.R.").replace("United States","U.S.A").replace("United Arab","U.A.")},Country.prototype.nameMatches=function(a){return null==this._simplifiedId&&this.generatesSimplifiedNames(),a=CountryOperators.getSimplifiedName(a),a==this._simplifiedId||a==this._simplifiedName?!0:-1!=this._simplifiedNames.indexOf(a)},Country.prototype.getFrame=function(){return null==this._frame&&(this._frame=null==this.simplePolygonList?this.polygonList.getFrame():this.simplePolygonList.getFrame()),this._frame},Polygon3DList.prototype=new List,Polygon3DList.prototype.constructor=Polygon3DList,Polygon3DList.fromArray=function(a){var b=List.fromArray(a);return b.type="Polygon3DList",b},ColorScale.prototype=new DataModel,ColorScale.prototype.constructor=ColorScale,ColorScale.prototype.getColor=function(a){return this.colorScaleFunction(a)},ColorScale.prototype.getColorList=function(a){var b,c=new ColorList;for(b=0;a>b;b++)c.push(this.getColor(b/(a-1)));return c},Space2D.prototype.activeInteraction=function(){this.active||(this.active=!0,this.graphics.on("mousedown",this.onMouse,this),this.graphics.on("mouseup",this.onMouse,this),this.graphics.on("mousewheel",this.wheel,this))},Space2D.prototype.deActivate=function(){this.active=!1,this.dragging=!1,this.graphics.off("mousedown",this.onMouse,this),this.graphics.off("mouseup",this.onMouse,this),this.graphics.off("mousemove",this.onMouse,this),this.graphics.off("mousewheel",this.wheel,this)},Space2D.prototype.stopDragging=function(){this.graphics.off("mousemove",this.onMouse,this)},Space2D.prototype.project=function(a){return new _Point((a.x-this.center.x)*this.scale,(a.y+this.center.y)*this.scale)},Space2D.prototype.projectX=function(a){return(a-this.center.x)*this.scale},Space2D.prototype.projectY=function(a){return(a-this.center.y)*this.scale},Space2D.prototype.inverseProject=function(a){return new _Point(a.x/this.scale+this.center.x,a.y/this.scale+this.center.y)},Space2D.prototype.inverseProjectX=function(a){return a/this.scale+this.center.x},Space2D.prototype.inverseProjectY=function(a){return a/this.scale+this.center.y},Space2D.prototype.move=function(a,b){this.center=this.center.subtract(b?a.factor(1/this.scale):a)},Space2D.prototype.factorScaleFromPoint=function(a,b){var c=(1-1/b)/this.scale;this.center.x=c*a.x+this.center.x,this.center.y=c*a.y+this.center.y,this.scale*=b},Space2D.prototype.fixX=function(a,b){this.center.x=a-b/this.scale},Space2D.prototype.fixY=function(a,b){this.center.y=a-b/this.scale},Space2D.prototype.fixHorizontalInterval=function(a,b){this.scale=b.getAmplitude()/a.getAmplitude(),this.fixX(.5*(a.x+a.y),.5*this.graphics.cW)},Space2D.prototype.onMouse=function(a){switch(a.type){case"mousedown":if(!this.active)return;this.dragging=!0,this.prev_mX=this.graphics.mX,this.prev_mY=this.graphics.mY,this.graphics.on("mousemove",this.onMouse,this);break;case"mouseup":this.dragging=!1,this.graphics.on("mousemove",this.onMouse,this);break;case"mousemove":if(!this.active)return;this.center.x+=(this.prev_mX-this.graphics.mX)/this.scale,this.center.y+=(this.prev_mY-this.graphics.mY)/this.scale,this.prev_mX=this.graphics.mX,this.prev_mY=this.graphics.mY}},Space2D.prototype.wheel=function(a){return this.active?this.scale<=this.MIN_SCALE&&a.value>0?void(this.scale=this.MIN_SCALE):this.scale>=this.MAX_SCALE&&a.value<0?void(this.scale=this.MAX_SCALE):void this.factorScaleFromPoint(new _Point(this.graphics.mX-0,this.graphics.mY-0),1-.02*a.value):void 0},DateListConversions.toStringList=function(a){for(var b=new StringList,c=0;null!=a[c];c++)b[c]=DateOperators.dateToString(a[c]);return b},DateListOperators.buildTimeTreeFromDates=function(a){if(null!=a){var b,c,d=new Tree,e=a[0],f=a[0];a.forEach(function(a){e=e>a?a:e,f=a>f?a:f}),b=e.getFullYear(),c=e.getFullYear();var g=new Node("years","years");d.addNodeToTree(g),g.dates=a.clone();var h,i,j,k,l,m,n,o,p,q,r;for(h=b;c>=h;h++)m=new Node(String(h),String(h)),d.addNodeToTree(m,g);return a.forEach(function(a){if(h=DateListOperators._y(a),m=g.toNodeList[h-b],null==m.dates)for(m.dates=new DateList,i=0;12>i;i++)n=new Node(DateOperators.MONTH_NAMES[i]+"_"+h,DateOperators.MONTH_NAMES[i]),d.addNodeToTree(n,m),r=DateOperators.getNDaysInMonth(h,i+1);if(m.dates.push(a),i=DateListOperators._m(a),n=m.toNodeList[i],null==n.dates)for(n.dates=new DateList,j=0;r>j;j++)o=new Node(j+1+"_"+n.id,String(j+1)),d.addNodeToTree(o,n);if(n.dates.push(a),j=DateListOperators._d(a),o=n.toNodeList[j],null==o.dates)for(o.dates=new DateList,k=0;24>k;k++)p=new Node(k+"_"+o.id,String(k)+":00"),d.addNodeToTree(p,o);if(o.dates.push(a),k=DateListOperators._h(a),p=o.toNodeList[k],null==p.dates)for(p.dates=new DateList,l=0;60>l;l++)q=new Node(l+"_"+p.id,String(l)),d.addNodeToTree(q,p);p.dates.push(a),l=DateListOperators._mn(a),q=p.toNodeList[l],null==q.dates&&(q.dates=new DateList),q.weight++,q.dates.push(a)}),d.assignDescentWeightsToNodes(),d}},DateListOperators._y=function(a){return a.getFullYear()},DateListOperators._m=function(a){return a.getMonth()},DateListOperators._d=function(a){return a.getDate()-1},DateListOperators._h=function(a){return a.getHours()},DateListOperators._mn=function(a){return a.getMinutes()},DateListOperators._s=function(a){return a.getSeconds()},DateListOperators._ms=function(a){return a.getMilliseconds()},GeoOperators.EARTH_RADIUS=6371009,GeoOperators.EARTH_DIAMETER=2*GeoOperators.EARTH_RADIUS,GeoOperators.geoCoordinateToDecimal=function(a){return Math.floor(a)+1.66667*(a-Math.floor(a))},GeoOperators.geoDistance=function(a,b){var c=Math.pow(Math.sin(.5*(b.y-a.y)*gradToRad),2)+Math.cos(a.y*gradToRad)*Math.cos(b.y*gradToRad)*Math.pow(Math.sin(.5*(b.x-a.x)*gradToRad),2);return GeoOperators.EARTH_DIAMETER*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))},GeoOperators.polygonLength=function(a){if(a.length<2)return 0;for(var b=GeoOperators.geoDistance(a[0],a[1]),c=2;null!=a[c];c++)b+=GeoOperators.geoDistance(a[c-1],a[c]);return b},CountryListOperators.getCountryByName=function(a,b){for(var c=CountryOperators.getSimplifiedName(b),d=0;null!=a[d];d++)if(-1!=a[d].simplifiedNames.indexOf(c))return a[d];return null},RectangleOperators.minRect=function(){if(null==arguments||arguments.length<1)return null;var a,b=arguments[0].clone();for(b.width=b.getRight(),b.height=b.getBottom(),a=1;null!=arguments[a];a++)b.x=Math.min(b.x,arguments[a].x),b.y=Math.min(b.y,arguments[a].y),b.width=Math.max(arguments[a].getRight(),b.width),b.height=Math.max(arguments[a].getBottom(),b.height);return b.width-=b.x,b.height-=b.y,b},RectangleOperators.packingRectangles=function(a,b,c,d){switch(null==c&&(c=new Rectangle(0,0,1,1)),b=b?b:0){case 0:return RectangleOperators.squarify(c,a);case 1:var e=a.getMinMaxInterval();e.min<0&&(a=a.add(-e.min),e=new Interval(0,e.max-e.min));var f,g,h=a.getSum(),i=new List,j=c.y,k=c.height/h;for(g=0;null!=a[g];g++)f=k*a[g],i.push(new Rectangle(c.x,j,c.width,f)),j+=f;return i;case 2:e=a.getMinMaxInterval(),e.min<0&&(a=a.add(-e.min),e=new Interval(0,e.max-e.min)),h=a.getSum(),i=new List;var l,m=c.x,n=c.width/h;for(g=0;null!=a[g];g++)l=n*a[g],i.push(new Rectangle(m,c.y,l,c.height)),m+=l;return i;case 3:if(a.length<6);else if(6==a.length){var o=new Rectangle(.44,.36,.16,.45),p=new Rectangle(.6,.15,.3,.3),q=new Rectangle(.72,.45,.28,.32),r=new Rectangle(.38,.04,.22,.32),s=new _Point(.6,.36);o=expandRectangle(o,Math.sqrt(a[0]),s),p=expandRectangle(p,Math.sqrt(a[1]),s),r=expandRectangle(r,Math.sqrt(a[3]),s),q.x=p.x+.5*p.width,q.y=p.bottom;var t=new _Point(q.x+.3*q.width,p.bottom);q=expandRectangle(q,Math.sqrt(a[2]),t),q.y+=.2*q.height;
var u=new _Point(.26,.36+Math.max(.3*o.height,.2*r.height)),v=new Rectangle(.1,u.y-.4,.2,.4),w=new Rectangle(.22,u.y,.16,.5);v=expandRectangle(v,Math.sqrt(a[4]),u),w=expandRectangle(w,Math.sqrt(a[5]),u);var x=.2*Math.max(r.width,o.width,w.right-u.x,v.right-u.x),y=Math.min(r.x,o.x)-Math.max(v.right,w.right)-x;return w.x+=y,v.x+=y,new List(o,p,q,r,v,w)}case 4:return europeQuadrigram(a);case 5:d=d||0;var z;z=0===d?Math.round(Math.sqrt(a.length)):Math.round(a.length/d);var A=Math.ceil(a.length/z),B=z*A-a.length,C=a.getAverage(),D=ListOperators.concat(a,ListGenerators.createListWithSameElement(B,C)),E=ListOperators.slidingWindowOnList(D,A,A,0),F=E.getSums(),G=this.packingRectangles(F,2,c);for(i=List(),g=0;z>g;g++)i=ListOperators.concat(i,this.packingRectangles(E[g],1,G[g]));return i;case 6:}return null},RectangleOperators.squarify=function(a,b,c,d){if(null!=b){if(0===b.length)return new RectangleList;if(1===b.length)return new RectangleList(a);c=c?c:!1,d=d?d:!1;var e;e=c?b:NumberListOperators.normalizedToSum(b);var f;d||(f=e.getSortIndexes(),e=ListOperators.sortListByNumberList(e,e));var g,h,i,j,k,l,m,n,o,p=a.width*a.height,q=new RectangleList,r=a.clone(),s=new List,t=0,u=new Rectangle,v=b.length;if(v>2){var w;for(n=t;v>n;n++)if(i=Number.MAX_VALUE,0===e[n])q.push(new Rectangle(u.x,u.y,0,0));else{for(o=1;v>o&&(g=NumberList.fromArray(e.slice(n,n+o)),h=s.slice(),w=g.getSum(),k=w*p,u.x=r.x,u.y=r.y,r.width>r.height?(u.width=k/r.height,u.height=r.height):(u.width=r.width,u.height=k/r.width),s=RectangleOperators.partitionRectangle(u,g,w),j=s.highestRatio,!(j>=i));o++)i=j;if(0===h.length){if(q.push(new Rectangle(r.x,r.y,r.width,r.height)),q.length==v){if(!d){for(m=new List,n=0;null!=q[n];n++)m[f[n]]=q[n];return m}return q}t++}else{if(q=q.concat(h),q.length==v){if(!d){for(m=new List,n=0;null!=q[n];n++)m[f[n]]=q[n];return m}return q}t+=h.length,l=h[h.length-1],r.width>r.height?(r.x=l.width+l.x,r.width-=l.width):(r.y=l.height+l.y,r.height-=l.height)}n=t-1}}else 2==v?(g=e.clone(),u=a.clone(),q=RectangleOperators.partitionRectangle(u,g,g.getSum())):q[0]=new Rectangle(a.x,a.y,a.width,a.height);if(!d){for(m=new List,n=0;null!=q[n];n++)m[f[n]]=q[n];return m}return q}},RectangleOperators.partitionRectangle=function(a,b,c){var d,e,f,g=a.width*a.height,h=new List,i=new Rectangle(a.x,a.y,a.width,a.height),j=1,k=b.length;for(e=0;k>e;e++)d=b[e]*g/c,a.width>a.height?(f=new Rectangle(i.x,i.y,d/i.height,i.height),h.push(f),i.x+=d/i.height):(f=new Rectangle(i.x,i.y,i.width,d/i.width),h.push(f),i.y+=d/i.width),f.ratio=Math.max(f.width,f.height)/Math.min(f.width,f.height),j=Math.max(j,f.ratio);return h.highestRatio=j,h},RectangleOperators._getHighestRatio=function(a){var b,c,d=1;for(c=0;c<a.length;c++)b=a[c],d=Math.max(d,b.getRatio());return d},PolygonListOperators.simplifyPolygons=function(a,b,c){for(var d,e=new PolygonList,f=0;null!=a[f];f++)d=PolygonOperators.simplifyPolygon(a[f],b),(d.length>0||!c)&&e.push(d);return e},PolygonListEncodings.StringToPolygonList=function(a,b,c){b=b||",",c=c||"/";for(var d,e,f,g,h=new PolygonList,i=StringOperators.splitString(a,c),j=0;null!=i[j];j++){for(d=new _Polygon,g=StringOperators.splitString(i[j],b),f=0;null!=g[f];f+=2)e=new _Point(Number(g[f]),Number(g[f+1])),d.push(e);h.push(d)}return h},PolygonListEncodings.PolygonListToString=function(a,b,c){b=b||",",c=c||"/";var d,e,f="";for(d=0;null!=a[d];d++)for(f+=0===d?"":c,e=0;null!=a[d][e];e++)f+=(0===e?"":b)+a[d][e].x+b+a[d][e].y;return f},PolygonGenerators.createPolygon=function(a,b,c){var d=new _Polygon;switch(b){case 0:for(var e=0;a>e;e++)d.push(new _Point(c.x+c.width*Math.random(),c.y+c.height*Math.random()));break;case 1:}return d},GeometryConversions.twoNumberListsToPolygon=function(a,b){for(var c=Math.min(a.length,b.length),d=new _Polygon,e=0;c>e;e++)d[e]=new _Point(a[e],b[e]);return d},GeometryConversions.PolygonToNumberTable=function(a){if(null==a)return null;var b=new NumberTable;return b[0]=new NumberList,b[1]=new NumberList,a.forEach(function(a){b[0].push(a.x),b[1].push(a.y)}),b},ColorScaleGenerators.createColorScaleFromColors=function(a,b){if(null==a||null==b||a.length<=0||b.length<=0||a.length!=b.length+2)return null;null==a.rgbs&&(a.rgbs=a.getRgbArrays()),b=b.slice(),b.unshift(0),b.push(1);var c=function(c){var d,e,f;for(d=0;null!=b[d+1];d++)if(c<b[d+1])return e=(c-b[d])/(b[d+1]-b[d]),f=1-e,"rgb("+Math.floor(f*a.rgbs[d][0]+e*a.rgbs[d+1][0])+","+Math.floor(f*a.rgbs[d][1]+e*a.rgbs[d+1][1])+","+Math.floor(f*a.rgbs[d][2]+e*a.rgbs[d+1][2])+")"};return c},ColorListOperators.colorListFromColorScale=function(a,b){return a.getColorList.apply(a,[b])},ColorListOperators.colorListFromColorScaleFunction=function(a,b){var c,d=new ColorList;for(c=0;b>c;c++)d[c]=a(c/(b-1));return d},ColorListOperators.colorListFromColorScaleFunctionAndNumberList=function(a,b,c){c=null==c?!0:c,c&&(b=NumberListOperators.normalized(b));var d,e=new ColorList;for(d=0;null!=b[d];d++)e[d]=a(b[d]);return e},ColorListOperators.polygon3DToColorList=function(a){var b,c=a.length,d=new ColorList;for(b=0;c>b;b++)d.push(ColorOperators.point3DToColor(a[b]));return d},ColorListOperators.colorListToPolygon3D=function(a){var b,c=a.length,d=new Polygon3D;for(b=0;c>b;b++)d.push(ColorOperators.colorToPoint3D(a[b]));return d},ColorGenerators.randomColor=function(a){return a=null==a?1:a,"rgba("+Math.floor(256*Math.random())+","+Math.floor(256*Math.random())+","+Math.floor(256*Math.random())+","+a+")"},TableOperators.getElementFromTable=function(a,b,c){return null==a[b]?null:a[b][c]},TableOperators.getSubTable=function(a,b,c,d,e){if(null==a)return a;var f=a.length;if(0===f)return null;var g=new Table;0>=d&&(d=f-b+d),b=Math.min(b,f-1),d=Math.min(d,f-b);var h=a[0].length;if(0===h)return null;0>=e&&(e=h-c+e),c=Math.min(c,h-1),e=Math.min(e,h-c);var i,j,k,l,m;for(k=b;b+d>k;k++){for(i=a[k],j=new List,j.name=a[k].name,l=c;c+e>l;l++)m=i[l],j.push(m);g.push(j.getImproved())}return g.getImproved()},TableOperators.getFilteredByValue=function(a,b,c,d,e,f){if(null!=a&&0!==a.length&&null!=c){null==b&&(b="=c"),"="==b&&(b="==");var g,h,i,j,k=new NumberList,l=a.getListLength(),m=0,n=a.length,o=_typeOf(c);switch("string"!=o||isNaN(c)||""===c.trim()||(o="number",c=Number(c)),"=c"==b&&(b="string"==o?"contains":"=="),"number"==o&&"between"==b&&(isNaN(e)?b="noop":e=Number(e)),"between"==b&&null==e&&(b="noop"),null!=d&&(m=d,n=d+1),(null==f||f!==!0&&f!==!1)&&(f=!0),"string"==o&&f&&(c=c.toLowerCase(),e=e?String(e).toLowerCase():e),"=="==b&&f&&(b="==i"),"!="==b&&f&&(b="!=i"),b){case"==":for(g=0;l>g;g++)for(h=m;n>h;h++)if(a[h][g]==c){k.push(g);break}break;case"==i":for(g=0;l>g;g++)for(h=m;n>h;h++)if(i=String(a[h][g]).toLowerCase(),i==c){k.push(g);break}break;case"!=":for(g=0;l>g;g++){for(j=!0,h=m;n>h;h++)if(a[h][g]==c){j=!1;break}j&&k.push(g)}break;case"!=i":for(g=0;l>g;g++){for(j=!0,h=m;n>h;h++)if(i=String(a[h][g]).toLowerCase(),i==c){j=!1;break}j&&k.push(g)}break;case"contains":for(g=0;l>g;g++)for(h=m;n>h;h++)if(i=f?String(a[h][g]).toLowerCase():String(a[h][g]),i.indexOf(c)>-1){k.push(g);break}break;case"<":case"<=":for(g=0;l>g;g++)for(h=m;n>h;h++)if(o==_typeOf(a[h][g])){if(i=f?String(a[h][g]).toLowerCase():String(a[h][g]),c>i){k.push(g);break}if(i==c&&"<="==b){k.push(g);break}}break;case">":case">=":for(g=0;l>g;g++)for(h=m;n>h;h++)if(o==_typeOf(a[h][g])){if(i=f?String(a[h][g]).toLowerCase():String(a[h][g]),i>c){k.push(g);break}if(i==c&&">="==b){k.push(g);break}}break;case"between":for(g=0;l>g;g++)for(h=m;n>h;h++)if(o==_typeOf(a[h][g])&&(i=f?String(a[h][g]).toLowerCase():String(a[h][g]),"number"==o&&(i=Number(i)),i>=c&&e>=i)){k.push(g);break}}var p=a.getSubListsByIndexes(k);return p}},TableOperators.getSubTableByElementOnList=function(a,b,c){if(null!=b&&null!=c){var d,e,f=a.length;0>b&&(b=f+b),b%=f;var g=instantiateWithSameType(a);for(g.name=a.name,d=0;f>d;d++){var h=new List;h.name=a[d].name,g.push(h)}var i,j=a[b],k=j.length;for(d=0;k>d;d++)if(c==j[d])for(i=g.length,e=0;i>e;e++)g[e].push(a[e][d]);for(f=g.length,d=0;f>d;d++)g[d]=g[d].getImproved();return g.getImproved()}},TableOperators.getSubTableByElementsOnList=function(a,b,c){if(null!=b&&null!=c){var d,e;0>b&&(b=a.length+b),b%=a.length;var f=instantiateWithSameType(a);f.name=a.name,a.forEach(function(a){var b=new List;b.name=a.name,f.push(b)});var g=a[b],h=ListOperators.getBooleanDictionaryForList(c);for(d=0;null!=g[d];d++)if(h[g[d]])for(e=0;null!=f[e];e++)f[e].push(a[e][d]);return f.forEach(function(a,b){f[b]=a.getImproved()}),f.getImproved()}},TableOperators.getRandomRows=function(a,b,c){if(c=null==c?!0:c,null==a||null==a[0])return null;if(null==b&&(b=.5),0>b||b>1)return null;var d=a[0].length,e=Math.round(b*d),f=NumberListGenerators.createSortedNumberList(d,0,1);return f=f.getRandomElements(e,c),f=f.getSorted(),a.getSubListsByIndexes(f)},TableOperators.transpose=function(a,b){return null==a?null:a.getTransposed(b)},TableOperators.trainingTestPartition=function(a,b,c,d){if(null!=a&&null!=b){c=c||0,d=d||0;var e=0,f=new NumberList,g=new NumberList,h=1==c?new NumberOperators._Alea("my",d,"seeds"):Math.random;return 2==c&&(e=Math.floor(b/(1-b)*10)),a[0].forEach(function(a,d){0===c||1===c?h()<b?f.push(d):g.push(d):d%e!==0?f.push(d):g.push(d)}),new List(a.getSubListsByIndexes(f),a.getSubListsByIndexes(g))}},TableOperators.testClassificationModel=function(a,b,c,d){if(null==a||null==b||null==c)return null;d=d||0;var e=0;return b.forEach(function(b,d){c(a[0][d],a[1][d])!=b&&e++}),e/b.length},TableOperators.getSubListsByIndexes=function(a,b){var c=new Table;c.name=a.name;for(var d,e,f=0;null!=a[f];f++){d=a[f],e=instantiateWithSameType(d);for(var g=0;null!=b[g];g++)e[g]=d[b[g]];c[f]=e.getImproved()}return c},TableOperators.sortListsByNumberList=function(a,b,c){null==c&&(c=!0);var d=instantiate(_typeOf(a));d.name=a.name;var e,f=a.length,g=b.clone();for(e=0;e<g.length;e++)g[e]=e;for(g=ListOperators.sortListByNumberList(g,b,c),e=0;f>e;e++){d[e]=a[e].clone();for(var h=0;h<g.length;h++)d[e][h]=a[e][g[h]]}return d},TableOperators.aggregateTable=function(a,b,c,d,e){if(b=b||0,null!=a&&a.length&&!(a.length<b)&&null!=c&&c.length&&null!=d){var f,g,h=a[b],i=ListOperators.getIndexesTable(h),j=new Table;return c.forEach(function(b,c){g=a[b],f=ListOperators.aggregateList(h,g,c<d.length?d[c]:1,i)[1],e&&c<e.length&&(f.name=e[c]),j.push(f)}),j.getImproved()}},TableOperators.pivotTable=function(a,b,c,d,e,f,g){if(null!=a&&a.length&&null!=b&&null!=c&&null!=d&&null!=e){g=g||0,f=null==f?"":f;var h,i,j,k,l,m=a[d],n=new Table;if(1==g){var o={},p={};switch(a[b].forEach(function(b,d){h=a[c][d],i=String(b)+"∞"+String(h),null==o[i]&&(o[i]=new NumberList,p[i]=new List),o[i].push(d),p[i].push(m[d])}),n[0]=new List,n[1]=new List,e){case 0:n[2]=new List;break;case 1:case 2:case 3:n[2]=new NumberList}for(i in o)switch(j=o[i],n[0].push(a[b][j[0]]),n[1].push(a[c][j[0]]),e){case 0:n[2].push(m[j[0]]);break;case 1:n[2].push(j.length);break;case 2:case 3:k=0,j.forEach(function(a){k+=m[a]}),3==e&&(k/=j.length),n[2].push(k)}switch(n[0]=n[0].getImproved(),n[1]=n[1].getImproved(),e){case 0:n[2]=n[2].getImproved()}return n}n[0]=new List;var q,r,s,t,u={},v={};switch(a[b].forEach(function(b,d){if(h=a[c][d],s=m[d],r=u[String(b)],null==r&&(n[0].push(b),r=n[0].length-1,u[String(b)]=r),q=v[String(h)],null==q){switch(e){case 0:t=new List;break;case 1:case 2:case 3:t=new NumberList}n.push(t),t.name=String(h),q=n.length-1,v[String(h)]=q}switch(e){case 0:null==n[q][r]&&(n[q][r]=s);break;case 1:null==n[q][r]&&(n[q][r]=0),n[q][r]++;break;case 2:null==n[q][r]&&(n[q][r]=0),n[q][r]+=s;break;case 3:null==n[q][r]&&(n[q][r]=[0,0]),n[q][r][0]+=s,n[q][r][1]++}}),e){case 0:for(l=1;l<n.length;l++)null==n[l]&&(n[l]=new List),n[0].forEach(function(a,b){null==n[l][b]&&(n[l][b]=f)}),n[l]=n[l].getImproved();break;case 1:case 2:for(l=1;l<n.length;l++)null==n[l]&&(n[l]=new NumberList),n[0].forEach(function(a,b){null==n[l][b]&&(n[l][b]=0)});break;case 3:for(l=1;l<n.length;l++)null==n[l]&&(n[l]=new NumberList),n[0].forEach(function(a,b){null==n[l][b]?n[l][b]=0:n[l][b]=n[l][b][0]/n[l][b][1]})}return n}},TableOperators.getCountPairsMatrix=function(a){if(null==a||a.length<2||null==a[0]||null==a[0][0])return null;var b=a[0].getWithoutRepetitions(),c=a[1].getWithoutRepetitions(),d=new NumberTable(c.length);return c.forEach(function(a,c){d[c].name=String(a),b.forEach(function(a,b){d[c][b]=0})}),a[0].forEach(function(e,f){var g=a[1][f];d[c.indexOf(g)][b.indexOf(e)]++}),d},TableOperators.filterTableByElementInList=function(a,b,c,d){if(!(null==a||a.length<=0||null==b)){if(null==c)return a;d=null==d?!0:d;var e,f,g=new Table,h=a.length,i=a[0].length;for(g.name=a.name,f=0;h>f;f++)g[f]=new List,g[f].name=a[f].name;if(d){for(e=0;i>e;e++)if(a[b][e]==c)for(f=0;h>f;f++)g[f].push(a[f][e])}else for(e=0;i>e;e++)if(a[b][e]!=c)for(f=0;h>f;f++)g[f].push(a[f][e]);for(f=0;h>f;f++)g[f]=g[f].getImproved();return g}},TableOperators.filterTableByElementsInList=function(a,b,c,d){if(!(null==a||a.length<=0||null==b)){if(null==c||0===c.length)return a;d=null==d?!0:d;var e,f,g=ListOperators.getBooleanDictionaryForList(c),h=new Table,i=a.length,j=a[0].length;for(h.name=a.name,f=0;i>f;f++)h[f]=new List,h[f].name=a[f].name;if(d){for(e=0;j>e;e++)if(g[a[b][e]])for(f=0;i>f;f++)h[f].push(a[f][e])}else for(e=0;j>e;e++)if(!g[a[b][e]])for(f=0;i>f;f++)h[f].push(a[f][e]);for(f=0;i>f;f++)h[f]=h[f].getImproved();return h}},TableOperators.mergeDataTablesInList=function(a){if(a.length<2)return a;for(var b=a[0],c=1;null!=a[c];c++)b=TableOperators.mergeDataTables(b,a[c]);return b},TableOperators.mergeDataTables=function(a,b){if(!(null==a||null==b||a.length<2||b.length<2)){if(0===b[0].length){var c=a.clone();return c.push(ListGenerators.createListWithSameElement(a[0].length,0)),c}var d,e,f,g=a[0],h=b[0],i=ListOperators.getSingleIndexDictionaryForList(g),j=ListOperators.getSingleIndexDictionaryForList(h),k=new Table,l=ListOperators.concatWithoutRepetitions(g,h),m=l.length,n=a.length-1,o=b.length-1,p=new NumberTable,q=new NumberTable;for(e=0;m>e;e++){if(d=i[l[e]],d>-1)for(f=0;n>f;f++)0===e&&(p[f]=new NumberList,p[f].name=a[f+1].name),p[f][e]=a[f+1][d];else for(f=0;n>f;f++)0===e&&(p[f]=new NumberList,p[f].name=a[f+1].name),p[f][e]=0;if(d=j[l[e]],d>-1)for(f=0;o>f;f++)0===e&&(q[f]=new NumberList,q[f].name=b[f+1].name),q[f][e]=b[f+1][d];else for(f=0;o>f;f++)0===e&&(q[f]=new NumberList,q[f].name=b[f+1].name),q[f][e]=0}k[0]=l;var r=p.length;for(e=0;r>e;e++)k.push(p[e]);for(r=q.length,e=0;r>e;e++)k.push(q[e]);return k}},TableOperators.sumDataTables=function(a,b){for(var c,d,e=a.clone(),f=0;null!=b[0][f];f++)d=b[0][f],c=e[0].indexOf(d),-1==c?(e[0].push(d),e[1].push(b[1][f])):e[1][c]+=b[1][f];return e},NumberListOperators.dotProductDataTables=function(a,b){if(null==a||null==b||a.length<2||b.length<2)return null;var c,d,e,f,g=a[0].length,h=b[0].length,i=0;for(c=0;g>c;c++)for(e=a[0][c],d=0;h>d;d++)f=b[0][d],e==f&&(i+=a[1][c]*b[1][d]);return i},NumberListOperators.cosineSimilarityDataTables=function(a,b){if(null==a||null==b||a.length<2||b.length<2)return null;if(0===a[0].length||0===b[0].length)return 0;var c=a[1].getNorm()*b[1].getNorm();return 0===c?0:NumberListOperators.dotProductDataTables(a,b)/c},TableOperators.completeTable=function(a,b,c){c=null==c?0:c;var d=new Table;d.name=a.name;for(var e,f,g,h=0;h<a.length;h++){for(e=a[h],f=null==e?ListOperators.getNewListForObjectType(c):instantiateWithSameType(e),f.name=null==e?"":e.name,g=0;b>g;g++)f[g]=null==e||null==e[g]?c:e[g];d[h]=f}return d},TableOperators.getNumberTableFromTable=function(a){if(null==a||a.length<=0)return null;var b,c=new NumberTable;for(c.name=a.name,b=0;null!=a[b];b++)"NumberList"==a[b].type&&c.push(a[b]);return c},TableOperators.getVariablesInformationGain=function(a,b){if(null==a)return null;var c=new NumberList;return a.forEach(function(a){c.push(ListOperators.getInformationGain(a,b))}),c},TableOperators.splitTableByCategoricList=function(a,b){if(null==a||null==b)return null;var c,d=new List,e={};return b.forEach(function(b,f){c=e[b],null==c&&(c=new Table,e[b]=c,d.push(c),a.forEach(function(a,b){c[b]=new List,c[b].name=a.name}),c._element=b),a.forEach(function(b,d){c[d].push(a[d][f])})}),d},TableOperators.buildCorrelationsNetwork=function(a,b,c,d,e,f,g){if(null==a)return null;b=null==b?!0:Boolean(b),d=d||0,f=null==f?.3:f,g=Boolean(g);var h,i,j,k,l,m,n,o,p,q,r,s,t=a.getTypes(),u=a.length,v=a[0].length,w=new Network;if(null!=e&&("number"==_typeOf(e)?u>=e&&(r=a[e]):e.isList&&e.length>=u&&(r=e),null!=r&&(s="NumberList"===r.type?ColorListGenerators.createColorListFromNumberList(r,ColorScales.blueToRed,0):ColorListGenerators.createCategoricalColorListForList(r)[0].value)),null!=c&&"number"==_typeOf(c)&&u>c&&(c=a[c]),b){for(h=0;v>h;h++){for(m="_"+h,n=null==c?m:c[h],j=new Node(m,n),j.row=a.getRow(h),j.numbers=new NumberList,j.categories=new List,s&&(j.color=s[h]),i=0;u>i;i++)"NumberList"===t[i]?j.numbers.push(j.row[i]):j.categories.push(j.row[i]);w.addNode(j)}for(h=0;v-1>h;h++)for(j=w.nodeList[h],i=h+1;v>i;i++)k=w.nodeList[i],o=NumberListOperators.pearsonProductMomentCorrelation(j.numbers,k.numbers),p=2*Math.pow(ListOperators.jaccardIndex(j.categories,k.categories),.2)-1,q=.5*(o+p),(g&&Math.abs(q)>f||!g&&q>f)&&(m=h+"_"+i,n=null==c?m:j.name+"_"+k.name,l=new Relation(m,n,j,k,Math.abs(q)-.9*f),l.color=q>0?"blue":"red",l.pearson=o,l.jaccard=p,w.addRelation(l))}else if("NumberTable"==a.type){for(h=0;u>h;h++)j=new Node("list_"+h,null==a[h].name||""==a[h].name?"list_"+h:a[h].name),w.addNode(j),j.i=h,j.numbers=a[h];for(h=0;u>h;h++)for(j=w.nodeList[h],i=h+1;u>i;i++)k=w.nodeList[i],o=NumberListOperators.pearsonProductMomentCorrelation(j.numbers,k.numbers),q=o,(g&&Math.abs(q)>f||!g&&q>f)&&(m=h+"_"+i,n=j.name+"_"+k.name,l=new Relation(m,n,j,k,Math.abs(q)-.9*f),l.color=q>0?"blue":"red",l.pearson=o,w.addRelation(l))}return w},TableOperators.buildDecisionTree=function(a,b,c,d,e,f,g,h){if(null!=a&&null!=b&&null!=c){if(null==h&&(h=ColorScales.blueWhiteRed),"number"==_typeOf(b)){var i=a.getWithoutElementAtIndex(b);b=a[b],a=i}d=null==d?.2:d,e=e||10,f=f||.002;var j=NumberListGenerators.createSortedNumberList(b.length),k=new Tree;return TableOperators._buildDecisionTreeNode(k,a,b,0,d,e,f,null,null,c,j,g,h),k}},TableOperators._buildDecisionTreeNode=function(a,b,c,d,e,f,g,h,i,j,k,l,m){var n=ListOperators.getListEntropy(c,j),o=0,p=0,q=0;n>=e&&(q=TableOperators.getVariablesInformationGain(b,c),q.forEach(function(a,b){a>o&&(o=a,p=b)}));var r=n>=e&&o>g&&c.length>=f,s=a.nodeList.getNewId(),t=(null==i?"":i+":")+(r?b[p].name:"P="+c._biggestProbability+"("+c._mostRepresentedValue+")"),u=new Node(s,t);if(a.addNodeToTree(u,h),null==h&&(a.informationGainTable=new Table,a.informationGainTable[0]=b.getNames(),q&&(a.informationGainTable[1]=q.clone(),a.informationGainTable=a.informationGainTable.getListsSortedByList(q,!1))),u.entropy=n,u.weight=c.length,u.supervised=c,u.indexes=k,u.value=i,u.mostRepresentedValue=c._mostRepresentedValue,u.biggestProbability=c._biggestProbability,u.valueFollowingProbability=c._P_valueFollowing,u.lift=u.valueFollowingProbability/a.nodeList[0].valueFollowingProbability,u._color=m(u.valueFollowingProbability),l){var v=document.createElement("canvas");v.width=150,v.height=100;var w=v.getContext("2d");w.clearRect(0,0,150,100),TableOperators._decisionTreeGenerateColorsMixture(w,150,100,["blue","red"],u.mostRepresentedValue==j?[Math.floor(u.biggestProbability*u.weight),Math.floor((1-u.biggestProbability)*u.weight)]:[Math.floor((1-u.biggestProbability)*u.weight),Math.floor(u.biggestProbability*u.weight)]);var x=new Image;x.src=v.toDataURL(),u.pattern=w.createPattern(x,"repeat")}if(!r)return u;u.bestFeatureName=b[p].name,u.bestFeatureName=""===u.bestFeatureName?"list "+p:u.bestFeatureName,u.iBestFeature=p,u.informationGain=o;var y,z,A,B=b.concat([c,k]),C=TableOperators.splitTableByCategoricList(B,b[p]);return C.forEach(function(b){y=b.getSubList(0,b.length-3),z=b[b.length-2],A=b[b.length-1],TableOperators._buildDecisionTreeNode(a,y,z,d+1,e,f,g,u,b._element,j,A,l,m)}),u.toNodeList=u.toNodeList.getSortedByProperty("valueFollowingProbability",!1),u},TableOperators._decisionTreeGenerateColorsMixture=function(a,b,c,d,e){var f,g,h,i=ListGenerators.createListWithSameElement(e[0],d[0]);for(h=1;null!=d[h];h++)i=i.concat(ListGenerators.createListWithSameElement(e[h],d[h]));for(f=0;b>f;f++)for(g=0;c>g;g++)h=4*(f+g*b),a.fillStyle=i.getRandomElement(),a.fillRect(f,g,1,1)},TableOperators.getReport=function(a,b){var c="\n"+(b>0?StringOperators.repeatString(" ",b):""),d=a.getLengths(),e=d.getMin(),f=d.getMax(),g=.5*(e+f),h=e==f,i=b>0?c+"////report of instance of Table////":"///////////report of instance of Table//////////";if(0===a.length)return i+=c+"this table has no lists";i+=c+"name: "+a.name,i+=c+"type: "+a.type,i+=c+"number of lists: "+a.length,i+=c+"all lists have same length: "+(h?"true":"false"),h?i+=c+"lists length: "+a[0].length:(i+=c+"min length: "+e,i+=c+"max length: "+f,i+=c+"average length: "+g,i+=c+"all lengths: "+d.join(", "));var j=a.getNames(),k=a.getTypes();i+=c+"--",j.forEach(function(a,b){i+=c+b+": "+a+" ["+TYPES_SHORT_NAMES_DICTIONARY[k[b]]+"]"}),i+=c+"--";var l=k.allElementsEqual();if(i+=l?c+"types of all lists: "+k[0]:c+"types: "+k.join(", "),i+=c+"names: "+j.join(", "),a.length<101){i+=c+c+"--------lists reports---------";var m;for(m=0;null!=a[m];m++){i+="\n"+c+("("+m+"/0-"+(a.length-1)+")");try{i+=ListOperators.getReport(a[m],1)}catch(n){i+=c+"[!] something wrong with list "+n}}}if(2==a.length){if(i+=c+c+"--------lists comparisons---------","NumberList"==a[0].type&&"NumberList"==a[1].type)i+=c+"covariance:"+NumberListOperators.covariance(a[0],a[1]),i+=c+"Pearson product moment correlation: "+NumberListOperators.pearsonProductMomentCorrelation(a[0],a[1]);else if("NumberList"!=a[0].type&&"NumberList"!=a[1].type){var o=ListOperators.union(a[0],a[1]).length;i+=c+"union size: "+o;var p=ListOperators.intersection(a[0],a[1]),q=p.length;i+=c+"intersection size: "+q,a[0]._freqTable[0].length==o&&a[1]._freqTable[0].length==o?i+=c+"[!] both lists contain the same non repeated elements":(a[0]._freqTable[0].length==q&&(i+=c+"[!] all elements in first list also occur on second list"),a[1]._freqTable[0].length==q&&(i+=c+"[!] all elements in second list also occur on first list")),i+=c+"Jaccard distance: "+(1-q/o)}var r=ListOperators.subCategoricalAnalysis(a[0],a[1]);switch(r){case 0:i+=c+"no categorical relation found between lists";break;case 1:i+=c+"[!] both lists are categorical identical";break;case 2:i+=c+"[!] first list is subcategorical to second list";break;case 3:i+=c+"[!] second list is subcategorical to first list"}1!=r&&(i+=c+"information gain when segmenting first list by the second: "+ListOperators.getInformationGain(a[0],a[1]),i+=c+"information gain when segmenting second list by the first: "+ListOperators.getInformationGain(a[1],a[0]))}return i},TableOperators.getReportHtml=function(a,b){var c="<br>"+(b>0?StringOperators.repeatString("&nbsp",b):""),d=a.getLengths(),e=d.getMin(),f=d.getMax(),g=.5*(e+f),h=e==f,i="<b>"+(b>0?c+'<font style="font-size:16px">table report</f>':'<font style="font-size:18px">table report</f>')+"</b>";if(0===a.length)return i+=c+"this table has no lists";i+=a.name?c+"name: <b>"+a.name+"</b>":c+"<i>no name</i>",i+=c+"type: <b>"+a.type+"</b>",i+=c+"number of lists: <b>"+a.length+"</b>",i+=c+"all lists have same length: <b>"+(h?"true":"false")+"</b>",h?i+=c+"lists length: <b>"+a[0].length+"</b>":(i+=c+"min length: <b>"+e+"</b>",i+=c+"max length: <b>"+f+"</b>",i+=c+"average length: <b>"+g+"</b>",i+=c+"all lengths: <b>"+d.join(", ")+"</b>");var j=a.getNames(),k=a.getTypes();i+="<hr>",j.forEach(function(a,b){i+=c+'<font style="font-size:10px">'+b+":</f><b>"+a+'</b> <font color="'+getColorFromDataModelType(k[b])+'">'+TYPES_SHORT_NAMES_DICTIONARY[k[b]]+"</f>"}),i+="<hr>";var l=k.allElementsEqual();if(l?i+=c+"types of all lists: <b>"+k[0]+"</b>":(i+=c+"types: ",k.forEach(function(a,b){i+='<b><font color="'+getColorFromDataModelType(a)+'">'+a+"</f></b>",b<k.length-1&&(i+=", ")})),i+="<br>"+c+"names: <b>"+j.join("</b>, <b>")+"</b>",a.length<501){i+="<hr>",i+=c+'<font style="font-size:16px"><b>lists reports</b></f>';var m;for(m=0;null!=a[m];m++){i+="<br>"+c+m+": "+(a[m].name?"<b>"+a[m].name+"</b>":"<i>no name</i>");try{i+=ListOperators.getReportHtml(a[m],1)}catch(n){i+=c+'[!] something wrong with list <font style="font-size:10px">:'+n+"</f>",console.log("getReportHtml err",n)}}}if(2==a.length){if(i+="<hr>",i+=c+"<b>lists comparisons</b>","NumberList"==a[0].type&&"NumberList"==a[1].type)i+=c+"covariance:"+NumberOperators.numberToString(NumberListOperators.covariance(a[0],a[1]),4),i+=c+"Pearson product moment correlation: "+NumberOperators.numberToString(NumberListOperators.pearsonProductMomentCorrelation(a[0],a[1]),4);else if("NumberList"!=a[0].type&&"NumberList"!=a[1].type){var o=ListOperators.union(a[0],a[1]).length;i+=c+"union size: "+o;var p=ListOperators.intersection(a[0],a[1]),q=p.length;i+=c+"intersection size: "+q,a[0]._freqTable[0].length==o&&a[1]._freqTable[0].length==o?i+=c+"[!] both lists contain the same non repeated elements":(a[0]._freqTable[0].length==q&&(i+=c+"[!] all elements in first list also occur on second list"),a[1]._freqTable[0].length==q&&(i+=c+"[!] all elements in second list also occur on first list")),i+=c+"Jaccard distance: "+(1-q/o)}var r=ListOperators.subCategoricalAnalysis(a[0],a[1]);switch(r){case 0:i+=c+"no categorical relation found between lists";break;case 1:i+=c+"[!] both lists are categorical identical";break;case 2:i+=c+"[!] first list is subcategorical to second list";break;case 3:i+=c+"[!] second list is subcategorical to first list"}1!=r&&(i+=c+"information gain when segmenting first list by the second: "+NumberOperators.numberToString(ListOperators.getInformationGain(a[0],a[1]),4),i+=c+"information gain when segmenting second list by the first: "+NumberOperators.numberToString(ListOperators.getInformationGain(a[1],a[0]),4))}return i},TableOperators.getReportObject=function(){},TableOperators.getTableSimplified=function(a,b,c){if(null==a||!(a.length>0))return null;b=b||20;var d,e=a.length,f=new Table;for(f.name=a.name,d=0;e>d;d++)console.log(d,"table[i].type:",a[d].type),f.push("NumberList"===a[d].type?a[d].getNumbersSimplified(2,b):a[d].getSimplified(b,c));return f},TableGenerators.createTableWithSameElement=function(a,b,c){for(var d=new Table,e=0;a>e;e++)d[e]=ListGenerators.createListWithSameElement(b,c);return d.getImproved()},TableConversions.TableToObject=function(a,b){if(a){b||(b=a.getNames());for(var c=[],d=0;d<a[0].length;d++){for(var e={},f=0;f<b.length;f++)e[b[f]]=a[f][d];c.push(e)}return{array:c}}},TableConversions.ArrayOfArraysToTable=function(a){if(null!==a&&isArray(a)){var b,c=a.length,d=new Table;for(b=0;c>b;b++)isArray(a[b])&&d.push(List.fromArray(a[b]).getImproved());return d.getImproved()}},NumberTableOperators.normalizeTableToMax=function(a,b){b=null==b?1:b;var c,d=new NumberTable,e=b/a.getMax();for(c=0;null!=a[c];c++)d[c]=a[c].factor(e);return d.name=a.name,d},NumberTableOperators.normalizeLists=function(a,b){b=null==b?1:b;var c,d=new NumberTable;for(c=0;null!=a[c];c++){var e=a[c];d[c]=NumberListOperators.normalized(e,b)}return d.name=a.name,d},NumberTableOperators.normalizeListsToMax=function(a,b){var c,d,e=new NumberTable,f=a.length;for(d=0;f>d;d++)c=a[d],e[d]=NumberListOperators.normalizedToMax(c,b);return e.name=a.name,e},NumberTableOperators.normalizeListsToSum=function(a){var b,c,d=new NumberTable,e=a.length;for(c=0;e>c;c++)b=a[c],d[c]=NumberListOperators.normalizedToSum(b);return d.name=a.name,d},NumberTableOperators.averageSmootherOnLists=function(a,b,c){if(null!=a){b=b||.5,c=c||1;var d=new NumberTable;return d.name=a.name,a.forEach(function(e,f){d[f]=NumberListOperators.averageSmoother(a[f],b,c)}),d}},NumberTableOperators.kMeans=function(a,b,c,d){if(null==a||null==a[0]||null==b||0>=b||0!==a.getLengths().getInterval().getAmplitude())return null;c=null==c?0:c,d=null==d||0>=d?1e3:d;var e,f,g,h,i,j,k,l,m,n,o,p=new NumberTable,q=new NumberTable,r=a.length,s=a[0].length,t=a.getTransposed(),u=99999999;if(b>=t.length)return t;var v=function(a,b){var c=b.length;for(e=0;c>e;e++)if(ListOperators.containSameElements(a,b[e]))return!0;return!1};for(f=0;b>f;f++){for(i=t.getRandomElement();v(i,q);)i=t.getRandomElement();q[f]=i.clone()}for(l=0;d>l;l++){for(f=0;b>f;f++)p[f]=new NumberList;for(e=0;s>e;e++){for(i=t[e],k=u,h=0,f=0;b>f;f++)j=NumberListOperators.distance(i,q[f]),k>j&&(k=j,h=f);p[h].push(e)}for(f=0;b>f;f++){for(n=p[f],m=n.length,q[f]=new NumberList,o=q[f],i=t[n[0]],g=0;r>g;g++)o[g]=i[g]/m;for(e=1;m>e;e++)for(i=t[n[e]],g=0;r>g;g++)o[g]+=i[g]/m}}var w,x,y;if(1==c||5==c)for(w=new NumberList,e=0;b>e;e++)for(x=p[e],y=x.length,f=0;y>f;f++)w[x[f]]=e;var z;if(2==c||5==c){z=new ColorList;var A=ColorListGenerators.createDefaultCategoricalColorList(b);for(e=0;b>e;e++)for(x=p[e],y=x.length,f=0;y>f;f++)z[x[f]]=A[e]}var B=new List;if(4==c||5==c)for(e=0;b>e;e++){for(B[e]=new NumberTable,B[e].name="subtable_"+e,x=p[e],y=x.length,f=0;y>f;f++)B[e].push(t[x[f]]);B[e]=B[e].getTransposed()}switch(c){case 0:return p;case 1:return w;case 2:return z;case 3:return q;case 4:return B;case 5:return{indexes:p,means:q,meanNumber:w,colors:z,subtables:B}}return null},NumberTableOperators.kNN=function(a,b,c,d,e,f){if(null==a||null==b)return null;d=d||1,e=null==e?!0:e;var g,h,i=function(c){var f,g,h,i=new NumberTable;if(i[0]=new NumberList,i[1]=new NumberList,a[0].forEach(function(b,e){if(h=0,a.forEach(function(a,b){h+=Math.pow(a[e]-c[b],2)}),i[1].length<d||i[1][d-1]>h){var f=!1;for(g=0;i[1][g]<d;g++)if(h<i[1][g]){i[1].splice(g,0,h),i[0].splice(g,0,e),f=!0;break}!f&&i[1].length<d&&(i[1].push(h),i[0].push(e))}}),e){var j=new Table;for(j[0]=new List,j[1]=new NumberList,f=0;d>f;f++){var k=b[i[0][f]],l=j[0].indexOf(k);-1==l?(j[0].push(k),j[1].push(1)):j[1][l]++}var m=j[1][0],n=0;return j[1].slice(1).forEach(function(a,b){a>m&&(m=a,n=b+1)}),j[0][n]}var o,p=0,q=0;for(f=0;d>f;f++)o=b[i[0][f]],p+=o/(i[1][f]+1e-6),q+=1/(i[1][f]+1e-6);return p/q};if(null==c){if(null!=f&&f>0){var j={},k=0;b.forEach(function(a){null==j[a]&&(j[a]=k,k++)});var l,m=new NumberTable,n=a[0].getMinMaxInterval(),o=n.x,p=n.getAmplitude()/f,q=a[1].getMinMaxInterval(),r=q.x,s=q.getAmplitude()/f;for(g=0;f>g;g++)for(m[g]=new NumberList,h=0;f>h;h++)l=[o+p*g,r+s*h],i(l),m[g][h]=e?j[i(l)]:i(l);return m}return i}var t=instantiateWithSameType(b);return c.forEach(function(a){t.push(i(a))}),t},NumberTableOperators.product=function(a,b){if(null!=a&&null!=b){var c=a.length,d=a[0].length;if(0!==c&&0!==d&&c==b[0].length&&d==b.length){var e,f,g,h,i=new NumberTable;for(e=0;c>e;e++)for(i[e]=new NumberList,f=0;c>f;f++){for(h=0,g=0;d>g;g++)h+=a[e][g]*b[g][f];i[e][f]=h}return i}}},NumberTableOperators.getCovarianceMatrix=function(a){return null!=a?NumberTableOperators.product(a,a.getTransposed()).factor(1/a.length):void 0},NumberTableFlowOperators.getFlowTable=function(a,b,c){if(null!=a){b=b||!1;var d,e,f,g,h,i,j=a.length,k=a[0].length,l=new NumberList,m=new NumberList,n=new NumberList,o=-9999999,p=9999999,q=-9999999;for(h=0;k>h;h++){for(e=9999999,f=-9999999,g=0,i=0;j>i;i++){if(d=a[i],d.length!=k)return;f=Math.max(f,d[h]),e=Math.min(e,d[h]),g+=d[h]}l.push(e),m.push(f),n.push(g),p=Math.min(p,e),o=Math.max(o,f),q=Math.max(q,g)}var r,s,t,u=q-p,v=new NumberTable,w=c?1:0;if(b&&c)return v=new NumberTable(a.length+1),a[0].forEach(function(){v[0].push(0)}),a.forEach(function(a,b){a.forEach(function(a,c){var d=n[c];v[b+1][c]=a/(0===d?1e-5:d)+v[b][c]})}),v;for(v=new NumberTable,b?s=Math.max(p,0):(s=p,t=u),h=0;j>h;h++)r=new NumberList,v.push(r);for(c&&v.push(new NumberList),h=0;k>h;h++)for(d=a[0],b&&(t=n[h]-s),c&&(v[0][h]=0),0===t&&(t=1e-5),v[w][h]=(d[h]-s)/t,i=1;j>i;i++)d=a[i],v[i+w][h]=(d[h]-s)/t+v[i-1+w][h];return console.log("flowTable",v),v}},NumberTableFlowOperators.getFlowTableIntervals=function(a,b,c,d){if(null==a)return null;var e,f,g,h,i=NumberTableFlowOperators.getFlowTable(a,b,!0),j=new Table,k=i.length,l=i[0].length,m=new NumberList;for(e=1;k>e;e++)for(h=i[e],g=new List,j[e-1]=g,f=0;l>f;f++)g.push(new Interval(i[e-1][f],i[e][f])),e==k-1&&(m[f]=i[e][f]);
var n;if(c){var o,p;for(f=0;l>f;f++){for(o=new NumberList,g=j[e],e=0;k-1>e;e++)o.push(j[e][f].getAmplitude());var q=o.getSortIndexes();for(p=b||d?0:.5*(1-m[f]),e=0;k-1>e;e++)n=j[q[e]][f],n.y=p+n.getAmplitude(),n.x=p,p=n.y}}else if(!b)for(f=0;l>f;f++)for(e=0;k-1>e;e++)n=j[e][f],d?(j[e][f].x=1-j[e][f].x,j[e][f].y=1-j[e][f].y):j[e][f]=n.add(.5*(1-m[f]));return j},NumberTableConversions.numberTableToPolygon=function(a){if(a.length<2)return null;var b,c=Math.min(a[0].length,a[1].length),d=new _Polygon;for(b=0;c>b;b++)d[b]=new _Point(a[0][b],a[1][b]);return d},NumberTableConversions.numberTableToNetwork=function(a,b,c){c=null==c?0:c;var d,e,f,g,h,i,j,k=new Network;switch(b){case 0:var l,m;for(f=0;null!=a[f+1];f++)for(d=a[f],0===f?(h=new Node(d.name,d.name),k.addNode(h)):h=k.nodeList[f],g=f+1;null!=a[g];g++)e=a[g],0===f?(i=new Node(e.name,e.name),k.addNode(i)):i=k.nodeList[g],e=a[g],l=NumberListOperators.standardDeviationBetweenTwoNumberLists(d,e),m=1/(1+l),m>=c&&(j=new Relation(f+"_"+g,h.name+"_"+i.name,h,i,m),k.addRelation(j));break;case 1:break;case 2:}return k},IntervalListOperators.scaleIntervals=function(a,b){if(null!=a){b=null==b?1:b;var c,d=new List,e=a.length;for(d.name=a.name,c=0;e>c;c++)d[c]=a[c].getScaled(b);return d}},IntervalTableOperators.scaleIntervals=function(a,b){if(null==a)return null;var c=new Table;c.name=a.name;var d,e=a.length;for(d=0;e>d;d++)c[d]=IntervalListOperators.scaleIntervals(a[d],b);return c},NumberListConversions.toPolygon=function(a){if(0===a.length)return null;for(var b=new _Polygon,c=0;null!=a[c+1];c+=2)b.push(new _Point(a[c],a[c+1]));return b},NumberListConversions.toStringList=function(a){var b,c=new StringList;for(b=0;null!=a[b];b++)c[b]=String(a[b]);return c.name=a.name,c},NetworkConversions.TableToNetwork=function(a,b,c,d,e,f){if(null!=a&&a.isTable&&null!=a[0]&&null!=a[1]){if(null==d&&(d=!1),a.length<2)return null;var g,h=new Network;g=null==b?Math.min(a[0].length,a[1].length):Math.min(a[0].length,a[1].length,b.length),null==b&&a.length>2&&"NumberList"==_typeOf(a[2])&&a[2].length>=g&&(b=a[2]),_typeOf(a[0])==NodeList&&_typeOf(a[1])==NodeList;var i,j,k,l,m,n;for(n=0;g>n;n++)k=""+a[0][n],l=""+a[1][n],i=h.nodeList.getNodeById(k),null==i?(i=new Node(k,k),h.addNode(i)):i.weight++,j=h.nodeList.getNodeById(l),null==j?(j=new Node(l,l),h.addNode(j)):j.weight++,null==b?(m=h.relationList.getFirstRelationByIds(i.id,j.id,!1),null==m||d?(m=new Relation(k+"_"+l+h.relationList.length,k+"_"+l,i,j,1),h.addRelation(m)):m.weight++):b[n]>c&&(m=new Relation(k+"_"+l,k+"_"+l,i,j,b[n]),h.addRelation(m)),f&&(m.content=f[n]);if(e)for(n=0;null!=h.nodeList[n];n++)h.nodeList[n].relationList.length<e&&(h.removeNode(h.nodeList[n]),n--);return h}},StringListConversions.toNumberList=function(a){var b=new NumberList;b.name=a.name;var c;for(c=0;null!=a[c];c++)b[c]=Number(a[c]);return b},StringListConversions.toDateList=function(a,b,c){if(null!=a){var d,e=new DateList,f=a.length;for(d=0;f>d;d++)e.push(DateOperators.stringToDate(a[d],b,c));return e}},ObjectConversions.ObjectToTable=function(a,b){var c,d;if(Array.isArray(a)){if(c=1,!b){b=[];for(d in a[0])a[0].hasOwnProperty(d)&&b.push(d)}}else{var e=[];for(d in a)e.push(d);if(1==e.length&&Array.isArray(a[e[0]])){if(c=1,a=a[e[0]],!b){b=[];for(d in a[0])b.push(d)}}else c=3,b||(b=e)}var f,g,h,i=new Table;for(g=0;g<b.length;g++){var j=b[g];f=new List,i[g]=f,f.name=j}if(1==c)for(g=0;g<a.length;g++){var k=a[g];for(h=0;h<b.length;h++)i[h].push(k[b[h]])}else for(h=0;h<b.length;h++)for(f=a[b[h]],g=0;g<f.length;g++)i[h].push(f[g]);for(g=0;g<i.length;g++)i[g]=i[g].getImproved();return i=i.getImproved()},ObjectConversions.ObjectToList=function(a,b){var c=ObjectConversions.ObjectToTable(a,b);return 1==c.getLengths.getMax()?c.getRow(0):void 0},ObjectConversions.objectToString=function(a){try{return JSON.stringify(a)}catch(b){return JSON.stringify({error:"cannot convert."})}},ObjectConversions.conversor=function(a,b){if(null!=a&&null!=b){var c,d,e=_typeOf(a),f=e+"_"+b;switch(console.log("ObjectConversions.conversor, pairType:",f),f){case"Array_List":return ObjectConversions.ArrayToList(a);case"NumberTable_Polygon":var g=new _Polygon,h=a.length>1;for(c=0;null!=a[0][c];c++)g[c]=new _Point(a[0][c],h?a[1][c]:0);return g;case"date_string":return DateOperators.dateToString(a);case"string_date":return DateOperators.stringToDate(a);case"date_number":return a.getTime();case"number_date":return new Date(a);case"List_StringList":case"NumberList_StringList":return NumberListConversions.toStringList(a);case"StringList_NumberList":return StringListConversions.toNumberList(a);case"Object_string":return JSON.stringify(a,null," ");case"string_Object":return JSON.parse(a);case"string_ColorScale":return ColorScales[a];case"string_Table":return TableEncodings.CSVtoTable(a);case"StringList_DateList":return d=new DateList,a.forEach(function(a){d.push(DateOperators.stringToDate(a))}),d.name=a.name,d;case"DateList_NumberList":return a.getTimes();case"Table_Network":return NetworkConversions.TableToNetwork(a,null,0,!1)}switch(b){case"string":return a.toString();case"number":return Number(a)}return null}},ObjectConversions.ArrayToList=function(a){return List.fromArray(a).getImproved()},ObjectOperators.identity=function(a){return a},ObjectOperators.serliazeObject=function(a){if(null==a)return null;var b,c,d;if(a.isTable){for(b=a.toArray(),c=a.length,d=0;c>d;d++)b[d]=ObjectOperators.serliazeObject(a[d]);return b}return a.isList?a.toArray():a},ObjectOperators.serliazeObjectsInArray=function(a){if(null==a)return null;var b,c=[],d=a.length;for(b=0;d>b;b++)c[b]=ObjectOperators.serliazeObject(a[b]);return c},ObjectOperators.getReport=function(a){if(null==a)return null;if(a.getReport)return a.getReport();var b=_typeOf(a);switch(b){case"Table":return TableOperators.getReport(a);case"List":return ListOperators.getReport(a)}if(a.isTable)return TableOperators.getReport(a);if(a.isList)return ListOperators.getReport(a);var c="///////////report of instance of Object//////////";a.name&&(c+="name: "+a.name);var d=ObjectConversions.objectToString(a);if(d.length<2e3)return c+="\n"+d;var e=new StringList;for(var f in a)e.push(f);return c+=e.length<100?"\nproperties: "+e.join(", "):"\nfirst 100 properties: "+e.slice(0,100).join(", ")},ObjectOperators.getReportHtml=function(a){if(null==a)return null;if(a.getReportHtml)return a.getReportHtml();var b=_typeOf(a);switch(b){case"Table":return TableOperators.getReportHtml(a);case"List":return ListOperators.getReportHtml(a)}if(a.isTable)return TableOperators.getReportHtml(a);if(a.isList)return ListOperators.getReportHtml(a);var c="<fs18>report of instance of Object</f>";return c+=ObjectOperators.getReportHtml(a)},ObjectOperators.getLength=function(a){return null!=a&&null!=a.length?a.length:void 0},ObjectOperators.booleanGate=function(a,b,c){return a?b:c},ObjectOperators.getPropertyValue=function(a,b){return null!=a?null==a?null:a[b]:void 0},ObjectOperators.isPropertyValue=function(a,b){if(null==a)return!1;for(var c in a)if(a[c]===b)return!0;return!1},ObjectOperators.getPropertiesNames=function(a){return null!=a?StringList.fromArray(Object.getOwnPropertyNames(a)):void 0},ObjectOperators.getPropertiesNamesAndValues=function(a){if(null!=a){var b=new Table;return b[0]=ObjectOperators.getPropertiesNames(a),b[1]=new List,b[0].forEach(function(c,d){b[1][d]=a[c]}),b[1]=b[1].getImproved(),b}},ObjectOperators.interpolateObjects=function(a,b,c,d){var e,f=_typeOf(a);if(f!=_typeOf(b))return a;c=null==c?.5:c;var g=1-c;switch(f){case"number":return d&&Math.abs(a-b)<=d?a:g*a+c*b;case"Interval":return d&&Math.abs(a.x-b.x)+Math.abs(a.y-b.y)<=d?a:new Interval(g*a.x+c*b.x,g*a.y+c*b.y);case"NumberList":if(d&&Math.abs(a.subtract(b).getSum())<=d)return a;var h=Math.min(a.length,b.length),i=new NumberList;for(e=0;h>e;e++)i[e]=g*a[e]+c*b[e];return i}return null},ObjectOperators.replaceObject=function(a,b,c){return a==b?c:a},ObjectOperators.toList=function(a){return List.fromArray(a).getImproved()},ObjectOperators.addition=function(){var a,b;if(arguments.length<2){if(1==arguments.length&&null!=arguments[0]&&arguments[0].isList){for(a=arguments[0][0],b=1;null!=arguments[0][b];b++)a=ObjectOperators.addition(a,arguments[0][b]);return a}return null}if(2==arguments.length){if(null!=arguments[0]&&arguments[0].isList&&null!=arguments[1]&&arguments[1].isList)return ObjectOperators._applyBinaryOperatorOnLists(arguments[0],arguments[1],ObjectOperators.addition);if(null!=arguments[0]&&arguments[0].isList)return ObjectOperators._applyBinaryOperatorOnListWithObject(arguments[0],arguments[1],ObjectOperators.addition);if(null!=arguments[1]&&arguments[1].isList)return ObjectOperators._applyBinaryOperatorOnObjectWithList(arguments[0],arguments[1],ObjectOperators.addition);var c=arguments[0],d=arguments[1],e=_typeOf(c),f=_typeOf(d),g=!1;e>f&&"string"!=f&&"string"!=e&&(c=arguments[1],d=arguments[0],e=_typeOf(c),f=_typeOf(d),g=!0);var h=e+"_"+f;switch(h){case"boolean_boolean":return c&&d;case"date_string":return g?d+DateOperators.dateToString(c):DateOperators.dateToString(c)+d;case"number_string":case"string_string":case"string_number":case"boolean_number":case"number_number":return c+d;case"Point_Point":return new _Point(c.x+d.x,c.y+d.y);case"Point3D_Point3D":return new Point3D(c.x+d.x,c.y+d.y,c.z+d.z);case"number_Point":return new _Point(c.x+d,c.y+d);case"number_Point3D":return new Point3D(c.x+d,c.y+d,c.z+d);case"Interval_number":return new Interval(c.x+d,c.y+d);case"Interval_Point":return new _Point(c.getMin()+d.x,c.getMax()+d.y);case"Interval_Interval":return new _Point(c.getMin()+d.getMin(),c.getMax()+d.getMax());case"Point_Rectangle":return new Rectangle(c.x+d.x,c.y+d.y,d.width,d.height);case"Interval_Rectangle":return new Rectangle(c.getMin()+d.x,c.getMax()+d.y,d.width,d.height);case"Rectangle_Rectangle":return new Rectangle(c.x+d.x,c.y+d.y,c.width+d.width,c.height+d.height);case"date_number":return new Date(c.getTime()+d/DateOperators.millisecondsToDays);case"date_date":return new Date(Number(c.getTime()+d.getTime()));case"date_DateInterval":return new DateInterval(ObjectOperators.addition(c,d.date0),ObjectOperators.addition(c,d.date1));case"DateInterval_number":return new DateInterval(ObjectOperators.addition(c.date0,d),ObjectOperators.addition(c.date1,d));case"DateInterval_Interval":return new DateInterval(ObjectOperators.addition(c.date0,d.min),ObjectOperators.addition(c.date1,d.max));case"DateInterval_DateInterval":return new DateInterval(ObjectOperators.addition(c.date0,d.date0),ObjectOperators.addition(c.date1,d.date1));case"string_StringList":return d.append(c,!1);case"StringList_string":return d.append(c,!0);default:return console.log("[!] addition didn't manage to resolve:",h,c+d),null}return c+d}for(a=arguments[0],b=1;b<arguments.length;b++)a=ObjectOperators.addition(a,arguments[b]);return a},ObjectOperators.multiplication=function(){var a,b;if(arguments.length<2){if(1==arguments.length&&arguments[0].isList){for(a=arguments[0][0],b=1;null!=arguments[0][b];b++)a=ObjectOperators.multiplication(a,arguments[0][b]);return a}return null}var c=arguments[0],d=arguments[1],e=_typeOf(c),f=_typeOf(d),g=e+"_"+f;if(2==arguments.length){if(null==arguments[0])return null;if("NumberTable_NumberTable"==g)return NumberTableOperators.product(c,d);if(arguments[0].isList&&arguments[1].isList)return ObjectOperators._applyBinaryOperatorOnLists(arguments[0],arguments[1],ObjectOperators.multiplication);if(arguments[0].isList)return ObjectOperators._applyBinaryOperatorOnListWithObject(arguments[0],arguments[1],ObjectOperators.multiplication);if(arguments[1].isList)return ObjectOperators._applyBinaryOperatorOnListWithObject(arguments[1],arguments[0],ObjectOperators.multiplication);switch(e>f&&(c=arguments[1],d=arguments[0],e=_typeOf(c),f=_typeOf(d)),g=e+"_"+f){case"number_number":case"boolean_boolean":case"boolean_number":case"Date_string":case"number_string":case"string_string":return c*d;case"Point_Point":return new _Point(c.x*d.x,c.y*d.y);case"Point3D_Point3D":return new Point3D(c.x*d.x,c.y*d.y,c.z*d.z);case"number_Point":return new _Point(c.x*d,c.y*d);case"number_Point3D":return new Point3D(c.x*d,c.y*d,c.z*d);case"Interval_number":return new Interval(c.getMin()*d,c.getMax()*d);case"Interval_Point":return new _Point(c.getMin()*d.x,c.getMax()*d.y);case"Interval_Interval":return new _Point(c.getMin()+d.getMin(),c.getMax()+d.getMax());case"Point_Rectangle":return new Rectangle(c.x*d.x,c.y*d.y,d.width,d.height);case"Interval_Rectangle":return new Rectangle(c.getMin()*d.x,c.getMax()*d.y,d.width,d.height);case"Rectangle_Rectangle":return new Rectangle(c.x*d.x,c.y*d.y,c.width*d.width,c.height*d.height);case"date_number":return new Date(c.getTime()*(d/DateOperators.millisecondsToDays));case"date_date":return new Date(Number(c.getTime()+d.getTime()));case"date_DateInterval":return new DateInterval(ObjectOperators.multiplication(c,d.date0),ObjectOperators.multiplication(c,d.date1));case"DateInterval_number":return new DateInterval(ObjectOperators.multiplication(c.date0,d),ObjectOperators.multiplication(c.date1,d));case"DateInterval_Interval":return new DateInterval(ObjectOperators.multiplication(c.date0,d.min),ObjectOperators.multiplication(c.date1,d.max));case"DateInterval_DateInterval":return new DateInterval(ObjectOperators.multiplication(c.date0,d.date0),ObjectOperators.multiplication(c.date1,d.date1));default:return console.log("[!] multiplication didn't manage to resolve:",g,c*d),null}return c*d}for(a=arguments[0],b=1;b<arguments.length;b++)a=ObjectOperators.multiplication(a,arguments[b]);return a},ObjectOperators.division=function(){var a,b;if(arguments.length<2){if(1==arguments.length&&arguments[0]&&arguments[0].isList){for(a=arguments[0][0],b=1;null!=arguments[0][b];b++)a=ObjectOperators.division(a,arguments[0][b]);return a}return null}if(2==arguments.length){if(null!=arguments[0]&&arguments[0].isList&&null!=arguments[1]&&arguments[1].isList)return ObjectOperators._applyBinaryOperatorOnLists(arguments[0],arguments[1],ObjectOperators.division);if(null!=arguments[0]&&arguments[0].isList)return ObjectOperators._applyBinaryOperatorOnListWithObject(arguments[0],arguments[1],ObjectOperators.division);if(null!=arguments[1]&&arguments[1].isList)return ObjectOperators._applyBinaryOperatorOnListWithObject(arguments[1],arguments[0],ObjectOperators.division);var c=arguments[0],d=arguments[1],e=_typeOf(c),f=_typeOf(d);e>f&&(c=arguments[1],d=arguments[0],e=_typeOf(c),f=_typeOf(d));var g=e+"_"+f;switch(g){case"number_number":case"boolean_boolean":case"boolean_number":case"Date_string":case"number_string":case"string_string":return c/d;case"Point_Point":return new _Point(c.x/d.x,c.y/d.y);case"Point3D_Point3D":return new Point3D(c.x/d.x,c.y/d.y,c.z/d.z);case"number_Point":return new _Point(c.x/d,c.y/d);case"number_Point3D":return new Point3D(c.x/d,c.y/d,c.z/d);case"Interval_number":return new Interval(c.getMin()/d,c.getMax()/d);case"Interval_Point":return new _Point(c.getMin()/d.x,c.getMax()/d.y);case"Interval_Interval":return new _Point(c.getMin()+d.getMin(),c.getMax()+d.getMax());case"Point_Rectangle":return new Rectangle(c.x/d.x,c.y/d.y,d.width,d.height);case"Interval_Rectangle":return new Rectangle(c.getMin()/d.x,c.getMax()/d.y,d.width,d.height);case"Rectangle_Rectangle":return new Rectangle(c.x/d.x,c.y/d.y,c.width/d.width,c.height/d.height);case"date_number":return new Date(c.getTime()/(d/DateOperators.millisecondsToDays));case"date_date":return new Date(Number(c.getTime()+d.getTime()));case"date_DateInterval":return new DateInterval(ObjectOperators.division(c,d.date0),ObjectOperators.division(c,d.date1));case"DateInterval_number":return new DateInterval(ObjectOperators.division(c.date0,d),ObjectOperators.division(c.date1,d));case"DateInterval_Interval":return new DateInterval(ObjectOperators.division(c.date0,d.min),ObjectOperators.division(c.date1,d.max));case"DateInterval_DateInterval":return new DateInterval(ObjectOperators.division(c.date0,d.date0),ObjectOperators.division(c.date1,d.date1));default:return console.log("[!] division didn't manage to resolve:",g,c/d),null}return c/d}for(a=arguments[0],b=1;b<arguments.length;b++)a=ObjectOperators.division(a,arguments[b]);return a},ObjectOperators._applyBinaryOperatorOnLists=function(a,b,c){var d,e=Math.min(a.length,b.length),f=new List;for(d=0;e>d;d++)f.push(ObjectOperators._applyBinaryOperator(a[d],b[d],c));return f.getImproved()},ObjectOperators._applyBinaryOperatorOnListWithObject=function(a,b,c){var d,e=new List;for(d=0;d<a.length;d++)e.push(ObjectOperators._applyBinaryOperator(a[d],b,c));return e.getImproved()},ObjectOperators._applyBinaryOperatorOnObjectWithList=function(a,b,c){var d,e=new List;for(d=0;d<b.length;d++)e.push(ObjectOperators._applyBinaryOperator(a,b[d],c));return e.getImproved()},ObjectOperators._applyBinaryOperator=function(a,b,c){return c(a,b)},StringListOperators.concatStrings=function(a,b){return null==b&&(b=""),StringList.fromArray(a.join(b))},StringListOperators.join=function(a,b,c,d){return null!=a?(b=null==b?"":b,c=null==c?"":c,d=null==d?"":d,c+a.join(b)+d):void 0},StringListOperators.filterStringListByString=function(a,b,c,d){if(null==a||null==b)return null;var e,f,g=d?new NumberList:new StringList,h=a.length;for(c&&(f=new RegExp("\\b"+b+"\\b")),e=0;h>e;e++)c?a[e].match(f).length>0&&g.push(d?e:a[e]):-1!=a[e].indexOf(b)&&g.push(d?e:a[e]);return g},StringListOperators.replaceStringsInTexts=function(a,b,c){if(null==a||null==b||null==c)return null;var d=new StringList;d.name=a.name;var e,f,g,h=a.length,i=b.length;for(e=0;h>e;e++)for(d[e]=a[e],f=0;i>f;f++)g=b[f],g instanceof RegExp||(g=new RegExp(g,"g")),d[e]=d[e].replace(g,c);return d},StringListOperators.replaceStringInTexts=function(a,b,c){if(null==a||null==b||null==c)return null;b instanceof RegExp||(b=new RegExp(b,"g"));var d=new StringList;d.name=a.name;var e,f=a.length;for(e=0;f>e;e++)d[e]=a[e].replace(b,c);return d},StringListOperators.replaceStringsInTextsByStrings=function(a,b,c){if(null==a||null==b||null==c)return null;var d=new StringList;d.name=a.name;var e,f,g,h=a.length,i=b.length;for(e=0;h>e;e++)for(d[e]=a[e],f=0;i>f;f++)g=b[f],g instanceof RegExp||(g=new RegExp(g,"g")),d[e]=d[e].replace(g,c[f]);return d},StringListOperators.countStringsOccurrencesOnTexts=function(a,b,c){var d,e,f,g,h,i=new NumberTable,j=a.length,k=b.length;for(d=0;j>d;d++){for(f=a[d],h=new RegExp("\\b"+f+"\\b"),g=new NumberList,g.name=f,e=0;k>e;e++)c?g[e]=StringOperators.countRegexOccurrences(b[e],h):g[e]=StringOperators.countOccurrences(b[e],f);i[d]=g}return i},StringListOperators.getWordsOccurrencesMatrix=function(a,b,c,d,e,f,g,h,i){var j;d=d||500,e=e||1e3,f=null==f?!0:f,g=g||!1,h=h||!0,i=null==i?3:i;var k,l=StringOperators.getWordsOccurrencesTable(a[0],b,c,d,i);for(j=1;null!=a[j];j++)k=StringOperators.getWordsOccurrencesTable(a[j],b,c,d,i),l=TableOperators.mergeDataTables(l,k);if(l[0].length>e&&(h=!0),g||h){var m=new NumberList;m=l[1].clone(),l.forEach(function(a,b){2>b||a.forEach(function(a,b){m[b]+=a})}),g&&l.forEach(function(a,b){0!==b&&a.forEach(function(b,c){a[c]=b/m[c]})}),h&&(l=l.getListsSortedByList(m,!1))}return f&&l.forEach(function(a,b){0!==b&&(l[b]=NumberListOperators.normalizedToSum(l[b]))}),e>0&&(l=l.sliceRows(0,e-1)),l},StringListOperators.createTextsNetwork=function(a,b,c,d){var e,f,g=new Network,h=StringListOperators.getWordsOccurrencesMatrix(a,b,!1,600,800,!1,!0,!1,3);for(a.forEach(function(a,b){var c=new Node("_"+b,"_"+b);c.content=a,c.wordsWeights=h[b+1],g.addNode(c)}),e=0;null!=g.nodeList[e+1];e++){var i=g.nodeList[e];for(f=e+1;null!=g.nodeList[f];f++){var j=g.nodeList[f],k=NumberListOperators.cosineSimilarity(i.wordsWeights,j.wordsWeights);if(0===e&&1==f&&(console.log(i.wordsWeights.length,j.wordsWeights.length,k),console.log(i.wordsWeights.type,i.wordsWeights),console.log(j.wordsWeights.type,j.wordsWeights),console.log(i.wordsWeights.getNorm()*j.wordsWeights.getNorm())),k>d){var l=new Relation(i.id+"_"+j.id,i.id+"_"+j.id,i,j,k);g.addRelation(l)}}}return g},StringListOperators.createShortTextsNetwork=function(a,b,c,d,e,f){if(null!=a&&null!=a.length&&0!==a.length){var g,h,i,j,k,l,m,n=(new Date).getTime(),o=new Network,p=a.join(" *** ").toLowerCase(),q=p.split(" *** "),r=a.length,s=0;if(c=c||.2,d=d||0,f){f[0]=f[0].toLowerCase();var t,u=f[1][0]}var v;switch(d){case 0:v=function(a){return 1-Math.pow(2*a/(r-1)-1,2)};break;case 1:v=function(a){return 1/(a+1)};break;case 2:v=function(a){return 1-Math.pow(2*Math.pow(a/(r-1),.2)-1,2)};break;default:v=function(a){return 0===a?0:1/a}}for(console.log("A ===> StringListOperators.createShortTextsNetwork took:",(new Date).getTime()-n),n=(new Date).getTime(),a.forEach(function(a,c){var d=new Node("_"+c,"_"+c);o.addNode(d),d.content=a;var g=StringOperators.getWords(a,!0,b,!1,!1,0,3);for(k=g.length,l=new NumberList,h=0;null!=g[h];h++){i=g[h];var m=0;q.forEach(function(a,b){c!=b&&(m+=Number(-1!=a.indexOf(i)))}),0!==m?(l[h]=v(m),e&&(l[h]*=1-1/(StringOperators.countOccurrences(q[c],i)+1)),f&&(t=f[0].indexOf(i),l[h]*=-1==t?1:1-Math.pow(f[1][t]/u,.2)),s=Math.max(s,l[h])):(g.splice(h,1),h--)}j=Math.floor(3*Math.log(k+1)),g=g.getSortedByList(l,!1).slice(0,j),g.position={},g.forEach(function(a,b){g.position[a]=b}),l=l.getSorted(!1).slice(0,j),d.wordsTable=new Table,d.wordsTable[0]=g,d.wordsTable[1]=l}),console.log("B ===> StringListOperators.createShortTextsNetwork took:",(new Date).getTime()-n),n=(new Date).getTime(),g=0;null!=o.nodeList[g+1];g++){var w=o.nodeList[g];for(h=g+1;null!=o.nodeList[h];h++){var x=o.nodeList[h];if(m=0,w.wordsTable[0].forEach(function(a,b){t=x.wordsTable[0].position[a],null!=t&&(m+=w.wordsTable[1][b]*x.wordsTable[1][t])}),m=Math.sqrt(m/s/Math.max(w.wordsTable[0].length,x.wordsTable[0].length)),m>c){var y=new Relation(w.id+"_"+x.id,w.id+"_"+x.id,w,x,m);o.addRelation(y)}}}return console.log("C ===> StringListOperators.createShortTextsNetwork took:",(new Date).getTime()-n),o}},StringConversions.stringToObject=function(a){try{return JSON.parse(a)}catch(b){return null}},TreeEncodings.decodeIdentedTree=function(a,b,c){b=null==b?"":b,c=null==c?" ":c;var d=new Tree,e=StringOperators.splitByEnter(a),f=e.length;if(0===f||1==f&&(null==e[0]||""===e[0]))return null;var g,h,i,j,k,l,m,n,o;for(""!==b&&null!=b&&(o=new Node(b,b),d.addNodeToTree(o,null)),g=0;f>g;g++){for(i=e[g],j=i.length,h=0;j>h;h++)if(i.charAt(h)!=c){k=i.substr(h);break}m=new Node(i,k),0===h?null!=o?d.addNodeToTree(m,o):d.addNodeToTree(m,null):(l=h+1-Number(null==o),n=null!=d.getNodesByLevel(l-1)&&d.getNodesByLevel(l-1).length>0?d.getNodesByLevel(l-1)[d.getNodesByLevel(l-1).length-1]:null,d.addNodeToTree(m,n))}return d.assignDescentWeightsToNodes(),d},TreeConversions.TableToTree=function(a,b){if(null!=a){b=null==b?"father":b;var c,d,e,f=new Tree,g=new Node(b,b);f.addNodeToTree(g,null);var h,i,j,k,l=a.length,m=a[0].length;for(h=0;l>h;h++){if(j=a[h],j.length!=m)return null;for(i=0;m>i;i++)k=j[i],e=TreeConversions._getId(a,h,i),c=f.nodeList.getNodeById(e),null==c?(c=new Node(e,String(k)),0===h?f.addNodeToTree(c,g):(d=f.nodeList.getNodeById(TreeConversions._getId(a,h-1,i)),f.addNodeToTree(c,d)),c.firstIndexInTable=i,c.indexesInTable=new NumberList(i)):(c.weight++,c.indexesInTable.push(i))}f.assignDescentWeightsToNodes();var n=function(a){var b;if(0===a.toNodeList.length)return a.indexesInTable;for(a.indexesInTable=new NumberList,b=0;null!=a.toNodeList[b];b++)a.indexesInTable=a.indexesInTable.concat(n(a.toNodeList[b]));return a.indexesInTable};return n(f.nodeList[0]),f}},TreeConversions._getId=function(a,b,c){for(var d=1,e=String(a[0][c]);b>=d;)e+="_"+String(a[d][c]),d++;return e},NetworkOperators.filterNodesByMinDegree=function(a,b){var c;for(c=0;null!=a.nodeList[c];c++)a.nodeList[c].nodeList.length<b&&(a.removeNode(a.nodeList[c]),c--);return null},NetworkOperators.degreeBetweenNodes=function(a,b,c){if(null==a||null==b||null==c)return null;if(b==c)return 0;for(var d,e,f,g=b.nodeList,h=1;null==g.getNodeById(c.id);){for(d=g.clone(),f=g.length,e=0;f>e;e++)d=ListOperators.concat(d,g[e].nodeList);if(d=d.getWithoutRepetitions(),g.length==d.length)return-1;g=d,h++}return h},NetworkOperators.getNodesBetweenTwoNodes=function(a,b,c){var d,e,f=new NodeList,g=a.nodeList.length;for(d=0;g>d;d++)e=a.nodeList[d],e.id!=b.id&&e.id!=c.id&&null!=b.nodeList.getNodeById(e.id)&&null!=c.nodeList.getNodeById(e.id)&&f.addNode(e);return f},NetworkOperators.shortestPath=function(a,b,c,d){if(null==a||null==b||null==c)return null;var e=NetworkOperators.spanningTree(a,b,c),f=new NodeList;d&&f.addNode(c);var g=e.nodeList.getNodeById(c.id);if(null==g)return null;for(;g.parent.id!=b.id;)if(f.addNode(g.parent.node),g=g.parent,null==g)return null;return d&&f.addNode(b),f.getReversed()},NetworkOperators.shortestPaths=function(a,b,c,d,e){if(null==a||null==b||null==c)return null;var f,g=new Table;if(null!=b.nodeList.getNodeById(c.id))return g.push(new NodeList(b,c)),g;null==e&&(e=NetworkOperators.spanningTree(a,b,c));var h,i=e.nLevels,j=new NodeList(c),k=NetworkOperators.adjacentNodeList(a,j,!1),l=ListOperators.intersection(k,e.getNodesByLevel(i-2)),m=new Table;for(m.push(NetworkOperators.getRelationsBetweenNodeLists(a,l,j,!1));i>2;)i--,j=l,l=ListOperators.intersection(NetworkOperators.adjacentNodeList(a,j,!1),e.getNodesByLevel(i-2)),h=NetworkOperators.getRelationsBetweenNodeLists(a,l,j,!1),m.push(h);for(m=m.getReversed(),f=0;null!=m[0][f];f++)g.push(new NodeList(b,m[0][f].getOther(b)));for(var n,o,p,q,r=function(a,b){var c,d=new Table,e=a[a.length-1];return b.forEach(function(b){e.relationList.getNodeById(b.id)&&(c=a.clone(),c.addNode(b.getOther(e)),d.push(c))}),d};g[0].length<e.nLevels;){for(n=new Table,p=g.length,f=0;p>f;f++)q=g[f],o=r(q,m[q.length-1]),n=n.concat(o);g=n}return g},NetworkOperators.getRelationsBetweenNodeLists=function(a,b,c,d){if(null==b||null==c)return null;null==d&&(d=!0);var e,f,g=new RelationList,h=a.relationList.length;for(f=0;h>f;f++)e=a.relationList[f],(null!=b.getNodeById(e.node0.id)&&null!=c.getNodeById(e.node1.id)||!d&&null!=b.getNodeById(e.node1.id)&&null!=c.getNodeById(e.node0.id))&&g.addRelation(e);return g},NetworkOperators._extendPaths=function(a,b,c){if(a[0].length>=c)return a;var d,e,f,g,h,i,j,k=new Table,l=a.length;for(d=0;l>d;d++)for(h=a[d],g=h[h.length-1],f=g.nodeList.getWithoutRepetitions(),j=f.length,e=0;j>e;e++)null==h.getNodeById(f[e].id)&&(i=h.clone(),i.addNode(f[e]),k.push(i));return a=k,NetworkOperators._extendPaths(a,b,c)},NetworkOperators.loops=function(a,b){if(null==a)return null;var c,d,e,f,g=new Table;for(c=0;null!=a.nodeList[c];c++){for(f=NetworkOperators._getLoopsOnNode(a.nodeList[c]),e=0;null!=g[e];e++)for(d=0;null!=f[d];d++)NetworkOperators._sameLoop(f[d],g[e])&&(f.splice(d,1),d--);g=g.concat(f)}return b&&(g=g.getFilteredByPropertyValue("length",b,"greater")),g.sort(function(a,b){return a.length>b.length?-1:1}),g.forEach(function(a){console.log(a.getIds().join("-"))}),g},NetworkOperators._sameLoop=function(a,b){if(a.length!=b.length)return!1;if(null==b.getNodeById(a[0].id))return!1;for(var c=b.indexOf(a[0]),d=a.length,e=1;null!=a[e];e++)if(a[e]!=b[(e+c)%d])return!1;return!0},NetworkOperators._getLoopsOnNode=function(a){if(0===a.toNodeList.length||0===a.fromNodeList.length)return[];var b,c,d,e,f=new Table,g=new NodeList;for(g.addNode(a),f.push(g),NetworkOperators._loopsColumns(a.toNodeList,1,f,1),b=1;f[b];b++)for(c=1;null!=f[c];c++)for(d=0;null!=f[c][d];d++)e=f[c][d],delete e.onColumn,0===e.toNodeList.length&&(f[c].removeNodeAtIndex(d),d--);var h,i=new Table;for(c=1;null!=f[c];c++)for(d=0;null!=f[c][d];d++)e=f[c][d],null!=e.toNodeList.getNodeById(a.id)&&(h=new NodeList(e),i.push(h),NetworkOperators._pathsToCentral(f,c,h,i));return i.sort(function(a,b){return a.length>b.length?-1:1}),i},NetworkOperators._pathsToCentral=function(a,b,c,d){if(!c.finished){if(0===b)return void(c.finished=!0);var e,f,g,h,i=c[0],j=!0,k=a[b-1].clone();k.addNodes(a[b]);var l=a[b-1].length;for(e=0;null!=k[e];e++)f=k[e],i==f||null!=c.getNodeById(f.id)||null!=g&&null!=g.getNodeById(f.id)||null!=f.toNodeList.getNodeById(i.id)&&(j?(g=c.clone(),c.unshift(f),c.ids[f.id]=f,NetworkOperators._pathsToCentral(a,l>e?b-1:b,c,d),j=!1):(h=g.clone(),d.push(h),h.unshift(f),h.ids[f.id]=f,NetworkOperators._pathsToCentral(a,l>e?b-1:b,h,d)))}},NetworkOperators._loopsColumns=function(a,b,c){null==c[b]&&(c[b]=new NodeList);for(var d,e=new NodeList,f=0;null!=a[f];f++)d=a[f],d.onColumn||(d.onColumn=!0,c[b].addNode(d),e.addNodes(d.toNodeList));for(e=e.getWithoutRepetitions(),f=0;null!=e[f];f++)e[f].onColumn&&(e.removeNodeAtIndex(f),f--);e.length>0&&NetworkOperators._loopsColumns(e,b+1,c)},NetworkOperators.spanningTree=function(a,b,c){if(null!=a){b=null==b?a.nodeList[0]:b;var d=new Tree,e=new Node(b.id,b.name);e.node=b,d.addNodeToTree(e);var f,g,h,i,j,k=b.nodeList,l=!1;for(i=0;null!=k[i];i++)g=new Node(k[i].id,k[i].name),g.id!=e.id&&(g.node=k[i],d.addNodeToTree(g,e),null!=c&&g.id==c.id&&(l=!0));if(l)return d;var m=k.clone();m.addNode(b);for(var n=0;;){for(f=new NodeList,i=0;null!=k[i];i++)f.addNodes(k[i].nodeList);if(f=f.getWithoutRepetitions(),f.removeElements(m),0===f.length)return d;for(i=0;null!=f[i];i++){g=new Node(f[i].id,f[i].name),g.node=f[i];for(var o=0;null!=f[i].nodeList[o];o++)if(j=f[i].nodeList[o].id,h=k.getNodeById(j),null!=h&&g.id!=j){d.addNodeToTree(g,d.nodeList.getNodeById(j));break}null!=c&&g.id==c.id&&(l=!0)}if(l&&(l=!0),l)return d;if(k=f,m=m.concat(f),n++,n>a.nodeList)return null}return d}},NetworkOperators.adjacentNodeList=function(a,b,c,d){if(null==a||null==b)return null;var e,f,g,h,i=c?b.clone():new NodeList;if(d){for(e=0;null!=b[e];e++)for(f=0;null!=b[e].toNodeList[f];f++)h=b[e].toNodeList[f].id,null==b.getNodeById(h)&&null==i.getNodeById(h)&&i.addNode(h);return i}for(e=0;null!=b[e];e++)for(f=0;null!=b[e].relationList[f];f++)g=b[e].relationList[f].node0,h=b[e].relationList[f].node1,null==b.getNodeById(g.id)&&null==i.getNodeById(g.id)&&i.addNode(g),null==b.getNodeById(h.id)&&null==i.getNodeById(h.id)&&i.addNode(h);return i},NetworkOperators.degreesPartition=function(a,b){var c,d,e,f,g=new NodeList(b),h=b.nodeList,i=h,j=new Table(g),k=i.length>0;k&&j.push(i);var l=i.clone();for(l.push(b);k;){for(d=new NodeList,e=0;null!=i[e];e++)for(c=i[e].nodeList,f=0;null!=c[f];f++)-1==l.indexOf(c[f])&&(d.push(c[f]),l.push(c[f]));k=d.length>0,k&&(i=d,j.push(i))}return j},NetworkOperators.degreesFromNodeToNodes=function(a,b,c){var d=NetworkOperators.degreesPartition(a,b),e=new NumberList;e.max=0;for(var f,g=0;null!=c[g];g++){if(c[g]==b)e[g]=0;else for(f=1;null!=d[f];f++)if(-1!=d[f].indexOf(c[g])){e[g]=f,e.max=Math.max(e.max,f);break}null==e[g]&&(e[g]=-1)}return e},NetworkOperators.getNodes=function(a){return null==a?null:null!=a.nodeList?a.nodeList:"Relation"==typeOf(a)?new NodeList(a.node0,a.node1):null},NetworkOperators.buildDendrogram=function(a){if(null==a)return null;var b,c,d,e,f,g,h=new Tree,i=new NodeList,j=a.nodeList.length,k=2*a.relationList.length/(j*(j-1));for(g=0;null!=a.nodeList[g];g++)e=new Node("["+a.nodeList[g].id+"]","["+a.nodeList[g].id+"]"),e.nodes=new NodeList(a.nodeList[g]),h.addNode(e),i[g]=e;for(;i.length>1;){for(b=NetworkOperators._getClosestPair(i,!0,k),c=i[b[0]],d=i[b[1]],f="["+c.id+"-"+d.id+"]",e=new Node(f,f),e.weight=b.strength,h.addNode(e),h.createRelation(e,c,f+"-"+c.id),h.createRelation(e,d,f+"-"+d.id),e.node=new Node(f,f),e.nodes=c.nodes.concat(d.nodes),g=0;null!=c.nodeList[g];g++)e.node.nodeList.addNode(c.nodeList[g]),e.node.relationList.addRelation(c.relationList[g]);for(g=0;null!=d.nodeList[g];g++)e.node.nodeList.addNode(d.nodeList[g]),e.node.relationList.addRelation(d.relationList[g]);i.removeElement(c),i.removeElement(d),i.addNode(e)}for(g=0;null!=h.nodeList[g];g++)c=h.nodeList[g],c.nodes.length>1&&(c.level=Math.max(c.nodeList[0].level,c.nodeList[1].level)+1);return h},NetworkOperators._getClosestPair=function(a,b,c){var d,e;if(2==a.length){var f=a[0].nodeList.indexOf(a[1]);return b?(d=[0,1],d.strength=-1==f?0:a[0].relationList[f].weight,d):(e=new NodeList(a[0],a[1]),e.strength=-1==f?0:a[0].relationList[f].weight,e)}var g,h,i,j,k=-1;for(g=0;null!=a[g+1];g++)for(i=a[g].nodes,h=g+1;null!=a[h];h++)j=NetworkOperators._strengthBetweenSets(i,a[h].nodes,c),
j>k&&(d=[g,h],k=j);return d.strength=k,b?d:(e=new NodeList(a[d[0]],a[d[1]]),e.strength=k,e)},NetworkOperators._strengthBetweenSets=function(a,b,c){var d,e,f,g=0;for(d=0;null!=a[d];d++)for(f=a[d],e=0;null!=f.nodeList[e];e++)-1!=b.indexOf(f.nodeList[e])&&(g+=f.relationList[e].weight);return g/(a.length*b.length*c)},NetworkOperators.buildNetworkClusters=function(a,b,c,d,e){if(null!=a){var f,g,h,i,j,k;if(null==b||0===b?f=NetworkOperators._buildNetworkClustersLouvain(a):(null==c&&(c=NetworkOperators.buildDendrogram(a)),d=d||.5,f=new Table,NetworkOperators._iterativeBuildClusters(c.nodeList[c.nodeList.length-1],f,d)),e)for(g=ColorListGenerators.createDefaultCategoricalColorList(f.length),j=f.length,h=0;j>h;h++)for(k=f[h].length,i=0;k>i;i++)f[h][i].color=g[h];return f}},NetworkOperators._iterativeBuildClusters=function(a,b,c){return 1==a.nodeList.length?void b.push(new NodeList(a.node)):(1==a.nodeList[0].nodes.length||a.nodeList[0].weight>c?b.push(a.nodeList[0].nodes):NetworkOperators._iterativeBuildClusters(a.nodeList[0],b,c),void(1==a.nodeList[1].nodes.length||a.nodeList[1].weight>c?b.push(a.nodeList[1].nodes):NetworkOperators._iterativeBuildClusters(a.nodeList[1],b,c)))},NetworkOperators._buildNetworkClustersLouvain=function(a){if(null==a)return a;var b,c=[];for(b=0;b<a.nodeList.length;b++)c.push("n"+a.nodeList[b].id);var d=[];for(b=0;b<a.relationList.length;b++){var e={source:"n"+a.relationList[b].node0.id,target:"n"+a.relationList[b].node1.id,weight:a.relationList[b].weight};d.push(e)}var f=NetworkOperators._jLouvain().nodes(c).edges(d),g=f(),h=new Table;if(g)for(b=0;b<a.nodeList.length;b++){var i=g["n"+a.nodeList[b].id];void 0==h[i]&&(h[i]=new NodeList),h[i].addNode(a.nodeList[b])}else for(b=0;b<a.nodeList.length;b++)h.push(new NodeList(a.nodeList[b]));return h},NetworkOperators.addPageRankToNodes=function(a,b,c){b=null==b?!0:b;var d,e,f,g,h,i,j=.85,k=a.nodeList.length,l=(1-j)/k,m=b?"fromPageRank":"toPageRank";for(a.minFromPageRank=a.minToPageRank=99999999,a.maxFromPageRank=a.maxToPageRank=-99999999,e=0;null!=a.nodeList[e];e++)g=a.nodeList[e],g[m]=1/k;for(d=0;300>d;d++)for(e=0;null!=a.nodeList[e];e++){for(g=a.nodeList[e],i=b?g.fromNodeList:g.toNodeList,g[m]=l,f=0;null!=i[f];f++)h=i[f],g[m]+=j*h[m]/(b?h.toNodeList.length:h.fromNodeList.length);299==d&&(b?(a.minFromPageRank=Math.min(a.minFromPageRank,g[m]),a.maxFromPageRank=Math.max(a.maxFromPageRank,g[m])):(a.minToPageRank=Math.min(a.minToPageRank,g[m]),a.maxToPageRank=Math.max(a.maxToPageRank,g[m])))}},NetworkOperators.fusionNoteworks=function(a,b,c){var d=new List;return a.forEach(function(a,b){var c="map_"+b+"_",e=NetworkEncodings.decodeNoteWork(a);e=e.clone(e.nodesPropertiesNames,e.relationsPropertiesNames,c),e.id="map_"+b,d.push(e)}),NetworkOperators.fusionNetworks(d,b,c)},NetworkOperators.fusionNetworks=function(a,b,c){b=null==b?1:b,c=null==c?1:c;var d,e,f,g,h=new Network,i=new Table,j=ColorListGenerators.createDefaultCategoricalColorList(a.length).getInterpolated("black",.17).getInterpolated("white",.55);a.forEach(function(a,b){i[b]=new NodeList,a.nodeList.forEach(function(a){d=h.nodeList.getNodeById(a.id),null==d?(d=new Node(a.id,a.name),d.basicId=a.basicId,d.mapId="map_"+b,d.mapsIds=[d.mapId],d.color=j[b],d.nMaps=1,d.weight=a.weight,h.addNode(d),i[b].addNode(d)):(d.nMaps+=1,d.mapsIds.push("map_"+b),d.color="rgb(200,200,200)")})}),a.forEach(function(a){a.relationList.forEach(function(a){e=new Relation(a.id,a.name,h.nodeList.getNodeById(a.node0.id),h.nodeList.getNodeById(a.node1.id)),e.color=a.color,e.content=a.content,e.description=a.description,e.weight=a.weight,h.addRelation(e)})});var k;for(f=0;null!=h.nodeList[f];f++)for(k=h.nodeList[f],g=f+1;null!=h.nodeList[g];g++)k.name==h.nodeList[g].name&&(e=new Relation(k.id+"_"+h.nodeList[g].id,"same variable",k,h.nodeList[g]),e.color="black",e.distanceFactor=b,e.forceWeight=c,h.addRelation(e),e=new Relation(h.nodeList[g].id+"_"+k.id,"same variable",h.nodeList[g],k),e.color="black",e.distanceFactor=b,e.forceWeight=c,h.addRelation(e),e.node0.nMaps+=1,e.node1.nMaps+=1);for(f=0;null!=h.nodeList[f];f++)h.nodeList[f].hubWeight=Math.sqrt(h.nodeList[f].nMaps-1);return h.mapsCluster=i,h},NetworkOperators._jLouvain=function(){function a(a){var b={};return a.forEach(function(a){b[a]=!0}),Object.keys(b)}function b(a){var b=[];for(var c in a)a.hasOwnProperty(c)&&b.push(a[c]);return b}function c(a,b){var c=a._assoc_mat[b]?Object.keys(a._assoc_mat[b]):[],d=0;return c.forEach(function(c){var e=a._assoc_mat[b][c]||1;b==c&&(e*=2),d+=e}),d}function d(a,b){if("undefined"==typeof a._assoc_mat[b])return[];var c=Object.keys(a._assoc_mat[b]);return c}function e(a,b,c){return a._assoc_mat[b]?a._assoc_mat[b][c]:void 0}function f(a){var b=0;return a.edges.forEach(function(a){b+=a.weight}),b}function g(a,b){i(a,b);var c=a.edges.map(function(a){return a.source+"_"+a.target}).indexOf(b.source+"_"+b.target);-1!=c?a.edges[c].weight=b.weight:a.edges.push(b)}function h(a){var b={};return a.forEach(function(a){b[a.source]=b[a.source]||{},b[a.source][a.target]=a.weight,b[a.target]=b[a.target]||{},b[a.target][a.source]=a.weight}),b}function i(a,b){a._assoc_mat[b.source]=a._assoc_mat[b.source]||{},a._assoc_mat[b.source][b.target]=b.weight,a._assoc_mat[b.target]=a._assoc_mat[b.target]||{},a._assoc_mat[b.target][b.source]=b.weight}function j(a){if(null==a||"object"!=typeof a)return a;var b=a.constructor();for(var c in a)b[c]=j(a[c]);return b}function k(a,b,g){b.nodes_to_com={},b.total_weight=0,b.internals={},b.degrees={},b.gdegrees={},b.loops={},b.total_weight=f(a),"undefined"==typeof g?a.nodes.forEach(function(d,f){b.nodes_to_com[d]=f;var g=c(a,d);if(0>g)throw"Bad graph type, use positive weights!";b.degrees[f]=g,b.gdegrees[d]=g,b.loops[d]=e(a,d,d)||0,b.internals[f]=b.loops[d]}):a.nodes.forEach(function(e){var f=g[e];b.nodes_to_com[e]=f;var h=c(a,e);b.degrees[f]=(b.degrees[f]||0)+h,b.gdegrees[e]=h;var i=0,j=d(a,e);j.forEach(function(b){var c=a._assoc_mat[e][b];if(0>=c)throw"Bad graph type, use positive weights";g[b]==f&&(i+=b==e?c:c/2)}),b.internals[f]=(b.internals[f]||0)+i})}function l(c){var d=c.total_weight,e=0,f=a(b(c.nodes_to_com));return f.forEach(function(a){var b=c.internals[a]||0,f=c.degrees[a]||0;d>0&&(e=e+b/d-Math.pow(f/(2*d),2))}),e}function m(a,b,c){var e={},f=d(b,a);return f.forEach(function(d){if(d!=a){var f=b._assoc_mat[a][d]||1,g=c.nodes_to_com[d];e[g]=(e[g]||0)+f}}),e}function n(a,b,c,d){d.nodes_to_com[a]=+b,d.degrees[b]=(d.degrees[b]||0)+(d.gdegrees[a]||0),d.internals[b]=(d.internals[b]||0)+c+(d.loops[a]||0)}function o(a,b,c,d){d.degrees[b]=(d.degrees[b]||0)-(d.gdegrees[a]||0),d.internals[b]=(d.internals[b]||0)-c-(d.loops[a]||0),d.nodes_to_com[a]=-1}function p(a){var b=0,c=j(a),d={},e=Object.keys(a);return e.forEach(function(e){var f=a[e],g="undefined"==typeof d[f]?-1:d[f];-1==g&&(d[f]=b,g=b,b+=1),c[e]=g}),c}function q(a,b){for(var c=!0,d=0,e=l(b),f=e;c&&d!=x&&(e=f,c=!1,d+=1,a.nodes.forEach(function(d){var e=b.nodes_to_com[d],f=(b.gdegrees[d]||0)/(2*b.total_weight),g=m(d,a,b);o(d,e,g[e]||0,b);var h=e,i=0,j=Object.keys(g);j.forEach(function(a){var c=g[a]-(b.degrees[a]||0)*f;c>i&&(i=c,h=a)}),n(d,h,g[h]||0,b),h!=e&&(c=!0)}),f=l(b),!(y>f-e)););}function r(c,d){var f,h,i={nodes:[],edges:[],_assoc_mat:{}},j=b(c);return i.nodes=i.nodes.concat(a(j)),d.edges.forEach(function(a){h=a.weight||1;var b=c[a.source],d=c[a.target];f=e(i,b,d)||0;var j=f+h;g(i,{source:b,target:d,weight:j})}),i}function s(a,b){for(var c=j(a[0]),d=1;b+1>d;d++)Object.keys(c).forEach(function(b){var e=b,f=c[b];c[e]=a[d][f]});return c}function t(a,b){if(0===a.edges.length){var c={};return a.nodes.forEach(function(a){c[a]=a}),c}var d={};k(z,d,b);var e=l(d),f=[];q(z,d);var g=l(d),h=p(d.nodes_to_com);f.push(h),e=g;var i=r(h,z);for(k(i,d);;){if(q(i,d),g=l(d),y>g-e)break;h=p(d.nodes_to_com),f.push(h),e=g,i=r(h,i),k(i,d)}return f}var u,v,w,x=-1,y=1e-7,z={},A=function(){var a=t(z,w);return s(a,a.length-1)};return A.nodes=function(a){return arguments.length>0&&(u=a),A},A.edges=function(a){if("undefined"==typeof u)throw"Please provide the graph nodes first!";if(arguments.length>0){v=a;var b=h(a);z={nodes:u,edges:v,_assoc_mat:b}}return A},A.partition_init=function(a){return arguments.length>0&&(w=a),A},A},NetworkOperators.getReport=function(){return"network contains "+this.nodeList.length+" nodes and "+this.relationList.length+" relations"},NetworkGenerators.createRandomNetwork=function(a,b,c,d,e){if(null==a||null==b)return null;var f;f=null!=e?function(){return e++,NumberOperators.getRandomWithSeed(e)}:Math.random,c=null==c?0:c;var g,h,i,j=new Network;for(g=0;a>g;g++)j.addNode(new Node("n"+g,"n"+g));switch(c){case 0:for(g=0;a-1>g;g++)for(i=j.nodeList[g],h=g+1;a>h;h++)f()<b&&j.addRelation(new Relation(g+"_"+h,g+"_"+h,i,j.nodeList[h],d?f():1));return j;case 1:var k,l,m,n=a*(a-1)*.5,o=0;for(g=0;n>g;g++)if(f()<b)for(k=!0;k;)if(i=j.nodeList[Math.floor(j.nodeList.length*f())],f()<(i.nodeList.length+1)/(o+1))for(;k;)l=j.nodeList[Math.floor(j.nodeList.length*f())],m=i.id+"_"+l.id,null==j.relationList.getNodeById(m)&&null==j.relationList.getNodeById(l.id+"_"+i.id)&&f()<(l.nodeList.length+1)/(o+1)&&(j.addRelation(new Relation(m,m,i,l,d?f():1)),k=!1);return j}},NetworkGenerators.createTextsCoOccurrencesNetwork=function(a,b,c,d){var e=StringListOperators.countStringsOccurrencesOnTexts(a,b,c,d);return NetworkGenerators.createNetworkFromOccurrencesTable(e)},NetworkGenerators.createNetworkFromOccurrencesTable=function(a,b,c){b=null==b?0:b,c=null==c?0:c;var d,e,f,g,h,i,j,k,l,m=new Network;for(d=0;null!=a[d];d++)for(f=a[d].name,0===d?(i=new Node(f,f),m.addNode(i)):i=m.nodeList[d],k=a[d].getSum(),i.weight=k,e=d+1;null!=a[e];e++){switch(g=a[e].name,0===d?(j=new Node(g,g),m.addNode(j)):j=m.nodeList[e],l=a[e].getSum(),j.weight=l,b){case 0:h=a[d].dotProduct(a[e]);break;case 1:h=NumberListOperators.cosinus(a[d],a[e])}h>c&&m.createRelation(i,j,f+"_"+g,h)}return m},NetworkGenerators.createNetworkFromListAndFunction=function(a,b,c){var d,e,f,g,h=new Network;for(d=0;null!=a[d+1];d++)for(0===d&&h.addNode(new Node("n_0",null==c?"n_0":c[d])),g=h.nodeList[d],e=d+1;null!=a[e];e++)0===d&&h.addNode(new Node("n_"+e,null==c?"n_"+e:c[e])),f=b(a[d],a[e]),f>0&&h.addRelation(new Relation(d+"_"+e,d+"_"+e,g,h.nodeList[e],f));return h},NetworkGenerators.createNetworkFromTextAndWords=function(a,b,c){if(null==a||null==b)return null;c=null==c?"\\.|\\n":c;var d=new Network;b=b.getWithoutElements(new StringList(""," ","\n")),b.forEach(function(a){a=NetworkEncodings._simplifyForNoteWork(a),a&&b.push(a)}),b=b.getWithoutRepetitions();var e,f,g,h,i,j,k,l,m,n,o=a.split(new RegExp(c,"g"));return b.forEach(function(b){e=new Node(b,b),d.addNode(e),k=a.match(NetworkEncodings._regexWordForNoteWork(b)),e.weight=null==k?1:k.length}),o.forEach(function(a){a=a.trim(),l=new NodeList,m=0,b.forEach(function(b){h=d.nodeList.getNodeById(b),i=NetworkEncodings._regexWordForNoteWork(b),g=a.search(i),-1!=g&&(n=h.weight>m?h:n,m=Math.max(h.weight,m),h!=n&&l.push(h))}),l.forEach(function(b){j=n.id+"_"+b.id+"|"+a,f=new Relation(j,j,n,b),f.content=a,d.addRelation(f)})}),d.nodeList.forEach(function(a){i=NetworkEncodings._regexWordForNoteWork(a.id),d.nodeList.forEach(function(b){a!=b&&-1!=b.id.search(i)&&(j=b.id+"_"+a.id+"|contains "+a.id,f=new Relation(j,j,b,a),f.content="contains "+a.id,d.addRelation(f))})}),d},DrawTextsAdvanced.textOnQuadrilater=function(a,b,c,d,e,f,g,h){if(g=null==g?0:g,1==g){var i=new _Point(.5*(b.x+c.x),.5*(b.y+c.y)),j=new _Point(.5*(b.x+e.x),.5*(b.y+e.y)),k=new _Point(.5*(d.x+e.x),.5*(d.y+e.y)),l=new _Point(.5*(c.x+d.x),.5*(c.y+d.y)),m=new _Point(.5*(i.x+k.x),.5*(i.y+k.y));return DrawTextsAdvanced.textOnQuadrilater(a,b,i,m,j,f,2),DrawTextsAdvanced.textOnQuadrilater(a,i,c,l,m,f,3),DrawTextsAdvanced.textOnQuadrilater(a,m,l,d,k,f,4),void DrawTextsAdvanced.textOnQuadrilater(a,j,m,k,e,f,5)}var n,o,p,q=h.context.measureText(a),r=q.width,s=f;switch(g){case 0:n=new _Point(0,0),o=new _Point(r,0),p=new _Point(1e-6,s+1e-6);break;case 2:n=new _Point(0,0),o=new _Point(.5*r,0),p=new _Point(1e-6,.5*s+1e-6);break;case 3:n=new _Point(.5*r,0),o=new _Point(r,0),p=new _Point(.5*r+1e-6,.5*s+1e-6);break;case 4:n=new _Point(.5*r,.5*s),o=new _Point(r,.5*s),p=new _Point(.5*r+1e-6,s+1e-6);break;case 5:n=new _Point(0,.5*s),o=new _Point(.5*r,.5*s),p=new _Point(1e-6,s+1e-6)}h.context.save(),DrawTextsAdvanced.applyTransformationOnCanvasFromPoints(n,o,p,b,c,e),h.context.beginPath(),h.context.moveTo(n.x-2,n.y-2),h.context.lineTo(o.x+8,o.y-2),h.context.lineTo(p.x-2,p.y+8),h.context.clip(),h.context.fillText(a,0,0),h.context.restore(),n.x=o.x+1e-4,n.y=p.y+1e-4,h.context.save(),DrawTextsAdvanced.applyTransformationOnCanvasFromPoints(n,o,p,d,c,e),h.context.beginPath(),h.context.moveTo(n.x+4,n.y+2),h.context.lineTo(o.x+4,o.y-2),h.context.lineTo(p.x-2,p.y+2),h.context.clip(),h.context.fillText(a,0,0),h.context.restore()},DrawTextsAdvanced.applyTransformationOnCanvasFromPoints=function(a,b,c,d,e,f,g){var h=MatrixGenerators.createMatrixFromTrianglesMapping(a,b,c,d,e,f);g.context.transform(h.a,h.b,h.c,h.d,h.tx,h.ty)},DrawTextsAdvanced.mapRectangleIntoQuadrilater=function(a,b,c,d,e,f,g,h,i,j){j.context.save();var k=MatrixGenerators.createMatrixFromTrianglesMapping(new _Point(0,0),new _Point(100,0),new _Point(100,100),f,g,h);j.context.transform(k.a,k.b,k.c,k.d,k.tx,k.ty),j.context.beginPath(),j.context.moveTo(0,0),j.context.lineTo(100,0),j.context.lineTo(100,100),j.context.lineTo(0,0),j.context.clip(),j.context.drawImage(a,b,c,d,e,0,0,100,100),j.context.restore(),j.context.save(),k=MatrixGenerators.createMatrixFromTrianglesMapping(new _Point(0,0),new _Point(0,2),new _Point(2,2),f,i,h),j.context.transform(k.a,k.b,k.c,k.d,k.tx,k.ty),j.context.beginPath(),j.context.moveTo(0,0),j.context.lineTo(0,2),j.context.lineTo(2,2),j.context.lineTo(0,0),j.context.clip(),j.context.drawImage(a,b,c,d,e,0,0,2,2),j.context.restore()},DrawTextsAdvanced.getClippedTrianglesData=function(a,b,c,d,e,f){var g={};return f.context.clearRect(0,0,d,e),f.context.save(),f.context.beginPath(),f.context.moveTo(0,0),f.context.lineTo(d,0),f.context.lineTo(d,e),f.context.lineTo(0,0),f.context.clip(),f.context.drawImage(a,b,c,d,e,0,0,d,e),g.dataTriangle0=f.context.getImageData(0,0,d,e),f.context.restore(),f.context.clearRect(0,0,d,e),f.context.save(),f.context.beginPath(),f.context.moveTo(0,0),f.context.lineTo(0,e),f.context.lineTo(d,e),f.context.lineTo(0,0),f.context.clip(),f.context.drawImage(a,b,c,d,e,0,0,d,e),g.dataTriangle1=f.context.getImageData(0,0,d,e),f.context.restore(),g},DrawTextsAdvanced.typodeOnQuadrilater=function(a,b,c,d,e,f){var g=c.x-b.x,h=e.y-b.y,i=d.y-c.y;if(f.context.lineWidth=.01+(h+i)/100,!(1.8>g))for(var j,k,l,m,n=typodeObject[a],o=0;null!=n[o];o++){for(j=n[o],f.context.beginPath(),l=j[0].x,m=1-l,f.context.moveTo(Math.floor(l*g+b.x)+.5,Math.floor(j[0].y*(m*h+l*i)+m*b.y+l*c.y)+.5),k=1;null!=j[k];k++)l=j[k].x,m=1-l,f.context.lineTo(Math.floor(l*g+b.x)+.5,Math.floor(j[k].y*(m*h+l*i)+m*b.y+l*c.y)+.5);f.context.stroke()}},DrawTexts.POINT_TO_PIXEL=1.3333,DrawTexts.PIXEL_TO_POINT=.75,DrawTexts.fillTextRectangle=function(a,b,c,d,e,f,g,h,i){var j=DrawTexts.textWordWrapReturnLines(a,d,e,f,h,i);return DrawTexts.fillTextRectangleWithTextLines(j,b,c,e,f,g,i)},DrawTexts.fillTextRectangleWithTextLines=function(a,b,c,d,e,f,g){d=0===d||null==d?99999:d;for(var h=0;null!=a[h]&&(g.context.fillText(a[h],b,c+h*e),!((h+2)*e>d));h++);return f?a.length*e:a.length},DrawTexts.textWordWrapReturnLines=function(a,b,c,d,e,f){b=b||100,c=c||600,d=d||16;var g=0===d?-1:Math.floor(c/d),h=new StringList;if(0>=b)return h.push(a),h;var i,j,k,l,m,n,o=a.split(/\\n|\n/),p=0;for(i=0;i<o.length;i++)if(""!==o[i]){for(j=o[i].split(" "),k=1;j.length>0&&k<=j.length;)if(l=j.slice(0,k).join(" "),m=f.context.measureText(l).width,m>b){if(1==k&&(k=2),n=j.slice(0,k-1).join(" "),""!==n&&h.push(n),h.length==g){if(e){var q=h[h.length-1];f.context.measureText(q+"…").width<=b?h[h.length-1]+="…":(j=q.split(" "),n=j.slice(0,j.length-1).join(" ")+"…",h.push(n))}return h}p++,j=j.splice(k-1),k=1}else k++;k>0&&(n=j.join(" "),""!==n&&h.push(n)),p++}else h.push(""),p++;return h.width=1==h.length?m:b,h},DrawTexts.getMaxTextWidth=function(a,b){for(var c=b.getTextW(a[0]),d=1;null!=a[d];d++)c=Math.max(c,b.getTextW(a[d]));return c},DrawTexts.cropString=function(a,b,c){if(null!=b){if(c=c||0,0>=c||a.context.measureText(b).width<=c)return b;for(var d=b.split(""),e=1;d.length>0&&e<=d.length;){var f=d.slice(0,e).join(""),g=a.context.measureText(f).width;if(g>c)return 1==e&&(e=2),d.slice(0,e-1).join("");e++}}},DrawSimpleVis.drawSimpleBarChart=function(a,b,c,d){d=null==d?ColorListOperators.colorListFromColorScale(new ColorScale):d,c=null==c?new Rectangle(10,10,400,300):c;var e,f=c.width/b.length,g=c.getBottom(),h=NumberListOperators.normalizedToMax(b,c.height);for(e=0;null!=b[e];e++)a.fillStyle=d[e],a.fillRect(c.x+e*f,g-h[e],f-1,h[e])},DrawSimpleVis.drawIntervalsFlowTable=function(a,b,c,d,e){console.log("[!] MOVED TO IntervalTableDraw.js")},DrawSimpleVis.drawIntervalsWordsFlowTable=function(a,b,c,d,e){console.log("[!] MOVED TO IntervalTableDraw.js")},DrawSimpleVis.drawStackBarsFlowTable=function(a,b,c,d){var e,f,g=b.length;d=null==d?ColorListOperators.colorListFromColorScale(new ColorScale(ColorOperators.temperatureScale),g):d,c=null==c?new Rectangle(10,10,400,300):c;var h,i,j,k,l,m=b[0].length,n=c.width/(m-1),o=c.height,p=b[g-1],q=0,r=0,s=c.x,t=c.y;for(a.strokeStyle="white",e=0;null!=b[e];e++){for(l=b[e],q=.5*(1-p[0].y)*o+e*r+t,f=1;m>f;f++)q=.5*(1-p[f].y)*o+e*r+t,h=new _Point(f*n+s,l[f].x*o+q),i=new _Point((f+1)*n+s,l[f].x*o+q),j=new _Point((f+1)*n+s,l[f].y*o+q),k=new _Point(f*n+s,l[f].y*o+q),a.fillStyle=d[e],a.beginPath(),a.moveTo(h.x,h.y),a.lineTo(i.x,i.y),a.lineTo(j.x,j.y),a.lineTo(k.x,k.y),a.lineTo(h.x,h.y),a.fill();a.fill()}},Draw.fillRectangleWithImage=function(a,b,c,d,e){null!=d&&(e.context.fillStyle=d,e.context.beginPath(),e.context.fillRect(a.x,a.y,a.width,a.height),e.context.fill());var f,g,h,i,j,k;switch(c){case 0:e.context.drawImage(b,a.x,a.y,a.width,a.height);break;case 1:f=.5*Math.max(b.width-a.width,0),g=.5*Math.max(b.height-a.height,0),h=a.x+.5*Math.max(a.width-b.width,0),i=a.y+.5*Math.max(a.height-b.height,0),j=Math.min(b.width,a.width),k=Math.min(b.height,a.height),e.context.drawImage(b,f,g,j,k,h,i,j,k);break;case 2:f=Math.max(b.width-a.width,0),g=Math.max(b.height-a.height,0),j=Math.min(b.width,a.width),k=Math.min(b.height,a.height);var l=j/k,m=b.width/b.height;m>l&&(k=j/m),l>m&&(j=k/m),h=a.x+.5*(a.width-j),i=a.y+.5*(a.height-k),e.context.drawImage(b,0,0,b.width,b.height,h,i,j,k);break;case 3:var n,o;a.width/a.height<b.width/b.height?(n=b.height,o=n*a.width/a.height,f=.5*(b.width-o),g=0):(o=b.width,n=o*a.height/a.width,f=0,g=.5*(b.height-n)),e.context.drawImage(b,f,g,o,n,a.x,a.y,a.width,a.height);break;case 4:break;case 5:}},Draw.drawBezierPolygonTransformed=function(a,b,c){if(null!=a&&0!==a.length){var d,e,f,g,h=Math.floor((a.length-1)/3),i=b(a[0]);for(c.context.moveTo(i.x,i.y),e=0;h>e;e++)d=3*e+1,i=b(a[d]),f=b(a[d+1]),g=b(a[d+2]),c.context.bezierCurveTo(i.x,i.y,f.x,f.y,g.x,g.y)}},Draw.prototype.drawPolygonTransformed=function(a,b,c){var d=b(a[0]);c.context.moveTo(d.x,d.y);for(var e=0;null!=a[e];e++)d=b(a[e]),c.context.lineTo(d.x,d.y)},Draw.prototype.drawSliderRectangle=function(a,b,c,d,e){e.context.arc(a+.5*c,b,.5*c,Math.PI,TwoPi),e.context.lineTo(a+c,b),e.context.arc(a+.5*c,b+d,.5*c,0,Math.PI),e.context.lineTo(a,b)},Draw.drawRectangles=function(a,b,c,d,e,f,g,h){e=e||0;var i,j,k,l=2*e;null!=d&&(k=d.length);var m=new Rectangle;for(i=0;null!=a[i];i++)j=a[i],j.height<=e||j.width<=e||(null!=d&&(h.context.fillStyle=d[i%k]),h.context.fillRect(j.x+b+e,j.y+c+e,j.width-l,j.height-l),null!=f&&null!=f[i]&&(m.x=j.x+b+e,m.y=j.y+c+e,m.width=j.width-l,m.height=j.height-l,this.fillRectangleWithImage(h.context,m,f[i],g)))},Draw.drawHorizontalFlowPiece=function(a,b,c,d,e,f,g,h){h.context.moveTo(a,c),h.context.bezierCurveTo(a+g,c,b-g,e,b,e),h.context.lineTo(b,f),h.context.bezierCurveTo(b-g,f,a+g,d,a,d),h.context.lineTo(a,c)},Draw.drawLens=function(a,b,c){if(b.x<a.x){var d=b.clone();b=a.clone(),a=d}if(b.x+b.z<=a.x+a.z)return void c.context.arc(b.x,b.y,b.z,0,TwoPi);if(a.x-a.z>=b.x-b.z)return void c.context.arc(a.x,a.y,a.z,0,TwoPi);var e=GeometryOperators.circlesLensAngles(a,b);c.context.arc(a.x,a.y,a.z,e[0],e[1]),c.context.arc(b.x,b.y,b.z,e[2],e[3])},Draw.drawArrowTriangle=function(a,b,c,d){var e=a.angleToPoint(b),f=a.distanceToPoint(b);d.drawTriangleFromBase(a.x,a.y,c,f,e)},Graphics.prototype._initialize=function(a){this.cW=1,this.cH=1,this.cX=1,this.cY=1,this.mX=0,this.mY=0,this.mP=new _Point(0,0),this.nF=0,this.MOUSE_DOWN=!1,this.MOUSE_UP=!1,this.MOUSE_UP_FAST=!1,this.WHEEL_CHANGE=0,this.NF_DOWN=void 0,this.NF_UP=void 0,this.MOUSE_PRESSED=void 0,this.MOUSE_IN_DOCUMENT=!0,this.mX_DOWN=void 0,this.mY_DOWN=void 0,this.mX_UP=void 0,this.mY_UP=void 0,this.PREV_mX=0,this.PREV_mY=0,this.DX_MOUSE=0,this.DY_MOUSE=0,this.MOUSE_MOVED=!1,this.T_MOUSE_PRESSED=0,this.cursorStyle="auto",this.backGroundColor="white",this.backGroundColorRGB=[255,255,255],this.cycleActive=void 0,this._prevMouseX=0,this._prevMouseY=0,this._setIntervalId=void 0,this._setTimeOutId=void 0,this._interactionCancelledFrame=void 0,this._tLastMouseDown=void 0,this._alphaRefresh=0,this.END_CYCLE_DELAY=3e3,this.fontColor="#000000",this.fontSize="14",this.fontName="Arial",this.fontAlign="left",this.fontBaseline="top",this.fontStyle="",this.canvas=document.createElement("canvas"),this.canvas.setAttribute("tabindex","10000");var b="outline: none; -webkit-tap-highlight-color: rgba(255, 255, 255, 0);";this.canvas.setAttribute("style",b),this.container&&this.container.appendChild(this.canvas),this.context=this.canvas.getContext("2d"),this._adjustCanvas(this.dimensions);var c=this._onMouseOrKeyBoard.bind(this);this.canvas.addEventListener("mousemove",c,!1),this.canvas.addEventListener("mousedown",c,!1),this.canvas.addEventListener("mouseup",c,!1),this.canvas.addEventListener("mouseenter",c,!1),this.canvas.addEventListener("mouseleave",c,!1),this.canvas.addEventListener("click",c,!1),this.canvas.addEventListener("DOMMouseScroll",c,!1),this.canvas.addEventListener("mousewheel",c,!1),this.canvas.addEventListener("keydown",c,!1),this.canvas.addEventListener("keyup",c,!1);var d=this._onResize.bind(this);window.addEventListener("resize",resizeThrottler(d,66),!1),this._listeners={mousemove:[],mousedown:[],mouseup:[],mouseenter:[],mouseleave:[],mousewheel:[],click:[],keydown:[],keyup:[]},this.init(),a&&this._startCycle()},Graphics.prototype._getRelativeMousePos=function(a){var b=this.canvas.getBoundingClientRect();return{x:a.clientX-b.left,y:a.clientY-b.top}},Graphics.prototype._onMouseOrKeyBoard=function(a){switch(a.type){case"mousemove":var b=this._getRelativeMousePos(a);this.PREV_mX=this.mX,this.PREV_mY=this.mY,this.mX=b.x,this.mY=b.y,this.mP.x=this.mX,this.mP.y=this.mY,this.MOUSE_IN_DOCUMENT=!0;break;case"mousedown":this.NF_DOWN=this.nF,this.MOUSE_PRESSED=!0,this.T_MOUSE_PRESSED=0,this._tLastMouseDown=(new Date).getTime(),this.mX_DOWN=this.mX,this.mY_DOWN=this.mY,this.MOUSE_IN_DOCUMENT=!0;break;case"mouseup":this.NF_UP=this.nF,this.MOUSE_PRESSED=!1,this.T_MOUSE_PRESSED=0,this.mX_UP=this.mX,this.mY_UP=this.mY,this.MOUSE_IN_DOCUMENT=!0;break;case"mouseenter":this.MOUSE_IN_DOCUMENT=!0;break;case"mouseleave":this.MOUSE_IN_DOCUMENT=!1}this._emit(a.type,a)},Graphics.prototype._onResize=function(a){var b=this.cW,c=this.cH;if(void 0===this.dimensions&&this._adjustCanvas(),this.onResize!==noOperation){var d=this._containerDimensions();(d.width!==b||d.height!==c)&&this.onResize(a)}},Graphics.prototype._containerDimensions=function(){return this.container?{width:this.container.clientWidth,height:this.container.clientHeight}:{width:0,height:0}},Graphics.prototype._adjustCanvas=function(a){if(void 0!==a)this.cW=a.width,this.cH=a.height;else{var b=this._containerDimensions();this.cW=b.width,this.cH=b.height}this.cX=Math.floor(.5*this.cW),this.cY=Math.floor(.5*this.cH),this.canvas.setAttribute("width",this.cW),this.canvas.setAttribute("height",this.cH)},Graphics.prototype._startCycle=function(){this.cycleActive=!0,0===this._cycleInterval?setTimeout(this._onCycle.bind(this),10):(clearInterval(this._setIntervalId),this._setIntervalId=setInterval(this._onCycle.bind(this),this._cycleInterval))},Graphics.prototype._stopCycle=function(a){clearInterval(this._setIntervalId),this.cycleActive=!1,this._setIntervalId=void 0,a&&a()},Graphics.prototype.cycleFor=function(a){0===a?(this._setIntervalId&&clearTimeout(this._setTimeOutId),this._startCycle()):1==a?(this._setIntervalId&&clearTimeout(this._setTimeOutId),this._onCycle()):(this._setIntervalId?clearTimeout(this._setTimeOutId):this._startCycle(),this._stopAfter(a))},Graphics.prototype._stopAfter=function(a,b){var c=this;this._setTimeOutId=setTimeout(function(){c._stopCycle(),b&&b()},a)},Graphics.prototype._onCycle=function(){0===this._alphaRefresh?null!=this.backGroundColorRGB?(this.context.fillStyle="rgb("+this.backGroundColorRGB[0]+","+this.backGroundColorRGB[1]+","+this.backGroundColorRGB[2]+")",this.context.fillRect(0,0,this.cW,this.cH)):this.context.clearRect(0,0,this.cW,this.cH):(this.context.fillStyle="rgba("+this.backGroundColorRGB[0]+","+this.backGroundColorRGB[1]+","+this.backGroundColorRGB[2]+","+this._alphaRefresh+")",this.context.fillRect(0,0,this.cW,this.cH)),this.setCursor("default"),this.MOUSE_DOWN=this.NF_DOWN==this.nF,this.MOUSE_UP=this.NF_UP==this.nF,this.MOUSE_UP_FAST=this.MOUSE_UP&&this.nF-this.NF_DOWN<9,this.DX_MOUSE=this.mX-this.PREV_mX,this.DY_MOUSE=this.mY-this.PREV_mY,this.MOUSE_MOVED=0!==this.DX_MOUSE||0!==this.DY_MOUSE,this.MOUSE_PRESSED&&(this.T_MOUSE_PRESSED=(new Date).getTime()-this._tLastMouseDown),this.cycle(),this.WHEEL_CHANGE=0,this.PREV_mX=this.mX,this.PREV_mY=this.mY,this.nF++},Graphics.prototype._emit=function(a,b){switch(a){case"mousewheel":case"DOMMouseScroll":a="mousewheel",b||(b=window.event),b.wheelDelta?this.WHEEL_CHANGE=b.wheelDelta/120:b.detail&&(this.WHEEL_CHANGE=-b.detail/3),b.value=this.WHEEL_CHANGE}for(var c=this._listeners[a].length,d=0;c>d;d++){var e=this._listeners[a][d];e.call(e.__context,b)}},Graphics.prototype.getCycleInterval=function(){return this._cycleInterval},Graphics.prototype.setCycleInterval=function(a){this._cycleInterval=a,this.cycleActive&&this._startCycle()},Graphics.prototype.start=function(){return this._startCycle()},Graphics.prototype.stop=function(){return this._stopCycle()},Graphics.prototype.cycleOnMouseMovement=function(a){var b=this;this.cycleOnMouseMovementListener&&(this.canvas.removeEventListener("mousemove",this.cycleOnMouseMovementListener,!1),this.canvas.removeEventListener("mousewheel",this.cycleOnMouseMovementListener,!1),this.canvas.removeEventListener("mousemove",this.cycleOnMouseMovementListener,!1),this.canvas.removeEventListener("mousedown",this.cycleOnMouseMovementListener,!1)),a>1&&(this.cycleOnMouseMovementListener=function(){b.cycleFor(a)},this.canvas.addEventListener("mousemove",this.cycleOnMouseMovementListener,!1),this.canvas.addEventListener("mousewheel",this.cycleOnMouseMovementListener,!1),this.canvas.addEventListener("mousemove",this.cycleOnMouseMovementListener,!1),this.canvas.addEventListener("mousedown",this.cycleOnMouseMovementListener,!1),b.cycleFor(a))},Graphics.prototype.on=function(a,b,c){b.__context=c,this._listeners[a].push(b)},Graphics.prototype.off=function(a,b){var c=this._listeners[a].indexOf(b);c>-1&&this._listeners[a].splice(c,1)},Graphics.prototype.clearCanvas=function(){this.context.clearRect(0,0,this.cW,this.cH)},Graphics.prototype.setBackgroundColor=function(a){"number"==typeof a?a=arguments.length>3?"rgba("+arguments[0]+","+arguments[1]+","+arguments[2]+","+arguments[3]+")":"rgb("+arguments[0]+","+arguments[1]+","+arguments[2]+")":Array.isArray(a)&&(a=ColorOperators.RGBtoHEX(a[0],a[1],a[2])),this.backGroundColor=a,this.backGroundColorRGB=ColorOperators.colorStringToRGB(this.backGroundColor)},Graphics.prototype.setBackgroundAlpha=function(a){this._alphaRefresh=a},Graphics.prototype.fRect=function(a,b,c,d){"number"!=typeof a&&(b=a.y,c=a.width,d=a.height,a=a.x),this.context.fillRect(a,b,c,d)},Graphics.prototype.sRect=function(a,b,c,d){"number"!=typeof a&&(b=a.y,c=a.width,d=a.height,a=a.x),this.context.strokeRect(a,b,c,d)},Graphics.prototype.fsRect=function(a,b,c,d){"number"!=typeof a&&(b=a.y,c=a.width,d=a.height,a=a.x),this.context.fillRect(a,b,c,d),this.context.strokeRect(a,b,c,d)},Graphics.prototype.fArc=function(a,b,c,d,e,f){this.context.beginPath(),this.context.arc(a,b,c,d,e,f),this.context.fill()},Graphics.prototype.sArc=function(a,b,c,d,e,f){this.context.beginPath(),this.context.arc(a,b,c,d,e,f),this.context.stroke()},Graphics.prototype.fCircle=function(a,b,c){this.context.beginPath(),this.context.arc(a,b,c,0,TwoPi),this.context.fill()},Graphics.prototype.sCircle=function(a,b,c){this.context.beginPath(),this.context.arc(a,b,c,0,TwoPi),this.context.stroke()},Graphics.prototype.fsCircle=function(a,b,c){this.fCircle(a,b,c),this.context.stroke()},Graphics.prototype.fEllipse=function(a,b,c,d){var e=.5522848,f=c*e,g=d*e,h=a+c,i=b+d;this.context.beginPath(),this.context.moveTo(a-c,b),this.context.bezierCurveTo(a-c,b-g,a-f,b-d,a,b-d),this.context.bezierCurveTo(a+f,b-d,h,b-g,h,b),this.context.bezierCurveTo(h,b+g,a+f,i,a,i),this.context.bezierCurveTo(a-f,i,a-c,b+g,a-c,b),this.context.moveTo(a-c,b),this.context.closePath(),this.context.fill()},Graphics.prototype.sEllipse=function(a,b,c,d){var e=.5522848,f=c*e,g=d*e,h=a+c,i=b+d;this.context.beginPath(),this.context.moveTo(a-c,b),this.context.bezierCurveTo(a-c,b-g,a-f,b-d,a,b-d),this.context.bezierCurveTo(a+f,b-d,h,b-g,h,b),this.context.bezierCurveTo(h,b+g,a+f,i,a,i),this.context.bezierCurveTo(a-f,i,a-c,b+g,a-c,b),this.context.moveTo(a-c,b),this.context.closePath(),this.context.stroke()},Graphics.prototype.fsEllipse=function(a,b,c,d){this.fEllipse(a,b,c,d),this.context.stroke()},Graphics.prototype._solidArc=function(a,b,c,d,e,f){this.context.beginPath(),this.context.arc(a,b,e,c,d),this.context.lineTo(a+f*Math.cos(d),b+f*Math.sin(d)),this.context.arc(a,b,f,d,c,!0),this.context.lineTo(a+e*Math.cos(c),b+e*Math.sin(c))},Graphics.prototype.fSolidArc=function(a,b,c,d,e,f){this._solidArc(a,b,c,d,e,f),this.context.fill()},Graphics.prototype.sSolidArc=function(a,b,c,d,e,f){this._solidArc(a,b,c,d,e,f),this.context.stroke()},Graphics.prototype.fsSolidArc=function(a,b,c,d,e,f){this.fSolidArc(a,b,c,d,e,f),this.context.stroke()},Graphics.prototype.line=function(a,b,c,d){this.context.beginPath(),this.context.moveTo(a,b),this.context.lineTo(c,d),this.context.stroke()},Graphics.prototype.bezier=function(a,b,c,d,e,f,g,h){this.context.beginPath(),this.context.moveTo(a,b),this.context.bezierCurveTo(c,d,e,f,g,h),this.context.stroke()},Graphics.prototype._lines=function(){if(null!=arguments){var a=arguments[0];this.context.beginPath(),this.context.moveTo(a[0],a[1]);for(var b=2;null!=a[b+1];b+=2)this.context.lineTo(a[b],a[b+1])}},Graphics.prototype._linesM=function(){if(null!=arguments){var a=arguments[0],b=new _Polygon;this.context.beginPath(),this.context.moveTo(a[0],a[1]),b[0]=new _Point(a[0],a[1]);for(var c=2;null!=a[c+1];c+=2)this.context.lineTo(a[c],a[c+1]),b.push(new _Point(a[c],a[c+1]));return b.containsPoint(this.mP)}},Graphics.prototype.fLines=function(){this._lines(arguments),this.context.fill()},Graphics.prototype.sLines=function(){this._lines(arguments),this.context.stroke()},Graphics.prototype.fsLines=function(){this._lines(arguments),this.context.fill(),this.context.stroke()},Graphics.prototype.fsLinesM=function(){var a=this._linesM(arguments);return this.context.fill(),this.context.stroke(),a},Graphics.prototype._polygon=function(a){this.context.beginPath(),this.context.moveTo(a[0].x,a[0].y);for(var b=1;null!=a[b];b++)this.context.lineTo(a[b].x,a[b].y)},Graphics.prototype.fPolygon=function(a){this._polygon(a),this.context.fill()},Graphics.prototype.sPolygon=function(a,b){this._polygon(a),b&&this.context.closePath(),this.context.stroke()},Graphics.prototype.fsPolygon=function(a,b){this._polygon(a),b&&this.context.closePath(),
this.context.fill(),this.context.stroke()},Graphics.prototype.fEqTriangle=function(a,b,c,d){this._eqTriangle(a,b,c,d),this.context.fill()},Graphics.prototype.sEqTriangle=function(a,b,c,d){this._eqTriangle(a,b,c,d),this.context.stroke()},Graphics.prototype.fsEqTriangle=function(a,b,c,d){this._eqTriangle(a,b,c,d),this.context.fill(),this.context.stroke()},Graphics.prototype._eqTriangle=function(a,b,c,d){this.context.beginPath(),c=c||0,this.context.moveTo(d*Math.cos(c)+a,d*Math.sin(c)+b),this.context.lineTo(d*Math.cos(c+2.0944)+a,d*Math.sin(c+2.0944)+b),this.context.lineTo(d*Math.cos(c+4.1888)+a,d*Math.sin(c+4.1888)+b),this.context.lineTo(d*Math.cos(c)+a,d*Math.sin(c)+b)},Graphics.prototype.fRectM=function(a,b,c,d,e){return e=null==e?0:e,this.context.fillRect(a,b,c,d),this.mY>b-e&&this.mY<b+d+e&&this.mX>a-e&&this.mX<a+c+e},Graphics.prototype.sRectM=function(a,b,c,d,e){return e=null==e?0:e,this.context.strokeRect(a,b,c,d),this.mY>b-e&&this.mY<b+d+e&&this.mX>a-e&&this.mX<a+c+e},Graphics.prototype.fsRectM=function(a,b,c,d,e){return e=null==e?0:e,this.context.fillRect(a,b,c,d),this.context.strokeRect(a,b,c,d),this.mY>b-e&&this.mY<b+d+e&&this.mX>a-e&&this.mX<a+c+e},Graphics.prototype.fCircleM=function(a,b,c,d){return d=null==d?0:d,this.context.beginPath(),this.context.arc(a,b,c,0,TwoPi),this.context.fill(),Math.pow(a-this.mX,2)+Math.pow(b-this.mY,2)<Math.pow(c+d,2)},Graphics.prototype.sCircleM=function(a,b,c,d){return d=null==d?0:d,this.context.beginPath(),this.context.arc(a,b,c,0,TwoPi),this.context.stroke(),Math.pow(a-this.mX,2)+Math.pow(b-this.mY,2)<Math.pow(c+d,2)},Graphics.prototype.fsCircleM=function(a,b,c,d){return d=null==d?0:d,this.context.beginPath(),this.context.arc(a,b,c,0,TwoPi),this.context.stroke(),this.context.fill(),Math.pow(a-this.mX,2)+Math.pow(b-this.mY,2)<Math.pow(c+d,2)},Graphics.prototype.lineM=function(a,b,c,d,e){return e=e||4,this.context.beginPath(),this.context.moveTo(a,b),this.context.lineTo(c,d),this.context.stroke(),this._distToSegmentSquared(a,b,c,d)<e*e},Graphics.prototype._distToSegmentSquared=function(a,b,c,d){var e=Math.pow(a-c,2)+Math.pow(b-d,2);if(0===e)return Math.pow(a-this.mX,2)+Math.pow(b-this.mY,2);var f=((this.mX-a)*(c-a)+(this.mY-b)*(d-b))/e;if(0>=f)return Math.pow(a-this.mX,2)+Math.pow(b-this.mY,2);if(f>=1)return Math.pow(c-this.mX,2)+Math.pow(d-this.mY,2);var g=a+f*(c-a),h=b+f*(d-b);return Math.pow(g-this.mX,2)+Math.pow(h-this.mY,2)},Graphics.prototype.bezierM=function(a,b,c,d,e,f,g,h,i){return i=null==i?2:i,this.context.beginPath(),this.context.moveTo(a,b),this.context.bezierCurveTo(c,d,e,f,g,h),this.context.stroke(),this.mX<Math.min(a,g,c,e)-i||this.mX>Math.max(a,g,c,e)+i||this.mY<Math.min(b,h,d,f)-i||this.mY>Math.max(b,h,d,f)+i?!1:GeometryOperators.distanceToBezierCurve(a,b,c,d,e,f,g,h,this.mP,!1)<i},Graphics.prototype.drawImage=function(a){if(null!=a)switch(arguments.length){case 3:this.context.drawImage(a,arguments[1],arguments[2]);break;case 5:this.context.drawImage(a,arguments[1],arguments[2],arguments[3],arguments[4]);break;case 9:this.context.drawImage(a,arguments[1],arguments[2],arguments[3],arguments[4],arguments[5],arguments[6],arguments[7],arguments[8])}},Graphics.prototype.fitImage=function(a,b){if(null!=a&&null!=b){var c=a.width/a.height,d=b.width/b.height,e=c/d;c>d?this.context.drawImage(a,.5*(a.width-a.width/e),0,a.width/e,a.height,b.x,b.y,b.width,b.height):this.context.drawImage(a,0,.5*(a.height-a.height*e),a.width,a.height*e,b.x,b.y,b.width,b.height)}},Graphics.prototype.setFill=function(a){return"number"==typeof a?arguments.length>3?void(this.context.fillStyle="rgba("+arguments[0]+","+arguments[1]+","+arguments[2]+","+arguments[3]+")"):void(this.context.fillStyle="rgb("+arguments[0]+","+arguments[1]+","+arguments[2]+")"):void(this.context.fillStyle=a)},Graphics.prototype.setStroke=function(a,b){return"number"==typeof a?arguments.length>3?void(this.context.strokeStyle="rgba("+arguments[0]+","+arguments[1]+","+arguments[2]+","+arguments[3]+")"):void(this.context.strokeStyle="rgb("+arguments[0]+","+arguments[1]+","+arguments[2]+")"):(this.context.strokeStyle=a,void(b&&(this.context.lineWidth=b)))},Graphics.prototype.setLW=function(a){this.context.lineWidth=a},Graphics.prototype.clipCircle=function(a,b,c){this.context.save(),this.context.beginPath(),this.context.arc(a,b,c,0,TwoPi,!1),this.context.closePath(),this.context.clip()},Graphics.prototype.clipRectangle=function(a,b,c,d){this.context.save(),this.context.beginPath(),this.context.moveTo(a,b),this.context.lineTo(a+c,b),this.context.lineTo(a+c,b+d),this.context.lineTo(a,b+d),this.context.clip()},Graphics.prototype.save=function(){this.context.save()},Graphics.prototype.clip=function(){this.context.clip()},Graphics.prototype.restore=function(){this.context.restore()},Graphics.prototype.fText=function(a,b,c){this.context.fillText(a,b,c)},Graphics.prototype.sText=function(a,b,c){this.context.strokeText(a,b,c)},Graphics.prototype.fsText=function(a,b,c){this.context.strokeText(a,b,c),this.context.fillText(a,b,c)},Graphics.prototype.fTextW=function(a,b,c){return this.context.fillText(a,b,c),this.context.measureText(a).width},Graphics.prototype.fTextRotated=function(a,b,c,d){this.context.save(),this.context.translate(b,c),this.context.rotate(d),this.context.fillText(a,0,0),this.context.restore()},Graphics.prototype.fsTextRotated=function(a,b,c,d){this.context.save(),this.context.translate(b,c),this.context.rotate(d),this.context.strokeText(a,0,0),this.context.fillText(a,0,0),this.context.restore()},Graphics.prototype.fTextArc=function(a,b,c,d,e,f){if(null!=a&&""!==a){var g,h=Math.sqrt(Math.pow(b-d,2)+Math.pow(c-e,2)),i=Math.atan2(c-e,b-d);f&&(i-=.5*this.getTextW(a)/h);var j,k,l=a.split("");for(g=0;null!=l[g];g++)j=d+h*Math.cos(i),k=e+h*Math.sin(i),this.fTextRotated(l[g],j,k,i+HalfPi),i+=this.getTextW(l[g])/h}},Graphics.prototype.fTextM=function(a,b,c,d){return d=d||this.fontSize,this.context.fillText(a,b,c),this.mY>c&&this.mY<c+d&&this.mX>b&&this.mX<b+this.context.measureText(a).width},Graphics.prototype.fsTextM=function(a,b,c,d){return d=d||this.fontSize,this.context.strokeText(a,b,c),this.context.fillText(a,b,c),this.mY>c&&this.mY<c+d&&this.mX>b&&this.mX<b+this.context.measureText(a).width},Graphics.prototype.fTextRotatedM=function(a,b,c,d,e){e=e||12,this.context.save(),this.context.translate(b,c),this.context.rotate(d),this.context.fillText(a,0,0),this.context.restore();var f=this.mX-b,g=this.mY-c,h=Math.sqrt(f*f+g*g),i=Math.atan2(g,f)-d,j=b+h*Math.cos(i),k=c+h*Math.sin(i);return k>c&&c+e>k&&j>b&&j<b+this.context.measureText(a).width},Graphics.prototype.setTextDefaults=function(a,b,c,d,e,f){this.fontColor=ifDef(a,this.fontColor),this.fontSize=ifDef(String(b),this.fontSize),this.fontName=ifDef(c,this.fontName),this.fontAlign=ifDef(d,this.fontAlign),this.fontBaseline=ifDef(e,this.fontBaseline),this.fontStyle=ifDef(f,this.fontStyle),this.setText()},Graphics.prototype.setText=function(a,b,c,d,e,f){var g=ifDef(a,this.fontColor),h=ifDef(String(b),this.fontSize),i=ifDef(c,this.fontName),j=ifDef(d,this.fontAlign),k=ifDef(e,this.fontBaseline),l=ifDef(f,this.fontStyle);""!==l&&(l+=" "),this.context.fillStyle=g,this.context.font=l+h+"px "+i,this.context.textAlign=j,this.context.textBaseline=k},Graphics.prototype.getFontFamily=function(){return this.fontName},Graphics.prototype.setFontFamily=function(a){this.setText(void 0,void 0,a)},Graphics.prototype.getTextW=function(a){return this.context.measureText(a).width},Graphics.prototype.getPixelColor=function(a,b){var c=this.context.getImageData(a,b,1,1).data;return"rgba("+c[0]+","+c[1]+","+c[2]+","+c[3]+")"},Graphics.prototype.getPixelColorRGBA=function(a,b){return this.context.getImageData(a,b,1,1).data},Graphics.prototype.captureCanvas=function(){var a=new Image;return a.src=this.canvas.toDataURL(),a},Graphics.prototype.setCursor=function(a){a=null==a?"default":a,this.canvas.style.cursor=a},Graphics.prototype.getFrame=function(){return new Rectangle(0,0,this.cW,this.cH)},Graphics.prototype._linesInFrame=function(a,b,c){var d,e=Math.min(b.length,c.length);for(this.context.beginPath(),this.context.moveTo(a.projectX(b[0]),a.projectY(c[0])),d=1;e>d;d++)this.context.lineTo(a.projectX(b[d]),a.projectY(c[d]))},Graphics.prototype.sLinesInFrame=function(a,b,c){this._linesInFrame(a,b,c),this.context.stroke()},Graphics.prototype.fLinesInFrame=function(a,b,c){this._linesInFrame(a,b,c),this.context.fill()},Graphics.prototype.fsLinesInFrame=function(a,b,c){this._linesInFrame(a,b,c),this.context.fill(),this.context.stroke()},Graphics.prototype.drawGridX=function(a,b,c,d){var e,f,g,h,i,j;for(e=Math.floor(a.departureFrame.x/b)*b,f=Math.min(Math.ceil(a.departureFrame.width/b),1e3),i=Math.min(a.arrivalFrame.y,a.arrivalFrame.y+a.arrivalFrame.height),j=Math.max(a.arrivalFrame.y,a.arrivalFrame.y+a.arrivalFrame.height),d=null==d?1:d,g=0;f>g;g++)h=Math.floor(a.projectX(e+g*b))+.5,this.line(h,i,h,j),null!=c&&g%d===0&&this.fText(String(e+g*b),h,j+c)},Graphics.prototype.drawGridY=function(a,b,c,d){var e,f,g,h,i,j;for(e=Math.floor(a.departureFrame.y/b)*b,f=Math.min(Math.ceil(a.departureFrame.height/b),1e3),i=Math.min(a.arrivalFrame.x,a.arrivalFrame.x+a.arrivalFrame.width),j=Math.max(a.arrivalFrame.x,a.arrivalFrame.x+a.arrivalFrame.width),d=null==d?1:d,g=0;f>g;g++)h=Math.floor(a.projectY(e+g*b))+.5,this.line(i,h,j,h),null!=c&&g%d===0&&this.fText(String(e+g*b),i+c,h)},Graphics.prototype.drawSmoothPolygon=function(a,b,c){c=null==c?30:c;var d;if(a.length<2)return null;if(2==a.length){var e=Math.atan2(a[1].y-a[0].y,a[1].x-a[0].x)-.5*Math.PI,f=c*Math.cos(e),g=c*Math.sin(e);return this.context.moveTo(a[0].x,a[0].y),this.context.bezierCurveTo(a[0].x+f,a[0].y+g,a[1].x+f,a[1].y+g,a[1].x,a[1].y),void this.context.bezierCurveTo(a[1].x-f,a[1].y-g,a[0].x-f,a[0].y-g,a[0].x,a[0].y)}var h,i=a.length,j=a[i-1],k=a[0],l=a[1];d=GeometryOperators.getSoftenControlPoints(j,k,l,c);var m,n=d[1];this.context.moveTo(k.x,k.y),j=k;var o=i+Number(b);for(h=1;o>h;h++)k=a[h%i],l=a[(h+1)%i],d=GeometryOperators.getSoftenControlPoints(j,k,l,c),m=d[0],this.context.bezierCurveTo(n.x,n.y,m.x,m.y,k.x,k.y),n=d[1],j=k},Graphics.prototype.drawEllipse=function(a,b,c,d){var e=.5522848,f=c*e,g=d*e,h=a+c,i=b+d;this.context.moveTo(a-c,b),this.context.bezierCurveTo(a-c,b-g,a-f,b-d,a,b-d),this.context.bezierCurveTo(a+f,b-d,h,b-g,h,b),this.context.bezierCurveTo(h,b+g,a+f,i,a,i),this.context.bezierCurveTo(a-f,i,a-c,b+g,a-c,b),this.context.moveTo(a-c,b)},Graphics.prototype.drawPolygon=function(a,b,c,d){c=c||0,d=d||0;var e;for(this.context.moveTo(c+a[0].x,d+a[0].y),e=1;null!=a[e];e++)this.context.lineTo(c+a[e].x,d+a[e].y);b&&this.context.lineTo(c+a[0].x,d+a[0].y)},Graphics.prototype.drawPolygonWithControlPoints=function(a,b,c,d){c=c||0,d=d||0;var e;for(this.context.moveTo(c+a[0].x,d+a[0].y),e=1;null!=a[e];e++)this.context.bezierCurveTo(c+b[2*(e-1)].x,d+b[2*(e-1)].y,c+b[2*e-1].x,d+b[2*e-1].y,c+a[e].x,d+a[e].y)},Graphics.prototype.drawBezierPolygon=function(a,b,c){b=b||0,c=c||0;var d,e,f=Math.floor((a.length-1)/3);for(this.context.moveTo(b+a[0].x,c+a[0].y),e=0;f>e;e++)d=3*e+1,this.context.bezierCurveTo(b+a[d].x,c+a[d].y,b+a[d+1].x,c+a[d+1].y,b+a[d+2].x,c+a[d+2].y)},Graphics.prototype.drawRoundRect=function(a,b,c,d,e){e=e||0;var f=b+d;this.context.moveTo(a+e,b),this.context.lineTo(a+c-e,b),this.context.quadraticCurveTo(a+c,b,a+c,b+e),this.context.lineTo(a+c,b+d-e),this.context.quadraticCurveTo(a+c,f,a+c-e,f),this.context.lineTo(a+e,f),this.context.quadraticCurveTo(a,f,a,f-e),this.context.lineTo(a,b+e),this.context.quadraticCurveTo(a,b,a+e,b)},Graphics.prototype.drawTriangleFromBase=function(a,b,c,d,e){this.context.moveTo(a+.5*c*Math.cos(e+.5*Math.PI),b+.5*c*Math.sin(e+.5*Math.PI)),this.context.lineTo(a+.5*c*Math.cos(e-.5*Math.PI),b+.5*c*Math.sin(e-.5*Math.PI)),this.context.lineTo(a+d*Math.cos(e),b+d*Math.sin(e)),this.context.lineTo(a+.5*c*Math.cos(e+.5*Math.PI),b+.5*c*Math.sin(e+.5*Math.PI))},Graphics.prototype.drawQuadrilater=function(a,b,c,d,e){e=null==e?!0:e,this.context.moveTo(a.x,a.y),this.context.lineTo(b.x,b.y),this.context.lineTo(c.x,c.y),this.context.lineTo(d.x,d.y),e&&this.context.lineTo(a.x,a.y)},FastHtml.expand=function(a){if(null==a||""===a)return"";var b;if(a.split("<").length!=a.split(">").length)return a;var c=a;if(-1!=c.indexOf("<fs"))for(b="";null!=b;)b=StringOperators.getFirstTextBetweenStrings(c,"<fs",">"),null!=b&&(c=c.replace("<fs"+b+">",'<font style="font-size:'+Number(b)+'px">')),-1==c.indexOf(">")&&(b=null);for(b="";null!=b;)b=StringOperators.getFirstTextBetweenStrings(c,"<ff",">"),null!=b&&(c=c.replace("<ff"+b+">",'<font face="'+b+'">'));for(c=c.replace(/¬/,"<br/>"),c=c.replace(/<fcBlack>/g,'<font color="#000000">'),c=c.replace(/<fcWhite>/g,'<font color="#FFFFFF">'),c=c.replace(/<fcRed>/g,'<font color="#FF0000">'),c=c.replace(/<fcGreen>/g,'<font color="#00FF00">'),c=c.replace(/<fcBlue>/g,'<font color="#0000FF">'),c=c.replace(/<fcOrange>/g,'<font color="#FFAA00">'),c=c.replace(/<fcCyan>/g,'<font color="#00FFFF">'),c=c.replace(/<fcYellow>/g,'<font color="#FFFF00">'),c=c.replace(/<fcMagenta>/g,'<font color="#FF00FF">'),b="";null!=b;)b=StringOperators.getFirstTextBetweenStrings(c,"<fcuint",">"),null!=b&&(c=c.replace("<fcuint"+b+">",'<font color="'+ColorOperators.uinttoHEX(b)+'">'));for(b="";null!=b;)b=StringOperators.getFirstTextBetweenStrings(c,"<fccolor",">"),null!=b&&(c=c.replace("<fccolor"+b+">",'<font color="'+ColorOperators.colorStringToHEX(b)+'">'));for(b="";null!=b;)if(b=StringOperators.getFirstTextBetweenStrings(c,"<frgb",">"),null!=b){var d=b.split(".");c=c.replace("<frgb"+b+">",'<font color="'+ColorOperators.RGBtoHEX(Number(d[0]),Number(d[1]),Number(d[2]))+'">')}if(-1!=c.indexOf("<fc"))for(b="";null!=b;)b=StringOperators.getFirstTextBetweenStrings(c,"<fc",">"),null!=b&&(c=c.replace("<fc"+b+">",'<font color="#'+b+'">'));for(b="";null!=b;)b=StringOperators.getFirstTextBetweenStrings(c,"<tl",">"),null!=b&&(c=c.replace("<tl"+b+">",'<textformat leftmargin="'+b+'">'));for(b="";null!=b;)b=StringOperators.getFirstTextBetweenStrings(c,"<tv",">"),null!=b&&(c=c.replace("<tv"+b+">",'<textformat leading="'+b+'">'));b="";for(var e,f,g;null!=b;)b=StringOperators.getFirstTextBetweenStrings(c,"<e",">"),null!=b&&(e=b.split("*")[0],f=b.split("*")[1],g=b.split("*").length>2&&"s"==b.split("*")[2]?"_self":"_blank",c="http://"==e.substr(0,7)||"https://"==e.substr(0,8)?c.replace("<e"+b+">","<u><a href='"+e+"' target='"+g+"'>"+f+"</a></u>"):c.replace("<e"+b+">","<u><a href='javascript:FastHtml.clickLink(\""+e+"\")' FastHtml.onclick='event.preventDefault(); clickLink(\""+e+"\"); return false; '>"+f+"</a></u>"));return c=c.replace(/<pl>/g,'<p align="left">'),c=c.replace(/<pc>/g,'<p align="center">'),c=c.replace(/<pr>/g,'<p align="right">'),c=c.replace(/<pj>/g,'<p align="justify">'),c=c.replace(/<\/f>/g,"</font>"),c=c.replace(/<\/t>/g,"</textformat>")},FastHtml.clickLink=function(a){FastHtml.linkFunction.call(FastHtml.target,a)},FastHtml.findAndPlaceLinks=function(a){var b=FastHtml._findAndPlaceLinksPrefix(a,"http");return FastHtml._findAndPlaceLinksPrefix(b,"https")},FastHtml._findAndPlaceLinksPrefix=function(a,b){var c,d="http"==b?/http:\/\//g:/https:\/\//g,e=a.split(d);if(e.length>1){c=[];var f,g;c[0]=e[0];for(var h=1;null!=e[h];h++)f=e[h].search(/ |:|;/),f>-1?(g=b+"://"+e[h].substr(0,f),c[h]="<e"+g+"*"+g+">"+e[h].substr(f)):(g=b+"://"+e[h].substr(0),c[h]="<e"+g+"*"+g+">")}return 0===e.length||1==e.length?a:c.join("")},FastHtml.findAndPlaceTwitterAdresses=function(a){var b,c=a.split(/@/g);if(c.length>1){b=[];var d,e,f;b[0]=c[0];for(var g=1;null!=c[g];g++)d=c[g].search(/ |:|;/),d>-1?(f=c[g].substr(0,d),e="https://twitter.com/"+f,b[g]="<e"+e+"*@"+f+">"+c[g].substr(d)):(f=c[g].substr(0),e="https://twitter.com/"+f,b[g]="<e"+e+"*@"+f+">")}return 0===c.length||1==c.length?a:b.join("")},FastHtml.getColorTag=function(a){return a=ColorOperators.colorStringToHEX(a),'<font color="'+a+'">'},TextFieldHTML.prototype.constructor=TextFieldHTML,TextFieldHTML.prototype.draw=function(){(this.x!=this._prevX||this.y!=this._prevY||this.width!=this._prevWidth||this.height!=this._prevHeight)&&(this._prevX=this.x,this._prevY=this.y,this._prevWidth=this.width,this._prevHeight=this.height,this.div.setAttribute("style","position:absolute;top:"+this.y+"px;left:"+this.x+"px;z-index:"+this.zIndex+"; width:"+this.width+"px; height:"+this.height+"px;"))},TextFieldHTML.prototype.setText=function(a){this.text!=a&&(this.text=a,this.div.innerHTML=this.fastHTMLactive?FastHtml.expand(a):a)},TextFieldHTML.prototype.getText=function(){return this.DOMtext.value},TextBox.prototype.constructor=TextBox,TextBox.prototype.getMaxWidth=function(){return DrawTexts.getMaxTextWidth(this.lines)},TextBox.prototype.update=function(){this.setText(this.text)},TextBox.prototype.setText=function(a){this.text=String(a),this.text=TextBox.replaceWikiLinks(this.text);var b,c,d,e=this.text.split("<e");if(e.length>1){var f,g,h;this.links=new StringList,this.linksType=new StringList,d=new List;var i,j,k,l;for(b=1;null!=e[b];b++)if(f=e[b].indexOf("*"),h=e[b].indexOf(">"),g=e[b].indexOf("*",f+1),-1!=f&&-1!=h&&h>f){for(j=e[b].substr(0,f),this.links.push(j),-1!=g&&h>g&&"b"!=e[b].charAt(g+1)?(k=e[b].charAt(g+1),e[b]=e[b].substring(f+1,g)+e[b].substr(h+1),this.linksType.push("self")):(a=e[b].substring(f+1,h),l=e[b].substr(h+1),e[b]=a+l,this.linksType.push("blank")),i=e[b-1].length,i-=1*(e[b-1].split("\\n").length-1),c=0;b-1>c;c++)i+=e[c].length,i-=1*(e[c].split("\\n").length-1);d.push(new Interval(i,h-f-1))}this.text=e.join("")}else this.links=null,this.pointPairs=null;this.graphics.setText(this.fontColor,this.fontSize,this.fontName,null,null,this.fontStyle),this.lines=DrawTexts.textWordWrapReturnLines(this.text,this.width,0,this.lineHeight),this.height=this.lines.length*this.lineHeight;var m,n;if(null!=this.links){var o;m=0,this.pointPairs=[];var p,q,r;for(b=0;null!=this.links[b];b++)for(o=d[b],m=0,c=0;null!=this.lines[c];c++){if(n=this.lines[c],o.x>=m&&o.x<m+n.length){p=this.graphics.context.measureText(n.substr(0,o.x-m)).width,q=this.graphics.context.measureText(n.substr(0,o.x+o.y-m)).width,r=c*this.lineHeight+.5,this.pointPairs.push({x0:p,x1:q,y:r});break}m+=n.length+1}}for(m=0,c=0;null!=this.lines[c];c++)n=this.lines[c],m+=n.length+1;for(this.graphics.setText(this.fontColor,this.fontSize,this.fontName,null,null,this.fontStyle),this.maxWidth=0,b=0;null!=this.lines[b];b++)this.maxWidth=Math.max(this.maxWidth,this.graphics.context.measureText(this.lines[b]).width)},TextBox.prototype.draw=function(a){a=null==a?1:a,null!=this.backgroundColor&&(this.graphics.context.fillStyle=this.backgroundColor,this.graphics.context.fillRect(this.x-this.boxMargin,this.y-this.boxMargin,this.width+2*this.boxMargin,this.height+2*this.boxMargin)),this.graphics.setText(this.fontColor,this.fontSize*a,this.fontName,null,null,this.fontStyle),DrawTexts.fillTextRectangleWithTextLines(this.lines,this.x,this.y,0,this.lineHeight*a);var b,c,d,e;if(this.overLink=null,null!=this.pointPairs){this.graphics.context.lineWidth=this.lineWidth,this.graphics.context.strokeStyle=this.fontColor;for(var f=0;null!=this.pointPairs[f];f++)b=this.pointPairs[f].x0*a+this.x,c=this.pointPairs[f].x1*a+this.x,d=this.pointPairs[f].y*a+this.y,e=Math.floor(d+Number(this.fontSize*a)),this.line(b,c,e+.5),this.graphics.mY>d&&this.graphics.mY<e&&this.graphics.mX>b&&this.graphics.mX<c&&(this.graphics.context.canvas.style.cursor="pointer",this.overLink=f)}},TextBox.prototype.line=function(a,b,c){this.graphics.context.beginPath(),this.graphics.context.moveTo(a,c),this.graphics.context.lineTo(b,c),this.graphics.context.stroke()},TextBox.prototype.mouseUp=function(){if(null!=this.overLink){var a=this.links[this.overLink],b=this.linksType[this.overLink];"http://"==a.substr(0,7)||"https://"==a.substr(0,8)||"www."==a.substr(0,4)?"blank"===b?window.open(a):window.open(a,"_self"):this.warnFunction.call(this.target,a),this.overLink=null}},TextBox.prototype.deactivate=function(){this.graphics.off("mouseup",this.mouseUp,this)},TextBox.replaceWikiLinks=function(a){for(var b,c,d,e,f=a.indexOf("[");-1!=f;)b=a.indexOf("]",f+1),-1==b?f=-1:(c=a.substring(f+1,b),console.log("text inside brackets: {"+c+"}"),-1==c.indexOf("[")&&-1==c.indexOf("]")&&(-1!=c.indexOf(" ")&&(d=c.split(" "),StringOperators.validateUrl(d[0])&&(a=a.substr(0,f)+"<e"+d[0]+"*"+d.slice(1).join(" ")+">"+a.substr(b+1),e=!0)),e||(a=a.substr(0,f)+"<e"+c+"*"+c+">"+a.substr(b+1))),f=a.indexOf("[",b));return a},InputTextFieldHTML.prototype.constructor=InputTextFieldHTML,InputTextFieldHTML.prototype.setBorder=function(a){this.border=a,this.DOMtext.setAttribute("style","border:0; color: "+this.textColor+"; width:"+(this.width-7)+"px;height:"+(this.height-7)+"px; font-size:"+this.fontSize+"px; border:"+(a?"yes":"none"))},InputTextFieldHTML.prototype.draw=function(){(this.x!=this._prevX||this.y!=this._prevY||this.width!=this._prevWidth||this.height!=this._prevHeight||this.text!=this._prevText)&&(this._prevX=this.x,this._prevY=this.y,this._prevWidth=this.width,this._prevHeight=this.height,this._prevText=this.text,this.DOMtext.style.padding="0px",this.DOMtext.style.border="0px",this.DOMtext.style.borderColor="#FFFFFF",this.DOMtext.style.background="transparent",this.DOMtext.style.resize="none",this.DOMtext.setAttribute("style","border: 0; color: "+this.textColor+"; width:"+(this.width-7)+"px;height:"+(this.height-7)+"px; font-size:"+this.fontSize+"px"),this.div.setAttribute("style","border: 0; position:absolute;top:"+this.y+"px;left:"+this.x+"px;z-index:"+this.zIndex+";"))},InputTextFieldHTML.prototype.setText=function(a,b){b=null==b?!0:b,this.text=a,this.DOMtext.value=a,this.draw()},InputTextFieldHTML.prototype.getText=function(){return this.DOMtext.value},InputTextFieldHTML.prototype.getSelectionStart=function(){return this.DOMtext.selectionStart},InputTextFieldHTML.prototype.onKeyDown=function(a){var b=a.srcElement.parent;b._eKeyDown=a,b._keyCode=a.keyCode,b.timer=setTimeout(b.onKeyDownDelayed,4,b)},InputTextFieldHTML.prototype.onKeyDownDelayed=function(a){13==a._keyCode&&a.DOMtext==document.activeElement&&null!=a.enterFunction&&a.enterFunction.call(a.enterFunctionTarget,a.id),a.text!=a.DOMtext.value&&(a.text=a.DOMtext.value,13!=a._keyCode&&null!=a.changeFunction&&a.changeFunction.call(a.changeFunctionTarget,a.id)),this.timer=null},InputTextFieldHTML.prototype.forceFocus=function(){this.DOMtext.focus(),this.focus=!0},InputTextFieldHTML.prototype.forceBlur=function(){this.DOMtext.blur(),this.focus=!1},InputTextFieldHTML.prototype.setEnterFunction=function(a,b){this.enterFunction=a,this.enterFunctionTarget=b},InputTextFieldHTML.prototype.setChangeFunction=function(a,b){this.changeFunction=a,this.changeFunctionTarget=b},InputTextFieldHTML.prototype.setFocusFunction=function(a,b){this.focusFunction=a,this.focusFunctionTarget=b},InputTextFieldHTML.prototype.setBlurFunction=function(a,b){this.blurFunction=a,this.blurFunctionTarget=b},InputTextFieldHTML.prototype.setSelection=function(a,b){a=null==a?0:a,b=null==b?this.DOMtext.value.length:b,this.DOMtext.selectionStart=a,this.DOMtext.selectionEnd=b},InputTextFieldHTML.prototype.placeCursor=function(a){this.setSelection(a)},InputTextFieldHTML.prototype.setScrollPosition=function(a){1>=a&&(a=Math.floor(a*this.DOMtext.scrollHeight)),this.DOMtext.scrollTop=a},InputTextFieldHTML.prototype.getScrollPosition=function(){return this.DOMtext.scrollTop},InputTextFieldHTML.prototype.getTextHeight=function(){return this.DOMtext.scrollHeight},InputTextFieldHTML.prototype._onFocus=function(a){a.focus=!0,null!=a.focusFunction&&a.focusFunction.call(a.focusFunctionTarget,a.id)},InputTextFieldHTML.prototype._onBlur=function(a){a.focus=!1,null!=a.blurFunction&&a.blurFunction.call(a.blurFunctionTarget,a.id)},InputTextFieldHTML.prototype.remove=function(){this.added&&(this.div.removeChild(this.DOMtext),this.main.removeChild(this.div),this.added=!1)},InputTextFieldHTML.prototype.readd=function(){this.added||(this.main.appendChild(this.div),this.div.appendChild(this.DOMtext),this.added=!0)},DragDetection.prototype.constructor=DragDetection,DragDetection.prototype.enterframe=function(a){switch(a.mode){case 0:a.dragVector.x=(this.graphics.mX-a.mousePosition.x)*a.factor,a.dragVector.y=(this.graphics.mY-a.mousePosition.y)*a.factor,a.mousePosition.x=this.graphics.mX,a.mousePosition.y=this.graphics.mY;break;case 1:a.dragVector.x=this.graphics.mX-a.mouseClickPosition.x,a.dragVector.y=this.graphics.mY-a.mouseClickPosition.y;break;case 2:var b=this.graphics.mX-a.center.x,c=this.graphics.mY-a.center.y,d=Math.sqrt(Math.pow(b,2)+Math.pow(c,2)),e=Math.atan2(c,b);a.dragVector.x=d-a.r,a.dragVector.y=e-a.a,a.r=d,a.a=e}a.listenerFunction.call(a.target,a.dragVector)},DragDetection.prototype.onMouse=function(a){switch(a.type){case"mousedown":if(null!=this.areaVerificationFunction&&!this.areaVerificationFunction.call(this.target))return;this.dragging=!0,this.mouseClickPosition.x=this.graphics.mX,this.mouseClickPosition.y=this.graphics.mY,this.mousePosition.x=this.graphics.mX,this.mousePosition.y=this.graphics.mY;var b=this.graphics.mX-this.center.x,c=this.graphics.mY-this.center.y;this.r=Math.sqrt(Math.pow(b,2)+Math.pow(c,2)),this.a=Math.atan2(c,b),this.dragVector.x=0,this.dragVector.y=0,null!=this.idInterval&&clearInterval(this.idInterval),this.idInterval=setInterval(this.enterframe.bind(this),30,this);break;case"mouseup":this.simulateMouseUp()}},DragDetection.prototype.simulateMouseUp=function(){this.dragging=!1,clearInterval(this.idInterval),this.idInterval=null},MultiLoader.prototype={},MultiLoader.prototype.constructor=MultiLoader,MultiLoader.prototype.loadDatas=function(a,b,c){this.urlList=a,this.target=c?c:arguments.callee,this.onComplete=b,this.datasLoaded=new List,this.nextDataLoading()},MultiLoader.prototype.nextDataLoading=function(){this.iLoaded<this.urlList.length?(this.indexLoading=this.iLoaded,Loader.loadData(this.urlList[this.indexLoading],this.onCompleteLoadData,this),this.loading=!0):this.loading=!1},MultiLoader.prototype.onCompleteLoadData=function(a){null!=this.priorityWeights?this.datasLoaded[this.urlList.indexOf(a.url)]=a.result:this.datasLoaded.push(a.result),this.associativeArray[this.indexLoading]=a.result;var b=new LoadEvent;b.errorType=a.errorType,b.result=this.datasLoaded,b.url=a.url,this.iLoaded+1>=this.urlList.length&&(this.loading=!1),this.onComplete.call(this.target,b),this.iLoaded++,this.nextDataLoading()},MultiLoader.prototype.loadImages=function(a,b,c,d){this.urlList=a,this.target=c?c:arguments.callee,this.onComplete=b,this.priorityWeights=d,this.imagesLoaded=new List,this.nextImageLoading()},MultiLoader.prototype.onCompleteLoadImage=function(a){1==a.errorType?(null!=this.priorityWeights?this.imagesLoaded[this.indexLoading]=null:this.imagesLoaded.push(null),this.associativeArray[this.indexLoading]=-1):(null!=this.priorityWeights?this.imagesLoaded[this.indexLoading]=a.result:this.imagesLoaded.push(a.result),this.associativeArray[this.indexLoading]=a.url,this.url_to_image[a.url]=a.result);var b=new LoadEvent;b.result=this.imagesLoaded,b.url=a.url,b.lastImage=a.result,b.indexImage=this.indexLoading,null!=this.onComplete&&this.onComplete.call(this.target,b),this.loading=!1,this.iLoaded++,this.nextImageLoading()},MultiLoader.prototype.getImageFromUrl=function(a){return this.url_to_image[a]},MultiLoader.prototype.setPriorityWeights=function(a){this.priorityWeights=a,this.loading||this.nextImageLoading()},MultiLoader.prototype.nextImageLoading=function(a){if(this.simulateDelay||null!=a)return null==a?(this.loading=!0,void(this.timer=setTimeout(this.nextImageLoading,this.DELAY_MILLISECONDS,this))):(a.loading=!1,a.simulateDelay=!1,a.nextImageLoading(),void(a.simulateDelay=!0));if(this.iLoaded<this.urlList.length)if(null!=this.priorityWeights){var b,c,d=-99999999;for(c=0;null!=this.urlList[c];c++)this.priorityWeights[c]>d&&null==this.associativeArray[c]&&(d=this.priorityWeights[c],b=c);d>0&&(this.indexLoading=b,Loader.loadImage(this.urlList[this.indexLoading],this.onCompleteLoadImage,this),this.loading=!0)}else this.indexLoading=this.iLoaded,Loader.loadImage(this.urlList[this.indexLoading],this.onCompleteLoadImage,this),this.loading=!0;else this.loading=!1},MultiLoader.prototype.destroy=function(){delete this.datasLoaded,delete this.imagesLoaded};var userAgent,userAgentVersion;Navigator.IE="IE",Navigator.NS="NS",Navigator.IOS="IOS",Navigator.getUserAgent=function(){return detectUserAgent(),userAgent},Navigator.getUserAgentVersion=function(){return detectUserAgent(),userAgentVersion},StringUtils.stringtoXML=function(a){var b;if(window.ActiveXObject)b=new window.ActiveXObject("Microsoft.XMLDOM"),b.async="false",b.loadXML(a);else{var c=new DOMParser;b=c.parseFromString(a,"text/xml")}return b},JSONUtils.stringifyAndPrint=function(a){var b=JSON.stringify(a);console.log("__________________________________________________________________________________________________________________________________________________________"),console.log(b),console.log("__________________________________________________________________________________________________________________________________________________________")},JSONUtils.dummy2=function(){return null},ConsoleTools._ticTime=void 0,ConsoleTools._tacTime=void 0,ConsoleTools.NumberTableOnConsole=function(a){var b,c,d,e,f="";for(e=0;e<a[0].length;e++){for(b="|",d=0;null!=a[d];d++){for(c=String(Math.floor(100*a[d][e])/100).replace(/0./,".");c.length<3;)c=" "+c;b+=c+"|"}f+=b+"\n"}return console.log(f),f},ConsoleTools.tic=function(a){a=a||"",ConsoleTools._ticTime=ConsoleTools._tacTime=(new Date).getTime(),ConsoleTools._nTacs=0,console.log("°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° tic °°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°° ["+a+"]")},ConsoleTools.tac=function(a){a=a||"";var b=ConsoleTools._tacTime;ConsoleTools._tacTime=(new Date).getTime(),console.log("°°°°°°° tac ["+a+"], t from tic:"+(ConsoleTools._tacTime-ConsoleTools._ticTime)+", t from last tac:"+(ConsoleTools._tacTime-b))},Forces.prototype.forcesForNetwork=function(a,b,c,d,e){b=b||0,c=c||new _Point(0,0),d=null==d?0:d,e=null==e?!1:e,this.forcesList=new List,this.equilibriumDistances=new NumberList,this.forcesTypeList=new List,this.fromNodeList=new NodeList,this.toNodeList=new NodeList;var f,g,h,i,j,k=a.nodeList.length,l=a.relationList;for(h=0;k>h;h++)0===b?this.addNode(a.nodeList[h],new _Point(a.nodeList[h].x,a.nodeList[h].y)):(j=Math.random()*TwoPi,this.addNode(a.nodeList[h],new _Point(c.x+b*Math.cos(j),c.y+b*Math.sin(j))));for(h=0;k-1>h;h++)for(f=a.nodeList[h],i=h+1;k>i;i++)if(g=a.nodeList[i],l.nodesAreConnected(f,g)){switch(d){case 0:this.equilibriumDistances.push(this.dEqSprings);break;case 1:this.equilibriumDistances.push((1.1-l.getFirstRelationByIds(f.id,g.id,!1).weight)*this.dEqSprings);break;case 2:this.equilibriumDistances.push(Math.sqrt(Math.min(f.nodeList.length,g.nodeList.length))*this.dEqSprings*.1)}this.addForce(f,g,"Spring"),e&&(this.equilibriumDistances.push(.5*this.dEqRepulsors),this.addForce(f,g,"Repulsor"))}else this.equilibriumDistances.push(this.dEqRepulsors),this.addForce(f,g,"Repulsor")},Forces.prototype.addNode=function(a,b,c){b=null==b?new _Point(200*Math.random()-100,200*Math.random()-100):b,c=null==c?new _Point(0,0):c,this.nodeList.addNode(a),a.x=b.x,a.y=b.y,a.vx=c.x,a.vy=c.y,a.ax=0,a.ay=0},Forces.prototype.addForce=function(a,b,c,d){this.fromNodeList.addNode(a),this.toNodeList.addNode(b),this.forcesList.push(a.id+"*"+b.id+"*"+c),this.forcesTypeList.push(c),null!=d&&this.equilibriumDistances.push(d)},Forces.prototype.calculate=function(){var a,b,c,d,e,f,g,h,i;for(this._resetAccelerations(),a=0;null!=this.forcesList[a];a++)if(b=this.fromNodeList[a],c=this.toNodeList[a],d=this.forcesTypeList[a],f=c.x-b.x,g=c.y-b.y,h=Math.sqrt(Math.pow(f,2)+Math.pow(g,2)),i=this.equilibriumDistances[a],!("Repulsor"==d&&h>i||"Attractor"==d&&i>h))switch(d){case"Spring":case"Repulsor":case"Attractor":e=this.k*(h-i)/h,b.ax+=e*f,b.ay+=e*g,c.ax-=e*f,c.ay-=e*g;break;case"DirectedSpring":e=this.k*(h-i)/h,c.ax-=e*f,c.ay-=e*g;break;case"DirectedRepulsor":i>h&&(e=this.k*(h-i)/h,c.ax-=e*f,c.ay-=e*g)}},Forces.prototype.attractionToPoint=function(a,b,c){
b=null==b?1:b;for(var d,e,f,g,h,i=0;null!=this.nodeList[i];i++)d=this.nodeList[i],f=a.x-d.x,g=a.y-d.y,h=Math.pow(f,2)+Math.pow(g,2),e=null!=c?Math.min(b/h,c):b/h,d.ax+=e*f,d.ay+=e*g},Forces.prototype.avoidOverlapping=function(a){a=a||0;var b,c,d,e,f,g,h,i,j,k,l,m,n,o=.5*a,p=this.nodeList.length;for(console.log(this.nodeList.length),b=0;null!=this.nodeList[b+1];b++){c=this.nodeList[(b+this._i0)%p],e=c.x-.5*c.width-o,g=c.x+.5*c.width+o,f=c.y-.5*c.height-o,h=c.y+.5*c.height+o;for(var q=b+1;null!=this.nodeList[q];q++)d=this.nodeList[(q+this._i0+b)%p],i=d.x-.5*d.width-o,k=d.x+.5*d.width+o,j=d.y-.5*d.height-o,l=d.y+.5*d.height+o,(e>i&&k>e||g>i&&k>g)&&(f>j&&l>f||h>j&&l>h)&&(m=d.x-c.x,n=d.y-c.y,Math.abs(m)>Math.abs(n)?m>0?(c.x-=.5*(g-i),d.x+=.5*(g-i)):(c.x+=.5*(k-e),d.x-=.5*(k-e)):n>0?(c.y-=.5*(h-j),d.y+=.5*(h-j)):(c.y+=.5*(l-f),d.y-=.5*(l-f)))}this._i0++},Forces.prototype.avoidOverlappingRadial=function(a,b){a=a||0,b=b||1;var c,d,e,f,g,h,i,j,k=this.nodeList.length,l=2*a;for(c=0;null!=this.nodeList[c+1];c++){d=this.nodeList[(c+this._i0)%k];for(var m=c+1;null!=this.nodeList[m];m++)e=this.nodeList[(m+this._i0+c)%k],f=e.x-d.x,g=e.y-d.y,h=Math.pow(f,2)+Math.pow(g,2),i=Math.pow(d.r+e.r+l,2),i>h&&(i=Math.sqrt(i),h=Math.sqrt(h),j=.5*(i-h)/h,d.x-=b*j*f,d.y-=b*j*g,e.x+=b*j*f,e.y+=b*j*g)}this._i0++},Forces.prototype.applyForces=function(){for(var a,b=0;null!=this.nodeList[b];b++)a=this.nodeList[b],a.vx+=a.ax,a.vy+=a.ay,a.vx*=this.friction,a.vy*=this.friction,a.x+=a.vx,a.y+=a.vy},Forces.prototype.deactivateForcesFromNode=function(a){a.vx=a.vy=a.ax=a.ay=0},Forces.prototype.destroy=function(){delete this.k,delete this.dEqSprings,delete this.dEqRepulsors,delete this.friction,this.nodeList.destroy(),delete this.nodeList,this.forcesList.destroy(),delete this.forcesList,this.equilibriumDistances.destroy(),delete this.equilibriumDistances,this.forcesTypeList.destroy(),delete this.forcesTypeList,this.fromNodeList.destroy(),delete this.fromNodeList,this.toNodeList.destroy(),delete this.toNodeList,delete this._i0},Forces.prototype._resetAccelerations=function(){for(var a,b=0;null!=this.nodeList[b];b++)a=this.nodeList[b],a.ax=0,a.ay=0},Engine3D.prototype.constructor=Engine3D,Engine3D.prototype.setBasis=function(a){this._basis=a.clone(),this._basisBase=a.clone(),this._provisionalBase=a.clone()},Engine3D.prototype.setAngles=function(a){this._angles=a.clone(),this._freeRotation=!1,this._basis=this.basis3DRotation(this._basisBase,this._angles)},Engine3D.prototype.applyRotation=function(a){this._freeRotation||(this._freeRotation=!0,this.updateAngles(),this._provisionalBase[0]=this._basis[0].clone(),this._provisionalBase[1]=this._basis[1].clone(),this._provisionalBase[2]=this._basis[2].clone()),this._basis[0]=this.point3DRotation(this._provisionalBase[0],new Point3D(-a.y,a.x,0)),this._basis[1]=this.point3DRotation(this._provisionalBase[1],new Point3D(-a.y,a.x,0)),this._basis[2]=this.point3DRotation(this._provisionalBase[2],new Point3D(-a.y,a.x,0)),this._provisionalBase[0]=this._basis[0].clone(),this._provisionalBase[1]=this._basis[1].clone(),this._provisionalBase[2]=this._basis[2].clone()},Engine3D.prototype.projectPoint3D=function(a){var b=this.lens/(this.lens+(this._basis[0].z*a.x+this._basis[1].z*a.y+this._basis[2].z*a.z));return new Point3D((this._basis[0].x*a.x+this._basis[1].x*a.y+this._basis[2].x*a.z)*b,(this._basis[0].y*a.x+this._basis[1].y*a.y+this._basis[2].y*a.z)*b,b)},Engine3D.prototype.projectCoordinates=function(a,b,c){var d=this.lens/(this.lens+(this._basis[0].z*a+this._basis[1].z*b+this._basis[2].z*c));return new Point3D((this._basis[0].x*a+this._basis[1].x*b+this._basis[2].x*c)*d,(this._basis[0].y*a+this._basis[1].y*b+this._basis[2].y*c)*d,d)},Engine3D.prototype.projectPoint3DNode=function(a){var b=this.lens/(this.lens+(this._basis[0].z*a.x+this._basis[1].z*a.y+this._basis[2].z*a.z));return new Point3D((this._basis[0].x*a.x+this._basis[1].x*a.y+this._basis[2].x*a.z)*b,(this._basis[0].y*a.x+this._basis[1].y*a.y+this._basis[2].y*a.z)*b,b)},Engine3D.prototype.scale=function(a){return this.lens/(this.lens+(this._basis[0].z*a.x+this._basis[1].z*a.y+this._basis[2].z*a.z))},Engine3D.prototype.sortedIndexesByPointsScale=function(a){var b,c=[];for(b=0;null!=a[b];b++)c[b]=[a[b],b];c=c.sort(this._sortingCriteria.bind(this));var d=new NumberList;for(b=0;null!=a[b];b++)d[b]=c[b][1];return d},Engine3D.prototype.sortListByPointsScale=function(a,b){var c,d=[];for(c=0;null!=a[c];c++)d[c]=[b[c],a[c]];d=d.sort(this._sortingCriteria.bind(this));var e=instantiateWithSameType(a);for(e.name=a,c=0;null!=a[c];c++)e[c]=d[c][1];return e},Engine3D.prototype._sortingCriteria=function(a,b){var c=a[0],d=b[0];return this._basis[0].z*c.x+this._basis[1].z*c.y+this._basis[2].z*c.z<this._basis[0].z*d.x+this._basis[1].z*d.y+this._basis[2].z*d.z?1:-1},Engine3D.prototype.updateAngles=function(){this._angles=this.getEulerAngles()},Engine3D.prototype.getEulerAngles=function(){return new Point3D(Math.atan2(-this._basis[1].z,this._basis[2].z),Math.asin(this._basis[0].z),Math.atan2(-this._basis[0].y,this._basis[0].x))},Engine3D.prototype.basis3DRotation=function(a,b){var c=Math.cos(b.x),d=Math.sin(b.x),e=Math.cos(b.y),f=Math.sin(b.y),g=Math.cos(b.z),h=Math.sin(b.z);return new Polygon3D(new Point3D(a[0].x*g*e+a[0].y*(g*d*f+h*c)+a[0].z*(h*d-g*c*f),-a[0].x*h*e+a[0].y*(g*c-h*d*f)+a[0].z*(h*c*f+g*d),a[0].x*f-a[0].y*d*e+a[0].z*e*c),new Point3D(a[1].x*g*e+a[1].y*(g*d*f+h*c)+a[1].z*(h*d-g*c*f),-a[1].x*h*e+a[1].y*(g*c-h*d*f)+a[1].z*(h*c*f+g*d),a[1].x*f-a[1].y*d*e+a[1].z*e*c),new Point3D(a[2].x*g*e+a[2].y*(g*d*f+h*c)+a[2].z*(h*d-g*c*f),-a[2].x*h*e+a[2].y*(g*c-h*d*f)+a[2].z*(h*c*f+g*d),a[2].x*f-a[2].y*d*e+a[2].z*e*c))},Engine3D.prototype.point3DRotation=function(a,b){var c=Math.cos(b.x),d=Math.sin(b.x),e=Math.cos(b.y),f=Math.sin(b.y),g=Math.cos(b.z),h=Math.sin(b.z);return new Point3D(a.x*g*e+a.y*(g*d*f+h*c)+a.z*(h*d-g*c*f),-a.x*h*e+a.y*(g*c-h*d*f)+a.z*(h*c*f+g*d),a.x*f-a.y*d*e+a.z*e*c)},Engine3D.prototype.line3D=function(a,b){var c=new _Polygon,d=a,e=this.lens/(this.lens+(this._basis[0].z*d.x+this._basis[1].z*d.y+this._basis[2].z*d.z)),f=b,g=this.lens/(this.lens+(this._basis[0].z*f.x+this._basis[1].z*f.y+this._basis[2].z*f.z));if(e>0||g>0){if(e>0&&g>0)return c.push(new _Point((this._basis[0].x*d.x+this._basis[1].x*d.y+this._basis[2].x*d.z)*e,(this._basis[0].y*d.x+this._basis[1].y*d.y+this._basis[2].y*d.z)*e)),c.push(new _Point((this._basis[0].x*f.x+this._basis[1].x*f.y+this._basis[2].x*f.z)*g,(this._basis[0].y*f.x+this._basis[1].y*f.y+this._basis[2].y*f.z)*g)),c;var h=new Point3D(this._basis[0].x*d.x+this._basis[1].x*d.y+this._basis[2].x*d.z,this._basis[0].y*d.x+this._basis[1].y*d.y+this._basis[2].y*d.z,this._basis[0].z*d.x+this._basis[1].z*d.y+this._basis[2].z*d.z),i=new Point3D(this._basis[0].x*f.x+this._basis[1].x*f.y+this._basis[2].x*f.z,this._basis[0].y*f.x+this._basis[1].y*f.y+this._basis[2].y*f.z,this._basis[0].z*f.x+this._basis[1].z*f.y+this._basis[2].z*f.z),j=(-this.lens+this._cuttingPlane-h.z)/(i.z-h.z),k=new Point3D(h.x+j*(i.x-h.x),h.y+j*(i.y-h.y),-this.lens+this._cuttingPlane),l=this.lens/(this.lens+k.z);return e>0?(c.push(new _Point(h.x*e,h.y*e)),c.push(new _Point(k.x*l,k.y*l))):(c.push(new _Point(k.x*l,k.y*l)),c.push(new _Point(i.x*g,i.y*g))),c}return null},Engine3D.prototype.quadrilater=function(a,b,c,d){var e=new Polygon3D,f=this.line3D(a,b),g=this.line3D(b,c),h=this.line3D(c,d),i=this.line3D(d,a);return null!=f&&((null==i||f[0].x!=i[1].x&&f[0].y!=i[1].y)&&e.push(f[0]),e.push(f[1])),null!=g&&((null==f||g[0].x!=f[1].x&&g[0].y!=f[1].y)&&e.push(g[0]),e.push(g[1])),null!=h&&((null==g||h[0].x!=g[1].x&&h[0].y!=g[1].y)&&e.push(h[0]),e.push(h[1])),null!=i&&((null==h||i[0].x!=h[1].x&&i[0].y!=h[1].y)&&e.push(i[0]),e.push(i[1])),e},CountryListDraw.drawCountriesAsCircles=function(a,b,c,d,e,f){e=null==e?new Rectangle(-180,-90,360,180):e,f=null==f?ColorListGenerators.createColorListWithSingleColor(b.length,"rgba(100,100,100,0.6)"):f;for(var g,h=d.width/e.width,i=d.height/e.height,j=0;null!=b[j];j++)c[j]<.5||(g=b[j],a.fillStyle=f[j],a.beginPath(),a.arc(d.x+h*(g.geoCenter.x-e.x),d.getBottom()-i*(g.geoCenter.y-e.y),c[j],0,TwoPi),a.fill())},CountryListDraw.drawCountriesPolygons=function(a,b,c,d,e,f,g){d=null==d?new Rectangle(-180,-90,360,180):d,e=null==e?ColorListGenerators.createColorListWithSingleColor(b.length,"rgba(100,100,100,0.6)"):e;var h,i,j,k=c.width/d.width,l=c.height/d.height;null!=f&&(a.lineWidth=f),null!=g&&(a.strokeStyle=g);for(var m=0;null!=b[m];m++){h=b[m],i=h.polygonList,a.fillStyle=e[m];for(var n=0;null!=i[n];n++){j=i[n],a.beginPath(),a.moveTo(c.x+k*(j[0].x-d.x),c.getBottom()-l*(j[0].y-d.y));for(var o=1;null!=j[o];o++)a.lineTo(c.x+k*(j[o].x-d.x),c.getBottom()-l*(j[o].y-d.y));a.fill(),null!=f&&a.stroke()}}},CircleDraw.circlesCloud=function(a,b,c){if(null==a||0===a.length)return null;c=null==c?0:c;for(var d,e,f=NumberListOperators.normalizedToMax(a).sqrt(),g=new Polygon3D,h=0,i=0,j=0,k=0,l=b.getCenter(),m=100*f[0],n=b.width/b.height,o=0;null!=f[o];o++){if(d=100*f[o],0===o)j=l.x,k=l.y,e=d;else{for(h=0,i=e+d+c+.1;CircleDraw._pointInCircles(g,j,k,d,c);)i+=.1,h+=.005*i,j=l.x+n*i*Math.cos(h),k=l.y+i*Math.sin(h);m=Math.max(m,n*i+100*f[o])}g[o]=new Point3D(j,k,d)}var p;for(n=.5*b.width/(m+.001),o=0;null!=g[o];o++)p=g[o],p.x=l.x+(p.x-l.x)*n,p.y=l.y+(p.y-l.y)*n,p.z*=n;return g},CircleDraw._pointInCircles=function(a,b,c,d,e){for(var f,g=0;null!=a[g];g++)if(f=a[g],Math.pow(f.x-b,2)+Math.pow(f.y-c,2)<Math.pow(f.z+d+e,2))return!0;return!1},ColorsDraw.drawColorScaleLegend=function(a,b,c,d,e){var f=null==a.memory||a.width!=a.memory.w||a.height!=a.memory.h||b!=a.memory.cS||c!=a.memory.min||d!=a.memory.max;if(f){a.memory={w:a.width,h:a.height,cS:b,min:c,max:d};var g;if(a.width>a.height){for(g=0;g<a.width;g+=2)e.setFill(b(g/a.width)),e.fRect(g,0,2,a.height);e.setStroke("rgba(0,0,0,0.8)",3),null!=c&&(e.setText("white",12,null,"left","middle"),e.fsText(c,2,.5*a.height)),null!=d&&(e.setText("white",12,null,"right","middle"),e.fsText(d,a.width-2,.5*a.height))}else for(g=0;g<a.height;g+=2)e.setFill(b(g/a.height)),e.fRect(0,g,a.width,2)}a.memory.image&&e.drawImage(a.memory.image,a.x,a.y)},ListDraw.drawList=function(a,b,c,d,e,f,g,h){if(!(null==b||b.length<0)){null==h&&(h=a.graphics),e=e||14,c=null==c?0:c,null==a.memory&&(a.memory={selected:0,y:0,multiSelected:new List});var i=a.memory.list!=b,j=i&&null!=g||a.memory.selectedInit!=g;j&&(3==c?(a.memory.multiSelected=new List,g.forEach(function(c){a.memory.multiSelected.push(b[c])})):2==c?a.memory.multiSelected=List.fromArray(g).getImproved():a.memory.selected=g,a.memory.selectedInit=g),i&&(a.memory.list=b);var k,l,m,n,o,p,q=a.x+5,r=q+(d?15:0),s=e+4,t=b.length,u=a.getBottom(),v=a.containsPoint(h.mP),w=0,x=2==c||3==c,y=b.length*s;for(y<=a.height-20?m=a.y+10:(w=v?Math.min(10-(y-a.height+20)*((h.mY-(a.y+10))/(a.height-20)),10):10-(y-a.height+20)*a.memory.selected/b.length,a.memory.y=.95*a.memory.y+.05*w,m=a.y+a.memory.y),h.setText("black",e),k=0;null!=b[k];k++)if(l=m+s*k,!(l<a.y)){if(l+12>u)break;-1!=c?(o=a.memory.multiSelected.indexOf(k),p=x&&-1!=o,n=x?p:a.memory.selected==k,n?(h.setFill("black"),h.fRect(a.x+2,l,a.width-4,s),h.setFill("white")):h.setFill("black"),h.fText(b[k].toString(),r,l+2),v&&h.mY>=l&&h.mY<l+s&&(h.setFill("rgba(150,150,150,0.3)"),h.fRectM(a.x+2,l,a.width-4,s)&&h.setCursor("pointer"),h.MOUSE_DOWN&&(x?p?a.memory.multiSelected=a.memory.multiSelected.getWithoutElementAtIndex(o):(a.memory.multiSelected=a.memory.multiSelected.clone(),a.memory.multiSelected.push(2==c?k:b[k]),a.memory.multiSelected=a.memory.multiSelected.getImproved()):a.memory.selected=k))):h.setFill("black"),d&&(h.setFill(null==d?"rgb(200, 200, 200)":d[k%t]),h.fRect(q,l+4,10,10))}return 1==c?b[a.memory.selected]:x?a.memory.multiSelected:a.memory.selected}},NumberListDraw.drawSimpleGraph=function(a,b,c,d,e){if(null!=b&&null!=NumberListOperators.normalized(b)){if(null==e&&(e=a.graphics),c=c||0,null==a.memory||b!=a.memory.numberList){if(a.memory={numberList:b,minmax:b.getMinMaxInterval(),zero:null},a.memory.minmax.x>0&&a.memory.minmax.y>0?a.memory.normalizedList=NumberListOperators.normalizedToMax(b):(a.memory.normalizedList=NumberListOperators.normalized(b),a.memory.zero=-a.memory.minmax.x/a.memory.minmax.getAmplitude()),a.memory.xTexts=new StringList,null!=d&&"Interval"==d.type)var f=(d.getAmplitude()+1)/b.length;b.forEach(function(c,e){a.memory.xTexts[e]=null==d?String(b[e]):(null==f?d[e]:d.x+e*f)+":"+b[e]})}var g,h=new Rectangle(a.x+c,a.y+c,a.width-2*c,a.height-2*c);h.bottom=h.getBottom();var i,j=h.width/b.length,k=Math.max(1,j),l=-1,m=h.containsPoint(e.mP),n=m?"rgb(160,160,160)":"black";if(a.memory.zero){var o=h.bottom-h.height*a.memory.zero;for(g=0;null!=b[g];g++)i=h.x+g*j,m&&e.mX>i&&e.mX<i+j?(l=g,e.setFill("black")):e.setFill(n),e.fRect(h.x+g*j,o,k,-h.height*(a.memory.normalizedList[g]-a.memory.zero))}else for(g=0;null!=b[g];g++)i=h.x+g*j,m&&e.mX>i&&e.mX<i+j?(l=g,e.setFill("black")):e.setFill(n),e.fRect(i,h.bottom,k,-h.height*a.memory.normalizedList[g]);var p;if(-1!=l){e.setText("white",12);var q=a.memory.xTexts[l],k=e.getTextW(q);e.setFill("rgb(100,100,100)"),e.fLines(e.mX,e.mY,e.mX+16,e.mY-10,e.mX+k+16,e.mY-10,e.mX+k+16,e.mY-30,e.mX+6,e.mY-30,e.mX+6,e.mY-10),e.setFill("white"),e.fText(q,e.mX+10,e.mY-26),e.MOUSE_DOWN&&(p=l)}return p}},IntervalTableDraw.MIN_CHARACTERS_SIZE=1,IntervalTableDraw.drawIntervalsFlowTable=function(a,b,c,d,e,f){b=null==b?new Rectangle(10,10,400,300):b,c=null==c?ColorListGenerators.createCategoricalColors(0,a.length,ColorScales.temperature):c,d=d||!1,e=null==e?.45:e,null==f&&(f=b.graphics);var g,h,i,j,k,l,m=a[0].length,n=b.width/(m-1),o=b.height,p=0,q=b.x,r=b.y;for(g=0;null!=a[g];g++){for(j=a[g],f.context.fillStyle=c[g],f.context.beginPath(),p=r,i=new _Point(q,j[0].y*o+p),f.context.moveTo(i.x,i.y),k=i,h=1;m>h;h++)p=r,i=new _Point(h*n+q,j[h].y*o+p),d?(l=(i.x-k.x)*e,f.context.bezierCurveTo(k.x+l,k.y,i.x-l,i.y,i.x,i.y)):f.context.lineTo(i.x,i.y),k=i;for(i=new _Point((m-1)*n+q,j[m-1].x*o+p),f.context.lineTo(i.x,i.y),k=i,h=m-2;h>=0;h--)p=r,i=new _Point(h*n+q,j[h].x*o+p),d?(l=(i.x-k.x)*e,f.context.bezierCurveTo(k.x+l,k.y,i.x-l,i.y,i.x,i.y)):f.context.lineTo(i.x,i.y),k=i;i=new _Point(q,j[0].x*o+p),f.context.lineTo(i.x,i.y),f.context.fill()}},IntervalTableDraw._isOnShape=function(a,b,c,d,e,f,g){var h=(f-a.x)/(b.x-a.x),i=1-h;this.p0.x=a.x+h*e,this.p0.y=a.y,this.p1.x=i*(a.x+e)+h*(b.x-e),this.p1.y=i*a.y+h*b.y,this.p2.x=b.x-i*e,this.p2.y=b.y,this.P0.x=i*this.p0.x+h*this.p1.x,this.P0.y=i*this.p0.y+h*this.p1.y,this.P1.x=i*this.p1.x+h*this.p2.x,this.P1.y=i*this.p1.y+h*this.p2.y;var j=i*this.P0.y+h*this.P1.y;this.p0.y=c,this.p1.y=i*c+h*d,this.p2.y=d,this.P0.y=i*this.p0.y+h*this.p1.y,this.P1.y=i*this.p1.y+h*this.p2.y;var k=i*this.P0.y+h*this.P1.y;return g>k&&j>g},IntervalTableDraw.drawCircularIntervalsFlowTable=function(a,b,c,d,e,f,g,h,i,j,k){null==k&&(k=a.graphics);var l,m,n=b.length;f=null==f?ColorListOperators.colorListFromColorScale(new ColorScale(ColorOperators.temperatureScale),n):f,c=null==c?new _Point(100,100):c,d=null==d?200:d,e=null==e?10:e,j=null==j?0:j;var o,p,q,r,s,t,u,v,w,x=b[0].length,y=TwoPi/x,z=d-e,A=.3*y,B=Math.cos(A),C=-1,D=[],E=[],F=[],G=[],H=[];for(l=0;n>l;l++){for(p=b[l],k.setFill(f[l%n]),k.context.beginPath(),o=new _Point(null==i?0:i[0]+j,(1-p[0].y)*z+e),k.context.moveTo(o.y*Math.cos(o.x)+c.x,o.y*Math.sin(o.x)+c.y),t=o,m=1;x>=m;m++)q=p[m%x],o=new _Point(null==i?m*y:i[m%x]+j,(1-q.y)*z+e),u=t.y/B,v=o.y/B,k.context.bezierCurveTo(u*Math.cos(t.x+A)+c.x,u*Math.sin(t.x+A)+c.y,v*Math.cos(o.x-A)+c.x,v*Math.sin(o.x-A)+c.y,o.y*Math.cos(o.x)+c.x,o.y*Math.sin(o.x)+c.y),h&&-1==C&&this._isOnRadialShape(c,k.mP,t.x,o.x,z*(1-p[(m-1)%x].y)+e,z*(1-p[(m-1)%x].x)+e,z*(1-p[m%x].y)+e,z*(1-p[m%x].x)+e)&&(C=l),t=o,null!=g&&(r=q.getAmplitude(),s=Math.min(3*Math.sqrt(r*d),28),s>=8&&(w=o.y+.5*r*z,G.push(s),H.push(o.x+.5*Math.PI),E.push(w*Math.cos(o.x)+c.x),F.push(w*Math.sin(o.x)+c.y),D.push(g[l])));for(o=new _Point(null==i?0:i[0]+j,(1-p[0].x)*z+e),k.context.lineTo(o.y*Math.cos(o.x)+c.x,o.y*Math.sin(o.x)+c.y),t=o,m=x-1;m>=0;m--)o=new _Point(null==i?m*y:i[m]+j,(1-p[m].x)*z+e),u=t.y/B,v=o.y/B,k.context.bezierCurveTo(u*Math.cos(t.x-A)+c.x,u*Math.sin(t.x-A)+c.y,v*Math.cos(o.x+A)+c.x,v*Math.sin(o.x+A)+c.y,o.y*Math.cos(o.x)+c.x,o.y*Math.sin(o.x)+c.y),t=o;o=new _Point(null==i?0:i[0]+j,(1-p[0].x)*z+e),k.context.lineTo(o.y*Math.cos(o.x)+c.x,o.y*Math.sin(o.x)+c.y),k.context.fill()}var I=D.length;for(l=0;I>l;l++)k.setText("black",G[l],null,"center","middle"),k.fTextRotated(D[l],E[l],F[l],H[l]);return C},IntervalTableDraw._isOnRadialShape=function(a,b,c,d,e,f,g,h){c>d&&(d+=TwoPi);var i=a.angleToPoint(b);if(0>i&&(i+=TwoPi),i>TwoPi&&(i-=TwoPi),d>i+TwoPi&&(i+=TwoPi),i-TwoPi>c&&(i-=TwoPi),c>i||i>d)return!1;var j=d-c,k=(i-c)/j,l=GeometryOperators.bezierCurvePoints(c,e,c+.5*j,e,d-.5*j,g,d,g,k),m=GeometryOperators.bezierCurvePoints(c,f,c+.25*j,f,d-.25*j,h,d,h,k),n=b.subtract(a).getNorm();return n>l.y&&n<m.y},IntervalTableDraw.drawIntervalsWordsFlowTable=function(a,b,c,d,e,f){null==f&&(f=a.graphics);var g,h,i=b.length;d=null==d?ColorListGenerators.createCategoricalColors(0,b.length,ColorScales.temperature):d,a=null==a?new Rectangle(10,10,400,300):a;var j,k,l,m,n,o,p,q=b[0].length,r=a.width/(q-1),s=a.height,t=new _Point,u=new _Point,v=b[i-1],w=0,x=a.x,y=a.y;e||(f.context.strokeStyle="rgba(255,255,255,0.4)"),f.context.textBaseline="top",f.context.textAlign="left";var z,A,B,C,D,E,F,G,H,I,J,K,L=r,M=(q-1)/a.width;for(g=0;null!=b[g];g++){n=b[g],p=" "+c[g],A=0,F=0,z=0,h=0,B=0,w=.5*(1-v[0].y)*s+y,j=new _Point(x,n[0].x*s+w),k=new _Point(x,n[0].y*s+w);do F++,m=k.y-j.y,I=Math.floor(.3*m+1),e||(f.context.font=I+"px "),G=p.charAt(F%p.length),H=e?I*widthsTypode[G]:f.context.measureText(G).width+2,L=.9*H||1,A+=L,z=M*A,h=Math.floor(z),B=z-h,h+2>q||(J=h/M,K=(h+1)/M,o=.45*M,C=IntervalTableDraw._bezierValue(J,K,v[h].y,v[h+1].y,B,o),w=.5*(1-C)*s+y,t.x=j.x,t.y=j.y,u.x=k.x,u.y=k.y,D=IntervalTableDraw._bezierValue(J,K,n[h].x,n[h+1].x,B,o),E=IntervalTableDraw._bezierValue(J,K,n[h].y,n[h+1].y,B,o),j=new _Point(A+x,D*s+w),k=new _Point(A+x,E*s+w),l=new _Point(t.x+.5*L,.25*(j.y+k.y+t.y+u.y)),e?f.context.strokeStyle=d[g]:f.context.fillStyle=d[g],m>IntervalTableDraw.MIN_CHARACTERS_SIZE&&(e?DrawTextsAdvanced.typodeOnQuadrilater(G,t,j,k,u):(f.context.save(),f.context.globalAlpha=m/15,DrawTextsAdvanced.textOnQuadrilater(f.context,G,t,j,k,u,I,1),f.context.restore())));while(q>h+1)}},IntervalTableDraw._bezierValue=function(a,b,c,d,e,f){var g=1-e,h=new _Point(a+e*f,c),i=new _Point(g*(a+f)+e*(b-f),g*c+e*d),j=new _Point(b-g*f,d),k=new _Point(g*h.x+e*i.x,g*h.y+e*i.y),l=new _Point(g*i.x+e*j.x,g*i.y+e*j.y);return g*k.y+e*l.y},NumberTableDraw.drawNumberTable=function(a,b,c,d,e,f){if(null==a||null==b||null==b.type||"NumberTable"!=b.type||b.length<2)return null;null==f&&(f=a.graphics),c=null==c?ColorScales.blueToRed:c,d=d||!1,e=null==e?2:e;var g,h,i,j,k,l,m,n=a.width/b.length,o=a.height/b[0].length;d||(l=b.getMinMaxInterval(),m=l.getAmplitude());var p;for(g=0;null!=b[g];g++)for(i=b[g],j=Math.round(a.x+g*n),p=f.mX>j&&f.mX<=j+n,d&&(l=i.getMinMaxInterval(),m=l.getAmplitude()),h=0;null!=i[h];h++)f.context.fillStyle=c((i[h]-l.x)/m),f.context.fillRect(j,Math.round(a.y+h*o),Math.ceil(n)-e,Math.ceil(o)-e),p&&f.mY>a.y+h*o&&f.mY<=a.y+(h+1)*o&&(k=new _Point(g,h));return k},NumberTableDraw.drawSimpleScatterPlot=function(a,b,c,d,e,f,g,h){if(!(null==a||null==b||"NumberTable"!=b.type||b.length<2||0===b[0].length||0===b[1].length||(null==h&&(h=a.graphics),b.length<2))){e=e||20,f=f||!1,g=g||0;var i=new Rectangle(a.x+g,a.y+g,a.width-2*g,a.height-2*g);i.bottom=i.getBottom();var j,k,l,m,n=NumberListOperators.normalized(f?b[0].log(1):b[0]),o=f?b[1].log(1):NumberListOperators.normalized(b[1]),p=b.length<=2?null:NumberListOperators.normalized(b[2]).sqrt().factor(e),q=null==d?null:d.length,r=Math.min(n.length,o.length,null==p?3e5:p.length,null==c?3e5:c.length);for(j=0;r>j;j++)k=i.x+n[j]*i.width,l=i.bottom-o[j]*i.height,null==p?NumberTableDraw._drawCrossScatterPlot(k,l,null==d?"rgb(150,150,150)":d[j%q],h)&&(m=j):(h.setFill(null==d?"rgb(150,150,150)":d[j%q]),h.fCircleM(k,l,p[j],p[j]+1)&&(m=j)),null!=c&&(h.setText("black",10),h.fText(c[j],k,l));return g>7&&""!==n.name&&""!==o.name&&(h.setText("black",10,null,"right","middle"),h.fText(n.name,i.getRight()-2,i.bottom+.5*g),h.fTextRotated(o.name,i.x-.5*g,i.y+1,-HalfPi)),null!=m?(h.setCursor("pointer"),m):void 0}},NumberTableDraw._drawCrossScatterPlot=function(a,b,c,d){return d.setStroke(c,1),d.line(a,b-2,a,b+2),d.line(a-2,b,a+2,b),Math.pow(d.mX-a,2)+Math.pow(d.mY-b,2)<25},NumberTableDraw.drawSlopeGraph=function(a,b,c,d){if(null!=a&&null!=b&&"NumberTable"==b.type&&!(b.length<2)){var e=16,f=new Rectangle(a.x+e,a.y+e,a.width-2*e,a.height-2*e);f.bottom=f.getBottom();var g,h,i,j=NumberListOperators.normalized(b[0]),k=NumberListOperators.normalized(b[1]),l=Math.min(j.length,k.length,null==c?2e3:c.length),m=f.x+(null==c?10:.25*f.width),n=f.getRight()-(null==c?10:.25*f.width);for(d.setStroke("black",1),g=0;l>g;g++)h=f.bottom-j[g]*f.height,i=f.bottom-k[g]*f.height,d.line(m,h,n,i),null!=c&&f.bottom-h>=9&&(d.setText("black",9,null,"right","middle"),d.fText(c[g],m-2,h)),null!=c&&f.bottom-i>=9&&(d.setText("black",9,null,"left","middle"),d.fText(c[g],n+2,i))}},NumberTableDraw.drawDensityMatrix=function(a,b,c,d,e){if(null!=b&&null!=b[0]){c=null==c?ColorScales.whiteToRed:"string"==typeof c?ColorScales[c]:c,d=d||0;var f,g,h,i,j,k,l,m,n;if(null==a.memory||b!=a.memory.coordinates||c!=a.memory.colorScale){var o=null==b[0].x;if(o){if(m=b,null==m||m.length<2||"NumberTable"!=m.type)return}else n=b;var p=0,q=0,r=0,s=new NumberTable,t=o?m[0].length:n.length;if(l=new Table,o)j=m[0].getMin(),k=m[1].getMin();else for(j=n[0].x,k=n[0].y,f=1;t>f;f++)j=Math.min(n[f].x,j),k=Math.min(n[f].y,k);for(f=0;t>f;f++)o?(h=Math.floor(m[0][f]-j),i=Math.floor(m[1][f]-k)):(h=Math.floor(n[f].x-j),i=Math.floor(n[f].y-k)),null==s[h]&&(s[h]=new NumberList),null==s[h][i]&&(s[h][i]=0),s[h][i]++,p=Math.max(p,s[h][i]),q=Math.max(q,h+1),r=Math.max(r,i+1);for(f=0;q>f;f++)for(null==s[f]&&(s[f]=new NumberList),l[f]=new ColorList,g=0;r>g;g++)null==s[f][g]&&(s[f][g]=0),l[f][g]=c(s[f][g]/p);a.memory={matrixColors:l,coordinates:b,colorScale:c,selected:null}}else l=a.memory.matrixColors;var u=new Rectangle(a.x+d,a.y+d,a.width-2*d,a.height-2*d);u.bottom=u.getBottom();var v=u.width/l.length,w=u.height/l[0].length,x=a.memory.selected;for(e.MOUSE_UP_FAST&&(a.memory.selected=null),f=0;null!=l[f];f++)for(g=0;null!=l[0][g];g++)e.setFill(l[f][g]),e.fRectM(u.x+f*v,u.bottom-(g+1)*w,v+.5,w+.5)&&e.MOUSE_UP_FAST&&(a.memory.selected=[f,g]);if(a.memory.selected&&(e.setStroke("white",5),e.sRect(u.x+a.memory.selected[0]*v-1,u.bottom-(a.memory.selected[1]+1)*w-1,v+1,w+1),e.setStroke("black",1),e.sRect(u.x+a.memory.selected[0]*v-1,u.bottom-(a.memory.selected[1]+1)*w-1,v+1,w+1)),x!=a.memory.selected)if(null==a.memory.selected)a.memory.indexes=null;else for(j=m[0].getMin(),k=m[1].getMin(),h=a.memory.selected[0]+j,i=a.memory.selected[1]+k,a.memory.indexes=new NumberList,f=0;null!=m[0][f];f++)m[0][f]==h&&m[1][f]==i&&a.memory.indexes.push(f);return a.memory.selected?a.memory.indexes:void 0}},NumberTableDraw.drawStreamgraph=function(a,b,c,d,e,f,g,h,i,j,k){if(!(null==b||b.length<2||"NumberTable"!=b.type)){if(null==k&&(k=a.graphics),f=null==f?!0:f,e=null==e?1:e,null==a.memory||b!=a.memory.numberTable||c!=a.memory.normalized||d!=a.memory.sorted||e!=a.memory.intervalsFactor||f!=a.memory.bezier||a.width!=a.memory.width||a.height!=a.memory.height||j!=a.memory.logFactor){var l=j?b.applyFunction(function(a){return Math.log(j*a+1)}):b;a.memory={numberTable:b,normalized:c,sorted:d,intervalsFactor:e,bezier:f,flowIntervals:IntervalTableOperators.scaleIntervals(NumberTableFlowOperators.getFlowTableIntervals(l,c,d),e),fOpen:1,names:b.getNames(),mXF:k.mX,width:a.width,height:a.height,logFactor:j,image:null}}g&&a.memory.colorList!=g&&(a.memory.image=null),(a.memory.colorList!=g||null==a.memory.colorList)&&(a.memory.actualColorList=null==g?ColorListGenerators.createDefaultCategoricalColorList(b.length,.7):g,a.memory.colorList=g);var m=new Rectangle(0,0,a.width,null==h?a.height:a.height-14);if(m.graphics=k,null==a.memory.image){var n=document.createElement("canvas");n.width=a.width,n.height=a.height;var o=n.getContext("2d");o.clearRect(0,0,a.width,a.height);var p=k.context;k.context=o,IntervalTableDraw.drawIntervalsFlowTable(a.memory.flowIntervals,m,a.memory.actualColorList,f,.3),k.context=p,a.memory.image=new Image,a.memory.image.src=n.toDataURL()}var q,r;if(a.memory.image)if(a.memory.fOpen=.8*a.memory.fOpen+.2*(a.containsPoint(k.mP)?.8:1),a.memory.mXF=.7*a.memory.mXF+.3*k.mX,a.memory.mXF=Math.min(Math.max(a.memory.mXF,a.x),a.getRight()),a.memory.fOpen<.999){k.context.save(),k.context.translate(a.x,a.y);var s=a.memory.mXF-a.x;q=Math.floor(s*a.memory.fOpen),r=Math.ceil(a.width-(a.width-s)*a.memory.fOpen),k.drawImage(a.memory.image,0,0,s,m.height,0,0,q,m.height),k.drawImage(a.memory.image,s,0,a.width-s,m.height,r,0,(a.width-s)*a.memory.fOpen,m.height),NumberTableDraw._drawPartialFlow(m,a.memory.flowIntervals,a.memory.names,a.memory.actualColorList,s,q,r,.3,d,i?b:null),k.context.restore()}else k.drawImage(a.memory.image,a.x,a.y,a.width,a.height);h&&NumberTableDraw._drawHorizontalLabels(a,a.getBottom()-5,b,h,q,r)}},NumberTableDraw._drawHorizontalLabels=function(a,b,c,d,e,f,g){null==g&&(g=a.graphics);var h,i=a.width/(c[0].length-1),j=Math.min(Math.max(g.mX,a.x+1),a.getRight()-1),k=(j-a.x)/i,l=Math.round(k);e=null==e?a.x:e+a.x,f=null==f?a.x:f+a.x,d.forEach(function(c,m){g.setText("black",m==l&&f>e+4?14:10,null,"center","middle"),e>f-5?h=a.x+m*i:l==m?h=.5*(e+f)-(f-e)*(k-l):(h=a.x+m*i,j>h?h=a.x+m*i*a.memory.fOpen:h>j&&(h=a.x+m*i*a.memory.fOpen+(f-e))),g.fText(d[m],h,b)})},NumberTableDraw._drawPartialFlow=function(a,b,c,d,e,f,g,h,i,j,k){null==k&&(k=a.graphics);var l=g-f,m=null==j?g-f:.85*(g-f),n=b[0].length,o=a.width/(n-1),p=(e-a.x)/o;p=Math.max(Math.min(p,n-1),0);var q,r,s,t,u,v,w,x,y,z,A,B,C,D=Math.floor(p),E=Math.ceil(p),F=h*o,G=-1;for(q=0;null!=b[q];q++)k.setFill(d[q]),r=b[q][D],s=b[q][E],y=Math.floor(p)*o,z=Math.floor(p+1)*o,A=e,t=GeometryOperators.trueBezierCurveHeightHorizontalControlPoints(y,z,r.x,s.x,y+F,z-F,A),u=GeometryOperators.trueBezierCurveHeightHorizontalControlPoints(y,z,r.y,s.y,y+F,z-F,A)-t,t=t*a.height+a.y,u*=a.height,k.fRectM(f,t,l,u)&&(G=q),u>=5&&l>40&&(k.setText("white",u,null,null,"middle"),x=c[q],v=k.getTextW(x),w=v/m,w>1&&k.setText("white",u/w,null,null,"middle"),k.context.fillText(x,f,t+.5*u),j&&(v=k.getTextW(x),B=Math.min(u,u/w),C=Math.max(.6*B,8),k.setText("white",C,null,null,"middle"),k.fText(Math.round(j[q][D]),f+v+.03*l,t+.5*(u+.5*(B-C)))));return G},NumberTableDraw.drawCircularStreamgraph=function(a,b,c,d,e,f,g){if(!(null==b||b.length<3||b[0].length<2)){null==g&&(g=a.graphics),e=null==e?1:e;var h;if(null==a.memory||b!=a.memory.dataTable||c!=a.memory.normalized||d!=a.memory.sorted||e!=a.memory.intervalsFactor||a.width!=a.memory.width||a.height!=a.memory.height){var i=TableOperators.getNumberTableFromTable(b);if(i.length<2)return;i=i.getTransposed();var j=b.getNames().slice(1);null!=j&&""===j.join("")&&(j=null),a.memory={dataTable:b,numberTable:i,categories:b[0],names:j,normalized:c,sorted:d,intervalsFactor:e,flowIntervals:IntervalTableOperators.scaleIntervals(NumberTableFlowOperators.getFlowTableIntervals(i,c,d),e),fOpen:1,mXF:g.mX,width:a.width,height:a.height,radius:.46*Math.min(a.width,a.height)-(null==j?0:8),r0:.05*Math.min(a.width,a.height),angles:new NumberList,zoom:1,angle0:0,image:null};var k=TwoPi/i[0].length;i[0].forEach(function(b,c){a.memory.angles[c]=c*k})}(a.memory.colorList!=f||null==a.memory.colorList)&&(a.memory.actualColorList=null==f?ColorListGenerators.createDefaultCategoricalColorList(a.memory.numberTable.length,.4):f,a.memory.colorList=f);var l=a.containsPoint(g.mP);if(l&&(g.MOUSE_DOWN&&(a.memory.downX=g.mX,a.memory.downY=g.mY,a.memory.pressed=!0,a.memory.zoomPressed=a.memory.zoom,a.memory.anglePressed=a.memory.angle0),a.memory.zoom*=1-.4*g.WHEEL_CHANGE),g.MOUSE_UP&&(a.memory.pressed=!1),a.memory.pressed){var m=a.getCenter(),n=a.memory.downX-m.x,o=a.memory.downY-m.y,p=Math.sqrt(Math.pow(n,2)+Math.pow(o,2)),q=g.mX-m.x,r=g.mY-m.y,s=Math.sqrt(Math.pow(q,2)+Math.pow(r,2));a.memory.zoom=a.memory.zoomPressed*((s+5)/(p+5));var t=Math.atan2(o,n),u=Math.atan2(r,q);a.memory.angle0=a.memory.anglePressed+u-t}l&&(a.memory.image=null);var v=!1;if(v)g.drawImage(a.memory.image,a.x,a.y,a.width,a.height);else{if(g.context.save(),g.clipRectangle(a.x,a.y,a.width,a.height),h=IntervalTableDraw.drawCircularIntervalsFlowTable(a,a.memory.flowIntervals,a.getCenter(),a.memory.radius*a.memory.zoom,a.memory.r0,a.memory.actualColorList,a.memory.categories,!0,a.memory.angles,a.memory.angle0),a.memory.zoom=Math.max(Math.min(a.memory.zoom,2e3),.08),a.memory.names){var w,x=a.memory.radius*a.memory.zoom+8;g.setText("black",14,null,"center","middle"),a.memory.names.forEach(function(b,c){w=a.memory.angle0+a.memory.angles[c],g.fTextRotated(String(b),a.getCenter().x+x*Math.cos(w),a.getCenter().y+x*Math.sin(w),w+HalfPi)})}g.context.restore()}return h}},StringDraw.drawText=function(a,b,c,d,e,f){if(null!=a&&null!=b){null==f&&(f=a.graphics),e=e||10,c=c||12;var g=new Rectangle(a.x+e,a.y+e,a.width-2*e,a.height-2*e);g.bottom=g.getBottom();var h=Math.floor(1.2*c);f.setText("black",c,null,null,null,d);var i=null==a.memory||b!=a.memory.object||c!=a.memory.fontSize||d!=a.memory.fontStyle||e!=a.memory.margin||a.width!=a.memory.width||a.height!=a.memory.height;if(i){var j=null==b?"":"string"==typeof b?b:JSON.stringify(b,null," ");a.memory={textLines:DrawTexts.textWordWrapReturnLines(j,g.width,g.height,h,!0,f),object:b,fontSize:c,fontStyle:d,margin:e,width:a.width,height:a.height}}DrawTexts.fillTextRectangleWithTextLines(a.memory.textLines,g.x,g.y,g.height,h,null,f)}},ObjectDraw.count=function(a,b,c){null==c&&(c=a.graphics),null==a.memory&&(a.memory={n:1,object:b}),a.memory.object!=b&&(a.memory.object=b,a.memory.n++),c.MOUSE_DOWN&&a.containsPoint(c.mP)&&(a.memory.n=0),c.setText("black",12),c.fText(a.memory.n,a.x+10,a.y+10)},StringListVisOperators.simpleTagCloud=function(a,b,c,d,e,f){d=null==d?"Arial":d,e=null==e?1.2:e;for(var g,h,i,j,k,l,m,n,o,p,q,r=20,s=NumberListOperators.normalizedToMax(b),t=!0,u=0;t;){var v=r*e;for(i=0,j=0,n=0,o=0,p=new NumberList,q=new _Polygon,g=0;null!=a[g];g++){if(k=a[g],m=Math.floor(Math.sqrt(s[g])*r),p.push(m),f.context.font=String(m)+"px "+d,l=f.context.measureText(k).width,i+l>c.width){for(i=0,j+=n*e+1,n=0,h=o;g>h;h++)q[h].y=j;o=g}n=Math.max(n,m),q.push(new _Point(i,j)),i+=l+.2*m}for(j+=n*e+1,h=o;null!=a[h];h++)q[h].y=j;t=!1,j<.97*c.height&&(r=.5*r+.5*r*c.height/(j+v),t=!0),j>=.995*c.height&&(r=.5*r+.5*r*c.height/(j+v),t=!0),u++,u>10&&(t=!1)}var w=new Table;return w[0]=a,w[1]=q,w[2]=p,w},StringListVisOperators.tagCloudRectangles=function(a,b,c,d,e,f){if(null!=a&&null!=b&&null!=c){d=null==d?0:d,e=null==e?0:e,null==f&&(f=a.graphics);var g,h,i,j=NumberListOperators.normalizedToMax(c.sqrt()),k=0===d,l=new List,m=new NumberList,n=new List,o=6,q=0,r=0,s=0;switch(d){case 0:g=a.x,h=a.y;break;case 2:var t=5,u=0,v=1,w=new _Point;break;case 1:g=0,h=0,i=a.getCenter()}for(var x,y,z=a.width/a.height,A=0;null!=b[A];A++){switch(m[A]=k?Math.round(12*j[A])*o:12*j[A]*o,f.context.fillStyle="black",f.context.font=m[A]+"px "+f.getFontFamily(),f.context.textAlign="left",f.context.textBaseline="top",x=Math.ceil((2+f.context.measureText(b[A]).width)/o)*o,y=m[A],d){case 0:for(;StringListVisOperators._pointInRectangles(n,g,h,x,y,e);)g+=o,h-=o,h<a.y&&(h=p.x,g=a.x);break;case 1:if(0===A)g=i.x-.5*x,h=i.y-.5*y;else{for(q=.1*A,r=0;StringListVisOperators._pointInRectangles(n,g,h,x,y,e);)r+=1,q+=.005*r,g=i.x+z*r*Math.cos(q)-.5*x,h=i.y+r*Math.sin(q)-.5*y;s=Math.max(s,z*r+.5*x)}break;case 2:if(0===A)w=i.clone(),g=w.x-.5*x,h=w.y-.5*y;else{for(u=0,v=1,q=0,w=i.clone();StringListVisOperators._pointInRectangles(n,g,h,x,y,e);)u++,w.x+=z*t*Math.cos(q),w.y+=t*Math.sin(q),g=w.x-.5*x,h=w.y-.5*y,u>=v&&(q+=.5*Math.PI,v+=.5,u=0);s=Math.max(Math.abs(w.x-i.x)+.5*x,s)}}l[A]=new Rectangle(g,h,x,y),n.push(l[A]);
}if(1==d||2==d){var B;for(z=.5*a.width/s,A=0;null!=l[A];A++)B=l[A],B.x=i.x+(B.x-i.x)*z,B.y=i.y+(B.y-i.y)*z,B.width*=z,B.height*=z,m[A]*=z}var C=new Table;return C[0]=b,C[1]=l,C[2]=m,C}},StringListVisOperators._pointInRectangles=function(a,b,c,d,e,f){for(var g,h=0;null!=a[h];h++)if(g=a[h],b+d>g.x-f&&b<g.x+g.width+f&&c+e>g.y-f&&c<g.y+g.height+f)return!0;return!1},StringListDraw.simpleTagCloud=function(a,b,c,d,e,f){d=null==d?"Arial":d,e=null==e?1.2:e;for(var g,h,i,j,k,l,m,n,o,p,q,r=20,s=NumberListOperators.normalizedToMax(b),t=!0,u=0;t;){var v=r*e;for(i=0,j=0,n=0,o=0,p=new NumberList,q=new _Polygon,g=0;null!=a[g];g++){if(k=a[g],m=Math.floor(Math.sqrt(s[g])*r),p.push(m),f.context.font=String(m)+"px "+d,l=f.context.measureText(k).width,i+l>c.width){for(i=0,j+=n*e+1,n=0,h=o;g>h;h++)q[h].y=j;o=g}n=Math.max(n,m),q.push(new _Point(i,j)),i+=l+.2*m}for(j+=n*e+1,h=o;null!=a[h];h++)q[h].y=j;t=!1,j<.97*c.height&&(r=.5*r+.5*r*c.height/(j+v),t=!0),j>=.995*c.height&&(r=.5*r+.5*r*c.height/(j+v),t=!0),u++,u>10&&(t=!1)}var w=new Table;return w[0]=a,w[1]=q,w[2]=p,w},StringListDraw.tagCloudRectangles=function(a,b,c,d,e,f){d=null==d?0:d,e=null==e?0:e;var g,h,i,j=NumberListOperators.normalizedToMax(b.sqrt()),k=0===d,l=new List,m=new NumberList,n=new List,o=6,p=0,q=0,r=0;switch(d){case 0:g=c.x,h=c.y;break;case 2:var s=5,t=0,u=1,v=new _Point;break;case 1:g=0,h=0,i=c.getCenter()}for(var w,x,y=c.width/c.height,z=0;null!=a[z];z++){switch(m[z]=k?Math.round(12*j[z])*o:12*j[z]*o,DrawTexts.setContextTextProperties("black",m[z],f.fontName,null,null,"bold"),w=Math.ceil((2+f.context.measureText(a[z]).width)/o)*o,x=m[z],d){case 0:for(;StringListDraw._pointInRectangles(n,g,h,w,x,e);)g+=o,h-=o,h<c.y&&(h=c.y,g=c.x);break;case 1:if(0===z)g=i.x-.5*w,h=i.y-.5*x;else{for(p=.1*z,q=0;StringListDraw._pointInRectangles(n,g,h,w,x,e);)q+=1,p+=.005*q,g=i.x+y*q*Math.cos(p)-.5*w,h=i.y+q*Math.sin(p)-.5*x;r=Math.max(r,y*q+.5*w)}break;case 2:if(0===z)v=i.clone(),g=v.x-.5*w,h=v.y-.5*x;else{for(t=0,u=1,p=0,v=i.clone();StringListDraw._pointInRectangles(n,g,h,w,x,e);)t++,v.x+=y*s*Math.cos(p),v.y+=s*Math.sin(p),g=v.x-.5*w,h=v.y-.5*x,t>=u&&(p+=.5*Math.PI,u+=.5,t=0);r=Math.max(Math.abs(v.x-i.x)+.5*w,r)}}l[z]=new Rectangle(g,h,w,x),n.push(l[z])}if(1==d||2==d){var A;for(y=.5*c.width/r,z=0;null!=l[z];z++)A=l[z],A.x=i.x+(A.x-i.x)*y,A.y=i.y+(A.y-i.y)*y,A.width*=y,A.height*=y,m[z]*=y}var B=new Table;return B[0]=a,B[1]=l,B[2]=m,B},StringListDraw._pointInRectangles=function(a,b,c,d,e,f){for(var g,h=0;null!=a[h];h++)if(g=a[h],b+d>g.x-f&&b<g.x+g.width+f&&c+e>g.y-f&&c<g.y+g.height+f)return!0;return!1},TreeDraw.drawRectanglesTree=function(a,b,c,d){c=null==c?ColorListGenerators.createCategoricalColors(1,b.nLevels):c,d=d||1;var e=a.width/b.nLevels;TreeDraw._drawRectanglesTreeChildren(b.nodeList[0],new Rectangle(a.x,a.y,e,a.height),c,d)},TreeDraw._drawRectanglesTreeChildren=function(a,b,c,d,e){e.context.fillStyle=c[a.level],e.context.fillRect(b.x+d,b.y+d,b.width-2*d,b.height-2*d);var f=a.toNodeList;if(f.length>0){var g,h,i=b.height/(a.descentWeight-1),j=b.y;for(g=0;null!=f[g];g++)h=i*f[g].descentWeight,TreeDraw._drawRectanglesTreeChildren(f[g],new Rectangle(b.x+b.width,j,b.width,h),c,d),j+=h}},TreeDraw.drawTreemap=function(a,b,c,d,e,f,g){if(null!=a&&null!=b){null==g&&(g=a.graphics);var h=null==a.memory||a.memory.tree!=b||a.memory.width!=a.width||a.memory.height!=a.height||a.memory.weights!=d;null!=f&&(f=b.nodeList.getNodeById(f.id));var i,j,k=null!=f&&(null==a.memory||f!=a.memory.nodeSelected),l=b.nodeList.length;if(h){var m=null==a.memory||a.memory.tree!=b;null==a.memory?a.memory={width:a.width,height:a.height,weights:d,nFLastChange:g.nF,tree:b,nodeSelected:b.nodeList[0]}:(a.memory.nFLastChange=g.nF,a.memory.weights=d,a.memory.width=a.width,a.memory.height=a.height,m&&(a.memory.tree=b),k&&(a.memory.nodeSelected=f));var n=!m&&a.memory.leaves?a.memory.leaves:b.getLeaves();if(a.memory.leaves=n,null==d)for(j=0;l>j;j++)b.nodeList[j]._treeMapWeight=b.nodeList[j].descentWeight;else{var o=n.length;for(j=0;o>j;j++)n[j]._treeMapWeight=d[j];var p=function(a){var b,c;if(0===a.toNodeList.length)return a._treeMapWeight;for(a._treeMapWeight=0,c=a.toNodeList.length,b=0;c>b;b++)a._treeMapWeight+=p(a.toNodeList[b]);return a._treeMapWeight};p(b.nodeList[0])}for(b.nodeList[0]._outRectangle=new Rectangle(0,0,a.width,a.height),b.nodeList[0]._inRectangle=TreeDraw._inRectFromOutRect(b.nodeList[0]._outRectangle),TreeDraw._generateRectangles(b.nodeList[0]),a.memory.focusFrame=TreeDraw._expandRect(a.memory.nodeSelected._outRectangle),m&&(a.memory.kx=a.width/a.memory.focusFrame.width,a.memory.mx=-a.memory.kx*a.memory.focusFrame.x,a.memory.ky=a.height/a.memory.focusFrame.height,a.memory.my=-a.memory.ky*a.memory.focusFrame.y),g.setText("black",12),j=0;l>j;j++)i=b.nodeList[j],i._textWidth=g.getTextW(i.name)}if(a.memory.colorList!=c||null==a.memory.colorList){if(a.memory.nFLastChange=g.nF,a.memory.image=null,a.memory.actualColorList=null==c?ColorListGenerators.createCategoricalColors(0,b.nLevels,ColorScales.grayToOrange,.1):c,a.memory.nodesColorList=new ColorList,null==e&&(a.memory.textsColorList=new ColorList),a.memory.actualColorList.length<=b.nLevels)for(j=0;l>j;j++)i=b.nodeList[j],a.memory.nodesColorList[j]=i._color=a.memory.actualColorList[i.level%a.memory.actualColorList.length];else if(a.memory.actualColorList.length==a.memory.leaves.length){a.memory.leaves.forEach(function(b,c){b._color=a.memory.actualColorList[c],b._rgb=ColorOperators.colorStringToRGB(b._color)});var q=function(a){var b;if(0!==a.toNodeList.length){for(a._rgb=[0,0,0],b=0;null!=a.toNodeList[b];b++)q(a.toNodeList[b]),a._rgb[0]+=a.toNodeList[b]._rgb[0],a._rgb[1]+=a.toNodeList[b]._rgb[1],a._rgb[2]+=a.toNodeList[b]._rgb[2];a._rgb[0]=Math.floor(a._rgb[0]/a.toNodeList.length),a._rgb[1]=Math.floor(a._rgb[1]/a.toNodeList.length),a._rgb[2]=Math.floor(a._rgb[2]/a.toNodeList.length)}};for(q(b.nodeList[0]),j=0;l>j;j++)i=b.nodeList[j],i._rgb&&null==i._rgbF&&(i._rgbF=[i._rgb[0],i._rgb[1],i._rgb[2]]),a.memory.nodesColorList[j]="rgb("+i._rgb[0]+","+i._rgb[1]+","+i._rgb[2]+")"}else for(j=0;l>j;j++)i=b.nodeList[j],i._color=a.memory.nodesColorList[j]=a.memory.actualColorList[j%a.memory.actualColorList.length];if(null==e){var r;for(j=0;l>j;j++)i=b.nodeList[j],r=i._color?ColorOperators.colorStringToRGB(i._color):[0,0,0],a.memory.textsColorList[j]=r[0]+r[1]+r[2]>360?"black":"white"}a.memory.colorList=c}null==e&&(e="black");var s=a.width/a.memory.focusFrame.width,t=-s*a.memory.focusFrame.x,u=a.height/a.memory.focusFrame.height,v=-u*a.memory.focusFrame.y,w=s>a.memory.kx?.05:.1,x=1-w;a.memory.kx=x*a.memory.kx+w*s,a.memory.mx=x*a.memory.mx+w*t,a.memory.ky=x*a.memory.ky+w*u,a.memory.my=x*a.memory.my+w*v;var y,z,A,B,C,D,E,F,G=a.memory.kx,H=a.memory.mx,I=a.memory.ky,J=a.memory.my,K=function(a){return G*a+H},L=function(a){return I*a+J},M=null,N=a.containsPoint(g.mP),O=!1,P=!1;if(P?g.drawImage(a.memory.image,a.x,a.y,a.width,a.height):(O||(g.context.save(),g.clipRectangle(a.x,a.y,a.width,a.height)),g.setStroke("black",.2),b.nodeList.forEach(function(b,c){if(E=new Rectangle(K(b._outRectangle.x),L(b._outRectangle.y),b._outRectangle.width*G,b._outRectangle.height*I),E.width>5&&E.height>4&&E.x<a.width&&E.getRight()>0&&E.y<a.height&&E.getBottom()>0&&(y=Math.round(a.x+E.x)+.5,z=Math.round(a.y+E.y)+.5,b._rgbF?(b._rgbF[0]=.95*b._rgbF[0]+.05*b._rgb[0],b._rgbF[1]=.95*b._rgbF[1]+.05*b._rgb[1],b._rgbF[2]=.95*b._rgbF[2]+.05*b._rgb[2],g.setFill("rgb("+Math.floor(b._rgbF[0])+","+Math.floor(b._rgbF[1])+","+Math.floor(b._rgbF[2])+")")):g.setFill(a.memory.nodesColorList[c]),g.fsRectM(y,z,Math.floor(E.width),Math.floor(E.height))&&(M=b,F=c),E.width>20&&(A=E.width*TreeDraw.PROP_RECT_MARGIN*.8,B=E.height*TreeDraw.PROP_RECT_MARGIN*.15,C=E.height*TreeDraw.PROP_RECT_LABEL-2,C>=5))){var d=(E.width-2*A)/(b._textWidth*C/12);D=1>d,D?g.setText(e?e:a.memory.textsColorList[c],C*d):g.setText(e?e:a.memory.textsColorList[c],C),g.fText(b.name,y+A,z+B)}})),N){if(M&&(g.setCursor("pointer"),E=new Rectangle(K(M._outRectangle.x),L(M._outRectangle.y),M._outRectangle.width*G,M._outRectangle.height*I),y=Math.round(a.x+E.x)+.5,z=Math.round(a.y+E.y)+.5,g.setStroke(e?e:a.memory.textsColorList[F],2),g.sRect(y,z,Math.floor(E.width),Math.floor(E.height)),g.MOUSE_UP_FAST&&(a.memory.focusFrame=TreeDraw._expandRect(M._outRectangle),a.memory.nodeSelected=M,a.memory.image=null)),g.MOUSE_DOWN&&(a.memory.prevMX=g.mX,a.memory.prevMY=g.mY),g.MOUSE_PRESSED){var Q=5*a.memory.focusFrame.width/a.width;a.memory.focusFrame.x-=(g.mX-a.memory.prevMX)*Q,a.memory.focusFrame.y-=(g.mY-a.memory.prevMY)*Q,a.memory.prevMX=g.mX,a.memory.prevMY=g.mY}if(0!==g.WHEEL_CHANGE){var R=a.memory.focusFrame.getCenter(),S=1-.1*g.WHEEL_CHANGE;a.memory.focusFrame.x=R.x-.5*a.memory.focusFrame.width*S,a.memory.focusFrame.y=R.y-.5*a.memory.focusFrame.height*S,a.memory.focusFrame.width*=S,a.memory.focusFrame.height*=S}(g.MOUSE_PRESSED||0!==g.WHEEL_CHANGE)&&(a.memory.image=null)}return k&&(a.memory.focusFrame=TreeDraw._expandRect(f._outRectangle),a.memory.nodeSelected=f,a.memory.image=null),O||P||g.context.restore(),a.memory.nodeSelected}},TreeDraw._generateRectangles=function(a){var b,c,d=a.toNodeList.length,e=new NumberList;for(b=0;d>b;b++)c=a.toNodeList[b],e.push(c._treeMapWeight);var f=RectangleOperators.squarify(a._inRectangle,e,!1,!1);for(b=0;d>b;b++)c=a.toNodeList[b],c._outRectangle=TreeDraw._reduceRect(f[b]),c._inRectangle=TreeDraw._inRectFromOutRect(c._outRectangle),TreeDraw._generateRectangles(c)},TreeDraw._reduceRect=function(a){return new Rectangle(a.x+a.width*TreeDraw.PROP_RECT_REDUCTION_MARGIN,a.y+a.height*TreeDraw.PROP_RECT_REDUCTION_MARGIN,a.width*(1-2*TreeDraw.PROP_RECT_REDUCTION_MARGIN),a.height*(1-2*TreeDraw.PROP_RECT_REDUCTION_MARGIN))},TreeDraw._expandRect=function(a){return new Rectangle(a.x-a.width*TreeDraw.PROP_RECT_EXPANTION_MARGIN,a.y-a.height*TreeDraw.PROP_RECT_EXPANTION_MARGIN,a.width*(1+2*TreeDraw.PROP_RECT_EXPANTION_MARGIN),a.height*(1+2*TreeDraw.PROP_RECT_EXPANTION_MARGIN))},TreeDraw._inRectFromOutRect=function(a){return new Rectangle(a.x+a.width*TreeDraw.PROP_RECT_MARGIN,a.y+a.height*TreeDraw.PROP_RECT_LABEL,a.width*(1-2*TreeDraw.PROP_RECT_MARGIN),a.height*(1-TreeDraw.PROP_RECT_MARGIN-TreeDraw.PROP_RECT_LABEL))},TreeDraw.PROP_RECT_MARGIN=.03,TreeDraw.PROP_RECT_LABEL=.2,TreeDraw.PROP_RECT_REDUCTION_MARGIN=.01,TreeDraw.PROP_RECT_EXPANTION_MARGIN=.05,TreeDraw.drawDecisionTree=function(a,b,c,d){if(null!=a&&null!=b){null==d&&(d=a.graphics);var e=null==a.memory||a.memory.tree!=b||a.memory.width!=a.width||a.memory.height!=a.height;c=c||"black";var f=.06*a.height,g=b.nLevels*(a.height-f)/(b.nLevels+1),h=g/b.nLevels,i=!1;if(e){var j=null!=a.memory&&null!=a.memory.tree&&a.memory.tree!=b;a.memory={tree:b,width:a.width,height:a.height,nodeSelected:b.nodeList[0],nFLastChange:d.nF,leaves:null,image:null},(j||null==a.memory.leaves)&&(a.memory.leaves=b.getLeaves().getSortedByProperty("valueFollowingProbability",!1)),b.nodeList[0]._outRectangle=new Rectangle(0,0,a.width,g),b.nodeList[0]._inRectangle=TreeDraw._inRectFromOutRectDecision(b.nodeList[0]._outRectangle,h),TreeDraw._generateRectanglesDecision(b.nodeList[0],h),a.memory.focusFrame=new Rectangle(0,0,a.width,a.height),a.memory.kx=a.width/a.memory.focusFrame.width,a.memory.mx=-a.memory.kx*a.memory.focusFrame.x,a.memory.ky=a.height/a.memory.focusFrame.height,a.memory.my=-a.memory.ky*a.memory.focusFrame.y,d.setText(c,12),b.nodeList.forEach(function(a){a.label=0===a.toNodeList.length?Math.round(100*a.valueFollowingProbability)/100:a.bestFeatureName,a._textWidth=d.getTextW(a.label)})}a.memory.followingWeights&&b.nodeList.forEach(function(a){a._treeMapWeight=a.descentWeight});var k=a.width/a.memory.focusFrame.width,l=-k*a.memory.focusFrame.x,m=k>a.memory.kx?.05:.1,n=1-m;a.memory.kx=n*a.memory.kx+m*k,a.memory.mx=n*a.memory.mx+m*l;var o,p,q,r,s,t,u,v,w,x=a.memory.kx,y=a.memory.mx,z=function(a){return x*a+y},A=null,B=a.containsPoint(d.mP),C=!1,D=!1;if(D)d.drawImage(a.memory.image,a.x,a.y,a.width,a.height);else{C||(d.context.save(),d.clipRectangle(a.x,a.y,a.width,a.height)),w=a.y+g+f,d.setStroke("black",.2),b.nodeList.forEach(function(b,e){if(u=new Rectangle(z(b._outRectangle.x),b._outRectangle.y,b._outRectangle.width*x,b._outRectangle.height),u.x<a.width&&u.getRight()>0&&u.y<a.height&&u.getBottom()>0){o=Math.round(a.x+u.x)+.5,p=Math.round(a.y+u.y)+.5,b.pattern?(d.context.fillStyle=b.pattern,d.context.fillRect(o,p,Math.floor(u.width),Math.floor(u.height)),d.sRectM(o,p,Math.floor(u.width),Math.floor(u.height))&&(A=b,v=e)):(d.setFill(b._color),d.fsRectM(o,p,Math.floor(u.width),Math.floor(u.height))&&(A=b,v=e));var f=Math.min(u.getRight(),a.width)-Math.max(u.x,0);if(f>16){q=u.width*TreeDraw.PROP_RECT_MARGIN*.8,r=u.height*TreeDraw.PROP_RECT_MARGIN*.15;var g=c?c:a.memory.textsColorList[e];s=18,d.setText(g,s),t=!0,t&&d.clipRectangle(o,p-17,u.width,u.height),d.fText(b.label,Math.max(o,a.x)+8,p+1),b.value&&(s=14,d.setText(g,s),d.fText(b.value,Math.max(o,a.x)+8,p-17)),f-b._textWidth>60&&(s=12,d.setText(g,s,null,"right"),d.fText("s="+b.weight,Math.min(a.x+u.getRight(),a.getRight())-2,p+1),d.fText("e="+Math.round(100*b.entropy)/100,Math.min(a.x+u.getRight(),a.getRight())-2,p+12),b.toNodeList.length>0&&d.fText("P="+Math.round(100*b.valueFollowingProbability)/100,Math.min(a.x+u.getRight(),a.getRight())-2,p+23),d.fText("l="+Math.round(100*b.lift)/100,Math.min(a.x+u.getRight(),a.getRight())-2,p+23+(b.toNodeList.length>0?11:0))),t&&d.context.restore()}}});var E,F=a.x,G=a.width/b.nodeList[0].weight,H=!0,I=!0,J=!0,K=!0,L=!0;a.memory.leaves.forEach(function(a){d.setStroke("black",.2),E=G*a.weight,a.pattern?(d.context.fillStyle=a.pattern,d.context.fillRect(F,w,E,h),d.sRectM(F,w,E,h)&&(A=a,v=b.nodeList.indexOf(a))):(d.setFill(a._color),d.fsRectM(F,w,E,h)&&(A=a,v=b.nodeList.indexOf(a))),a._xLeaf=F,a._wLeaf=E,d.setStroke("black",1),H&&a.valueFollowingProbability<b.nodeList[0].valueFollowingProbability&&(H=!1,d.setFill("black"),d.fLines(F,w-14,F+4,w-8,F,w-2,F-4,w-8)),I&&a.valueFollowingProbability<=2*b.nodeList[0].valueFollowingProbability&&(I=!1,d.line(F,w-14,F,w-2)),J&&a.valueFollowingProbability<.5*b.nodeList[0].valueFollowingProbability&&(J=!1,d.line(F,w-14,F,w-2)),K&&a.valueFollowingProbability<=1.5*b.nodeList[0].valueFollowingProbability&&(K=!1,d.line(F,w-8,F,w-2)),L&&a.valueFollowingProbability<.66667*b.nodeList[0].valueFollowingProbability&&(L=!1,d.line(F,w-8,F,w-2)),F+=E})}if(B){if(A&&(d.setCursor("pointer"),u=new Rectangle(z(A._outRectangle.x),A._outRectangle.y,A._outRectangle.width*x,A._outRectangle.height),o=Math.round(a.x+u.x)+.5,p=Math.round(a.y+u.y)+.5,d.setStroke(c?c:a.memory.textsColorList[v],2),A._wLeaf&&(d.setFill("rgba(0,0,0,0.5)"),d.context.beginPath(),d.context.moveTo(o,w-f),d.context.bezierCurveTo(o,w-.65*f,A._xLeaf,w-.35*f,A._xLeaf,w),d.context.lineTo(A._xLeaf+A._wLeaf,w),d.context.bezierCurveTo(A._xLeaf+A._wLeaf,w-.35*f,o+u.width,w-.65*f,o+u.width,w-f),d.context.fill(),d.sRect(A._xLeaf,w,A._wLeaf,h)),d.sRect(o,p,Math.floor(u.width),Math.floor(u.height)),d.MOUSE_UP_FAST&&(a.memory.focusFrame=new Rectangle(A._outRectangle.x-.025*A._outRectangle.width,0,1.05*A._outRectangle.width,a.height),a.memory.focusFrame.x<0&&(a.memory.focusFrame.width+=a.memory.focusFrame.x,a.memory.focusFrame.x=0),a.memory.focusFrame.getRight()>a.width&&(a.memory.focusFrame.width-=a.memory.focusFrame.getRight()-a.width,a.memory.focusFrame.x=a.width-a.memory.focusFrame.width),a.memory.nodeSelected=A,i=!0,a.memory.image=null)),d.MOUSE_DOWN&&(a.memory.prevMX=d.mX),d.MOUSE_PRESSED){var M=5*a.memory.focusFrame.width/a.width;a.memory.focusFrame.x-=(d.mX-a.memory.prevMX)*M,a.memory.prevMX=d.mX}if(0!==d.WHEEL_CHANGE){var N=a.memory.focusFrame.getCenter(),O=1+.1*d.WHEEL_CHANGE;a.memory.focusFrame.x=N.x-.5*a.memory.focusFrame.width*O,a.memory.focusFrame.width*=O}(d.MOUSE_PRESSED||0!==d.WHEEL_CHANGE)&&(a.memory.image=null)}return C||D||d.context.restore(),a.memory.overNode!=A&&(a.memory.overNode=A,i=!0),(i||null==a.memory.result)&&(a.memory.result=[{value:a.memory.nodeSelected,type:"Node"},{value:a.memory.overNode,type:"Node"}]),a.memory.result}},TreeDraw._generateRectanglesDecision=function(a,b){var c=new NumberList;a.toNodeList.forEach(function(a){c.push(a.weight)});var d=TreeDraw._horizontalRectanglesDecision(a._inRectangle,c);a.toNodeList.forEach(function(a,c){a._outRectangle=d[c],a._inRectangle=TreeDraw._inRectFromOutRectDecision(a._outRectangle,b),TreeDraw._generateRectanglesDecision(a,b)})},TreeDraw._inRectFromOutRectDecision=function(a,b){return new Rectangle(a.x,a.y+b,a.width,a.height-b)},TreeDraw._horizontalRectanglesDecision=function(a,b){var c,d=new List,e=a.x,f=NumberListOperators.normalizedToSum(b);return f.forEach(function(b){c=b*a.width,d.push(new Rectangle(e,a.y,c,a.height)),e+=c}),d},NetworkDraw._drawNode=function(a,b,c,d,e){var f=!1;return a.image?(e.clipCircle(b,c,d),e.drawImage(a.image,b-d,c-1.3*d,2*d,3*d),e.restore(),f=Math.pow(b-e.mX,2)+Math.pow(c-e.mY,2)<=d*d):(e.setFill(null==a.color?"rgb(50,50,50)":a.color),f=e.fCircleM(b,c,d)),f&&e.setCursor("pointer"),f},NetworkDraw.drawRadialNetwork=function(a,b,c){var d,e,f,g,h=1.1*Math.min(a.width,a.height)/b.nodeList.length,i=.5*a.width-h,j=.5*a.height-h,k=a.x+.5*a.width,l=a.y+.5*a.height,m=TwoPi/b.nodeList.length;return c.setFill("black"),b.nodeList.forEach(function(a,b){a._drawRadialNetwork_x=k+i*Math.cos(b*m),a._drawRadialNetwork_y=l+j*Math.sin(b*m)}),b.relationList.forEach(function(a){c.setStroke("black",.25*a.weight),d=.5*(a.node0._drawRadialNetwork_x+a.node1._drawRadialNetwork_x),e=.5*(a.node0._drawRadialNetwork_y+a.node1._drawRadialNetwork_y),f=Math.sqrt(Math.pow(a.node0._drawRadialNetwork_x-a.node1._drawRadialNetwork_x,2),Math.pow(a.node0._drawRadialNetwork_y-a.node1._drawRadialNetwork_y,2))+1,d=(1-.5*(f/i))*d+.5*(f/i)*k,e=(1-.5*(f/j))*e+.5*(f/j)*l,c.bezier(a.node0._drawRadialNetwork_x,a.node0._drawRadialNetwork_y,d,e,d,e,a.node1._drawRadialNetwork_x,a.node1._drawRadialNetwork_y)}),b.nodeList.forEach(function(a){NetworkDraw._drawNode(a,a._drawRadialNetwork_x,a._drawRadialNetwork_y,h)&&(g=a)}),g},NetworkDraw.drawNetwork2D=function(a,b,c,d,e,f,g,h){if(null!=b&&null!=c&&"Polygon"==c.type){d=d||!1,e=e||!1,f=f||!1,g=g||0;var i,j,k,l,m,n=1.1*Math.min(a.width,a.height)/b.nodeList.length,o=a.memory,p=null==o||!o.frame.isEqual(a);if(null==o||o.network!=b||o.nNodes!=b.nodeList.length||o.polygon!=c||p||o.respectProportions!=d||o.margin!=g||o.logScale!=e||o.drawGrid!=f){null==o&&(a.memory={},o=a.memory),o.frame=a.clone(),o.network=b;var q=null!=o.polygon&&o.polygon.length!=c.length;o.polygon=c,o.respectProportions=d,o.logScale=e,o.drawGrid=f,o.margin=g,o.nNodes=b.nodeList.length,a.bottom=a.getBottom(),a.right=a.getRight(),o.frameMargin=new Rectangle(a.x+g,a.y+g,a.width-2*g,a.height-2*g),m=o.frameMargin,o.frameMargin.right=o.frameMargin.getRight(),o.frameMargin.bottom=o.frameMargin.getBottom(),o.frameP=c.getFrame(),l=o.frameP,l.right=l.getRight(),l.bottom=l.getBottom(),d&&(j=k=Math.min(j,k));var r;o.actualLogScale=e&&l.x>=0&&l.y>=0,o.actualLogScale?(j=m.width/Math.log((l.right+1)/(l.x+1)),k=m.height/Math.log((l.bottom+1)/(l.y+1)),r=function(a){return new _Point((Math.log(a.x+1)-Math.log(l.x+1))*j+m.x,m.bottom-(Math.log(a.y+1)-Math.log(l.y+1))*k)}):(j=m.width/l.width,k=m.height/l.height,r=function(a){return new _Point((a.x-l.x)*j+m.x,m.bottom-(a.y-l.y)*k)}),o.projectedPolygon=new _Polygon,c.forEach(function(a,b){o.projectedPolygon[b]=r(a)}),l.x<=0&&l.getRight()>=0&&(o.yAxis=-l.x*j+m.x),l.y<=0&&l.getBottom()>=0&&(o.xAxis=m.bottom- -l.y*k),(null==a.memory.projectPolygonConvergent||p||q)&&(a.memory.projectPolygonConvergent=o.projectedPolygon.clone())}else l=o.frameP,m=o.frameMargin;if(h.setStroke("rgb(50,50,50)",2),o.xAxis&&h.line(m.x,o.xAxis,o.frameMargin.right,o.xAxis),o.yAxis&&h.line(o.yAxis,o.frameMargin.y,o.yAxis,o.frameMargin.bottom),a.containsPoint(h.mP)&&(h.setStroke("rgb(50,50,50)",.5),h.line(a.x+2,h.mY+.5,a.right-4,h.mY+.5),h.line(h.mX+.5,a.y+2,h.mX+.5,a.bottom-4)),o.projectPolygonConvergent.approach(o.projectedPolygon,.1),b.nodeList.forEach(function(a,b){a.x=o.projectPolygonConvergent[b].x,a.y=o.projectPolygonConvergent[b].y}),b.relationList.forEach(function(a){h.setStroke("black",.25*a.weight),h.line(a.node0.x,a.node0.y,a.node1.x,a.node1.y)}),b.nodeList.forEach(function(a){NetworkDraw._drawNode(a,a.x,a.y,n)&&(i=a)}),a.containsPoint(h.mP))if(null==i)o.actualLogScale?NetworkDraw._drawNodeValues(Math.floor(10*(Math.pow(Math.E,Math.log((l.right+1)/(l.x+1))*(h.mX-m.x)/m.width)-1))/10,Math.floor(10*(Math.pow(Math.E,Math.log((l.bottom+1)/(l.y+1))*(m.bottom-h.mY)/m.height)-1))/10):NetworkDraw._drawNodeValues(Math.floor(10*(l.x+l.width*(h.mX-o.frameMargin.x)/o.frameMargin.width))/10,Math.floor(10*(l.y+l.height*(o.frameMargin.bottom-h.mY)/o.frameMargin.height))/10);else{var s=b.nodeList.indexOf(i);NetworkDraw._drawNodeValues(c[s].x,c[s].y,i.name)}return i}},NetworkDraw._drawNodeValues=function(a,b,c,d){var e=(null==c?"":c+": ")+a+", "+b;d.setFill("rgba(50,50,50,0.8)"),d.fRect(d.mX-2,d.mY-2,-d.getTextW(e)-4,-14),d.setText("white",12,null,"right","bottom"),d.fText(e,d.mX-4,d.mY-2)},NetworkDraw.drawNetworkMatrix=function(a,b,c,d,e,f,g,h,i){d=null==d?ColorOperators.grayScale:d,e=null==e?2:e,f=null==f?!1:f;var j,k,l,m,n,o,p=b.nodeList,q=b.relationList,r=null!=g,s=a.width/(p.length+1),t=a.height/(p.length+1),u=s-e,v=t-e,w=s,x=t,y=[],z=[],A=[],B=[];h=h&&a.pointIsInside(i.mousePoint);var C;for(h&&(C=new _Point(-1,-1)),r&&(s=a.width-s,t=a.height-t),j=0;null!=p[j];j++)i.context.fillStyle=c[j],r?(n=s*g[j],o=t*g[j],i.context.fillRect(a.x+w,a.y,n-e,v),i.context.fillRect(a.x,a.y+x,u,o-e),h&&(i.mX>a.x+w&&i.mX<a.x+w+n&&(C.x=j),i.mY>a.y+x&&i.mY<a.y+x+o&&(C.y=j)),y[p[j].id]=w,z[p[j].id]=x,A[p[j].id]=n,B[p[j].id]=o,w+=n,x+=o):(i.context.fillRect(a.x+(j+1)*s,a.y,u,v),i.context.fillRect(a.x,a.y+(j+1)*t,u,v));for(j=0;null!=q[j];j++)k=q[j],i.context.fillStyle=d(k.weight),r?(i.context.fillRect(a.x+y[k.node0.id],a.y+z[k.node1.id],A[k.node0.id]-e,B[k.node1.id]-e),f||i.context.fillRect(a.x+z[k.node1.id],a.y+y[k.node0.id],B[k.node1.id]-e,A[k.node0.id]-e)):(l=p.indexOf(k.node0)+1,m=p.indexOf(k.node1)+1,i.context.fillRect(a.x+l*s,a.y+m*t,u,v),f||l==m||i.context.fillRect(a.x+m*s,a.y+l*t,u,v));return C},exports.DataModel=DataModel,exports.List=List,exports.Table=Table,exports.Axis=Axis,exports.Axis2D=Axis2D,exports.Interval=Interval,exports.Matrix=Matrix,exports.NumberList=NumberList,exports.NumberTable=NumberTable,exports.DateAxis=DateAxis,exports.DateInterval=DateInterval,exports.DateList=DateList,exports.Country=Country,exports.CountryList=CountryList,exports.Point=_Point,exports.Point3D=Point3D,exports.Polygon=_Polygon,exports.Polygon3D=Polygon3D,exports.Polygon3DList=Polygon3DList,exports.PolygonList=PolygonList,exports.Rectangle=Rectangle,exports.RectangleList=RectangleList,exports.ColorList=ColorList,exports.ColorScale=ColorScale,exports.Space2D=Space2D,exports.StringList=StringList,exports.Node=Node,exports.Relation=Relation,exports.NodeList=NodeList,exports.RelationList=RelationList,exports.Network=Network,exports.Tree=Tree,exports.DateListOperators=DateListOperators,exports.DateListConversions=DateListConversions,exports.DateOperators=DateOperators,exports.CountryListOperators=CountryListOperators,exports.CountryOperators=CountryOperators,exports.GeoOperators=GeoOperators,exports.GeometryConversions=GeometryConversions,exports.GeometryOperators=GeometryOperators,exports.PointOperators=PointOperators,exports.PolygonGenerators=PolygonGenerators,exports.PolygonOperators=PolygonOperators,exports.PolygonListEncodings=PolygonListEncodings,exports.PolygonListOperators=PolygonListOperators,exports.RectangleOperators=RectangleOperators,exports.ColorGenerators=ColorGenerators,exports.ColorListGenerators=ColorListGenerators,exports.ColorListOperators=ColorListOperators,exports.ColorOperators=ColorOperators,exports.ColorScales=ColorScales,exports.ColorScaleGenerators=ColorScaleGenerators,exports.ListGenerators=ListGenerators,exports.ListOperators=ListOperators,exports.ListConversions=ListConversions,exports.TableConversions=TableConversions,exports.TableEncodings=TableEncodings,exports.TableGenerators=TableGenerators,exports.TableOperators=TableOperators,exports.IntervalListOperators=IntervalListOperators,exports.NumberListConversions=NumberListConversions,exports.IntervalTableOperators=IntervalTableOperators,exports.MatrixGenerators=MatrixGenerators,exports.NumberListGenerators=NumberListGenerators,exports.NumberListOperators=NumberListOperators,exports.NumberOperators=NumberOperators,exports.NumberTableConversions=NumberTableConversions,exports.NumberTableFlowOperators=NumberTableFlowOperators,exports.NumberTableOperators=NumberTableOperators,exports.ObjectOperators=ObjectOperators,exports.ObjectConversions=ObjectConversions,exports.StringConversions=StringConversions,exports.StringListOperators=StringListOperators,exports.StringListConversions=StringListConversions,exports.StringOperators=StringOperators,exports.NetworkConversions=NetworkConversions,exports.NetworkEncodings=NetworkEncodings,exports.NetworkGenerators=NetworkGenerators,exports.NetworkOperators=NetworkOperators,exports.TreeConversions=TreeConversions,exports.TreeEncodings=TreeEncodings,exports.Draw=Draw,exports.DrawSimpleVis=DrawSimpleVis,exports.DrawTexts=DrawTexts,exports.DrawTextsAdvanced=DrawTextsAdvanced,exports.Graphics=Graphics,exports.DragDetection=DragDetection,exports.InputTextFieldHTML=InputTextFieldHTML,exports.TextBox=TextBox,exports.TextFieldHTML=TextFieldHTML,exports.Loader=Loader,exports.LoadEvent=LoadEvent,exports.MultiLoader=MultiLoader,exports.ConsoleTools=ConsoleTools,exports.FastHtml=FastHtml,exports.JSONUtils=JSONUtils,exports.MD5=MD5,exports.StringUtils=StringUtils,exports.Navigator=Navigator,exports.typeOf=_typeOf,exports.instantiate=instantiate,exports.getShortNameFromDataModelType=getShortNameFromDataModelType,exports.getColorFromDataModelType=getColorFromDataModelType,exports.getLightColorFromDataModelType=getLightColorFromDataModelType,exports.getTextFromObject=getTextFromObject,exports.instantiateWithSameType=instantiateWithSameType,exports.isArray=isArray,exports.evalJavaScriptFunction=evalJavaScriptFunction,exports.argumentsToArray=argumentsToArray,exports.Forces=Forces,exports.Engine3D=Engine3D,exports.CountryListDraw=CountryListDraw,exports.CircleDraw=CircleDraw,exports.ColorsDraw=ColorsDraw,exports.ListDraw=ListDraw,exports.IntervalTableDraw=IntervalTableDraw,exports.NumberTableDraw=NumberTableDraw,exports.NumberListDraw=NumberListDraw,exports.ObjectDraw=ObjectDraw,exports.StringDraw=StringDraw,exports.StringListDraw=StringListDraw,exports.StringListVisOperators=StringListVisOperators,exports.NetworkDraw=NetworkDraw,exports.TreeDraw=TreeDraw,exports.setStructureLocalStorage=setStructureLocalStorage,exports.getStructureLocalStorageFromSeed=getStructureLocalStorageFromSeed,exports.getStructureLocalStorage=getStructureLocalStorage,exports.dataModelsInfo=dataModelsInfo,exports.TwoPi=TwoPi,exports.HalfPi=HalfPi,exports.radToGrad=radToGrad,exports.gradToRad=gradToRad});
@marcoscastro
Copy link

thanks, was very useful for me :)

@jalelhmani21222
Copy link

اناسعيد اما لهذا البحث من فايدة علي العديد

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment