@datagrok/curves 1.2.15 → 1.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -1
- package/README.md +9 -1
- package/dist/package-test.js +1 -1
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +1 -1
- package/dist/package.js.map +1 -1
- package/img/multi-curve-viewer.gif +0 -0
- package/package.json +6 -6
- package/src/fit/fit-grid-cell-handler.ts +30 -64
- package/src/fit/fit-renderer.ts +8 -5
- package/src/package.ts +75 -2
package/dist/package-test.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var curves_test;(()=>{var __webpack_modules__={78:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";function copyInto(n,r){for(var e=0;e<r.length;e++)n[e]=r[e]}function limitedMemoryBFGS(n,r){var e=+new Date,t=r.length,o=numeric.rep([t],0);n.getGradient(r,o);var i=numeric.clone(o),u=numeric.clone(r),a=numeric.clone(o);numeric.diveq(a,numeric.norm2(a));var c=[],s=[],l=[],f=(backtrackingLineSearch(n,a,o,r),n.getValue(r));o=n.getGradient(r,o);for(var m=f,h=0;h<100;h++){var d;if(new Date,c.length<4)c.unshift(numeric.sub(r,u)),s.unshift(numeric.sub(o,i));else{for(var p=c.pop(),g=s.pop(),v=0;v<t;v++)p[v]=r[v]-u[v],g[v]=o[v]-i[v];c.unshift(p),s.unshift(g)}copyInto(u,r),copyInto(i,o);var y=0,x=0;for(v=0;v<t;v++)y+=c[0][v]*s[0][v],x+=s[0][v]*s[0][v];var w=y/x;l.unshift(1/y),copyInto(a,o);for(var b=[],T=0;T<c.length;T++){var _=0;for(v=0;v<t;v++)_+=c[T][v]*a[v];for(_*=l[T],b.push(_),v=0;v<t;v++)a[v]+=s[T][v]*-_}for(v=0;v<t;v++)a[v]*=w;for(T=c.length-1;T>=0;T--){var k=0;for(v=0;v<t;v++)k+=s[T][v]*a[v];for(k*=l[T],_=b[T],v=0;v<t;v++)a[v]+=c[T][v]*(_-k)}for(v=0;v<t;v++)a[v]=-a[v];if(backtrackingLineSearch(n,a,o,r),f=n.getValue(r),o=n.getGradient(r,o),2*(f-m)<=1e-4*(Math.abs(f)+Math.abs(m)+1e-5))return d=+new Date,!0;var M=numeric.norm2(o);if(M<.001)return d=+new Date,!0;if(0==M)return d=+new Date,!0;m=f}return d=+new Date,console.log("Finished iterations "+(d-e)),!0}function backtrackingLineSearch(n,r,e,t){var o=t.length,i=0,u=1,a=0,c=n.getValue(t),s=c,l=numeric.norm2(r);l>100&&numeric.muleq(r,100/l);for(var f=0,m=0;m<o;m++)f+=e[m]*r[m];var h=0;for(m=0;m<o;m++){var d=Math.abs(r[m]/Math.max(Math.abs(t[m]),1));d>h&&(h=d)}for(var p=1e-4/h,g=0;g<25;g++){for(m=0;m<o;m++)t[m]+=(u-i)*r[m];if(u<p)return 0;var v=n.getValue(t);if(v>=c+1e-4*u*f)return u;if(isFinite(v))if(1==u)a=-f/(2*(v-c-f));else{var y=v-c-u*f,x=s-c-i*f,w=1/(u*u),b=1/(i*i),T=1/(u-i),_=T*(y*w-x*b),k=T*(-y*i*w+x*u*b);if(0==_)a=-f/(2*k);else{var M=k*k-3*_*f;a=M<0?.5*u:k<=0?(-k+Math.sqrt(M))/(3*_):-f/(k+Math.sqrt(M))}a>.5*u&&(a=.5*u)}else a=.2*u;s=v,i=u,u=Math.max(a,.1*u)}}__webpack_require__.d(__webpack_exports__,{U:()=>limitedMemoryBFGS});var quadratic={getValue:function(n){var r=n[0],e=n[1];return-3*r*r-4*e*e+2*r-4*e+18},getGradient:function(n,r){return r[0]=-6*n[0]+2,r[1]=-8*n[1]-4,r}};function doubleExp(n){for(var r=Array(n),e=0;e<n;e++)r[e]=Math.log(Math.random())*(Math.random()>.5?1:-1);return r}var ridgeRegression={covariates:[],responses:[],originalParameters:doubleExp(100),sample:function(n,r){for(var e=0;e<n;e++){var t=doubleExp(100);this.responses.push(numeric.dot(t,this.originalParameters)+r()),this.covariates.push(t)}},getValue:function(n){for(var r=0,e=0;e<this.covariates.length;e++){var t=this.responses[e]-numeric.dot(this.covariates[e],n);r+=-.5*t*t}return r},getGradient:function(n,r){for(var e=0;e<this.covariates.length;e++){var t=this.responses[e]-numeric.dot(this.covariates[e],n);numeric.addeq(r,numeric.mul(this.covariates[e],t))}return r}},numeric="undefined"==typeof exports?function(){}:exports;void 0!==__webpack_require__.g&&(__webpack_require__.g.numeric=numeric),numeric.version="1.2.6",numeric.bench=function(n,r){var e,t,o;for(void 0===r&&(r=15),t=.5,e=new Date;;){for(o=t*=2;o>3;o-=4)n(),n(),n(),n();for(;o>0;)n(),o--;if(new Date-e>r)break}for(o=t;o>3;o-=4)n(),n(),n(),n();for(;o>0;)n(),o--;return 1e3*(3*t-1)/(new Date-e)},numeric._myIndexOf=function(n){var r,e=this.length;for(r=0;r<e;++r)if(this[r]===n)return r;return-1},numeric.myIndexOf=Array.prototype.indexOf?Array.prototype.indexOf:numeric._myIndexOf,numeric.Function=Function,numeric.precision=4,numeric.largeArray=50,numeric.prettyPrint=function(n){function r(n){if(0===n)return"0";if(isNaN(n))return"NaN";if(n<0)return"-"+r(-n);if(isFinite(n)){var e=Math.floor(Math.log(n)/Math.log(10)),t=n/Math.pow(10,e),o=t.toPrecision(numeric.precision);return 10===parseFloat(o)&&(e++,o=(t=1).toPrecision(numeric.precision)),parseFloat(o).toString()+"e"+e.toString()}return"Infinity"}var e=[];return function n(t){var o;if(void 0===t)return e.push(Array(numeric.precision+8).join(" ")),!1;if("string"==typeof t)return e.push('"'+t+'"'),!1;if("boolean"==typeof t)return e.push(t.toString()),!1;if("number"==typeof t){var i=r(t),u=t.toPrecision(numeric.precision),a=parseFloat(t.toString()).toString(),c=[i,u,a,parseFloat(u).toString(),parseFloat(a).toString()];for(o=1;o<c.length;o++)c[o].length<i.length&&(i=c[o]);return e.push(Array(numeric.precision+8-i.length).join(" ")+i),!1}if(null===t)return e.push("null"),!1;if("function"==typeof t){e.push(t.toString());var s=!1;for(o in t)t.hasOwnProperty(o)&&(s?e.push(",\n"):e.push("\n{"),s=!0,e.push(o),e.push(": \n"),n(t[o]));return s&&e.push("}\n"),!0}if(t instanceof Array){if(t.length>numeric.largeArray)return e.push("...Large Array..."),!0;for(s=!1,e.push("["),o=0;o<t.length;o++)o>0&&(e.push(","),s&&e.push("\n ")),s=n(t[o]);return e.push("]"),!0}for(o in e.push("{"),s=!1,t)t.hasOwnProperty(o)&&(s&&e.push(",\n"),s=!0,e.push(o),e.push(": \n"),n(t[o]));return e.push("}"),!0}(n),e.join("")},numeric.parseDate=function(n){return function n(r){if("string"==typeof r)return Date.parse(r.replace(/-/g,"/"));if(r instanceof Array){var e,t=[];for(e=0;e<r.length;e++)t[e]=n(r[e]);return t}throw new Error("parseDate: parameter must be arrays of strings")}(n)},numeric.parseFloat=function(n){return function n(r){if("string"==typeof r)return parseFloat(r);if(r instanceof Array){var e,t=[];for(e=0;e<r.length;e++)t[e]=n(r[e]);return t}throw new Error("parseFloat: parameter must be arrays of strings")}(n)},numeric.parseCSV=function(n){var r,e,t,o=n.split("\n"),i=[],u=/(([^'",]*)|('[^']*')|("[^"]*")),/g,a=/^\s*(([+-]?[0-9]+(\.[0-9]*)?(e[+-]?[0-9]+)?)|([+-]?[0-9]*(\.[0-9]+)?(e[+-]?[0-9]+)?))\s*$/,c=0;for(e=0;e<o.length;e++){var s,l=(o[e]+",").match(u);if(l.length>0){for(i[c]=[],r=0;r<l.length;r++)s=(t=l[r]).substr(0,t.length-1),a.test(s)?i[c][r]=parseFloat(s):i[c][r]=s;c++}}return i},numeric.toCSV=function(n){var r,e,t,o,i,u=numeric.dim(n);for(t=u[0],u[1],i=[],r=0;r<t;r++){for(o=[],e=0;e<t;e++)o[e]=n[r][e].toString();i[r]=o.join(", ")}return i.join("\n")+"\n"},numeric.getURL=function(n){var r=new XMLHttpRequest;return r.open("GET",n,!1),r.send(),r},numeric.imageURL=function(n){function r(n,r,e){void 0===r&&(r=0),void 0===e&&(e=n.length);var t,o=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],i=-1;for(n.length,t=r;t<e;t++)i=i>>>8^o[255&(i^n[t])];return-1^i}var e,t,o,i,u,a,c,s,l,f,m=n[0].length,h=n[0][0].length,d=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,h>>24&255,h>>16&255,h>>8&255,255&h,m>>24&255,m>>16&255,m>>8&255,255&m,8,2,0,0,0,-1,-2,-3,-4,-5,-6,-7,-8,73,68,65,84,8,29];for(f=r(d,12,29),d[29]=f>>24&255,d[30]=f>>16&255,d[31]=f>>8&255,d[32]=255&f,e=1,t=0,c=0;c<m;c++){for(c<m-1?d.push(0):d.push(1),u=3*h+1+(0===c)&255,a=3*h+1+(0===c)>>8&255,d.push(u),d.push(a),d.push(255&~u),d.push(255&~a),0===c&&d.push(0),s=0;s<h;s++)for(o=0;o<3;o++)t=(t+(e=(e+(u=(u=n[o][c][s])>255?255:u<0?0:Math.round(u)))%65521))%65521,d.push(u);d.push(0)}return l=(t<<16)+e,d.push(l>>24&255),d.push(l>>16&255),d.push(l>>8&255),d.push(255&l),i=d.length-41,d[33]=i>>24&255,d[34]=i>>16&255,d[35]=i>>8&255,d[36]=255&i,f=r(d,37),d.push(f>>24&255),d.push(f>>16&255),d.push(f>>8&255),d.push(255&f),d.push(0),d.push(0),d.push(0),d.push(0),d.push(73),d.push(69),d.push(78),d.push(68),d.push(174),d.push(66),d.push(96),d.push(130),"data:image/png;base64,"+function(n){var r,e,t,o,i,u,a,c=n.length,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l="";for(r=0;r<c;r+=3)i=((3&(e=n[r]))<<4)+((t=n[r+1])>>4),u=((15&t)<<2)+((o=n[r+2])>>6),a=63&o,r+1>=c?u=a=64:r+2>=c&&(a=64),l+=s.charAt(e>>2)+s.charAt(i)+s.charAt(u)+s.charAt(a);return l}(d)},numeric._dim=function(n){for(var r=[];"object"==typeof n;)r.push(n.length),n=n[0];return r},numeric.dim=function(n){var r;return"object"==typeof n?"object"==typeof(r=n[0])?"object"==typeof r[0]?numeric._dim(n):[n.length,r.length]:[n.length]:[]},numeric.mapreduce=function(n,r){return Function("x","accum","_s","_k",'if(typeof accum === "undefined") accum = '+r+';\nif(typeof x === "number") { var xi = x; '+n+'; return accum; }\nif(typeof _s === "undefined") _s = numeric.dim(x);\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i,xi;\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) {\n accum = arguments.callee(x[i],accum,_s,_k+1);\n } return accum;\n}\nfor(i=_n-1;i>=1;i-=2) { \n xi = x[i];\n '+n+";\n xi = x[i-1];\n "+n+";\n}\nif(i === 0) {\n xi = x[i];\n "+n+"\n}\nreturn accum;")},numeric.mapreduce2=function(n,r){return Function("x","var n = x.length;\nvar i,xi;\n"+r+";\nfor(i=n-1;i!==-1;--i) { \n xi = x[i];\n "+n+";\n}\nreturn accum;")},numeric.same=function n(r,e){var t,o;if(r instanceof Array&&e instanceof Array){if((o=r.length)!==e.length)return!1;for(t=0;t<o;t++)if(r[t]!==e[t]){if("object"!=typeof r[t])return!1;if(!n(r[t],e[t]))return!1}return!0}return!1},numeric.rep=function(n,r,e){void 0===e&&(e=0);var t,o=n[e],i=Array(o);if(e===n.length-1){for(t=o-2;t>=0;t-=2)i[t+1]=r,i[t]=r;return-1===t&&(i[0]=r),i}for(t=o-1;t>=0;t--)i[t]=numeric.rep(n,r,e+1);return i},numeric.dotMMsmall=function(n,r){var e,t,o,i,u,a,c,s,l,f,m;for(i=n.length,u=r.length,a=r[0].length,c=Array(i),e=i-1;e>=0;e--){for(s=Array(a),l=n[e],o=a-1;o>=0;o--){for(f=l[u-1]*r[u-1][o],t=u-2;t>=1;t-=2)m=t-1,f+=l[t]*r[t][o]+l[m]*r[m][o];0===t&&(f+=l[0]*r[0][o]),s[o]=f}c[e]=s}return c},numeric._getCol=function(n,r,e){var t;for(t=n.length-1;t>0;--t)e[t]=n[t][r],e[--t]=n[t][r];0===t&&(e[0]=n[0][r])},numeric.dotMMbig=function(n,r){var e,t,o,i=numeric._getCol,u=r.length,a=Array(u),c=n.length,s=r[0].length,l=new Array(c),f=numeric.dotVV;for(--u,t=--c;-1!==t;--t)l[t]=Array(s);for(t=--s;-1!==t;--t)for(i(r,t,a),o=c;-1!==o;--o)e=n[o],l[o][t]=f(e,a);return l},numeric.dotMV=function(n,r){var e,t=n.length,o=(r.length,Array(t)),i=numeric.dotVV;for(e=t-1;e>=0;e--)o[e]=i(n[e],r);return o},numeric.dotVM=function(n,r){var e,t,o,i,u,a,c;for(o=n.length,i=r[0].length,u=Array(i),t=i-1;t>=0;t--){for(a=n[o-1]*r[o-1][t],e=o-2;e>=1;e-=2)c=e-1,a+=n[e]*r[e][t]+n[c]*r[c][t];0===e&&(a+=n[0]*r[0][t]),u[t]=a}return u},numeric.dotVV=function(n,r){var e,t,o=n.length,i=n[o-1]*r[o-1];for(e=o-2;e>=1;e-=2)t=e-1,i+=n[e]*r[e]+n[t]*r[t];return 0===e&&(i+=n[0]*r[0]),i},numeric.dot=function(n,r){var e=numeric.dim;switch(1e3*e(n).length+e(r).length){case 2002:return r.length<10?numeric.dotMMsmall(n,r):numeric.dotMMbig(n,r);case 2001:return numeric.dotMV(n,r);case 1002:return numeric.dotVM(n,r);case 1001:return numeric.dotVV(n,r);case 1e3:return numeric.mulVS(n,r);case 1:return numeric.mulSV(n,r);case 0:return n*r;default:throw new Error("numeric.dot only works on vectors and matrices")}},numeric.diag=function(n){var r,e,t,o,i=n.length,u=Array(i);for(r=i-1;r>=0;r--){for(o=Array(i),e=r+2,t=i-1;t>=e;t-=2)o[t]=0,o[t-1]=0;for(t>r&&(o[t]=0),o[r]=n[r],t=r-1;t>=1;t-=2)o[t]=0,o[t-1]=0;0===t&&(o[0]=0),u[r]=o}return u},numeric.getDiag=function(n){var r,e=Math.min(n.length,n[0].length),t=Array(e);for(r=e-1;r>=1;--r)t[r]=n[r][r],t[--r]=n[r][r];return 0===r&&(t[0]=n[0][0]),t},numeric.identity=function(n){return numeric.diag(numeric.rep([n],1))},numeric.pointwise=function(n,r,e){void 0===e&&(e="");var t,o,i=[],u=/\[i\]$/,a="",c=!1;for(t=0;t<n.length;t++)u.test(n[t])?a=o=n[t].substring(0,n[t].length-3):o=n[t],"ret"===o&&(c=!0),i.push(o);return i[n.length]="_s",i[n.length+1]="_k",i[n.length+2]='if(typeof _s === "undefined") _s = numeric.dim('+a+');\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i'+(c?"":", ret = Array(_n)")+";\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) ret[i] = arguments.callee("+n.join(",")+",_s,_k+1);\n return ret;\n}\n"+e+"\nfor(i=_n-1;i!==-1;--i) {\n "+r+"\n}\nreturn ret;",Function.apply(null,i)},numeric.pointwise2=function(n,r,e){void 0===e&&(e="");var t,o,i=[],u=/\[i\]$/,a="",c=!1;for(t=0;t<n.length;t++)u.test(n[t])?a=o=n[t].substring(0,n[t].length-3):o=n[t],"ret"===o&&(c=!0),i.push(o);return i[n.length]="var _n = "+a+".length;\nvar i"+(c?"":", ret = Array(_n)")+";\n"+e+"\nfor(i=_n-1;i!==-1;--i) {\n"+r+"\n}\nreturn ret;",Function.apply(null,i)},numeric._biforeach=function n(r,e,t,o,i){var u;if(o!==t.length-1)for(u=t[o]-1;u>=0;u--)n("object"==typeof r?r[u]:r,"object"==typeof e?e[u]:e,t,o+1,i);else i(r,e)},numeric._biforeach2=function n(r,e,t,o,i){if(o===t.length-1)return i(r,e);var u,a=t[o],c=Array(a);for(u=a-1;u>=0;--u)c[u]=n("object"==typeof r?r[u]:r,"object"==typeof e?e[u]:e,t,o+1,i);return c},numeric._foreach=function n(r,e,t,o){var i;if(t!==e.length-1)for(i=e[t]-1;i>=0;i--)n(r[i],e,t+1,o);else o(r)},numeric._foreach2=function n(r,e,t,o){if(t===e.length-1)return o(r);var i,u=e[t],a=Array(u);for(i=u-1;i>=0;i--)a[i]=n(r[i],e,t+1,o);return a},numeric.ops2={add:"+",sub:"-",mul:"*",div:"/",mod:"%",and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">=",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"},numeric.opseq={addeq:"+=",subeq:"-=",muleq:"*=",diveq:"/=",modeq:"%=",lshifteq:"<<=",rshifteq:">>=",rrshifteq:">>>=",bandeq:"&=",boreq:"|=",bxoreq:"^="},numeric.mathfuns=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","isNaN","isFinite"],numeric.mathfuns2=["atan2","pow","max","min"],numeric.ops1={neg:"-",not:"!",bnot:"~",clone:""},numeric.mapreducers={any:["if(xi) return true;","var accum = false;"],all:["if(!xi) return false;","var accum = true;"],sum:["accum += xi;","var accum = 0;"],prod:["accum *= xi;","var accum = 1;"],norm2Squared:["accum += xi*xi;","var accum = 0;"],norminf:["accum = max(accum,abs(xi));","var accum = 0, max = Math.max, abs = Math.abs;"],norm1:["accum += abs(xi)","var accum = 0, abs = Math.abs;"],sup:["accum = max(accum,xi);","var accum = -Infinity, max = Math.max;"],inf:["accum = min(accum,xi);","var accum = Infinity, min = Math.min;"]},function(){var n,r;for(n=0;n<numeric.mathfuns2.length;++n)r=numeric.mathfuns2[n],numeric.ops2[r]=r;for(n in numeric.ops2)if(numeric.ops2.hasOwnProperty(n)){r=numeric.ops2[n];var e,t,o="";-1!==numeric.myIndexOf.call(numeric.mathfuns2,n)?(o="var "+r+" = Math."+r+";\n",e=function(n,e,t){return n+" = "+r+"("+e+","+t+")"},t=function(n,e){return n+" = "+r+"("+n+","+e+")"}):(e=function(n,e,t){return n+" = "+e+" "+r+" "+t},t=numeric.opseq.hasOwnProperty(n+"eq")?function(n,e){return n+" "+r+"= "+e}:function(n,e){return n+" = "+n+" "+r+" "+e}),numeric[n+"VV"]=numeric.pointwise2(["x[i]","y[i]"],e("ret[i]","x[i]","y[i]"),o),numeric[n+"SV"]=numeric.pointwise2(["x","y[i]"],e("ret[i]","x","y[i]"),o),numeric[n+"VS"]=numeric.pointwise2(["x[i]","y"],e("ret[i]","x[i]","y"),o),numeric[n]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar VV = numeric."+n+"VV, VS = numeric."+n+"VS, SV = numeric."+n+'SV;\nvar dim = numeric.dim;\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof x === "object") {\n if(typeof y === "object") x = numeric._biforeach2(x,y,dim(x),0,VV);\n else x = numeric._biforeach2(x,y,dim(x),0,VS);\n } else if(typeof y === "object") x = numeric._biforeach2(x,y,dim(y),0,SV);\n else '+t("x","y")+"\n}\nreturn x;\n"),numeric[r]=numeric[n],numeric[n+"eqV"]=numeric.pointwise2(["ret[i]","x[i]"],t("ret[i]","x[i]"),o),numeric[n+"eqS"]=numeric.pointwise2(["ret[i]","x"],t("ret[i]","x"),o),numeric[n+"eq"]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar V = numeric."+n+"eqV, S = numeric."+n+'eqS\nvar s = numeric.dim(x);\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof y === "object") numeric._biforeach(x,y,s,0,V);\n else numeric._biforeach(x,y,s,0,S);\n}\nreturn x;\n')}for(n=0;n<numeric.mathfuns2.length;++n)r=numeric.mathfuns2[n],delete numeric.ops2[r];for(n=0;n<numeric.mathfuns.length;++n)r=numeric.mathfuns[n],numeric.ops1[r]=r;for(n in numeric.ops1)numeric.ops1.hasOwnProperty(n)&&(o="",r=numeric.ops1[n],-1!==numeric.myIndexOf.call(numeric.mathfuns,n)&&Math.hasOwnProperty(r)&&(o="var "+r+" = Math."+r+";\n"),numeric[n+"eqV"]=numeric.pointwise2(["ret[i]"],"ret[i] = "+r+"(ret[i]);",o),numeric[n+"eq"]=Function("x",'if(typeof x !== "object") return '+r+"x\nvar i;\nvar V = numeric."+n+"eqV;\nvar s = numeric.dim(x);\nnumeric._foreach(x,s,0,V);\nreturn x;\n"),numeric[n+"V"]=numeric.pointwise2(["x[i]"],"ret[i] = "+r+"(x[i]);",o),numeric[n]=Function("x",'if(typeof x !== "object") return '+r+"(x)\nvar i;\nvar V = numeric."+n+"V;\nvar s = numeric.dim(x);\nreturn numeric._foreach2(x,s,0,V);\n"));for(n=0;n<numeric.mathfuns.length;++n)r=numeric.mathfuns[n],delete numeric.ops1[r];for(n in numeric.mapreducers)numeric.mapreducers.hasOwnProperty(n)&&(r=numeric.mapreducers[n],numeric[n+"V"]=numeric.mapreduce2(r[0],r[1]),numeric[n]=Function("x","s","k",r[1]+'if(typeof x !== "object") { xi = x;\n'+r[0]+';\n return accum;\n}if(typeof s === "undefined") s = numeric.dim(x);\nif(typeof k === "undefined") k = 0;\nif(k === s.length-1) return numeric.'+n+"V(x);\nvar xi;\nvar n = x.length, i;\nfor(i=n-1;i!==-1;--i) {\n xi = arguments.callee(x[i]);\n"+r[0]+";\n}\nreturn accum;\n"))}(),numeric.truncVV=numeric.pointwise(["x[i]","y[i]"],"ret[i] = round(x[i]/y[i])*y[i];","var round = Math.round;"),numeric.truncVS=numeric.pointwise(["x[i]","y"],"ret[i] = round(x[i]/y)*y;","var round = Math.round;"),numeric.truncSV=numeric.pointwise(["x","y[i]"],"ret[i] = round(x/y[i])*y[i];","var round = Math.round;"),numeric.trunc=function(n,r){return"object"==typeof n?"object"==typeof r?numeric.truncVV(n,r):numeric.truncVS(n,r):"object"==typeof r?numeric.truncSV(n,r):Math.round(n/r)*r},numeric.inv=function(n){var r,e,t,o,i,u,a,c=numeric.dim(n),s=Math.abs,l=c[0],f=c[1],m=numeric.clone(n),h=numeric.identity(l);for(u=0;u<f;++u){var d=-1,p=-1;for(i=u;i!==l;++i)(a=s(m[i][u]))>p&&(d=i,p=a);for(e=m[d],m[d]=m[u],m[u]=e,o=h[d],h[d]=h[u],h[u]=o,n=e[u],a=u;a!==f;++a)e[a]/=n;for(a=f-1;-1!==a;--a)o[a]/=n;for(i=l-1;-1!==i;--i)if(i!==u){for(r=m[i],t=h[i],n=r[u],a=u+1;a!==f;++a)r[a]-=e[a]*n;for(a=f-1;a>0;--a)t[a]-=o[a]*n,t[--a]-=o[a]*n;0===a&&(t[0]-=o[0]*n)}}return h},numeric.det=function(n){var r=numeric.dim(n);if(2!==r.length||r[0]!==r[1])throw new Error("numeric: det() only works on square matrices");var e,t,o,i,u,a,c,s,l=r[0],f=1,m=numeric.clone(n);for(t=0;t<l-1;t++){for(o=t,e=t+1;e<l;e++)Math.abs(m[e][t])>Math.abs(m[o][t])&&(o=e);for(o!==t&&(c=m[o],m[o]=m[t],m[t]=c,f*=-1),i=m[t],e=t+1;e<l;e++){for(a=(u=m[e])[t]/i[t],o=t+1;o<l-1;o+=2)s=o+1,u[o]-=i[o]*a,u[s]-=i[s]*a;o!==l&&(u[o]-=i[o]*a)}if(0===i[t])return 0;f*=i[t]}return f*m[t][t]},numeric.transpose=function(n){var r,e,t,o,i,u=n.length,a=n[0].length,c=Array(a);for(e=0;e<a;e++)c[e]=Array(u);for(r=u-1;r>=1;r-=2){for(o=n[r],t=n[r-1],e=a-1;e>=1;--e)(i=c[e])[r]=o[e],i[r-1]=t[e],(i=c[--e])[r]=o[e],i[r-1]=t[e];0===e&&((i=c[0])[r]=o[0],i[r-1]=t[0])}if(0===r){for(t=n[0],e=a-1;e>=1;--e)c[e][0]=t[e],c[--e][0]=t[e];0===e&&(c[0][0]=t[0])}return c},numeric.negtranspose=function(n){var r,e,t,o,i,u=n.length,a=n[0].length,c=Array(a);for(e=0;e<a;e++)c[e]=Array(u);for(r=u-1;r>=1;r-=2){for(o=n[r],t=n[r-1],e=a-1;e>=1;--e)(i=c[e])[r]=-o[e],i[r-1]=-t[e],(i=c[--e])[r]=-o[e],i[r-1]=-t[e];0===e&&((i=c[0])[r]=-o[0],i[r-1]=-t[0])}if(0===r){for(t=n[0],e=a-1;e>=1;--e)c[e][0]=-t[e],c[--e][0]=-t[e];0===e&&(c[0][0]=-t[0])}return c},numeric._random=function n(r,e){var t,o,i=r[e],u=Array(i);if(e===r.length-1){for(o=Math.random,t=i-1;t>=1;t-=2)u[t]=o(),u[t-1]=o();return 0===t&&(u[0]=o()),u}for(t=i-1;t>=0;t--)u[t]=n(r,e+1);return u},numeric.random=function(n){return numeric._random(n,0)},numeric.norm2=function(n){return Math.sqrt(numeric.norm2Squared(n))},numeric.linspace=function(n,r,e){if(void 0===e&&(e=Math.max(Math.round(r-n)+1,1)),e<2)return 1===e?[n]:[];var t,o=Array(e);for(t=--e;t>=0;t--)o[t]=(t*r+(e-t)*n)/e;return o},numeric.getBlock=function(n,r,e){var t=numeric.dim(n);return function n(o,i){var u,a=r[i],c=e[i]-a,s=Array(c);if(i===t.length-1){for(u=c;u>=0;u--)s[u]=o[u+a];return s}for(u=c;u>=0;u--)s[u]=n(o[u+a],i+1);return s}(n,0)},numeric.setBlock=function(n,r,e,t){var o=numeric.dim(n);return function n(t,i,u){var a,c=r[u],s=e[u]-c;if(u===o.length-1)for(a=s;a>=0;a--)t[a+c]=i[a];for(a=s;a>=0;a--)n(t[a+c],i[a],u+1)}(n,t,0),n},numeric.getRange=function(n,r,e){var t,o,i,u,a=r.length,c=e.length,s=Array(a);for(t=a-1;-1!==t;--t)for(s[t]=Array(c),i=s[t],u=n[r[t]],o=c-1;-1!==o;--o)i[o]=u[e[o]];return s},numeric.blockMatrix=function(n){var r=numeric.dim(n);if(r.length<4)return numeric.blockMatrix([n]);var e,t,o,i,u,a=r[0],c=r[1];for(e=0,t=0,o=0;o<a;++o)e+=n[o][0].length;for(i=0;i<c;++i)t+=n[0][i][0].length;var s=Array(e);for(o=0;o<e;++o)s[o]=Array(t);var l,f,m,h,d,p=0;for(o=0;o<a;++o){for(l=t,i=c-1;-1!==i;--i)for(l-=(u=n[o][i])[0].length,m=u.length-1;-1!==m;--m)for(d=u[m],f=s[p+m],h=d.length-1;-1!==h;--h)f[l+h]=d[h];p+=n[o][0].length}return s},numeric.tensor=function(n,r){if("number"==typeof n||"number"==typeof r)return numeric.mul(n,r);var e=numeric.dim(n),t=numeric.dim(r);if(1!==e.length||1!==t.length)throw new Error("numeric: tensor product is only defined for vectors");var o,i,u,a,c=e[0],s=t[0],l=Array(c);for(i=c-1;i>=0;i--){for(o=Array(s),a=n[i],u=s-1;u>=3;--u)o[u]=a*r[u],o[--u]=a*r[u],o[--u]=a*r[u],o[--u]=a*r[u];for(;u>=0;)o[u]=a*r[u],--u;l[i]=o}return l},numeric.T=function(n,r){this.x=n,this.y=r},numeric.t=function(n,r){return new numeric.T(n,r)},numeric.Tbinop=function(n,r,e,t,o){var i;if(numeric.indexOf,"string"!=typeof o)for(i in o="",numeric)numeric.hasOwnProperty(i)&&(n.indexOf(i)>=0||r.indexOf(i)>=0||e.indexOf(i)>=0||t.indexOf(i)>=0)&&i.length>1&&(o+="var "+i+" = numeric."+i+";\n");return Function(["y"],"var x = this;\nif(!(y instanceof numeric.T)) { y = new numeric.T(y); }\n"+o+"\nif(x.y) { if(y.y) { return new numeric.T("+t+");\n }\n return new numeric.T("+e+");\n}\nif(y.y) {\n return new numeric.T("+r+");\n}\nreturn new numeric.T("+n+");\n")},numeric.T.prototype.add=numeric.Tbinop("add(x.x,y.x)","add(x.x,y.x),y.y","add(x.x,y.x),x.y","add(x.x,y.x),add(x.y,y.y)"),numeric.T.prototype.sub=numeric.Tbinop("sub(x.x,y.x)","sub(x.x,y.x),neg(y.y)","sub(x.x,y.x),x.y","sub(x.x,y.x),sub(x.y,y.y)"),numeric.T.prototype.mul=numeric.Tbinop("mul(x.x,y.x)","mul(x.x,y.x),mul(x.x,y.y)","mul(x.x,y.x),mul(x.y,y.x)","sub(mul(x.x,y.x),mul(x.y,y.y)),add(mul(x.x,y.y),mul(x.y,y.x))"),numeric.T.prototype.reciprocal=function(){var n=numeric.mul,r=numeric.div;if(this.y){var e=numeric.add(n(this.x,this.x),n(this.y,this.y));return new numeric.T(r(this.x,e),r(numeric.neg(this.y),e))}return new T(r(1,this.x))},numeric.T.prototype.div=function(n){if(n instanceof numeric.T||(n=new numeric.T(n)),n.y)return this.mul(n.reciprocal());var r=numeric.div;return this.y?new numeric.T(r(this.x,n.x),r(this.y,n.x)):new numeric.T(r(this.x,n.x))},numeric.T.prototype.dot=numeric.Tbinop("dot(x.x,y.x)","dot(x.x,y.x),dot(x.x,y.y)","dot(x.x,y.x),dot(x.y,y.x)","sub(dot(x.x,y.x),dot(x.y,y.y)),add(dot(x.x,y.y),dot(x.y,y.x))"),numeric.T.prototype.transpose=function(){var n=numeric.transpose,r=this.x,e=this.y;return e?new numeric.T(n(r),n(e)):new numeric.T(n(r))},numeric.T.prototype.transjugate=function(){var n=numeric.transpose,r=this.x,e=this.y;return e?new numeric.T(n(r),numeric.negtranspose(e)):new numeric.T(n(r))},numeric.Tunop=function(n,r,e){return"string"!=typeof e&&(e=""),Function("var x = this;\n"+e+"\nif(x.y) { "+r+";\n}\n"+n+";\n")},numeric.T.prototype.exp=numeric.Tunop("return new numeric.T(ex)","return new numeric.T(mul(cos(x.y),ex),mul(sin(x.y),ex))","var ex = numeric.exp(x.x), cos = numeric.cos, sin = numeric.sin, mul = numeric.mul;"),numeric.T.prototype.conj=numeric.Tunop("return new numeric.T(x.x);","return new numeric.T(x.x,numeric.neg(x.y));"),numeric.T.prototype.neg=numeric.Tunop("return new numeric.T(neg(x.x));","return new numeric.T(neg(x.x),neg(x.y));","var neg = numeric.neg;"),numeric.T.prototype.sin=numeric.Tunop("return new numeric.T(numeric.sin(x.x))","return x.exp().sub(x.neg().exp()).div(new numeric.T(0,2));"),numeric.T.prototype.cos=numeric.Tunop("return new numeric.T(numeric.cos(x.x))","return x.exp().add(x.neg().exp()).div(2);"),numeric.T.prototype.abs=numeric.Tunop("return new numeric.T(numeric.abs(x.x));","return new numeric.T(numeric.sqrt(numeric.add(mul(x.x,x.x),mul(x.y,x.y))));","var mul = numeric.mul;"),numeric.T.prototype.log=numeric.Tunop("return new numeric.T(numeric.log(x.x));","var theta = new numeric.T(numeric.atan2(x.y,x.x)), r = x.abs();\nreturn new numeric.T(numeric.log(r.x),theta.x);"),numeric.T.prototype.norm2=numeric.Tunop("return numeric.norm2(x.x);","var f = numeric.norm2Squared;\nreturn Math.sqrt(f(x.x)+f(x.y));"),numeric.T.prototype.inv=function(){var n=this;if(void 0===n.y)return new numeric.T(numeric.inv(n.x));var r,e,t,o,i,u,a,c,s,l,f,m,h,d,p,g,v,y,x=n.x.length,w=numeric.identity(x),b=numeric.rep([x,x],0),T=numeric.clone(n.x),_=numeric.clone(n.y);for(s=0;s<x;s++){for(m=(d=T[s][s])*d+(p=_[s][s])*p,f=s,l=s+1;l<x;l++)(h=(d=T[l][s])*d+(p=_[l][s])*p)>m&&(f=l,m=h);for(f!==s&&(y=T[s],T[s]=T[f],T[f]=y,y=_[s],_[s]=_[f],_[f]=y,y=w[s],w[s]=w[f],w[f]=y,y=b[s],b[s]=b[f],b[f]=y),r=T[s],e=_[s],i=w[s],u=b[s],d=r[s],p=e[s],l=s+1;l<x;l++)g=r[l],v=e[l],r[l]=(g*d+v*p)/m,e[l]=(v*d-g*p)/m;for(l=0;l<x;l++)g=i[l],v=u[l],i[l]=(g*d+v*p)/m,u[l]=(v*d-g*p)/m;for(l=s+1;l<x;l++){for(t=T[l],o=_[l],a=w[l],c=b[l],d=t[s],p=o[s],f=s+1;f<x;f++)g=r[f],v=e[f],t[f]-=g*d-v*p,o[f]-=v*d+g*p;for(f=0;f<x;f++)g=i[f],v=u[f],a[f]-=g*d-v*p,c[f]-=v*d+g*p}}for(s=x-1;s>0;s--)for(i=w[s],u=b[s],l=s-1;l>=0;l--)for(a=w[l],c=b[l],d=T[l][s],p=_[l][s],f=x-1;f>=0;f--)g=i[f],v=u[f],a[f]-=d*g-p*v,c[f]-=d*v+p*g;return new numeric.T(w,b)},numeric.T.prototype.get=function(n){var r,e=this.x,t=this.y,o=0,i=n.length;if(t){for(;o<i;)e=e[r=n[o]],t=t[r],o++;return new numeric.T(e,t)}for(;o<i;)e=e[r=n[o]],o++;return new numeric.T(e)},numeric.T.prototype.set=function(n,r){var e,t=this.x,o=this.y,i=0,u=n.length,a=r.x,c=r.y;if(0===u)return c?this.y=c:o&&(this.y=void 0),this.x=t,this;if(c){for(o||(o=numeric.rep(numeric.dim(t),0),this.y=o);i<u-1;)t=t[e=n[i]],o=o[e],i++;return t[e=n[i]]=a,o[e]=c,this}if(o){for(;i<u-1;)t=t[e=n[i]],o=o[e],i++;return t[e=n[i]]=a,o[e]=a instanceof Array?numeric.rep(numeric.dim(a),0):0,this}for(;i<u-1;)t=t[e=n[i]],i++;return t[e=n[i]]=a,this},numeric.T.prototype.getRows=function(n,r){var e,t,o=r-n+1,i=Array(o),u=this.x,a=this.y;for(e=n;e<=r;e++)i[e-n]=u[e];if(a){for(t=Array(o),e=n;e<=r;e++)t[e-n]=a[e];return new numeric.T(i,t)}return new numeric.T(i)},numeric.T.prototype.setRows=function(n,r,e){var t,o=this.x,i=this.y,u=e.x,a=e.y;for(t=n;t<=r;t++)o[t]=u[t-n];if(a)for(i||(i=numeric.rep(numeric.dim(o),0),this.y=i),t=n;t<=r;t++)i[t]=a[t-n];else if(i)for(t=n;t<=r;t++)i[t]=numeric.rep([u[t-n].length],0);return this},numeric.T.prototype.getRow=function(n){var r=this.x,e=this.y;return e?new numeric.T(r[n],e[n]):new numeric.T(r[n])},numeric.T.prototype.setRow=function(n,r){var e=this.x,t=this.y,o=r.x,i=r.y;return e[n]=o,i?(t||(t=numeric.rep(numeric.dim(e),0),this.y=t),t[n]=i):t&&(t=numeric.rep([o.length],0)),this},numeric.T.prototype.getBlock=function(n,r){var e=this.x,t=this.y,o=numeric.getBlock;return t?new numeric.T(o(e,n,r),o(t,n,r)):new numeric.T(o(e,n,r))},numeric.T.prototype.setBlock=function(n,r,e){e instanceof numeric.T||(e=new numeric.T(e));var t=this.x,o=this.y,i=numeric.setBlock,u=e.x,a=e.y;if(a)return o||(this.y=numeric.rep(numeric.dim(this),0),o=this.y),i(t,n,r,u),i(o,n,r,a),this;i(t,n,r,u),o&&i(o,n,r,numeric.rep(numeric.dim(u),0))},numeric.T.rep=function(n,r){var e=numeric.T;r instanceof e||(r=new e(r));var t=r.x,o=r.y,i=numeric.rep;return o?new e(i(n,t),i(n,o)):new e(i(n,t))},numeric.T.diag=function(n){n instanceof numeric.T||(n=new numeric.T(n));var r=n.x,e=n.y,t=numeric.diag;return e?new numeric.T(t(r),t(e)):new numeric.T(t(r))},numeric.T.eig=function(){if(this.y)throw new Error("eig: not implemented for complex matrices.");return numeric.eig(this.x)},numeric.T.identity=function(n){return new numeric.T(numeric.identity(n))},numeric.T.prototype.getDiag=function(){var n=numeric,r=this.x,e=this.y;return e?new n.T(n.getDiag(r),n.getDiag(e)):new n.T(n.getDiag(r))},numeric.house=function(n){var r=numeric.clone(n),e=(n[0]>=0?1:-1)*numeric.norm2(n);r[0]+=e;var t=numeric.norm2(r);if(0===t)throw new Error("eig: internal error");return numeric.div(r,t)},numeric.toUpperHessenberg=function(n){var r=numeric.dim(n);if(2!==r.length||r[0]!==r[1])throw new Error("numeric: toUpperHessenberg() only works on square matrices");var e,t,o,i,u,a,c,s,l,f,m=r[0],h=numeric.clone(n),d=numeric.identity(m);for(t=0;t<m-2;t++){for(i=Array(m-t-1),e=t+1;e<m;e++)i[e-t-1]=h[e][t];if(numeric.norm2(i)>0){for(u=numeric.house(i),a=numeric.getBlock(h,[t+1,t],[m-1,m-1]),c=numeric.tensor(u,numeric.dot(u,a)),e=t+1;e<m;e++)for(s=h[e],l=c[e-t-1],o=t;o<m;o++)s[o]-=2*l[o-t];for(a=numeric.getBlock(h,[0,t+1],[m-1,m-1]),c=numeric.tensor(numeric.dot(a,u),u),e=0;e<m;e++)for(s=h[e],l=c[e],o=t+1;o<m;o++)s[o]-=2*l[o-t-1];for(a=Array(m-t-1),e=t+1;e<m;e++)a[e-t-1]=d[e];for(c=numeric.tensor(u,numeric.dot(u,a)),e=t+1;e<m;e++)for(f=d[e],l=c[e-t-1],o=0;o<m;o++)f[o]-=2*l[o]}}return{H:h,Q:d}},numeric.epsilon=2220446049250313e-31,numeric.QRFrancis=function(n,r){void 0===r&&(r=1e4),n=numeric.clone(n),numeric.clone(n);var e,t,o,i,u,a,c,s,l,f,m,h,d,p,g,v,y,x,w=numeric.dim(n)[0],b=numeric.identity(w);if(w<3)return{Q:b,B:[[0,w-1]]};var T=numeric.epsilon;for(x=0;x<r;x++){for(v=0;v<w-1;v++)if(Math.abs(n[v+1][v])<T*(Math.abs(n[v][v])+Math.abs(n[v+1][v+1]))){var _=numeric.QRFrancis(numeric.getBlock(n,[0,0],[v,v]),r),k=numeric.QRFrancis(numeric.getBlock(n,[v+1,v+1],[w-1,w-1]),r);for(h=Array(v+1),g=0;g<=v;g++)h[g]=b[g];for(d=numeric.dot(_.Q,h),g=0;g<=v;g++)b[g]=d[g];for(h=Array(w-v-1),g=v+1;g<w;g++)h[g-v-1]=b[g];for(d=numeric.dot(k.Q,h),g=v+1;g<w;g++)b[g]=d[g-v-1];return{Q:b,B:_.B.concat(numeric.add(k.B,v+1))}}var M,A,S;for(o=n[w-2][w-2],i=n[w-2][w-1],u=n[w-1][w-2],s=o+(a=n[w-1][w-1]),c=o*a-i*u,l=numeric.getBlock(n,[0,0],[2,2]),s*s>=4*c?(M=.5*(s+Math.sqrt(s*s-4*c)),A=.5*(s-Math.sqrt(s*s-4*c)),l=numeric.add(numeric.sub(numeric.dot(l,l),numeric.mul(l,M+A)),numeric.diag(numeric.rep([3],M*A)))):l=numeric.add(numeric.sub(numeric.dot(l,l),numeric.mul(l,s)),numeric.diag(numeric.rep([3],c))),e=[l[0][0],l[1][0],l[2][0]],t=numeric.house(e),h=[n[0],n[1],n[2]],d=numeric.tensor(t,numeric.dot(t,h)),g=0;g<3;g++)for(m=n[g],p=d[g],y=0;y<w;y++)m[y]-=2*p[y];for(h=numeric.getBlock(n,[0,0],[w-1,2]),d=numeric.tensor(numeric.dot(h,t),t),g=0;g<w;g++)for(m=n[g],p=d[g],y=0;y<3;y++)m[y]-=2*p[y];for(h=[b[0],b[1],b[2]],d=numeric.tensor(t,numeric.dot(t,h)),g=0;g<3;g++)for(f=b[g],p=d[g],y=0;y<w;y++)f[y]-=2*p[y];for(v=0;v<w-2;v++){for(y=v;y<=v+1;y++)if(Math.abs(n[y+1][y])<T*(Math.abs(n[y][y])+Math.abs(n[y+1][y+1]))){for(_=numeric.QRFrancis(numeric.getBlock(n,[0,0],[y,y]),r),k=numeric.QRFrancis(numeric.getBlock(n,[y+1,y+1],[w-1,w-1]),r),h=Array(y+1),g=0;g<=y;g++)h[g]=b[g];for(d=numeric.dot(_.Q,h),g=0;g<=y;g++)b[g]=d[g];for(h=Array(w-y-1),g=y+1;g<w;g++)h[g-y-1]=b[g];for(d=numeric.dot(k.Q,h),g=y+1;g<w;g++)b[g]=d[g-y-1];return{Q:b,B:_.B.concat(numeric.add(k.B,y+1))}}for(S=Math.min(w-1,v+3),e=Array(S-v),g=v+1;g<=S;g++)e[g-v-1]=n[g][v];for(t=numeric.house(e),h=numeric.getBlock(n,[v+1,v],[S,w-1]),d=numeric.tensor(t,numeric.dot(t,h)),g=v+1;g<=S;g++)for(m=n[g],p=d[g-v-1],y=v;y<w;y++)m[y]-=2*p[y-v];for(h=numeric.getBlock(n,[0,v+1],[w-1,S]),d=numeric.tensor(numeric.dot(h,t),t),g=0;g<w;g++)for(m=n[g],p=d[g],y=v+1;y<=S;y++)m[y]-=2*p[y-v-1];for(h=Array(S-v),g=v+1;g<=S;g++)h[g-v-1]=b[g];for(d=numeric.tensor(t,numeric.dot(t,h)),g=v+1;g<=S;g++)for(f=b[g],p=d[g-v-1],y=0;y<w;y++)f[y]-=2*p[y]}}throw new Error("numeric: eigenvalue iteration does not converge -- increase maxiter?")},numeric.eig=function(n,r){var e,t,o,i,u,a,c,s,l,f,m,h,d,p,g,v,y=numeric.toUpperHessenberg(n),x=numeric.QRFrancis(y.H,r),w=numeric.T,b=n.length,T=x.B,_=numeric.dot(x.Q,numeric.dot(y.H,numeric.transpose(x.Q))),k=new w(numeric.dot(x.Q,y.Q)),M=T.length,A=Math.sqrt;for(t=0;t<M;t++)if((e=T[t][0])!==T[t][1]){if(i=e+1,u=_[e][e],a=_[e][i],c=_[i][e],s=_[i][i],0===a&&0===c)continue;(f=(l=-u-s)*l-4*(u*s-a*c))>=0?((g=(u-(m=l<0?-.5*(l-A(f)):-.5*(l+A(f))))*(u-m)+a*a)>(v=c*c+(s-m)*(s-m))?(d=(u-m)/(g=A(g)),p=a/g):(d=c/(v=A(v)),p=(s-m)/v),o=new w([[p,-d],[d,p]]),k.setRows(e,i,o.dot(k.getRows(e,i)))):(m=-.5*l,h=.5*A(-f),(g=(u-m)*(u-m)+a*a)>(v=c*c+(s-m)*(s-m))?(d=(u-m)/(g=A(g+h*h)),p=a/g,m=0,h/=g):(d=c/(v=A(v+h*h)),p=(s-m)/v,m=h/v,h=0),o=new w([[p,-d],[d,p]],[[m,h],[h,-m]]),k.setRows(e,i,o.dot(k.getRows(e,i))))}var S=k.dot(n).dot(k.transjugate()),P=(b=n.length,numeric.T.identity(b));for(i=0;i<b;i++)if(i>0)for(t=i-1;t>=0;t--){var C=S.get([t,t]),q=S.get([i,i]);numeric.neq(C.x,q.x)||numeric.neq(C.y,q.y)?(m=S.getRow(t).getBlock([t],[i-1]),h=P.getRow(i).getBlock([t],[i-1]),P.set([i,t],S.get([t,i]).neg().sub(m.dot(h)).div(C.sub(q)))):P.setRow(i,P.getRow(t))}for(i=0;i<b;i++)m=P.getRow(i),P.setRow(i,m.div(m.norm2()));return P=P.transpose(),P=k.transjugate().dot(P),{lambda:S.getDiag(),E:P}},numeric.ccsSparse=function(n){var r,e,t,o=n.length,i=[];for(e=o-1;-1!==e;--e)for(t in r=n[e]){for(t=parseInt(t);t>=i.length;)i[i.length]=0;0!==r[t]&&i[t]++}var u=i.length,a=Array(u+1);for(a[0]=0,e=0;e<u;++e)a[e+1]=a[e]+i[e];var c=Array(a[u]),s=Array(a[u]);for(e=o-1;-1!==e;--e)for(t in r=n[e])0!==r[t]&&(i[t]--,c[a[t]+i[t]]=e,s[a[t]+i[t]]=r[t]);return[a,c,s]},numeric.ccsFull=function(n){var r,e,t,o,i=n[0],u=n[1],a=n[2],c=numeric.ccsDim(n),s=c[0],l=c[1],f=numeric.rep([s,l],0);for(r=0;r<l;r++)for(t=i[r],o=i[r+1],e=t;e<o;++e)f[u[e]][r]=a[e];return f},numeric.ccsTSolve=function(n,r,e,t,o){function i(n){var r;if(0===e[n]){for(e[n]=1,r=h[n];r<h[n+1];++r)i(d[r]);o[y]=n,++y}}var u,a,c,s,l,f,m,h=n[0],d=n[1],p=n[2],g=h.length-1,v=Math.max,y=0;for(void 0===t&&(e=numeric.rep([g],0)),void 0===t&&(t=numeric.linspace(0,e.length-1)),void 0===o&&(o=[]),u=t.length-1;-1!==u;--u)i(t[u]);for(o.length=y,u=o.length-1;-1!==u;--u)e[o[u]]=0;for(u=t.length-1;-1!==u;--u)a=t[u],e[a]=r[a];for(u=o.length-1;-1!==u;--u){for(a=o[u],c=h[a],s=v(h[a+1],c),l=c;l!==s;++l)if(d[l]===a){e[a]/=p[l];break}for(m=e[a],l=c;l!==s;++l)(f=d[l])!==a&&(e[f]-=m*p[l])}return e},numeric.ccsDFS=function(n){this.k=Array(n),this.k1=Array(n),this.j=Array(n)},numeric.ccsDFS.prototype.dfs=function(n,r,e,t,o,i){var u,a,c,s=0,l=o.length,f=this.k,m=this.k1,h=this.j;if(0===t[n])for(t[n]=1,h[0]=n,f[0]=a=r[n],m[0]=c=r[n+1];;)if(a>=c){if(o[l]=h[s],0===s)return;++l,a=f[--s],c=m[s]}else 0===t[u=i[e[a]]]?(t[u]=1,f[s]=a,h[++s]=u,a=r[u],m[s]=c=r[u+1]):++a},numeric.ccsLPSolve=function(n,r,e,t,o,i,u){var a,c,s,l,f,m,h,d,p,g=n[0],v=n[1],y=n[2],x=(g.length,r[0]),w=r[1],b=r[2];for(c=x[o],s=x[o+1],t.length=0,a=c;a<s;++a)u.dfs(i[w[a]],g,v,e,t,i);for(a=t.length-1;-1!==a;--a)e[t[a]]=0;for(a=c;a!==s;++a)e[l=i[w[a]]]=b[a];for(a=t.length-1;-1!==a;--a){for(f=g[l=t[a]],m=g[l+1],h=f;h<m;++h)if(i[v[h]]===l){e[l]/=y[h];break}for(p=e[l],h=f;h<m;++h)(d=i[v[h]])!==l&&(e[d]-=p*y[h])}return e},numeric.ccsLUP1=function(n,r){var e,t,o,i,u,a,c,s=n[0].length-1,l=[numeric.rep([s+1],0),[],[]],f=[numeric.rep([s+1],0),[],[]],m=l[0],h=l[1],d=l[2],p=f[0],g=f[1],v=f[2],y=numeric.rep([s],0),x=numeric.rep([s],0),w=numeric.ccsLPSolve,b=(Math.max,Math.abs),T=numeric.linspace(0,s-1),_=numeric.linspace(0,s-1),k=new numeric.ccsDFS(s);for(void 0===r&&(r=1),e=0;e<s;++e){for(w(l,n,y,x,e,_,k),i=-1,u=-1,t=x.length-1;-1!==t;--t)(o=x[t])<=e||(a=b(y[o]))>i&&(u=o,i=a);for(b(y[e])<r*i&&(t=T[e],i=T[u],T[e]=i,_[i]=e,T[u]=t,_[t]=u,i=y[e],y[e]=y[u],y[u]=i),i=m[e],u=p[e],c=y[e],h[i]=T[e],d[i]=1,++i,t=x.length-1;-1!==t;--t)a=y[o=x[t]],x[t]=0,y[o]=0,o<=e?(g[u]=o,v[u]=a,++u):(h[i]=T[o],d[i]=a/c,++i);m[e+1]=i,p[e+1]=u}for(t=h.length-1;-1!==t;--t)h[t]=_[h[t]];return{L:l,U:f,P:T,Pinv:_}},numeric.ccsDFS0=function(n){this.k=Array(n),this.k1=Array(n),this.j=Array(n)},numeric.ccsDFS0.prototype.dfs=function(n,r,e,t,o,i,u){var a,c,s,l=0,f=o.length,m=this.k,h=this.k1,d=this.j;if(0===t[n])for(t[n]=1,d[0]=n,m[0]=c=r[i[n]],h[0]=s=r[i[n]+1];;){if(isNaN(c))throw new Error("Ow!");if(c>=s){if(o[f]=i[d[l]],0===l)return;++f,c=m[--l],s=h[l]}else 0===t[a=e[c]]?(t[a]=1,m[l]=c,d[++l]=a,c=r[a=i[a]],h[l]=s=r[a+1]):++c}},numeric.ccsLPSolve0=function(n,r,e,t,o,i,u,a){var c,s,l,f,m,h,d,p,g,v=n[0],y=n[1],x=n[2],w=(v.length,r[0]),b=r[1],T=r[2];for(s=w[o],l=w[o+1],t.length=0,c=s;c<l;++c)a.dfs(b[c],v,y,e,t,i,u);for(c=t.length-1;-1!==c;--c)e[u[f=t[c]]]=0;for(c=s;c!==l;++c)e[f=b[c]]=T[c];for(c=t.length-1;-1!==c;--c){for(p=u[f=t[c]],m=v[f],h=v[f+1],d=m;d<h;++d)if(y[d]===p){e[p]/=x[d];break}for(g=e[p],d=m;d<h;++d)e[y[d]]-=g*x[d];e[p]=g}},numeric.ccsLUP0=function(n,r){var e,t,o,i,u,a,c,s=n[0].length-1,l=[numeric.rep([s+1],0),[],[]],f=[numeric.rep([s+1],0),[],[]],m=l[0],h=l[1],d=l[2],p=f[0],g=f[1],v=f[2],y=numeric.rep([s],0),x=numeric.rep([s],0),w=numeric.ccsLPSolve0,b=(Math.max,Math.abs),T=numeric.linspace(0,s-1),_=numeric.linspace(0,s-1),k=new numeric.ccsDFS0(s);for(void 0===r&&(r=1),e=0;e<s;++e){for(w(l,n,y,x,e,_,T,k),i=-1,u=-1,t=x.length-1;-1!==t;--t)(o=x[t])<=e||(a=b(y[T[o]]))>i&&(u=o,i=a);for(b(y[T[e]])<r*i&&(t=T[e],i=T[u],T[e]=i,_[i]=e,T[u]=t,_[t]=u),i=m[e],u=p[e],c=y[T[e]],h[i]=T[e],d[i]=1,++i,t=x.length-1;-1!==t;--t)a=y[T[o=x[t]]],x[t]=0,y[T[o]]=0,o<=e?(g[u]=o,v[u]=a,++u):(h[i]=T[o],d[i]=a/c,++i);m[e+1]=i,p[e+1]=u}for(t=h.length-1;-1!==t;--t)h[t]=_[h[t]];return{L:l,U:f,P:T,Pinv:_}},numeric.ccsLUP=numeric.ccsLUP0,numeric.ccsDim=function(n){return[numeric.sup(n[1])+1,n[0].length-1]},numeric.ccsGetBlock=function(n,r,e){var t=numeric.ccsDim(n),o=t[0],i=t[1];void 0===r?r=numeric.linspace(0,o-1):"number"==typeof r&&(r=[r]),void 0===e?e=numeric.linspace(0,i-1):"number"==typeof e&&(e=[e]);var u,a,c,s,l=r.length,f=e.length,m=numeric.rep([i],0),h=[],d=[],p=[m,h,d],g=n[0],v=n[1],y=n[2],x=numeric.rep([o],0),w=0,b=numeric.rep([o],0);for(a=0;a<f;++a){var T=g[s=e[a]],_=g[s+1];for(u=T;u<_;++u)b[c=v[u]]=1,x[c]=y[u];for(u=0;u<l;++u)b[r[u]]&&(h[w]=u,d[w]=x[r[u]],++w);for(u=T;u<_;++u)b[c=v[u]]=0;m[a+1]=w}return p},numeric.ccsDot=function(n,r){var e,t,o,i,u,a,c,s,l,f,m,h=n[0],d=n[1],p=n[2],g=r[0],v=r[1],y=r[2],x=numeric.ccsDim(n),w=numeric.ccsDim(r),b=x[0],T=(x[1],w[1]),_=numeric.rep([b],0),k=numeric.rep([b],0),M=Array(b),A=numeric.rep([T],0),S=[],P=[],C=[A,S,P];for(o=0;o!==T;++o){for(i=g[o],u=g[o+1],l=0,t=i;t<u;++t)for(f=v[t],m=y[t],a=h[f],c=h[f+1],e=a;e<c;++e)0===k[s=d[e]]&&(M[l]=s,k[s]=1,l+=1),_[s]=_[s]+p[e]*m;for(u=(i=A[o])+l,A[o+1]=u,t=l-1;-1!==t;--t)m=i+t,e=M[t],S[m]=e,P[m]=_[e],k[e]=0,_[e]=0;A[o+1]=A[o]+l}return C},numeric.ccsLUPSolve=function(n,r){var e=n.L,t=n.U,o=(n.P,r[0]),i=!1;"object"!=typeof o&&(o=(r=[[0,r.length],numeric.linspace(0,r.length-1),r])[0],i=!0);var u,a,c,s,l,f,m=r[1],h=r[2],d=e[0].length-1,p=o.length-1,g=numeric.rep([d],0),v=Array(d),y=numeric.rep([d],0),x=Array(d),w=numeric.rep([p+1],0),b=[],T=[],_=numeric.ccsTSolve,k=0;for(u=0;u<p;++u){for(l=0,c=o[u],s=o[u+1],a=c;a<s;++a)f=n.Pinv[m[a]],x[l]=f,y[f]=h[a],++l;for(x.length=l,_(e,y,g,x,v),a=x.length-1;-1!==a;--a)y[x[a]]=0;if(_(t,g,y,v,x),i)return y;for(a=v.length-1;-1!==a;--a)g[v[a]]=0;for(a=x.length-1;-1!==a;--a)f=x[a],b[k]=f,T[k]=y[f],y[f]=0,++k;w[u+1]=k}return[w,b,T]},numeric.ccsbinop=function(n,r){return void 0===r&&(r=""),Function("X","Y","var Xi = X[0], Xj = X[1], Xv = X[2];\nvar Yi = Y[0], Yj = Y[1], Yv = Y[2];\nvar n = Xi.length-1,m = Math.max(numeric.sup(Xj),numeric.sup(Yj))+1;\nvar Zi = numeric.rep([n+1],0), Zj = [], Zv = [];\nvar x = numeric.rep([m],0),y = numeric.rep([m],0);\nvar xk,yk,zk;\nvar i,j,j0,j1,k,p=0;\n"+r+"for(i=0;i<n;++i) {\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Xj[j];\n x[k] = 1;\n Zj[p] = k;\n ++p;\n }\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Yj[j];\n y[k] = Yv[j];\n if(x[k] === 0) {\n Zj[p] = k;\n ++p;\n }\n }\n Zi[i+1] = p;\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = Xv[j];\n j0 = Zi[i]; j1 = Zi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Zj[j];\n xk = x[k];\n yk = y[k];\n"+n+"\n Zv[j] = zk;\n }\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = 0;\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) y[Yj[j]] = 0;\n}\nreturn [Zi,Zj,Zv];")},function(){var k,A,B,C;for(k in numeric.ops2)A=isFinite(eval("1"+numeric.ops2[k]+"0"))?"[Y[0],Y[1],numeric."+k+"(X,Y[2])]":"NaN",B=isFinite(eval("0"+numeric.ops2[k]+"1"))?"[X[0],X[1],numeric."+k+"(X[2],Y)]":"NaN",C=isFinite(eval("1"+numeric.ops2[k]+"0"))&&isFinite(eval("0"+numeric.ops2[k]+"1"))?"numeric.ccs"+k+"MM(X,Y)":"NaN",numeric["ccs"+k+"MM"]=numeric.ccsbinop("zk = xk "+numeric.ops2[k]+"yk;"),numeric["ccs"+k]=Function("X","Y",'if(typeof X === "number") return '+A+';\nif(typeof Y === "number") return '+B+";\nreturn "+C+";\n")}(),numeric.ccsScatter=function(n){var r,e=n[0],t=n[1],o=n[2],i=numeric.sup(t)+1,u=e.length,a=numeric.rep([i],0),c=Array(u),s=Array(u),l=numeric.rep([i],0);for(r=0;r<u;++r)l[t[r]]++;for(r=0;r<i;++r)a[r+1]=a[r]+l[r];var f,m,h=a.slice(0);for(r=0;r<u;++r)c[f=h[m=t[r]]]=e[r],s[f]=o[r],h[m]=h[m]+1;return[a,c,s]},numeric.ccsGather=function(n){var r,e,t,o,i,u=n[0],a=n[1],c=n[2],s=u.length-1,l=a.length,f=Array(l),m=Array(l),h=Array(l);for(i=0,r=0;r<s;++r)for(t=u[r],o=u[r+1],e=t;e!==o;++e)m[i]=r,f[i]=a[e],h[i]=c[e],++i;return[f,m,h]},numeric.sdim=function n(r,e,t){if(void 0===e&&(e=[]),"object"!=typeof r)return e;var o;for(o in void 0===t&&(t=0),t in e||(e[t]=0),r.length>e[t]&&(e[t]=r.length),r)r.hasOwnProperty(o)&&n(r[o],e,t+1);return e},numeric.sclone=function n(r,e,t){void 0===e&&(e=0),void 0===t&&(t=numeric.sdim(r).length);var o,i=Array(r.length);if(e===t-1){for(o in r)r.hasOwnProperty(o)&&(i[o]=r[o]);return i}for(o in r)r.hasOwnProperty(o)&&(i[o]=n(r[o],e+1,t));return i},numeric.sdiag=function(n){var r,e,t=n.length,o=Array(t);for(r=t-1;r>=1;r-=2)e=r-1,o[r]=[],o[r][r]=n[r],o[e]=[],o[e][e]=n[e];return 0===r&&(o[0]=[],o[0][0]=n[r]),o},numeric.sidentity=function(n){return numeric.sdiag(numeric.rep([n],1))},numeric.stranspose=function(n){var r,e,t,o=[];for(r in n.length,n)if(n.hasOwnProperty(r))for(e in t=n[r])t.hasOwnProperty(e)&&("object"!=typeof o[e]&&(o[e]=[]),o[e][r]=t[e]);return o},numeric.sLUP=function(n,r){throw new Error("The function numeric.sLUP had a bug in it and has been removed. Please use the new numeric.ccsLUP function instead.")},numeric.sdotMM=function(n,r){var e,t,o,i,u,a,c,s=n.length,l=(r.length,numeric.stranspose(r)),f=l.length,m=Array(s);for(o=s-1;o>=0;o--){for(c=[],e=n[o],u=f-1;u>=0;u--){for(i in a=0,t=l[u],e)e.hasOwnProperty(i)&&i in t&&(a+=e[i]*t[i]);a&&(c[u]=a)}m[o]=c}return m},numeric.sdotMV=function(n,r){var e,t,o,i,u=n.length,a=Array(u);for(t=u-1;t>=0;t--){for(o in i=0,e=n[t])e.hasOwnProperty(o)&&r[o]&&(i+=e[o]*r[o]);i&&(a[t]=i)}return a},numeric.sdotVM=function(n,r){var e,t,o,i,u=[];for(e in n)if(n.hasOwnProperty(e))for(t in o=r[e],i=n[e],o)o.hasOwnProperty(t)&&(u[t]||(u[t]=0),u[t]+=i*o[t]);return u},numeric.sdotVV=function(n,r){var e,t=0;for(e in n)n[e]&&r[e]&&(t+=n[e]*r[e]);return t},numeric.sdot=function(n,r){var e=numeric.sdim(n).length,t=numeric.sdim(r).length;switch(1e3*e+t){case 0:return n*r;case 1001:return numeric.sdotVV(n,r);case 2001:return numeric.sdotMV(n,r);case 1002:return numeric.sdotVM(n,r);case 2002:return numeric.sdotMM(n,r);default:throw new Error("numeric.sdot not implemented for tensors of order "+e+" and "+t)}},numeric.sscatter=function(n){var r,e,t,o,i=n[0].length,u=n.length,a=[];for(e=i-1;e>=0;--e)if(n[u-1][e]){for(o=a,t=0;t<u-2;t++)o[r=n[t][e]]||(o[r]=[]),o=o[r];o[n[t][e]]=n[t+1][e]}return a},numeric.sgather=function n(r,e,t){var o,i,u;for(i in void 0===e&&(e=[]),void 0===t&&(t=[]),o=t.length,r)if(r.hasOwnProperty(i))if(t[o]=parseInt(i),"number"==typeof(u=r[i])){if(u){if(0===e.length)for(i=o+1;i>=0;--i)e[i]=[];for(i=o;i>=0;--i)e[i].push(t[i]);e[o+1].push(u)}}else n(u,e,t);return t.length>o&&t.pop(),e},numeric.cLU=function(n){var r,e,t,o,i,u,a=n[0],c=n[1],s=n[2],l=a.length,f=0;for(r=0;r<l;r++)a[r]>f&&(f=a[r]);f++;var m,h=Array(f),d=Array(f),p=numeric.rep([f],1/0),g=numeric.rep([f],-1/0);for(t=0;t<l;t++)r=a[t],(e=c[t])<p[r]&&(p[r]=e),e>g[r]&&(g[r]=e);for(r=0;r<f-1;r++)g[r]>g[r+1]&&(g[r+1]=g[r]);for(r=f-1;r>=1;r--)p[r]<p[r-1]&&(p[r-1]=p[r]);for(r=0;r<f;r++)d[r]=numeric.rep([g[r]-p[r]+1],0),h[r]=numeric.rep([r-p[r]],0),p[r],g[r];for(t=0;t<l;t++)d[r=a[t]][c[t]-p[r]]=s[t];for(r=0;r<f-1;r++)for(o=r-p[r],x=d[r],e=r+1;p[e]<=r&&e<f;e++)if(i=r-p[e],u=g[r]-r,m=(w=d[e])[i]/x[o]){for(t=1;t<=u;t++)w[t+i]-=m*x[t+o];h[e][r-p[e]]=m}var v,y,x=[],w=[],b=[],T=[],_=[],k=[];for(l=0,v=0,r=0;r<f;r++){for(o=p[r],i=g[r],y=d[r],e=r;e<=i;e++)y[e-o]&&(x[l]=r,w[l]=e,b[l]=y[e-o],l++);for(y=h[r],e=o;e<r;e++)y[e-o]&&(T[v]=r,_[v]=e,k[v]=y[e-o],v++);T[v]=r,_[v]=r,k[v]=1,v++}return{U:[x,w,b],L:[T,_,k]}},numeric.cLUsolve=function(n,r){var e,t,o=n.L,i=n.U,u=numeric.clone(r),a=o[0],c=o[1],s=o[2],l=i[0],f=i[1],m=i[2],h=l.length,d=(a.length,u.length);for(t=0,e=0;e<d;e++){for(;c[t]<e;)u[e]-=s[t]*u[c[t]],t++;t++}for(t=h-1,e=d-1;e>=0;e--){for(;f[t]>e;)u[e]-=m[t]*u[f[t]],t--;u[e]/=m[t],t--}return u},numeric.cgrid=function(n,r){"number"==typeof n&&(n=[n,n]);var e,t,o,i=numeric.rep(n,-1);for("function"!=typeof r&&(r="L"===r?function(r,e){return r>=n[0]/2||e<n[1]/2}:function(n,r){return!0}),o=0,e=1;e<n[0]-1;e++)for(t=1;t<n[1]-1;t++)r(e,t)&&(i[e][t]=o,o++);return i},numeric.cdelsq=function(n){var r,e,t,o,i,u=[[-1,0],[0,-1],[0,1],[1,0]],a=numeric.dim(n),c=a[0],s=a[1],l=[],f=[],m=[];for(r=1;r<c-1;r++)for(e=1;e<s-1;e++)if(!(n[r][e]<0)){for(t=0;t<4;t++)o=r+u[t][0],i=e+u[t][1],n[o][i]<0||(l.push(n[r][e]),f.push(n[o][i]),m.push(-1));l.push(n[r][e]),f.push(n[r][e]),m.push(4)}return[l,f,m]},numeric.cdotMV=function(n,r){var e,t,o,i=n[0],u=n[1],a=n[2],c=i.length;for(o=0,t=0;t<c;t++)i[t]>o&&(o=i[t]);for(o++,e=numeric.rep([o],0),t=0;t<c;t++)e[i[t]]+=a[t]*r[u[t]];return e},numeric.Spline=function(n,r,e,t,o){this.x=n,this.yl=r,this.yr=e,this.kl=t,this.kr=o},numeric.Spline.prototype._at=function(n,r){var e,t,o,i=this.x,u=this.yl,a=this.yr,c=this.kl,s=this.kr,l=numeric.add,f=numeric.sub,m=numeric.mul;e=f(m(c[r],i[r+1]-i[r]),f(a[r+1],u[r])),t=l(m(s[r+1],i[r]-i[r+1]),f(a[r+1],u[r]));var h=(o=(n-i[r])/(i[r+1]-i[r]))*(1-o);return l(l(l(m(1-o,u[r]),m(o,a[r+1])),m(e,h*(1-o))),m(t,h*o))},numeric.Spline.prototype.at=function(n){if("number"==typeof n){var r,e,t,o=this.x,i=o.length,u=Math.floor;for(r=0,e=i-1;e-r>1;)o[t=u((r+e)/2)]<=n?r=t:e=t;return this._at(n,r)}i=n.length;var a,c=Array(i);for(a=i-1;-1!==a;--a)c[a]=this.at(n[a]);return c},numeric.Spline.prototype.diff=function(){var n,r,e,t=this.x,o=this.yl,i=this.yr,u=this.kl,a=this.kr,c=o.length,s=u,l=a,f=Array(c),m=Array(c),h=numeric.add,d=numeric.mul,p=numeric.div,g=numeric.sub;for(n=c-1;-1!==n;--n)r=t[n+1]-t[n],e=g(i[n+1],o[n]),f[n]=p(h(d(e,6),d(u[n],-4*r),d(a[n+1],-2*r)),r*r),m[n+1]=p(h(d(e,-6),d(u[n],2*r),d(a[n+1],4*r)),r*r);return new numeric.Spline(t,s,l,f,m)},numeric.Spline.prototype.roots=function(){var n=[],r=this.x,e=this.yl,t=this.yr,o=this.kl,i=this.kr;"number"==typeof e[0]&&(e=[e],t=[t],o=[o],i=[i]);var u,a,c,s,l,f,m,h,d,p,g,v,y,x,w,b,T,_,k,M,A,S,P,C,q=e.length,N=r.length-1,j=(n=Array(q),Math.sqrt);for(u=0;u!==q;++u){for(s=e[u],l=t[u],f=o[u],m=i[u],h=[],a=0;a!==N;a++){for(a>0&&l[a]*s[a]<0&&h.push(r[a]),b=r[a+1]-r[a],r[a],g=s[a],v=l[a+1],d=f[a]/b,y=(p=m[a+1]/b)+3*g+2*d-3*v,x=3*(p+d+2*(g-v)),(w=(C=d-p+3*(g-v))*C+12*p*g)<=0?T=(_=y/x)>r[a]&&_<r[a+1]?[r[a],_,r[a+1]]:[r[a],r[a+1]]:(_=(y-j(w))/x,k=(y+j(w))/x,T=[r[a]],_>r[a]&&_<r[a+1]&&T.push(_),k>r[a]&&k<r[a+1]&&T.push(k),T.push(r[a+1])),A=T[0],_=this._at(A,a),c=0;c<T.length-1;c++)if(S=T[c+1],k=this._at(S,a),0!==_)if(0===k||_*k>0)A=S,_=k;else{for(var O=0;!((P=(_*S-k*A)/(_-k))<=A||P>=S);)if((M=this._at(P,a))*k>0)S=P,k=M,-1===O&&(_*=.5),O=-1;else{if(!(M*_>0))break;A=P,_=M,1===O&&(k*=.5),O=1}h.push(P),A=T[c+1],_=this._at(A,a)}else h.push(A),A=S,_=k;0===k&&h.push(S)}n[u]=h}return"number"==typeof this.yl[0]?n[0]:n},numeric.spline=function(n,r,e,t){var o,i=n.length,u=[],a=[],c=[],s=numeric.sub,l=numeric.mul,f=numeric.add;for(o=i-2;o>=0;o--)a[o]=n[o+1]-n[o],c[o]=s(r[o+1],r[o]);"string"!=typeof e&&"string"!=typeof t||(e=t="periodic");var m=[[],[],[]];switch(typeof e){case"undefined":u[0]=l(3/(a[0]*a[0]),c[0]),m[0].push(0,0),m[1].push(0,1),m[2].push(2/a[0],1/a[0]);break;case"string":u[0]=f(l(3/(a[i-2]*a[i-2]),c[i-2]),l(3/(a[0]*a[0]),c[0])),m[0].push(0,0,0),m[1].push(i-2,0,1),m[2].push(1/a[i-2],2/a[i-2]+2/a[0],1/a[0]);break;default:u[0]=e,m[0].push(0),m[1].push(0),m[2].push(1)}for(o=1;o<i-1;o++)u[o]=f(l(3/(a[o-1]*a[o-1]),c[o-1]),l(3/(a[o]*a[o]),c[o])),m[0].push(o,o,o),m[1].push(o-1,o,o+1),m[2].push(1/a[o-1],2/a[o-1]+2/a[o],1/a[o]);switch(typeof t){case"undefined":u[i-1]=l(3/(a[i-2]*a[i-2]),c[i-2]),m[0].push(i-1,i-1),m[1].push(i-2,i-1),m[2].push(1/a[i-2],2/a[i-2]);break;case"string":m[1][m[1].length-1]=0;break;default:u[i-1]=t,m[0].push(i-1),m[1].push(i-1),m[2].push(1)}u="number"!=typeof u[0]?numeric.transpose(u):[u];var h=Array(u.length);if("string"==typeof e)for(o=h.length-1;-1!==o;--o)h[o]=numeric.ccsLUPSolve(numeric.ccsLUP(numeric.ccsScatter(m)),u[o]),h[o][i-1]=h[o][0];else for(o=h.length-1;-1!==o;--o)h[o]=numeric.cLUsolve(numeric.cLU(m),u[o]);return h="number"==typeof r[0]?h[0]:numeric.transpose(h),new numeric.Spline(n,r,r,h,h)},numeric.fftpow2=function n(r,e){var t=r.length;if(1!==t){var o,i,u=Math.cos,a=Math.sin,c=Array(t/2),s=Array(t/2),l=Array(t/2),f=Array(t/2);for(i=t/2,o=t-1;-1!==o;--o)l[--i]=r[o],f[i]=e[o],--o,c[i]=r[o],s[i]=e[o];n(c,s),n(l,f),i=t/2;var m,h,d,p=-6.283185307179586/t;for(o=t-1;-1!==o;--o)-1==--i&&(i=t/2-1),h=u(m=p*o),d=a(m),r[o]=c[i]+h*l[i]-d*f[i],e[o]=s[i]+h*f[i]+d*l[i]}},numeric._ifftpow2=function n(r,e){var t=r.length;if(1!==t){var o,i,u=Math.cos,a=Math.sin,c=Array(t/2),s=Array(t/2),l=Array(t/2),f=Array(t/2);for(i=t/2,o=t-1;-1!==o;--o)l[--i]=r[o],f[i]=e[o],--o,c[i]=r[o],s[i]=e[o];n(c,s),n(l,f),i=t/2;var m,h,d,p=6.283185307179586/t;for(o=t-1;-1!==o;--o)-1==--i&&(i=t/2-1),h=u(m=p*o),d=a(m),r[o]=c[i]+h*l[i]-d*f[i],e[o]=s[i]+h*f[i]+d*l[i]}},numeric.ifftpow2=function(n,r){numeric._ifftpow2(n,r),numeric.diveq(n,n.length),numeric.diveq(r,r.length)},numeric.convpow2=function(n,r,e,t){var o,i,u,a,c;for(numeric.fftpow2(n,r),numeric.fftpow2(e,t),o=n.length-1;-1!==o;--o)i=n[o],a=r[o],u=e[o],c=t[o],n[o]=i*u-a*c,r[o]=i*c+a*u;numeric.ifftpow2(n,r)},numeric.T.prototype.fft=function(){var n,r,e=this.x,t=this.y,o=e.length,i=Math.log,u=i(2),a=Math.ceil(i(2*o-1)/u),c=Math.pow(2,a),s=numeric.rep([c],0),l=numeric.rep([c],0),f=Math.cos,m=Math.sin,h=-3.141592653589793/o,d=numeric.rep([c],0),p=numeric.rep([c],0);for(Math.floor(o/2),n=0;n<o;n++)d[n]=e[n];if(void 0!==t)for(n=0;n<o;n++)p[n]=t[n];for(s[0]=1,n=1;n<=c/2;n++)r=h*n*n,s[n]=f(r),l[n]=m(r),s[c-n]=f(r),l[c-n]=m(r);var g=new numeric.T(d,p),v=new numeric.T(s,l);return g=g.mul(v),numeric.convpow2(g.x,g.y,numeric.clone(v.x),numeric.neg(v.y)),(g=g.mul(v)).x.length=o,g.y.length=o,g},numeric.T.prototype.ifft=function(){var n,r,e=this.x,t=this.y,o=e.length,i=Math.log,u=i(2),a=Math.ceil(i(2*o-1)/u),c=Math.pow(2,a),s=numeric.rep([c],0),l=numeric.rep([c],0),f=Math.cos,m=Math.sin,h=3.141592653589793/o,d=numeric.rep([c],0),p=numeric.rep([c],0);for(Math.floor(o/2),n=0;n<o;n++)d[n]=e[n];if(void 0!==t)for(n=0;n<o;n++)p[n]=t[n];for(s[0]=1,n=1;n<=c/2;n++)r=h*n*n,s[n]=f(r),l[n]=m(r),s[c-n]=f(r),l[c-n]=m(r);var g=new numeric.T(d,p),v=new numeric.T(s,l);return g=g.mul(v),numeric.convpow2(g.x,g.y,numeric.clone(v.x),numeric.neg(v.y)),(g=g.mul(v)).x.length=o,g.y.length=o,g.div(o)},numeric.gradient=function(n,r){var e=r.length,t=n(r);if(isNaN(t))throw new Error("gradient: f(x) is a NaN!");var o,i,u,a,c,s,l,f,m,h=Math.max,d=numeric.clone(r),p=Array(e),g=(numeric.div,numeric.sub,h=Math.max,Math.abs),v=Math.min,y=0;for(o=0;o<e;o++)for(var x=h(1e-6*t,1e-8);;){if(++y>20)throw new Error("Numerical gradient fails");if(d[o]=r[o]+x,i=n(d),d[o]=r[o]-x,u=n(d),d[o]=r[o],isNaN(i)||isNaN(u))x/=16;else{if(p[o]=(i-u)/(2*x),a=r[o]-x,c=r[o],s=r[o]+x,l=(i-t)/x,f=(t-u)/x,m=h(g(p[o]),g(t),g(i),g(u),g(a),g(c),g(s),1e-8),!(v(h(g(l-p[o]),g(f-p[o]),g(l-f))/m,x/m)>.001))break;x/=16}}return p},numeric.uncmin=function(n,r,e,t,o,i,u){var a=numeric.gradient;void 0===u&&(u={}),void 0===e&&(e=1e-8),void 0===t&&(t=function(r){return a(n,r)}),void 0===o&&(o=1e3);var c,s,l=(r=numeric.clone(r)).length,f=n(r);if(isNaN(f))throw new Error("uncmin: f(x0) is a NaN!");var m=Math.max,h=numeric.norm2;e=m(e,numeric.epsilon);var d,p,g,v,y,x,w,b,T,_,k=u.Hinv||numeric.identity(l),M=numeric.dot,A=(numeric.inv,numeric.sub),S=numeric.add,P=numeric.tensor,C=numeric.div,q=numeric.mul,N=numeric.all,j=numeric.isFinite,O=numeric.neg,E=0,L="";for(p=t(r);E<o;){if("function"==typeof i&&i(E,r,f,p,k)){L="Callback returned true";break}if(!N(j(p))){L="Gradient has Infinity or NaN";break}if(!N(j(d=O(M(k,p))))){L="Search direction has Infinity or NaN";break}if((_=h(d))<e){L="Newton step smaller than tol";break}for(T=1,s=M(p,d),y=r;E<o&&!(T*_<e)&&(y=S(r,v=q(d,T)),(c=n(y))-f>=.1*T*s||isNaN(c));)T*=.5,++E;if(T*_<e){L="Line search step size smaller than tol";break}if(E===o){L="maxit reached during line search";break}b=M(x=A(g=t(y),p),v),w=M(k,x),k=A(S(k,q((b+M(x,w))/(b*b),P(v,v))),C(S(P(w,v),P(v,w)),b)),r=y,f=c,p=g,++E}return{solution:r,f,gradient:p,invHessian:k,iterations:E,message:L}},numeric.Dopri=function(n,r,e,t,o,i,u){this.x=n,this.y=r,this.f=e,this.ymid=t,this.iterations=o,this.events=u,this.message=i},numeric.Dopri.prototype._at=function(n,r){function e(n){return n*n}var t,o,i,u,a,c,s,l,f,m=this,h=m.x,d=m.y,p=m.f,g=m.ymid,v=(h.length,Math.floor,numeric.add),y=numeric.mul,x=numeric.sub;return t=h[r],o=h[r+1],u=d[r],a=d[r+1],i=t+.5*(o-t),c=g[r],s=x(p[r],y(u,1/(t-i)+2/(t-o))),l=x(p[r+1],y(a,1/(o-i)+2/(o-t))),v(v(v(v(y(u,(f=[e(n-o)*(n-i)/e(t-o)/(t-i),e(n-t)*e(n-o)/e(t-i)/e(o-i),e(n-t)*(n-i)/e(o-t)/(o-i),(n-t)*e(n-o)*(n-i)/e(t-o)/(t-i),(n-o)*e(n-t)*(n-i)/e(t-o)/(o-i)])[0]),y(c,f[1])),y(a,f[2])),y(s,f[3])),y(l,f[4]))},numeric.Dopri.prototype.at=function(n){var r,e,t,o=Math.floor;if("number"!=typeof n){var i=n.length,u=Array(i);for(r=i-1;-1!==r;--r)u[r]=this.at(n[r]);return u}var a=this.x;for(r=0,e=a.length-1;e-r>1;)a[t=o(.5*(r+e))]<=n?r=t:e=t;return this._at(n,r)},numeric.dopri=function(n,r,e,t,o,i,u){void 0===o&&(o=1e-6),void 0===i&&(i=1e3);var a,c,s,l,f,m,h,d,p,g,v,y,x,w=[n],b=[e],T=[t(n,e)],_=[],k=[.075,.225],M=[44/45,-56/15,32/9],A=[19372/6561,-25360/2187,64448/6561,-212/729],S=[9017/3168,-355/33,46732/5247,49/176,-5103/18656],P=[35/384,0,500/1113,125/192,-2187/6784,11/84],C=[.10013431883002395,0,.3918321794184259,-.02982460176594817,.05893268337240795,-.04497888809104361,.023904308236133973],q=[.2,.3,.8,8/9,1,1],N=[-71/57600,0,71/16695,-71/1920,17253/339200,-22/525,.025],j=0,O=(r-n)/10,E=0,L=numeric.add,Y=numeric.mul,I=(Math.max,Math.min),F=Math.abs,R=numeric.norminf,V=Math.pow,X=numeric.any,B=numeric.lt,D=numeric.and,U=(numeric.sub,new numeric.Dopri(w,b,T,_,-1,""));for("function"==typeof u&&(v=u(n,e));n<r&&E<i;)if(++E,n+O>r&&(O=r-n),a=t(n+q[0]*O,L(e,Y(.2*O,T[j]))),c=t(n+q[1]*O,L(L(e,Y(k[0]*O,T[j])),Y(k[1]*O,a))),s=t(n+q[2]*O,L(L(L(e,Y(M[0]*O,T[j])),Y(M[1]*O,a)),Y(M[2]*O,c))),l=t(n+q[3]*O,L(L(L(L(e,Y(A[0]*O,T[j])),Y(A[1]*O,a)),Y(A[2]*O,c)),Y(A[3]*O,s))),f=t(n+q[4]*O,L(L(L(L(L(e,Y(S[0]*O,T[j])),Y(S[1]*O,a)),Y(S[2]*O,c)),Y(S[3]*O,s)),Y(S[4]*O,l))),m=t(n+O,p=L(L(L(L(L(e,Y(T[j],O*P[0])),Y(c,O*P[2])),Y(s,O*P[3])),Y(l,O*P[4])),Y(f,O*P[5]))),(g="number"==typeof(h=L(L(L(L(L(Y(T[j],O*N[0]),Y(c,O*N[2])),Y(s,O*N[3])),Y(l,O*N[4])),Y(f,O*N[5])),Y(m,O*N[6])))?F(h):R(h))>o){if(n+(O=.2*O*V(o/g,.25))===n){U.msg="Step size became too small";break}}else{if(_[j]=L(L(L(L(L(L(e,Y(T[j],O*C[0])),Y(c,O*C[2])),Y(s,O*C[3])),Y(l,O*C[4])),Y(f,O*C[5])),Y(m,O*C[6])),w[++j]=n+O,b[j]=p,T[j]=m,"function"==typeof u){var G,$,W=n,z=n+.5*O;if(y=u(z,_[j-1]),X(x=D(B(v,0),B(0,y)))||(W=z,v=y,y=u(z=n+O,p),x=D(B(v,0),B(0,y))),X(x)){for(var H,K,Q=0,Z=1,J=1;;){if("number"==typeof v)$=(J*y*W-Z*v*z)/(J*y-Z*v);else for($=z,d=v.length-1;-1!==d;--d)v[d]<0&&y[d]>0&&($=I($,(J*y[d]*W-Z*v[d]*z)/(J*y[d]-Z*v[d])));if($<=W||$>=z)break;K=u($,G=U._at($,j-1)),X(H=D(B(v,0),B(0,K)))?(z=$,y=K,x=H,J=1,-1===Q?Z*=.5:Z=1,Q=-1):(W=$,v=K,Z=1,1===Q?J*=.5:J=1,Q=1)}return p=U._at(.5*(n+$),j-1),U.f[j]=t($,G),U.x[j]=$,U.y[j]=G,U.ymid[j-1]=p,U.events=x,U.iterations=E,U}}n+=O,e=p,v=y,O=I(.8*O*V(o/g,.25),4*O)}return U.iterations=E,U},numeric.LU=function(n,r){r=r||!1;var e,t,o,i,u,a,c,s,l,f=Math.abs,m=n.length,h=m-1,d=new Array(m);for(r||(n=numeric.clone(n)),o=0;o<m;++o){for(c=o,l=f((a=n[o])[o]),t=o+1;t<m;++t)l<(i=f(n[t][o]))&&(l=i,c=t);for(d[o]=c,c!=o&&(n[o]=n[c],n[c]=a,a=n[o]),u=a[o],e=o+1;e<m;++e)n[e][o]/=u;for(e=o+1;e<m;++e){for(s=n[e],t=o+1;t<h;++t)s[t]-=s[o]*a[t],s[++t]-=s[o]*a[t];t===h&&(s[t]-=s[o]*a[t])}}return{LU:n,P:d}},numeric.LUsolve=function(n,r){var e,t,o,i,u,a=n.LU,c=a.length,s=numeric.clone(r),l=n.P;for(e=c-1;-1!==e;--e)s[e]=r[e];for(e=0;e<c;++e)for(o=l[e],l[e]!==e&&(u=s[e],s[e]=s[o],s[o]=u),i=a[e],t=0;t<e;++t)s[e]-=s[t]*i[t];for(e=c-1;e>=0;--e){for(i=a[e],t=e+1;t<c;++t)s[e]-=s[t]*i[t];s[e]/=i[e]}return s},numeric.solve=function(n,r,e){return numeric.LUsolve(numeric.LU(n,e),r)},numeric.echelonize=function(n){var r,e,t,o,i,u,a,c,s=numeric.dim(n),l=s[0],f=s[1],m=numeric.identity(l),h=Array(l),d=Math.abs,p=numeric.diveq;for(n=numeric.clone(n),r=0;r<l;++r){for(t=0,i=n[r],u=m[r],e=1;e<f;++e)d(i[t])<d(i[e])&&(t=e);for(h[r]=t,p(u,i[t]),p(i,i[t]),e=0;e<l;++e)if(e!==r){for(c=(a=n[e])[t],o=f-1;-1!==o;--o)a[o]-=i[o]*c;for(a=m[e],o=l-1;-1!==o;--o)a[o]-=u[o]*c}}return{I:m,A:n,P:h}},numeric.__solveLP=function(n,r,e,t,o,i,u){var a,c,s,l,f=numeric.sum,m=(numeric.log,numeric.mul),h=numeric.sub,d=numeric.dot,p=numeric.div,g=numeric.add,v=n.length,y=e.length,x=!1,w=1,b=(numeric.transpose(r),numeric.svd,numeric.transpose),T=(numeric.leq,Math.sqrt),_=Math.abs,k=(numeric.muleq,numeric.norminf,numeric.any,Math.min),M=numeric.all,A=numeric.gt,S=Array(v),P=Array(y),C=(numeric.rep([y],1),numeric.solve),q=h(e,d(r,i)),N=d(n,n);for(s=0;s<o;++s){var j,O;for(j=y-1;-1!==j;--j)P[j]=p(r[j],q[j]);var E=b(P);for(j=v-1;-1!==j;--j)S[j]=f(E[j]);w=.25*_(N/d(n,S));var L=100*T(N/d(S,S));for((!isFinite(w)||w>L)&&(w=L),l=g(n,m(w,S)),c=d(E,P),j=v-1;-1!==j;--j)c[j][j]+=1;O=C(c,p(l,w),!0);var Y=p(q,d(r,O)),I=1;for(j=y-1;-1!==j;--j)Y[j]<0&&(I=k(I,-.999*Y[j]));if(a=h(i,m(O,I)),!M(A(q=h(e,d(r,a)),0)))return{solution:i,message:"",iterations:s};if(i=a,w<t)return{solution:a,message:"",iterations:s};if(u){var F=d(n,l),R=d(r,l);for(x=!0,j=y-1;-1!==j;--j)if(F*R[j]<0){x=!1;break}}else x=!(i[v-1]>=0);if(x)return{solution:a,message:"Unbounded",iterations:s}}return{solution:i,message:"maximum iteration count exceeded",iterations:s}},numeric._solveLP=function(n,r,e,t,o){var i=n.length,u=e.length,a=(numeric.sum,numeric.log,numeric.mul,numeric.sub),c=numeric.dot,s=(numeric.div,numeric.add,numeric.rep([i],0).concat([1])),l=numeric.rep([u,1],-1),f=numeric.blockMatrix([[r,l]]),m=e,h=numeric.rep([i],0).concat(Math.max(0,numeric.sup(numeric.neg(e)))+1),d=numeric.__solveLP(s,f,m,t,o,h,!1),p=numeric.clone(d.solution);if(p.length=i,numeric.inf(a(e,c(r,p)))<0)return{solution:NaN,message:"Infeasible",iterations:d.iterations};var g=numeric.__solveLP(n,r,e,t,o-d.iterations,p,!0);return g.iterations+=d.iterations,g},numeric.solveLP=function(n,r,e,t,o,i,u){if(void 0===u&&(u=1e3),void 0===i&&(i=numeric.epsilon),void 0===t)return numeric._solveLP(n,r,e,i,u);var a,c=t.length,s=t[0].length,l=r.length,f=numeric.echelonize(t),m=numeric.rep([s],0),h=f.P,d=[];for(a=h.length-1;-1!==a;--a)m[h[a]]=1;for(a=s-1;-1!==a;--a)0===m[a]&&d.push(a);var p=numeric.getRange,g=numeric.linspace(0,c-1),v=numeric.linspace(0,l-1),y=p(t,g,d),x=p(r,v,h),w=p(r,v,d),b=numeric.dot,T=numeric.sub,_=b(x,f.I),k=T(w,b(_,y)),M=T(e,b(_,o)),A=Array(h.length),S=Array(d.length);for(a=h.length-1;-1!==a;--a)A[a]=n[h[a]];for(a=d.length-1;-1!==a;--a)S[a]=n[d[a]];var P=T(S,b(A,b(f.I,y))),C=numeric._solveLP(P,k,M,i,u),q=C.solution;if(q!=q)return C;var N=b(f.I,T(o,b(y,q))),j=Array(n.length);for(a=h.length-1;-1!==a;--a)j[h[a]]=N[a];for(a=d.length-1;-1!==a;--a)j[d[a]]=q[a];return{solution:j,message:C.message,iterations:C.iterations}},numeric.MPStoLP=function(n){function r(r){throw new Error("MPStoLP: "+r+"\nLine "+e+": "+n[e]+"\nCurrent state: "+a[u]+"\n")}n instanceof String&&n.split("\n");var e,t,o,i,u=0,a=["Initial state","NAME","ROWS","COLUMNS","RHS","BOUNDS","ENDATA"],c=n.length,s=0,l={},f=[],m=0,h={},d=0,p=[],g=[],v=[];for(e=0;e<c;++e){var y=(o=n[e]).match(/\S*/g),x=[];for(t=0;t<y.length;++t)""!==y[t]&&x.push(y[t]);if(0!==x.length){for(t=0;t<a.length&&o.substr(0,a[t].length)!==a[t];++t);if(t<a.length){if(u=t,1===t&&(i=x[1]),6===t)return{name:i,c:p,A:numeric.transpose(g),b:v,rows:l,vars:h}}else switch(u){case 0:case 1:r("Unexpected line");case 2:switch(x[0]){case"N":0===s?s=x[1]:r("Two or more N rows");break;case"L":l[x[1]]=m,f[m]=1,v[m]=0,++m;break;case"G":l[x[1]]=m,f[m]=-1,v[m]=0,++m;break;case"E":l[x[1]]=m,f[m]=0,v[m]=0,++m;break;default:r("Parse error "+numeric.prettyPrint(x))}break;case 3:h.hasOwnProperty(x[0])||(h[x[0]]=d,p[d]=0,g[d]=numeric.rep([m],0),++d);var w=h[x[0]];for(t=1;t<x.length;t+=2)if(x[t]!==s){var b=l[x[t]];g[w][b]=(f[b]<0?-1:1)*parseFloat(x[t+1])}else p[w]=parseFloat(x[t+1]);break;case 4:for(t=1;t<x.length;t+=2)v[l[x[t]]]=(f[l[x[t]]]<0?-1:1)*parseFloat(x[t+1]);break;case 5:break;case 6:r("Internal error")}}}r("Reached end of file without ENDATA")},numeric.seedrandom={pow:Math.pow,random:Math.random},function(n,r,e,t,o,i,u){function a(n){var r,t,o=this,i=n.length,u=0,a=o.i=o.j=o.m=0;for(o.S=[],o.c=[],i||(n=[i++]);u<e;)o.S[u]=u++;for(u=0;u<e;u++)a=l(a+(r=o.S[u])+n[u%i]),t=o.S[a],o.S[u]=t,o.S[a]=r;o.g=function(n){var r=o.S,t=l(o.i+1),i=r[t],u=l(o.j+i),a=r[u];r[t]=a,r[u]=i;for(var c=r[l(i+a)];--n;)t=l(t+1),a=r[u=l(u+(i=r[t]))],r[t]=a,r[u]=i,c=c*e+r[l(i+a)];return o.i=t,o.j=u,c},o.g(e)}function c(n,r,e,t,o){if(e=[],o=typeof n,r&&"object"==o)for(t in n)if(t.indexOf("S")<5)try{e.push(c(n[t],r-1))}catch(n){}return e.length?e:n+("string"!=o?"\0":"")}function s(n,r,e,t){for(n+="",e=0,t=0;t<n.length;t++)r[l(t)]=l((e^=19*r[l(t)])+n.charCodeAt(t));for(t in n="",r)n+=String.fromCharCode(r[t]);return n}function l(n){return n&e-1}r.seedrandom=function(t,l){var f,m=[];return t=s(c(l?[t,n]:arguments.length?t:[(new Date).getTime(),n,window],3),m),s((f=new a(m)).S,n),r.random=function(){for(var n=f.g(6),r=u,t=0;n<o;)n=(n+t)*e,r*=e,t=f.g(1);for(;n>=i;)n/=2,r/=2,t>>>=1;return(n+t)/r},t},u=r.pow(e,6),o=r.pow(2,o),i=2*o,s(r.random(),n)}([],numeric.seedrandom,256,0,52),function(n){function r(n){if("object"!=typeof n)return n;var e,t=[],o=n.length;for(e=0;e<o;e++)t[e+1]=r(n[e]);return t}function e(n){if("object"!=typeof n)return n;var r,t=[],o=n.length;for(r=1;r<o;r++)t[r-1]=e(n[r]);return t}n.solveQP=function(n,t,o,i,u,a){n=r(n),t=r(t),o=r(o);var c,s,l,f,m,h=[],d=[],p=[],g=[],v=[];if(u=u||0,a=a?r(a):[void 0,0],i=i?r(i):[],s=n.length-1,l=o[1].length-1,!i)for(c=1;c<=l;c+=1)i[c]=0;for(c=1;c<=l;c+=1)d[c]=0;for(f=Math.min(s,l),c=1;c<=s;c+=1)p[c]=0;for(h[1]=0,c=1;c<=2*s+f*(f+5)/2+2*l+1;c+=1)g[c]=0;for(c=1;c<=2;c+=1)v[c]=0;return function(n,r,e,t,o,i,u,a,c,s,l,f,m,h,d,p){function g(){for(h[1]=h[1]+1,_=q,b=1;b<=s;b+=1){for(_+=1,Y=-a[b],T=1;T<=t;T+=1)Y+=u[T][b]*o[T];if(Math.abs(Y)<U&&(Y=0),b>l)d[_]=Y;else if(d[_]=-Math.abs(Y),Y>0){for(T=1;T<=t;T+=1)u[T][b]=-u[T][b];a[b]=-a[b]}}for(b=1;b<=m;b+=1)d[q+f[b]]=0;for(j=0,L=0,b=1;b<=s;b+=1)d[q+b]<L*d[E+b]&&(j=b,L=d[q+b]/d[E+b]);return 0===j?999:0}function v(){for(b=1;b<=t;b+=1){for(Y=0,T=1;T<=t;T+=1)Y+=n[T][b]*u[T][j];d[b]=Y}for(k=S,b=1;b<=t;b+=1)d[k+b]=0;for(T=m+1;T<=t;T+=1)for(b=1;b<=t;b+=1)d[k+b]=d[k+b]+n[b][T]*d[T];for(B=!0,b=m;b>=1;b-=1){for(Y=d[b],k=(_=C+b*(b+3)/2)-b,T=b+1;T<=m;T+=1)Y-=d[_]*d[P+T],_+=T;if(Y/=d[k],d[P+b]=Y,f[b]<l)break;if(Y<0)break;B=!1,A=b}if(!B)for(I=d[N+A]/d[P+A],b=1;b<=m&&!(f[b]<l)&&!(d[P+b]<0);b+=1)(L=d[N+b]/d[P+b])<I&&(I=L,A=b);for(Y=0,b=S+1;b<=S+t;b+=1)Y+=d[b]*d[b];if(Math.abs(Y)<=U){if(B)return p[1]=1,999;for(b=1;b<=m;b+=1)d[N+b]=d[N+b]-I*d[P+b];return d[N+m+1]=d[N+m+1]+I,700}for(Y=0,b=1;b<=t;b+=1)Y+=d[S+b]*u[b][j];for(F=-d[q+j]/Y,D=!0,B||I<F&&(F=I,D=!1),b=1;b<=t;b+=1)o[b]=o[b]+F*d[S+b],Math.abs(o[b])<U&&(o[b]=0);for(i[1]=i[1]+F*Y*(F/2+d[N+m+1]),b=1;b<=m;b+=1)d[N+b]=d[N+b]-F*d[P+b];if(d[N+m+1]=d[N+m+1]+F,!D){for(Y=-a[j],T=1;T<=t;T+=1)Y+=o[T]*u[T][j];if(j>l)d[q+j]=Y;else if(d[q+j]=-Math.abs(Y),Y>0){for(T=1;T<=t;T+=1)u[T][j]=-u[T][j];a[j]=-a[j]}return 700}for(f[m+=1]=j,_=C+(m-1)*m/2+1,b=1;b<=m-1;b+=1)d[_]=d[b],_+=1;if(m===t)d[_]=d[t];else{for(b=t;b>=m+1&&0!==d[b]&&(R=Math.max(Math.abs(d[b-1]),Math.abs(d[b])),V=Math.min(Math.abs(d[b-1]),Math.abs(d[b])),L=d[b-1]>=0?Math.abs(R*Math.sqrt(1+V*V/(R*R))):-Math.abs(R*Math.sqrt(1+V*V/(R*R))),R=d[b-1]/L,V=d[b]/L,1!==R);b-=1)if(0===R)for(d[b-1]=V*L,T=1;T<=t;T+=1)L=n[T][b-1],n[T][b-1]=n[T][b],n[T][b]=L;else for(d[b-1]=L,X=V/(1+R),T=1;T<=t;T+=1)L=R*n[T][b-1]+V*n[T][b],n[T][b]=X*(n[T][b-1]+L)-n[T][b],n[T][b-1]=L;d[_]=d[m]}return 0}function y(){if(0===d[k=(_=C+A*(A+1)/2+1)+A])return 798;if(R=Math.max(Math.abs(d[k-1]),Math.abs(d[k])),V=Math.min(Math.abs(d[k-1]),Math.abs(d[k])),L=d[k-1]>=0?Math.abs(R*Math.sqrt(1+V*V/(R*R))):-Math.abs(R*Math.sqrt(1+V*V/(R*R))),R=d[k-1]/L,V=d[k]/L,1===R)return 798;if(0===R){for(b=A+1;b<=m;b+=1)L=d[k-1],d[k-1]=d[k],d[k]=L,k+=b;for(b=1;b<=t;b+=1)L=n[b][A],n[b][A]=n[b][A+1],n[b][A+1]=L}else{for(X=V/(1+R),b=A+1;b<=m;b+=1)L=R*d[k-1]+V*d[k],d[k]=X*(d[k-1]+L)-d[k],d[k-1]=L,k+=b;for(b=1;b<=t;b+=1)L=R*n[b][A]+V*n[b][A+1],n[b][A+1]=X*(n[b][A]+L)-n[b][A+1],n[b][A]=L}return 0}function x(){for(k=_-A,b=1;b<=A;b+=1)d[k]=d[_],_+=1,k+=1;return d[N+A]=d[N+A+1],f[A]=f[A+1],(A+=1)<m?797:0}function w(){return d[N+m]=d[N+m+1],d[N+m+1]=0,f[m]=0,m-=1,h[2]=h[2]+1,0}var b,T,_,k,M,A,S,P,C,q,N,j,O,E,L,Y,I,F,R,V,X,B,D,U,G,$,W;O=Math.min(t,s),_=2*t+O*(O+5)/2+2*s+1,U=1e-60;do{G=1+.1*(U+=U),$=1+.2*U}while(G<=1||$<=1);for(b=1;b<=t;b+=1)d[b]=r[b];for(b=t+1;b<=_;b+=1)d[b]=0;for(b=1;b<=s;b+=1)f[b]=0;if(M=[],0===p[1]){if(function(n,r,e,t){var o,i,u,a,c,s;for(i=1;i<=e;i+=1){if(t[1]=i,s=0,(u=i-1)<1){if((s=n[i][i]-s)<=0)break;n[i][i]=Math.sqrt(s)}else{for(a=1;a<=u;a+=1){for(c=n[a][i],o=1;o<a;o+=1)c-=n[o][i]*n[o][a];c/=n[a][a],n[a][i]=c,s+=c*c}if((s=n[i][i]-s)<=0)break;n[i][i]=Math.sqrt(s)}t[1]=0}}(n,0,t,M),0!==M[1])return void(p[1]=2);(function(n,r,e,t){var o,i,u,a;for(i=1;i<=e;i+=1){for(a=0,o=1;o<i;o+=1)a+=n[o][i]*t[o];t[i]=(t[i]-a)/n[i][i]}for(u=1;u<=e;u+=1)for(t[i=e+1-u]=t[i]/n[i][i],a=-t[i],o=1;o<i;o+=1)t[o]=t[o]+a*n[o][i]})(n,0,t,r),function(n,r,e){var t,o,i,u,a;for(i=1;i<=e;i+=1){for(n[i][i]=1/n[i][i],a=-n[i][i],t=1;t<i;t+=1)n[t][i]=a*n[t][i];if(e<(u=i+1))break;for(o=u;o<=e;o+=1)for(a=n[i][o],n[i][o]=0,t=1;t<=i;t+=1)n[t][o]=n[t][o]+a*n[t][i]}}(n,0,t)}else{for(T=1;T<=t;T+=1)for(o[T]=0,b=1;b<=T;b+=1)o[T]=o[T]+n[b][T]*r[b];for(T=1;T<=t;T+=1)for(r[T]=0,b=T;b<=t;b+=1)r[T]=r[T]+n[T][b]*o[b]}for(i[1]=0,T=1;T<=t;T+=1)for(o[T]=r[T],i[1]=i[1]+d[T]*o[T],d[T]=0,b=T+1;b<=t;b+=1)n[b][T]=0;for(i[1]=-i[1]/2,p[1]=0,E=(q=(C=(N=(P=(S=t)+t)+O)+O+1)+O*(O+1)/2)+s,b=1;b<=s;b+=1){for(Y=0,T=1;T<=t;T+=1)Y+=u[T][b]*u[T][b];d[E+b]=Math.sqrt(Y)}for(m=0,h[1]=0,h[2]=0,W=0;;){if(999===(W=g()))return;for(;0!==(W=v());){if(999===W)return;if(700===W)if(A===m)w();else{for(;y(),797===(W=x()););w()}}}}(n,t,0,s,p,h,o,i,0,l,u,d,0,v,g,a),m="",1===a[1]&&(m="constraints are inconsistent, no solution!"),2===a[1]&&(m="matrix D in quadratic function is not positive definite!"),{solution:e(p),value:e(h),unconstrained_solution:e(t),iterations:e(v),iact:e(d),message:m}}}(numeric),numeric.svd=function(n){function r(n,r){return(n=Math.abs(n))>(r=Math.abs(r))?n*Math.sqrt(1+r*r/n/n):0==r?n:r*Math.sqrt(1+n*n/r/r)}var e,t=numeric.epsilon,o=1e-64/t,i=0,u=0,a=0,c=0,s=0,l=numeric.clone(n),f=l.length,m=l[0].length;if(f<m)throw"Need more rows than columns";var h=new Array(m),d=new Array(m);for(u=0;u<m;u++)h[u]=d[u]=0;var p=numeric.rep([m,m],0),g=0,v=0,y=0,x=0,w=0,b=0,T=0;for(u=0;u<m;u++){for(h[u]=v,T=0,s=u+1,a=u;a<f;a++)T+=l[a][u]*l[a][u];if(T<=o)v=0;else for(g=l[u][u],v=Math.sqrt(T),g>=0&&(v=-v),y=g*v-T,l[u][u]=g-v,a=s;a<m;a++){for(T=0,c=u;c<f;c++)T+=l[c][u]*l[c][a];for(g=T/y,c=u;c<f;c++)l[c][a]+=g*l[c][u]}for(d[u]=v,T=0,a=s;a<m;a++)T+=l[u][a]*l[u][a];if(T<=o)v=0;else{for(g=l[u][u+1],v=Math.sqrt(T),g>=0&&(v=-v),y=g*v-T,l[u][u+1]=g-v,a=s;a<m;a++)h[a]=l[u][a]/y;for(a=s;a<f;a++){for(T=0,c=s;c<m;c++)T+=l[a][c]*l[u][c];for(c=s;c<m;c++)l[a][c]+=T*h[c]}}(w=Math.abs(d[u])+Math.abs(h[u]))>x&&(x=w)}for(u=m-1;-1!=u;u+=-1){if(0!=v){for(y=v*l[u][u+1],a=s;a<m;a++)p[a][u]=l[u][a]/y;for(a=s;a<m;a++){for(T=0,c=s;c<m;c++)T+=l[u][c]*p[c][a];for(c=s;c<m;c++)p[c][a]+=T*p[c][u]}}for(a=s;a<m;a++)p[u][a]=0,p[a][u]=0;p[u][u]=1,v=h[u],s=u}for(u=m-1;-1!=u;u+=-1){for(s=u+1,v=d[u],a=s;a<m;a++)l[u][a]=0;if(0!=v){for(y=l[u][u]*v,a=s;a<m;a++){for(T=0,c=s;c<f;c++)T+=l[c][u]*l[c][a];for(g=T/y,c=u;c<f;c++)l[c][a]+=g*l[c][u]}for(a=u;a<f;a++)l[a][u]=l[a][u]/v}else for(a=u;a<f;a++)l[a][u]=0;l[u][u]+=1}for(t*=x,c=m-1;-1!=c;c+=-1)for(var _=0;_<50;_++){var k=!1;for(s=c;-1!=s;s+=-1){if(Math.abs(h[s])<=t){k=!0;break}if(Math.abs(d[s-1])<=t)break}if(!k){i=0,T=1;var M=s-1;for(u=s;u<c+1&&(g=T*h[u],h[u]=i*h[u],!(Math.abs(g)<=t));u++)for(y=r(g,v=d[u]),d[u]=y,i=v/y,T=-g/y,a=0;a<f;a++)w=l[a][M],b=l[a][u],l[a][M]=w*i+b*T,l[a][u]=-w*T+b*i}if(b=d[c],s==c){if(b<0)for(d[c]=-b,a=0;a<m;a++)p[a][c]=-p[a][c];break}if(_>=49)throw"Error: no convergence.";for(x=d[s],v=r(g=(((w=d[c-1])-b)*(w+b)+((v=h[c-1])-(y=h[c]))*(v+y))/(2*y*w),1),g=g<0?((x-b)*(x+b)+y*(w/(g-v)-y))/x:((x-b)*(x+b)+y*(w/(g+v)-y))/x,i=1,T=1,u=s+1;u<c+1;u++){for(v=h[u],w=d[u],y=T*v,v*=i,b=r(g,y),h[u-1]=b,g=x*(i=g/b)+v*(T=y/b),v=-x*T+v*i,y=w*T,w*=i,a=0;a<m;a++)x=p[a][u-1],b=p[a][u],p[a][u-1]=x*i+b*T,p[a][u]=-x*T+b*i;for(b=r(g,y),d[u-1]=b,g=(i=g/b)*v+(T=y/b)*w,x=-T*v+i*w,a=0;a<f;a++)w=l[a][u-1],b=l[a][u],l[a][u-1]=w*i+b*T,l[a][u]=-w*T+b*i}h[s]=0,h[c]=g,d[c]=x}for(u=0;u<d.length;u++)d[u]<t&&(d[u]=0);for(u=0;u<m;u++)for(a=u-1;a>=0;a--)if(d[a]<d[u]){for(i=d[a],d[a]=d[u],d[u]=i,c=0;c<l.length;c++)e=l[c][u],l[c][u]=l[c][a],l[c][a]=e;for(c=0;c<p.length;c++)e=p[c][u],p[c][u]=p[c][a],p[c][a]=e;u=a}return{U:l,S:d,V:p}}},111:(n,r,e)=>{"use strict";function t(n){n.sort();const r=n[Math.trunc(n.length/4)],e=n.length%2==0?(n[Math.trunc(n.length/2)]+n[Math.trunc(n.length/2)-1])/2:n[Math.trunc(n.length/2)],t=n[Math.trunc(3*n.length/4)],i=1.5*(t-r);let u=o(n,t+i);u<0&&(u=~u);let a=n[Math.max(0,u-1)];a<t&&(a=t);let c=o(n,r-i);c<0&&(c=~c);let s=n[c];return s>r&&(s=r),{q1:r,q2:e,q3:t,lowerAdjacentValue:s,upperAdjacentValue:a}}function o(n,r,e=0,t){if(0===n.length)return-1;if(void 0===t&&(t=n.length-1),r<n[e])return-1;if(r>n[t])return-(t+1);for(;t-e>1;){const o=Math.trunc((t+e)/2);if(r===n[o])return o;r<n[o]?t=o:e=o}return n[e]===r?e:0===n[t]?t:r<n[e]?-(e+1):-(t+1)}e.d(r,{G:()=>t})},875:(n,r,e)=>{"use strict";e.d(r,{Hg:()=>S,K0:()=>p,Kp:()=>s,Qc:()=>l,XD:()=>f,ZY:()=>T,aC:()=>A,d8:()=>c,hR:()=>k,iC:()=>_,j2:()=>a,js:()=>u,kW:()=>d,sw:()=>h,ue:()=>M,vK:()=>m,yB:()=>g});var t=e(976),o=e(78),i=e(162);const u={CONSTANT:"constant",PROPORTIONAL:"proportional"},a="fit",c="fit",s=".fit",l="rgba(255,191,63,0.4)",f="rgba(255,238,204,0.3)",m={TOP:"top",BOTTOM:"bottom"},h=[t.Property.js("rSquared",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("auc",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("interceptY",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("interceptX",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("slope",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("top",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("bottom",t.TYPE.FLOAT,{userEditable:!1})],d=[t.Property.js("minX",t.TYPE.FLOAT,{description:"Minimum value of the X axis",nullable:!0}),t.Property.js("minY",t.TYPE.FLOAT,{description:"Minimum value of the Y axis",nullable:!0}),t.Property.js("maxX",t.TYPE.FLOAT,{description:"Maximum value of the X axis",nullable:!0}),t.Property.js("maxY",t.TYPE.FLOAT,{description:"Maximum value of the Y axis",nullable:!0}),t.Property.js("title",t.TYPE.STRING,{nullable:!0}),t.Property.js("xAxisName",t.TYPE.STRING,{description:"Label to show on the X axis. If not specified, corresponding data column name is used",nullable:!0}),t.Property.js("yAxisName",t.TYPE.STRING,{description:"Label to show on the Y axis. If not specified, corresponding data column name is used",nullable:!0}),t.Property.js("logX",t.TYPE.BOOL,{description:"Whether the X axis should be logarithmic",defaultValue:!1}),t.Property.js("logY",t.TYPE.BOOL,{description:"Whether the Y axis should be logarithmic",defaultValue:!1}),t.Property.js("allowXZeroes",t.TYPE.BOOL,{description:"Whether x zeroes allowed for logarithmic data or not",defaultValue:!0}),t.Property.js("showStatistics",t.TYPE.STRING_LIST,{description:"Whether specific statistics should be rendered",choices:h.map((n=>n.name)),inputType:"MultiChoice"})],p=[t.Property.js("fitFunction",t.TYPE.STRING,{category:"Fitting",choices:["sigmoid","linear"],defaultValue:"sigmoid"}),t.Property.js("pointColor",t.TYPE.STRING,{category:"Rendering",nullable:!0,inputType:"Color"}),t.Property.js("fitLineColor",t.TYPE.STRING,{category:"Rendering",nullable:!0,inputType:"Color"}),t.Property.js("errorModel",t.TYPE.STRING,{category:"Fitting",defaultValue:"constant",choices:["constant","proportional"],nullable:!1}),t.Property.js("clickToToggle",t.TYPE.BOOL,{category:"Fitting",description:"Click on a point to mark it as outlier and refit",nullable:!0,defaultValue:!1}),t.Property.js("showFitLine",t.TYPE.BOOL,{category:"Fitting",defaultValue:!0}),t.Property.js("showPoints",t.TYPE.STRING,{category:"Fitting",description:"Whether points/candlesticks/none should be rendered",defaultValue:"points",choices:["points","candlesticks","both"]}),t.Property.js("showCurveConfidenceInterval",t.TYPE.BOOL,{category:"Fitting",description:"Whether confidence intervals should be rendered",defaultValue:!1,caption:"Confidence interval"}),t.Property.js("markerType",t.TYPE.STRING,{category:"Rendering",defaultValue:"circle",choices:["asterisk","circle","cross border","diamond","square","star","triangle bottom","triangle left","triangle right","triangle top"],nullable:!1}),t.Property.js("lineStyle",t.TYPE.STRING,{category:"Rendering",defaultValue:"solid",choices:["solid","dotted","dashed","dashdotted"],nullable:!1}),t.Property.js("droplines",t.TYPE.STRING_LIST,{description:"Whether specific droplines should be rendered",choices:["IC50"],inputType:"MultiChoice"})],g="sigmoid";class v{}class y extends v{constructor(n,r,e,t){super(),this._name=n,this._parameterNames=t,this.y=r,this.getInitialParameters=e}get name(){return this._name}get parameterNames(){return this._parameterNames}y(n,r){throw new Error("Not implemented")}getInitialParameters(n,r){throw new Error("Not implemented")}}const x={linear:new class extends v{get name(){return"linear"}get parameterNames(){return["Slope","Intercept"]}y(n,r){return function(n,r){return n[0]*r+n[1]}(n,r)}getInitialParameters(n,r){let e=0,t=0;for(let r=1;r<n.length;r++)n[r]<n[e]&&(e=r),n[r]>n[t]&&(t=r);const o=n[t]-n[e],i=(r[t]-r[e])/o;return[i,r[t]-i*n[t]]}},sigmoid:new class extends v{get name(){return g}get parameterNames(){return["Top","Bottom","Slope","IC50"]}y(n,r){return S(n,r)}getInitialParameters(n,r){const e=t.Rect.fromXYArrays(n,r),o=(e.bottom-e.top)/2+e.top;let i=e.bottom-e.top,u=0;for(let e=0;e<n.length;e++){const n=Math.abs(r[e]-o);n<i&&(i=n,u=e)}const a=n[u],c=r[0]>r[r.length-1]?1:-1;return[e.bottom,c,a,e.top]}}};function w(n){let r;switch(n){case u.CONSTANT:r=N;break;case u.PROPORTIONAL:r=j;break;default:r=N}return r}function b(n,r,e,t){return{getValue:t=>e(r,n,t).value,getGradient:(o,i)=>{for(let u=0;u<o.length;u++)i[u]=t.includes(u)?0:q(e,r,n,o,u);return i}}}function T(n){if("string"==typeof n)return x[n];if(!x[n.name]){const r=n.name,e=n.parameterNames,t=n.function.split("=>").map((n=>n.trim())),o=n.getInitialParameters.split("=>").map((n=>n.trim())),i=new Function(t[0].slice(1,t[0].length-1),`${t[1].includes(";")?"":"return "}${t[1]}`),u=new Function(o[0].slice(1,o[0].length-1),`return ${o[1]}`),a=new y(r,i,u,e);x[r]=a}return x[n.name]}function _(n,r,e,t){var i,u;const a=r.y,c=r.getInitialParameters(n.x,n.y),s=w(e),l=[];let f=!0;for(;f;){const r=b(n,a,s,l);if((0,o.U)(r,c),(0,o.U)(r,c),f=!1,!t)break;for(let n=0;n<t.length;n++){if(void 0!==(null===(i=t[n])||void 0===i?void 0:i.max)&&c[n]>t[n].max){f=!0,l.push(n),c[n]=t[n].max;break}if(void 0!==(null===(u=t[n])||void 0===u?void 0:u.min)&&c[n]<t[n].min){f=!0,l.push(n),c[n]=t[n].min;break}}}return{fittedCurve:k(a,c),parameters:c}}function k(n,r){return e=>n(r,e)}function M(n,r,e,t=.05,o){const a=w(o),c=o===u.PROPORTIONAL?a(e,n,r).mult:a(e,n,r).const,s=i.normal.inv(1-t/2,0,1);return{confidenceTop:n=>{const t=e(r,n);return o===u.CONSTANT?t+s*c:t+s*Math.abs(t)*c},confidenceBottom:n=>{const t=e(r,n);return o===u.CONSTANT?t-s*c:t-s*Math.abs(t)*c}}}function A(n,r,e,t=!0){const o=k(e,r);return{rSquared:t?C(o,n):void 0,auc:t?P(o,n):void 0,interceptX:r[2],interceptY:o(r[2]),slope:r[1],top:r[0],bottom:r[3]}}function S(n,r){const e=n[0],t=n[1],o=n[2],i=n[3];return i+(e-i)/(1+Math.pow(10,(r-o)*t))}function P(n,r){let e=0;const t=Math.min(...r.x),o=Math.max(...r.x),i=(o-t)/1e3;for(let r=t;r<o;r+=i)e+=i*n(r);return e}function C(n,r){let e=0,t=0;const o=i.mean(r.y);for(let i=0;i<r.x.length;i++)e+=Math.pow(r.y[i]-n(r.x[i]),2),t+=Math.pow(r.y[i]-o,2);return 1-e/t}function q(n,r,e,t,o){const i=1e-4*t[o]==0?.001:1e-4*t[o],u=[],a=[];for(let n=0;n<t.length;n++)n===o?(u.push(t[n]+i),a.push(t[n]-i)):(u.push(t[n]),a.push(t[n]));return(n(r,e,u).value-n(r,e,a).value)/(2*i)}function N(n,r,e){const t=Math.PI;let o=0,i=0,u=0;const a=new Float32Array(r.x.length);for(let t=0;t<r.x.length;t++){const o=r.y[t],i=n(e,r.x[t]);a[t]=Math.pow(o-i,2)}for(let n=0;n<a.length;n++)i+=a[n];i/=a.length,o=Math.sqrt(i);for(let n=0;n<a.length;n++)u+=a[n]/i+Math.log(2*t*i);return{value:-u,const:o,mult:0}}function j(n,r,e){const t=Math.PI;let o=0,i=0,u=0;const a=new Float32Array(r.x.length);for(let t=0;t<r.x.length;t++){const o=r.y[t],i=n(e,r.x[t]);a[t]=Math.pow(o-i,2)}for(let n=0;n<a.length;n++)i+=a[n];i/=a.length,o=Math.sqrt(i);for(let n=0;n<a.length;n++)u+=a[n]/i+Math.log(2*t*i);return{value:-u,const:0,mult:o}}},416:(n,r,e)=>{"use strict";e.d(r,{LC:()=>p,PK:()=>d,TL:()=>u,Y6:()=>m,dU:()=>f,hq:()=>c,jG:()=>a,kG:()=>h,q_:()=>s,tq:()=>g});var t=e(976),o=e(875);function i(n){const r={};for(const e of n)null!==e.defaultValue&&(r[e.name]=e.defaultValue);return r}function u(){return{chartOptions:i(o.kW),seriesOptions:i(o.K0)}}function a(n){var r,e;return JSON.parse(null!==(r=(e=n.tags)[o.Kp])&&void 0!==r?r:e[o.Kp]=JSON.stringify(u()))}function c(n){var r,e;return JSON.parse(null!==(r=(e=n.tags)[o.Kp])&&void 0!==r?r:e[o.Kp]=JSON.stringify(u()))}function s(n){const r=[],e=[];for(let t=0;t<n.length;t++)r[t]=n[t].x,e[t]=n[t].y;return{xs:r,ys:e}}function l(n){const r=Math.floor(n.y.length/2),e=n.y.sort(((n,r)=>n-r));return e.length%2==0?(e[r-1]+e[r])/2:e[r]}function f(n){var r;const e=n.chartOptions;if((null===(r=n.series)||void 0===r?void 0:r.length)&&0!==n.series.length){const{xs:r,ys:o}=s(n.series[0].points);let i=t.Rect.fromXYArrays(r,o);for(let r=1;r<n.series.length;r++){const{xs:e,ys:o}=s(n.series[r].points);e.some((n=>void 0===n))||o.some((n=>void 0===n))||(i=i.union(t.Rect.fromXYArrays(e,o)))}return e?function(n,r){let e=n.x,o=n.y,i=n.width,u=n.height;return void 0!==r.minX&&null!==r.minX&&(!r.logX||r.logX&&r.minX>0)&&(i+=e-r.minX,e=r.minX),void 0!==r.maxX&&null!==r.maxX&&(!r.logX||r.logX&&r.maxX>0)&&(i+=r.maxX-(e+i)),void 0!==r.minY&&null!==r.minY&&(!r.logY||r.logY&&r.minY>0)&&(u+=o-r.minY,o=r.minY),void 0!==r.maxY&&null!==r.maxY&&(!r.logY||r.logY&&r.maxY>0)&&(u+=r.maxY-(o+u)),new t.Rect(e,o,i,u)}(i,e):i}return new t.Rect(0,0,1,1)}function m(n){return(0,o.ZY)(n.fitFunction)}function h(n,r){return(0,o.hR)(r.y,n.parameters)}function d(n,r,e){var t;const i={x:n.points.filter((n=>!n.outlier)).map((n=>(null==e?void 0:e.logX)?Math.log10(n.x):n.x)),y:n.points.filter((n=>!n.outlier)).map((n=>(null==e?void 0:e.logY)?Math.log10(n.y):n.y))};var u;return n.parameterBounds&&(null==e?void 0:e.logX)&&(n.parameterBounds[2]=((u=n.parameterBounds[2])&&(void 0!==u.max&&(u.max=Math.log10(u.max)),void 0!==u.min&&(u.min=0===u.min?-Number.MAX_VALUE:Math.log10(u.min))),u)),(0,o.iC)(function(n){const r={x:[],y:[]},e={x:[n.x[0]],y:[n.y[0]]};for(let t=1;t<n.x.length;t++){if(n.x[t]===e.x[0]){e.x[e.x.length]=n.x[t],e.y[e.y.length]=n.y[t];continue}const o=l(e);r.x[r.x.length]=e.x[0],r.y[r.y.length]=o,e.x=[n.x[t]],e.y=[n.y[t]]}const t=l(e);return r.x[r.x.length]=e.x[0],r.y[r.y.length]=t,r}(i),r,null!==(t=n.errorModel)&&void 0!==t?t:o.js.CONSTANT,n.parameterBounds)}function p(n,r,e,t){var i;const u=e?{x:n.points.map((n=>(null==t?void 0:t.logX)?Math.log10(n.x):n.x)),y:n.points.map((n=>(null==t?void 0:t.logY)?Math.log10(n.y):n.y))}:{x:n.points.filter((n=>!n.outlier)).map((n=>(null==t?void 0:t.logX)?Math.log10(n.x):n.x)),y:n.points.filter((n=>!n.outlier)).map((n=>(null==t?void 0:t.logY)?Math.log10(n.y):n.y))};return n.parameters||(n.parameters=d(n,r).parameters),(0,o.ue)(u,n.parameters,r.y,.05,null!==(i=n.errorModel)&&void 0!==i?i:o.js.CONSTANT)}function g(n,r,e){const t={x:n.points.filter((n=>!n.outlier)).map((n=>(null==e?void 0:e.logX)?Math.log10(n.x):n.x)),y:n.points.filter((n=>!n.outlier)).map((n=>(null==e?void 0:e.logY)?Math.log10(n.y):n.y))};return n.parameters||(n.parameters=d(n,r).parameters),(0,o.aC)(t,n.parameters,r.y,!0)}},766:(n,r,e)=>{"use strict";e.d(r,{l:()=>a});var t=e(976);const o=1e-30,i=new class{screenToWorld(n,r,e,t,o){return e+(o?1-n/r:n/r)*(t-e)}worldToScreen(n,r,e,t,o){return o?(1-(n-e)/(t-e))*r:(n-e)/(t-e)*r}},u=new class{screenToWorld(n,r,e,t,i){e=e<o?o:e;const u=Math.log(t),a=Math.log(e);return Math.exp(a+(u-a)*(i?r-n:n)/r)}worldToScreen(n,r,e,t,i){if(n<=0)return NaN;if(Math.abs(n-e)<o)return i?r:0;if(Math.abs(n-t)<o)return i?0:r;e=e<o?o:e,n=n<o?o:n;const u=r*Math.log(n/e)/Math.log(t/e);return i?r-u:u}};class a{get xt(){return this.logX?u:i}get yt(){return this.logY?u:i}constructor(n,r,e=!1,t=!1){this.logX=!1,this.logY=!1,this.inverseX=!1,this.inverseY=!1,this.world=n,this.screen=r,this.logX=e,this.logY=t}xToScreen(n){return this.screen.left+this.xt.worldToScreen(n,this.screen.width,this.world.minX,this.world.maxX,this.inverseX)}yToScreen(n){return this.screen.top+this.yt.worldToScreen(n,this.screen.height,this.world.minY,this.world.maxY,!this.inverseY)}xToWorld(n){return this.xt.screenToWorld(n-this.screen.left,this.screen.width,this.world.minX,this.world.maxX,this.inverseX)}yToWorld(n){return this.yt.screenToWorld(n-this.screen.top,this.screen.height,this.world.minY,this.world.maxY,!this.inverseY)}toScreen(n){return new t.Point(this.xToScreen(n.x),this.yToScreen(n.y))}toWorld(n){return new t.Point(this.xToWorld(n.x),this.yToWorld(n.y))}drawCoordinateGrid(n,r,e){r&&t.Paint.horzAxis(n,this.world.minX,this.world.maxX,r.x,r.y,r.width,r.height,this.logX,this.inverseX),e&&t.Paint.vertAxis(n,this.world.minY,this.world.maxY,e.x,e.y,e.width,e.height,this.logY,this.inverseY)}}},162:function(n){var r;n.exports=(r=function(n,r){var e=Array.prototype.concat,t=Array.prototype.slice,o=Object.prototype.toString;function i(r,e){var t=r>e?r:e;return n.pow(10,17-~~(n.log(t>0?t:-t)*n.LOG10E))}var u=Array.isArray||function(n){return"[object Array]"===o.call(n)};function a(n){return"[object Function]"===o.call(n)}function c(n){return"number"==typeof n&&n-n==0}function s(){return new s._init(arguments)}function l(){return 0}function f(){return 1}function m(n,r){return n===r?1:0}s.fn=s.prototype,s._init=function(n){if(u(n[0]))if(u(n[0][0])){a(n[1])&&(n[0]=s.map(n[0],n[1]));for(var r=0;r<n[0].length;r++)this[r]=n[0][r];this.length=n[0].length}else this[0]=a(n[1])?s.map(n[0],n[1]):n[0],this.length=1;else if(c(n[0]))this[0]=s.seq.apply(null,n),this.length=1;else{if(n[0]instanceof s)return s(n[0].toArray());this[0]=[],this.length=1}return this},s._init.prototype=s.prototype,s._init.constructor=s,s.utils={calcRdx:i,isArray:u,isFunction:a,isNumber:c,toVector:function(n){return e.apply([],n)}},s._random_fn=n.random,s.setRandom=function(n){if("function"!=typeof n)throw new TypeError("fn is not a function");s._random_fn=n},s.extend=function(n){var r,e;if(1===arguments.length){for(e in n)s[e]=n[e];return this}for(r=1;r<arguments.length;r++)for(e in arguments[r])n[e]=arguments[r][e];return n},s.rows=function(n){return n.length||1},s.cols=function(n){return n[0].length||1},s.dimensions=function(n){return{rows:s.rows(n),cols:s.cols(n)}},s.row=function(n,r){return u(r)?r.map((function(r){return s.row(n,r)})):n[r]},s.rowa=function(n,r){return s.row(n,r)},s.col=function(n,r){if(u(r)){var e=s.arange(n.length).map((function(){return new Array(r.length)}));return r.forEach((function(r,t){s.arange(n.length).forEach((function(o){e[o][t]=n[o][r]}))})),e}for(var t=new Array(n.length),o=0;o<n.length;o++)t[o]=[n[o][r]];return t},s.cola=function(n,r){return s.col(n,r).map((function(n){return n[0]}))},s.diag=function(n){for(var r=s.rows(n),e=new Array(r),t=0;t<r;t++)e[t]=[n[t][t]];return e},s.antidiag=function(n){for(var r=s.rows(n)-1,e=new Array(r),t=0;r>=0;r--,t++)e[t]=[n[t][r]];return e},s.transpose=function(n){var r,e,t,o,i,a=[];for(u(n[0])||(n=[n]),e=n.length,t=n[0].length,i=0;i<t;i++){for(r=new Array(e),o=0;o<e;o++)r[o]=n[o][i];a.push(r)}return 1===a.length?a[0]:a},s.map=function(n,r,e){var t,o,i,a,c;for(u(n[0])||(n=[n]),o=n.length,i=n[0].length,a=e?n:new Array(o),t=0;t<o;t++)for(a[t]||(a[t]=new Array(i)),c=0;c<i;c++)a[t][c]=r(n[t][c],t,c);return 1===a.length?a[0]:a},s.cumreduce=function(n,r,e){var t,o,i,a,c;for(u(n[0])||(n=[n]),o=n.length,i=n[0].length,a=e?n:new Array(o),t=0;t<o;t++)for(a[t]||(a[t]=new Array(i)),i>0&&(a[t][0]=n[t][0]),c=1;c<i;c++)a[t][c]=r(a[t][c-1],n[t][c]);return 1===a.length?a[0]:a},s.alter=function(n,r){return s.map(n,r,!0)},s.create=function(n,r,e){var t,o,i=new Array(n);for(a(r)&&(e=r,r=n),t=0;t<n;t++)for(i[t]=new Array(r),o=0;o<r;o++)i[t][o]=e(t,o);return i},s.zeros=function(n,r){return c(r)||(r=n),s.create(n,r,l)},s.ones=function(n,r){return c(r)||(r=n),s.create(n,r,f)},s.rand=function(n,r){return c(r)||(r=n),s.create(n,r,s._random_fn)},s.identity=function(n,r){return c(r)||(r=n),s.create(n,r,m)},s.symmetric=function(n){var r,e,t=n.length;if(n.length!==n[0].length)return!1;for(r=0;r<t;r++)for(e=0;e<t;e++)if(n[e][r]!==n[r][e])return!1;return!0},s.clear=function(n){return s.alter(n,l)},s.seq=function(n,r,e,t){a(t)||(t=!1);var o,u=[],c=i(n,r),s=(r*c-n*c)/((e-1)*c),l=n;for(o=0;l<=r&&o<e;l=(n*c+s*c*++o)/c)u.push(t?t(l,o):l);return u},s.arange=function(n,e,t){var o,i=[];if(t=t||1,e===r&&(e=n,n=0),n===e||0===t)return[];if(n<e&&t<0)return[];if(n>e&&t>0)return[];if(t>0)for(o=n;o<e;o+=t)i.push(o);else for(o=n;o>e;o+=t)i.push(o);return i},s.slice=function(){function n(n,e,t,o){var i,u=[],a=n.length;if(e===r&&t===r&&o===r)return s.copy(n);if(o=o||1,(e=(e=e||0)>=0?e:a+e)===(t=(t=t||n.length)>=0?t:a+t)||0===o)return[];if(e<t&&o<0)return[];if(e>t&&o>0)return[];if(o>0)for(i=e;i<t;i+=o)u.push(n[i]);else for(i=e;i>t;i+=o)u.push(n[i]);return u}return function(r,e){var t,o;return c((e=e||{}).row)?c(e.col)?r[e.row][e.col]:n(s.rowa(r,e.row),(t=e.col||{}).start,t.end,t.step):c(e.col)?n(s.cola(r,e.col),(o=e.row||{}).start,o.end,o.step):(o=e.row||{},t=e.col||{},n(r,o.start,o.end,o.step).map((function(r){return n(r,t.start,t.end,t.step)})))}}(),s.sliceAssign=function(e,t,o){var i,u;if(c(t.row)){if(c(t.col))return e[t.row][t.col]=o;t.col=t.col||{},t.col.start=t.col.start||0,t.col.end=t.col.end||e[0].length,t.col.step=t.col.step||1,i=s.arange(t.col.start,n.min(e.length,t.col.end),t.col.step);var a=t.row;return i.forEach((function(n,r){e[a][n]=o[r]})),e}if(c(t.col)){t.row=t.row||{},t.row.start=t.row.start||0,t.row.end=t.row.end||e.length,t.row.step=t.row.step||1,u=s.arange(t.row.start,n.min(e[0].length,t.row.end),t.row.step);var l=t.col;return u.forEach((function(n,r){e[n][l]=o[r]})),e}return o[0].length===r&&(o=[o]),t.row.start=t.row.start||0,t.row.end=t.row.end||e.length,t.row.step=t.row.step||1,t.col.start=t.col.start||0,t.col.end=t.col.end||e[0].length,t.col.step=t.col.step||1,u=s.arange(t.row.start,n.min(e.length,t.row.end),t.row.step),i=s.arange(t.col.start,n.min(e[0].length,t.col.end),t.col.step),u.forEach((function(n,r){i.forEach((function(t,i){e[n][t]=o[r][i]}))})),e},s.diagonal=function(n){var r=s.zeros(n.length,n.length);return n.forEach((function(n,e){r[e][e]=n})),r},s.copy=function(n){return n.map((function(n){return c(n)?n:n.map((function(n){return n}))}))};var h=s.prototype;return h.length=0,h.push=Array.prototype.push,h.sort=Array.prototype.sort,h.splice=Array.prototype.splice,h.slice=Array.prototype.slice,h.toArray=function(){return this.length>1?t.call(this):t.call(this)[0]},h.map=function(n,r){return s(s.map(this,n,r))},h.cumreduce=function(n,r){return s(s.cumreduce(this,n,r))},h.alter=function(n){return s.alter(this,n),this},function(n){for(var r=0;r<n.length;r++)!function(n){h[n]=function(r){var e,t=this;return r?(setTimeout((function(){r.call(t,h[n].call(t))})),this):(e=s[n](this),u(e)?s(e):e)}}(n[r])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(n){for(var r=0;r<n.length;r++)!function(n){h[n]=function(r,e){var t=this;return e?(setTimeout((function(){e.call(t,h[n].call(t,r))})),this):s(s[n](this,r))}}(n[r])}("row col".split(" ")),function(n){for(var r=0;r<n.length;r++)!function(n){h[n]=function(){return s(s[n].apply(null,arguments))}}(n[r])}("create zeros ones rand identity".split(" ")),s}(Math),function(n,r){var e=n.utils.isFunction;function t(n,r){return n-r}function o(n,e,t){return r.max(e,r.min(n,t))}n.sum=function(n){for(var r=0,e=n.length;--e>=0;)r+=n[e];return r},n.sumsqrd=function(n){for(var r=0,e=n.length;--e>=0;)r+=n[e]*n[e];return r},n.sumsqerr=function(r){for(var e,t=n.mean(r),o=0,i=r.length;--i>=0;)o+=(e=r[i]-t)*e;return o},n.sumrow=function(n){for(var r=0,e=n.length;--e>=0;)r+=n[e];return r},n.product=function(n){for(var r=1,e=n.length;--e>=0;)r*=n[e];return r},n.min=function(n){for(var r=n[0],e=0;++e<n.length;)n[e]<r&&(r=n[e]);return r},n.max=function(n){for(var r=n[0],e=0;++e<n.length;)n[e]>r&&(r=n[e]);return r},n.unique=function(n){for(var r={},e=[],t=0;t<n.length;t++)r[n[t]]||(r[n[t]]=!0,e.push(n[t]));return e},n.mean=function(r){return n.sum(r)/r.length},n.meansqerr=function(r){return n.sumsqerr(r)/r.length},n.geomean=function(e){var t=e.map(r.log),o=n.mean(t);return r.exp(o)},n.median=function(n){var r=n.length,e=n.slice().sort(t);return 1&r?e[r/2|0]:(e[r/2-1]+e[r/2])/2},n.cumsum=function(r){return n.cumreduce(r,(function(n,r){return n+r}))},n.cumprod=function(r){return n.cumreduce(r,(function(n,r){return n*r}))},n.diff=function(n){var r,e=[],t=n.length;for(r=1;r<t;r++)e.push(n[r]-n[r-1]);return e},n.rank=function(n){var r,e=[],o={};for(r=0;r<n.length;r++)o[c=n[r]]?o[c]++:(o[c]=1,e.push(c));var i=e.sort(t),u={},a=1;for(r=0;r<i.length;r++){var c,s=o[c=i[r]],l=(a+(a+s-1))/2;u[c]=l,a+=s}return n.map((function(n){return u[n]}))},n.mode=function(n){var r,e=n.length,o=n.slice().sort(t),i=1,u=0,a=0,c=[];for(r=0;r<e;r++)o[r]===o[r+1]?i++:(i>u?(c=[o[r]],u=i,a=0):i===u&&(c.push(o[r]),a++),i=1);return 0===a?c[0]:c},n.range=function(r){return n.max(r)-n.min(r)},n.variance=function(r,e){return n.sumsqerr(r)/(r.length-(e?1:0))},n.pooledvariance=function(r){return r.reduce((function(r,e){return r+n.sumsqerr(e)}),0)/(r.reduce((function(n,r){return n+r.length}),0)-r.length)},n.deviation=function(r){for(var e=n.mean(r),t=r.length,o=new Array(t),i=0;i<t;i++)o[i]=r[i]-e;return o},n.stdev=function(e,t){return r.sqrt(n.variance(e,t))},n.pooledstdev=function(e){return r.sqrt(n.pooledvariance(e))},n.meandev=function(e){for(var t=n.mean(e),o=[],i=e.length-1;i>=0;i--)o.push(r.abs(e[i]-t));return n.mean(o)},n.meddev=function(e){for(var t=n.median(e),o=[],i=e.length-1;i>=0;i--)o.push(r.abs(e[i]-t));return n.median(o)},n.coeffvar=function(r){return n.stdev(r)/n.mean(r)},n.quartiles=function(n){var e=n.length,o=n.slice().sort(t);return[o[r.round(e/4)-1],o[r.round(e/2)-1],o[r.round(3*e/4)-1]]},n.quantiles=function(n,e,i,u){var a,c,s,l,f,m=n.slice().sort(t),h=[e.length],d=n.length;for(void 0===i&&(i=3/8),void 0===u&&(u=3/8),a=0;a<e.length;a++)s=d*(c=e[a])+(i+c*(1-i-u)),l=r.floor(o(s,1,d-1)),f=o(s-l,0,1),h[a]=(1-f)*m[l-1]+f*m[l];return h},n.percentile=function(n,r,e){var o=n.slice().sort(t),i=r*(o.length+(e?1:-1))+(e?0:1),u=parseInt(i),a=i-u;return u+1<o.length?o[u-1]+a*(o[u]-o[u-1]):o[u-1]},n.percentileOfScore=function(n,r,e){var t,o,i=0,u=n.length,a=!1;for("strict"===e&&(a=!0),o=0;o<u;o++)t=n[o],(a&&t<r||!a&&t<=r)&&i++;return i/u},n.histogram=function(e,t){t=t||4;var o,i=n.min(e),u=(n.max(e)-i)/t,a=e.length,c=[];for(o=0;o<t;o++)c[o]=0;for(o=0;o<a;o++)c[r.min(r.floor((e[o]-i)/u),t-1)]+=1;return c},n.covariance=function(r,e){var t,o=n.mean(r),i=n.mean(e),u=r.length,a=new Array(u);for(t=0;t<u;t++)a[t]=(r[t]-o)*(e[t]-i);return n.sum(a)/(u-1)},n.corrcoeff=function(r,e){return n.covariance(r,e)/n.stdev(r,1)/n.stdev(e,1)},n.spearmancoeff=function(r,e){return r=n.rank(r),e=n.rank(e),n.corrcoeff(r,e)},n.stanMoment=function(e,t){for(var o=n.mean(e),i=n.stdev(e),u=e.length,a=0,c=0;c<u;c++)a+=r.pow((e[c]-o)/i,t);return a/e.length},n.skewness=function(r){return n.stanMoment(r,3)},n.kurtosis=function(r){return n.stanMoment(r,4)-3};var i=n.prototype;!function(r){for(var t=0;t<r.length;t++)!function(r){i[r]=function(t,o){var u=[],a=0,c=this;if(e(t)&&(o=t,t=!1),o)return setTimeout((function(){o.call(c,i[r].call(c,t))})),this;if(this.length>1){for(c=!0===t?this:this.transpose();a<c.length;a++)u[a]=n[r](c[a]);return u}return n[r](this[0],t)}}(r[t])}("cumsum cumprod".split(" ")),function(r){for(var t=0;t<r.length;t++)!function(r){i[r]=function(t,o){var u=[],a=0,c=this;if(e(t)&&(o=t,t=!1),o)return setTimeout((function(){o.call(c,i[r].call(c,t))})),this;if(this.length>1){for("sumrow"!==r&&(c=!0===t?this:this.transpose());a<c.length;a++)u[a]=n[r](c[a]);return!0===t?n[r](n.utils.toVector(u)):u}return n[r](this[0],t)}}(r[t])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(r){for(var t=0;t<r.length;t++)!function(r){i[r]=function(){var t,o=[],u=0,a=this,c=Array.prototype.slice.call(arguments);if(e(c[c.length-1])){t=c[c.length-1];var s=c.slice(0,c.length-1);return setTimeout((function(){t.call(a,i[r].apply(a,s))})),this}t=void 0;var l=function(e){return n[r].apply(a,[e].concat(c))};if(this.length>1){for(a=a.transpose();u<a.length;u++)o[u]=l(a[u]);return o}return l(this[0])}}(r[t])}("quantiles percentileOfScore".split(" "))}(r,Math),function(n,r){n.gammaln=function(n){var e,t,o,i=0,u=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],a=1.000000000190015;for(o=(t=e=n)+5.5,o-=(e+.5)*r.log(o);i<6;i++)a+=u[i]/++t;return r.log(2.5066282746310007*a/e)-o},n.loggam=function(n){var e,t,o,i,u,a,c,s=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(e=n,c=0,1==n||2==n)return 0;for(n<=7&&(e=n+(c=r.floor(7-n))),t=1/(e*e),o=2*r.PI,u=s[9],a=8;a>=0;a--)u*=t,u+=s[a];if(i=u/e+.5*r.log(o)+(e-.5)*r.log(e)-e,n<=7)for(a=1;a<=c;a++)i-=r.log(e-1),e-=1;return i},n.gammafn=function(n){var e,t,o,i,u=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],a=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],c=!1,s=0,l=0,f=0,m=n;if(n>171.6243769536076)return 1/0;if(m<=0){if(!(i=m%1+36e-17))return 1/0;c=(1&m?-1:1)*r.PI/r.sin(r.PI*i),m=1-m}for(o=m,t=m<1?m++:(m-=s=(0|m)-1)-1,e=0;e<8;++e)f=(f+u[e])*t,l=l*t+a[e];if(i=f/l+1,o<m)i/=o;else if(o>m)for(e=0;e<s;++e)i*=m,m++;return c&&(i=c/i),i},n.gammap=function(r,e){return n.lowRegGamma(r,e)*n.gammafn(r)},n.lowRegGamma=function(e,t){var o,i=n.gammaln(e),u=e,a=1/e,c=a,s=t+1-e,l=1/1e-30,f=1/s,m=f,h=1,d=-~(8.5*r.log(e>=1?e:1/e)+.4*e+17);if(t<0||e<=0)return NaN;if(t<e+1){for(;h<=d;h++)a+=c*=t/++u;return a*r.exp(-t+e*r.log(t)-i)}for(;h<=d;h++)m*=(f=1/(f=(o=-h*(h-e))*f+(s+=2)))*(l=s+o/l);return 1-m*r.exp(-t+e*r.log(t)-i)},n.factorialln=function(r){return r<0?NaN:n.gammaln(r+1)},n.factorial=function(r){return r<0?NaN:n.gammafn(r+1)},n.combination=function(e,t){return e>170||t>170?r.exp(n.combinationln(e,t)):n.factorial(e)/n.factorial(t)/n.factorial(e-t)},n.combinationln=function(r,e){return n.factorialln(r)-n.factorialln(e)-n.factorialln(r-e)},n.permutation=function(r,e){return n.factorial(r)/n.factorial(r-e)},n.betafn=function(e,t){if(!(e<=0||t<=0))return e+t>170?r.exp(n.betaln(e,t)):n.gammafn(e)*n.gammafn(t)/n.gammafn(e+t)},n.betaln=function(r,e){return n.gammaln(r)+n.gammaln(e)-n.gammaln(r+e)},n.betacf=function(n,e,t){var o,i,u,a,c=1e-30,s=1,l=e+t,f=e+1,m=e-1,h=1,d=1-l*n/f;for(r.abs(d)<c&&(d=c),a=d=1/d;s<=100&&(d=1+(i=s*(t-s)*n/((m+(o=2*s))*(e+o)))*d,r.abs(d)<c&&(d=c),h=1+i/h,r.abs(h)<c&&(h=c),a*=(d=1/d)*h,d=1+(i=-(e+s)*(l+s)*n/((e+o)*(f+o)))*d,r.abs(d)<c&&(d=c),h=1+i/h,r.abs(h)<c&&(h=c),a*=u=(d=1/d)*h,!(r.abs(u-1)<3e-7));s++);return a},n.gammapinv=function(e,t){var o,i,u,a,c,s,l=0,f=t-1,m=n.gammaln(t);if(e>=1)return r.max(100,t+100*r.sqrt(t));if(e<=0)return 0;for(t>1?(c=r.log(f),s=r.exp(f*(c-1)-m),a=e<.5?e:1-e,o=(2.30753+.27061*(i=r.sqrt(-2*r.log(a))))/(1+i*(.99229+.04481*i))-i,e<.5&&(o=-o),o=r.max(.001,t*r.pow(1-1/(9*t)-o/(3*r.sqrt(t)),3))):o=e<(i=1-t*(.253+.12*t))?r.pow(e/i,1/t):1-r.log(1-(e-i)/(1-i));l<12;l++){if(o<=0)return 0;if((o-=i=(u=(n.lowRegGamma(t,o)-e)/(i=t>1?s*r.exp(-(o-f)+f*(r.log(o)-c)):r.exp(-o+f*r.log(o)-m)))/(1-.5*r.min(1,u*((t-1)/o-1))))<=0&&(o=.5*(o+i)),r.abs(i)<1e-8*o)break}return o},n.erf=function(n){var e,t,o,i,u=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],a=u.length-1,c=!1,s=0,l=0;for(n<0&&(n=-n,c=!0),t=4*(e=2/(2+n))-2;a>0;a--)o=s,s=t*s-l+u[a],l=o;return i=e*r.exp(-n*n+.5*(u[0]+t*s)-l),c?i-1:1-i},n.erfc=function(r){return 1-n.erf(r)},n.erfcinv=function(e){var t,o,i,u,a=0;if(e>=2)return-100;if(e<=0)return 100;for(u=e<1?e:2-e,t=-.70711*((2.30753+.27061*(i=r.sqrt(-2*r.log(u/2))))/(1+i*(.99229+.04481*i))-i);a<2;a++)t+=(o=n.erfc(t)-u)/(1.1283791670955126*r.exp(-t*t)-t*o);return e<1?t:-t},n.ibetainv=function(e,t,o){var i,u,a,c,s,l,f,m,h,d,p=t-1,g=o-1,v=0;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&o>=1?(a=e<.5?e:1-e,l=(2.30753+.27061*(c=r.sqrt(-2*r.log(a))))/(1+c*(.99229+.04481*c))-c,e<.5&&(l=-l),f=(l*l-3)/6,m=2/(1/(2*t-1)+1/(2*o-1)),h=l*r.sqrt(f+m)/m-(1/(2*o-1)-1/(2*t-1))*(f+5/6-2/(3*m)),l=t/(t+o*r.exp(2*h))):(i=r.log(t/(t+o)),u=r.log(o/(t+o)),l=e<(c=r.exp(t*i)/t)/(h=c+(s=r.exp(o*u)/o))?r.pow(t*h*e,1/t):1-r.pow(o*h*(1-e),1/o)),d=-n.gammaln(t)-n.gammaln(o)+n.gammaln(t+o);v<10;v++){if(0===l||1===l)return l;if((l-=c=(s=(n.ibeta(l,t,o)-e)/(c=r.exp(p*r.log(l)+g*r.log(1-l)+d)))/(1-.5*r.min(1,s*(p/l-g/(1-l)))))<=0&&(l=.5*(l+c)),l>=1&&(l=.5*(l+c+1)),r.abs(c)<1e-8*l&&v>0)break}return l},n.ibeta=function(e,t,o){var i=0===e||1===e?0:r.exp(n.gammaln(t+o)-n.gammaln(t)-n.gammaln(o)+t*r.log(e)+o*r.log(1-e));return!(e<0||e>1)&&(e<(t+1)/(t+o+2)?i*n.betacf(e,t,o)/t:1-i*n.betacf(1-e,o,t)/o)},n.randn=function(e,t){var o,i,u,a,c;if(t||(t=e),e)return n.create(e,t,(function(){return n.randn()}));do{o=n._random_fn(),i=1.7156*(n._random_fn()-.5),c=(u=o-.449871)*u+(a=r.abs(i)+.386595)*(.196*a-.25472*u)}while(c>.27597&&(c>.27846||i*i>-4*r.log(o)*o*o));return i/o},n.randg=function(e,t,o){var i,u,a,c,s,l,f=e;if(o||(o=t),e||(e=1),t)return(l=n.zeros(t,o)).alter((function(){return n.randg(e)})),l;e<1&&(e+=1),i=e-1/3,u=1/r.sqrt(9*i);do{do{c=1+u*(s=n.randn())}while(c<=0);c*=c*c,a=n._random_fn()}while(a>1-.331*r.pow(s,4)&&r.log(a)>.5*s*s+i*(1-c+r.log(c)));if(e==f)return i*c;do{a=n._random_fn()}while(0===a);return r.pow(a,1/f)*i*c},function(r){for(var e=0;e<r.length;e++)!function(r){n.fn[r]=function(){return n(n.map(this,(function(e){return n[r](e)})))}}(r[e])}("gammaln gammafn factorial factorialln".split(" ")),function(r){for(var e=0;e<r.length;e++)!function(r){n.fn[r]=function(){return n(n[r].apply(null,arguments))}}(r[e])}("randn".split(" "))}(r,Math),function(n,r){function e(n,e,t,o){for(var i,u=0,a=1,c=1,s=1,l=0,f=0;r.abs((c-f)/c)>o;)f=c,a=s+(i=-(e+l)*(e+t+l)*n/(e+2*l)/(e+2*l+1))*a,c=(u=c+i*u)+(i=(l+=1)*(t-l)*n/(e+2*l-1)/(e+2*l))*c,u/=s=a+i*s,a/=s,c/=s,s=1;return c/e}function t(e,t,o){var i=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],u=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],a=.5*e;if(a>=8)return 1;var c,s=2*n.normal.cdf(a,0,1,1,0)-1;s=s>=r.exp(-50/o)?r.pow(s,o):0;for(var l=a,f=(8-a)/(c=e>3?2:3),m=l+f,h=0,d=o-1,p=1;p<=c;p++){for(var g=0,v=.5*(m+l),y=.5*(m-l),x=1;x<=12;x++){var w,b=v+y*(6<x?i[(w=12-x+1)-1]:-i[(w=x)-1]),T=b*b;if(T>60)break;var _=2*n.normal.cdf(b,0,1,1,0)*.5-2*n.normal.cdf(b,e,1,1,0)*.5;_>=r.exp(-30/d)&&(g+=_=u[w-1]*r.exp(-.5*T)*r.pow(_,d))}h+=g*=2*y*o/r.sqrt(2*r.PI),l=m,m+=f}return(s+=h)<=r.exp(-30/t)?0:(s=r.pow(s,t))>=1?1:s}!function(r){for(var e=0;e<r.length;e++)!function(r){n[r]=function n(r,e,t){return this instanceof n?(this._a=r,this._b=e,this._c=t,this):new n(r,e,t)},n.fn[r]=function(e,t,o){var i=n[r](e,t,o);return i.data=this,i},n[r].prototype.sample=function(e){var t=this._a,o=this._b,i=this._c;return e?n.alter(e,(function(){return n[r].sample(t,o,i)})):n[r].sample(t,o,i)},function(e){for(var t=0;t<e.length;t++)!function(e){n[r].prototype[e]=function(t){var o=this._a,i=this._b,u=this._c;return t||0===t||(t=this.data),"number"!=typeof t?n.fn.map.call(t,(function(t){return n[r][e](t,o,i,u)})):n[r][e](t,o,i,u)}}(e[t])}("pdf cdf inv".split(" ")),function(e){for(var t=0;t<e.length;t++)!function(e){n[r].prototype[e]=function(){return n[r][e](this._a,this._b,this._c)}}(e[t])}("mean median mode variance".split(" "))}(r[e])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),n.extend(n.beta,{pdf:function(e,t,o){return e>1||e<0?0:1==t&&1==o?1:t<512&&o<512?r.pow(e,t-1)*r.pow(1-e,o-1)/n.betafn(t,o):r.exp((t-1)*r.log(e)+(o-1)*r.log(1-e)-n.betaln(t,o))},cdf:function(r,e,t){return r>1||r<0?1*(r>1):n.ibeta(r,e,t)},inv:function(r,e,t){return n.ibetainv(r,e,t)},mean:function(n,r){return n/(n+r)},median:function(r,e){return n.ibetainv(.5,r,e)},mode:function(n,r){return(n-1)/(n+r-2)},sample:function(r,e){var t=n.randg(r);return t/(t+n.randg(e))},variance:function(n,e){return n*e/(r.pow(n+e,2)*(n+e+1))}}),n.extend(n.centralF,{pdf:function(e,t,o){var i;return e<0?0:t<=2?0===e&&t<2?1/0:0===e&&2===t?1:1/n.betafn(t/2,o/2)*r.pow(t/o,t/2)*r.pow(e,t/2-1)*r.pow(1+t/o*e,-(t+o)/2):(i=t*e/(o+e*t),t*(o/(o+e*t))/2*n.binomial.pdf((t-2)/2,(t+o-2)/2,i))},cdf:function(r,e,t){return r<0?0:n.ibeta(e*r/(e*r+t),e/2,t/2)},inv:function(r,e,t){return t/(e*(1/n.ibetainv(r,e/2,t/2)-1))},mean:function(n,r){return r>2?r/(r-2):void 0},mode:function(n,r){return n>2?r*(n-2)/(n*(r+2)):void 0},sample:function(r,e){return 2*n.randg(r/2)/r/(2*n.randg(e/2)/e)},variance:function(n,r){if(!(r<=4))return 2*r*r*(n+r-2)/(n*(r-2)*(r-2)*(r-4))}}),n.extend(n.cauchy,{pdf:function(n,e,t){return t<0?0:t/(r.pow(n-e,2)+r.pow(t,2))/r.PI},cdf:function(n,e,t){return r.atan((n-e)/t)/r.PI+.5},inv:function(n,e,t){return e+t*r.tan(r.PI*(n-.5))},median:function(n){return n},mode:function(n){return n},sample:function(e,t){return n.randn()*r.sqrt(1/(2*n.randg(.5)))*t+e}}),n.extend(n.chisquare,{pdf:function(e,t){return e<0?0:0===e&&2===t?.5:r.exp((t/2-1)*r.log(e)-e/2-t/2*r.log(2)-n.gammaln(t/2))},cdf:function(r,e){return r<0?0:n.lowRegGamma(e/2,r/2)},inv:function(r,e){return 2*n.gammapinv(r,.5*e)},mean:function(n){return n},median:function(n){return n*r.pow(1-2/(9*n),3)},mode:function(n){return n-2>0?n-2:0},sample:function(r){return 2*n.randg(r/2)},variance:function(n){return 2*n}}),n.extend(n.exponential,{pdf:function(n,e){return n<0?0:e*r.exp(-e*n)},cdf:function(n,e){return n<0?0:1-r.exp(-e*n)},inv:function(n,e){return-r.log(1-n)/e},mean:function(n){return 1/n},median:function(n){return 1/n*r.log(2)},mode:function(){return 0},sample:function(e){return-1/e*r.log(n._random_fn())},variance:function(n){return r.pow(n,-2)}}),n.extend(n.gamma,{pdf:function(e,t,o){return e<0?0:0===e&&1===t?1/o:r.exp((t-1)*r.log(e)-e/o-n.gammaln(t)-t*r.log(o))},cdf:function(r,e,t){return r<0?0:n.lowRegGamma(e,r/t)},inv:function(r,e,t){return n.gammapinv(r,e)*t},mean:function(n,r){return n*r},mode:function(n,r){if(n>1)return(n-1)*r},sample:function(r,e){return n.randg(r)*e},variance:function(n,r){return n*r*r}}),n.extend(n.invgamma,{pdf:function(e,t,o){return e<=0?0:r.exp(-(t+1)*r.log(e)-o/e-n.gammaln(t)+t*r.log(o))},cdf:function(r,e,t){return r<=0?0:1-n.lowRegGamma(e,t/r)},inv:function(r,e,t){return t/n.gammapinv(1-r,e)},mean:function(n,r){return n>1?r/(n-1):void 0},mode:function(n,r){return r/(n+1)},sample:function(r,e){return e/n.randg(r)},variance:function(n,r){if(!(n<=2))return r*r/((n-1)*(n-1)*(n-2))}}),n.extend(n.kumaraswamy,{pdf:function(n,e,t){return 0===n&&1===e?t:1===n&&1===t?e:r.exp(r.log(e)+r.log(t)+(e-1)*r.log(n)+(t-1)*r.log(1-r.pow(n,e)))},cdf:function(n,e,t){return n<0?0:n>1?1:1-r.pow(1-r.pow(n,e),t)},inv:function(n,e,t){return r.pow(1-r.pow(1-n,1/t),1/e)},mean:function(r,e){return e*n.gammafn(1+1/r)*n.gammafn(e)/n.gammafn(1+1/r+e)},median:function(n,e){return r.pow(1-r.pow(2,-1/e),1/n)},mode:function(n,e){if(n>=1&&e>=1&&1!==n&&1!==e)return r.pow((n-1)/(n*e-1),1/n)},variance:function(){throw new Error("variance not yet implemented")}}),n.extend(n.lognormal,{pdf:function(n,e,t){return n<=0?0:r.exp(-r.log(n)-.5*r.log(2*r.PI)-r.log(t)-r.pow(r.log(n)-e,2)/(2*t*t))},cdf:function(e,t,o){return e<0?0:.5+.5*n.erf((r.log(e)-t)/r.sqrt(2*o*o))},inv:function(e,t,o){return r.exp(-1.4142135623730951*o*n.erfcinv(2*e)+t)},mean:function(n,e){return r.exp(n+e*e/2)},median:function(n){return r.exp(n)},mode:function(n,e){return r.exp(n-e*e)},sample:function(e,t){return r.exp(n.randn()*t+e)},variance:function(n,e){return(r.exp(e*e)-1)*r.exp(2*n+e*e)}}),n.extend(n.noncentralt,{pdf:function(e,t,o){return r.abs(o)<1e-14?n.studentt.pdf(e,t):r.abs(e)<1e-14?r.exp(n.gammaln((t+1)/2)-o*o/2-.5*r.log(r.PI*t)-n.gammaln(t/2)):t/e*(n.noncentralt.cdf(e*r.sqrt(1+2/t),t+2,o)-n.noncentralt.cdf(e,t,o))},cdf:function(e,t,o){var i=1e-14;if(r.abs(o)<i)return n.studentt.cdf(e,t);var u=!1;e<0&&(u=!0,o=-o);for(var a=n.normal.cdf(-o,0,1),c=i+1,s=c,l=e*e/(e*e+t),f=0,m=r.exp(-o*o/2),h=r.exp(-o*o/2-.5*r.log(2)-n.gammaln(1.5))*o;f<200||s>i||c>i;)s=c,f>0&&(m*=o*o/(2*f),h*=o*o/(2*(f+.5))),a+=.5*(c=m*n.beta.cdf(l,f+.5,t/2)+h*n.beta.cdf(l,f+1,t/2)),f++;return u?1-a:a}}),n.extend(n.normal,{pdf:function(n,e,t){return r.exp(-.5*r.log(2*r.PI)-r.log(t)-r.pow(n-e,2)/(2*t*t))},cdf:function(e,t,o){return.5*(1+n.erf((e-t)/r.sqrt(2*o*o)))},inv:function(r,e,t){return-1.4142135623730951*t*n.erfcinv(2*r)+e},mean:function(n){return n},median:function(n){return n},mode:function(n){return n},sample:function(r,e){return n.randn()*e+r},variance:function(n,r){return r*r}}),n.extend(n.pareto,{pdf:function(n,e,t){return n<e?0:t*r.pow(e,t)/r.pow(n,t+1)},cdf:function(n,e,t){return n<e?0:1-r.pow(e/n,t)},inv:function(n,e,t){return e/r.pow(1-n,1/t)},mean:function(n,e){if(!(e<=1))return e*r.pow(n,e)/(e-1)},median:function(n,e){return n*(e*r.SQRT2)},mode:function(n){return n},variance:function(n,e){if(!(e<=2))return n*n*e/(r.pow(e-1,2)*(e-2))}}),n.extend(n.studentt,{pdf:function(e,t){return t=t>1e100?1e100:t,1/(r.sqrt(t)*n.betafn(.5,t/2))*r.pow(1+e*e/t,-(t+1)/2)},cdf:function(e,t){var o=t/2;return n.ibeta((e+r.sqrt(e*e+t))/(2*r.sqrt(e*e+t)),o,o)},inv:function(e,t){var o=n.ibetainv(2*r.min(e,1-e),.5*t,.5);return o=r.sqrt(t*(1-o)/o),e>.5?o:-o},mean:function(n){return n>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(e){return n.randn()*r.sqrt(e/(2*n.randg(e/2)))},variance:function(n){return n>2?n/(n-2):n>1?1/0:void 0}}),n.extend(n.weibull,{pdf:function(n,e,t){return n<0||e<0||t<0?0:t/e*r.pow(n/e,t-1)*r.exp(-r.pow(n/e,t))},cdf:function(n,e,t){return n<0?0:1-r.exp(-r.pow(n/e,t))},inv:function(n,e,t){return e*r.pow(-r.log(1-n),1/t)},mean:function(r,e){return r*n.gammafn(1+1/e)},median:function(n,e){return n*r.pow(r.log(2),1/e)},mode:function(n,e){return e<=1?0:n*r.pow((e-1)/e,1/e)},sample:function(e,t){return e*r.pow(-r.log(n._random_fn()),1/t)},variance:function(e,t){return e*e*n.gammafn(1+2/t)-r.pow(n.weibull.mean(e,t),2)}}),n.extend(n.uniform,{pdf:function(n,r,e){return n<r||n>e?0:1/(e-r)},cdf:function(n,r,e){return n<r?0:n<e?(n-r)/(e-r):1},inv:function(n,r,e){return r+n*(e-r)},mean:function(n,r){return.5*(n+r)},median:function(r,e){return n.mean(r,e)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(r,e){return r/2+e/2+(e/2-r/2)*(2*n._random_fn()-1)},variance:function(n,e){return r.pow(e-n,2)/12}}),n.extend(n.binomial,{pdf:function(e,t,o){return 0===o||1===o?t*o===e?1:0:n.combination(t,e)*r.pow(o,e)*r.pow(1-o,t-e)},cdf:function(t,o,i){var u,a=1e-10;if(t<0)return 0;if(t>=o)return 1;if(i<0||i>1||o<=0)return NaN;var c=i,s=(t=r.floor(t))+1,l=o-t,f=s+l,m=r.exp(n.gammaln(f)-n.gammaln(l)-n.gammaln(s)+s*r.log(c)+l*r.log(1-c));return u=c<(s+1)/(f+2)?m*e(c,s,l,a):1-m*e(1-c,l,s,a),r.round(1/a*(1-u))/(1/a)}}),n.extend(n.negbin,{pdf:function(e,t,o){return e===e>>>0&&(e<0?0:n.combination(e+t-1,t-1)*r.pow(1-o,e)*r.pow(o,t))},cdf:function(r,e,t){var o=0,i=0;if(r<0)return 0;for(;i<=r;i++)o+=n.negbin.pdf(i,e,t);return o}}),n.extend(n.hypgeom,{pdf:function(e,t,o,i){if(e!=e|0)return!1;if(e<0||e<o-(t-i))return 0;if(e>i||e>o)return 0;if(2*o>t)return 2*i>t?n.hypgeom.pdf(t-o-i+e,t,t-o,t-i):n.hypgeom.pdf(i-e,t,t-o,i);if(2*i>t)return n.hypgeom.pdf(o-e,t,o,t-i);if(o<i)return n.hypgeom.pdf(e,t,i,o);for(var u=1,a=0,c=0;c<e;c++){for(;u>1&&a<i;)u*=1-o/(t-a),a++;u*=(i-c)*(o-c)/((c+1)*(t-o-i+c+1))}for(;a<i;a++)u*=1-o/(t-a);return r.min(1,r.max(0,u))},cdf:function(e,t,o,i){if(e<0||e<o-(t-i))return 0;if(e>=i||e>=o)return 1;if(2*o>t)return 2*i>t?n.hypgeom.cdf(t-o-i+e,t,t-o,t-i):1-n.hypgeom.cdf(i-e-1,t,t-o,i);if(2*i>t)return 1-n.hypgeom.cdf(o-e-1,t,o,t-i);if(o<i)return n.hypgeom.cdf(e,t,i,o);for(var u=1,a=1,c=0,s=0;s<e;s++){for(;u>1&&c<i;){var l=1-o/(t-c);a*=l,u*=l,c++}u+=a*=(i-s)*(o-s)/((s+1)*(t-o-i+s+1))}for(;c<i;c++)u*=1-o/(t-c);return r.min(1,r.max(0,u))}}),n.extend(n.poisson,{pdf:function(e,t){return t<0||e%1!=0||e<0?0:r.pow(t,e)*r.exp(-t)/n.factorial(e)},cdf:function(r,e){var t=[],o=0;if(r<0)return 0;for(;o<=r;o++)t.push(n.poisson.pdf(o,e));return n.sum(t)},mean:function(n){return n},variance:function(n){return n},sampleSmall:function(e){var t=1,o=0,i=r.exp(-e);do{o++,t*=n._random_fn()}while(t>i);return o-1},sampleLarge:function(e){var t,o,i,u,a,c,s,l,f,m,h=e;for(u=r.sqrt(h),a=r.log(h),c=.02483*(s=.931+2.53*u)-.059,l=1.1239+1.1328/(s-3.4),f=.9277-3.6224/(s-2);;){if(o=r.random()-.5,i=r.random(),m=.5-r.abs(o),t=r.floor((2*c/m+s)*o+h+.43),m>=.07&&i<=f)return t;if(!(t<0||m<.013&&i>m)&&r.log(i)+r.log(l)-r.log(c/(m*m)+s)<=t*a-h-n.loggam(t+1))return t}},sample:function(n){return n<10?this.sampleSmall(n):this.sampleLarge(n)}}),n.extend(n.triangular,{pdf:function(n,r,e,t){return e<=r||t<r||t>e?NaN:n<r||n>e?0:n<t?2*(n-r)/((e-r)*(t-r)):n===t?2/(e-r):2*(e-n)/((e-r)*(e-t))},cdf:function(n,e,t,o){return t<=e||o<e||o>t?NaN:n<=e?0:n>=t?1:n<=o?r.pow(n-e,2)/((t-e)*(o-e)):1-r.pow(t-n,2)/((t-e)*(t-o))},inv:function(n,e,t,o){return t<=e||o<e||o>t?NaN:n<=(o-e)/(t-e)?e+(t-e)*r.sqrt(n*((o-e)/(t-e))):e+(t-e)*(1-r.sqrt((1-n)*(1-(o-e)/(t-e))))},mean:function(n,r,e){return(n+r+e)/3},median:function(n,e,t){return t<=(n+e)/2?e-r.sqrt((e-n)*(e-t))/r.sqrt(2):t>(n+e)/2?n+r.sqrt((e-n)*(t-n))/r.sqrt(2):void 0},mode:function(n,r,e){return e},sample:function(e,t,o){var i=n._random_fn();return i<(o-e)/(t-e)?e+r.sqrt(i*(t-e)*(o-e)):t-r.sqrt((1-i)*(t-e)*(t-o))},variance:function(n,r,e){return(n*n+r*r+e*e-n*r-n*e-r*e)/18}}),n.extend(n.arcsine,{pdf:function(n,e,t){return t<=e?NaN:n<=e||n>=t?0:2/r.PI*r.pow(r.pow(t-e,2)-r.pow(2*n-e-t,2),-.5)},cdf:function(n,e,t){return n<e?0:n<t?2/r.PI*r.asin(r.sqrt((n-e)/(t-e))):1},inv:function(n,e,t){return e+(.5-.5*r.cos(r.PI*n))*(t-e)},mean:function(n,r){return r<=n?NaN:(n+r)/2},median:function(n,r){return r<=n?NaN:(n+r)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(e,t){return(e+t)/2+(t-e)/2*r.sin(2*r.PI*n.uniform.sample(0,1))},variance:function(n,e){return e<=n?NaN:r.pow(e-n,2)/8}}),n.extend(n.laplace,{pdf:function(n,e,t){return t<=0?0:r.exp(-r.abs(n-e)/t)/(2*t)},cdf:function(n,e,t){return t<=0?0:n<e?.5*r.exp((n-e)/t):1-.5*r.exp(-(n-e)/t)},mean:function(n){return n},median:function(n){return n},mode:function(n){return n},variance:function(n,r){return 2*r*r},sample:function(e,t){var o,i=n._random_fn()-.5;return e-t*((o=i)/r.abs(o))*r.log(1-2*r.abs(i))}}),n.extend(n.tukey,{cdf:function(e,o,i){var u=o,a=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],c=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(e<=0)return 0;if(i<2||u<2)return NaN;if(!Number.isFinite(e))return 1;if(i>25e3)return t(e,1,u);var s,l=.5*i,f=l*r.log(i)-i*r.log(2)-n.gammaln(l),m=l-1,h=.25*i;s=i<=100?1:i<=800?.5:i<=5e3?.25:.125,f+=r.log(s);for(var d=0,p=1;p<=50;p++){for(var g=0,v=(2*p-1)*s,y=1;y<=16;y++){var x,w;8<y?(x=y-8-1,w=f+m*r.log(v+a[x]*s)-(a[x]*s+v)*h):(x=y-1,w=f+m*r.log(v-a[x]*s)+(a[x]*s-v)*h),w>=-30&&(g+=t(8<y?e*r.sqrt(.5*(a[x]*s+v)):e*r.sqrt(.5*(-a[x]*s+v)),1,u)*c[x]*r.exp(w))}if(p*s>=1&&g<=1e-14)break;d+=g}if(g>1e-14)throw new Error("tukey.cdf failed to converge");return d>1&&(d=1),d},inv:function(e,t,o){if(o<2||t<2)return NaN;if(e<0||e>1)return NaN;if(0===e)return 0;if(1===e)return 1/0;var i,u=function(n,e,t){var o=.5-.5*n,i=r.sqrt(r.log(1/(o*o))),u=i+((((-453642210148e-16*i-.204231210125)*i-.342242088547)*i-1)*i+.322232421088)/((((.0038560700634*i+.10353775285)*i+.531103462366)*i+.588581570495)*i+.099348462606);t<120&&(u+=(u*u*u+u)/t/4);var a=.8832-.2368*u;return t<120&&(a+=-1.214/t+1.208*u/t),u*(a*r.log(e-1)+1.4142)}(e,t,o),a=n.tukey.cdf(u,t,o)-e;i=a>0?r.max(0,u-1):u+1;for(var c,s=n.tukey.cdf(i,t,o)-e,l=1;l<50;l++)if(c=i-s*(i-u)/(s-a),a=s,u=i,c<0&&(c=0,s=-e),s=n.tukey.cdf(c,t,o)-e,i=c,r.abs(i-u)<1e-4)return c;throw new Error("tukey.inv failed to converge")}})}(r,Math),function(n,r){var e,t,o=Array.prototype.push,i=n.utils.isArray;function u(r){return i(r)||r instanceof n}n.extend({add:function(r,e){return u(e)?(u(e[0])||(e=[e]),n.map(r,(function(n,r,t){return n+e[r][t]}))):n.map(r,(function(n){return n+e}))},subtract:function(r,e){return u(e)?(u(e[0])||(e=[e]),n.map(r,(function(n,r,t){return n-e[r][t]||0}))):n.map(r,(function(n){return n-e}))},divide:function(r,e){return u(e)?(u(e[0])||(e=[e]),n.multiply(r,n.inv(e))):n.map(r,(function(n){return n/e}))},multiply:function(r,e){var t,o,i,a,c,s,l,f;if(void 0===r.length&&void 0===e.length)return r*e;if(c=r.length,s=r[0].length,l=n.zeros(c,i=u(e)?e[0].length:s),f=0,u(e)){for(;f<i;f++)for(t=0;t<c;t++){for(a=0,o=0;o<s;o++)a+=r[t][o]*e[o][f];l[t][f]=a}return 1===c&&1===f?l[0][0]:l}return n.map(r,(function(n){return n*e}))},outer:function(r,e){return n.multiply(r.map((function(n){return[n]})),[e])},dot:function(r,e){u(r[0])||(r=[r]),u(e[0])||(e=[e]);for(var t,o,i=1===r[0].length&&1!==r.length?n.transpose(r):r,a=1===e[0].length&&1!==e.length?n.transpose(e):e,c=[],s=0,l=i.length,f=i[0].length;s<l;s++){for(c[s]=[],t=0,o=0;o<f;o++)t+=i[s][o]*a[s][o];c[s]=t}return 1===c.length?c[0]:c},pow:function(e,t){return n.map(e,(function(n){return r.pow(n,t)}))},exp:function(e){return n.map(e,(function(n){return r.exp(n)}))},log:function(e){return n.map(e,(function(n){return r.log(n)}))},abs:function(e){return n.map(e,(function(n){return r.abs(n)}))},norm:function(n,e){var t=0,o=0;for(isNaN(e)&&(e=2),u(n[0])&&(n=n[0]);o<n.length;o++)t+=r.pow(r.abs(n[o]),e);return r.pow(t,1/e)},angle:function(e,t){return r.acos(n.dot(e,t)/(n.norm(e)*n.norm(t)))},aug:function(n,r){var e,t=[];for(e=0;e<n.length;e++)t.push(n[e].slice());for(e=0;e<t.length;e++)o.apply(t[e],r[e]);return t},inv:function(r){for(var e,t=r.length,o=r[0].length,i=n.identity(t,o),u=n.gauss_jordan(r,i),a=[],c=0;c<t;c++)for(a[c]=[],e=o;e<u[0].length;e++)a[c][e-o]=u[c][e];return a},det:function n(r){if(2===r.length)return r[0][0]*r[1][1]-r[0][1]*r[1][0];for(var e=0,t=0;t<r.length;t++){for(var o=[],i=1;i<r.length;i++){o[i-1]=[];for(var u=0;u<r.length;u++)u<t?o[i-1][u]=r[i][u]:u>t&&(o[i-1][u-1]=r[i][u])}var a=t%2?-1:1;e+=n(o)*r[0][t]*a}return e},gauss_elimination:function(e,t){var o,i,u,a,c=0,s=0,l=e.length,f=e[0].length,m=1,h=0,d=[];for(o=(e=n.aug(e,t))[0].length,c=0;c<l;c++){for(i=e[c][c],s=c,a=c+1;a<f;a++)i<r.abs(e[a][c])&&(i=e[a][c],s=a);if(s!=c)for(a=0;a<o;a++)u=e[c][a],e[c][a]=e[s][a],e[s][a]=u;for(s=c+1;s<l;s++)for(m=e[s][c]/e[c][c],a=c;a<o;a++)e[s][a]=e[s][a]-m*e[c][a]}for(c=l-1;c>=0;c--){for(h=0,s=c+1;s<=l-1;s++)h+=d[s]*e[c][s];d[c]=(e[c][o-1]-h)/e[c][c]}return d},gauss_jordan:function(e,t){var o,i,u,a=n.aug(e,t),c=a.length,s=a[0].length,l=0;for(i=0;i<c;i++){var f=i;for(u=i+1;u<c;u++)r.abs(a[u][i])>r.abs(a[f][i])&&(f=u);var m=a[i];for(a[i]=a[f],a[f]=m,u=i+1;u<c;u++)for(l=a[u][i]/a[i][i],o=i;o<s;o++)a[u][o]-=a[i][o]*l}for(i=c-1;i>=0;i--){for(l=a[i][i],u=0;u<i;u++)for(o=s-1;o>i-1;o--)a[u][o]-=a[i][o]*a[u][i]/l;for(a[i][i]/=l,o=c;o<s;o++)a[i][o]/=l}return a},triaUpSolve:function(r,e){var t,o=r[0].length,i=n.zeros(1,o)[0],u=!1;return null!=e[0].length&&(e=e.map((function(n){return n[0]})),u=!0),n.arange(o-1,-1,-1).forEach((function(u){t=n.arange(u+1,o).map((function(n){return i[n]*r[u][n]})),i[u]=(e[u]-n.sum(t))/r[u][u]})),u?i.map((function(n){return[n]})):i},triaLowSolve:function(r,e){var t,o=r[0].length,i=n.zeros(1,o)[0],u=!1;return null!=e[0].length&&(e=e.map((function(n){return n[0]})),u=!0),n.arange(o).forEach((function(o){t=n.arange(o).map((function(n){return r[o][n]*i[n]})),i[o]=(e[o]-n.sum(t))/r[o][o]})),u?i.map((function(n){return[n]})):i},lu:function(r){var e,t=r.length,o=n.identity(t),i=n.zeros(r.length,r[0].length);return n.arange(t).forEach((function(n){i[0][n]=r[0][n]})),n.arange(1,t).forEach((function(u){n.arange(u).forEach((function(t){e=n.arange(t).map((function(n){return o[u][n]*i[n][t]})),o[u][t]=(r[u][t]-n.sum(e))/i[t][t]})),n.arange(u,t).forEach((function(t){e=n.arange(u).map((function(n){return o[u][n]*i[n][t]})),i[u][t]=r[e.length][t]-n.sum(e)}))})),[o,i]},cholesky:function(e){var t,o=e.length,i=n.zeros(e.length,e[0].length);return n.arange(o).forEach((function(u){t=n.arange(u).map((function(n){return r.pow(i[u][n],2)})),i[u][u]=r.sqrt(e[u][u]-n.sum(t)),n.arange(u+1,o).forEach((function(r){t=n.arange(u).map((function(n){return i[u][n]*i[r][n]})),i[r][u]=(e[u][r]-n.sum(t))/i[u][u]}))})),i},gauss_jacobi:function(e,t,o,i){for(var u,a,c,s,l=0,f=0,m=e.length,h=[],d=[],p=[];l<m;l++)for(h[l]=[],d[l]=[],p[l]=[],f=0;f<m;f++)l>f?(h[l][f]=e[l][f],d[l][f]=p[l][f]=0):l<f?(d[l][f]=e[l][f],h[l][f]=p[l][f]=0):(p[l][f]=e[l][f],h[l][f]=d[l][f]=0);for(c=n.multiply(n.multiply(n.inv(p),n.add(h,d)),-1),a=n.multiply(n.inv(p),t),u=o,s=n.add(n.multiply(c,o),a),l=2;r.abs(n.norm(n.subtract(s,u)))>i;)u=s,s=n.add(n.multiply(c,u),a),l++;return s},gauss_seidel:function(e,t,o,i){for(var u,a,c,s,l,f=0,m=e.length,h=[],d=[],p=[];f<m;f++)for(h[f]=[],d[f]=[],p[f]=[],u=0;u<m;u++)f>u?(h[f][u]=e[f][u],d[f][u]=p[f][u]=0):f<u?(d[f][u]=e[f][u],h[f][u]=p[f][u]=0):(p[f][u]=e[f][u],h[f][u]=d[f][u]=0);for(s=n.multiply(n.multiply(n.inv(n.add(p,h)),d),-1),c=n.multiply(n.inv(n.add(p,h)),t),a=o,l=n.add(n.multiply(s,o),c),f=2;r.abs(n.norm(n.subtract(l,a)))>i;)a=l,l=n.add(n.multiply(s,a),c),f+=1;return l},SOR:function(e,t,o,i,u){for(var a,c,s,l,f,m=0,h=e.length,d=[],p=[],g=[];m<h;m++)for(d[m]=[],p[m]=[],g[m]=[],a=0;a<h;a++)m>a?(d[m][a]=e[m][a],p[m][a]=g[m][a]=0):m<a?(p[m][a]=e[m][a],d[m][a]=g[m][a]=0):(g[m][a]=e[m][a],d[m][a]=p[m][a]=0);for(l=n.multiply(n.inv(n.add(g,n.multiply(d,u))),n.subtract(n.multiply(g,1-u),n.multiply(p,u))),s=n.multiply(n.multiply(n.inv(n.add(g,n.multiply(d,u))),t),u),c=o,f=n.add(n.multiply(l,o),s),m=2;r.abs(n.norm(n.subtract(f,c)))>i;)c=f,f=n.add(n.multiply(l,c),s),m++;return f},householder:function(e){for(var t,o,i,u,a=e.length,c=e[0].length,s=0,l=[],f=[];s<a-1;s++){for(t=0,u=s+1;u<c;u++)t+=e[u][s]*e[u][s];for(t=(e[s+1][s]>0?-1:1)*r.sqrt(t),o=r.sqrt((t*t-e[s+1][s]*t)/2),(l=n.zeros(a,1))[s+1][0]=(e[s+1][s]-t)/(2*o),i=s+2;i<a;i++)l[i][0]=e[i][s]/(2*o);f=n.subtract(n.identity(a,c),n.multiply(n.multiply(l,n.transpose(l)),2)),e=n.multiply(f,n.multiply(e,f))}return e},QR:(e=n.sum,t=n.arange,function(o){var i,u,a,c=o.length,s=o[0].length,l=n.zeros(s,s);for(o=n.copy(o),u=0;u<s;u++){for(l[u][u]=r.sqrt(e(t(c).map((function(n){return o[n][u]*o[n][u]})))),i=0;i<c;i++)o[i][u]=o[i][u]/l[u][u];for(a=u+1;a<s;a++)for(l[u][a]=e(t(c).map((function(n){return o[n][u]*o[n][a]}))),i=0;i<c;i++)o[i][a]=o[i][a]-o[i][u]*l[u][a]}return[o,l]}),lstsq:function(r,e){var t=!1;void 0===e[0].length&&(e=e.map((function(n){return[n]})),t=!0);var o=n.QR(r),i=o[0],u=o[1],a=r[0].length,c=n.slice(i,{col:{end:a}}),s=function(r){var e=(r=n.copy(r)).length,t=n.identity(e);return n.arange(e-1,-1,-1).forEach((function(e){n.sliceAssign(t,{row:e},n.divide(n.slice(t,{row:e}),r[e][e])),n.sliceAssign(r,{row:e},n.divide(n.slice(r,{row:e}),r[e][e])),n.arange(e).forEach((function(o){var i=n.multiply(r[o][e],-1),u=n.slice(r,{row:o}),a=n.multiply(n.slice(r,{row:e}),i);n.sliceAssign(r,{row:o},n.add(u,a));var c=n.slice(t,{row:o}),s=n.multiply(n.slice(t,{row:e}),i);n.sliceAssign(t,{row:o},n.add(c,s))}))})),t}(n.slice(u,{row:{end:a}})),l=n.transpose(c);void 0===l[0].length&&(l=[l]);var f=n.multiply(n.multiply(s,l),e);return void 0===f.length&&(f=[[f]]),t?f.map((function(n){return n[0]})):f},jacobi:function(e){for(var t,o,i,u,a,c,s,l=1,f=e.length,m=n.identity(f,f),h=[];1===l;){for(a=e[0][1],i=0,u=1,t=0;t<f;t++)for(o=0;o<f;o++)t!=o&&a<r.abs(e[t][o])&&(a=r.abs(e[t][o]),i=t,u=o);for(c=e[i][i]===e[u][u]?e[i][u]>0?r.PI/4:-r.PI/4:r.atan(2*e[i][u]/(e[i][i]-e[u][u]))/2,(s=n.identity(f,f))[i][i]=r.cos(c),s[i][u]=-r.sin(c),s[u][i]=r.sin(c),s[u][u]=r.cos(c),m=n.multiply(m,s),e=n.multiply(n.multiply(n.inv(s),e),s),l=0,t=1;t<f;t++)for(o=1;o<f;o++)t!=o&&r.abs(e[t][o])>.001&&(l=1)}for(t=0;t<f;t++)h.push(e[t][t]);return[m,h]},rungekutta:function(n,r,e,t,o,i){var u,a,c;if(2===i)for(;t<=e;)o+=((u=r*n(t,o))+(a=r*n(t+r,o+u)))/2,t+=r;if(4===i)for(;t<=e;)o+=((u=r*n(t,o))+2*(a=r*n(t+r/2,o+u/2))+2*(c=r*n(t+r/2,o+a/2))+r*n(t+r,o+c))/6,t+=r;return o},romberg:function(n,e,t,o){for(var i,u,a,c,s,l=0,f=(t-e)/2,m=[],h=[],d=[];l<o/2;){for(s=n(e),a=e,c=0;a<=t;a+=f,c++)m[c]=a;for(i=m.length,a=1;a<i-1;a++)s+=(a%2!=0?4:2)*n(m[a]);s=f/3*(s+n(t)),d[l]=s,f/=2,l++}for(u=d.length,i=1;1!==u;){for(a=0;a<u-1;a++)h[a]=(r.pow(4,i)*d[a+1]-d[a])/(r.pow(4,i)-1);u=h.length,d=h,h=[],i++}return d},richardson:function(n,e,t,o){function i(n,r){for(var e,t=0,o=n.length;t<o;t++)n[t]===r&&(e=t);return e}for(var u,a,c,s,l,f=r.abs(t-n[i(n,t)+1]),m=0,h=[],d=[];o>=f;)u=i(n,t+o),a=i(n,t),h[m]=(e[u]-2*e[a]+e[2*a-u])/(o*o),o/=2,m++;for(s=h.length,c=1;1!=s;){for(l=0;l<s-1;l++)d[l]=(r.pow(4,c)*h[l+1]-h[l])/(r.pow(4,c)-1);s=d.length,h=d,d=[],c++}return h},simpson:function(n,r,e,t){for(var o,i=(e-r)/t,u=n(r),a=[],c=r,s=0,l=1;c<=e;c+=i,s++)a[s]=c;for(o=a.length;l<o-1;l++)u+=(l%2!=0?4:2)*n(a[l]);return i/3*(u+n(e))},hermite:function(n,r,e,t){for(var o,i=n.length,u=0,a=0,c=[],s=[],l=[],f=[];a<i;a++){for(c[a]=1,o=0;o<i;o++)a!=o&&(c[a]*=(t-n[o])/(n[a]-n[o]));for(s[a]=0,o=0;o<i;o++)a!=o&&(s[a]+=1/(n[a]-n[o]));l[a]=(1-2*(t-n[a])*s[a])*(c[a]*c[a]),f[a]=(t-n[a])*(c[a]*c[a]),u+=l[a]*r[a]+f[a]*e[a]}return u},lagrange:function(n,r,e){for(var t,o,i=0,u=0,a=n.length;u<a;u++){for(o=r[u],t=0;t<a;t++)u!=t&&(o*=(e-n[t])/(n[u]-n[t]));i+=o}return i},cubic_spline:function(r,e,t){for(var o,i,u=r.length,a=0,c=[],s=[],l=[],f=[],m=[],h=[];a<u-1;a++)f[a]=r[a+1]-r[a];for(l[0]=0,a=1;a<u-1;a++)l[a]=3/f[a]*(e[a+1]-e[a])-3/f[a-1]*(e[a]-e[a-1]);for(a=1;a<u-1;a++)c[a]=[],s[a]=[],c[a][a-1]=f[a-1],c[a][a]=2*(f[a-1]+f[a]),c[a][a+1]=f[a],s[a][0]=l[a];for(i=n.multiply(n.inv(c),s),o=0;o<u-1;o++)m[o]=(e[o+1]-e[o])/f[o]-f[o]*(i[o+1][0]+2*i[o][0])/3,h[o]=(i[o+1][0]-i[o][0])/(3*f[o]);for(o=0;o<u&&!(r[o]>t);o++);return e[o-=1]+(t-r[o])*m[o]+n.sq(t-r[o])*i[o]+(t-r[o])*n.sq(t-r[o])*h[o]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(r){var e,t,o,i,u,a=r.length,c=r[0].length,s=0,l=[],f=[],m=[],h=[],d=[],p=[],g=[];for(s=0;s<a;s++)l[s]=n.sum(r[s])/c;for(s=0;s<c;s++)for(d[s]=[],e=0;e<a;e++)d[s][e]=r[e][s]-l[e];for(d=n.transpose(d),s=0;s<a;s++)for(p[s]=[],e=0;e<a;e++)p[s][e]=n.dot([d[s]],[d[e]])/(c-1);for(u=(o=n.jacobi(p))[0],f=o[1],g=n.transpose(u),s=0;s<f.length;s++)for(e=s;e<f.length;e++)f[s]<f[e]&&(t=f[s],f[s]=f[e],f[e]=t,m=g[s],g[s]=g[e],g[e]=m);for(i=n.transpose(d),s=0;s<a;s++)for(h[s]=[],e=0;e<i.length;e++)h[s][e]=n.dot([g[s]],[i[e]]);return[r,f,g,h]}}),function(r){for(var e=0;e<r.length;e++)!function(r){n.fn[r]=function(e,t){var o=this;return t?(setTimeout((function(){t.call(o,n.fn[r].call(o,e))}),15),this):"number"==typeof n[r](this,e)?n[r](this,e):n(n[r](this,e))}}(r[e])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(r,Math),function(n,r){var e=[].slice,t=n.utils.isNumber,o=n.utils.isArray;function i(n,e,t,o){if(n>1||t>1||n<=0||t<=0)throw new Error("Proportions should be greater than 0 and less than 1");var i=(n*e+t*o)/(e+o);return(n-t)/r.sqrt(i*(1-i)*(1/e+1/o))}n.extend({zscore:function(){var r=e.call(arguments);return t(r[1])?(r[0]-r[1])/r[2]:(r[0]-n.mean(r[1]))/n.stdev(r[1],r[2])},ztest:function(){var t,i=e.call(arguments);return o(i[1])?(t=n.zscore(i[0],i[1],i[3]),1===i[2]?n.normal.cdf(-r.abs(t),0,1):2*n.normal.cdf(-r.abs(t),0,1)):i.length>2?(t=n.zscore(i[0],i[1],i[2]),1===i[3]?n.normal.cdf(-r.abs(t),0,1):2*n.normal.cdf(-r.abs(t),0,1)):(t=i[0],1===i[1]?n.normal.cdf(-r.abs(t),0,1):2*n.normal.cdf(-r.abs(t),0,1))}}),n.extend(n.fn,{zscore:function(n,r){return(n-this.mean())/this.stdev(r)},ztest:function(e,t,o){var i=r.abs(this.zscore(e,o));return 1===t?n.normal.cdf(-i,0,1):2*n.normal.cdf(-i,0,1)}}),n.extend({tscore:function(){var t=e.call(arguments);return 4===t.length?(t[0]-t[1])/(t[2]/r.sqrt(t[3])):(t[0]-n.mean(t[1]))/(n.stdev(t[1],!0)/r.sqrt(t[1].length))},ttest:function(){var o,i=e.call(arguments);return 5===i.length?(o=r.abs(n.tscore(i[0],i[1],i[2],i[3])),1===i[4]?n.studentt.cdf(-o,i[3]-1):2*n.studentt.cdf(-o,i[3]-1)):t(i[1])?(o=r.abs(i[0]),1==i[2]?n.studentt.cdf(-o,i[1]-1):2*n.studentt.cdf(-o,i[1]-1)):(o=r.abs(n.tscore(i[0],i[1])),1==i[2]?n.studentt.cdf(-o,i[1].length-1):2*n.studentt.cdf(-o,i[1].length-1))}}),n.extend(n.fn,{tscore:function(n){return(n-this.mean())/(this.stdev(!0)/r.sqrt(this.cols()))},ttest:function(e,t){return 1===t?1-n.studentt.cdf(r.abs(this.tscore(e)),this.cols()-1):2*n.studentt.cdf(-r.abs(this.tscore(e)),this.cols()-1)}}),n.extend({anovafscore:function(){var t,o,i,u,a,c,s,l,f=e.call(arguments);if(1===f.length){for(a=new Array(f[0].length),s=0;s<f[0].length;s++)a[s]=f[0][s];f=a}for(o=new Array,s=0;s<f.length;s++)o=o.concat(f[s]);for(i=n.mean(o),t=0,s=0;s<f.length;s++)t+=f[s].length*r.pow(n.mean(f[s])-i,2);for(t/=f.length-1,c=0,s=0;s<f.length;s++)for(u=n.mean(f[s]),l=0;l<f[s].length;l++)c+=r.pow(f[s][l]-u,2);return t/(c/(o.length-f.length))},anovaftest:function(){var r,o,i,u,a=e.call(arguments);if(t(a[0]))return 1-n.centralF.cdf(a[0],a[1],a[2]);var c=n.anovafscore(a);for(r=a.length-1,i=0,u=0;u<a.length;u++)i+=a[u].length;return o=i-r-1,1-n.centralF.cdf(c,r,o)},ftest:function(r,e,t){return 1-n.centralF.cdf(r,e,t)}}),n.extend(n.fn,{anovafscore:function(){return n.anovafscore(this.toArray())},anovaftes:function(){var r,e=0;for(r=0;r<this.length;r++)e+=this[r].length;return n.ftest(this.anovafscore(),this.length-1,e-this.length)}}),n.extend({qscore:function(){var o,i,u,a,c,s=e.call(arguments);return t(s[0])?(o=s[0],i=s[1],u=s[2],a=s[3],c=s[4]):(o=n.mean(s[0]),i=n.mean(s[1]),u=s[0].length,a=s[1].length,c=s[2]),r.abs(o-i)/(c*r.sqrt((1/u+1/a)/2))},qtest:function(){var r,t=e.call(arguments);3===t.length?(r=t[0],t=t.slice(1)):7===t.length?(r=n.qscore(t[0],t[1],t[2],t[3],t[4]),t=t.slice(5)):(r=n.qscore(t[0],t[1],t[2]),t=t.slice(3));var o=t[0],i=t[1];return 1-n.tukey.cdf(r,i,o-i)},tukeyhsd:function(r){for(var e=n.pooledstdev(r),t=r.map((function(r){return n.mean(r)})),o=r.reduce((function(n,r){return n+r.length}),0),i=[],u=0;u<r.length;++u)for(var a=u+1;a<r.length;++a){var c=n.qtest(t[u],t[a],r[u].length,r[a].length,e,o,r.length);i.push([[u,a],c])}return i}}),n.extend({normalci:function(){var t,o=e.call(arguments),i=new Array(2);return t=4===o.length?r.abs(n.normal.inv(o[1]/2,0,1)*o[2]/r.sqrt(o[3])):r.abs(n.normal.inv(o[1]/2,0,1)*n.stdev(o[2])/r.sqrt(o[2].length)),i[0]=o[0]-t,i[1]=o[0]+t,i},tci:function(){var t,o=e.call(arguments),i=new Array(2);return t=4===o.length?r.abs(n.studentt.inv(o[1]/2,o[3]-1)*o[2]/r.sqrt(o[3])):r.abs(n.studentt.inv(o[1]/2,o[2].length-1)*n.stdev(o[2],!0)/r.sqrt(o[2].length)),i[0]=o[0]-t,i[1]=o[0]+t,i},significant:function(n,r){return n<r}}),n.extend(n.fn,{normalci:function(r,e){return n.normalci(r,e,this.toArray())},tci:function(r,e){return n.tci(r,e,this.toArray())}}),n.extend(n.fn,{oneSidedDifferenceOfProportions:function(r,e,t,o){var u=i(r,e,t,o);return n.ztest(u,1)},twoSidedDifferenceOfProportions:function(r,e,t,o){var u=i(r,e,t,o);return n.ztest(u,2)}})}(r,Math),r.models=function(){function n(n,e){var t=n.length,o=e[0].length-1,i=t-o-1,u=r.lstsq(e,n),a=r.multiply(e,u.map((function(n){return[n]}))).map((function(n){return n[0]})),c=r.subtract(n,a),s=r.mean(n),l=r.sum(a.map((function(n){return Math.pow(n-s,2)}))),f=r.sum(n.map((function(n,r){return Math.pow(n-a[r],2)}))),m=l+f;return{exog:e,endog:n,nobs:t,df_model:o,df_resid:i,coef:u,predict:a,resid:c,ybar:s,SST:m,SSE:l,SSR:f,R2:l/m}}function e(e){var t,o,i=(t=e.exog,o=t[0].length,r.arange(o).map((function(e){var i=r.arange(o).filter((function(n){return n!==e}));return n(r.col(t,e).map((function(n){return n[0]})),r.col(t,i))}))),u=Math.sqrt(e.SSR/e.df_resid),a=i.map((function(n){var r=n.SST,e=n.R2;return u/Math.sqrt(r*(1-e))})),c=e.coef.map((function(n,r){return(n-0)/a[r]})),s=c.map((function(n){var t=r.studentt.cdf(n,e.df_resid);return 2*(t>.5?1-t:t)})),l=r.studentt.inv(.975,e.df_resid),f=e.coef.map((function(n,r){var e=l*a[r];return[n-e,n+e]}));return{se:a,t:c,p:s,sigmaHat:u,interval95:f}}return{ols:function(t,o){var i=n(t,o),u=e(i),a=function(n){var e,t,o,i=n.R2/n.df_model/((1-n.R2)/n.df_resid);return{F_statistic:i,pvalue:1-(e=i,t=n.df_model,o=n.df_resid,r.beta.cdf(e/(o/t+e),t/2,o/2))}}(i),c=1-(1-i.R2)*((i.nobs-1)/i.df_resid);return i.t=u,i.f=a,i.adjust_R2=c,i}}}(),r.extend({buildxmatrix:function(){for(var n=new Array(arguments.length),e=0;e<arguments.length;e++)n[e]=[1].concat(arguments[e]);return r(n)},builddxmatrix:function(){for(var n=new Array(arguments[0].length),e=0;e<arguments[0].length;e++)n[e]=[1].concat(arguments[0][e]);return r(n)},buildjxmatrix:function(n){for(var e=new Array(n.length),t=0;t<n.length;t++)e[t]=n[t];return r.builddxmatrix(e)},buildymatrix:function(n){return r(n).transpose()},buildjymatrix:function(n){return n.transpose()},matrixmult:function(n,e){var t,o,i,u,a;if(n.cols()==e.rows()){if(e.rows()>1){for(u=[],t=0;t<n.rows();t++)for(u[t]=[],o=0;o<e.cols();o++){for(a=0,i=0;i<n.cols();i++)a+=n.toArray()[t][i]*e.toArray()[i][o];u[t][o]=a}return r(u)}for(u=[],t=0;t<n.rows();t++)for(u[t]=[],o=0;o<e.cols();o++){for(a=0,i=0;i<n.cols();i++)a+=n.toArray()[t][i]*e.toArray()[o];u[t][o]=a}return r(u)}},regress:function(n,e){var t=r.xtranspxinv(n),o=n.transpose(),i=r.matrixmult(r(t),o);return r.matrixmult(i,e)},regresst:function(n,e,t){var o=r.regress(n,e),i={anova:{}},u=r.jMatYBar(n,o);i.yBar=u;var a=e.mean();i.anova.residuals=r.residuals(e,u),i.anova.ssr=r.ssr(u,a),i.anova.msr=i.anova.ssr/(n[0].length-1),i.anova.sse=r.sse(e,u),i.anova.mse=i.anova.sse/(e.length-(n[0].length-1)-1),i.anova.sst=r.sst(e,a),i.anova.mst=i.anova.sst/(e.length-1),i.anova.r2=1-i.anova.sse/i.anova.sst,i.anova.r2<0&&(i.anova.r2=0),i.anova.fratio=i.anova.msr/i.anova.mse,i.anova.pvalue=r.anovaftest(i.anova.fratio,n[0].length-1,e.length-(n[0].length-1)-1),i.anova.rmse=Math.sqrt(i.anova.mse),i.anova.r2adj=1-i.anova.mse/i.anova.mst,i.anova.r2adj<0&&(i.anova.r2adj=0),i.stats=new Array(n[0].length);for(var c,s,l,f=r.xtranspxinv(n),m=0;m<o.length;m++)c=Math.sqrt(i.anova.mse*Math.abs(f[m][m])),s=Math.abs(o[m]/c),l=r.ttest(s,e.length-n[0].length-1,t),i.stats[m]=[o[m],c,s,l];return i.regress=o,i},xtranspx:function(n){return r.matrixmult(n.transpose(),n)},xtranspxinv:function(n){var e=r.matrixmult(n.transpose(),n);return r.inv(e)},jMatYBar:function(n,e){var t=r.matrixmult(n,e);return new r(t)},residuals:function(n,e){return r.matrixsubtract(n,e)},ssr:function(n,r){for(var e=0,t=0;t<n.length;t++)e+=Math.pow(n[t]-r,2);return e},sse:function(n,r){for(var e=0,t=0;t<n.length;t++)e+=Math.pow(n[t]-r[t],2);return e},sst:function(n,r){for(var e=0,t=0;t<n.length;t++)e+=Math.pow(n[t]-r,2);return e},matrixsubtract:function(n,e){for(var t=new Array(n.length),o=0;o<n.length;o++){t[o]=new Array(n[o].length);for(var i=0;i<n[o].length;i++)t[o][i]=n[o][i]-e[o][i]}return r(t)}}),r.jStat=r,r)},184:(n,r,e)=>{"use strict";e.d(r,{$:()=>u});var t=e(976),o=e(870),i=e(559);class u extends t.JsViewer{constructor(n){super(),this.canvas=o.canvas(),this.gridCellStyle=t.GridCellStyle.create(),this.renderer=n,this.root.append(this.canvas),this.canvas.style.width="100%",this.canvas.style.height="100%",o.tools.handleResize(this.canvas,((n,r)=>{this.canvas.width=n,this.canvas.height=r,this.render()}));const r=n=>r=>{this.gridCell&&n(this.gridCell,r)};this.canvas.onmousemove=r(this.renderer.onMouseMove),this.canvas.onmouseenter=r(this.renderer.onMouseEnter),this.canvas.onmouseleave=r(this.renderer.onMouseLeave)}static fromGridCell(n){const r=new u(new i.cv);return r.gridCell=n,r.render(),r}render(){if(!this.gridCell)return;const n=this.canvas.getContext("2d");n.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderer.renderInternal(n,0,0,this.canvas.width,this.canvas.height,this.gridCell.dart,this.gridCellStyle)}}},840:(n,r,e)=>{"use strict";e.d(r,{YC:()=>c,lf:()=>s});var t=e(976),o=(e(469),e(363),e(875)),i=e(414),u=e.n(i);function a(n,r){return Math.random()*(r-n)+n}function c(n,r,e=1){const t=new Float32Array(n*e),i=new Float32Array(n*e),u=[a(1,2),a(1,2),a(1,2),a(-5,5)],c=0-Math.floor(n/2)*r,s=c+r*(n-1);for(let n=c,a=0;n<=s;n+=r,a++)for(let r=0;r<e;r++)t[a*e+r]=n-c+.1,i[a*e+r]=(0,o.Hg)(u,n);const l=(1===e?.2:.4)*(Math.max(...i)-Math.min(...i)),f=Math.min(...i);for(let n=0;n<t.length;n++)i[n]=-f+i[n]+a(0,l);return{x:t,y:i,params:u}}function s(n,r,e){var i;const a=t.DataFrame.create(n);for(let s=0;s<r;s++){const r=3===s?5:1,l=a.columns.addNewString(`json chart ${s}`);l.semType=o.j2;let f=s%2==0?e:1;for(let o=0;o<n;o++){const n={series:[],chartOptions:{showStatistics:1===f?["auc"]:[],xAxisName:"Conc.",yAxisName:"Activity",title:"Dose-Response curves"}};for(let o=0;o<f;o++){const a=c(15,.5,r);let l=t.Color.toHtml(t.Color.getCategoricalColor(s*e+o));null===(i=n.series)||void 0===i||i.push({parameters:void 0,fitLineColor:l,pointColor:l,showCurveConfidenceInterval:1===f,points:u().count().take(15*r).map((function(n){return{x:a.x[n],y:a.y[n]}})).toArray()})}l.set(o,JSON.stringify(n))}}return a}},188:(n,r,e)=>{"use strict";e.d(r,{No:()=>c,hS:()=>a});var t,o=e(976),i=(e(870),e(416));e(875),e(559),e(184),e(711),function(n){n.DATAFRAME="Dataframe",n.COLUMN="Column",n.CELL="Cell"}(t||(t={}));const u={count:"totalCount",nulls:"missingValueCount",unique:"uniqueCount",values:"valueCount",min:"min",max:"max",sum:"sum",avg:"avg",stdev:"stdev",variance:"variance",skew:"skew",kurt:"kurt",med:"med",q1:"q1",q2:"q2",q3:"q3"};function a(n,r){const e=(0,i.Y6)(n);return n.parameters?r.logX&&n.parameters[2]>0&&(n.parameters[2]=Math.log10(n.parameters[2])):n.parameters=(0,i.PK)(n,e,r).parameters,(0,i.tq)(n,e,r)}function c(n,r){var e,t,i;const c={logX:null===(e=n.chartOptions)||void 0===e?void 0:e.logX,logY:null===(t=n.chartOptions)||void 0===t?void 0:t.logY},s=[],l=[],f=[],m=[],h=[],d=[],p=[];for(let r=0,e=0;r<(null===(i=n.series)||void 0===i?void 0:i.length);r++){if(n.series[r].points.every((n=>n.outlier)))continue;const t=a(n.series[r],c);s[e]=t.rSquared,l[e]=t.auc,f[e]=t.interceptX,m[e]=t.interceptY,h[e]=t.slope,d[e]=t.top,p[e]=t.bottom,e++}return{rSquared:o.Stats.fromValues(s)[u[r]],auc:o.Stats.fromValues(l)[u[r]],interceptX:o.Stats.fromValues(f)[u[r]],interceptY:o.Stats.fromValues(m)[u[r]],slope:o.Stats.fromValues(h)[u[r]],top:o.Stats.fromValues(d)[u[r]],bottom:o.Stats.fromValues(p)[u[r]]}}o.ObjectHandler},711:(n,r,e)=>{"use strict";e.d(r,{f:()=>s});var t=e(976),o=e(875);const i={x:"xAxis",y:"yAxis"},u={min:"min",max:"max"};function a(n){var r,e,i;const u=null===(e=null===(r=n.getElementsByTagName("params")[0])||void 0===r?void 0:r.childNodes[0].nodeValue)||void 0===e?void 0:e.split(",").map(Number);let a=null===(i=n.getElementsByTagName("function")[0])||void 0===i?void 0:i.getAttribute("type");a=a&&"sigif"!==a?a:o.yB;const c=n.getElementsByTagName("settings")[0].getAttribute("markerColor"),s=n.getElementsByTagName("settings")[0].getAttribute("color"),l=!!n.getElementsByTagName("settings")[0].getAttribute("drawLine"),f={name:n.getAttribute("name"),fitFunction:a,markerType:t.MARKER_TYPE.CIRCLE,pointColor:c,fitLineColor:s,showFitLine:l,showPoints:"points",showCurveConfidenceInterval:!1,clickToToggle:!1};return u&&(f.parameters=[u[2],u[1],u[0],u[3]]),f}function c(n){const r=function(n){var r,e,t;const o=null===(r=n.getElementsByTagName("x")[0].childNodes[0].nodeValue)||void 0===r?void 0:r.split(","),i=null===(e=n.getElementsByTagName("y")[0].childNodes[0].nodeValue)||void 0===e?void 0:e.split(","),u=null===(t=n.getElementsByTagName("mask")[0].childNodes[0].nodeValue)||void 0===t?void 0:t.split(""),a=[];for(let n=0;n<o.length;n++)a[n]={x:+o[n],y:+i[n],outlier:!Boolean(u[n])};return a}(n),e=a(n),t={points:r};return Object.assign(t,e),t}function s(n){const r=(new DOMParser).parseFromString(n,"text/xml"),e=r.getElementsByTagName("grid")[0],t=(s=r.getElementsByTagName("settings")[0],{minX:+(o=e).getElementsByTagName(i.x)[0].getAttribute(u.min),minY:+o.getElementsByTagName(i.y)[0].getAttribute(u.min),maxX:+o.getElementsByTagName(i.x)[0].getAttribute(u.max),maxY:+o.getElementsByTagName(i.y)[0].getAttribute(u.max),xAxisName:s.getAttribute("xLabel"),yAxisName:s.getAttribute("yLabel"),logX:!!s.getAttribute("logX")});var o,s;const l=r.getElementsByTagName("seriesCollection")[0],f=a(l.getElementsByTagName("series")[0]),m=function(n){const r=[],e=n.getElementsByTagName("series").length;for(let t=0;t<e;t++){const e=n.getElementsByTagName("series")[t];r[t]=c(e)}return r}(l);return{chartOptions:t,seriesOptions:f,series:m}}},559:(n,r,e)=>{"use strict";e.d(r,{cv:()=>B,od:()=>C,Rj:()=>g,NH:()=>v,W$:()=>j,fi:()=>E,Ce:()=>O,BI:()=>N});var t=e(976),o=e(469),i=e(870),u=e(875),a=e(111),c=e(766);const s=window,l=new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});class f{static getUniqueName(n,r,e){return s.grok_Utils_GetUniqueName(n,r,null==e?void 0:e.auto,null==e?void 0:e.idx,null==e?void 0:e.render,null==e?void 0:e.choices)}static isEmpty(n){return null==n||""==n}static formatNumber(n){return l.format(n)}}var m=e(416),h=e(711),d=e(184),p=e(188);const g=".fitChartFormat",v="3dx",y=100,x=55,w=38,b=45,T=5,_=25,k=18,M=15,A=30,S=4,P=3.5,C=-12,q={solid:[],dotted:[1,1],dashed:[5,5],dashdotted:[5,5,2,5]};function N(n,r,e){if(r&&e)for(const t of n)!(t.name in e)&&t.name in r&&(e[t.name]=r[t.name])}function j(n){var r,e,o,i,a;let c=n.cell.value;c.includes("|")&&(c=c.replaceAll("|",""));const s=(null===(e=null===(r=n.cell)||void 0===r?void 0:r.column)||void 0===e?void 0:e.type)===t.TYPE.STRING?n.cell.column.getTag(g)===v?(0,h.f)(c):null!==(o=JSON.parse(null!=c?c:"{}"))&&void 0!==o?o:{}:(0,m.TL)(),l=n.cell.column?(0,m.hq)(n.cell.column):{},f=n.cell.column?(0,m.jG)(n.cell.dataFrame):{};null!==(i=s.series)&&void 0!==i||(s.series=[]),null!==(a=s.chartOptions)&&void 0!==a||(s.chartOptions=l.chartOptions),N(u.kW,l.chartOptions,s.chartOptions),N(u.kW,f.chartOptions,s.chartOptions);for(const n of s.series)N(u.K0,l.seriesOptions,n),N(u.K0,f.seriesOptions,n);return s}function O(n,r,e){if(n.width<y||n.height<x)return[n,void 0,void 0];const t=r?b:w,o=r?A:M,i=e?_:T;return[n.cutLeft(t).cutBottom(o).cutTop(i).cutRight(k),n.getBottom(o).getTop(i).cutLeft(t).cutRight(k),n.getLeft(t).getRight(k).cutBottom(o).cutTop(i)]}function E(n){return null!=n&&""!==n&&void 0!==t.Color.fromHtml(n)}function L(n,r,e,t){n.moveTo(t.xToScreen(r)-S/2,t.yToScreen(e)),n.lineTo(t.xToScreen(r)+S/2,t.yToScreen(e))}function Y(n,r,e,o,i,u){L(n,r,e.lowerAdjacentValue,o),n.moveTo(o.xToScreen(r),o.yToScreen(e.lowerAdjacentValue)),n.lineTo(o.xToScreen(r),o.yToScreen(e.upperAdjacentValue)),L(n,r,e.upperAdjacentValue,o),t.Paint.marker(n,t.MARKER_TYPE.CIRCLE,o.xToScreen(r),o.yToScreen(e.q2),u,P*i)}function I(n,r,e,o,i,u){for(let i=0;i<r.points.length;i++){const a=r.points[i],c=a.outlier?t.Color.red:a.color&&t.Color.fromHtml(a.color)?t.Color.fromHtml(a.color):u,s=a.marker?a.marker:r.markerType,l=a.outlier?12*o:a.size?a.size:4*o;t.Paint.marker(n,a.outlier?t.MARKER_TYPE.OUTLIER:s,e.xToScreen(a.x),e.yToScreen(a.y),c,l),a.stdev&&!a.outlier&&(n.strokeStyle=t.Color.toHtml(c),n.beginPath(),n.moveTo(e.xToScreen(a.x),e.yToScreen(a.y+a.stdev)),n.lineTo(e.xToScreen(a.x),e.yToScreen(a.y-a.stdev)),n.stroke())}}function F(n,r,e,o,i){for(let u=0,c=null;u<r.points.length;u++){const s=r.points[u];if(s.outlier)continue;const l=u+1<r.points.length&&r.points[u+1].x===s.x;if(!c&&l)c=u;else if(null!==c&&!l){const l=[];for(let n=c,e=0;n<=u;n++,e++)l[e]=r.points[n].y;const f=(0,a.G)(l);if(n.beginPath(),Y(n,s.x,f,e,o,i),n.stroke(),"both"===r.showPoints)for(let i=0;i<l.length;i++)(l[i]<f.lowerAdjacentValue||l[i]>f.upperAdjacentValue)&&t.Paint.marker(n,t.MARKER_TYPE.OUTLIER,e.xToScreen(s.x),e.yToScreen(l[i]),r.pointColor?t.Color.fromHtml(r.pointColor):t.Color.scatterPlotMarker,6*o);c=null}}}function R(n,r,e,t,o,i,a,c){n.beginPath();const s=i?a?b:w:0,l=i?k:0,f=o===u.vK.TOP?r.confidenceTop:r.confidenceBottom;for(let r=s;r<=e.width-l;r++){const o=e.x+r,i=c.logX?Math.log10(t.xToWorld(o)):t.xToWorld(o),u=c.logY?t.yToScreen(Math.pow(10,f(i))):t.yToScreen(f(i));r===s?n.moveTo(o,u):n.lineTo(o,u)}n.stroke()}function V(n,r,e,t,o,i,u){n.beginPath();const a=o?i?b:w:0,c=o?k:0;for(let o=a;o<=e.width-c;o++){const i=e.x+o,c=u.logX?Math.log10(t.xToWorld(i)):t.xToWorld(i),s=u.logY?t.yToScreen(Math.pow(10,r.confidenceTop(c))):t.yToScreen(r.confidenceTop(c));o===a?n.moveTo(i,s):n.lineTo(i,s)}for(let o=e.width-c;o>=a;o--){const i=e.x+o,a=u.logX?Math.log10(t.xToWorld(i)):t.xToWorld(i),c=u.logY?t.yToScreen(Math.pow(10,r.confidenceBottom(a))):t.yToScreen(r.confidenceBottom(a));n.lineTo(i,c)}n.closePath(),n.fill()}function X(n,r,e,t,o,i){i.logX&&(e=Math.pow(10,e));const u=i.logX?Math.log10(e):e,a=i.logY?Math.pow(10,o(u)):o(u);n.moveTo(r.xToScreen(t.minX),r.yToScreen(a)),n.lineTo(r.xToScreen(e),r.yToScreen(a)),n.lineTo(r.xToScreen(e),r.yToScreen(t.minY))}class B extends t.GridCellRenderer{get name(){return u.d8}get cellType(){return u.d8}getDefaultSize(n){return{width:220,height:150}}onClick(n,r){var e,t,i,u,a,s,l,f;if(!n.cell.value)return;const d=n.cell.column.getTag(g)===v?(0,h.f)(n.cell.value):j(n);if(null===(e=d.series)||void 0===e?void 0:e.some((n=>0===n.points.length)))return;o.shell.o=n;const w=n.bounds.inflate(C/2,C/2),b=O(w,n.bounds.width>=180&&n.bounds.height>=140,n.bounds.width>=275&&n.bounds.height>=225)[0],T=(0,m.dU)(d),_=new c.l(T,b,null!==(i=null===(t=d.chartOptions)||void 0===t?void 0:t.logX)&&void 0!==i&&i,null!==(a=null===(u=d.chartOptions)||void 0===u?void 0:u.logY)&&void 0!==a&&a);for(let e=0;e<(null===(s=d.series)||void 0===s?void 0:s.length);e++)if(!(!d.series[e].clickToToggle||"points"!==d.series[e].showPoints||w.width<y||w.height<x))for(let t=0;t<d.series[e].points.length;t++){const o=d.series[e].points[t],i=_.xToScreen(o.x),u=_.yToScreen(o.y),a=(o.outlier?12:4)/2+2;if(r.offsetX>=i-a&&r.offsetX<=i+a&&r.offsetY>=u-a&&r.offsetY<=u+a){o.outlier=!o.outlier;const r=n.grid.dataFrame.columns.byTags({".sourceColumn":n.cell.column.name});if(r)for(const t of r){const r={logX:null===(l=d.chartOptions)||void 0===l?void 0:l.logX,logY:null===(f=d.chartOptions)||void 0===f?void 0:f.logY},o=null!==t.tags[".seriesAggregation"]?(0,p.No)(d,t.tags[".seriesAggregation"]):t.tags[".seriesNumber"]===e?(0,p.hS)(d.series[e],r):null;null!==o&&t.set(n.cell.rowIndex,o[t.tags[".statistics"]])}if(n.cell.column.getTag(g)!==v){const r=JSON.parse(n.cell.value);r.series[e].points[t].outlier=o.outlier,n.cell.value=JSON.stringify(r)}return}}}onDoubleClick(n,r){if(!n.cell.value)return;const e=d.$.fromGridCell(n),t=i.dialog({title:"Edit chart"}).add(e.root).show({resizable:!0}).root.getElementsByClassName("d4-dialog-contents dlg-edit-chart")[0].firstChild;e.canvas.width=t.clientWidth,e.canvas.height=t.clientHeight,e.render(),t.style.width="100%",t.style.height="100%",i.tools.handleResize(t,((n,r)=>{e.canvas.width=n,e.canvas.height=r,e.render()}))}renderCurves(n,r,e,o,i,a){var s,l,h,d,p,g,v,M,A,S,P,N,j,E,L,Y,B,D,U,G,$,W,z,H,K;n.save(),n.beginPath(),n.rect(r,e,o,i),n.clip(),(null===(s=a.chartOptions)||void 0===s?void 0:s.allowXZeroes)&&(null===(l=a.chartOptions)||void 0===l?void 0:l.logX)&&(null===(h=a.series)||void 0===h?void 0:h.some((n=>n.points.some((n=>0===n.x)))))&&function(n){var r;for(let e=0;e<(null===(r=n.series)||void 0===r?void 0:r.length);e++){const r=n.series[e];if(r.points.every((n=>0!==n.x)))continue;let t=Number.MAX_VALUE,o=0,i=0;const u=[];for(let n=0;n<r.points.length;n++)r.points[n].x<t&&0!==r.points[n].x&&(t=r.points[n].x),r.points[n].x>o&&0!==r.points[n].x&&(o=r.points[n].x),u.includes(r.points[n].x)||(u[u.length]=r.points[n].x,i++);const a=Math.pow(10,Math.log10(t)-(Math.log10(o)-Math.log10(t)/(i-1)));for(let n=0;n<r.points.length;n++)0===r.points[n].x&&(r.points[n].x=a)}}(a);const Q=new t.Rect(r,e,o,i).inflate(C/2,C/2),Z=Q.width>=y&&Q.height>=x,J=o>=180&&i>=140&&!!(null===(d=a.chartOptions)||void 0===d?void 0:d.xAxisName)&&!!a.chartOptions.yAxisName,nn=o>=275&&i>=225&&!!(null===(p=a.chartOptions)||void 0===p?void 0:p.title),rn=o>=120&&i>=110,[en,tn,on]=O(Q,J,nn),un=(0,m.dU)(a);(un.x<0&&a.chartOptions||0===un.x&&a.chartOptions&&!a.chartOptions.allowXZeroes)&&(a.chartOptions.logX=!1),un.y<=0&&a.chartOptions&&(a.chartOptions.logY=!1);const an=new c.l(un,en,null!==(v=null===(g=a.chartOptions)||void 0===g?void 0:g.logX)&&void 0!==v&&v,null!==(A=null===(M=a.chartOptions)||void 0===M?void 0:M.logY)&&void 0!==A&&A),cn=Math.min(en.width,en.height),sn=cn>100?1:.2+cn/100*.8,ln={logX:null===(S=a.chartOptions)||void 0===S?void 0:S.logX,logY:null===(P=a.chartOptions)||void 0===P?void 0:P.logY};n.save(),n.font='11px Roboto, "Roboto Local"',an.drawCoordinateGrid(n,tn,on),n.restore();for(let r=0;r<(null===(N=a.series)||void 0===N?void 0:N.length);r++){const e=a.series[r];if(e.points.some((n=>void 0===n.x||void 0===n.y)))continue;(o<70||i<45)&&(e.showPoints="",a.chartOptions&&(a.chartOptions.showStatistics=[])),e.points.sort(((n,r)=>n.x-r.x));let c=!0;const s=(0,m.Y6)(e);let l;if(e.parameters)(null===(j=a.chartOptions)||void 0===j?void 0:j.logX)&&e.parameters[2]>0&&(e.parameters[2]=Math.log10(e.parameters[2])),l=(0,m.kG)(e,s);else{const n=(0,m.PK)(e,s,ln);l=n.fittedCurve,e.parameters=n.parameters,c=!1}if(null===(E=e.showPoints)||void 0===E||E){const o=e.pointColor&&t.Color.fromHtml(e.pointColor)?e.pointColor:t.Color.toHtml(t.Color.getCategoricalColor(r));n.strokeStyle=o,"points"===e.showPoints?I(n,e,an,sn,0,t.Color.fromHtml(o)):["candlesticks","both"].includes(e.showPoints)&&F(n,e,an,sn,t.Color.fromHtml(o))}if(null===(L=e.showFitLine)||void 0===L||L){const o=e.fitLineColor&&t.Color.fromHtml(e.fitLineColor)?e.fitLineColor:t.Color.toHtml(t.Color.getCategoricalColor(r));n.save(),n.strokeStyle=o,n.lineWidth=2*sn,n.beginPath(),e.lineStyle&&n.setLineDash(q[e.lineStyle]);const i=Z?J?b:w:0,u=Z?k:0;for(let r=i;r<=Q.width-u;r++){const e=Q.x+r,t=(null===(Y=a.chartOptions)||void 0===Y?void 0:Y.logX)?Math.log10(an.xToWorld(e)):an.xToWorld(e),o=(null===(B=a.chartOptions)||void 0===B?void 0:B.logY)?an.yToScreen(Math.pow(10,l(t))):an.yToScreen(l(t));r===i?n.moveTo(e,o):n.lineTo(e,o)}n.stroke(),n.restore()}if((null===(D=e.showFitLine)||void 0===D||D)&&null!==(U=e.showCurveConfidenceInterval)&&void 0!==U&&U){n.strokeStyle=null!==(G=e.confidenceIntervalColor)&&void 0!==G?G:u.Qc,n.fillStyle=null!==($=e.confidenceIntervalColor)&&void 0!==$?$:u.XD;const r=(0,m.LC)(e,s,c,ln);R(n,r,Q,an,u.vK.TOP,Z,J,ln),R(n,r,Q,an,u.vK.BOTTOM,Z,J,ln),V(n,r,Q,an,Z,J,ln)}if(e.droplines&&rn){n.save(),n.strokeStyle="blue",n.lineWidth=sn,n.beginPath(),n.setLineDash([5,5]);for(let r=0;r<e.droplines.length;r++)"IC50"===e.droplines[r]&&X(n,an,e.parameters[2],un,l,ln);n.stroke(),n.restore()}if(null===(W=a.chartOptions)||void 0===W?void 0:W.showStatistics){const o=(0,m.tq)(e,s,ln);for(let i=0;i<a.chartOptions.showStatistics.length;i++){const c=a.chartOptions.showStatistics[i],s=u.sw.find((n=>n.name===c));if(s){const u=f.formatNumber(s.get(o)),a=e.fitLineColor&&t.Color.fromHtml(e.fitLineColor)?e.fitLineColor:t.Color.toHtml(t.Color.getCategoricalColor(r));n.fillStyle=a,n.textAlign="left",n.fillText(s.name+": "+u,en.x+5,en.y+20+20*i)}}}}if(nn&&(n.font='12px Roboto, "Roboto Local"',n.textAlign="center",n.fillStyle="black",n.fillText(null===(z=a.chartOptions)||void 0===z?void 0:z.title,en.midX-5,e+15)),J){n.font='11px Roboto, "Roboto Local"',n.textAlign="center",n.fillStyle="black",n.fillText(null===(H=a.chartOptions)||void 0===H?void 0:H.xAxisName,en.midX-5,e+i-10),n.translate(r,e),n.rotate(-Math.PI/2);const t=nn?_:T;n.fillText(null===(K=a.chartOptions)||void 0===K?void 0:K.yAxisName,-(en.height/2+t+15),15),n.restore()}n.restore()}render(n,r,e,t,o,i,u){var a,c;if(t<20||o<10)return;if(!i.cell.value)return;const s=(null===(a=i.cell.column)||void 0===a?void 0:a.getTag(g))===v?(0,h.f)(i.cell.value):j(i);(null===(c=s.series)||void 0===c?void 0:c.some((n=>0===n.points.length)))||this.renderCurves(n,r,e,t,o,s)}onMouseMove(n,r){var e,t,o,u,a;if(!n.cell.value)return;if(n.bounds.width<70||n.bounds.height<45){const e=i.canvas(300,200);this.render(e.getContext("2d"),0,0,300,200,n,null);const t=i.divV([e]);i.tooltip.show(t,r.x,r.y)}const s=n.cell.column.getTag(g)===v?(0,h.f)(n.cell.value):j(n),l=n.bounds.inflate(C/2,C/2),f=O(l,n.bounds.width>=180&&n.bounds.height>=140,n.bounds.width>=275&&n.bounds.height>=225)[0],d=(0,m.dU)(s),p=new c.l(d,f,null!==(t=null===(e=s.chartOptions)||void 0===e?void 0:e.logX)&&void 0!==t&&t,null!==(u=null===(o=s.chartOptions)||void 0===o?void 0:o.logY)&&void 0!==u&&u);for(let n=0;n<(null===(a=s.series)||void 0===a?void 0:a.length);n++)if(!(!s.series[n].clickToToggle||"points"!==s.series[n].showPoints||l.width<y||l.height<x))for(let e=0;e<s.series[n].points.length;e++){const t=s.series[n].points[e],o=p.xToScreen(t.x),i=p.yToScreen(t.y),u=(t.outlier?12:4)/2+2;if(r.offsetX>=o-u&&r.offsetX<=o+u&&r.offsetY>=i-u&&r.offsetY<=i+u)return void(document.body.style.cursor="pointer")}document.body.style.cursor="default"}}},363:(n,r,e)=>{"use strict";var t=e(976);e(188),e(559),e(870),e(184),e(875),rxjs.operators,rxjs,e(840),new t.Package},976:n=>{"use strict";n.exports=DG},469:n=>{"use strict";n.exports=grok},870:n=>{"use strict";n.exports=ui},414:n=>{"use strict";n.exports=wu}},__webpack_module_cache__={};function __webpack_require__(n){var r=__webpack_module_cache__[n];if(void 0!==r)return r.exports;var e=__webpack_module_cache__[n]={exports:{}};return __webpack_modules__[n].call(e.exports,e,e.exports,__webpack_require__),e.exports}__webpack_require__.n=n=>{var r=n&&n.__esModule?()=>n.default:()=>n;return __webpack_require__.d(r,{a:r}),r},__webpack_require__.d=(n,r)=>{for(var e in r)__webpack_require__.o(r,e)&&!__webpack_require__.o(n,e)&&Object.defineProperty(n,e,{enumerable:!0,get:r[e]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),__webpack_require__.o=(n,r)=>Object.prototype.hasOwnProperty.call(n,r),__webpack_require__.r=n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{_package:()=>V,test:()=>X,tests:()=>i});var n=__webpack_require__(976),r=__webpack_require__(469),e=function(n,r,e,t){return new(e||(e=Promise))((function(o,i){function u(n){try{c(t.next(n))}catch(n){i(n)}}function a(n){try{c(t.throw(n))}catch(n){i(n)}}function c(n){var r;n.done?o(n.value):(r=n.value,r instanceof e?r:new e((function(n){n(r)}))).then(u,a)}c((t=t.apply(n,r||[])).next())}))};const t=3e4,o=108e5,i={},u="Auto Tests",a={};let c;var s;!function(n){n.notNull=function(n,r){if(null==n)throw new Error(`${null==r?"Value":r} not defined`)}}(s||(s={}));class l{constructor(n,r){this.catchUnhandled=!0,this.report=!1,void 0!==n&&(this.catchUnhandled=n),void 0!==r&&(this.report=r)}}class f{constructor(n,r,o,i){var u;this.category=n,this.name=r,null!=i||(i={}),null!==(u=i.timeout)&&void 0!==u||(i.timeout=t),this.options=i,this.test=()=>e(this,void 0,void 0,(function*(){return new Promise(((n,r)=>e(this,void 0,void 0,(function*(){let e="";try{e=yield o()}catch(n){r(n)}n(e)}))))}))}}function m(n,r,e){null==i[c]&&(i[c]={}),null==i[c].tests&&(i[c].tests=[]),i[c].tests.push(new f(c,n,r,e))}function h(n,r=!0,e){if(e=e?`${e}, `:"",n!==r)throw new Error(`${e}Expected "${r}", got "${n}"`)}function d(n,r,e=.001,t){if(n===Number.POSITIVE_INFINITY&&r===Number.POSITIVE_INFINITY||n===Number.NEGATIVE_INFINITY&&r===Number.NEGATIVE_INFINITY||n===Number.NaN&&r===Number.NaN||isNaN(n)&&isNaN(r))return;const o=Math.abs(n-r)<e;if(h(o,!0,`${null!=t?t:""} (tolerance = ${e})`),!o)throw new Error(`Expected ${r}, got ${n} (tolerance = ${e})`)}function p(n,r){for(const[e,t]of Object.entries(r)){if(!n.hasOwnProperty(e))throw new Error(`Expected property "${e}" not found`);const r=n[e];if(r instanceof Array&&t instanceof Array)g(r,t);else if(r instanceof Object&&t instanceof Object)p(r,t);else if(Number.isFinite(r)&&Number.isFinite(t))d(r,t);else if(r!=t)throw new Error(`Expected (${t}) for key '${e}', got (${r})`)}}function g(n,r){const e=n.length,t=r.length;if(e!=t)throw new Error(`Arrays are of different length: actual array length is ${e} and expected array length is ${t}`);for(let t=0;t<e;t++)if(n[t]instanceof Array&&r[t]instanceof Array)g(n[t],r[t]);else if(n[t]instanceof Object&&r[t]instanceof Object)p(n[t],r[t]);else if(n[t]!=r[t])throw new Error(`Expected ${r[t]} at position ${t}, got ${n[t]}`)}function v(n,r,e){var t;c=n,r(),i[c]&&(i[c].clear=null===(t=null==e?void 0:e.clear)||void 0===t||t,i[c].timeout=null==e?void 0:e.timeout)}function y(n,r){return n.replace(new RegExp(r.name,"gi"),r.nqName)}function x(i,u,a,c){var s,l,f,m,h;return e(this,void 0,void 0,(function*(){let e;const d=null!=u&&!i.name.toLowerCase().startsWith(u.toLowerCase()),p=(null===(s=i.options)||void 0===s?void 0:s.skipReason)||d,g=d?"skipped":null===(l=i.options)||void 0===l?void 0:l.skipReason;p||console.log(`Started ${i.category} ${i.name}`);const v=new Date;try{if(p)e={success:!0,result:g,ms:0,skipped:!0};else{let r=(null===(f=i.options)||void 0===f?void 0:f.timeout)===t&&a?a:null===(m=i.options)||void 0===m?void 0:m.timeout;r=n.Test.isInBenchmark&&r===t?o:r,e={success:!0,result:null!==(h=yield b(i.test,r))&&void 0!==h?h:"OK",ms:0,skipped:!1}}}catch(n){e={success:!1,result:n.toString(),ms:0,skipped:!1}}const y=new Date;return e.ms=y-v,p||console.log(`Finished ${i.category} ${i.name} for ${e.ms} ms`),e.category=i.category,e.name=i.name,d||r.log.usage(`${c}: ${i.category}: ${i.name}`,{success:e.success,result:e.result,ms:e.ms,skipped:e.skipped,type:"package",packageName:c,category:i.category,test:i.name},`test-package ${c}: ${i.category}: ${i.name}`),e}))}function w(n){return e(this,void 0,void 0,(function*(){yield new Promise((r=>setTimeout(r,n)))}))}function b(n,r){return e(this,void 0,void 0,(function*(){let e=null;const t=new Promise(((n,t)=>{e=setTimeout((()=>{t("EXECUTION TIMEOUT")}),r)}));try{return yield Promise.race([n(),t])}finally{e&&clearTimeout(e)}}))}var T=__webpack_require__(559),_=__webpack_require__(875),k=function(n,r,e,t){return new(e||(e=Promise))((function(o,i){function u(n){try{c(t.next(n))}catch(n){i(n)}}function a(n){try{c(t.throw(n))}catch(n){i(n)}}function c(n){var r;n.done?o(n.value):(r=n.value,r instanceof e?r:new e((function(n){n(r)}))).then(u,a)}c((t=t.apply(n,r||[])).next())}))};v("detectors",(()=>{m("detectFitCurves",(()=>k(void 0,void 0,void 0,(function*(){const e=n.DataFrame.fromCsv('dataframes,json chart 0,json chart 1,json chart 2\n"null (15 rows, 2 columns)","{""series"":[{""parameters"":[1.4325498997897106,1.9857091601431633,1.1549088606928581,1.7111330488305754],""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showCurveConfidenceInterval"":false,""points"":[{""x"":0.10000000149011612,""y"":0.04513680189847946},{""x"":0.6000000238418579,""y"":0.05534003674983978},{""x"":1.100000023841858,""y"":0.041759949177503586},{""x"":1.600000023841858,""y"":0.019746985286474228},{""x"":2.0999999046325684,""y"":0.009008238092064857},{""x"":2.5999999046325684,""y"":0.00802786834537983},{""x"":3.0999999046325684,""y"":0.046114228665828705},{""x"":3.5999999046325684,""y"":0.0032935715280473232},{""x"":4.099999904632568,""y"":0.05305013433098793},{""x"":4.599999904632568,""y"":0.11946146935224533},{""x"":5.099999904632568,""y"":0.24304461479187012},{""x"":5.599999904632568,""y"":0.32507050037384033},{""x"":6.099999904632568,""y"":0.30492347478866577},{""x"":6.599999904632568,""y"":0.30675041675567627},{""x"":7.099999904632568,""y"":0.28282707929611206}]},{""fitFunction"":""sigmoid"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showCurveConfidenceInterval"":false,""points"":[{""x"":0.10000000149011612,""y"":0.027537694200873375},{""x"":0.6000000238418579,""y"":0.20163409411907196},{""x"":1.100000023841858,""y"":0.4537210166454315},{""x"":1.600000023841858,""y"":0.1709870994091034},{""x"":2.0999999046325684,""y"":0.35089364647865295},{""x"":2.5999999046325684,""y"":0.30297139286994934},{""x"":3.0999999046325684,""y"":0.3161645829677582},{""x"":3.5999999046325684,""y"":0.460237979888916},{""x"":4.099999904632568,""y"":0.5018354058265686},{""x"":4.599999904632568,""y"":1.2936394214630127},{""x"":5.099999904632568,""y"":2.336543321609497},{""x"":5.599999904632568,""y"":2.353417158126831},{""x"":6.099999904632568,""y"":2.5554966926574707},{""x"":6.599999904632568,""y"":2.7185072898864746},{""x"":7.099999904632568,""y"":2.8088953495025635}]}]}","{""series"":[{""parameters"":[1.4257157458000065,1.587135296876273,1.6780074048516793,4.72187609991688],""fitFunction"":""sigmoid"",""fitLineColor"":""#2ca02c"",""pointColor"":""#2ca02c"",""showCurveConfidenceInterval"":true,""points"":[{""x"":0.10000000149011612,""y"":0.5346568822860718},{""x"":0.6000000238418579,""y"":0.6445727348327637},{""x"":1.100000023841858,""y"":0.08188246190547943},{""x"":1.600000023841858,""y"":0.0516531839966774},{""x"":2.0999999046325684,""y"":0.17018724977970123},{""x"":2.5999999046325684,""y"":0.618033766746521},{""x"":3.0999999046325684,""y"":0.16852399706840515},{""x"":3.5999999046325684,""y"":0.013230039738118649},{""x"":4.099999904632568,""y"":0.6706985831260681},{""x"":4.599999904632568,""y"":0.6293138861656189},{""x"":5.099999904632568,""y"":1.4058887958526611},{""x"":5.599999904632568,""y"":2.6412644386291504},{""x"":6.099999904632568,""y"":3.775967597961426},{""x"":6.599999904632568,""y"":3.3188939094543457},{""x"":7.099999904632568,""y"":3.793793201446533}]}],""chartOptions"":{""showStatistics"":[""auc""]}}","{""series"":[{""parameters"":[1.4518023469757255,1.051351211186544,1.6612723878444138,-0.9253134758193626],""fitFunction"":""sigmoid"",""fitLineColor"":""#9467bd"",""pointColor"":""#9467bd"",""showCurveConfidenceInterval"":true,""points"":[{""x"":0.10000000149011612,""y"":2.5458569526672363},{""x"":0.10000000149011612,""y"":3.0017518997192383},{""x"":0.10000000149011612,""y"":2.4102466106414795},{""x"":0.10000000149011612,""y"":2.7017934322357178},{""x"":0.10000000149011612,""y"":2.8341686725616455},{""x"":0.6000000238418579,""y"":2.9751579761505127},{""x"":0.6000000238418579,""y"":2.8365142345428467},{""x"":0.6000000238418579,""y"":2.898362874984741},{""x"":0.6000000238418579,""y"":2.9964826107025146},{""x"":0.6000000238418579,""y"":2.6708292961120605},{""x"":1.100000023841858,""y"":3.263227939605713},{""x"":1.100000023841858,""y"":3.0655293464660645},{""x"":1.100000023841858,""y"":2.6620445251464844},{""x"":1.100000023841858,""y"":3.002741813659668},{""x"":1.100000023841858,""y"":3.1540098190307617},{""x"":1.600000023841858,""y"":2.8934433460235596},{""x"":1.600000023841858,""y"":2.7970690727233887},{""x"":1.600000023841858,""y"":3.0466723442077637},{""x"":1.600000023841858,""y"":3.179988145828247},{""x"":1.600000023841858,""y"":2.611898899078369},{""x"":2.0999999046325684,""y"":2.497966766357422},{""x"":2.0999999046325684,""y"":2.645627498626709},{""x"":2.0999999046325684,""y"":2.5474727153778076},{""x"":2.0999999046325684,""y"":2.530237913131714},{""x"":2.0999999046325684,""y"":2.9498236179351807},{""x"":2.5999999046325684,""y"":2.7639214992523193},{""x"":2.5999999046325684,""y"":3.007110595703125},{""x"":2.5999999046325684,""y"":2.71816086769104},{""x"":2.5999999046325684,""y"":3.050650119781494},{""x"":2.5999999046325684,""y"":2.591902017593384},{""x"":3.0999999046325684,""y"":2.79219388961792},{""x"":3.0999999046325684,""y"":2.380063056945801},{""x"":3.0999999046325684,""y"":3.2450575828552246},{""x"":3.0999999046325684,""y"":2.6954219341278076},{""x"":3.0999999046325684,""y"":2.368993043899536},{""x"":3.5999999046325684,""y"":3.2338552474975586},{""x"":3.5999999046325684,""y"":3.222881555557251},{""x"":3.5999999046325684,""y"":2.6137502193450928},{""x"":3.5999999046325684,""y"":2.3624353408813477},{""x"":3.5999999046325684,""y"":2.830970525741577},{""x"":4.099999904632568,""y"":2.8000826835632324},{""x"":4.099999904632568,""y"":2.8115334510803223},{""x"":4.099999904632568,""y"":2.8906726837158203},{""x"":4.099999904632568,""y"":2.5641937255859375},{""x"":4.099999904632568,""y"":2.3881938457489014},{""x"":4.599999904632568,""y"":2.076000928878784},{""x"":4.599999904632568,""y"":2.241201400756836},{""x"":4.599999904632568,""y"":2.018866777420044},{""x"":4.599999904632568,""y"":2.7197747230529785},{""x"":4.599999904632568,""y"":2.3649282455444336},{""x"":5.099999904632568,""y"":2.068617105484009},{""x"":5.099999904632568,""y"":2.0637989044189453},{""x"":5.099999904632568,""y"":1.5100634098052979},{""x"":5.099999904632568,""y"":1.9978814125061035},{""x"":5.099999904632568,""y"":2.1007437705993652},{""x"":5.599999904632568,""y"":0.7437329292297363},{""x"":5.599999904632568,""y"":0.8030821681022644},{""x"":5.599999904632568,""y"":1.0766953229904175},{""x"":5.599999904632568,""y"":1.5326048135757446},{""x"":5.599999904632568,""y"":1.5971065759658813},{""x"":6.099999904632568,""y"":0.31388434767723083},{""x"":6.099999904632568,""y"":0.6875622272491455},{""x"":6.099999904632568,""y"":0.855545163154602},{""x"":6.099999904632568,""y"":0.6559354662895203},{""x"":6.099999904632568,""y"":0.3100747764110565},{""x"":6.599999904632568,""y"":0.4792144000530243},{""x"":6.599999904632568,""y"":0.855309009552002},{""x"":6.599999904632568,""y"":0.18937373161315918},{""x"":6.599999904632568,""y"":0.3708323538303375},{""x"":6.599999904632568,""y"":0.08053481578826904},{""x"":7.099999904632568,""y"":0.7577306628227234},{""x"":7.099999904632568,""y"":0.3387751877307892},{""x"":7.099999904632568,""y"":0.1985611915588379},{""x"":7.099999904632568,""y"":0.172195702791214},{""x"":7.099999904632568,""y"":0.13258741796016693}]}],""chartOptions"":{""showStatistics"":[""auc""]}}"\n"null (15 rows, 2 columns)","{""series"":[{""parameters"":[1.4030933784862443,1.0245979562516274,1.7428150024861861,-3.5779850370795696],""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showCurveConfidenceInterval"":false,""points"":[{""x"":0.10000000149011612,""y"":5.7036309242248535},{""x"":0.6000000238418579,""y"":5.746265888214111},{""x"":1.100000023841858,""y"":5.299612045288086},{""x"":1.600000023841858,""y"":5.343863487243652},{""x"":2.0999999046325684,""y"":5.506134033203125},{""x"":2.5999999046325684,""y"":5.4817914962768555},{""x"":3.0999999046325684,""y"":5.3505539894104},{""x"":3.5999999046325684,""y"":5.151522159576416},{""x"":4.099999904632568,""y"":5.212680339813232},{""x"":4.599999904632568,""y"":4.80598783493042},{""x"":5.099999904632568,""y"":3.351301431655884},{""x"":5.599999904632568,""y"":2.108116865158081},{""x"":6.099999904632568,""y"":1.246281623840332},{""x"":6.599999904632568,""y"":0.5875148773193359},{""x"":7.099999904632568,""y"":0.6986792683601379}]},{""fitFunction"":""sigmoid"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showCurveConfidenceInterval"":false,""points"":[{""x"":0.10000000149011612,""y"":4.777379035949707},{""x"":0.6000000238418579,""y"":5.265642166137695},{""x"":1.100000023841858,""y"":5.713808059692383},{""x"":1.600000023841858,""y"":5.249830722808838},{""x"":2.0999999046325684,""y"":5.587547779083252},{""x"":2.5999999046325684,""y"":5.36907434463501},{""x"":3.0999999046325684,""y"":4.934175968170166},{""x"":3.5999999046325684,""y"":5.372972011566162},{""x"":4.099999904632568,""y"":5.017283916473389},{""x"":4.599999904632568,""y"":4.6751484870910645},{""x"":5.099999904632568,""y"":3.423663854598999},{""x"":5.599999904632568,""y"":1.594344973564148},{""x"":6.099999904632568,""y"":0.5661525130271912},{""x"":6.599999904632568,""y"":0.19819404184818268},{""x"":7.099999904632568,""y"":0.8421927690505981}]}]}","{""series"":[{""parameters"":[1.5400648543589148,1.7239324972922214,1.4063297934320662,0.33443731185267556],""fitFunction"":""sigmoid"",""fitLineColor"":""#2ca02c"",""pointColor"":""#2ca02c"",""showCurveConfidenceInterval"":true,""points"":[{""x"":0.10000000149011612,""y"":1.27737557888031},{""x"":0.6000000238418579,""y"":1.2780145406723022},{""x"":1.100000023841858,""y"":1.3489571809768677},{""x"":1.600000023841858,""y"":1.3250025510787964},{""x"":2.0999999046325684,""y"":1.309158444404602},{""x"":2.5999999046325684,""y"":1.441296935081482},{""x"":3.0999999046325684,""y"":1.3621265888214111},{""x"":3.5999999046325684,""y"":1.3409022092819214},{""x"":4.099999904632568,""y"":1.2703818082809448},{""x"":4.599999904632568,""y"":1.2195014953613281},{""x"":5.099999904632568,""y"":0.585429310798645},{""x"":5.599999904632568,""y"":0.19421088695526123},{""x"":6.099999904632568,""y"":0.2276361584663391},{""x"":6.599999904632568,""y"":0.03259352594614029},{""x"":7.099999904632568,""y"":0.03811067342758179}]}],""chartOptions"":{""showStatistics"":[""auc""]}}","{""series"":[{""parameters"":[1.3987701446422334,1.0025589776619843,1.950431059109577,1.57489342486818],""fitFunction"":""sigmoid"",""fitLineColor"":""#9467bd"",""pointColor"":""#9467bd"",""showCurveConfidenceInterval"":true,""points"":[{""x"":0.10000000149011612,""y"":0.03612012043595314},{""x"":0.10000000149011612,""y"":0.05706661567091942},{""x"":0.10000000149011612,""y"":0.007174440659582615},{""x"":0.10000000149011612,""y"":0.006656676065176725},{""x"":0.10000000149011612,""y"":0.03480849787592888},{""x"":0.6000000238418579,""y"":0.0665726289153099},{""x"":0.6000000238418579,""y"":0.054525356739759445},{""x"":0.6000000238418579,""y"":0.055943023413419724},{""x"":0.6000000238418579,""y"":0.0544852614402771},{""x"":0.6000000238418579,""y"":0.02734142541885376},{""x"":1.100000023841858,""y"":0.02047267183661461},{""x"":1.100000023841858,""y"":0.04814719781279564},{""x"":1.100000023841858,""y"":0.05629648640751839},{""x"":1.100000023841858,""y"":0.05200682207942009},{""x"":1.100000023841858,""y"":0.046626269817352295},{""x"":1.600000023841858,""y"":0.027950428426265717},{""x"":1.600000023841858,""y"":0.021106986328959465},{""x"":1.600000023841858,""y"":0.011796108447015285},{""x"":1.600000023841858,""y"":0.04013078659772873},{""x"":1.600000023841858,""y"":0.018657365813851357},{""x"":2.0999999046325684,""y"":0.010390376672148705},{""x"":2.0999999046325684,""y"":0.06717702001333237},{""x"":2.0999999046325684,""y"":0.015734216198325157},{""x"":2.0999999046325684,""y"":0.0005020603421144187},{""x"":2.0999999046325684,""y"":0.03601917624473572},{""x"":2.5999999046325684,""y"":0.04580968990921974},{""x"":2.5999999046325684,""y"":0.013811883516609669},{""x"":2.5999999046325684,""y"":0.0347907729446888},{""x"":2.5999999046325684,""y"":0.003400992602109909},{""x"":2.5999999046325684,""y"":0.0658077746629715},{""x"":3.0999999046325684,""y"":0.06470326334238052},{""x"":3.0999999046325684,""y"":0.040105774998664856},{""x"":3.0999999046325684,""y"":0.004536386113613844},{""x"":3.0999999046325684,""y"":0.028299888595938683},{""x"":3.0999999046325684,""y"":0.015297790057957172},{""x"":3.5999999046325684,""y"":0.010205036029219627},{""x"":3.5999999046325684,""y"":0.030351044610142708},{""x"":3.5999999046325684,""y"":0.02823905274271965},{""x"":3.5999999046325684,""y"":0.00543160829693079},{""x"":3.5999999046325684,""y"":0.03528806194663048},{""x"":4.099999904632568,""y"":0.024404611438512802},{""x"":4.099999904632568,""y"":0.021398605778813362},{""x"":4.099999904632568,""y"":0.01746137998998165},{""x"":4.099999904632568,""y"":0.06801135092973709},{""x"":4.099999904632568,""y"":0.02418249472975731},{""x"":4.599999904632568,""y"":0.08065827190876007},{""x"":4.599999904632568,""y"":0.03795705363154411},{""x"":4.599999904632568,""y"":0.03595327213406563},{""x"":4.599999904632568,""y"":0.019490951672196388},{""x"":4.599999904632568,""y"":0.0357535295188427},{""x"":5.099999904632568,""y"":0.06301134079694748},{""x"":5.099999904632568,""y"":0.04880264401435852},{""x"":5.099999904632568,""y"":0.046849530190229416},{""x"":5.099999904632568,""y"":0.046094998717308044},{""x"":5.099999904632568,""y"":0.07735799998044968},{""x"":5.599999904632568,""y"":0.10287926346063614},{""x"":5.599999904632568,""y"":0.15329882502555847},{""x"":5.599999904632568,""y"":0.09895746409893036},{""x"":5.599999904632568,""y"":0.10509312152862549},{""x"":5.599999904632568,""y"":0.10584071278572083},{""x"":6.099999904632568,""y"":0.19464170932769775},{""x"":6.099999904632568,""y"":0.1837087869644165},{""x"":6.099999904632568,""y"":0.19690236449241638},{""x"":6.099999904632568,""y"":0.14827826619148254},{""x"":6.099999904632568,""y"":0.15355728566646576},{""x"":6.599999904632568,""y"":0.21270307898521423},{""x"":6.599999904632568,""y"":0.19529509544372559},{""x"":6.599999904632568,""y"":0.20716492831707},{""x"":6.599999904632568,""y"":0.18739652633666992},{""x"":6.599999904632568,""y"":0.22446008026599884},{""x"":7.099999904632568,""y"":0.18822836875915527},{""x"":7.099999904632568,""y"":0.2324085384607315},{""x"":7.099999904632568,""y"":0.1877404898405075},{""x"":7.099999904632568,""y"":0.19784560799598694},{""x"":7.099999904632568,""y"":0.21554286777973175}]}],""chartOptions"":{""showStatistics"":[""auc""]}}"'),t=e.columns.byName("json chart 0"),o=e.columns.byName("json chart 1"),i=e.columns.byName("json chart 2");yield r.data.detectSemanticTypes(e),h(t.semType,_.j2),h(o.semType,_.j2),h(i.semType,_.j2)})))),m("detectXMLCurveChart",(()=>k(void 0,void 0,void 0,(function*(){const e=n.DataFrame.fromCsv('xmlCurveFitChart\n"<chart><grid><xAxis min=""0.0"" max=""5"" /><yAxis min=""-100"" max=""100"" /></grid><settings xLabel=""Concentration"" yLabel=""Activity"" logX=""true"" /><seriesCollection><series><x>7.2e-12,7.1e-12,7e-12,6e-8,6e-5,6e-4</x><y>112,115,116,100,123,124</y><fitLine><function type=""sigif""><params>2e-08,-1.5,125,-20</params></function></fitLine><settings color=""Green"" marker=""SquareBorder"" markerColor=""Yellow"" markerBorderColor=""Black"" errorBarColor=""Red"" showErrorBars=""True"" drawLine=""True"" bound=""True"" /></series></seriesCollection></chart>"'),t=e.columns.byName("xmlCurveFitChart");yield r.data.detectSemanticTypes(e),h(t.semType,_.j2),h(t.tags[T.Rj],T.NH)}))))}));var M=__webpack_require__(870),A=__webpack_require__(414),S=__webpack_require__.n(A),P=__webpack_require__(840),C=function(n,r,e,t){return new(e||(e=Promise))((function(o,i){function u(n){try{c(t.next(n))}catch(n){i(n)}}function a(n){try{c(t.throw(n))}catch(n){i(n)}}function c(n){var r;n.done?o(n.value):(r=n.value,r instanceof e?r:new e((function(n){n(r)}))).then(u,a)}c((t=t.apply(n,r||[])).next())}))};function q(r){const e={series:[],chartOptions:{showStatistics:["auc"]}},t=(0,P.YC)(r,.5),o=n.Color.toHtml(n.Color.scatterPlotMarker);return e.series[0]={fitLineColor:o,pointColor:o,markerType:n.MARKER_TYPE.CIRCLE,showFitLine:!0,showPoints:"points",showCurveConfidenceInterval:!0,fitFunction:"sigmoid",points:S().count().take(r).map((function(n){return{x:t.x[n],y:t.y[n]}})).toArray()},e}v("creation",(()=>{m("fit curve creation",(()=>C(void 0,void 0,void 0,(function*(){const e=Date.now(),t=(0,P.lf)(n.Test.isInBenchmark?1e3:100,5,2);r.shell.addTableView(t);const o=Date.now();return yield w(50),console.log(`Creation took ${o.valueOf()-e.valueOf()} ms`),`${n.Test.isInBenchmark?1e3:100} points, took ${o.valueOf()-e.valueOf()} ms`}))))})),v("rendering",(()=>{m("rendering same fitChartData on canvas",(()=>C(void 0,void 0,void 0,(function*(){const e=M.canvas(160,120);r.shell.newView("canvas",[e]);const t=e.getContext("2d"),o=new T.cv,i=q(n.Test.isInBenchmark?50:15);for(let n=1;n<=1e3;n++)o.renderCurves(t,e.clientLeft,e.clientTop,160,120,i),t.clearRect(0,0,160,120);return"rendering performed 1000 times"})))),m("rendering different fitChartData on canvas",(()=>C(void 0,void 0,void 0,(function*(){const e=M.canvas(160,120);r.shell.newView("canvas",[e]);const t=e.getContext("2d"),o=new T.cv;for(let r=1;r<=1e3;r++){const r=q(n.Test.isInBenchmark?50:15);o.renderCurves(t,e.clientLeft,e.clientTop,160,120,r),t.clearRect(0,0,160,120)}return"rendering performed 1000 times"})))),m("rendering in grid",(()=>C(void 0,void 0,void 0,(function*(){const n=(0,P.lf)(30,5,2),e=r.shell.addTableView(n);yield w(100);const t=e.grid.root.getElementsByTagName("canvas")[2],o=new Date;yield function(n,r,e,t){return C(this,void 0,void 0,(function*(){for(let r=0;r<10;r++)n.dispatchEvent(new WheelEvent("wheel",{deltaY:300})),yield w(10)}))}(t);const i=new Date;return console.log(`curves rendering took ${i.valueOf()-o.valueOf()} ms`),i.valueOf()-o.valueOf()+" ms"}))))}));var N=__webpack_require__(766);v("viewport",(()=>{m("viewportMethods",(()=>{return r=void 0,e=void 0,o=function*(){const r=new n.Rect(120,20,160,100).inflate(T.od/2,T.od/2),[e]=(0,T.Ce)(r,!1,!1),t=new n.Rect(.1,.06,7,5.94),o=new N.l(t,e,!1,!1);h(o.xToScreen(1.5),182.4),h(o.yToScreen(2.33),73.01346801346801),h(o.xToWorld(150),-.9652173913043479),h(o.yToWorld(67),2.855294117647059)},new((t=void 0)||(t=Promise))((function(n,i){function u(n){try{c(o.next(n))}catch(n){i(n)}}function a(n){try{c(o.throw(n))}catch(n){i(n)}}function c(r){var e;r.done?n(r.value):(e=r.value,e instanceof t?e:new t((function(n){n(e)}))).then(u,a)}c((o=o.apply(r,e||[])).next())}));var r,e,t,o}))}));var j=__webpack_require__(416),O=__webpack_require__(111),E=function(n,r,e,t){return new(e||(e=Promise))((function(o,i){function u(n){try{c(t.next(n))}catch(n){i(n)}}function a(n){try{c(t.throw(n))}catch(n){i(n)}}function c(n){var r;n.done?o(n.value):(r=n.value,r instanceof e?r:new e((function(n){n(r)}))).then(u,a)}c((t=t.apply(n,r||[])).next())}))};const L={fitLineColor:"#1f77b4",pointColor:"#1f77b4",showCurveConfidenceInterval:!1,points:[{x:.10000000149011612,y:1.7412786483764648},{x:.6000000238418579,y:1.8561450242996216},{x:1.100000023841858,y:1.6065685749053955},{x:1.600000023841858,y:1.70476496219635},{x:2.0999999046325684,y:1.5737264156341553},{x:2.5999999046325684,y:1.6007002592086792},{x:3.0999999046325684,y:1.6796687841415405},{x:3.5999999046325684,y:1.656104326248169},{x:4.099999904632568,y:1.782997488975525},{x:4.599999904632568,y:1.530208945274353},{x:5.099999904632568,y:1.1572397947311401},{x:5.599999904632568,y:.8691964745521545},{x:6.099999904632568,y:.3228665590286255},{x:6.599999904632568,y:.2990703880786896},{x:7.099999904632568,y:.23361243307590485}],fitFunction:"sigmoid",clickToToggle:!1,showFitLine:!0,showPoints:"points",parameters:[1.6914372095641517,1.1536998642628853,5.410173358224149,.2089689354045083]},Y={fitLineColor:"#2ca02c",pointColor:"#2ca02c",showCurveConfidenceInterval:!0,fitFunction:{name:"Polynomial",function:"([p1, p2, p3, p4], x) => p1 * x * x * x + p2 * x * x + p3 * x + p4",getInitialParameters:"(xs, ys) => [0.1, -1, 4, 4]",parameterNames:["Slope","Intercept","Parameter3","Parameter4"]},points:[{x:.10000000149011612,y:7.365033149719238},{x:.6000000238418579,y:6.595034599304199},{x:1.100000023841858,y:7.05179500579834},{x:1.600000023841858,y:7.251461982727051},{x:2.0999999046325684,y:7.775498867034912},{x:2.5999999046325684,y:7.748039722442627},{x:3.0999999046325684,y:6.8391804695129395},{x:3.5999999046325684,y:7.570991516113281},{x:4.099999904632568,y:6.387666702270508},{x:4.599999904632568,y:6.464827537536621},{x:5.099999904632568,y:3.932436227798462},{x:5.599999904632568,y:1.4741199016571045},{x:6.099999904632568,y:.47604307532310486},{x:6.599999904632568,y:.5836760401725769},{x:7.099999904632568,y:1.0317600965499878}],clickToToggle:!1,showFitLine:!0,showPoints:"points",parameters:[.07070206940832963,-1.138666933634074,3.947509109407932,3.9947960440506685]},I=(0,j.Y6)(L),F=(0,j.Y6)(Y);v("fit",(()=>{m("getSeriesFitFunction",(()=>E(void 0,void 0,void 0,(function*(){const{xs:n,ys:r}=(0,j.q_)(L.points),{xs:e,ys:t}=(0,j.q_)(Y.points);h(I.name,_.yB),h(F.name,"Polynomial"),g(I.parameterNames,["Top","Bottom","Slope","IC50"]),g(F.parameterNames,["Slope","Intercept","Parameter3","Parameter4"]),g(I.getInitialParameters(n,r),[1.8561450242996216,1,5.099999904632568,.23361243307590485]),g(F.getInitialParameters(e,t),[.1,-1,4,4]),h(I.y(L.parameters,1.1),1.6914214213007113),h(F.y(F.getInitialParameters(e,t),1.1),7.3231)})))),m("getCurve",(()=>E(void 0,void 0,void 0,(function*(){const n=(0,j.kG)(L,I),r=(0,j.kG)(Y,F);h(n(2.5),1.6907865884456907),h(n(5.8858),.5356637992990292),h(r(1.56),7.6502648725700535),h(r(3.99876),6.09328601677405)})))),m("fitSeries",(()=>E(void 0,void 0,void 0,(function*(){const n=Date.now(),r=(0,j.PK)(L,I),e=(0,j.PK)(Y,F),t=Date.now();return h(r.fittedCurve(2.5),1.690742266220136),h(e.fittedCurve(3.99876),6.09328601677405),g(r.parameters,[1.691390784119389,1.1540819399621425,5.4104428146970704,.20886765646057662]),g(e.parameters,[.07070206940832963,-1.138666933634074,3.947509109407932,3.9947960440506685]),t.valueOf()-n.valueOf()+" ms"})))),m("getSeriesConfidenceInterval",(()=>E(void 0,void 0,void 0,(function*(){const n=(0,j.LC)(L,I,!0),r=(0,j.LC)(Y,F,!0);h(n.confidenceTop(2.578),1.8540854906189528),h(r.confidenceTop(2.3342),10.035230015978911),h(n.confidenceBottom(3.987),1.494930602732917),h(r.confidenceBottom(3.8796),4.168651824724921)})))),m("getSeriesStatistics",(()=>E(void 0,void 0,void 0,(function*(){const n=(0,j.tq)(L,I),r=(0,j.tq)(Y,F);h(n.auc,9.33542235488813),h(r.auc,36.52554692824738),h(n.rSquared,.9781915962446398),h(r.rSquared,.8460557736673078)})))),m("calculateBoxPlotStatistics",(()=>E(void 0,void 0,void 0,(function*(){const n=(0,O.G)([.7654603719711304,.8199243545532227,.8257747292518616,.9558155536651611,.9596694707870483]);h(n.q1,.8199243545532227),h(n.q2,.8257747292518616),h(n.q3,.9558155536651611),h(n.lowerAdjacentValue,.7654603719711304),h(n.upperAdjacentValue,.9558155536651611)})))),m("sigmoid",(()=>E(void 0,void 0,void 0,(function*(){const n=[2.612687371569039,-1.421800778574126,5.16688669906018,.341788492203575];h((0,_.Hg)(n,.5),.34178901799627626),h((0,_.Hg)(n,2.5),.3421552218929382),h((0,_.Hg)(n,5.678976),2.254881739737238)}))))}));var R=function(n,r,e,t){return new(e||(e=Promise))((function(o,i){function u(n){try{c(t.next(n))}catch(n){i(n)}}function a(n){try{c(t.throw(n))}catch(n){i(n)}}function c(n){var r;n.done?o(n.value):(r=n.value,r instanceof e?r:new e((function(n){n(r)}))).then(u,a)}c((t=t.apply(n,r||[])).next())}))};const V=new n.Package;function X(t,o,c){return R(this,void 0,void 0,(function*(){const s=yield function(t){var o,c,s,m,h;return e(this,void 0,void 0,(function*(){const d=null===(c=null===(o=r.functions.getCurrentCall())||void 0===o?void 0:o.func)||void 0===c?void 0:c.package;yield function(n,t){return e(this,void 0,void 0,(function*(){if(a[n])return;const t=i;if(void 0!==t[u]||Object.keys(t).find((n=>n.startsWith(u))))return void(a[n]=!0);const o=[],c=yield r.dapi.functions.filter(`package.id = "${n}"`).list(),s=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)/g);for(const n of c){const i=n.options.test;if(i&&Array.isArray(i)&&i.length)for(let a=0;a<i.length;a++){const c=i[a].matchAll(s),l={};Array.from(c).forEach((n=>{n[0].startsWith("skip")?l.skip=n[1]:n[0].startsWith("wait")?l.wait=parseInt(n[2]):n[0].startsWith("cat")&&(l.cat=n[3])}));const m=new f(u,1===i.length?n.name:`${n.name} ${a+1}`,(()=>e(this,void 0,void 0,(function*(){const e=yield r.functions.eval(y(i[a],n));if(l.wait&&(yield w(l.wait)),"boolean"==typeof e&&!e)throw`Failed: ${i[a]}, expected true, got ${e}`}))),{skipReason:l.skip});if(l.cat){const n=u+": "+l.cat;m.category=n,void 0===t[n]&&(t[n]={tests:[],clear:!0}),t[n].tests.push(m)}else o.push(m)}}a[n]=!0,o.length&&(t[u]={tests:o,clear:!0})}))}(d.id);const p=[];console.log("Running tests"),null!=t||(t={}),null!==(s=(h=t).testContext)&&void 0!==s||(h.testContext=new l),r.shell.lastError="";for(const[e,o]of Object.entries(i)){if(null!=(null==t?void 0:t.category)&&!e.toLowerCase().startsWith(null==t?void 0:t.category.toLowerCase()))continue;console.log(`Started ${e} category`);try{o.before&&(yield o.before())}catch(n){o.beforeStatus=n.toString()}const i=null!==(m=o.tests)&&void 0!==m?m:[],u=[];if(o.clear)for(let e=0;e<i.length;e++)u.push(yield x(i[e],null==t?void 0:t.test,o.timeout,d.name)),r.shell.closeAll(),n.Balloon.closeAll();else for(let n=0;n<i.length;n++)u.push(yield x(i[n],null==t?void 0:t.test,o.timeout,d.name));const a=(yield Promise.all(u)).filter((n=>"skipped"!=n.result));try{o.after&&(yield o.after())}catch(n){o.afterStatus=n.toString()}o.afterStatus&&a.push({category:e,name:"init",result:o.afterStatus,success:!1,ms:0,skipped:!1}),o.beforeStatus&&a.push({category:e,name:"init",result:o.beforeStatus,success:!1,ms:0,skipped:!1}),p.push(...a)}if(t.testContext.catchUnhandled&&(yield w(1e3),r.shell.lastError.length>0&&p.push({category:"Unhandled exceptions",name:"exceptions",result:r.shell.lastError,success:!1,ms:0,skipped:!1})),t.testContext.report){const r=new n.Logger,e=p.filter((n=>n.success)).length,t=p.filter((n=>n.skipped)).length,o=p.filter((n=>!n.success)),i="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",u={successful:e,skipped:t,failed:o.length,package:d};for(const n of o)Object.assign(u,{[`${n.category} | ${n.name}`]:n.result});r.log(i,u,"package-tested")}return p}))}({category:t,test:o,testContext:c});return n.DataFrame.fromObjects(s)}))}})(),curves_test=__webpack_exports__})();
|
|
1
|
+
var curves_test;(()=>{var __webpack_modules__={78:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";function copyInto(e,n){for(var r=0;r<n.length;r++)e[r]=n[r]}function limitedMemoryBFGS(e,n){var r=+new Date,t=n.length,o=numeric.rep([t],0);e.getGradient(n,o);var i=numeric.clone(o),a=numeric.clone(n),u=numeric.clone(o);numeric.diveq(u,numeric.norm2(u));var s=[],c=[],f=[],l=(backtrackingLineSearch(e,u,o,n),e.getValue(n));o=e.getGradient(n,o);for(var m=l,h=0;h<100;h++){var p;if(new Date,s.length<4)s.unshift(numeric.sub(n,a)),c.unshift(numeric.sub(o,i));else{for(var d=s.pop(),y=c.pop(),g=0;g<t;g++)d[g]=n[g]-a[g],y[g]=o[g]-i[g];s.unshift(d),c.unshift(y)}copyInto(a,n),copyInto(i,o);var x=0,v=0;for(g=0;g<t;g++)x+=s[0][g]*c[0][g],v+=c[0][g]*c[0][g];var w=x/v;f.unshift(1/x),copyInto(u,o);for(var b=[],T=0;T<s.length;T++){var C=0;for(g=0;g<t;g++)C+=s[T][g]*u[g];for(C*=f[T],b.push(C),g=0;g<t;g++)u[g]+=c[T][g]*-C}for(g=0;g<t;g++)u[g]*=w;for(T=s.length-1;T>=0;T--){var _=0;for(g=0;g<t;g++)_+=c[T][g]*u[g];for(_*=f[T],C=b[T],g=0;g<t;g++)u[g]+=s[T][g]*(C-_)}for(g=0;g<t;g++)u[g]=-u[g];if(backtrackingLineSearch(e,u,o,n),l=e.getValue(n),o=e.getGradient(n,o),2*(l-m)<=1e-4*(Math.abs(l)+Math.abs(m)+1e-5))return p=+new Date,!0;var A=numeric.norm2(o);if(A<.001)return p=+new Date,!0;if(0==A)return p=+new Date,!0;m=l}return p=+new Date,console.log("Finished iterations "+(p-r)),!0}function backtrackingLineSearch(e,n,r,t){var o=t.length,i=0,a=1,u=0,s=e.getValue(t),c=s,f=numeric.norm2(n);f>100&&numeric.muleq(n,100/f);for(var l=0,m=0;m<o;m++)l+=r[m]*n[m];var h=0;for(m=0;m<o;m++){var p=Math.abs(n[m]/Math.max(Math.abs(t[m]),1));p>h&&(h=p)}for(var d=1e-4/h,y=0;y<25;y++){for(m=0;m<o;m++)t[m]+=(a-i)*n[m];if(a<d)return 0;var g=e.getValue(t);if(g>=s+1e-4*a*l)return a;if(isFinite(g))if(1==a)u=-l/(2*(g-s-l));else{var x=g-s-a*l,v=c-s-i*l,w=1/(a*a),b=1/(i*i),T=1/(a-i),C=T*(x*w-v*b),_=T*(-x*i*w+v*a*b);if(0==C)u=-l/(2*_);else{var A=_*_-3*C*l;u=A<0?.5*a:_<=0?(-_+Math.sqrt(A))/(3*C):-l/(_+Math.sqrt(A))}u>.5*a&&(u=.5*a)}else u=.2*a;c=g,i=a,a=Math.max(u,.1*a)}}__webpack_require__.d(__webpack_exports__,{U:()=>limitedMemoryBFGS});var quadratic={getValue:function(e){var n=e[0],r=e[1];return-3*n*n-4*r*r+2*n-4*r+18},getGradient:function(e,n){return n[0]=-6*e[0]+2,n[1]=-8*e[1]-4,n}};function doubleExp(e){for(var n=Array(e),r=0;r<e;r++)n[r]=Math.log(Math.random())*(Math.random()>.5?1:-1);return n}var ridgeRegression={covariates:[],responses:[],originalParameters:doubleExp(100),sample:function(e,n){for(var r=0;r<e;r++){var t=doubleExp(100);this.responses.push(numeric.dot(t,this.originalParameters)+n()),this.covariates.push(t)}},getValue:function(e){for(var n=0,r=0;r<this.covariates.length;r++){var t=this.responses[r]-numeric.dot(this.covariates[r],e);n+=-.5*t*t}return n},getGradient:function(e,n){for(var r=0;r<this.covariates.length;r++){var t=this.responses[r]-numeric.dot(this.covariates[r],e);numeric.addeq(n,numeric.mul(this.covariates[r],t))}return n}},numeric="undefined"==typeof exports?function(){}:exports;void 0!==__webpack_require__.g&&(__webpack_require__.g.numeric=numeric),numeric.version="1.2.6",numeric.bench=function(e,n){var r,t,o;for(void 0===n&&(n=15),t=.5,r=new Date;;){for(o=t*=2;o>3;o-=4)e(),e(),e(),e();for(;o>0;)e(),o--;if(new Date-r>n)break}for(o=t;o>3;o-=4)e(),e(),e(),e();for(;o>0;)e(),o--;return 1e3*(3*t-1)/(new Date-r)},numeric._myIndexOf=function(e){var n,r=this.length;for(n=0;n<r;++n)if(this[n]===e)return n;return-1},numeric.myIndexOf=Array.prototype.indexOf?Array.prototype.indexOf:numeric._myIndexOf,numeric.Function=Function,numeric.precision=4,numeric.largeArray=50,numeric.prettyPrint=function(e){function n(e){if(0===e)return"0";if(isNaN(e))return"NaN";if(e<0)return"-"+n(-e);if(isFinite(e)){var r=Math.floor(Math.log(e)/Math.log(10)),t=e/Math.pow(10,r),o=t.toPrecision(numeric.precision);return 10===parseFloat(o)&&(r++,o=(t=1).toPrecision(numeric.precision)),parseFloat(o).toString()+"e"+r.toString()}return"Infinity"}var r=[];return function e(t){var o;if(void 0===t)return r.push(Array(numeric.precision+8).join(" ")),!1;if("string"==typeof t)return r.push('"'+t+'"'),!1;if("boolean"==typeof t)return r.push(t.toString()),!1;if("number"==typeof t){var i=n(t),a=t.toPrecision(numeric.precision),u=parseFloat(t.toString()).toString(),s=[i,a,u,parseFloat(a).toString(),parseFloat(u).toString()];for(o=1;o<s.length;o++)s[o].length<i.length&&(i=s[o]);return r.push(Array(numeric.precision+8-i.length).join(" ")+i),!1}if(null===t)return r.push("null"),!1;if("function"==typeof t){r.push(t.toString());var c=!1;for(o in t)t.hasOwnProperty(o)&&(c?r.push(",\n"):r.push("\n{"),c=!0,r.push(o),r.push(": \n"),e(t[o]));return c&&r.push("}\n"),!0}if(t instanceof Array){if(t.length>numeric.largeArray)return r.push("...Large Array..."),!0;for(c=!1,r.push("["),o=0;o<t.length;o++)o>0&&(r.push(","),c&&r.push("\n ")),c=e(t[o]);return r.push("]"),!0}for(o in r.push("{"),c=!1,t)t.hasOwnProperty(o)&&(c&&r.push(",\n"),c=!0,r.push(o),r.push(": \n"),e(t[o]));return r.push("}"),!0}(e),r.join("")},numeric.parseDate=function(e){return function e(n){if("string"==typeof n)return Date.parse(n.replace(/-/g,"/"));if(n instanceof Array){var r,t=[];for(r=0;r<n.length;r++)t[r]=e(n[r]);return t}throw new Error("parseDate: parameter must be arrays of strings")}(e)},numeric.parseFloat=function(e){return function e(n){if("string"==typeof n)return parseFloat(n);if(n instanceof Array){var r,t=[];for(r=0;r<n.length;r++)t[r]=e(n[r]);return t}throw new Error("parseFloat: parameter must be arrays of strings")}(e)},numeric.parseCSV=function(e){var n,r,t,o=e.split("\n"),i=[],a=/(([^'",]*)|('[^']*')|("[^"]*")),/g,u=/^\s*(([+-]?[0-9]+(\.[0-9]*)?(e[+-]?[0-9]+)?)|([+-]?[0-9]*(\.[0-9]+)?(e[+-]?[0-9]+)?))\s*$/,s=0;for(r=0;r<o.length;r++){var c,f=(o[r]+",").match(a);if(f.length>0){for(i[s]=[],n=0;n<f.length;n++)c=(t=f[n]).substr(0,t.length-1),u.test(c)?i[s][n]=parseFloat(c):i[s][n]=c;s++}}return i},numeric.toCSV=function(e){var n,r,t,o,i,a=numeric.dim(e);for(t=a[0],a[1],i=[],n=0;n<t;n++){for(o=[],r=0;r<t;r++)o[r]=e[n][r].toString();i[n]=o.join(", ")}return i.join("\n")+"\n"},numeric.getURL=function(e){var n=new XMLHttpRequest;return n.open("GET",e,!1),n.send(),n},numeric.imageURL=function(e){function n(e,n,r){void 0===n&&(n=0),void 0===r&&(r=e.length);var t,o=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],i=-1;for(e.length,t=n;t<r;t++)i=i>>>8^o[255&(i^e[t])];return-1^i}var r,t,o,i,a,u,s,c,f,l,m=e[0].length,h=e[0][0].length,p=[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,h>>24&255,h>>16&255,h>>8&255,255&h,m>>24&255,m>>16&255,m>>8&255,255&m,8,2,0,0,0,-1,-2,-3,-4,-5,-6,-7,-8,73,68,65,84,8,29];for(l=n(p,12,29),p[29]=l>>24&255,p[30]=l>>16&255,p[31]=l>>8&255,p[32]=255&l,r=1,t=0,s=0;s<m;s++){for(s<m-1?p.push(0):p.push(1),a=3*h+1+(0===s)&255,u=3*h+1+(0===s)>>8&255,p.push(a),p.push(u),p.push(255&~a),p.push(255&~u),0===s&&p.push(0),c=0;c<h;c++)for(o=0;o<3;o++)t=(t+(r=(r+(a=(a=e[o][s][c])>255?255:a<0?0:Math.round(a)))%65521))%65521,p.push(a);p.push(0)}return f=(t<<16)+r,p.push(f>>24&255),p.push(f>>16&255),p.push(f>>8&255),p.push(255&f),i=p.length-41,p[33]=i>>24&255,p[34]=i>>16&255,p[35]=i>>8&255,p[36]=255&i,l=n(p,37),p.push(l>>24&255),p.push(l>>16&255),p.push(l>>8&255),p.push(255&l),p.push(0),p.push(0),p.push(0),p.push(0),p.push(73),p.push(69),p.push(78),p.push(68),p.push(174),p.push(66),p.push(96),p.push(130),"data:image/png;base64,"+function(e){var n,r,t,o,i,a,u,s=e.length,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f="";for(n=0;n<s;n+=3)i=((3&(r=e[n]))<<4)+((t=e[n+1])>>4),a=((15&t)<<2)+((o=e[n+2])>>6),u=63&o,n+1>=s?a=u=64:n+2>=s&&(u=64),f+=c.charAt(r>>2)+c.charAt(i)+c.charAt(a)+c.charAt(u);return f}(p)},numeric._dim=function(e){for(var n=[];"object"==typeof e;)n.push(e.length),e=e[0];return n},numeric.dim=function(e){var n;return"object"==typeof e?"object"==typeof(n=e[0])?"object"==typeof n[0]?numeric._dim(e):[e.length,n.length]:[e.length]:[]},numeric.mapreduce=function(e,n){return Function("x","accum","_s","_k",'if(typeof accum === "undefined") accum = '+n+';\nif(typeof x === "number") { var xi = x; '+e+'; return accum; }\nif(typeof _s === "undefined") _s = numeric.dim(x);\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i,xi;\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) {\n accum = arguments.callee(x[i],accum,_s,_k+1);\n } return accum;\n}\nfor(i=_n-1;i>=1;i-=2) { \n xi = x[i];\n '+e+";\n xi = x[i-1];\n "+e+";\n}\nif(i === 0) {\n xi = x[i];\n "+e+"\n}\nreturn accum;")},numeric.mapreduce2=function(e,n){return Function("x","var n = x.length;\nvar i,xi;\n"+n+";\nfor(i=n-1;i!==-1;--i) { \n xi = x[i];\n "+e+";\n}\nreturn accum;")},numeric.same=function e(n,r){var t,o;if(n instanceof Array&&r instanceof Array){if((o=n.length)!==r.length)return!1;for(t=0;t<o;t++)if(n[t]!==r[t]){if("object"!=typeof n[t])return!1;if(!e(n[t],r[t]))return!1}return!0}return!1},numeric.rep=function(e,n,r){void 0===r&&(r=0);var t,o=e[r],i=Array(o);if(r===e.length-1){for(t=o-2;t>=0;t-=2)i[t+1]=n,i[t]=n;return-1===t&&(i[0]=n),i}for(t=o-1;t>=0;t--)i[t]=numeric.rep(e,n,r+1);return i},numeric.dotMMsmall=function(e,n){var r,t,o,i,a,u,s,c,f,l,m;for(i=e.length,a=n.length,u=n[0].length,s=Array(i),r=i-1;r>=0;r--){for(c=Array(u),f=e[r],o=u-1;o>=0;o--){for(l=f[a-1]*n[a-1][o],t=a-2;t>=1;t-=2)m=t-1,l+=f[t]*n[t][o]+f[m]*n[m][o];0===t&&(l+=f[0]*n[0][o]),c[o]=l}s[r]=c}return s},numeric._getCol=function(e,n,r){var t;for(t=e.length-1;t>0;--t)r[t]=e[t][n],r[--t]=e[t][n];0===t&&(r[0]=e[0][n])},numeric.dotMMbig=function(e,n){var r,t,o,i=numeric._getCol,a=n.length,u=Array(a),s=e.length,c=n[0].length,f=new Array(s),l=numeric.dotVV;for(--a,t=--s;-1!==t;--t)f[t]=Array(c);for(t=--c;-1!==t;--t)for(i(n,t,u),o=s;-1!==o;--o)r=e[o],f[o][t]=l(r,u);return f},numeric.dotMV=function(e,n){var r,t=e.length,o=(n.length,Array(t)),i=numeric.dotVV;for(r=t-1;r>=0;r--)o[r]=i(e[r],n);return o},numeric.dotVM=function(e,n){var r,t,o,i,a,u,s;for(o=e.length,i=n[0].length,a=Array(i),t=i-1;t>=0;t--){for(u=e[o-1]*n[o-1][t],r=o-2;r>=1;r-=2)s=r-1,u+=e[r]*n[r][t]+e[s]*n[s][t];0===r&&(u+=e[0]*n[0][t]),a[t]=u}return a},numeric.dotVV=function(e,n){var r,t,o=e.length,i=e[o-1]*n[o-1];for(r=o-2;r>=1;r-=2)t=r-1,i+=e[r]*n[r]+e[t]*n[t];return 0===r&&(i+=e[0]*n[0]),i},numeric.dot=function(e,n){var r=numeric.dim;switch(1e3*r(e).length+r(n).length){case 2002:return n.length<10?numeric.dotMMsmall(e,n):numeric.dotMMbig(e,n);case 2001:return numeric.dotMV(e,n);case 1002:return numeric.dotVM(e,n);case 1001:return numeric.dotVV(e,n);case 1e3:return numeric.mulVS(e,n);case 1:return numeric.mulSV(e,n);case 0:return e*n;default:throw new Error("numeric.dot only works on vectors and matrices")}},numeric.diag=function(e){var n,r,t,o,i=e.length,a=Array(i);for(n=i-1;n>=0;n--){for(o=Array(i),r=n+2,t=i-1;t>=r;t-=2)o[t]=0,o[t-1]=0;for(t>n&&(o[t]=0),o[n]=e[n],t=n-1;t>=1;t-=2)o[t]=0,o[t-1]=0;0===t&&(o[0]=0),a[n]=o}return a},numeric.getDiag=function(e){var n,r=Math.min(e.length,e[0].length),t=Array(r);for(n=r-1;n>=1;--n)t[n]=e[n][n],t[--n]=e[n][n];return 0===n&&(t[0]=e[0][0]),t},numeric.identity=function(e){return numeric.diag(numeric.rep([e],1))},numeric.pointwise=function(e,n,r){void 0===r&&(r="");var t,o,i=[],a=/\[i\]$/,u="",s=!1;for(t=0;t<e.length;t++)a.test(e[t])?u=o=e[t].substring(0,e[t].length-3):o=e[t],"ret"===o&&(s=!0),i.push(o);return i[e.length]="_s",i[e.length+1]="_k",i[e.length+2]='if(typeof _s === "undefined") _s = numeric.dim('+u+');\nif(typeof _k === "undefined") _k = 0;\nvar _n = _s[_k];\nvar i'+(s?"":", ret = Array(_n)")+";\nif(_k < _s.length-1) {\n for(i=_n-1;i>=0;i--) ret[i] = arguments.callee("+e.join(",")+",_s,_k+1);\n return ret;\n}\n"+r+"\nfor(i=_n-1;i!==-1;--i) {\n "+n+"\n}\nreturn ret;",Function.apply(null,i)},numeric.pointwise2=function(e,n,r){void 0===r&&(r="");var t,o,i=[],a=/\[i\]$/,u="",s=!1;for(t=0;t<e.length;t++)a.test(e[t])?u=o=e[t].substring(0,e[t].length-3):o=e[t],"ret"===o&&(s=!0),i.push(o);return i[e.length]="var _n = "+u+".length;\nvar i"+(s?"":", ret = Array(_n)")+";\n"+r+"\nfor(i=_n-1;i!==-1;--i) {\n"+n+"\n}\nreturn ret;",Function.apply(null,i)},numeric._biforeach=function e(n,r,t,o,i){var a;if(o!==t.length-1)for(a=t[o]-1;a>=0;a--)e("object"==typeof n?n[a]:n,"object"==typeof r?r[a]:r,t,o+1,i);else i(n,r)},numeric._biforeach2=function e(n,r,t,o,i){if(o===t.length-1)return i(n,r);var a,u=t[o],s=Array(u);for(a=u-1;a>=0;--a)s[a]=e("object"==typeof n?n[a]:n,"object"==typeof r?r[a]:r,t,o+1,i);return s},numeric._foreach=function e(n,r,t,o){var i;if(t!==r.length-1)for(i=r[t]-1;i>=0;i--)e(n[i],r,t+1,o);else o(n)},numeric._foreach2=function e(n,r,t,o){if(t===r.length-1)return o(n);var i,a=r[t],u=Array(a);for(i=a-1;i>=0;i--)u[i]=e(n[i],r,t+1,o);return u},numeric.ops2={add:"+",sub:"-",mul:"*",div:"/",mod:"%",and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">=",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"},numeric.opseq={addeq:"+=",subeq:"-=",muleq:"*=",diveq:"/=",modeq:"%=",lshifteq:"<<=",rshifteq:">>=",rrshifteq:">>>=",bandeq:"&=",boreq:"|=",bxoreq:"^="},numeric.mathfuns=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan","isNaN","isFinite"],numeric.mathfuns2=["atan2","pow","max","min"],numeric.ops1={neg:"-",not:"!",bnot:"~",clone:""},numeric.mapreducers={any:["if(xi) return true;","var accum = false;"],all:["if(!xi) return false;","var accum = true;"],sum:["accum += xi;","var accum = 0;"],prod:["accum *= xi;","var accum = 1;"],norm2Squared:["accum += xi*xi;","var accum = 0;"],norminf:["accum = max(accum,abs(xi));","var accum = 0, max = Math.max, abs = Math.abs;"],norm1:["accum += abs(xi)","var accum = 0, abs = Math.abs;"],sup:["accum = max(accum,xi);","var accum = -Infinity, max = Math.max;"],inf:["accum = min(accum,xi);","var accum = Infinity, min = Math.min;"]},function(){var e,n;for(e=0;e<numeric.mathfuns2.length;++e)n=numeric.mathfuns2[e],numeric.ops2[n]=n;for(e in numeric.ops2)if(numeric.ops2.hasOwnProperty(e)){n=numeric.ops2[e];var r,t,o="";-1!==numeric.myIndexOf.call(numeric.mathfuns2,e)?(o="var "+n+" = Math."+n+";\n",r=function(e,r,t){return e+" = "+n+"("+r+","+t+")"},t=function(e,r){return e+" = "+n+"("+e+","+r+")"}):(r=function(e,r,t){return e+" = "+r+" "+n+" "+t},t=numeric.opseq.hasOwnProperty(e+"eq")?function(e,r){return e+" "+n+"= "+r}:function(e,r){return e+" = "+e+" "+n+" "+r}),numeric[e+"VV"]=numeric.pointwise2(["x[i]","y[i]"],r("ret[i]","x[i]","y[i]"),o),numeric[e+"SV"]=numeric.pointwise2(["x","y[i]"],r("ret[i]","x","y[i]"),o),numeric[e+"VS"]=numeric.pointwise2(["x[i]","y"],r("ret[i]","x[i]","y"),o),numeric[e]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar VV = numeric."+e+"VV, VS = numeric."+e+"VS, SV = numeric."+e+'SV;\nvar dim = numeric.dim;\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof x === "object") {\n if(typeof y === "object") x = numeric._biforeach2(x,y,dim(x),0,VV);\n else x = numeric._biforeach2(x,y,dim(x),0,VS);\n } else if(typeof y === "object") x = numeric._biforeach2(x,y,dim(y),0,SV);\n else '+t("x","y")+"\n}\nreturn x;\n"),numeric[n]=numeric[e],numeric[e+"eqV"]=numeric.pointwise2(["ret[i]","x[i]"],t("ret[i]","x[i]"),o),numeric[e+"eqS"]=numeric.pointwise2(["ret[i]","x"],t("ret[i]","x"),o),numeric[e+"eq"]=Function("var n = arguments.length, i, x = arguments[0], y;\nvar V = numeric."+e+"eqV, S = numeric."+e+'eqS\nvar s = numeric.dim(x);\nfor(i=1;i!==n;++i) { \n y = arguments[i];\n if(typeof y === "object") numeric._biforeach(x,y,s,0,V);\n else numeric._biforeach(x,y,s,0,S);\n}\nreturn x;\n')}for(e=0;e<numeric.mathfuns2.length;++e)n=numeric.mathfuns2[e],delete numeric.ops2[n];for(e=0;e<numeric.mathfuns.length;++e)n=numeric.mathfuns[e],numeric.ops1[n]=n;for(e in numeric.ops1)numeric.ops1.hasOwnProperty(e)&&(o="",n=numeric.ops1[e],-1!==numeric.myIndexOf.call(numeric.mathfuns,e)&&Math.hasOwnProperty(n)&&(o="var "+n+" = Math."+n+";\n"),numeric[e+"eqV"]=numeric.pointwise2(["ret[i]"],"ret[i] = "+n+"(ret[i]);",o),numeric[e+"eq"]=Function("x",'if(typeof x !== "object") return '+n+"x\nvar i;\nvar V = numeric."+e+"eqV;\nvar s = numeric.dim(x);\nnumeric._foreach(x,s,0,V);\nreturn x;\n"),numeric[e+"V"]=numeric.pointwise2(["x[i]"],"ret[i] = "+n+"(x[i]);",o),numeric[e]=Function("x",'if(typeof x !== "object") return '+n+"(x)\nvar i;\nvar V = numeric."+e+"V;\nvar s = numeric.dim(x);\nreturn numeric._foreach2(x,s,0,V);\n"));for(e=0;e<numeric.mathfuns.length;++e)n=numeric.mathfuns[e],delete numeric.ops1[n];for(e in numeric.mapreducers)numeric.mapreducers.hasOwnProperty(e)&&(n=numeric.mapreducers[e],numeric[e+"V"]=numeric.mapreduce2(n[0],n[1]),numeric[e]=Function("x","s","k",n[1]+'if(typeof x !== "object") { xi = x;\n'+n[0]+';\n return accum;\n}if(typeof s === "undefined") s = numeric.dim(x);\nif(typeof k === "undefined") k = 0;\nif(k === s.length-1) return numeric.'+e+"V(x);\nvar xi;\nvar n = x.length, i;\nfor(i=n-1;i!==-1;--i) {\n xi = arguments.callee(x[i]);\n"+n[0]+";\n}\nreturn accum;\n"))}(),numeric.truncVV=numeric.pointwise(["x[i]","y[i]"],"ret[i] = round(x[i]/y[i])*y[i];","var round = Math.round;"),numeric.truncVS=numeric.pointwise(["x[i]","y"],"ret[i] = round(x[i]/y)*y;","var round = Math.round;"),numeric.truncSV=numeric.pointwise(["x","y[i]"],"ret[i] = round(x/y[i])*y[i];","var round = Math.round;"),numeric.trunc=function(e,n){return"object"==typeof e?"object"==typeof n?numeric.truncVV(e,n):numeric.truncVS(e,n):"object"==typeof n?numeric.truncSV(e,n):Math.round(e/n)*n},numeric.inv=function(e){var n,r,t,o,i,a,u,s=numeric.dim(e),c=Math.abs,f=s[0],l=s[1],m=numeric.clone(e),h=numeric.identity(f);for(a=0;a<l;++a){var p=-1,d=-1;for(i=a;i!==f;++i)(u=c(m[i][a]))>d&&(p=i,d=u);for(r=m[p],m[p]=m[a],m[a]=r,o=h[p],h[p]=h[a],h[a]=o,e=r[a],u=a;u!==l;++u)r[u]/=e;for(u=l-1;-1!==u;--u)o[u]/=e;for(i=f-1;-1!==i;--i)if(i!==a){for(n=m[i],t=h[i],e=n[a],u=a+1;u!==l;++u)n[u]-=r[u]*e;for(u=l-1;u>0;--u)t[u]-=o[u]*e,t[--u]-=o[u]*e;0===u&&(t[0]-=o[0]*e)}}return h},numeric.det=function(e){var n=numeric.dim(e);if(2!==n.length||n[0]!==n[1])throw new Error("numeric: det() only works on square matrices");var r,t,o,i,a,u,s,c,f=n[0],l=1,m=numeric.clone(e);for(t=0;t<f-1;t++){for(o=t,r=t+1;r<f;r++)Math.abs(m[r][t])>Math.abs(m[o][t])&&(o=r);for(o!==t&&(s=m[o],m[o]=m[t],m[t]=s,l*=-1),i=m[t],r=t+1;r<f;r++){for(u=(a=m[r])[t]/i[t],o=t+1;o<f-1;o+=2)c=o+1,a[o]-=i[o]*u,a[c]-=i[c]*u;o!==f&&(a[o]-=i[o]*u)}if(0===i[t])return 0;l*=i[t]}return l*m[t][t]},numeric.transpose=function(e){var n,r,t,o,i,a=e.length,u=e[0].length,s=Array(u);for(r=0;r<u;r++)s[r]=Array(a);for(n=a-1;n>=1;n-=2){for(o=e[n],t=e[n-1],r=u-1;r>=1;--r)(i=s[r])[n]=o[r],i[n-1]=t[r],(i=s[--r])[n]=o[r],i[n-1]=t[r];0===r&&((i=s[0])[n]=o[0],i[n-1]=t[0])}if(0===n){for(t=e[0],r=u-1;r>=1;--r)s[r][0]=t[r],s[--r][0]=t[r];0===r&&(s[0][0]=t[0])}return s},numeric.negtranspose=function(e){var n,r,t,o,i,a=e.length,u=e[0].length,s=Array(u);for(r=0;r<u;r++)s[r]=Array(a);for(n=a-1;n>=1;n-=2){for(o=e[n],t=e[n-1],r=u-1;r>=1;--r)(i=s[r])[n]=-o[r],i[n-1]=-t[r],(i=s[--r])[n]=-o[r],i[n-1]=-t[r];0===r&&((i=s[0])[n]=-o[0],i[n-1]=-t[0])}if(0===n){for(t=e[0],r=u-1;r>=1;--r)s[r][0]=-t[r],s[--r][0]=-t[r];0===r&&(s[0][0]=-t[0])}return s},numeric._random=function e(n,r){var t,o,i=n[r],a=Array(i);if(r===n.length-1){for(o=Math.random,t=i-1;t>=1;t-=2)a[t]=o(),a[t-1]=o();return 0===t&&(a[0]=o()),a}for(t=i-1;t>=0;t--)a[t]=e(n,r+1);return a},numeric.random=function(e){return numeric._random(e,0)},numeric.norm2=function(e){return Math.sqrt(numeric.norm2Squared(e))},numeric.linspace=function(e,n,r){if(void 0===r&&(r=Math.max(Math.round(n-e)+1,1)),r<2)return 1===r?[e]:[];var t,o=Array(r);for(t=--r;t>=0;t--)o[t]=(t*n+(r-t)*e)/r;return o},numeric.getBlock=function(e,n,r){var t=numeric.dim(e);return function e(o,i){var a,u=n[i],s=r[i]-u,c=Array(s);if(i===t.length-1){for(a=s;a>=0;a--)c[a]=o[a+u];return c}for(a=s;a>=0;a--)c[a]=e(o[a+u],i+1);return c}(e,0)},numeric.setBlock=function(e,n,r,t){var o=numeric.dim(e);return function e(t,i,a){var u,s=n[a],c=r[a]-s;if(a===o.length-1)for(u=c;u>=0;u--)t[u+s]=i[u];for(u=c;u>=0;u--)e(t[u+s],i[u],a+1)}(e,t,0),e},numeric.getRange=function(e,n,r){var t,o,i,a,u=n.length,s=r.length,c=Array(u);for(t=u-1;-1!==t;--t)for(c[t]=Array(s),i=c[t],a=e[n[t]],o=s-1;-1!==o;--o)i[o]=a[r[o]];return c},numeric.blockMatrix=function(e){var n=numeric.dim(e);if(n.length<4)return numeric.blockMatrix([e]);var r,t,o,i,a,u=n[0],s=n[1];for(r=0,t=0,o=0;o<u;++o)r+=e[o][0].length;for(i=0;i<s;++i)t+=e[0][i][0].length;var c=Array(r);for(o=0;o<r;++o)c[o]=Array(t);var f,l,m,h,p,d=0;for(o=0;o<u;++o){for(f=t,i=s-1;-1!==i;--i)for(f-=(a=e[o][i])[0].length,m=a.length-1;-1!==m;--m)for(p=a[m],l=c[d+m],h=p.length-1;-1!==h;--h)l[f+h]=p[h];d+=e[o][0].length}return c},numeric.tensor=function(e,n){if("number"==typeof e||"number"==typeof n)return numeric.mul(e,n);var r=numeric.dim(e),t=numeric.dim(n);if(1!==r.length||1!==t.length)throw new Error("numeric: tensor product is only defined for vectors");var o,i,a,u,s=r[0],c=t[0],f=Array(s);for(i=s-1;i>=0;i--){for(o=Array(c),u=e[i],a=c-1;a>=3;--a)o[a]=u*n[a],o[--a]=u*n[a],o[--a]=u*n[a],o[--a]=u*n[a];for(;a>=0;)o[a]=u*n[a],--a;f[i]=o}return f},numeric.T=function(e,n){this.x=e,this.y=n},numeric.t=function(e,n){return new numeric.T(e,n)},numeric.Tbinop=function(e,n,r,t,o){var i;if(numeric.indexOf,"string"!=typeof o)for(i in o="",numeric)numeric.hasOwnProperty(i)&&(e.indexOf(i)>=0||n.indexOf(i)>=0||r.indexOf(i)>=0||t.indexOf(i)>=0)&&i.length>1&&(o+="var "+i+" = numeric."+i+";\n");return Function(["y"],"var x = this;\nif(!(y instanceof numeric.T)) { y = new numeric.T(y); }\n"+o+"\nif(x.y) { if(y.y) { return new numeric.T("+t+");\n }\n return new numeric.T("+r+");\n}\nif(y.y) {\n return new numeric.T("+n+");\n}\nreturn new numeric.T("+e+");\n")},numeric.T.prototype.add=numeric.Tbinop("add(x.x,y.x)","add(x.x,y.x),y.y","add(x.x,y.x),x.y","add(x.x,y.x),add(x.y,y.y)"),numeric.T.prototype.sub=numeric.Tbinop("sub(x.x,y.x)","sub(x.x,y.x),neg(y.y)","sub(x.x,y.x),x.y","sub(x.x,y.x),sub(x.y,y.y)"),numeric.T.prototype.mul=numeric.Tbinop("mul(x.x,y.x)","mul(x.x,y.x),mul(x.x,y.y)","mul(x.x,y.x),mul(x.y,y.x)","sub(mul(x.x,y.x),mul(x.y,y.y)),add(mul(x.x,y.y),mul(x.y,y.x))"),numeric.T.prototype.reciprocal=function(){var e=numeric.mul,n=numeric.div;if(this.y){var r=numeric.add(e(this.x,this.x),e(this.y,this.y));return new numeric.T(n(this.x,r),n(numeric.neg(this.y),r))}return new T(n(1,this.x))},numeric.T.prototype.div=function(e){if(e instanceof numeric.T||(e=new numeric.T(e)),e.y)return this.mul(e.reciprocal());var n=numeric.div;return this.y?new numeric.T(n(this.x,e.x),n(this.y,e.x)):new numeric.T(n(this.x,e.x))},numeric.T.prototype.dot=numeric.Tbinop("dot(x.x,y.x)","dot(x.x,y.x),dot(x.x,y.y)","dot(x.x,y.x),dot(x.y,y.x)","sub(dot(x.x,y.x),dot(x.y,y.y)),add(dot(x.x,y.y),dot(x.y,y.x))"),numeric.T.prototype.transpose=function(){var e=numeric.transpose,n=this.x,r=this.y;return r?new numeric.T(e(n),e(r)):new numeric.T(e(n))},numeric.T.prototype.transjugate=function(){var e=numeric.transpose,n=this.x,r=this.y;return r?new numeric.T(e(n),numeric.negtranspose(r)):new numeric.T(e(n))},numeric.Tunop=function(e,n,r){return"string"!=typeof r&&(r=""),Function("var x = this;\n"+r+"\nif(x.y) { "+n+";\n}\n"+e+";\n")},numeric.T.prototype.exp=numeric.Tunop("return new numeric.T(ex)","return new numeric.T(mul(cos(x.y),ex),mul(sin(x.y),ex))","var ex = numeric.exp(x.x), cos = numeric.cos, sin = numeric.sin, mul = numeric.mul;"),numeric.T.prototype.conj=numeric.Tunop("return new numeric.T(x.x);","return new numeric.T(x.x,numeric.neg(x.y));"),numeric.T.prototype.neg=numeric.Tunop("return new numeric.T(neg(x.x));","return new numeric.T(neg(x.x),neg(x.y));","var neg = numeric.neg;"),numeric.T.prototype.sin=numeric.Tunop("return new numeric.T(numeric.sin(x.x))","return x.exp().sub(x.neg().exp()).div(new numeric.T(0,2));"),numeric.T.prototype.cos=numeric.Tunop("return new numeric.T(numeric.cos(x.x))","return x.exp().add(x.neg().exp()).div(2);"),numeric.T.prototype.abs=numeric.Tunop("return new numeric.T(numeric.abs(x.x));","return new numeric.T(numeric.sqrt(numeric.add(mul(x.x,x.x),mul(x.y,x.y))));","var mul = numeric.mul;"),numeric.T.prototype.log=numeric.Tunop("return new numeric.T(numeric.log(x.x));","var theta = new numeric.T(numeric.atan2(x.y,x.x)), r = x.abs();\nreturn new numeric.T(numeric.log(r.x),theta.x);"),numeric.T.prototype.norm2=numeric.Tunop("return numeric.norm2(x.x);","var f = numeric.norm2Squared;\nreturn Math.sqrt(f(x.x)+f(x.y));"),numeric.T.prototype.inv=function(){var e=this;if(void 0===e.y)return new numeric.T(numeric.inv(e.x));var n,r,t,o,i,a,u,s,c,f,l,m,h,p,d,y,g,x,v=e.x.length,w=numeric.identity(v),b=numeric.rep([v,v],0),T=numeric.clone(e.x),C=numeric.clone(e.y);for(c=0;c<v;c++){for(m=(p=T[c][c])*p+(d=C[c][c])*d,l=c,f=c+1;f<v;f++)(h=(p=T[f][c])*p+(d=C[f][c])*d)>m&&(l=f,m=h);for(l!==c&&(x=T[c],T[c]=T[l],T[l]=x,x=C[c],C[c]=C[l],C[l]=x,x=w[c],w[c]=w[l],w[l]=x,x=b[c],b[c]=b[l],b[l]=x),n=T[c],r=C[c],i=w[c],a=b[c],p=n[c],d=r[c],f=c+1;f<v;f++)y=n[f],g=r[f],n[f]=(y*p+g*d)/m,r[f]=(g*p-y*d)/m;for(f=0;f<v;f++)y=i[f],g=a[f],i[f]=(y*p+g*d)/m,a[f]=(g*p-y*d)/m;for(f=c+1;f<v;f++){for(t=T[f],o=C[f],u=w[f],s=b[f],p=t[c],d=o[c],l=c+1;l<v;l++)y=n[l],g=r[l],t[l]-=y*p-g*d,o[l]-=g*p+y*d;for(l=0;l<v;l++)y=i[l],g=a[l],u[l]-=y*p-g*d,s[l]-=g*p+y*d}}for(c=v-1;c>0;c--)for(i=w[c],a=b[c],f=c-1;f>=0;f--)for(u=w[f],s=b[f],p=T[f][c],d=C[f][c],l=v-1;l>=0;l--)y=i[l],g=a[l],u[l]-=p*y-d*g,s[l]-=p*g+d*y;return new numeric.T(w,b)},numeric.T.prototype.get=function(e){var n,r=this.x,t=this.y,o=0,i=e.length;if(t){for(;o<i;)r=r[n=e[o]],t=t[n],o++;return new numeric.T(r,t)}for(;o<i;)r=r[n=e[o]],o++;return new numeric.T(r)},numeric.T.prototype.set=function(e,n){var r,t=this.x,o=this.y,i=0,a=e.length,u=n.x,s=n.y;if(0===a)return s?this.y=s:o&&(this.y=void 0),this.x=t,this;if(s){for(o||(o=numeric.rep(numeric.dim(t),0),this.y=o);i<a-1;)t=t[r=e[i]],o=o[r],i++;return t[r=e[i]]=u,o[r]=s,this}if(o){for(;i<a-1;)t=t[r=e[i]],o=o[r],i++;return t[r=e[i]]=u,o[r]=u instanceof Array?numeric.rep(numeric.dim(u),0):0,this}for(;i<a-1;)t=t[r=e[i]],i++;return t[r=e[i]]=u,this},numeric.T.prototype.getRows=function(e,n){var r,t,o=n-e+1,i=Array(o),a=this.x,u=this.y;for(r=e;r<=n;r++)i[r-e]=a[r];if(u){for(t=Array(o),r=e;r<=n;r++)t[r-e]=u[r];return new numeric.T(i,t)}return new numeric.T(i)},numeric.T.prototype.setRows=function(e,n,r){var t,o=this.x,i=this.y,a=r.x,u=r.y;for(t=e;t<=n;t++)o[t]=a[t-e];if(u)for(i||(i=numeric.rep(numeric.dim(o),0),this.y=i),t=e;t<=n;t++)i[t]=u[t-e];else if(i)for(t=e;t<=n;t++)i[t]=numeric.rep([a[t-e].length],0);return this},numeric.T.prototype.getRow=function(e){var n=this.x,r=this.y;return r?new numeric.T(n[e],r[e]):new numeric.T(n[e])},numeric.T.prototype.setRow=function(e,n){var r=this.x,t=this.y,o=n.x,i=n.y;return r[e]=o,i?(t||(t=numeric.rep(numeric.dim(r),0),this.y=t),t[e]=i):t&&(t=numeric.rep([o.length],0)),this},numeric.T.prototype.getBlock=function(e,n){var r=this.x,t=this.y,o=numeric.getBlock;return t?new numeric.T(o(r,e,n),o(t,e,n)):new numeric.T(o(r,e,n))},numeric.T.prototype.setBlock=function(e,n,r){r instanceof numeric.T||(r=new numeric.T(r));var t=this.x,o=this.y,i=numeric.setBlock,a=r.x,u=r.y;if(u)return o||(this.y=numeric.rep(numeric.dim(this),0),o=this.y),i(t,e,n,a),i(o,e,n,u),this;i(t,e,n,a),o&&i(o,e,n,numeric.rep(numeric.dim(a),0))},numeric.T.rep=function(e,n){var r=numeric.T;n instanceof r||(n=new r(n));var t=n.x,o=n.y,i=numeric.rep;return o?new r(i(e,t),i(e,o)):new r(i(e,t))},numeric.T.diag=function(e){e instanceof numeric.T||(e=new numeric.T(e));var n=e.x,r=e.y,t=numeric.diag;return r?new numeric.T(t(n),t(r)):new numeric.T(t(n))},numeric.T.eig=function(){if(this.y)throw new Error("eig: not implemented for complex matrices.");return numeric.eig(this.x)},numeric.T.identity=function(e){return new numeric.T(numeric.identity(e))},numeric.T.prototype.getDiag=function(){var e=numeric,n=this.x,r=this.y;return r?new e.T(e.getDiag(n),e.getDiag(r)):new e.T(e.getDiag(n))},numeric.house=function(e){var n=numeric.clone(e),r=(e[0]>=0?1:-1)*numeric.norm2(e);n[0]+=r;var t=numeric.norm2(n);if(0===t)throw new Error("eig: internal error");return numeric.div(n,t)},numeric.toUpperHessenberg=function(e){var n=numeric.dim(e);if(2!==n.length||n[0]!==n[1])throw new Error("numeric: toUpperHessenberg() only works on square matrices");var r,t,o,i,a,u,s,c,f,l,m=n[0],h=numeric.clone(e),p=numeric.identity(m);for(t=0;t<m-2;t++){for(i=Array(m-t-1),r=t+1;r<m;r++)i[r-t-1]=h[r][t];if(numeric.norm2(i)>0){for(a=numeric.house(i),u=numeric.getBlock(h,[t+1,t],[m-1,m-1]),s=numeric.tensor(a,numeric.dot(a,u)),r=t+1;r<m;r++)for(c=h[r],f=s[r-t-1],o=t;o<m;o++)c[o]-=2*f[o-t];for(u=numeric.getBlock(h,[0,t+1],[m-1,m-1]),s=numeric.tensor(numeric.dot(u,a),a),r=0;r<m;r++)for(c=h[r],f=s[r],o=t+1;o<m;o++)c[o]-=2*f[o-t-1];for(u=Array(m-t-1),r=t+1;r<m;r++)u[r-t-1]=p[r];for(s=numeric.tensor(a,numeric.dot(a,u)),r=t+1;r<m;r++)for(l=p[r],f=s[r-t-1],o=0;o<m;o++)l[o]-=2*f[o]}}return{H:h,Q:p}},numeric.epsilon=2220446049250313e-31,numeric.QRFrancis=function(e,n){void 0===n&&(n=1e4),e=numeric.clone(e),numeric.clone(e);var r,t,o,i,a,u,s,c,f,l,m,h,p,d,y,g,x,v,w=numeric.dim(e)[0],b=numeric.identity(w);if(w<3)return{Q:b,B:[[0,w-1]]};var T=numeric.epsilon;for(v=0;v<n;v++){for(g=0;g<w-1;g++)if(Math.abs(e[g+1][g])<T*(Math.abs(e[g][g])+Math.abs(e[g+1][g+1]))){var C=numeric.QRFrancis(numeric.getBlock(e,[0,0],[g,g]),n),_=numeric.QRFrancis(numeric.getBlock(e,[g+1,g+1],[w-1,w-1]),n);for(h=Array(g+1),y=0;y<=g;y++)h[y]=b[y];for(p=numeric.dot(C.Q,h),y=0;y<=g;y++)b[y]=p[y];for(h=Array(w-g-1),y=g+1;y<w;y++)h[y-g-1]=b[y];for(p=numeric.dot(_.Q,h),y=g+1;y<w;y++)b[y]=p[y-g-1];return{Q:b,B:C.B.concat(numeric.add(_.B,g+1))}}var A,k,M;for(o=e[w-2][w-2],i=e[w-2][w-1],a=e[w-1][w-2],c=o+(u=e[w-1][w-1]),s=o*u-i*a,f=numeric.getBlock(e,[0,0],[2,2]),c*c>=4*s?(A=.5*(c+Math.sqrt(c*c-4*s)),k=.5*(c-Math.sqrt(c*c-4*s)),f=numeric.add(numeric.sub(numeric.dot(f,f),numeric.mul(f,A+k)),numeric.diag(numeric.rep([3],A*k)))):f=numeric.add(numeric.sub(numeric.dot(f,f),numeric.mul(f,c)),numeric.diag(numeric.rep([3],s))),r=[f[0][0],f[1][0],f[2][0]],t=numeric.house(r),h=[e[0],e[1],e[2]],p=numeric.tensor(t,numeric.dot(t,h)),y=0;y<3;y++)for(m=e[y],d=p[y],x=0;x<w;x++)m[x]-=2*d[x];for(h=numeric.getBlock(e,[0,0],[w-1,2]),p=numeric.tensor(numeric.dot(h,t),t),y=0;y<w;y++)for(m=e[y],d=p[y],x=0;x<3;x++)m[x]-=2*d[x];for(h=[b[0],b[1],b[2]],p=numeric.tensor(t,numeric.dot(t,h)),y=0;y<3;y++)for(l=b[y],d=p[y],x=0;x<w;x++)l[x]-=2*d[x];for(g=0;g<w-2;g++){for(x=g;x<=g+1;x++)if(Math.abs(e[x+1][x])<T*(Math.abs(e[x][x])+Math.abs(e[x+1][x+1]))){for(C=numeric.QRFrancis(numeric.getBlock(e,[0,0],[x,x]),n),_=numeric.QRFrancis(numeric.getBlock(e,[x+1,x+1],[w-1,w-1]),n),h=Array(x+1),y=0;y<=x;y++)h[y]=b[y];for(p=numeric.dot(C.Q,h),y=0;y<=x;y++)b[y]=p[y];for(h=Array(w-x-1),y=x+1;y<w;y++)h[y-x-1]=b[y];for(p=numeric.dot(_.Q,h),y=x+1;y<w;y++)b[y]=p[y-x-1];return{Q:b,B:C.B.concat(numeric.add(_.B,x+1))}}for(M=Math.min(w-1,g+3),r=Array(M-g),y=g+1;y<=M;y++)r[y-g-1]=e[y][g];for(t=numeric.house(r),h=numeric.getBlock(e,[g+1,g],[M,w-1]),p=numeric.tensor(t,numeric.dot(t,h)),y=g+1;y<=M;y++)for(m=e[y],d=p[y-g-1],x=g;x<w;x++)m[x]-=2*d[x-g];for(h=numeric.getBlock(e,[0,g+1],[w-1,M]),p=numeric.tensor(numeric.dot(h,t),t),y=0;y<w;y++)for(m=e[y],d=p[y],x=g+1;x<=M;x++)m[x]-=2*d[x-g-1];for(h=Array(M-g),y=g+1;y<=M;y++)h[y-g-1]=b[y];for(p=numeric.tensor(t,numeric.dot(t,h)),y=g+1;y<=M;y++)for(l=b[y],d=p[y-g-1],x=0;x<w;x++)l[x]-=2*d[x]}}throw new Error("numeric: eigenvalue iteration does not converge -- increase maxiter?")},numeric.eig=function(e,n){var r,t,o,i,a,u,s,c,f,l,m,h,p,d,y,g,x=numeric.toUpperHessenberg(e),v=numeric.QRFrancis(x.H,n),w=numeric.T,b=e.length,T=v.B,C=numeric.dot(v.Q,numeric.dot(x.H,numeric.transpose(v.Q))),_=new w(numeric.dot(v.Q,x.Q)),A=T.length,k=Math.sqrt;for(t=0;t<A;t++)if((r=T[t][0])!==T[t][1]){if(i=r+1,a=C[r][r],u=C[r][i],s=C[i][r],c=C[i][i],0===u&&0===s)continue;(l=(f=-a-c)*f-4*(a*c-u*s))>=0?((y=(a-(m=f<0?-.5*(f-k(l)):-.5*(f+k(l))))*(a-m)+u*u)>(g=s*s+(c-m)*(c-m))?(p=(a-m)/(y=k(y)),d=u/y):(p=s/(g=k(g)),d=(c-m)/g),o=new w([[d,-p],[p,d]]),_.setRows(r,i,o.dot(_.getRows(r,i)))):(m=-.5*f,h=.5*k(-l),(y=(a-m)*(a-m)+u*u)>(g=s*s+(c-m)*(c-m))?(p=(a-m)/(y=k(y+h*h)),d=u/y,m=0,h/=y):(p=s/(g=k(g+h*h)),d=(c-m)/g,m=h/g,h=0),o=new w([[d,-p],[p,d]],[[m,h],[h,-m]]),_.setRows(r,i,o.dot(_.getRows(r,i))))}var M=_.dot(e).dot(_.transjugate()),S=(b=e.length,numeric.T.identity(b));for(i=0;i<b;i++)if(i>0)for(t=i-1;t>=0;t--){var N=M.get([t,t]),P=M.get([i,i]);numeric.neq(N.x,P.x)||numeric.neq(N.y,P.y)?(m=M.getRow(t).getBlock([t],[i-1]),h=S.getRow(i).getBlock([t],[i-1]),S.set([i,t],M.get([t,i]).neg().sub(m.dot(h)).div(N.sub(P)))):S.setRow(i,S.getRow(t))}for(i=0;i<b;i++)m=S.getRow(i),S.setRow(i,m.div(m.norm2()));return S=S.transpose(),S=_.transjugate().dot(S),{lambda:M.getDiag(),E:S}},numeric.ccsSparse=function(e){var n,r,t,o=e.length,i=[];for(r=o-1;-1!==r;--r)for(t in n=e[r]){for(t=parseInt(t);t>=i.length;)i[i.length]=0;0!==n[t]&&i[t]++}var a=i.length,u=Array(a+1);for(u[0]=0,r=0;r<a;++r)u[r+1]=u[r]+i[r];var s=Array(u[a]),c=Array(u[a]);for(r=o-1;-1!==r;--r)for(t in n=e[r])0!==n[t]&&(i[t]--,s[u[t]+i[t]]=r,c[u[t]+i[t]]=n[t]);return[u,s,c]},numeric.ccsFull=function(e){var n,r,t,o,i=e[0],a=e[1],u=e[2],s=numeric.ccsDim(e),c=s[0],f=s[1],l=numeric.rep([c,f],0);for(n=0;n<f;n++)for(t=i[n],o=i[n+1],r=t;r<o;++r)l[a[r]][n]=u[r];return l},numeric.ccsTSolve=function(e,n,r,t,o){function i(e){var n;if(0===r[e]){for(r[e]=1,n=h[e];n<h[e+1];++n)i(p[n]);o[x]=e,++x}}var a,u,s,c,f,l,m,h=e[0],p=e[1],d=e[2],y=h.length-1,g=Math.max,x=0;for(void 0===t&&(r=numeric.rep([y],0)),void 0===t&&(t=numeric.linspace(0,r.length-1)),void 0===o&&(o=[]),a=t.length-1;-1!==a;--a)i(t[a]);for(o.length=x,a=o.length-1;-1!==a;--a)r[o[a]]=0;for(a=t.length-1;-1!==a;--a)u=t[a],r[u]=n[u];for(a=o.length-1;-1!==a;--a){for(u=o[a],s=h[u],c=g(h[u+1],s),f=s;f!==c;++f)if(p[f]===u){r[u]/=d[f];break}for(m=r[u],f=s;f!==c;++f)(l=p[f])!==u&&(r[l]-=m*d[f])}return r},numeric.ccsDFS=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS.prototype.dfs=function(e,n,r,t,o,i){var a,u,s,c=0,f=o.length,l=this.k,m=this.k1,h=this.j;if(0===t[e])for(t[e]=1,h[0]=e,l[0]=u=n[e],m[0]=s=n[e+1];;)if(u>=s){if(o[f]=h[c],0===c)return;++f,u=l[--c],s=m[c]}else 0===t[a=i[r[u]]]?(t[a]=1,l[c]=u,h[++c]=a,u=n[a],m[c]=s=n[a+1]):++u},numeric.ccsLPSolve=function(e,n,r,t,o,i,a){var u,s,c,f,l,m,h,p,d,y=e[0],g=e[1],x=e[2],v=(y.length,n[0]),w=n[1],b=n[2];for(s=v[o],c=v[o+1],t.length=0,u=s;u<c;++u)a.dfs(i[w[u]],y,g,r,t,i);for(u=t.length-1;-1!==u;--u)r[t[u]]=0;for(u=s;u!==c;++u)r[f=i[w[u]]]=b[u];for(u=t.length-1;-1!==u;--u){for(l=y[f=t[u]],m=y[f+1],h=l;h<m;++h)if(i[g[h]]===f){r[f]/=x[h];break}for(d=r[f],h=l;h<m;++h)(p=i[g[h]])!==f&&(r[p]-=d*x[h])}return r},numeric.ccsLUP1=function(e,n){var r,t,o,i,a,u,s,c=e[0].length-1,f=[numeric.rep([c+1],0),[],[]],l=[numeric.rep([c+1],0),[],[]],m=f[0],h=f[1],p=f[2],d=l[0],y=l[1],g=l[2],x=numeric.rep([c],0),v=numeric.rep([c],0),w=numeric.ccsLPSolve,b=(Math.max,Math.abs),T=numeric.linspace(0,c-1),C=numeric.linspace(0,c-1),_=new numeric.ccsDFS(c);for(void 0===n&&(n=1),r=0;r<c;++r){for(w(f,e,x,v,r,C,_),i=-1,a=-1,t=v.length-1;-1!==t;--t)(o=v[t])<=r||(u=b(x[o]))>i&&(a=o,i=u);for(b(x[r])<n*i&&(t=T[r],i=T[a],T[r]=i,C[i]=r,T[a]=t,C[t]=a,i=x[r],x[r]=x[a],x[a]=i),i=m[r],a=d[r],s=x[r],h[i]=T[r],p[i]=1,++i,t=v.length-1;-1!==t;--t)u=x[o=v[t]],v[t]=0,x[o]=0,o<=r?(y[a]=o,g[a]=u,++a):(h[i]=T[o],p[i]=u/s,++i);m[r+1]=i,d[r+1]=a}for(t=h.length-1;-1!==t;--t)h[t]=C[h[t]];return{L:f,U:l,P:T,Pinv:C}},numeric.ccsDFS0=function(e){this.k=Array(e),this.k1=Array(e),this.j=Array(e)},numeric.ccsDFS0.prototype.dfs=function(e,n,r,t,o,i,a){var u,s,c,f=0,l=o.length,m=this.k,h=this.k1,p=this.j;if(0===t[e])for(t[e]=1,p[0]=e,m[0]=s=n[i[e]],h[0]=c=n[i[e]+1];;){if(isNaN(s))throw new Error("Ow!");if(s>=c){if(o[l]=i[p[f]],0===f)return;++l,s=m[--f],c=h[f]}else 0===t[u=r[s]]?(t[u]=1,m[f]=s,p[++f]=u,s=n[u=i[u]],h[f]=c=n[u+1]):++s}},numeric.ccsLPSolve0=function(e,n,r,t,o,i,a,u){var s,c,f,l,m,h,p,d,y,g=e[0],x=e[1],v=e[2],w=(g.length,n[0]),b=n[1],T=n[2];for(c=w[o],f=w[o+1],t.length=0,s=c;s<f;++s)u.dfs(b[s],g,x,r,t,i,a);for(s=t.length-1;-1!==s;--s)r[a[l=t[s]]]=0;for(s=c;s!==f;++s)r[l=b[s]]=T[s];for(s=t.length-1;-1!==s;--s){for(d=a[l=t[s]],m=g[l],h=g[l+1],p=m;p<h;++p)if(x[p]===d){r[d]/=v[p];break}for(y=r[d],p=m;p<h;++p)r[x[p]]-=y*v[p];r[d]=y}},numeric.ccsLUP0=function(e,n){var r,t,o,i,a,u,s,c=e[0].length-1,f=[numeric.rep([c+1],0),[],[]],l=[numeric.rep([c+1],0),[],[]],m=f[0],h=f[1],p=f[2],d=l[0],y=l[1],g=l[2],x=numeric.rep([c],0),v=numeric.rep([c],0),w=numeric.ccsLPSolve0,b=(Math.max,Math.abs),T=numeric.linspace(0,c-1),C=numeric.linspace(0,c-1),_=new numeric.ccsDFS0(c);for(void 0===n&&(n=1),r=0;r<c;++r){for(w(f,e,x,v,r,C,T,_),i=-1,a=-1,t=v.length-1;-1!==t;--t)(o=v[t])<=r||(u=b(x[T[o]]))>i&&(a=o,i=u);for(b(x[T[r]])<n*i&&(t=T[r],i=T[a],T[r]=i,C[i]=r,T[a]=t,C[t]=a),i=m[r],a=d[r],s=x[T[r]],h[i]=T[r],p[i]=1,++i,t=v.length-1;-1!==t;--t)u=x[T[o=v[t]]],v[t]=0,x[T[o]]=0,o<=r?(y[a]=o,g[a]=u,++a):(h[i]=T[o],p[i]=u/s,++i);m[r+1]=i,d[r+1]=a}for(t=h.length-1;-1!==t;--t)h[t]=C[h[t]];return{L:f,U:l,P:T,Pinv:C}},numeric.ccsLUP=numeric.ccsLUP0,numeric.ccsDim=function(e){return[numeric.sup(e[1])+1,e[0].length-1]},numeric.ccsGetBlock=function(e,n,r){var t=numeric.ccsDim(e),o=t[0],i=t[1];void 0===n?n=numeric.linspace(0,o-1):"number"==typeof n&&(n=[n]),void 0===r?r=numeric.linspace(0,i-1):"number"==typeof r&&(r=[r]);var a,u,s,c,f=n.length,l=r.length,m=numeric.rep([i],0),h=[],p=[],d=[m,h,p],y=e[0],g=e[1],x=e[2],v=numeric.rep([o],0),w=0,b=numeric.rep([o],0);for(u=0;u<l;++u){var T=y[c=r[u]],C=y[c+1];for(a=T;a<C;++a)b[s=g[a]]=1,v[s]=x[a];for(a=0;a<f;++a)b[n[a]]&&(h[w]=a,p[w]=v[n[a]],++w);for(a=T;a<C;++a)b[s=g[a]]=0;m[u+1]=w}return d},numeric.ccsDot=function(e,n){var r,t,o,i,a,u,s,c,f,l,m,h=e[0],p=e[1],d=e[2],y=n[0],g=n[1],x=n[2],v=numeric.ccsDim(e),w=numeric.ccsDim(n),b=v[0],T=(v[1],w[1]),C=numeric.rep([b],0),_=numeric.rep([b],0),A=Array(b),k=numeric.rep([T],0),M=[],S=[],N=[k,M,S];for(o=0;o!==T;++o){for(i=y[o],a=y[o+1],f=0,t=i;t<a;++t)for(l=g[t],m=x[t],u=h[l],s=h[l+1],r=u;r<s;++r)0===_[c=p[r]]&&(A[f]=c,_[c]=1,f+=1),C[c]=C[c]+d[r]*m;for(a=(i=k[o])+f,k[o+1]=a,t=f-1;-1!==t;--t)m=i+t,r=A[t],M[m]=r,S[m]=C[r],_[r]=0,C[r]=0;k[o+1]=k[o]+f}return N},numeric.ccsLUPSolve=function(e,n){var r=e.L,t=e.U,o=(e.P,n[0]),i=!1;"object"!=typeof o&&(o=(n=[[0,n.length],numeric.linspace(0,n.length-1),n])[0],i=!0);var a,u,s,c,f,l,m=n[1],h=n[2],p=r[0].length-1,d=o.length-1,y=numeric.rep([p],0),g=Array(p),x=numeric.rep([p],0),v=Array(p),w=numeric.rep([d+1],0),b=[],T=[],C=numeric.ccsTSolve,_=0;for(a=0;a<d;++a){for(f=0,s=o[a],c=o[a+1],u=s;u<c;++u)l=e.Pinv[m[u]],v[f]=l,x[l]=h[u],++f;for(v.length=f,C(r,x,y,v,g),u=v.length-1;-1!==u;--u)x[v[u]]=0;if(C(t,y,x,g,v),i)return x;for(u=g.length-1;-1!==u;--u)y[g[u]]=0;for(u=v.length-1;-1!==u;--u)l=v[u],b[_]=l,T[_]=x[l],x[l]=0,++_;w[a+1]=_}return[w,b,T]},numeric.ccsbinop=function(e,n){return void 0===n&&(n=""),Function("X","Y","var Xi = X[0], Xj = X[1], Xv = X[2];\nvar Yi = Y[0], Yj = Y[1], Yv = Y[2];\nvar n = Xi.length-1,m = Math.max(numeric.sup(Xj),numeric.sup(Yj))+1;\nvar Zi = numeric.rep([n+1],0), Zj = [], Zv = [];\nvar x = numeric.rep([m],0),y = numeric.rep([m],0);\nvar xk,yk,zk;\nvar i,j,j0,j1,k,p=0;\n"+n+"for(i=0;i<n;++i) {\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Xj[j];\n x[k] = 1;\n Zj[p] = k;\n ++p;\n }\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Yj[j];\n y[k] = Yv[j];\n if(x[k] === 0) {\n Zj[p] = k;\n ++p;\n }\n }\n Zi[i+1] = p;\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = Xv[j];\n j0 = Zi[i]; j1 = Zi[i+1];\n for(j=j0;j!==j1;++j) {\n k = Zj[j];\n xk = x[k];\n yk = y[k];\n"+e+"\n Zv[j] = zk;\n }\n j0 = Xi[i]; j1 = Xi[i+1];\n for(j=j0;j!==j1;++j) x[Xj[j]] = 0;\n j0 = Yi[i]; j1 = Yi[i+1];\n for(j=j0;j!==j1;++j) y[Yj[j]] = 0;\n}\nreturn [Zi,Zj,Zv];")},function(){var k,A,B,C;for(k in numeric.ops2)A=isFinite(eval("1"+numeric.ops2[k]+"0"))?"[Y[0],Y[1],numeric."+k+"(X,Y[2])]":"NaN",B=isFinite(eval("0"+numeric.ops2[k]+"1"))?"[X[0],X[1],numeric."+k+"(X[2],Y)]":"NaN",C=isFinite(eval("1"+numeric.ops2[k]+"0"))&&isFinite(eval("0"+numeric.ops2[k]+"1"))?"numeric.ccs"+k+"MM(X,Y)":"NaN",numeric["ccs"+k+"MM"]=numeric.ccsbinop("zk = xk "+numeric.ops2[k]+"yk;"),numeric["ccs"+k]=Function("X","Y",'if(typeof X === "number") return '+A+';\nif(typeof Y === "number") return '+B+";\nreturn "+C+";\n")}(),numeric.ccsScatter=function(e){var n,r=e[0],t=e[1],o=e[2],i=numeric.sup(t)+1,a=r.length,u=numeric.rep([i],0),s=Array(a),c=Array(a),f=numeric.rep([i],0);for(n=0;n<a;++n)f[t[n]]++;for(n=0;n<i;++n)u[n+1]=u[n]+f[n];var l,m,h=u.slice(0);for(n=0;n<a;++n)s[l=h[m=t[n]]]=r[n],c[l]=o[n],h[m]=h[m]+1;return[u,s,c]},numeric.ccsGather=function(e){var n,r,t,o,i,a=e[0],u=e[1],s=e[2],c=a.length-1,f=u.length,l=Array(f),m=Array(f),h=Array(f);for(i=0,n=0;n<c;++n)for(t=a[n],o=a[n+1],r=t;r!==o;++r)m[i]=n,l[i]=u[r],h[i]=s[r],++i;return[l,m,h]},numeric.sdim=function e(n,r,t){if(void 0===r&&(r=[]),"object"!=typeof n)return r;var o;for(o in void 0===t&&(t=0),t in r||(r[t]=0),n.length>r[t]&&(r[t]=n.length),n)n.hasOwnProperty(o)&&e(n[o],r,t+1);return r},numeric.sclone=function e(n,r,t){void 0===r&&(r=0),void 0===t&&(t=numeric.sdim(n).length);var o,i=Array(n.length);if(r===t-1){for(o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);return i}for(o in n)n.hasOwnProperty(o)&&(i[o]=e(n[o],r+1,t));return i},numeric.sdiag=function(e){var n,r,t=e.length,o=Array(t);for(n=t-1;n>=1;n-=2)r=n-1,o[n]=[],o[n][n]=e[n],o[r]=[],o[r][r]=e[r];return 0===n&&(o[0]=[],o[0][0]=e[n]),o},numeric.sidentity=function(e){return numeric.sdiag(numeric.rep([e],1))},numeric.stranspose=function(e){var n,r,t,o=[];for(n in e.length,e)if(e.hasOwnProperty(n))for(r in t=e[n])t.hasOwnProperty(r)&&("object"!=typeof o[r]&&(o[r]=[]),o[r][n]=t[r]);return o},numeric.sLUP=function(e,n){throw new Error("The function numeric.sLUP had a bug in it and has been removed. Please use the new numeric.ccsLUP function instead.")},numeric.sdotMM=function(e,n){var r,t,o,i,a,u,s,c=e.length,f=(n.length,numeric.stranspose(n)),l=f.length,m=Array(c);for(o=c-1;o>=0;o--){for(s=[],r=e[o],a=l-1;a>=0;a--){for(i in u=0,t=f[a],r)r.hasOwnProperty(i)&&i in t&&(u+=r[i]*t[i]);u&&(s[a]=u)}m[o]=s}return m},numeric.sdotMV=function(e,n){var r,t,o,i,a=e.length,u=Array(a);for(t=a-1;t>=0;t--){for(o in i=0,r=e[t])r.hasOwnProperty(o)&&n[o]&&(i+=r[o]*n[o]);i&&(u[t]=i)}return u},numeric.sdotVM=function(e,n){var r,t,o,i,a=[];for(r in e)if(e.hasOwnProperty(r))for(t in o=n[r],i=e[r],o)o.hasOwnProperty(t)&&(a[t]||(a[t]=0),a[t]+=i*o[t]);return a},numeric.sdotVV=function(e,n){var r,t=0;for(r in e)e[r]&&n[r]&&(t+=e[r]*n[r]);return t},numeric.sdot=function(e,n){var r=numeric.sdim(e).length,t=numeric.sdim(n).length;switch(1e3*r+t){case 0:return e*n;case 1001:return numeric.sdotVV(e,n);case 2001:return numeric.sdotMV(e,n);case 1002:return numeric.sdotVM(e,n);case 2002:return numeric.sdotMM(e,n);default:throw new Error("numeric.sdot not implemented for tensors of order "+r+" and "+t)}},numeric.sscatter=function(e){var n,r,t,o,i=e[0].length,a=e.length,u=[];for(r=i-1;r>=0;--r)if(e[a-1][r]){for(o=u,t=0;t<a-2;t++)o[n=e[t][r]]||(o[n]=[]),o=o[n];o[e[t][r]]=e[t+1][r]}return u},numeric.sgather=function e(n,r,t){var o,i,a;for(i in void 0===r&&(r=[]),void 0===t&&(t=[]),o=t.length,n)if(n.hasOwnProperty(i))if(t[o]=parseInt(i),"number"==typeof(a=n[i])){if(a){if(0===r.length)for(i=o+1;i>=0;--i)r[i]=[];for(i=o;i>=0;--i)r[i].push(t[i]);r[o+1].push(a)}}else e(a,r,t);return t.length>o&&t.pop(),r},numeric.cLU=function(e){var n,r,t,o,i,a,u=e[0],s=e[1],c=e[2],f=u.length,l=0;for(n=0;n<f;n++)u[n]>l&&(l=u[n]);l++;var m,h=Array(l),p=Array(l),d=numeric.rep([l],1/0),y=numeric.rep([l],-1/0);for(t=0;t<f;t++)n=u[t],(r=s[t])<d[n]&&(d[n]=r),r>y[n]&&(y[n]=r);for(n=0;n<l-1;n++)y[n]>y[n+1]&&(y[n+1]=y[n]);for(n=l-1;n>=1;n--)d[n]<d[n-1]&&(d[n-1]=d[n]);for(n=0;n<l;n++)p[n]=numeric.rep([y[n]-d[n]+1],0),h[n]=numeric.rep([n-d[n]],0),d[n],y[n];for(t=0;t<f;t++)p[n=u[t]][s[t]-d[n]]=c[t];for(n=0;n<l-1;n++)for(o=n-d[n],v=p[n],r=n+1;d[r]<=n&&r<l;r++)if(i=n-d[r],a=y[n]-n,m=(w=p[r])[i]/v[o]){for(t=1;t<=a;t++)w[t+i]-=m*v[t+o];h[r][n-d[r]]=m}var g,x,v=[],w=[],b=[],T=[],C=[],_=[];for(f=0,g=0,n=0;n<l;n++){for(o=d[n],i=y[n],x=p[n],r=n;r<=i;r++)x[r-o]&&(v[f]=n,w[f]=r,b[f]=x[r-o],f++);for(x=h[n],r=o;r<n;r++)x[r-o]&&(T[g]=n,C[g]=r,_[g]=x[r-o],g++);T[g]=n,C[g]=n,_[g]=1,g++}return{U:[v,w,b],L:[T,C,_]}},numeric.cLUsolve=function(e,n){var r,t,o=e.L,i=e.U,a=numeric.clone(n),u=o[0],s=o[1],c=o[2],f=i[0],l=i[1],m=i[2],h=f.length,p=(u.length,a.length);for(t=0,r=0;r<p;r++){for(;s[t]<r;)a[r]-=c[t]*a[s[t]],t++;t++}for(t=h-1,r=p-1;r>=0;r--){for(;l[t]>r;)a[r]-=m[t]*a[l[t]],t--;a[r]/=m[t],t--}return a},numeric.cgrid=function(e,n){"number"==typeof e&&(e=[e,e]);var r,t,o,i=numeric.rep(e,-1);for("function"!=typeof n&&(n="L"===n?function(n,r){return n>=e[0]/2||r<e[1]/2}:function(e,n){return!0}),o=0,r=1;r<e[0]-1;r++)for(t=1;t<e[1]-1;t++)n(r,t)&&(i[r][t]=o,o++);return i},numeric.cdelsq=function(e){var n,r,t,o,i,a=[[-1,0],[0,-1],[0,1],[1,0]],u=numeric.dim(e),s=u[0],c=u[1],f=[],l=[],m=[];for(n=1;n<s-1;n++)for(r=1;r<c-1;r++)if(!(e[n][r]<0)){for(t=0;t<4;t++)o=n+a[t][0],i=r+a[t][1],e[o][i]<0||(f.push(e[n][r]),l.push(e[o][i]),m.push(-1));f.push(e[n][r]),l.push(e[n][r]),m.push(4)}return[f,l,m]},numeric.cdotMV=function(e,n){var r,t,o,i=e[0],a=e[1],u=e[2],s=i.length;for(o=0,t=0;t<s;t++)i[t]>o&&(o=i[t]);for(o++,r=numeric.rep([o],0),t=0;t<s;t++)r[i[t]]+=u[t]*n[a[t]];return r},numeric.Spline=function(e,n,r,t,o){this.x=e,this.yl=n,this.yr=r,this.kl=t,this.kr=o},numeric.Spline.prototype._at=function(e,n){var r,t,o,i=this.x,a=this.yl,u=this.yr,s=this.kl,c=this.kr,f=numeric.add,l=numeric.sub,m=numeric.mul;r=l(m(s[n],i[n+1]-i[n]),l(u[n+1],a[n])),t=f(m(c[n+1],i[n]-i[n+1]),l(u[n+1],a[n]));var h=(o=(e-i[n])/(i[n+1]-i[n]))*(1-o);return f(f(f(m(1-o,a[n]),m(o,u[n+1])),m(r,h*(1-o))),m(t,h*o))},numeric.Spline.prototype.at=function(e){if("number"==typeof e){var n,r,t,o=this.x,i=o.length,a=Math.floor;for(n=0,r=i-1;r-n>1;)o[t=a((n+r)/2)]<=e?n=t:r=t;return this._at(e,n)}i=e.length;var u,s=Array(i);for(u=i-1;-1!==u;--u)s[u]=this.at(e[u]);return s},numeric.Spline.prototype.diff=function(){var e,n,r,t=this.x,o=this.yl,i=this.yr,a=this.kl,u=this.kr,s=o.length,c=a,f=u,l=Array(s),m=Array(s),h=numeric.add,p=numeric.mul,d=numeric.div,y=numeric.sub;for(e=s-1;-1!==e;--e)n=t[e+1]-t[e],r=y(i[e+1],o[e]),l[e]=d(h(p(r,6),p(a[e],-4*n),p(u[e+1],-2*n)),n*n),m[e+1]=d(h(p(r,-6),p(a[e],2*n),p(u[e+1],4*n)),n*n);return new numeric.Spline(t,c,f,l,m)},numeric.Spline.prototype.roots=function(){var e=[],n=this.x,r=this.yl,t=this.yr,o=this.kl,i=this.kr;"number"==typeof r[0]&&(r=[r],t=[t],o=[o],i=[i]);var a,u,s,c,f,l,m,h,p,d,y,g,x,v,w,b,T,C,_,A,k,M,S,N,P=r.length,O=n.length-1,L=(e=Array(P),Math.sqrt);for(a=0;a!==P;++a){for(c=r[a],f=t[a],l=o[a],m=i[a],h=[],u=0;u!==O;u++){for(u>0&&f[u]*c[u]<0&&h.push(n[u]),b=n[u+1]-n[u],n[u],y=c[u],g=f[u+1],p=l[u]/b,x=(d=m[u+1]/b)+3*y+2*p-3*g,v=3*(d+p+2*(y-g)),(w=(N=p-d+3*(y-g))*N+12*d*y)<=0?T=(C=x/v)>n[u]&&C<n[u+1]?[n[u],C,n[u+1]]:[n[u],n[u+1]]:(C=(x-L(w))/v,_=(x+L(w))/v,T=[n[u]],C>n[u]&&C<n[u+1]&&T.push(C),_>n[u]&&_<n[u+1]&&T.push(_),T.push(n[u+1])),k=T[0],C=this._at(k,u),s=0;s<T.length-1;s++)if(M=T[s+1],_=this._at(M,u),0!==C)if(0===_||C*_>0)k=M,C=_;else{for(var E=0;!((S=(C*M-_*k)/(C-_))<=k||S>=M);)if((A=this._at(S,u))*_>0)M=S,_=A,-1===E&&(C*=.5),E=-1;else{if(!(A*C>0))break;k=S,C=A,1===E&&(_*=.5),E=1}h.push(S),k=T[s+1],C=this._at(k,u)}else h.push(k),k=M,C=_;0===_&&h.push(M)}e[a]=h}return"number"==typeof this.yl[0]?e[0]:e},numeric.spline=function(e,n,r,t){var o,i=e.length,a=[],u=[],s=[],c=numeric.sub,f=numeric.mul,l=numeric.add;for(o=i-2;o>=0;o--)u[o]=e[o+1]-e[o],s[o]=c(n[o+1],n[o]);"string"!=typeof r&&"string"!=typeof t||(r=t="periodic");var m=[[],[],[]];switch(typeof r){case"undefined":a[0]=f(3/(u[0]*u[0]),s[0]),m[0].push(0,0),m[1].push(0,1),m[2].push(2/u[0],1/u[0]);break;case"string":a[0]=l(f(3/(u[i-2]*u[i-2]),s[i-2]),f(3/(u[0]*u[0]),s[0])),m[0].push(0,0,0),m[1].push(i-2,0,1),m[2].push(1/u[i-2],2/u[i-2]+2/u[0],1/u[0]);break;default:a[0]=r,m[0].push(0),m[1].push(0),m[2].push(1)}for(o=1;o<i-1;o++)a[o]=l(f(3/(u[o-1]*u[o-1]),s[o-1]),f(3/(u[o]*u[o]),s[o])),m[0].push(o,o,o),m[1].push(o-1,o,o+1),m[2].push(1/u[o-1],2/u[o-1]+2/u[o],1/u[o]);switch(typeof t){case"undefined":a[i-1]=f(3/(u[i-2]*u[i-2]),s[i-2]),m[0].push(i-1,i-1),m[1].push(i-2,i-1),m[2].push(1/u[i-2],2/u[i-2]);break;case"string":m[1][m[1].length-1]=0;break;default:a[i-1]=t,m[0].push(i-1),m[1].push(i-1),m[2].push(1)}a="number"!=typeof a[0]?numeric.transpose(a):[a];var h=Array(a.length);if("string"==typeof r)for(o=h.length-1;-1!==o;--o)h[o]=numeric.ccsLUPSolve(numeric.ccsLUP(numeric.ccsScatter(m)),a[o]),h[o][i-1]=h[o][0];else for(o=h.length-1;-1!==o;--o)h[o]=numeric.cLUsolve(numeric.cLU(m),a[o]);return h="number"==typeof n[0]?h[0]:numeric.transpose(h),new numeric.Spline(e,n,n,h,h)},numeric.fftpow2=function e(n,r){var t=n.length;if(1!==t){var o,i,a=Math.cos,u=Math.sin,s=Array(t/2),c=Array(t/2),f=Array(t/2),l=Array(t/2);for(i=t/2,o=t-1;-1!==o;--o)f[--i]=n[o],l[i]=r[o],--o,s[i]=n[o],c[i]=r[o];e(s,c),e(f,l),i=t/2;var m,h,p,d=-6.283185307179586/t;for(o=t-1;-1!==o;--o)-1==--i&&(i=t/2-1),h=a(m=d*o),p=u(m),n[o]=s[i]+h*f[i]-p*l[i],r[o]=c[i]+h*l[i]+p*f[i]}},numeric._ifftpow2=function e(n,r){var t=n.length;if(1!==t){var o,i,a=Math.cos,u=Math.sin,s=Array(t/2),c=Array(t/2),f=Array(t/2),l=Array(t/2);for(i=t/2,o=t-1;-1!==o;--o)f[--i]=n[o],l[i]=r[o],--o,s[i]=n[o],c[i]=r[o];e(s,c),e(f,l),i=t/2;var m,h,p,d=6.283185307179586/t;for(o=t-1;-1!==o;--o)-1==--i&&(i=t/2-1),h=a(m=d*o),p=u(m),n[o]=s[i]+h*f[i]-p*l[i],r[o]=c[i]+h*l[i]+p*f[i]}},numeric.ifftpow2=function(e,n){numeric._ifftpow2(e,n),numeric.diveq(e,e.length),numeric.diveq(n,n.length)},numeric.convpow2=function(e,n,r,t){var o,i,a,u,s;for(numeric.fftpow2(e,n),numeric.fftpow2(r,t),o=e.length-1;-1!==o;--o)i=e[o],u=n[o],a=r[o],s=t[o],e[o]=i*a-u*s,n[o]=i*s+u*a;numeric.ifftpow2(e,n)},numeric.T.prototype.fft=function(){var e,n,r=this.x,t=this.y,o=r.length,i=Math.log,a=i(2),u=Math.ceil(i(2*o-1)/a),s=Math.pow(2,u),c=numeric.rep([s],0),f=numeric.rep([s],0),l=Math.cos,m=Math.sin,h=-3.141592653589793/o,p=numeric.rep([s],0),d=numeric.rep([s],0);for(Math.floor(o/2),e=0;e<o;e++)p[e]=r[e];if(void 0!==t)for(e=0;e<o;e++)d[e]=t[e];for(c[0]=1,e=1;e<=s/2;e++)n=h*e*e,c[e]=l(n),f[e]=m(n),c[s-e]=l(n),f[s-e]=m(n);var y=new numeric.T(p,d),g=new numeric.T(c,f);return y=y.mul(g),numeric.convpow2(y.x,y.y,numeric.clone(g.x),numeric.neg(g.y)),(y=y.mul(g)).x.length=o,y.y.length=o,y},numeric.T.prototype.ifft=function(){var e,n,r=this.x,t=this.y,o=r.length,i=Math.log,a=i(2),u=Math.ceil(i(2*o-1)/a),s=Math.pow(2,u),c=numeric.rep([s],0),f=numeric.rep([s],0),l=Math.cos,m=Math.sin,h=3.141592653589793/o,p=numeric.rep([s],0),d=numeric.rep([s],0);for(Math.floor(o/2),e=0;e<o;e++)p[e]=r[e];if(void 0!==t)for(e=0;e<o;e++)d[e]=t[e];for(c[0]=1,e=1;e<=s/2;e++)n=h*e*e,c[e]=l(n),f[e]=m(n),c[s-e]=l(n),f[s-e]=m(n);var y=new numeric.T(p,d),g=new numeric.T(c,f);return y=y.mul(g),numeric.convpow2(y.x,y.y,numeric.clone(g.x),numeric.neg(g.y)),(y=y.mul(g)).x.length=o,y.y.length=o,y.div(o)},numeric.gradient=function(e,n){var r=n.length,t=e(n);if(isNaN(t))throw new Error("gradient: f(x) is a NaN!");var o,i,a,u,s,c,f,l,m,h=Math.max,p=numeric.clone(n),d=Array(r),y=(numeric.div,numeric.sub,h=Math.max,Math.abs),g=Math.min,x=0;for(o=0;o<r;o++)for(var v=h(1e-6*t,1e-8);;){if(++x>20)throw new Error("Numerical gradient fails");if(p[o]=n[o]+v,i=e(p),p[o]=n[o]-v,a=e(p),p[o]=n[o],isNaN(i)||isNaN(a))v/=16;else{if(d[o]=(i-a)/(2*v),u=n[o]-v,s=n[o],c=n[o]+v,f=(i-t)/v,l=(t-a)/v,m=h(y(d[o]),y(t),y(i),y(a),y(u),y(s),y(c),1e-8),!(g(h(y(f-d[o]),y(l-d[o]),y(f-l))/m,v/m)>.001))break;v/=16}}return d},numeric.uncmin=function(e,n,r,t,o,i,a){var u=numeric.gradient;void 0===a&&(a={}),void 0===r&&(r=1e-8),void 0===t&&(t=function(n){return u(e,n)}),void 0===o&&(o=1e3);var s,c,f=(n=numeric.clone(n)).length,l=e(n);if(isNaN(l))throw new Error("uncmin: f(x0) is a NaN!");var m=Math.max,h=numeric.norm2;r=m(r,numeric.epsilon);var p,d,y,g,x,v,w,b,T,C,_=a.Hinv||numeric.identity(f),A=numeric.dot,k=(numeric.inv,numeric.sub),M=numeric.add,S=numeric.tensor,N=numeric.div,P=numeric.mul,O=numeric.all,L=numeric.isFinite,E=numeric.neg,j=0,q="";for(d=t(n);j<o;){if("function"==typeof i&&i(j,n,l,d,_)){q="Callback returned true";break}if(!O(L(d))){q="Gradient has Infinity or NaN";break}if(!O(L(p=E(A(_,d))))){q="Search direction has Infinity or NaN";break}if((C=h(p))<r){q="Newton step smaller than tol";break}for(T=1,c=A(d,p),x=n;j<o&&!(T*C<r)&&(x=M(n,g=P(p,T)),(s=e(x))-l>=.1*T*c||isNaN(s));)T*=.5,++j;if(T*C<r){q="Line search step size smaller than tol";break}if(j===o){q="maxit reached during line search";break}b=A(v=k(y=t(x),d),g),w=A(_,v),_=k(M(_,P((b+A(v,w))/(b*b),S(g,g))),N(M(S(w,g),S(g,w)),b)),n=x,l=s,d=y,++j}return{solution:n,f:l,gradient:d,invHessian:_,iterations:j,message:q}},numeric.Dopri=function(e,n,r,t,o,i,a){this.x=e,this.y=n,this.f=r,this.ymid=t,this.iterations=o,this.events=a,this.message=i},numeric.Dopri.prototype._at=function(e,n){function r(e){return e*e}var t,o,i,a,u,s,c,f,l,m=this,h=m.x,p=m.y,d=m.f,y=m.ymid,g=(h.length,Math.floor,numeric.add),x=numeric.mul,v=numeric.sub;return t=h[n],o=h[n+1],a=p[n],u=p[n+1],i=t+.5*(o-t),s=y[n],c=v(d[n],x(a,1/(t-i)+2/(t-o))),f=v(d[n+1],x(u,1/(o-i)+2/(o-t))),g(g(g(g(x(a,(l=[r(e-o)*(e-i)/r(t-o)/(t-i),r(e-t)*r(e-o)/r(t-i)/r(o-i),r(e-t)*(e-i)/r(o-t)/(o-i),(e-t)*r(e-o)*(e-i)/r(t-o)/(t-i),(e-o)*r(e-t)*(e-i)/r(t-o)/(o-i)])[0]),x(s,l[1])),x(u,l[2])),x(c,l[3])),x(f,l[4]))},numeric.Dopri.prototype.at=function(e){var n,r,t,o=Math.floor;if("number"!=typeof e){var i=e.length,a=Array(i);for(n=i-1;-1!==n;--n)a[n]=this.at(e[n]);return a}var u=this.x;for(n=0,r=u.length-1;r-n>1;)u[t=o(.5*(n+r))]<=e?n=t:r=t;return this._at(e,n)},numeric.dopri=function(e,n,r,t,o,i,a){void 0===o&&(o=1e-6),void 0===i&&(i=1e3);var u,s,c,f,l,m,h,p,d,y,g,x,v,w=[e],b=[r],T=[t(e,r)],C=[],_=[.075,.225],A=[44/45,-56/15,32/9],k=[19372/6561,-25360/2187,64448/6561,-212/729],M=[9017/3168,-355/33,46732/5247,49/176,-5103/18656],S=[35/384,0,500/1113,125/192,-2187/6784,11/84],N=[.10013431883002395,0,.3918321794184259,-.02982460176594817,.05893268337240795,-.04497888809104361,.023904308236133973],P=[.2,.3,.8,8/9,1,1],O=[-71/57600,0,71/16695,-71/1920,17253/339200,-22/525,.025],L=0,E=(n-e)/10,j=0,q=numeric.add,R=numeric.mul,F=(Math.max,Math.min),I=Math.abs,Y=numeric.norminf,V=Math.pow,D=numeric.any,X=numeric.lt,B=numeric.and,U=(numeric.sub,new numeric.Dopri(w,b,T,C,-1,""));for("function"==typeof a&&(g=a(e,r));e<n&&j<i;)if(++j,e+E>n&&(E=n-e),u=t(e+P[0]*E,q(r,R(.2*E,T[L]))),s=t(e+P[1]*E,q(q(r,R(_[0]*E,T[L])),R(_[1]*E,u))),c=t(e+P[2]*E,q(q(q(r,R(A[0]*E,T[L])),R(A[1]*E,u)),R(A[2]*E,s))),f=t(e+P[3]*E,q(q(q(q(r,R(k[0]*E,T[L])),R(k[1]*E,u)),R(k[2]*E,s)),R(k[3]*E,c))),l=t(e+P[4]*E,q(q(q(q(q(r,R(M[0]*E,T[L])),R(M[1]*E,u)),R(M[2]*E,s)),R(M[3]*E,c)),R(M[4]*E,f))),m=t(e+E,d=q(q(q(q(q(r,R(T[L],E*S[0])),R(s,E*S[2])),R(c,E*S[3])),R(f,E*S[4])),R(l,E*S[5]))),(y="number"==typeof(h=q(q(q(q(q(R(T[L],E*O[0]),R(s,E*O[2])),R(c,E*O[3])),R(f,E*O[4])),R(l,E*O[5])),R(m,E*O[6])))?I(h):Y(h))>o){if(e+(E=.2*E*V(o/y,.25))===e){U.msg="Step size became too small";break}}else{if(C[L]=q(q(q(q(q(q(r,R(T[L],E*N[0])),R(s,E*N[2])),R(c,E*N[3])),R(f,E*N[4])),R(l,E*N[5])),R(m,E*N[6])),w[++L]=e+E,b[L]=d,T[L]=m,"function"==typeof a){var G,H,W=e,$=e+.5*E;if(x=a($,C[L-1]),D(v=B(X(g,0),X(0,x)))||(W=$,g=x,x=a($=e+E,d),v=B(X(g,0),X(0,x))),D(v)){for(var K,z,Q=0,Z=1,J=1;;){if("number"==typeof g)H=(J*x*W-Z*g*$)/(J*x-Z*g);else for(H=$,p=g.length-1;-1!==p;--p)g[p]<0&&x[p]>0&&(H=F(H,(J*x[p]*W-Z*g[p]*$)/(J*x[p]-Z*g[p])));if(H<=W||H>=$)break;z=a(H,G=U._at(H,L-1)),D(K=B(X(g,0),X(0,z)))?($=H,x=z,v=K,J=1,-1===Q?Z*=.5:Z=1,Q=-1):(W=H,g=z,Z=1,1===Q?J*=.5:J=1,Q=1)}return d=U._at(.5*(e+H),L-1),U.f[L]=t(H,G),U.x[L]=H,U.y[L]=G,U.ymid[L-1]=d,U.events=v,U.iterations=j,U}}e+=E,r=d,g=x,E=F(.8*E*V(o/y,.25),4*E)}return U.iterations=j,U},numeric.LU=function(e,n){n=n||!1;var r,t,o,i,a,u,s,c,f,l=Math.abs,m=e.length,h=m-1,p=new Array(m);for(n||(e=numeric.clone(e)),o=0;o<m;++o){for(s=o,f=l((u=e[o])[o]),t=o+1;t<m;++t)f<(i=l(e[t][o]))&&(f=i,s=t);for(p[o]=s,s!=o&&(e[o]=e[s],e[s]=u,u=e[o]),a=u[o],r=o+1;r<m;++r)e[r][o]/=a;for(r=o+1;r<m;++r){for(c=e[r],t=o+1;t<h;++t)c[t]-=c[o]*u[t],c[++t]-=c[o]*u[t];t===h&&(c[t]-=c[o]*u[t])}}return{LU:e,P:p}},numeric.LUsolve=function(e,n){var r,t,o,i,a,u=e.LU,s=u.length,c=numeric.clone(n),f=e.P;for(r=s-1;-1!==r;--r)c[r]=n[r];for(r=0;r<s;++r)for(o=f[r],f[r]!==r&&(a=c[r],c[r]=c[o],c[o]=a),i=u[r],t=0;t<r;++t)c[r]-=c[t]*i[t];for(r=s-1;r>=0;--r){for(i=u[r],t=r+1;t<s;++t)c[r]-=c[t]*i[t];c[r]/=i[r]}return c},numeric.solve=function(e,n,r){return numeric.LUsolve(numeric.LU(e,r),n)},numeric.echelonize=function(e){var n,r,t,o,i,a,u,s,c=numeric.dim(e),f=c[0],l=c[1],m=numeric.identity(f),h=Array(f),p=Math.abs,d=numeric.diveq;for(e=numeric.clone(e),n=0;n<f;++n){for(t=0,i=e[n],a=m[n],r=1;r<l;++r)p(i[t])<p(i[r])&&(t=r);for(h[n]=t,d(a,i[t]),d(i,i[t]),r=0;r<f;++r)if(r!==n){for(s=(u=e[r])[t],o=l-1;-1!==o;--o)u[o]-=i[o]*s;for(u=m[r],o=f-1;-1!==o;--o)u[o]-=a[o]*s}}return{I:m,A:e,P:h}},numeric.__solveLP=function(e,n,r,t,o,i,a){var u,s,c,f,l=numeric.sum,m=(numeric.log,numeric.mul),h=numeric.sub,p=numeric.dot,d=numeric.div,y=numeric.add,g=e.length,x=r.length,v=!1,w=1,b=(numeric.transpose(n),numeric.svd,numeric.transpose),T=(numeric.leq,Math.sqrt),C=Math.abs,_=(numeric.muleq,numeric.norminf,numeric.any,Math.min),A=numeric.all,k=numeric.gt,M=Array(g),S=Array(x),N=(numeric.rep([x],1),numeric.solve),P=h(r,p(n,i)),O=p(e,e);for(c=0;c<o;++c){var L,E;for(L=x-1;-1!==L;--L)S[L]=d(n[L],P[L]);var j=b(S);for(L=g-1;-1!==L;--L)M[L]=l(j[L]);w=.25*C(O/p(e,M));var q=100*T(O/p(M,M));for((!isFinite(w)||w>q)&&(w=q),f=y(e,m(w,M)),s=p(j,S),L=g-1;-1!==L;--L)s[L][L]+=1;E=N(s,d(f,w),!0);var R=d(P,p(n,E)),F=1;for(L=x-1;-1!==L;--L)R[L]<0&&(F=_(F,-.999*R[L]));if(u=h(i,m(E,F)),!A(k(P=h(r,p(n,u)),0)))return{solution:i,message:"",iterations:c};if(i=u,w<t)return{solution:u,message:"",iterations:c};if(a){var I=p(e,f),Y=p(n,f);for(v=!0,L=x-1;-1!==L;--L)if(I*Y[L]<0){v=!1;break}}else v=!(i[g-1]>=0);if(v)return{solution:u,message:"Unbounded",iterations:c}}return{solution:i,message:"maximum iteration count exceeded",iterations:c}},numeric._solveLP=function(e,n,r,t,o){var i=e.length,a=r.length,u=(numeric.sum,numeric.log,numeric.mul,numeric.sub),s=numeric.dot,c=(numeric.div,numeric.add,numeric.rep([i],0).concat([1])),f=numeric.rep([a,1],-1),l=numeric.blockMatrix([[n,f]]),m=r,h=numeric.rep([i],0).concat(Math.max(0,numeric.sup(numeric.neg(r)))+1),p=numeric.__solveLP(c,l,m,t,o,h,!1),d=numeric.clone(p.solution);if(d.length=i,numeric.inf(u(r,s(n,d)))<0)return{solution:NaN,message:"Infeasible",iterations:p.iterations};var y=numeric.__solveLP(e,n,r,t,o-p.iterations,d,!0);return y.iterations+=p.iterations,y},numeric.solveLP=function(e,n,r,t,o,i,a){if(void 0===a&&(a=1e3),void 0===i&&(i=numeric.epsilon),void 0===t)return numeric._solveLP(e,n,r,i,a);var u,s=t.length,c=t[0].length,f=n.length,l=numeric.echelonize(t),m=numeric.rep([c],0),h=l.P,p=[];for(u=h.length-1;-1!==u;--u)m[h[u]]=1;for(u=c-1;-1!==u;--u)0===m[u]&&p.push(u);var d=numeric.getRange,y=numeric.linspace(0,s-1),g=numeric.linspace(0,f-1),x=d(t,y,p),v=d(n,g,h),w=d(n,g,p),b=numeric.dot,T=numeric.sub,C=b(v,l.I),_=T(w,b(C,x)),A=T(r,b(C,o)),k=Array(h.length),M=Array(p.length);for(u=h.length-1;-1!==u;--u)k[u]=e[h[u]];for(u=p.length-1;-1!==u;--u)M[u]=e[p[u]];var S=T(M,b(k,b(l.I,x))),N=numeric._solveLP(S,_,A,i,a),P=N.solution;if(P!=P)return N;var O=b(l.I,T(o,b(x,P))),L=Array(e.length);for(u=h.length-1;-1!==u;--u)L[h[u]]=O[u];for(u=p.length-1;-1!==u;--u)L[p[u]]=P[u];return{solution:L,message:N.message,iterations:N.iterations}},numeric.MPStoLP=function(e){function n(n){throw new Error("MPStoLP: "+n+"\nLine "+r+": "+e[r]+"\nCurrent state: "+u[a]+"\n")}e instanceof String&&e.split("\n");var r,t,o,i,a=0,u=["Initial state","NAME","ROWS","COLUMNS","RHS","BOUNDS","ENDATA"],s=e.length,c=0,f={},l=[],m=0,h={},p=0,d=[],y=[],g=[];for(r=0;r<s;++r){var x=(o=e[r]).match(/\S*/g),v=[];for(t=0;t<x.length;++t)""!==x[t]&&v.push(x[t]);if(0!==v.length){for(t=0;t<u.length&&o.substr(0,u[t].length)!==u[t];++t);if(t<u.length){if(a=t,1===t&&(i=v[1]),6===t)return{name:i,c:d,A:numeric.transpose(y),b:g,rows:f,vars:h}}else switch(a){case 0:case 1:n("Unexpected line");case 2:switch(v[0]){case"N":0===c?c=v[1]:n("Two or more N rows");break;case"L":f[v[1]]=m,l[m]=1,g[m]=0,++m;break;case"G":f[v[1]]=m,l[m]=-1,g[m]=0,++m;break;case"E":f[v[1]]=m,l[m]=0,g[m]=0,++m;break;default:n("Parse error "+numeric.prettyPrint(v))}break;case 3:h.hasOwnProperty(v[0])||(h[v[0]]=p,d[p]=0,y[p]=numeric.rep([m],0),++p);var w=h[v[0]];for(t=1;t<v.length;t+=2)if(v[t]!==c){var b=f[v[t]];y[w][b]=(l[b]<0?-1:1)*parseFloat(v[t+1])}else d[w]=parseFloat(v[t+1]);break;case 4:for(t=1;t<v.length;t+=2)g[f[v[t]]]=(l[f[v[t]]]<0?-1:1)*parseFloat(v[t+1]);break;case 5:break;case 6:n("Internal error")}}}n("Reached end of file without ENDATA")},numeric.seedrandom={pow:Math.pow,random:Math.random},function(e,n,r,t,o,i,a){function u(e){var n,t,o=this,i=e.length,a=0,u=o.i=o.j=o.m=0;for(o.S=[],o.c=[],i||(e=[i++]);a<r;)o.S[a]=a++;for(a=0;a<r;a++)u=f(u+(n=o.S[a])+e[a%i]),t=o.S[u],o.S[a]=t,o.S[u]=n;o.g=function(e){var n=o.S,t=f(o.i+1),i=n[t],a=f(o.j+i),u=n[a];n[t]=u,n[a]=i;for(var s=n[f(i+u)];--e;)t=f(t+1),u=n[a=f(a+(i=n[t]))],n[t]=u,n[a]=i,s=s*r+n[f(i+u)];return o.i=t,o.j=a,s},o.g(r)}function s(e,n,r,t,o){if(r=[],o=typeof e,n&&"object"==o)for(t in e)if(t.indexOf("S")<5)try{r.push(s(e[t],n-1))}catch(e){}return r.length?r:e+("string"!=o?"\0":"")}function c(e,n,r,t){for(e+="",r=0,t=0;t<e.length;t++)n[f(t)]=f((r^=19*n[f(t)])+e.charCodeAt(t));for(t in e="",n)e+=String.fromCharCode(n[t]);return e}function f(e){return e&r-1}n.seedrandom=function(t,f){var l,m=[];return t=c(s(f?[t,e]:arguments.length?t:[(new Date).getTime(),e,window],3),m),c((l=new u(m)).S,e),n.random=function(){for(var e=l.g(6),n=a,t=0;e<o;)e=(e+t)*r,n*=r,t=l.g(1);for(;e>=i;)e/=2,n/=2,t>>>=1;return(e+t)/n},t},a=n.pow(r,6),o=n.pow(2,o),i=2*o,c(n.random(),e)}([],numeric.seedrandom,256,0,52),function(e){function n(e){if("object"!=typeof e)return e;var r,t=[],o=e.length;for(r=0;r<o;r++)t[r+1]=n(e[r]);return t}function r(e){if("object"!=typeof e)return e;var n,t=[],o=e.length;for(n=1;n<o;n++)t[n-1]=r(e[n]);return t}e.solveQP=function(e,t,o,i,a,u){e=n(e),t=n(t),o=n(o);var s,c,f,l,m,h=[],p=[],d=[],y=[],g=[];if(a=a||0,u=u?n(u):[void 0,0],i=i?n(i):[],c=e.length-1,f=o[1].length-1,!i)for(s=1;s<=f;s+=1)i[s]=0;for(s=1;s<=f;s+=1)p[s]=0;for(l=Math.min(c,f),s=1;s<=c;s+=1)d[s]=0;for(h[1]=0,s=1;s<=2*c+l*(l+5)/2+2*f+1;s+=1)y[s]=0;for(s=1;s<=2;s+=1)g[s]=0;return function(e,n,r,t,o,i,a,u,s,c,f,l,m,h,p,d){function y(){for(h[1]=h[1]+1,C=P,b=1;b<=c;b+=1){for(C+=1,R=-u[b],T=1;T<=t;T+=1)R+=a[T][b]*o[T];if(Math.abs(R)<U&&(R=0),b>f)p[C]=R;else if(p[C]=-Math.abs(R),R>0){for(T=1;T<=t;T+=1)a[T][b]=-a[T][b];u[b]=-u[b]}}for(b=1;b<=m;b+=1)p[P+l[b]]=0;for(L=0,q=0,b=1;b<=c;b+=1)p[P+b]<q*p[j+b]&&(L=b,q=p[P+b]/p[j+b]);return 0===L?999:0}function g(){for(b=1;b<=t;b+=1){for(R=0,T=1;T<=t;T+=1)R+=e[T][b]*a[T][L];p[b]=R}for(_=M,b=1;b<=t;b+=1)p[_+b]=0;for(T=m+1;T<=t;T+=1)for(b=1;b<=t;b+=1)p[_+b]=p[_+b]+e[b][T]*p[T];for(X=!0,b=m;b>=1;b-=1){for(R=p[b],_=(C=N+b*(b+3)/2)-b,T=b+1;T<=m;T+=1)R-=p[C]*p[S+T],C+=T;if(R/=p[_],p[S+b]=R,l[b]<f)break;if(R<0)break;X=!1,k=b}if(!X)for(F=p[O+k]/p[S+k],b=1;b<=m&&!(l[b]<f)&&!(p[S+b]<0);b+=1)(q=p[O+b]/p[S+b])<F&&(F=q,k=b);for(R=0,b=M+1;b<=M+t;b+=1)R+=p[b]*p[b];if(Math.abs(R)<=U){if(X)return d[1]=1,999;for(b=1;b<=m;b+=1)p[O+b]=p[O+b]-F*p[S+b];return p[O+m+1]=p[O+m+1]+F,700}for(R=0,b=1;b<=t;b+=1)R+=p[M+b]*a[b][L];for(I=-p[P+L]/R,B=!0,X||F<I&&(I=F,B=!1),b=1;b<=t;b+=1)o[b]=o[b]+I*p[M+b],Math.abs(o[b])<U&&(o[b]=0);for(i[1]=i[1]+I*R*(I/2+p[O+m+1]),b=1;b<=m;b+=1)p[O+b]=p[O+b]-I*p[S+b];if(p[O+m+1]=p[O+m+1]+I,!B){for(R=-u[L],T=1;T<=t;T+=1)R+=o[T]*a[T][L];if(L>f)p[P+L]=R;else if(p[P+L]=-Math.abs(R),R>0){for(T=1;T<=t;T+=1)a[T][L]=-a[T][L];u[L]=-u[L]}return 700}for(l[m+=1]=L,C=N+(m-1)*m/2+1,b=1;b<=m-1;b+=1)p[C]=p[b],C+=1;if(m===t)p[C]=p[t];else{for(b=t;b>=m+1&&0!==p[b]&&(Y=Math.max(Math.abs(p[b-1]),Math.abs(p[b])),V=Math.min(Math.abs(p[b-1]),Math.abs(p[b])),q=p[b-1]>=0?Math.abs(Y*Math.sqrt(1+V*V/(Y*Y))):-Math.abs(Y*Math.sqrt(1+V*V/(Y*Y))),Y=p[b-1]/q,V=p[b]/q,1!==Y);b-=1)if(0===Y)for(p[b-1]=V*q,T=1;T<=t;T+=1)q=e[T][b-1],e[T][b-1]=e[T][b],e[T][b]=q;else for(p[b-1]=q,D=V/(1+Y),T=1;T<=t;T+=1)q=Y*e[T][b-1]+V*e[T][b],e[T][b]=D*(e[T][b-1]+q)-e[T][b],e[T][b-1]=q;p[C]=p[m]}return 0}function x(){if(0===p[_=(C=N+k*(k+1)/2+1)+k])return 798;if(Y=Math.max(Math.abs(p[_-1]),Math.abs(p[_])),V=Math.min(Math.abs(p[_-1]),Math.abs(p[_])),q=p[_-1]>=0?Math.abs(Y*Math.sqrt(1+V*V/(Y*Y))):-Math.abs(Y*Math.sqrt(1+V*V/(Y*Y))),Y=p[_-1]/q,V=p[_]/q,1===Y)return 798;if(0===Y){for(b=k+1;b<=m;b+=1)q=p[_-1],p[_-1]=p[_],p[_]=q,_+=b;for(b=1;b<=t;b+=1)q=e[b][k],e[b][k]=e[b][k+1],e[b][k+1]=q}else{for(D=V/(1+Y),b=k+1;b<=m;b+=1)q=Y*p[_-1]+V*p[_],p[_]=D*(p[_-1]+q)-p[_],p[_-1]=q,_+=b;for(b=1;b<=t;b+=1)q=Y*e[b][k]+V*e[b][k+1],e[b][k+1]=D*(e[b][k]+q)-e[b][k+1],e[b][k]=q}return 0}function v(){for(_=C-k,b=1;b<=k;b+=1)p[_]=p[C],C+=1,_+=1;return p[O+k]=p[O+k+1],l[k]=l[k+1],(k+=1)<m?797:0}function w(){return p[O+m]=p[O+m+1],p[O+m+1]=0,l[m]=0,m-=1,h[2]=h[2]+1,0}var b,T,C,_,A,k,M,S,N,P,O,L,E,j,q,R,F,I,Y,V,D,X,B,U,G,H,W;E=Math.min(t,c),C=2*t+E*(E+5)/2+2*c+1,U=1e-60;do{G=1+.1*(U+=U),H=1+.2*U}while(G<=1||H<=1);for(b=1;b<=t;b+=1)p[b]=n[b];for(b=t+1;b<=C;b+=1)p[b]=0;for(b=1;b<=c;b+=1)l[b]=0;if(A=[],0===d[1]){if(function(e,n,r,t){var o,i,a,u,s,c;for(i=1;i<=r;i+=1){if(t[1]=i,c=0,(a=i-1)<1){if((c=e[i][i]-c)<=0)break;e[i][i]=Math.sqrt(c)}else{for(u=1;u<=a;u+=1){for(s=e[u][i],o=1;o<u;o+=1)s-=e[o][i]*e[o][u];s/=e[u][u],e[u][i]=s,c+=s*s}if((c=e[i][i]-c)<=0)break;e[i][i]=Math.sqrt(c)}t[1]=0}}(e,0,t,A),0!==A[1])return void(d[1]=2);(function(e,n,r,t){var o,i,a,u;for(i=1;i<=r;i+=1){for(u=0,o=1;o<i;o+=1)u+=e[o][i]*t[o];t[i]=(t[i]-u)/e[i][i]}for(a=1;a<=r;a+=1)for(t[i=r+1-a]=t[i]/e[i][i],u=-t[i],o=1;o<i;o+=1)t[o]=t[o]+u*e[o][i]})(e,0,t,n),function(e,n,r){var t,o,i,a,u;for(i=1;i<=r;i+=1){for(e[i][i]=1/e[i][i],u=-e[i][i],t=1;t<i;t+=1)e[t][i]=u*e[t][i];if(r<(a=i+1))break;for(o=a;o<=r;o+=1)for(u=e[i][o],e[i][o]=0,t=1;t<=i;t+=1)e[t][o]=e[t][o]+u*e[t][i]}}(e,0,t)}else{for(T=1;T<=t;T+=1)for(o[T]=0,b=1;b<=T;b+=1)o[T]=o[T]+e[b][T]*n[b];for(T=1;T<=t;T+=1)for(n[T]=0,b=T;b<=t;b+=1)n[T]=n[T]+e[T][b]*o[b]}for(i[1]=0,T=1;T<=t;T+=1)for(o[T]=n[T],i[1]=i[1]+p[T]*o[T],p[T]=0,b=T+1;b<=t;b+=1)e[b][T]=0;for(i[1]=-i[1]/2,d[1]=0,j=(P=(N=(O=(S=(M=t)+t)+E)+E+1)+E*(E+1)/2)+c,b=1;b<=c;b+=1){for(R=0,T=1;T<=t;T+=1)R+=a[T][b]*a[T][b];p[j+b]=Math.sqrt(R)}for(m=0,h[1]=0,h[2]=0,W=0;;){if(999===(W=y()))return;for(;0!==(W=g());){if(999===W)return;if(700===W)if(k===m)w();else{for(;x(),797===(W=v()););w()}}}}(e,t,0,c,d,h,o,i,0,f,a,p,0,g,y,u),m="",1===u[1]&&(m="constraints are inconsistent, no solution!"),2===u[1]&&(m="matrix D in quadratic function is not positive definite!"),{solution:r(d),value:r(h),unconstrained_solution:r(t),iterations:r(g),iact:r(p),message:m}}}(numeric),numeric.svd=function(e){function n(e,n){return(e=Math.abs(e))>(n=Math.abs(n))?e*Math.sqrt(1+n*n/e/e):0==n?e:n*Math.sqrt(1+e*e/n/n)}var r,t=numeric.epsilon,o=1e-64/t,i=0,a=0,u=0,s=0,c=0,f=numeric.clone(e),l=f.length,m=f[0].length;if(l<m)throw"Need more rows than columns";var h=new Array(m),p=new Array(m);for(a=0;a<m;a++)h[a]=p[a]=0;var d=numeric.rep([m,m],0),y=0,g=0,x=0,v=0,w=0,b=0,T=0;for(a=0;a<m;a++){for(h[a]=g,T=0,c=a+1,u=a;u<l;u++)T+=f[u][a]*f[u][a];if(T<=o)g=0;else for(y=f[a][a],g=Math.sqrt(T),y>=0&&(g=-g),x=y*g-T,f[a][a]=y-g,u=c;u<m;u++){for(T=0,s=a;s<l;s++)T+=f[s][a]*f[s][u];for(y=T/x,s=a;s<l;s++)f[s][u]+=y*f[s][a]}for(p[a]=g,T=0,u=c;u<m;u++)T+=f[a][u]*f[a][u];if(T<=o)g=0;else{for(y=f[a][a+1],g=Math.sqrt(T),y>=0&&(g=-g),x=y*g-T,f[a][a+1]=y-g,u=c;u<m;u++)h[u]=f[a][u]/x;for(u=c;u<l;u++){for(T=0,s=c;s<m;s++)T+=f[u][s]*f[a][s];for(s=c;s<m;s++)f[u][s]+=T*h[s]}}(w=Math.abs(p[a])+Math.abs(h[a]))>v&&(v=w)}for(a=m-1;-1!=a;a+=-1){if(0!=g){for(x=g*f[a][a+1],u=c;u<m;u++)d[u][a]=f[a][u]/x;for(u=c;u<m;u++){for(T=0,s=c;s<m;s++)T+=f[a][s]*d[s][u];for(s=c;s<m;s++)d[s][u]+=T*d[s][a]}}for(u=c;u<m;u++)d[a][u]=0,d[u][a]=0;d[a][a]=1,g=h[a],c=a}for(a=m-1;-1!=a;a+=-1){for(c=a+1,g=p[a],u=c;u<m;u++)f[a][u]=0;if(0!=g){for(x=f[a][a]*g,u=c;u<m;u++){for(T=0,s=c;s<l;s++)T+=f[s][a]*f[s][u];for(y=T/x,s=a;s<l;s++)f[s][u]+=y*f[s][a]}for(u=a;u<l;u++)f[u][a]=f[u][a]/g}else for(u=a;u<l;u++)f[u][a]=0;f[a][a]+=1}for(t*=v,s=m-1;-1!=s;s+=-1)for(var C=0;C<50;C++){var _=!1;for(c=s;-1!=c;c+=-1){if(Math.abs(h[c])<=t){_=!0;break}if(Math.abs(p[c-1])<=t)break}if(!_){i=0,T=1;var A=c-1;for(a=c;a<s+1&&(y=T*h[a],h[a]=i*h[a],!(Math.abs(y)<=t));a++)for(x=n(y,g=p[a]),p[a]=x,i=g/x,T=-y/x,u=0;u<l;u++)w=f[u][A],b=f[u][a],f[u][A]=w*i+b*T,f[u][a]=-w*T+b*i}if(b=p[s],c==s){if(b<0)for(p[s]=-b,u=0;u<m;u++)d[u][s]=-d[u][s];break}if(C>=49)throw"Error: no convergence.";for(v=p[c],g=n(y=(((w=p[s-1])-b)*(w+b)+((g=h[s-1])-(x=h[s]))*(g+x))/(2*x*w),1),y=y<0?((v-b)*(v+b)+x*(w/(y-g)-x))/v:((v-b)*(v+b)+x*(w/(y+g)-x))/v,i=1,T=1,a=c+1;a<s+1;a++){for(g=h[a],w=p[a],x=T*g,g*=i,b=n(y,x),h[a-1]=b,y=v*(i=y/b)+g*(T=x/b),g=-v*T+g*i,x=w*T,w*=i,u=0;u<m;u++)v=d[u][a-1],b=d[u][a],d[u][a-1]=v*i+b*T,d[u][a]=-v*T+b*i;for(b=n(y,x),p[a-1]=b,y=(i=y/b)*g+(T=x/b)*w,v=-T*g+i*w,u=0;u<l;u++)w=f[u][a-1],b=f[u][a],f[u][a-1]=w*i+b*T,f[u][a]=-w*T+b*i}h[c]=0,h[s]=y,p[s]=v}for(a=0;a<p.length;a++)p[a]<t&&(p[a]=0);for(a=0;a<m;a++)for(u=a-1;u>=0;u--)if(p[u]<p[a]){for(i=p[u],p[u]=p[a],p[a]=i,s=0;s<f.length;s++)r=f[s][a],f[s][a]=f[s][u],f[s][u]=r;for(s=0;s<d.length;s++)r=d[s][a],d[s][a]=d[s][u],d[s][u]=r;a=u}return{U:f,S:p,V:d}}},111:(e,n,r)=>{"use strict";function t(e){e.sort();const n=e[Math.trunc(e.length/4)],r=e.length%2==0?(e[Math.trunc(e.length/2)]+e[Math.trunc(e.length/2)-1])/2:e[Math.trunc(e.length/2)],t=e[Math.trunc(3*e.length/4)],i=1.5*(t-n);let a=o(e,t+i);a<0&&(a=~a);let u=e[Math.max(0,a-1)];u<t&&(u=t);let s=o(e,n-i);s<0&&(s=~s);let c=e[s];return c>n&&(c=n),{q1:n,q2:r,q3:t,lowerAdjacentValue:c,upperAdjacentValue:u}}function o(e,n,r=0,t){if(0===e.length)return-1;if(void 0===t&&(t=e.length-1),n<e[r])return-1;if(n>e[t])return-(t+1);for(;t-r>1;){const o=Math.trunc((t+r)/2);if(n===e[o])return o;n<e[o]?t=o:r=o}return e[r]===n?r:0===e[t]?t:n<e[r]?-(r+1):-(t+1)}r.d(n,{G:()=>t})},875:(e,n,r)=>{"use strict";r.d(n,{Hg:()=>M,K0:()=>d,Kp:()=>c,Qc:()=>f,XD:()=>l,ZY:()=>T,aC:()=>k,d8:()=>s,hR:()=>_,iC:()=>C,j2:()=>u,js:()=>a,kW:()=>p,sw:()=>h,ue:()=>A,vK:()=>m,yB:()=>y});var t=r(976),o=r(78),i=r(162);const a={CONSTANT:"constant",PROPORTIONAL:"proportional"},u="fit",s="fit",c=".fit",f="rgba(255,191,63,0.4)",l="rgba(255,238,204,0.3)",m={TOP:"top",BOTTOM:"bottom"},h=[t.Property.js("rSquared",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("auc",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("interceptY",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("interceptX",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("slope",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("top",t.TYPE.FLOAT,{userEditable:!1}),t.Property.js("bottom",t.TYPE.FLOAT,{userEditable:!1})],p=[t.Property.js("minX",t.TYPE.FLOAT,{description:"Minimum value of the X axis",nullable:!0}),t.Property.js("minY",t.TYPE.FLOAT,{description:"Minimum value of the Y axis",nullable:!0}),t.Property.js("maxX",t.TYPE.FLOAT,{description:"Maximum value of the X axis",nullable:!0}),t.Property.js("maxY",t.TYPE.FLOAT,{description:"Maximum value of the Y axis",nullable:!0}),t.Property.js("title",t.TYPE.STRING,{nullable:!0}),t.Property.js("xAxisName",t.TYPE.STRING,{description:"Label to show on the X axis. If not specified, corresponding data column name is used",nullable:!0}),t.Property.js("yAxisName",t.TYPE.STRING,{description:"Label to show on the Y axis. If not specified, corresponding data column name is used",nullable:!0}),t.Property.js("logX",t.TYPE.BOOL,{description:"Whether the X axis should be logarithmic",defaultValue:!1}),t.Property.js("logY",t.TYPE.BOOL,{description:"Whether the Y axis should be logarithmic",defaultValue:!1}),t.Property.js("allowXZeroes",t.TYPE.BOOL,{description:"Whether x zeroes allowed for logarithmic data or not",defaultValue:!0}),t.Property.js("showStatistics",t.TYPE.STRING_LIST,{description:"Whether specific statistics should be rendered",choices:h.map((e=>e.name)),inputType:"MultiChoice"})],d=[t.Property.js("fitFunction",t.TYPE.STRING,{category:"Fitting",choices:["sigmoid","linear"],defaultValue:"sigmoid"}),t.Property.js("pointColor",t.TYPE.STRING,{category:"Rendering",nullable:!0,inputType:"Color"}),t.Property.js("fitLineColor",t.TYPE.STRING,{category:"Rendering",nullable:!0,inputType:"Color"}),t.Property.js("outlierColor",t.TYPE.STRING,{category:"Rendering",nullable:!0,inputType:"Color"}),t.Property.js("errorModel",t.TYPE.STRING,{category:"Fitting",defaultValue:"constant",choices:["constant","proportional"],nullable:!1}),t.Property.js("clickToToggle",t.TYPE.BOOL,{category:"Fitting",description:"Click on a point to mark it as outlier and refit",nullable:!0,defaultValue:!1}),t.Property.js("showFitLine",t.TYPE.BOOL,{category:"Fitting",defaultValue:!0}),t.Property.js("showPoints",t.TYPE.STRING,{category:"Fitting",description:"Whether points/candlesticks/none should be rendered",defaultValue:"points",choices:["points","candlesticks","both"]}),t.Property.js("showCurveConfidenceInterval",t.TYPE.BOOL,{category:"Fitting",description:"Whether confidence intervals should be rendered",defaultValue:!1,friendlyName:"Confidence interval"}),t.Property.js("markerType",t.TYPE.STRING,{category:"Rendering",defaultValue:"circle",choices:["asterisk","circle","cross border","diamond","square","star","triangle bottom","triangle left","triangle right","triangle top"],nullable:!1}),t.Property.js("lineStyle",t.TYPE.STRING,{category:"Rendering",defaultValue:"solid",choices:["solid","dotted","dashed","dashdotted"],nullable:!1}),t.Property.js("droplines",t.TYPE.STRING_LIST,{description:"Whether specific droplines should be rendered",choices:["IC50"],inputType:"MultiChoice"})],y="sigmoid";class g{}class x extends g{constructor(e,n,r,t){super(),this._name=e,this._parameterNames=t,this.y=n,this.getInitialParameters=r}get name(){return this._name}get parameterNames(){return this._parameterNames}y(e,n){throw new Error("Not implemented")}getInitialParameters(e,n){throw new Error("Not implemented")}}const v={linear:new class extends g{get name(){return"linear"}get parameterNames(){return["Slope","Intercept"]}y(e,n){return function(e,n){return e[0]*n+e[1]}(e,n)}getInitialParameters(e,n){let r=0,t=0;for(let n=1;n<e.length;n++)e[n]<e[r]&&(r=n),e[n]>e[t]&&(t=n);const o=e[t]-e[r],i=(n[t]-n[r])/o;return[i,n[t]-i*e[t]]}},sigmoid:new class extends g{get name(){return y}get parameterNames(){return["Top","Bottom","Slope","IC50"]}y(e,n){return M(e,n)}getInitialParameters(e,n){const r=t.Rect.fromXYArrays(e,n),o=(r.bottom-r.top)/2+r.top;let i=r.bottom-r.top,a=0;for(let r=0;r<e.length;r++){const e=Math.abs(n[r]-o);e<i&&(i=e,a=r)}const u=e[a],s=n[0]>n[n.length-1]?1:-1;return[r.bottom,s,u,r.top]}}};function w(e){let n;switch(e){case a.CONSTANT:n=O;break;case a.PROPORTIONAL:n=L;break;default:n=O}return n}function b(e,n,r,t){return{getValue:t=>r(n,e,t).value,getGradient:(o,i)=>{for(let a=0;a<o.length;a++)i[a]=t.includes(a)?0:P(r,n,e,o,a);return i}}}function T(e){if("string"==typeof e)return v[e];if(!v[e.name]){const n=e.name,r=e.parameterNames,t=e.function.split("=>").map((e=>e.trim())),o=e.getInitialParameters.split("=>").map((e=>e.trim())),i=new Function(t[0].slice(1,t[0].length-1),`${t[1].includes(";")?"":"return "}${t[1]}`),a=new Function(o[0].slice(1,o[0].length-1),`return ${o[1]}`),u=new x(n,i,a,r);v[n]=u}return v[e.name]}function C(e,n,r,t){var i,a;const u=n.y,s=n.getInitialParameters(e.x,e.y),c=w(r),f=[];let l=!0;for(;l;){const n=b(e,u,c,f);if((0,o.U)(n,s),(0,o.U)(n,s),l=!1,!t)break;for(let e=0;e<t.length;e++){if(void 0!==(null===(i=t[e])||void 0===i?void 0:i.max)&&s[e]>t[e].max){l=!0,f.push(e),s[e]=t[e].max;break}if(void 0!==(null===(a=t[e])||void 0===a?void 0:a.min)&&s[e]<t[e].min){l=!0,f.push(e),s[e]=t[e].min;break}}}return{fittedCurve:_(u,s),parameters:s}}function _(e,n){return r=>e(n,r)}function A(e,n,r,t=.05,o){const u=w(o),s=o===a.PROPORTIONAL?u(r,e,n).mult:u(r,e,n).const,c=i.normal.inv(1-t/2,0,1);return{confidenceTop:e=>{const t=r(n,e);return o===a.CONSTANT?t+c*s:t+c*Math.abs(t)*s},confidenceBottom:e=>{const t=r(n,e);return o===a.CONSTANT?t-c*s:t-c*Math.abs(t)*s}}}function k(e,n,r,t=!0){const o=_(r,n);return{rSquared:t?N(o,e):void 0,auc:t?S(o,e):void 0,interceptX:n[2],interceptY:o(n[2]),slope:n[1],top:n[0],bottom:n[3]}}function M(e,n){const r=e[0],t=e[1],o=e[2],i=e[3];return i+(r-i)/(1+Math.pow(10,(n-o)*t))}function S(e,n){let r=0;const t=Math.min(...n.x),o=Math.max(...n.x),i=(o-t)/1e3;for(let n=t;n<o;n+=i)r+=i*e(n);return r}function N(e,n){let r=0,t=0;const o=i.mean(n.y);for(let i=0;i<n.x.length;i++)r+=Math.pow(n.y[i]-e(n.x[i]),2),t+=Math.pow(n.y[i]-o,2);return 1-r/t}function P(e,n,r,t,o){const i=1e-4*t[o]==0?.001:1e-4*t[o],a=[],u=[];for(let e=0;e<t.length;e++)e===o?(a.push(t[e]+i),u.push(t[e]-i)):(a.push(t[e]),u.push(t[e]));return(e(n,r,a).value-e(n,r,u).value)/(2*i)}function O(e,n,r){const t=Math.PI;let o=0,i=0,a=0;const u=new Float32Array(n.x.length);for(let t=0;t<n.x.length;t++){const o=n.y[t],i=e(r,n.x[t]);u[t]=Math.pow(o-i,2)}for(let e=0;e<u.length;e++)i+=u[e];i/=u.length,o=Math.sqrt(i);for(let e=0;e<u.length;e++)a+=u[e]/i+Math.log(2*t*i);return{value:-a,const:o,mult:0}}function L(e,n,r){const t=Math.PI;let o=0,i=0,a=0;const u=new Float32Array(n.x.length);for(let t=0;t<n.x.length;t++){const o=n.y[t],i=e(r,n.x[t]);u[t]=Math.pow(o-i,2)}for(let e=0;e<u.length;e++)i+=u[e];i/=u.length,o=Math.sqrt(i);for(let e=0;e<u.length;e++)a+=u[e]/i+Math.log(2*t*i);return{value:-a,const:0,mult:o}}},416:(e,n,r)=>{"use strict";r.d(n,{LC:()=>d,PK:()=>p,TL:()=>a,Y6:()=>m,dU:()=>l,hq:()=>s,jG:()=>u,kG:()=>h,q_:()=>c,tq:()=>y});var t=r(976),o=r(875);function i(e){const n={};for(const r of e)null!==r.defaultValue&&(n[r.name]=r.defaultValue);return n}function a(){return{chartOptions:i(o.kW),seriesOptions:i(o.K0)}}function u(e){var n,r;return JSON.parse(null!==(n=(r=e.tags)[o.Kp])&&void 0!==n?n:r[o.Kp]=JSON.stringify(a()))}function s(e){var n,r;return JSON.parse(null!==(n=(r=e.tags)[o.Kp])&&void 0!==n?n:r[o.Kp]=JSON.stringify(a()))}function c(e){const n=[],r=[];for(let t=0;t<e.length;t++)n[t]=e[t].x,r[t]=e[t].y;return{xs:n,ys:r}}function f(e){const n=Math.floor(e.y.length/2),r=e.y.sort(((e,n)=>e-n));return r.length%2==0?(r[n-1]+r[n])/2:r[n]}function l(e){var n;const r=e.chartOptions;if((null===(n=e.series)||void 0===n?void 0:n.length)&&0!==e.series.length){const{xs:n,ys:o}=c(e.series[0].points);let i=t.Rect.fromXYArrays(n,o);for(let n=1;n<e.series.length;n++){const{xs:r,ys:o}=c(e.series[n].points);r.some((e=>void 0===e))||o.some((e=>void 0===e))||(i=i.union(t.Rect.fromXYArrays(r,o)))}return r?function(e,n){let r=e.x,o=e.y,i=e.width,a=e.height;return void 0!==n.minX&&null!==n.minX&&(!n.logX||n.logX&&n.minX>0)&&(i+=r-n.minX,r=n.minX),void 0!==n.maxX&&null!==n.maxX&&(!n.logX||n.logX&&n.maxX>0)&&(i+=n.maxX-(r+i)),void 0!==n.minY&&null!==n.minY&&(!n.logY||n.logY&&n.minY>0)&&(a+=o-n.minY,o=n.minY),void 0!==n.maxY&&null!==n.maxY&&(!n.logY||n.logY&&n.maxY>0)&&(a+=n.maxY-(o+a)),new t.Rect(r,o,i,a)}(i,r):i}return new t.Rect(0,0,1,1)}function m(e){return(0,o.ZY)(e.fitFunction)}function h(e,n){return(0,o.hR)(n.y,e.parameters)}function p(e,n,r){var t;const i={x:e.points.filter((e=>!e.outlier)).map((e=>(null==r?void 0:r.logX)?Math.log10(e.x):e.x)),y:e.points.filter((e=>!e.outlier)).map((e=>(null==r?void 0:r.logY)?Math.log10(e.y):e.y))};var a;return e.parameterBounds&&(null==r?void 0:r.logX)&&(e.parameterBounds[2]=((a=e.parameterBounds[2])&&(void 0!==a.max&&(a.max=Math.log10(a.max)),void 0!==a.min&&(a.min=0===a.min?-Number.MAX_VALUE:Math.log10(a.min))),a)),(0,o.iC)(function(e){const n={x:[],y:[]},r={x:[e.x[0]],y:[e.y[0]]};for(let t=1;t<e.x.length;t++){if(e.x[t]===r.x[0]){r.x[r.x.length]=e.x[t],r.y[r.y.length]=e.y[t];continue}const o=f(r);n.x[n.x.length]=r.x[0],n.y[n.y.length]=o,r.x=[e.x[t]],r.y=[e.y[t]]}const t=f(r);return n.x[n.x.length]=r.x[0],n.y[n.y.length]=t,n}(i),n,null!==(t=e.errorModel)&&void 0!==t?t:o.js.CONSTANT,e.parameterBounds)}function d(e,n,r,t){var i;const a=r?{x:e.points.map((e=>(null==t?void 0:t.logX)?Math.log10(e.x):e.x)),y:e.points.map((e=>(null==t?void 0:t.logY)?Math.log10(e.y):e.y))}:{x:e.points.filter((e=>!e.outlier)).map((e=>(null==t?void 0:t.logX)?Math.log10(e.x):e.x)),y:e.points.filter((e=>!e.outlier)).map((e=>(null==t?void 0:t.logY)?Math.log10(e.y):e.y))};return e.parameters||(e.parameters=p(e,n).parameters),(0,o.ue)(a,e.parameters,n.y,.05,null!==(i=e.errorModel)&&void 0!==i?i:o.js.CONSTANT)}function y(e,n,r){const t={x:e.points.filter((e=>!e.outlier)).map((e=>(null==r?void 0:r.logX)?Math.log10(e.x):e.x)),y:e.points.filter((e=>!e.outlier)).map((e=>(null==r?void 0:r.logY)?Math.log10(e.y):e.y))};return e.parameters||(e.parameters=p(e,n).parameters),(0,o.aC)(t,e.parameters,n.y,!0)}},766:(e,n,r)=>{"use strict";r.d(n,{l:()=>u});var t=r(976);const o=1e-30,i=new class{screenToWorld(e,n,r,t,o){return r+(o?1-e/n:e/n)*(t-r)}worldToScreen(e,n,r,t,o){return o?(1-(e-r)/(t-r))*n:(e-r)/(t-r)*n}},a=new class{screenToWorld(e,n,r,t,i){r=r<o?o:r;const a=Math.log(t),u=Math.log(r);return Math.exp(u+(a-u)*(i?n-e:e)/n)}worldToScreen(e,n,r,t,i){if(e<=0)return NaN;if(Math.abs(e-r)<o)return i?n:0;if(Math.abs(e-t)<o)return i?0:n;r=r<o?o:r,e=e<o?o:e;const a=n*Math.log(e/r)/Math.log(t/r);return i?n-a:a}};class u{get xt(){return this.logX?a:i}get yt(){return this.logY?a:i}constructor(e,n,r=!1,t=!1){this.logX=!1,this.logY=!1,this.inverseX=!1,this.inverseY=!1,this.world=e,this.screen=n,this.logX=r,this.logY=t}xToScreen(e){return this.screen.left+this.xt.worldToScreen(e,this.screen.width,this.world.minX,this.world.maxX,this.inverseX)}yToScreen(e){return this.screen.top+this.yt.worldToScreen(e,this.screen.height,this.world.minY,this.world.maxY,!this.inverseY)}xToWorld(e){return this.xt.screenToWorld(e-this.screen.left,this.screen.width,this.world.minX,this.world.maxX,this.inverseX)}yToWorld(e){return this.yt.screenToWorld(e-this.screen.top,this.screen.height,this.world.minY,this.world.maxY,!this.inverseY)}toScreen(e){return new t.Point(this.xToScreen(e.x),this.yToScreen(e.y))}toWorld(e){return new t.Point(this.xToWorld(e.x),this.yToWorld(e.y))}drawCoordinateGrid(e,n,r){n&&t.Paint.horzAxis(e,this.world.minX,this.world.maxX,n.x,n.y,n.width,n.height,this.logX,this.inverseX),r&&t.Paint.vertAxis(e,this.world.minY,this.world.maxY,r.x,r.y,r.width,r.height,this.logY,this.inverseY)}}},133:function(e,n,r){var t;!function(n,o){var i={};!function(e){"use strict";e.__esModule=!0,e.digestLength=32,e.blockSize=64;var n=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function r(e,r,t,o,i){for(var a,u,s,c,f,l,m,h,p,d,y,g,x;i>=64;){for(a=r[0],u=r[1],s=r[2],c=r[3],f=r[4],l=r[5],m=r[6],h=r[7],d=0;d<16;d++)y=o+4*d,e[d]=(255&t[y])<<24|(255&t[y+1])<<16|(255&t[y+2])<<8|255&t[y+3];for(d=16;d<64;d++)g=((p=e[d-2])>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,x=((p=e[d-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3,e[d]=(g+e[d-7]|0)+(x+e[d-16]|0);for(d=0;d<64;d++)g=(((f>>>6|f<<26)^(f>>>11|f<<21)^(f>>>25|f<<7))+(f&l^~f&m)|0)+(h+(n[d]+e[d]|0)|0)|0,x=((a>>>2|a<<30)^(a>>>13|a<<19)^(a>>>22|a<<10))+(a&u^a&s^u&s)|0,h=m,m=l,l=f,f=c+g|0,c=s,s=u,u=a,a=g+x|0;r[0]+=a,r[1]+=u,r[2]+=s,r[3]+=c,r[4]+=f,r[5]+=l,r[6]+=m,r[7]+=h,o+=64,i-=64}return o}var t=function(){function n(){this.digestLength=e.digestLength,this.blockSize=e.blockSize,this.state=new Int32Array(8),this.temp=new Int32Array(64),this.buffer=new Uint8Array(128),this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this.reset()}return n.prototype.reset=function(){return this.state[0]=1779033703,this.state[1]=3144134277,this.state[2]=1013904242,this.state[3]=2773480762,this.state[4]=1359893119,this.state[5]=2600822924,this.state[6]=528734635,this.state[7]=1541459225,this.bufferLength=0,this.bytesHashed=0,this.finished=!1,this},n.prototype.clean=function(){for(var e=0;e<this.buffer.length;e++)this.buffer[e]=0;for(e=0;e<this.temp.length;e++)this.temp[e]=0;this.reset()},n.prototype.update=function(e,n){if(void 0===n&&(n=e.length),this.finished)throw new Error("SHA256: can't update because hash was finished.");var t=0;if(this.bytesHashed+=n,this.bufferLength>0){for(;this.bufferLength<64&&n>0;)this.buffer[this.bufferLength++]=e[t++],n--;64===this.bufferLength&&(r(this.temp,this.state,this.buffer,0,64),this.bufferLength=0)}for(n>=64&&(t=r(this.temp,this.state,e,t,n),n%=64);n>0;)this.buffer[this.bufferLength++]=e[t++],n--;return this},n.prototype.finish=function(e){if(!this.finished){var n=this.bytesHashed,t=this.bufferLength,o=n/536870912|0,i=n<<3,a=n%64<56?64:128;this.buffer[t]=128;for(var u=t+1;u<a-8;u++)this.buffer[u]=0;this.buffer[a-8]=o>>>24&255,this.buffer[a-7]=o>>>16&255,this.buffer[a-6]=o>>>8&255,this.buffer[a-5]=o>>>0&255,this.buffer[a-4]=i>>>24&255,this.buffer[a-3]=i>>>16&255,this.buffer[a-2]=i>>>8&255,this.buffer[a-1]=i>>>0&255,r(this.temp,this.state,this.buffer,0,a),this.finished=!0}for(u=0;u<8;u++)e[4*u+0]=this.state[u]>>>24&255,e[4*u+1]=this.state[u]>>>16&255,e[4*u+2]=this.state[u]>>>8&255,e[4*u+3]=this.state[u]>>>0&255;return this},n.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},n.prototype._saveState=function(e){for(var n=0;n<this.state.length;n++)e[n]=this.state[n]},n.prototype._restoreState=function(e,n){for(var r=0;r<this.state.length;r++)this.state[r]=e[r];this.bytesHashed=n,this.finished=!1,this.bufferLength=0},n}();e.Hash=t;var o=function(){function e(e){this.inner=new t,this.outer=new t,this.blockSize=this.inner.blockSize,this.digestLength=this.inner.digestLength;var n=new Uint8Array(this.blockSize);if(e.length>this.blockSize)(new t).update(e).finish(n).clean();else for(var r=0;r<e.length;r++)n[r]=e[r];for(r=0;r<n.length;r++)n[r]^=54;for(this.inner.update(n),r=0;r<n.length;r++)n[r]^=106;for(this.outer.update(n),this.istate=new Uint32Array(8),this.ostate=new Uint32Array(8),this.inner._saveState(this.istate),this.outer._saveState(this.ostate),r=0;r<n.length;r++)n[r]=0}return e.prototype.reset=function(){return this.inner._restoreState(this.istate,this.inner.blockSize),this.outer._restoreState(this.ostate,this.outer.blockSize),this},e.prototype.clean=function(){for(var e=0;e<this.istate.length;e++)this.ostate[e]=this.istate[e]=0;this.inner.clean(),this.outer.clean()},e.prototype.update=function(e){return this.inner.update(e),this},e.prototype.finish=function(e){return this.outer.finished?this.outer.finish(e):(this.inner.finish(e),this.outer.update(e,this.digestLength).finish(e)),this},e.prototype.digest=function(){var e=new Uint8Array(this.digestLength);return this.finish(e),e},e}();function i(e){var n=(new t).update(e),r=n.digest();return n.clean(),r}function a(e,n){var r=new o(e).update(n),t=r.digest();return r.clean(),t}function u(e,n,r,t){var o=t[0];if(0===o)throw new Error("hkdf: cannot expand more");n.reset(),o>1&&n.update(e),r&&n.update(r),n.update(t),n.finish(e),t[0]++}e.HMAC=o,e.hash=i,e.default=i,e.hmac=a;var s=new Uint8Array(e.digestLength);e.hkdf=function(e,n,r,t){void 0===n&&(n=s),void 0===t&&(t=32);for(var i=new Uint8Array([1]),c=a(n,e),f=new o(c),l=new Uint8Array(f.digestLength),m=l.length,h=new Uint8Array(t),p=0;p<t;p++)m===l.length&&(u(l,f,r,i),m=0),h[p]=l[m++];return f.clean(),l.fill(0),i.fill(0),h},e.pbkdf2=function(e,n,r,t){for(var i=new o(e),a=i.digestLength,u=new Uint8Array(4),s=new Uint8Array(a),c=new Uint8Array(a),f=new Uint8Array(t),l=0;l*a<t;l++){var m=l+1;u[0]=m>>>24&255,u[1]=m>>>16&255,u[2]=m>>>8&255,u[3]=m>>>0&255,i.reset(),i.update(n),i.update(u),i.finish(c);for(var h=0;h<a;h++)s[h]=c[h];for(h=2;h<=r;h++){i.reset(),i.update(c).finish(c);for(var p=0;p<a;p++)s[p]^=c[p]}for(h=0;h<a&&l*a+h<t;h++)f[l*a+h]=s[h]}for(l=0;l<a;l++)s[l]=c[l]=0;for(l=0;l<4;l++)u[l]=0;return i.clean(),f}}(i);var a=i.default;for(var u in i)a[u]=i[u];"object"==typeof e.exports?e.exports=a:void 0===(t=function(){return a}.call(i,r,i,e))||(e.exports=t)}()},162:function(e){var n;e.exports=(n=function(e,n){var r=Array.prototype.concat,t=Array.prototype.slice,o=Object.prototype.toString;function i(n,r){var t=n>r?n:r;return e.pow(10,17-~~(e.log(t>0?t:-t)*e.LOG10E))}var a=Array.isArray||function(e){return"[object Array]"===o.call(e)};function u(e){return"[object Function]"===o.call(e)}function s(e){return"number"==typeof e&&e-e==0}function c(){return new c._init(arguments)}function f(){return 0}function l(){return 1}function m(e,n){return e===n?1:0}c.fn=c.prototype,c._init=function(e){if(a(e[0]))if(a(e[0][0])){u(e[1])&&(e[0]=c.map(e[0],e[1]));for(var n=0;n<e[0].length;n++)this[n]=e[0][n];this.length=e[0].length}else this[0]=u(e[1])?c.map(e[0],e[1]):e[0],this.length=1;else if(s(e[0]))this[0]=c.seq.apply(null,e),this.length=1;else{if(e[0]instanceof c)return c(e[0].toArray());this[0]=[],this.length=1}return this},c._init.prototype=c.prototype,c._init.constructor=c,c.utils={calcRdx:i,isArray:a,isFunction:u,isNumber:s,toVector:function(e){return r.apply([],e)}},c._random_fn=e.random,c.setRandom=function(e){if("function"!=typeof e)throw new TypeError("fn is not a function");c._random_fn=e},c.extend=function(e){var n,r;if(1===arguments.length){for(r in e)c[r]=e[r];return this}for(n=1;n<arguments.length;n++)for(r in arguments[n])e[r]=arguments[n][r];return e},c.rows=function(e){return e.length||1},c.cols=function(e){return e[0].length||1},c.dimensions=function(e){return{rows:c.rows(e),cols:c.cols(e)}},c.row=function(e,n){return a(n)?n.map((function(n){return c.row(e,n)})):e[n]},c.rowa=function(e,n){return c.row(e,n)},c.col=function(e,n){if(a(n)){var r=c.arange(e.length).map((function(){return new Array(n.length)}));return n.forEach((function(n,t){c.arange(e.length).forEach((function(o){r[o][t]=e[o][n]}))})),r}for(var t=new Array(e.length),o=0;o<e.length;o++)t[o]=[e[o][n]];return t},c.cola=function(e,n){return c.col(e,n).map((function(e){return e[0]}))},c.diag=function(e){for(var n=c.rows(e),r=new Array(n),t=0;t<n;t++)r[t]=[e[t][t]];return r},c.antidiag=function(e){for(var n=c.rows(e)-1,r=new Array(n),t=0;n>=0;n--,t++)r[t]=[e[t][n]];return r},c.transpose=function(e){var n,r,t,o,i,u=[];for(a(e[0])||(e=[e]),r=e.length,t=e[0].length,i=0;i<t;i++){for(n=new Array(r),o=0;o<r;o++)n[o]=e[o][i];u.push(n)}return 1===u.length?u[0]:u},c.map=function(e,n,r){var t,o,i,u,s;for(a(e[0])||(e=[e]),o=e.length,i=e[0].length,u=r?e:new Array(o),t=0;t<o;t++)for(u[t]||(u[t]=new Array(i)),s=0;s<i;s++)u[t][s]=n(e[t][s],t,s);return 1===u.length?u[0]:u},c.cumreduce=function(e,n,r){var t,o,i,u,s;for(a(e[0])||(e=[e]),o=e.length,i=e[0].length,u=r?e:new Array(o),t=0;t<o;t++)for(u[t]||(u[t]=new Array(i)),i>0&&(u[t][0]=e[t][0]),s=1;s<i;s++)u[t][s]=n(u[t][s-1],e[t][s]);return 1===u.length?u[0]:u},c.alter=function(e,n){return c.map(e,n,!0)},c.create=function(e,n,r){var t,o,i=new Array(e);for(u(n)&&(r=n,n=e),t=0;t<e;t++)for(i[t]=new Array(n),o=0;o<n;o++)i[t][o]=r(t,o);return i},c.zeros=function(e,n){return s(n)||(n=e),c.create(e,n,f)},c.ones=function(e,n){return s(n)||(n=e),c.create(e,n,l)},c.rand=function(e,n){return s(n)||(n=e),c.create(e,n,c._random_fn)},c.identity=function(e,n){return s(n)||(n=e),c.create(e,n,m)},c.symmetric=function(e){var n,r,t=e.length;if(e.length!==e[0].length)return!1;for(n=0;n<t;n++)for(r=0;r<t;r++)if(e[r][n]!==e[n][r])return!1;return!0},c.clear=function(e){return c.alter(e,f)},c.seq=function(e,n,r,t){u(t)||(t=!1);var o,a=[],s=i(e,n),c=(n*s-e*s)/((r-1)*s),f=e;for(o=0;f<=n&&o<r;f=(e*s+c*s*++o)/s)a.push(t?t(f,o):f);return a},c.arange=function(e,r,t){var o,i=[];if(t=t||1,r===n&&(r=e,e=0),e===r||0===t)return[];if(e<r&&t<0)return[];if(e>r&&t>0)return[];if(t>0)for(o=e;o<r;o+=t)i.push(o);else for(o=e;o>r;o+=t)i.push(o);return i},c.slice=function(){function e(e,r,t,o){var i,a=[],u=e.length;if(r===n&&t===n&&o===n)return c.copy(e);if(o=o||1,(r=(r=r||0)>=0?r:u+r)===(t=(t=t||e.length)>=0?t:u+t)||0===o)return[];if(r<t&&o<0)return[];if(r>t&&o>0)return[];if(o>0)for(i=r;i<t;i+=o)a.push(e[i]);else for(i=r;i>t;i+=o)a.push(e[i]);return a}return function(n,r){var t,o;return s((r=r||{}).row)?s(r.col)?n[r.row][r.col]:e(c.rowa(n,r.row),(t=r.col||{}).start,t.end,t.step):s(r.col)?e(c.cola(n,r.col),(o=r.row||{}).start,o.end,o.step):(o=r.row||{},t=r.col||{},e(n,o.start,o.end,o.step).map((function(n){return e(n,t.start,t.end,t.step)})))}}(),c.sliceAssign=function(r,t,o){var i,a;if(s(t.row)){if(s(t.col))return r[t.row][t.col]=o;t.col=t.col||{},t.col.start=t.col.start||0,t.col.end=t.col.end||r[0].length,t.col.step=t.col.step||1,i=c.arange(t.col.start,e.min(r.length,t.col.end),t.col.step);var u=t.row;return i.forEach((function(e,n){r[u][e]=o[n]})),r}if(s(t.col)){t.row=t.row||{},t.row.start=t.row.start||0,t.row.end=t.row.end||r.length,t.row.step=t.row.step||1,a=c.arange(t.row.start,e.min(r[0].length,t.row.end),t.row.step);var f=t.col;return a.forEach((function(e,n){r[e][f]=o[n]})),r}return o[0].length===n&&(o=[o]),t.row.start=t.row.start||0,t.row.end=t.row.end||r.length,t.row.step=t.row.step||1,t.col.start=t.col.start||0,t.col.end=t.col.end||r[0].length,t.col.step=t.col.step||1,a=c.arange(t.row.start,e.min(r.length,t.row.end),t.row.step),i=c.arange(t.col.start,e.min(r[0].length,t.col.end),t.col.step),a.forEach((function(e,n){i.forEach((function(t,i){r[e][t]=o[n][i]}))})),r},c.diagonal=function(e){var n=c.zeros(e.length,e.length);return e.forEach((function(e,r){n[r][r]=e})),n},c.copy=function(e){return e.map((function(e){return s(e)?e:e.map((function(e){return e}))}))};var h=c.prototype;return h.length=0,h.push=Array.prototype.push,h.sort=Array.prototype.sort,h.splice=Array.prototype.splice,h.slice=Array.prototype.slice,h.toArray=function(){return this.length>1?t.call(this):t.call(this)[0]},h.map=function(e,n){return c(c.map(this,e,n))},h.cumreduce=function(e,n){return c(c.cumreduce(this,e,n))},h.alter=function(e){return c.alter(this,e),this},function(e){for(var n=0;n<e.length;n++)!function(e){h[e]=function(n){var r,t=this;return n?(setTimeout((function(){n.call(t,h[e].call(t))})),this):(r=c[e](this),a(r)?c(r):r)}}(e[n])}("transpose clear symmetric rows cols dimensions diag antidiag".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){h[e]=function(n,r){var t=this;return r?(setTimeout((function(){r.call(t,h[e].call(t,n))})),this):c(c[e](this,n))}}(e[n])}("row col".split(" ")),function(e){for(var n=0;n<e.length;n++)!function(e){h[e]=function(){return c(c[e].apply(null,arguments))}}(e[n])}("create zeros ones rand identity".split(" ")),c}(Math),function(e,n){var r=e.utils.isFunction;function t(e,n){return e-n}function o(e,r,t){return n.max(r,n.min(e,t))}e.sum=function(e){for(var n=0,r=e.length;--r>=0;)n+=e[r];return n},e.sumsqrd=function(e){for(var n=0,r=e.length;--r>=0;)n+=e[r]*e[r];return n},e.sumsqerr=function(n){for(var r,t=e.mean(n),o=0,i=n.length;--i>=0;)o+=(r=n[i]-t)*r;return o},e.sumrow=function(e){for(var n=0,r=e.length;--r>=0;)n+=e[r];return n},e.product=function(e){for(var n=1,r=e.length;--r>=0;)n*=e[r];return n},e.min=function(e){for(var n=e[0],r=0;++r<e.length;)e[r]<n&&(n=e[r]);return n},e.max=function(e){for(var n=e[0],r=0;++r<e.length;)e[r]>n&&(n=e[r]);return n},e.unique=function(e){for(var n={},r=[],t=0;t<e.length;t++)n[e[t]]||(n[e[t]]=!0,r.push(e[t]));return r},e.mean=function(n){return e.sum(n)/n.length},e.meansqerr=function(n){return e.sumsqerr(n)/n.length},e.geomean=function(r){var t=r.map(n.log),o=e.mean(t);return n.exp(o)},e.median=function(e){var n=e.length,r=e.slice().sort(t);return 1&n?r[n/2|0]:(r[n/2-1]+r[n/2])/2},e.cumsum=function(n){return e.cumreduce(n,(function(e,n){return e+n}))},e.cumprod=function(n){return e.cumreduce(n,(function(e,n){return e*n}))},e.diff=function(e){var n,r=[],t=e.length;for(n=1;n<t;n++)r.push(e[n]-e[n-1]);return r},e.rank=function(e){var n,r=[],o={};for(n=0;n<e.length;n++)o[s=e[n]]?o[s]++:(o[s]=1,r.push(s));var i=r.sort(t),a={},u=1;for(n=0;n<i.length;n++){var s,c=o[s=i[n]],f=(u+(u+c-1))/2;a[s]=f,u+=c}return e.map((function(e){return a[e]}))},e.mode=function(e){var n,r=e.length,o=e.slice().sort(t),i=1,a=0,u=0,s=[];for(n=0;n<r;n++)o[n]===o[n+1]?i++:(i>a?(s=[o[n]],a=i,u=0):i===a&&(s.push(o[n]),u++),i=1);return 0===u?s[0]:s},e.range=function(n){return e.max(n)-e.min(n)},e.variance=function(n,r){return e.sumsqerr(n)/(n.length-(r?1:0))},e.pooledvariance=function(n){return n.reduce((function(n,r){return n+e.sumsqerr(r)}),0)/(n.reduce((function(e,n){return e+n.length}),0)-n.length)},e.deviation=function(n){for(var r=e.mean(n),t=n.length,o=new Array(t),i=0;i<t;i++)o[i]=n[i]-r;return o},e.stdev=function(r,t){return n.sqrt(e.variance(r,t))},e.pooledstdev=function(r){return n.sqrt(e.pooledvariance(r))},e.meandev=function(r){for(var t=e.mean(r),o=[],i=r.length-1;i>=0;i--)o.push(n.abs(r[i]-t));return e.mean(o)},e.meddev=function(r){for(var t=e.median(r),o=[],i=r.length-1;i>=0;i--)o.push(n.abs(r[i]-t));return e.median(o)},e.coeffvar=function(n){return e.stdev(n)/e.mean(n)},e.quartiles=function(e){var r=e.length,o=e.slice().sort(t);return[o[n.round(r/4)-1],o[n.round(r/2)-1],o[n.round(3*r/4)-1]]},e.quantiles=function(e,r,i,a){var u,s,c,f,l,m=e.slice().sort(t),h=[r.length],p=e.length;for(void 0===i&&(i=3/8),void 0===a&&(a=3/8),u=0;u<r.length;u++)c=p*(s=r[u])+(i+s*(1-i-a)),f=n.floor(o(c,1,p-1)),l=o(c-f,0,1),h[u]=(1-l)*m[f-1]+l*m[f];return h},e.percentile=function(e,n,r){var o=e.slice().sort(t),i=n*(o.length+(r?1:-1))+(r?0:1),a=parseInt(i),u=i-a;return a+1<o.length?o[a-1]+u*(o[a]-o[a-1]):o[a-1]},e.percentileOfScore=function(e,n,r){var t,o,i=0,a=e.length,u=!1;for("strict"===r&&(u=!0),o=0;o<a;o++)t=e[o],(u&&t<n||!u&&t<=n)&&i++;return i/a},e.histogram=function(r,t){t=t||4;var o,i=e.min(r),a=(e.max(r)-i)/t,u=r.length,s=[];for(o=0;o<t;o++)s[o]=0;for(o=0;o<u;o++)s[n.min(n.floor((r[o]-i)/a),t-1)]+=1;return s},e.covariance=function(n,r){var t,o=e.mean(n),i=e.mean(r),a=n.length,u=new Array(a);for(t=0;t<a;t++)u[t]=(n[t]-o)*(r[t]-i);return e.sum(u)/(a-1)},e.corrcoeff=function(n,r){return e.covariance(n,r)/e.stdev(n,1)/e.stdev(r,1)},e.spearmancoeff=function(n,r){return n=e.rank(n),r=e.rank(r),e.corrcoeff(n,r)},e.stanMoment=function(r,t){for(var o=e.mean(r),i=e.stdev(r),a=r.length,u=0,s=0;s<a;s++)u+=n.pow((r[s]-o)/i,t);return u/r.length},e.skewness=function(n){return e.stanMoment(n,3)},e.kurtosis=function(n){return e.stanMoment(n,4)-3};var i=e.prototype;!function(n){for(var t=0;t<n.length;t++)!function(n){i[n]=function(t,o){var a=[],u=0,s=this;if(r(t)&&(o=t,t=!1),o)return setTimeout((function(){o.call(s,i[n].call(s,t))})),this;if(this.length>1){for(s=!0===t?this:this.transpose();u<s.length;u++)a[u]=e[n](s[u]);return a}return e[n](this[0],t)}}(n[t])}("cumsum cumprod".split(" ")),function(n){for(var t=0;t<n.length;t++)!function(n){i[n]=function(t,o){var a=[],u=0,s=this;if(r(t)&&(o=t,t=!1),o)return setTimeout((function(){o.call(s,i[n].call(s,t))})),this;if(this.length>1){for("sumrow"!==n&&(s=!0===t?this:this.transpose());u<s.length;u++)a[u]=e[n](s[u]);return!0===t?e[n](e.utils.toVector(a)):a}return e[n](this[0],t)}}(n[t])}("sum sumsqrd sumsqerr sumrow product min max unique mean meansqerr geomean median diff rank mode range variance deviation stdev meandev meddev coeffvar quartiles histogram skewness kurtosis".split(" ")),function(n){for(var t=0;t<n.length;t++)!function(n){i[n]=function(){var t,o=[],a=0,u=this,s=Array.prototype.slice.call(arguments);if(r(s[s.length-1])){t=s[s.length-1];var c=s.slice(0,s.length-1);return setTimeout((function(){t.call(u,i[n].apply(u,c))})),this}t=void 0;var f=function(r){return e[n].apply(u,[r].concat(s))};if(this.length>1){for(u=u.transpose();a<u.length;a++)o[a]=f(u[a]);return o}return f(this[0])}}(n[t])}("quantiles percentileOfScore".split(" "))}(n,Math),function(e,n){e.gammaln=function(e){var r,t,o,i=0,a=[76.18009172947146,-86.50532032941678,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],u=1.000000000190015;for(o=(t=r=e)+5.5,o-=(r+.5)*n.log(o);i<6;i++)u+=a[i]/++t;return n.log(2.5066282746310007*u/r)-o},e.loggam=function(e){var r,t,o,i,a,u,s,c=[.08333333333333333,-.002777777777777778,.0007936507936507937,-.0005952380952380952,.0008417508417508418,-.001917526917526918,.00641025641025641,-.02955065359477124,.1796443723688307,-1.3924322169059];if(r=e,s=0,1==e||2==e)return 0;for(e<=7&&(r=e+(s=n.floor(7-e))),t=1/(r*r),o=2*n.PI,a=c[9],u=8;u>=0;u--)a*=t,a+=c[u];if(i=a/r+.5*n.log(o)+(r-.5)*n.log(r)-r,e<=7)for(u=1;u<=s;u++)i-=n.log(r-1),r-=1;return i},e.gammafn=function(e){var r,t,o,i,a=[-1.716185138865495,24.76565080557592,-379.80425647094563,629.3311553128184,866.9662027904133,-31451.272968848367,-36144.413418691176,66456.14382024054],u=[-30.8402300119739,315.35062697960416,-1015.1563674902192,-3107.771671572311,22538.11842098015,4755.846277527881,-134659.9598649693,-115132.2596755535],s=!1,c=0,f=0,l=0,m=e;if(e>171.6243769536076)return 1/0;if(m<=0){if(!(i=m%1+36e-17))return 1/0;s=(1&m?-1:1)*n.PI/n.sin(n.PI*i),m=1-m}for(o=m,t=m<1?m++:(m-=c=(0|m)-1)-1,r=0;r<8;++r)l=(l+a[r])*t,f=f*t+u[r];if(i=l/f+1,o<m)i/=o;else if(o>m)for(r=0;r<c;++r)i*=m,m++;return s&&(i=s/i),i},e.gammap=function(n,r){return e.lowRegGamma(n,r)*e.gammafn(n)},e.lowRegGamma=function(r,t){var o,i=e.gammaln(r),a=r,u=1/r,s=u,c=t+1-r,f=1/1e-30,l=1/c,m=l,h=1,p=-~(8.5*n.log(r>=1?r:1/r)+.4*r+17);if(t<0||r<=0)return NaN;if(t<r+1){for(;h<=p;h++)u+=s*=t/++a;return u*n.exp(-t+r*n.log(t)-i)}for(;h<=p;h++)m*=(l=1/(l=(o=-h*(h-r))*l+(c+=2)))*(f=c+o/f);return 1-m*n.exp(-t+r*n.log(t)-i)},e.factorialln=function(n){return n<0?NaN:e.gammaln(n+1)},e.factorial=function(n){return n<0?NaN:e.gammafn(n+1)},e.combination=function(r,t){return r>170||t>170?n.exp(e.combinationln(r,t)):e.factorial(r)/e.factorial(t)/e.factorial(r-t)},e.combinationln=function(n,r){return e.factorialln(n)-e.factorialln(r)-e.factorialln(n-r)},e.permutation=function(n,r){return e.factorial(n)/e.factorial(n-r)},e.betafn=function(r,t){if(!(r<=0||t<=0))return r+t>170?n.exp(e.betaln(r,t)):e.gammafn(r)*e.gammafn(t)/e.gammafn(r+t)},e.betaln=function(n,r){return e.gammaln(n)+e.gammaln(r)-e.gammaln(n+r)},e.betacf=function(e,r,t){var o,i,a,u,s=1e-30,c=1,f=r+t,l=r+1,m=r-1,h=1,p=1-f*e/l;for(n.abs(p)<s&&(p=s),u=p=1/p;c<=100&&(p=1+(i=c*(t-c)*e/((m+(o=2*c))*(r+o)))*p,n.abs(p)<s&&(p=s),h=1+i/h,n.abs(h)<s&&(h=s),u*=(p=1/p)*h,p=1+(i=-(r+c)*(f+c)*e/((r+o)*(l+o)))*p,n.abs(p)<s&&(p=s),h=1+i/h,n.abs(h)<s&&(h=s),u*=a=(p=1/p)*h,!(n.abs(a-1)<3e-7));c++);return u},e.gammapinv=function(r,t){var o,i,a,u,s,c,f=0,l=t-1,m=e.gammaln(t);if(r>=1)return n.max(100,t+100*n.sqrt(t));if(r<=0)return 0;for(t>1?(s=n.log(l),c=n.exp(l*(s-1)-m),u=r<.5?r:1-r,o=(2.30753+.27061*(i=n.sqrt(-2*n.log(u))))/(1+i*(.99229+.04481*i))-i,r<.5&&(o=-o),o=n.max(.001,t*n.pow(1-1/(9*t)-o/(3*n.sqrt(t)),3))):o=r<(i=1-t*(.253+.12*t))?n.pow(r/i,1/t):1-n.log(1-(r-i)/(1-i));f<12;f++){if(o<=0)return 0;if((o-=i=(a=(e.lowRegGamma(t,o)-r)/(i=t>1?c*n.exp(-(o-l)+l*(n.log(o)-s)):n.exp(-o+l*n.log(o)-m)))/(1-.5*n.min(1,a*((t-1)/o-1))))<=0&&(o=.5*(o+i)),n.abs(i)<1e-8*o)break}return o},e.erf=function(e){var r,t,o,i,a=[-1.3026537197817094,.6419697923564902,.019476473204185836,-.00956151478680863,-.000946595344482036,.000366839497852761,42523324806907e-18,-20278578112534e-18,-1624290004647e-18,130365583558e-17,1.5626441722e-8,-8.5238095915e-8,6.529054439e-9,5.059343495e-9,-9.91364156e-10,-2.27365122e-10,96467911e-18,2394038e-18,-6886027e-18,894487e-18,313092e-18,-112708e-18,381e-18,7106e-18,-1523e-18,-94e-18,121e-18,-28e-18],u=a.length-1,s=!1,c=0,f=0;for(e<0&&(e=-e,s=!0),t=4*(r=2/(2+e))-2;u>0;u--)o=c,c=t*c-f+a[u],f=o;return i=r*n.exp(-e*e+.5*(a[0]+t*c)-f),s?i-1:1-i},e.erfc=function(n){return 1-e.erf(n)},e.erfcinv=function(r){var t,o,i,a,u=0;if(r>=2)return-100;if(r<=0)return 100;for(a=r<1?r:2-r,t=-.70711*((2.30753+.27061*(i=n.sqrt(-2*n.log(a/2))))/(1+i*(.99229+.04481*i))-i);u<2;u++)t+=(o=e.erfc(t)-a)/(1.1283791670955126*n.exp(-t*t)-t*o);return r<1?t:-t},e.ibetainv=function(r,t,o){var i,a,u,s,c,f,l,m,h,p,d=t-1,y=o-1,g=0;if(r<=0)return 0;if(r>=1)return 1;for(t>=1&&o>=1?(u=r<.5?r:1-r,f=(2.30753+.27061*(s=n.sqrt(-2*n.log(u))))/(1+s*(.99229+.04481*s))-s,r<.5&&(f=-f),l=(f*f-3)/6,m=2/(1/(2*t-1)+1/(2*o-1)),h=f*n.sqrt(l+m)/m-(1/(2*o-1)-1/(2*t-1))*(l+5/6-2/(3*m)),f=t/(t+o*n.exp(2*h))):(i=n.log(t/(t+o)),a=n.log(o/(t+o)),f=r<(s=n.exp(t*i)/t)/(h=s+(c=n.exp(o*a)/o))?n.pow(t*h*r,1/t):1-n.pow(o*h*(1-r),1/o)),p=-e.gammaln(t)-e.gammaln(o)+e.gammaln(t+o);g<10;g++){if(0===f||1===f)return f;if((f-=s=(c=(e.ibeta(f,t,o)-r)/(s=n.exp(d*n.log(f)+y*n.log(1-f)+p)))/(1-.5*n.min(1,c*(d/f-y/(1-f)))))<=0&&(f=.5*(f+s)),f>=1&&(f=.5*(f+s+1)),n.abs(s)<1e-8*f&&g>0)break}return f},e.ibeta=function(r,t,o){var i=0===r||1===r?0:n.exp(e.gammaln(t+o)-e.gammaln(t)-e.gammaln(o)+t*n.log(r)+o*n.log(1-r));return!(r<0||r>1)&&(r<(t+1)/(t+o+2)?i*e.betacf(r,t,o)/t:1-i*e.betacf(1-r,o,t)/o)},e.randn=function(r,t){var o,i,a,u,s;if(t||(t=r),r)return e.create(r,t,(function(){return e.randn()}));do{o=e._random_fn(),i=1.7156*(e._random_fn()-.5),s=(a=o-.449871)*a+(u=n.abs(i)+.386595)*(.196*u-.25472*a)}while(s>.27597&&(s>.27846||i*i>-4*n.log(o)*o*o));return i/o},e.randg=function(r,t,o){var i,a,u,s,c,f,l=r;if(o||(o=t),r||(r=1),t)return(f=e.zeros(t,o)).alter((function(){return e.randg(r)})),f;r<1&&(r+=1),i=r-1/3,a=1/n.sqrt(9*i);do{do{s=1+a*(c=e.randn())}while(s<=0);s*=s*s,u=e._random_fn()}while(u>1-.331*n.pow(c,4)&&n.log(u)>.5*c*c+i*(1-s+n.log(s)));if(r==l)return i*s;do{u=e._random_fn()}while(0===u);return n.pow(u,1/l)*i*s},function(n){for(var r=0;r<n.length;r++)!function(n){e.fn[n]=function(){return e(e.map(this,(function(r){return e[n](r)})))}}(n[r])}("gammaln gammafn factorial factorialln".split(" ")),function(n){for(var r=0;r<n.length;r++)!function(n){e.fn[n]=function(){return e(e[n].apply(null,arguments))}}(n[r])}("randn".split(" "))}(n,Math),function(e,n){function r(e,r,t,o){for(var i,a=0,u=1,s=1,c=1,f=0,l=0;n.abs((s-l)/s)>o;)l=s,u=c+(i=-(r+f)*(r+t+f)*e/(r+2*f)/(r+2*f+1))*u,s=(a=s+i*a)+(i=(f+=1)*(t-f)*e/(r+2*f-1)/(r+2*f))*s,a/=c=u+i*c,u/=c,s/=c,c=1;return s/r}function t(r,t,o){var i=[.9815606342467192,.9041172563704749,.7699026741943047,.5873179542866175,.3678314989981802,.1252334085114689],a=[.04717533638651183,.10693932599531843,.16007832854334622,.20316742672306592,.2334925365383548,.24914704581340277],u=.5*r;if(u>=8)return 1;var s,c=2*e.normal.cdf(u,0,1,1,0)-1;c=c>=n.exp(-50/o)?n.pow(c,o):0;for(var f=u,l=(8-u)/(s=r>3?2:3),m=f+l,h=0,p=o-1,d=1;d<=s;d++){for(var y=0,g=.5*(m+f),x=.5*(m-f),v=1;v<=12;v++){var w,b=g+x*(6<v?i[(w=12-v+1)-1]:-i[(w=v)-1]),T=b*b;if(T>60)break;var C=2*e.normal.cdf(b,0,1,1,0)*.5-2*e.normal.cdf(b,r,1,1,0)*.5;C>=n.exp(-30/p)&&(y+=C=a[w-1]*n.exp(-.5*T)*n.pow(C,p))}h+=y*=2*x*o/n.sqrt(2*n.PI),f=m,m+=l}return(c+=h)<=n.exp(-30/t)?0:(c=n.pow(c,t))>=1?1:c}!function(n){for(var r=0;r<n.length;r++)!function(n){e[n]=function e(n,r,t){return this instanceof e?(this._a=n,this._b=r,this._c=t,this):new e(n,r,t)},e.fn[n]=function(r,t,o){var i=e[n](r,t,o);return i.data=this,i},e[n].prototype.sample=function(r){var t=this._a,o=this._b,i=this._c;return r?e.alter(r,(function(){return e[n].sample(t,o,i)})):e[n].sample(t,o,i)},function(r){for(var t=0;t<r.length;t++)!function(r){e[n].prototype[r]=function(t){var o=this._a,i=this._b,a=this._c;return t||0===t||(t=this.data),"number"!=typeof t?e.fn.map.call(t,(function(t){return e[n][r](t,o,i,a)})):e[n][r](t,o,i,a)}}(r[t])}("pdf cdf inv".split(" ")),function(r){for(var t=0;t<r.length;t++)!function(r){e[n].prototype[r]=function(){return e[n][r](this._a,this._b,this._c)}}(r[t])}("mean median mode variance".split(" "))}(n[r])}("beta centralF cauchy chisquare exponential gamma invgamma kumaraswamy laplace lognormal noncentralt normal pareto studentt weibull uniform binomial negbin hypgeom poisson triangular tukey arcsine".split(" ")),e.extend(e.beta,{pdf:function(r,t,o){return r>1||r<0?0:1==t&&1==o?1:t<512&&o<512?n.pow(r,t-1)*n.pow(1-r,o-1)/e.betafn(t,o):n.exp((t-1)*n.log(r)+(o-1)*n.log(1-r)-e.betaln(t,o))},cdf:function(n,r,t){return n>1||n<0?1*(n>1):e.ibeta(n,r,t)},inv:function(n,r,t){return e.ibetainv(n,r,t)},mean:function(e,n){return e/(e+n)},median:function(n,r){return e.ibetainv(.5,n,r)},mode:function(e,n){return(e-1)/(e+n-2)},sample:function(n,r){var t=e.randg(n);return t/(t+e.randg(r))},variance:function(e,r){return e*r/(n.pow(e+r,2)*(e+r+1))}}),e.extend(e.centralF,{pdf:function(r,t,o){var i;return r<0?0:t<=2?0===r&&t<2?1/0:0===r&&2===t?1:1/e.betafn(t/2,o/2)*n.pow(t/o,t/2)*n.pow(r,t/2-1)*n.pow(1+t/o*r,-(t+o)/2):(i=t*r/(o+r*t),t*(o/(o+r*t))/2*e.binomial.pdf((t-2)/2,(t+o-2)/2,i))},cdf:function(n,r,t){return n<0?0:e.ibeta(r*n/(r*n+t),r/2,t/2)},inv:function(n,r,t){return t/(r*(1/e.ibetainv(n,r/2,t/2)-1))},mean:function(e,n){return n>2?n/(n-2):void 0},mode:function(e,n){return e>2?n*(e-2)/(e*(n+2)):void 0},sample:function(n,r){return 2*e.randg(n/2)/n/(2*e.randg(r/2)/r)},variance:function(e,n){if(!(n<=4))return 2*n*n*(e+n-2)/(e*(n-2)*(n-2)*(n-4))}}),e.extend(e.cauchy,{pdf:function(e,r,t){return t<0?0:t/(n.pow(e-r,2)+n.pow(t,2))/n.PI},cdf:function(e,r,t){return n.atan((e-r)/t)/n.PI+.5},inv:function(e,r,t){return r+t*n.tan(n.PI*(e-.5))},median:function(e){return e},mode:function(e){return e},sample:function(r,t){return e.randn()*n.sqrt(1/(2*e.randg(.5)))*t+r}}),e.extend(e.chisquare,{pdf:function(r,t){return r<0?0:0===r&&2===t?.5:n.exp((t/2-1)*n.log(r)-r/2-t/2*n.log(2)-e.gammaln(t/2))},cdf:function(n,r){return n<0?0:e.lowRegGamma(r/2,n/2)},inv:function(n,r){return 2*e.gammapinv(n,.5*r)},mean:function(e){return e},median:function(e){return e*n.pow(1-2/(9*e),3)},mode:function(e){return e-2>0?e-2:0},sample:function(n){return 2*e.randg(n/2)},variance:function(e){return 2*e}}),e.extend(e.exponential,{pdf:function(e,r){return e<0?0:r*n.exp(-r*e)},cdf:function(e,r){return e<0?0:1-n.exp(-r*e)},inv:function(e,r){return-n.log(1-e)/r},mean:function(e){return 1/e},median:function(e){return 1/e*n.log(2)},mode:function(){return 0},sample:function(r){return-1/r*n.log(e._random_fn())},variance:function(e){return n.pow(e,-2)}}),e.extend(e.gamma,{pdf:function(r,t,o){return r<0?0:0===r&&1===t?1/o:n.exp((t-1)*n.log(r)-r/o-e.gammaln(t)-t*n.log(o))},cdf:function(n,r,t){return n<0?0:e.lowRegGamma(r,n/t)},inv:function(n,r,t){return e.gammapinv(n,r)*t},mean:function(e,n){return e*n},mode:function(e,n){if(e>1)return(e-1)*n},sample:function(n,r){return e.randg(n)*r},variance:function(e,n){return e*n*n}}),e.extend(e.invgamma,{pdf:function(r,t,o){return r<=0?0:n.exp(-(t+1)*n.log(r)-o/r-e.gammaln(t)+t*n.log(o))},cdf:function(n,r,t){return n<=0?0:1-e.lowRegGamma(r,t/n)},inv:function(n,r,t){return t/e.gammapinv(1-n,r)},mean:function(e,n){return e>1?n/(e-1):void 0},mode:function(e,n){return n/(e+1)},sample:function(n,r){return r/e.randg(n)},variance:function(e,n){if(!(e<=2))return n*n/((e-1)*(e-1)*(e-2))}}),e.extend(e.kumaraswamy,{pdf:function(e,r,t){return 0===e&&1===r?t:1===e&&1===t?r:n.exp(n.log(r)+n.log(t)+(r-1)*n.log(e)+(t-1)*n.log(1-n.pow(e,r)))},cdf:function(e,r,t){return e<0?0:e>1?1:1-n.pow(1-n.pow(e,r),t)},inv:function(e,r,t){return n.pow(1-n.pow(1-e,1/t),1/r)},mean:function(n,r){return r*e.gammafn(1+1/n)*e.gammafn(r)/e.gammafn(1+1/n+r)},median:function(e,r){return n.pow(1-n.pow(2,-1/r),1/e)},mode:function(e,r){if(e>=1&&r>=1&&1!==e&&1!==r)return n.pow((e-1)/(e*r-1),1/e)},variance:function(){throw new Error("variance not yet implemented")}}),e.extend(e.lognormal,{pdf:function(e,r,t){return e<=0?0:n.exp(-n.log(e)-.5*n.log(2*n.PI)-n.log(t)-n.pow(n.log(e)-r,2)/(2*t*t))},cdf:function(r,t,o){return r<0?0:.5+.5*e.erf((n.log(r)-t)/n.sqrt(2*o*o))},inv:function(r,t,o){return n.exp(-1.4142135623730951*o*e.erfcinv(2*r)+t)},mean:function(e,r){return n.exp(e+r*r/2)},median:function(e){return n.exp(e)},mode:function(e,r){return n.exp(e-r*r)},sample:function(r,t){return n.exp(e.randn()*t+r)},variance:function(e,r){return(n.exp(r*r)-1)*n.exp(2*e+r*r)}}),e.extend(e.noncentralt,{pdf:function(r,t,o){return n.abs(o)<1e-14?e.studentt.pdf(r,t):n.abs(r)<1e-14?n.exp(e.gammaln((t+1)/2)-o*o/2-.5*n.log(n.PI*t)-e.gammaln(t/2)):t/r*(e.noncentralt.cdf(r*n.sqrt(1+2/t),t+2,o)-e.noncentralt.cdf(r,t,o))},cdf:function(r,t,o){var i=1e-14;if(n.abs(o)<i)return e.studentt.cdf(r,t);var a=!1;r<0&&(a=!0,o=-o);for(var u=e.normal.cdf(-o,0,1),s=i+1,c=s,f=r*r/(r*r+t),l=0,m=n.exp(-o*o/2),h=n.exp(-o*o/2-.5*n.log(2)-e.gammaln(1.5))*o;l<200||c>i||s>i;)c=s,l>0&&(m*=o*o/(2*l),h*=o*o/(2*(l+.5))),u+=.5*(s=m*e.beta.cdf(f,l+.5,t/2)+h*e.beta.cdf(f,l+1,t/2)),l++;return a?1-u:u}}),e.extend(e.normal,{pdf:function(e,r,t){return n.exp(-.5*n.log(2*n.PI)-n.log(t)-n.pow(e-r,2)/(2*t*t))},cdf:function(r,t,o){return.5*(1+e.erf((r-t)/n.sqrt(2*o*o)))},inv:function(n,r,t){return-1.4142135623730951*t*e.erfcinv(2*n)+r},mean:function(e){return e},median:function(e){return e},mode:function(e){return e},sample:function(n,r){return e.randn()*r+n},variance:function(e,n){return n*n}}),e.extend(e.pareto,{pdf:function(e,r,t){return e<r?0:t*n.pow(r,t)/n.pow(e,t+1)},cdf:function(e,r,t){return e<r?0:1-n.pow(r/e,t)},inv:function(e,r,t){return r/n.pow(1-e,1/t)},mean:function(e,r){if(!(r<=1))return r*n.pow(e,r)/(r-1)},median:function(e,r){return e*(r*n.SQRT2)},mode:function(e){return e},variance:function(e,r){if(!(r<=2))return e*e*r/(n.pow(r-1,2)*(r-2))}}),e.extend(e.studentt,{pdf:function(r,t){return t=t>1e100?1e100:t,1/(n.sqrt(t)*e.betafn(.5,t/2))*n.pow(1+r*r/t,-(t+1)/2)},cdf:function(r,t){var o=t/2;return e.ibeta((r+n.sqrt(r*r+t))/(2*n.sqrt(r*r+t)),o,o)},inv:function(r,t){var o=e.ibetainv(2*n.min(r,1-r),.5*t,.5);return o=n.sqrt(t*(1-o)/o),r>.5?o:-o},mean:function(e){return e>1?0:void 0},median:function(){return 0},mode:function(){return 0},sample:function(r){return e.randn()*n.sqrt(r/(2*e.randg(r/2)))},variance:function(e){return e>2?e/(e-2):e>1?1/0:void 0}}),e.extend(e.weibull,{pdf:function(e,r,t){return e<0||r<0||t<0?0:t/r*n.pow(e/r,t-1)*n.exp(-n.pow(e/r,t))},cdf:function(e,r,t){return e<0?0:1-n.exp(-n.pow(e/r,t))},inv:function(e,r,t){return r*n.pow(-n.log(1-e),1/t)},mean:function(n,r){return n*e.gammafn(1+1/r)},median:function(e,r){return e*n.pow(n.log(2),1/r)},mode:function(e,r){return r<=1?0:e*n.pow((r-1)/r,1/r)},sample:function(r,t){return r*n.pow(-n.log(e._random_fn()),1/t)},variance:function(r,t){return r*r*e.gammafn(1+2/t)-n.pow(e.weibull.mean(r,t),2)}}),e.extend(e.uniform,{pdf:function(e,n,r){return e<n||e>r?0:1/(r-n)},cdf:function(e,n,r){return e<n?0:e<r?(e-n)/(r-n):1},inv:function(e,n,r){return n+e*(r-n)},mean:function(e,n){return.5*(e+n)},median:function(n,r){return e.mean(n,r)},mode:function(){throw new Error("mode is not yet implemented")},sample:function(n,r){return n/2+r/2+(r/2-n/2)*(2*e._random_fn()-1)},variance:function(e,r){return n.pow(r-e,2)/12}}),e.extend(e.binomial,{pdf:function(r,t,o){return 0===o||1===o?t*o===r?1:0:e.combination(t,r)*n.pow(o,r)*n.pow(1-o,t-r)},cdf:function(t,o,i){var a,u=1e-10;if(t<0)return 0;if(t>=o)return 1;if(i<0||i>1||o<=0)return NaN;var s=i,c=(t=n.floor(t))+1,f=o-t,l=c+f,m=n.exp(e.gammaln(l)-e.gammaln(f)-e.gammaln(c)+c*n.log(s)+f*n.log(1-s));return a=s<(c+1)/(l+2)?m*r(s,c,f,u):1-m*r(1-s,f,c,u),n.round(1/u*(1-a))/(1/u)}}),e.extend(e.negbin,{pdf:function(r,t,o){return r===r>>>0&&(r<0?0:e.combination(r+t-1,t-1)*n.pow(1-o,r)*n.pow(o,t))},cdf:function(n,r,t){var o=0,i=0;if(n<0)return 0;for(;i<=n;i++)o+=e.negbin.pdf(i,r,t);return o}}),e.extend(e.hypgeom,{pdf:function(r,t,o,i){if(r!=r|0)return!1;if(r<0||r<o-(t-i))return 0;if(r>i||r>o)return 0;if(2*o>t)return 2*i>t?e.hypgeom.pdf(t-o-i+r,t,t-o,t-i):e.hypgeom.pdf(i-r,t,t-o,i);if(2*i>t)return e.hypgeom.pdf(o-r,t,o,t-i);if(o<i)return e.hypgeom.pdf(r,t,i,o);for(var a=1,u=0,s=0;s<r;s++){for(;a>1&&u<i;)a*=1-o/(t-u),u++;a*=(i-s)*(o-s)/((s+1)*(t-o-i+s+1))}for(;u<i;u++)a*=1-o/(t-u);return n.min(1,n.max(0,a))},cdf:function(r,t,o,i){if(r<0||r<o-(t-i))return 0;if(r>=i||r>=o)return 1;if(2*o>t)return 2*i>t?e.hypgeom.cdf(t-o-i+r,t,t-o,t-i):1-e.hypgeom.cdf(i-r-1,t,t-o,i);if(2*i>t)return 1-e.hypgeom.cdf(o-r-1,t,o,t-i);if(o<i)return e.hypgeom.cdf(r,t,i,o);for(var a=1,u=1,s=0,c=0;c<r;c++){for(;a>1&&s<i;){var f=1-o/(t-s);u*=f,a*=f,s++}a+=u*=(i-c)*(o-c)/((c+1)*(t-o-i+c+1))}for(;s<i;s++)a*=1-o/(t-s);return n.min(1,n.max(0,a))}}),e.extend(e.poisson,{pdf:function(r,t){return t<0||r%1!=0||r<0?0:n.pow(t,r)*n.exp(-t)/e.factorial(r)},cdf:function(n,r){var t=[],o=0;if(n<0)return 0;for(;o<=n;o++)t.push(e.poisson.pdf(o,r));return e.sum(t)},mean:function(e){return e},variance:function(e){return e},sampleSmall:function(r){var t=1,o=0,i=n.exp(-r);do{o++,t*=e._random_fn()}while(t>i);return o-1},sampleLarge:function(r){var t,o,i,a,u,s,c,f,l,m,h=r;for(a=n.sqrt(h),u=n.log(h),s=.02483*(c=.931+2.53*a)-.059,f=1.1239+1.1328/(c-3.4),l=.9277-3.6224/(c-2);;){if(o=n.random()-.5,i=n.random(),m=.5-n.abs(o),t=n.floor((2*s/m+c)*o+h+.43),m>=.07&&i<=l)return t;if(!(t<0||m<.013&&i>m)&&n.log(i)+n.log(f)-n.log(s/(m*m)+c)<=t*u-h-e.loggam(t+1))return t}},sample:function(e){return e<10?this.sampleSmall(e):this.sampleLarge(e)}}),e.extend(e.triangular,{pdf:function(e,n,r,t){return r<=n||t<n||t>r?NaN:e<n||e>r?0:e<t?2*(e-n)/((r-n)*(t-n)):e===t?2/(r-n):2*(r-e)/((r-n)*(r-t))},cdf:function(e,r,t,o){return t<=r||o<r||o>t?NaN:e<=r?0:e>=t?1:e<=o?n.pow(e-r,2)/((t-r)*(o-r)):1-n.pow(t-e,2)/((t-r)*(t-o))},inv:function(e,r,t,o){return t<=r||o<r||o>t?NaN:e<=(o-r)/(t-r)?r+(t-r)*n.sqrt(e*((o-r)/(t-r))):r+(t-r)*(1-n.sqrt((1-e)*(1-(o-r)/(t-r))))},mean:function(e,n,r){return(e+n+r)/3},median:function(e,r,t){return t<=(e+r)/2?r-n.sqrt((r-e)*(r-t))/n.sqrt(2):t>(e+r)/2?e+n.sqrt((r-e)*(t-e))/n.sqrt(2):void 0},mode:function(e,n,r){return r},sample:function(r,t,o){var i=e._random_fn();return i<(o-r)/(t-r)?r+n.sqrt(i*(t-r)*(o-r)):t-n.sqrt((1-i)*(t-r)*(t-o))},variance:function(e,n,r){return(e*e+n*n+r*r-e*n-e*r-n*r)/18}}),e.extend(e.arcsine,{pdf:function(e,r,t){return t<=r?NaN:e<=r||e>=t?0:2/n.PI*n.pow(n.pow(t-r,2)-n.pow(2*e-r-t,2),-.5)},cdf:function(e,r,t){return e<r?0:e<t?2/n.PI*n.asin(n.sqrt((e-r)/(t-r))):1},inv:function(e,r,t){return r+(.5-.5*n.cos(n.PI*e))*(t-r)},mean:function(e,n){return n<=e?NaN:(e+n)/2},median:function(e,n){return n<=e?NaN:(e+n)/2},mode:function(){throw new Error("mode is not yet implemented")},sample:function(r,t){return(r+t)/2+(t-r)/2*n.sin(2*n.PI*e.uniform.sample(0,1))},variance:function(e,r){return r<=e?NaN:n.pow(r-e,2)/8}}),e.extend(e.laplace,{pdf:function(e,r,t){return t<=0?0:n.exp(-n.abs(e-r)/t)/(2*t)},cdf:function(e,r,t){return t<=0?0:e<r?.5*n.exp((e-r)/t):1-.5*n.exp(-(e-r)/t)},mean:function(e){return e},median:function(e){return e},mode:function(e){return e},variance:function(e,n){return 2*n*n},sample:function(r,t){var o,i=e._random_fn()-.5;return r-t*((o=i)/n.abs(o))*n.log(1-2*n.abs(i))}}),e.extend(e.tukey,{cdf:function(r,o,i){var a=o,u=[.9894009349916499,.9445750230732326,.8656312023878318,.755404408355003,.6178762444026438,.45801677765722737,.2816035507792589,.09501250983763744],s=[.027152459411754096,.062253523938647894,.09515851168249279,.12462897125553388,.14959598881657674,.16915651939500254,.18260341504492358,.1894506104550685];if(r<=0)return 0;if(i<2||a<2)return NaN;if(!Number.isFinite(r))return 1;if(i>25e3)return t(r,1,a);var c,f=.5*i,l=f*n.log(i)-i*n.log(2)-e.gammaln(f),m=f-1,h=.25*i;c=i<=100?1:i<=800?.5:i<=5e3?.25:.125,l+=n.log(c);for(var p=0,d=1;d<=50;d++){for(var y=0,g=(2*d-1)*c,x=1;x<=16;x++){var v,w;8<x?(v=x-8-1,w=l+m*n.log(g+u[v]*c)-(u[v]*c+g)*h):(v=x-1,w=l+m*n.log(g-u[v]*c)+(u[v]*c-g)*h),w>=-30&&(y+=t(8<x?r*n.sqrt(.5*(u[v]*c+g)):r*n.sqrt(.5*(-u[v]*c+g)),1,a)*s[v]*n.exp(w))}if(d*c>=1&&y<=1e-14)break;p+=y}if(y>1e-14)throw new Error("tukey.cdf failed to converge");return p>1&&(p=1),p},inv:function(r,t,o){if(o<2||t<2)return NaN;if(r<0||r>1)return NaN;if(0===r)return 0;if(1===r)return 1/0;var i,a=function(e,r,t){var o=.5-.5*e,i=n.sqrt(n.log(1/(o*o))),a=i+((((-453642210148e-16*i-.204231210125)*i-.342242088547)*i-1)*i+.322232421088)/((((.0038560700634*i+.10353775285)*i+.531103462366)*i+.588581570495)*i+.099348462606);t<120&&(a+=(a*a*a+a)/t/4);var u=.8832-.2368*a;return t<120&&(u+=-1.214/t+1.208*a/t),a*(u*n.log(r-1)+1.4142)}(r,t,o),u=e.tukey.cdf(a,t,o)-r;i=u>0?n.max(0,a-1):a+1;for(var s,c=e.tukey.cdf(i,t,o)-r,f=1;f<50;f++)if(s=i-c*(i-a)/(c-u),u=c,a=i,s<0&&(s=0,c=-r),c=e.tukey.cdf(s,t,o)-r,i=s,n.abs(i-a)<1e-4)return s;throw new Error("tukey.inv failed to converge")}})}(n,Math),function(e,n){var r,t,o=Array.prototype.push,i=e.utils.isArray;function a(n){return i(n)||n instanceof e}e.extend({add:function(n,r){return a(r)?(a(r[0])||(r=[r]),e.map(n,(function(e,n,t){return e+r[n][t]}))):e.map(n,(function(e){return e+r}))},subtract:function(n,r){return a(r)?(a(r[0])||(r=[r]),e.map(n,(function(e,n,t){return e-r[n][t]||0}))):e.map(n,(function(e){return e-r}))},divide:function(n,r){return a(r)?(a(r[0])||(r=[r]),e.multiply(n,e.inv(r))):e.map(n,(function(e){return e/r}))},multiply:function(n,r){var t,o,i,u,s,c,f,l;if(void 0===n.length&&void 0===r.length)return n*r;if(s=n.length,c=n[0].length,f=e.zeros(s,i=a(r)?r[0].length:c),l=0,a(r)){for(;l<i;l++)for(t=0;t<s;t++){for(u=0,o=0;o<c;o++)u+=n[t][o]*r[o][l];f[t][l]=u}return 1===s&&1===l?f[0][0]:f}return e.map(n,(function(e){return e*r}))},outer:function(n,r){return e.multiply(n.map((function(e){return[e]})),[r])},dot:function(n,r){a(n[0])||(n=[n]),a(r[0])||(r=[r]);for(var t,o,i=1===n[0].length&&1!==n.length?e.transpose(n):n,u=1===r[0].length&&1!==r.length?e.transpose(r):r,s=[],c=0,f=i.length,l=i[0].length;c<f;c++){for(s[c]=[],t=0,o=0;o<l;o++)t+=i[c][o]*u[c][o];s[c]=t}return 1===s.length?s[0]:s},pow:function(r,t){return e.map(r,(function(e){return n.pow(e,t)}))},exp:function(r){return e.map(r,(function(e){return n.exp(e)}))},log:function(r){return e.map(r,(function(e){return n.log(e)}))},abs:function(r){return e.map(r,(function(e){return n.abs(e)}))},norm:function(e,r){var t=0,o=0;for(isNaN(r)&&(r=2),a(e[0])&&(e=e[0]);o<e.length;o++)t+=n.pow(n.abs(e[o]),r);return n.pow(t,1/r)},angle:function(r,t){return n.acos(e.dot(r,t)/(e.norm(r)*e.norm(t)))},aug:function(e,n){var r,t=[];for(r=0;r<e.length;r++)t.push(e[r].slice());for(r=0;r<t.length;r++)o.apply(t[r],n[r]);return t},inv:function(n){for(var r,t=n.length,o=n[0].length,i=e.identity(t,o),a=e.gauss_jordan(n,i),u=[],s=0;s<t;s++)for(u[s]=[],r=o;r<a[0].length;r++)u[s][r-o]=a[s][r];return u},det:function e(n){if(2===n.length)return n[0][0]*n[1][1]-n[0][1]*n[1][0];for(var r=0,t=0;t<n.length;t++){for(var o=[],i=1;i<n.length;i++){o[i-1]=[];for(var a=0;a<n.length;a++)a<t?o[i-1][a]=n[i][a]:a>t&&(o[i-1][a-1]=n[i][a])}var u=t%2?-1:1;r+=e(o)*n[0][t]*u}return r},gauss_elimination:function(r,t){var o,i,a,u,s=0,c=0,f=r.length,l=r[0].length,m=1,h=0,p=[];for(o=(r=e.aug(r,t))[0].length,s=0;s<f;s++){for(i=r[s][s],c=s,u=s+1;u<l;u++)i<n.abs(r[u][s])&&(i=r[u][s],c=u);if(c!=s)for(u=0;u<o;u++)a=r[s][u],r[s][u]=r[c][u],r[c][u]=a;for(c=s+1;c<f;c++)for(m=r[c][s]/r[s][s],u=s;u<o;u++)r[c][u]=r[c][u]-m*r[s][u]}for(s=f-1;s>=0;s--){for(h=0,c=s+1;c<=f-1;c++)h+=p[c]*r[s][c];p[s]=(r[s][o-1]-h)/r[s][s]}return p},gauss_jordan:function(r,t){var o,i,a,u=e.aug(r,t),s=u.length,c=u[0].length,f=0;for(i=0;i<s;i++){var l=i;for(a=i+1;a<s;a++)n.abs(u[a][i])>n.abs(u[l][i])&&(l=a);var m=u[i];for(u[i]=u[l],u[l]=m,a=i+1;a<s;a++)for(f=u[a][i]/u[i][i],o=i;o<c;o++)u[a][o]-=u[i][o]*f}for(i=s-1;i>=0;i--){for(f=u[i][i],a=0;a<i;a++)for(o=c-1;o>i-1;o--)u[a][o]-=u[i][o]*u[a][i]/f;for(u[i][i]/=f,o=s;o<c;o++)u[i][o]/=f}return u},triaUpSolve:function(n,r){var t,o=n[0].length,i=e.zeros(1,o)[0],a=!1;return null!=r[0].length&&(r=r.map((function(e){return e[0]})),a=!0),e.arange(o-1,-1,-1).forEach((function(a){t=e.arange(a+1,o).map((function(e){return i[e]*n[a][e]})),i[a]=(r[a]-e.sum(t))/n[a][a]})),a?i.map((function(e){return[e]})):i},triaLowSolve:function(n,r){var t,o=n[0].length,i=e.zeros(1,o)[0],a=!1;return null!=r[0].length&&(r=r.map((function(e){return e[0]})),a=!0),e.arange(o).forEach((function(o){t=e.arange(o).map((function(e){return n[o][e]*i[e]})),i[o]=(r[o]-e.sum(t))/n[o][o]})),a?i.map((function(e){return[e]})):i},lu:function(n){var r,t=n.length,o=e.identity(t),i=e.zeros(n.length,n[0].length);return e.arange(t).forEach((function(e){i[0][e]=n[0][e]})),e.arange(1,t).forEach((function(a){e.arange(a).forEach((function(t){r=e.arange(t).map((function(e){return o[a][e]*i[e][t]})),o[a][t]=(n[a][t]-e.sum(r))/i[t][t]})),e.arange(a,t).forEach((function(t){r=e.arange(a).map((function(e){return o[a][e]*i[e][t]})),i[a][t]=n[r.length][t]-e.sum(r)}))})),[o,i]},cholesky:function(r){var t,o=r.length,i=e.zeros(r.length,r[0].length);return e.arange(o).forEach((function(a){t=e.arange(a).map((function(e){return n.pow(i[a][e],2)})),i[a][a]=n.sqrt(r[a][a]-e.sum(t)),e.arange(a+1,o).forEach((function(n){t=e.arange(a).map((function(e){return i[a][e]*i[n][e]})),i[n][a]=(r[a][n]-e.sum(t))/i[a][a]}))})),i},gauss_jacobi:function(r,t,o,i){for(var a,u,s,c,f=0,l=0,m=r.length,h=[],p=[],d=[];f<m;f++)for(h[f]=[],p[f]=[],d[f]=[],l=0;l<m;l++)f>l?(h[f][l]=r[f][l],p[f][l]=d[f][l]=0):f<l?(p[f][l]=r[f][l],h[f][l]=d[f][l]=0):(d[f][l]=r[f][l],h[f][l]=p[f][l]=0);for(s=e.multiply(e.multiply(e.inv(d),e.add(h,p)),-1),u=e.multiply(e.inv(d),t),a=o,c=e.add(e.multiply(s,o),u),f=2;n.abs(e.norm(e.subtract(c,a)))>i;)a=c,c=e.add(e.multiply(s,a),u),f++;return c},gauss_seidel:function(r,t,o,i){for(var a,u,s,c,f,l=0,m=r.length,h=[],p=[],d=[];l<m;l++)for(h[l]=[],p[l]=[],d[l]=[],a=0;a<m;a++)l>a?(h[l][a]=r[l][a],p[l][a]=d[l][a]=0):l<a?(p[l][a]=r[l][a],h[l][a]=d[l][a]=0):(d[l][a]=r[l][a],h[l][a]=p[l][a]=0);for(c=e.multiply(e.multiply(e.inv(e.add(d,h)),p),-1),s=e.multiply(e.inv(e.add(d,h)),t),u=o,f=e.add(e.multiply(c,o),s),l=2;n.abs(e.norm(e.subtract(f,u)))>i;)u=f,f=e.add(e.multiply(c,u),s),l+=1;return f},SOR:function(r,t,o,i,a){for(var u,s,c,f,l,m=0,h=r.length,p=[],d=[],y=[];m<h;m++)for(p[m]=[],d[m]=[],y[m]=[],u=0;u<h;u++)m>u?(p[m][u]=r[m][u],d[m][u]=y[m][u]=0):m<u?(d[m][u]=r[m][u],p[m][u]=y[m][u]=0):(y[m][u]=r[m][u],p[m][u]=d[m][u]=0);for(f=e.multiply(e.inv(e.add(y,e.multiply(p,a))),e.subtract(e.multiply(y,1-a),e.multiply(d,a))),c=e.multiply(e.multiply(e.inv(e.add(y,e.multiply(p,a))),t),a),s=o,l=e.add(e.multiply(f,o),c),m=2;n.abs(e.norm(e.subtract(l,s)))>i;)s=l,l=e.add(e.multiply(f,s),c),m++;return l},householder:function(r){for(var t,o,i,a,u=r.length,s=r[0].length,c=0,f=[],l=[];c<u-1;c++){for(t=0,a=c+1;a<s;a++)t+=r[a][c]*r[a][c];for(t=(r[c+1][c]>0?-1:1)*n.sqrt(t),o=n.sqrt((t*t-r[c+1][c]*t)/2),(f=e.zeros(u,1))[c+1][0]=(r[c+1][c]-t)/(2*o),i=c+2;i<u;i++)f[i][0]=r[i][c]/(2*o);l=e.subtract(e.identity(u,s),e.multiply(e.multiply(f,e.transpose(f)),2)),r=e.multiply(l,e.multiply(r,l))}return r},QR:(r=e.sum,t=e.arange,function(o){var i,a,u,s=o.length,c=o[0].length,f=e.zeros(c,c);for(o=e.copy(o),a=0;a<c;a++){for(f[a][a]=n.sqrt(r(t(s).map((function(e){return o[e][a]*o[e][a]})))),i=0;i<s;i++)o[i][a]=o[i][a]/f[a][a];for(u=a+1;u<c;u++)for(f[a][u]=r(t(s).map((function(e){return o[e][a]*o[e][u]}))),i=0;i<s;i++)o[i][u]=o[i][u]-o[i][a]*f[a][u]}return[o,f]}),lstsq:function(n,r){var t=!1;void 0===r[0].length&&(r=r.map((function(e){return[e]})),t=!0);var o=e.QR(n),i=o[0],a=o[1],u=n[0].length,s=e.slice(i,{col:{end:u}}),c=function(n){var r=(n=e.copy(n)).length,t=e.identity(r);return e.arange(r-1,-1,-1).forEach((function(r){e.sliceAssign(t,{row:r},e.divide(e.slice(t,{row:r}),n[r][r])),e.sliceAssign(n,{row:r},e.divide(e.slice(n,{row:r}),n[r][r])),e.arange(r).forEach((function(o){var i=e.multiply(n[o][r],-1),a=e.slice(n,{row:o}),u=e.multiply(e.slice(n,{row:r}),i);e.sliceAssign(n,{row:o},e.add(a,u));var s=e.slice(t,{row:o}),c=e.multiply(e.slice(t,{row:r}),i);e.sliceAssign(t,{row:o},e.add(s,c))}))})),t}(e.slice(a,{row:{end:u}})),f=e.transpose(s);void 0===f[0].length&&(f=[f]);var l=e.multiply(e.multiply(c,f),r);return void 0===l.length&&(l=[[l]]),t?l.map((function(e){return e[0]})):l},jacobi:function(r){for(var t,o,i,a,u,s,c,f=1,l=r.length,m=e.identity(l,l),h=[];1===f;){for(u=r[0][1],i=0,a=1,t=0;t<l;t++)for(o=0;o<l;o++)t!=o&&u<n.abs(r[t][o])&&(u=n.abs(r[t][o]),i=t,a=o);for(s=r[i][i]===r[a][a]?r[i][a]>0?n.PI/4:-n.PI/4:n.atan(2*r[i][a]/(r[i][i]-r[a][a]))/2,(c=e.identity(l,l))[i][i]=n.cos(s),c[i][a]=-n.sin(s),c[a][i]=n.sin(s),c[a][a]=n.cos(s),m=e.multiply(m,c),r=e.multiply(e.multiply(e.inv(c),r),c),f=0,t=1;t<l;t++)for(o=1;o<l;o++)t!=o&&n.abs(r[t][o])>.001&&(f=1)}for(t=0;t<l;t++)h.push(r[t][t]);return[m,h]},rungekutta:function(e,n,r,t,o,i){var a,u,s;if(2===i)for(;t<=r;)o+=((a=n*e(t,o))+(u=n*e(t+n,o+a)))/2,t+=n;if(4===i)for(;t<=r;)o+=((a=n*e(t,o))+2*(u=n*e(t+n/2,o+a/2))+2*(s=n*e(t+n/2,o+u/2))+n*e(t+n,o+s))/6,t+=n;return o},romberg:function(e,r,t,o){for(var i,a,u,s,c,f=0,l=(t-r)/2,m=[],h=[],p=[];f<o/2;){for(c=e(r),u=r,s=0;u<=t;u+=l,s++)m[s]=u;for(i=m.length,u=1;u<i-1;u++)c+=(u%2!=0?4:2)*e(m[u]);c=l/3*(c+e(t)),p[f]=c,l/=2,f++}for(a=p.length,i=1;1!==a;){for(u=0;u<a-1;u++)h[u]=(n.pow(4,i)*p[u+1]-p[u])/(n.pow(4,i)-1);a=h.length,p=h,h=[],i++}return p},richardson:function(e,r,t,o){function i(e,n){for(var r,t=0,o=e.length;t<o;t++)e[t]===n&&(r=t);return r}for(var a,u,s,c,f,l=n.abs(t-e[i(e,t)+1]),m=0,h=[],p=[];o>=l;)a=i(e,t+o),u=i(e,t),h[m]=(r[a]-2*r[u]+r[2*u-a])/(o*o),o/=2,m++;for(c=h.length,s=1;1!=c;){for(f=0;f<c-1;f++)p[f]=(n.pow(4,s)*h[f+1]-h[f])/(n.pow(4,s)-1);c=p.length,h=p,p=[],s++}return h},simpson:function(e,n,r,t){for(var o,i=(r-n)/t,a=e(n),u=[],s=n,c=0,f=1;s<=r;s+=i,c++)u[c]=s;for(o=u.length;f<o-1;f++)a+=(f%2!=0?4:2)*e(u[f]);return i/3*(a+e(r))},hermite:function(e,n,r,t){for(var o,i=e.length,a=0,u=0,s=[],c=[],f=[],l=[];u<i;u++){for(s[u]=1,o=0;o<i;o++)u!=o&&(s[u]*=(t-e[o])/(e[u]-e[o]));for(c[u]=0,o=0;o<i;o++)u!=o&&(c[u]+=1/(e[u]-e[o]));f[u]=(1-2*(t-e[u])*c[u])*(s[u]*s[u]),l[u]=(t-e[u])*(s[u]*s[u]),a+=f[u]*n[u]+l[u]*r[u]}return a},lagrange:function(e,n,r){for(var t,o,i=0,a=0,u=e.length;a<u;a++){for(o=n[a],t=0;t<u;t++)a!=t&&(o*=(r-e[t])/(e[a]-e[t]));i+=o}return i},cubic_spline:function(n,r,t){for(var o,i,a=n.length,u=0,s=[],c=[],f=[],l=[],m=[],h=[];u<a-1;u++)l[u]=n[u+1]-n[u];for(f[0]=0,u=1;u<a-1;u++)f[u]=3/l[u]*(r[u+1]-r[u])-3/l[u-1]*(r[u]-r[u-1]);for(u=1;u<a-1;u++)s[u]=[],c[u]=[],s[u][u-1]=l[u-1],s[u][u]=2*(l[u-1]+l[u]),s[u][u+1]=l[u],c[u][0]=f[u];for(i=e.multiply(e.inv(s),c),o=0;o<a-1;o++)m[o]=(r[o+1]-r[o])/l[o]-l[o]*(i[o+1][0]+2*i[o][0])/3,h[o]=(i[o+1][0]-i[o][0])/(3*l[o]);for(o=0;o<a&&!(n[o]>t);o++);return r[o-=1]+(t-n[o])*m[o]+e.sq(t-n[o])*i[o]+(t-n[o])*e.sq(t-n[o])*h[o]},gauss_quadrature:function(){throw new Error("gauss_quadrature not yet implemented")},PCA:function(n){var r,t,o,i,a,u=n.length,s=n[0].length,c=0,f=[],l=[],m=[],h=[],p=[],d=[],y=[];for(c=0;c<u;c++)f[c]=e.sum(n[c])/s;for(c=0;c<s;c++)for(p[c]=[],r=0;r<u;r++)p[c][r]=n[r][c]-f[r];for(p=e.transpose(p),c=0;c<u;c++)for(d[c]=[],r=0;r<u;r++)d[c][r]=e.dot([p[c]],[p[r]])/(s-1);for(a=(o=e.jacobi(d))[0],l=o[1],y=e.transpose(a),c=0;c<l.length;c++)for(r=c;r<l.length;r++)l[c]<l[r]&&(t=l[c],l[c]=l[r],l[r]=t,m=y[c],y[c]=y[r],y[r]=m);for(i=e.transpose(p),c=0;c<u;c++)for(h[c]=[],r=0;r<i.length;r++)h[c][r]=e.dot([y[c]],[i[r]]);return[n,l,y,h]}}),function(n){for(var r=0;r<n.length;r++)!function(n){e.fn[n]=function(r,t){var o=this;return t?(setTimeout((function(){t.call(o,e.fn[n].call(o,r))}),15),this):"number"==typeof e[n](this,r)?e[n](this,r):e(e[n](this,r))}}(n[r])}("add divide multiply subtract dot pow exp log abs norm angle".split(" "))}(n,Math),function(e,n){var r=[].slice,t=e.utils.isNumber,o=e.utils.isArray;function i(e,r,t,o){if(e>1||t>1||e<=0||t<=0)throw new Error("Proportions should be greater than 0 and less than 1");var i=(e*r+t*o)/(r+o);return(e-t)/n.sqrt(i*(1-i)*(1/r+1/o))}e.extend({zscore:function(){var n=r.call(arguments);return t(n[1])?(n[0]-n[1])/n[2]:(n[0]-e.mean(n[1]))/e.stdev(n[1],n[2])},ztest:function(){var t,i=r.call(arguments);return o(i[1])?(t=e.zscore(i[0],i[1],i[3]),1===i[2]?e.normal.cdf(-n.abs(t),0,1):2*e.normal.cdf(-n.abs(t),0,1)):i.length>2?(t=e.zscore(i[0],i[1],i[2]),1===i[3]?e.normal.cdf(-n.abs(t),0,1):2*e.normal.cdf(-n.abs(t),0,1)):(t=i[0],1===i[1]?e.normal.cdf(-n.abs(t),0,1):2*e.normal.cdf(-n.abs(t),0,1))}}),e.extend(e.fn,{zscore:function(e,n){return(e-this.mean())/this.stdev(n)},ztest:function(r,t,o){var i=n.abs(this.zscore(r,o));return 1===t?e.normal.cdf(-i,0,1):2*e.normal.cdf(-i,0,1)}}),e.extend({tscore:function(){var t=r.call(arguments);return 4===t.length?(t[0]-t[1])/(t[2]/n.sqrt(t[3])):(t[0]-e.mean(t[1]))/(e.stdev(t[1],!0)/n.sqrt(t[1].length))},ttest:function(){var o,i=r.call(arguments);return 5===i.length?(o=n.abs(e.tscore(i[0],i[1],i[2],i[3])),1===i[4]?e.studentt.cdf(-o,i[3]-1):2*e.studentt.cdf(-o,i[3]-1)):t(i[1])?(o=n.abs(i[0]),1==i[2]?e.studentt.cdf(-o,i[1]-1):2*e.studentt.cdf(-o,i[1]-1)):(o=n.abs(e.tscore(i[0],i[1])),1==i[2]?e.studentt.cdf(-o,i[1].length-1):2*e.studentt.cdf(-o,i[1].length-1))}}),e.extend(e.fn,{tscore:function(e){return(e-this.mean())/(this.stdev(!0)/n.sqrt(this.cols()))},ttest:function(r,t){return 1===t?1-e.studentt.cdf(n.abs(this.tscore(r)),this.cols()-1):2*e.studentt.cdf(-n.abs(this.tscore(r)),this.cols()-1)}}),e.extend({anovafscore:function(){var t,o,i,a,u,s,c,f,l=r.call(arguments);if(1===l.length){for(u=new Array(l[0].length),c=0;c<l[0].length;c++)u[c]=l[0][c];l=u}for(o=new Array,c=0;c<l.length;c++)o=o.concat(l[c]);for(i=e.mean(o),t=0,c=0;c<l.length;c++)t+=l[c].length*n.pow(e.mean(l[c])-i,2);for(t/=l.length-1,s=0,c=0;c<l.length;c++)for(a=e.mean(l[c]),f=0;f<l[c].length;f++)s+=n.pow(l[c][f]-a,2);return t/(s/(o.length-l.length))},anovaftest:function(){var n,o,i,a,u=r.call(arguments);if(t(u[0]))return 1-e.centralF.cdf(u[0],u[1],u[2]);var s=e.anovafscore(u);for(n=u.length-1,i=0,a=0;a<u.length;a++)i+=u[a].length;return o=i-n-1,1-e.centralF.cdf(s,n,o)},ftest:function(n,r,t){return 1-e.centralF.cdf(n,r,t)}}),e.extend(e.fn,{anovafscore:function(){return e.anovafscore(this.toArray())},anovaftes:function(){var n,r=0;for(n=0;n<this.length;n++)r+=this[n].length;return e.ftest(this.anovafscore(),this.length-1,r-this.length)}}),e.extend({qscore:function(){var o,i,a,u,s,c=r.call(arguments);return t(c[0])?(o=c[0],i=c[1],a=c[2],u=c[3],s=c[4]):(o=e.mean(c[0]),i=e.mean(c[1]),a=c[0].length,u=c[1].length,s=c[2]),n.abs(o-i)/(s*n.sqrt((1/a+1/u)/2))},qtest:function(){var n,t=r.call(arguments);3===t.length?(n=t[0],t=t.slice(1)):7===t.length?(n=e.qscore(t[0],t[1],t[2],t[3],t[4]),t=t.slice(5)):(n=e.qscore(t[0],t[1],t[2]),t=t.slice(3));var o=t[0],i=t[1];return 1-e.tukey.cdf(n,i,o-i)},tukeyhsd:function(n){for(var r=e.pooledstdev(n),t=n.map((function(n){return e.mean(n)})),o=n.reduce((function(e,n){return e+n.length}),0),i=[],a=0;a<n.length;++a)for(var u=a+1;u<n.length;++u){var s=e.qtest(t[a],t[u],n[a].length,n[u].length,r,o,n.length);i.push([[a,u],s])}return i}}),e.extend({normalci:function(){var t,o=r.call(arguments),i=new Array(2);return t=4===o.length?n.abs(e.normal.inv(o[1]/2,0,1)*o[2]/n.sqrt(o[3])):n.abs(e.normal.inv(o[1]/2,0,1)*e.stdev(o[2])/n.sqrt(o[2].length)),i[0]=o[0]-t,i[1]=o[0]+t,i},tci:function(){var t,o=r.call(arguments),i=new Array(2);return t=4===o.length?n.abs(e.studentt.inv(o[1]/2,o[3]-1)*o[2]/n.sqrt(o[3])):n.abs(e.studentt.inv(o[1]/2,o[2].length-1)*e.stdev(o[2],!0)/n.sqrt(o[2].length)),i[0]=o[0]-t,i[1]=o[0]+t,i},significant:function(e,n){return e<n}}),e.extend(e.fn,{normalci:function(n,r){return e.normalci(n,r,this.toArray())},tci:function(n,r){return e.tci(n,r,this.toArray())}}),e.extend(e.fn,{oneSidedDifferenceOfProportions:function(n,r,t,o){var a=i(n,r,t,o);return e.ztest(a,1)},twoSidedDifferenceOfProportions:function(n,r,t,o){var a=i(n,r,t,o);return e.ztest(a,2)}})}(n,Math),n.models=function(){function e(e,r){var t=e.length,o=r[0].length-1,i=t-o-1,a=n.lstsq(r,e),u=n.multiply(r,a.map((function(e){return[e]}))).map((function(e){return e[0]})),s=n.subtract(e,u),c=n.mean(e),f=n.sum(u.map((function(e){return Math.pow(e-c,2)}))),l=n.sum(e.map((function(e,n){return Math.pow(e-u[n],2)}))),m=f+l;return{exog:r,endog:e,nobs:t,df_model:o,df_resid:i,coef:a,predict:u,resid:s,ybar:c,SST:m,SSE:f,SSR:l,R2:f/m}}function r(r){var t,o,i=(t=r.exog,o=t[0].length,n.arange(o).map((function(r){var i=n.arange(o).filter((function(e){return e!==r}));return e(n.col(t,r).map((function(e){return e[0]})),n.col(t,i))}))),a=Math.sqrt(r.SSR/r.df_resid),u=i.map((function(e){var n=e.SST,r=e.R2;return a/Math.sqrt(n*(1-r))})),s=r.coef.map((function(e,n){return(e-0)/u[n]})),c=s.map((function(e){var t=n.studentt.cdf(e,r.df_resid);return 2*(t>.5?1-t:t)})),f=n.studentt.inv(.975,r.df_resid),l=r.coef.map((function(e,n){var r=f*u[n];return[e-r,e+r]}));return{se:u,t:s,p:c,sigmaHat:a,interval95:l}}return{ols:function(t,o){var i=e(t,o),a=r(i),u=function(e){var r,t,o,i=e.R2/e.df_model/((1-e.R2)/e.df_resid);return{F_statistic:i,pvalue:1-(r=i,t=e.df_model,o=e.df_resid,n.beta.cdf(r/(o/t+r),t/2,o/2))}}(i),s=1-(1-i.R2)*((i.nobs-1)/i.df_resid);return i.t=a,i.f=u,i.adjust_R2=s,i}}}(),n.extend({buildxmatrix:function(){for(var e=new Array(arguments.length),r=0;r<arguments.length;r++)e[r]=[1].concat(arguments[r]);return n(e)},builddxmatrix:function(){for(var e=new Array(arguments[0].length),r=0;r<arguments[0].length;r++)e[r]=[1].concat(arguments[0][r]);return n(e)},buildjxmatrix:function(e){for(var r=new Array(e.length),t=0;t<e.length;t++)r[t]=e[t];return n.builddxmatrix(r)},buildymatrix:function(e){return n(e).transpose()},buildjymatrix:function(e){return e.transpose()},matrixmult:function(e,r){var t,o,i,a,u;if(e.cols()==r.rows()){if(r.rows()>1){for(a=[],t=0;t<e.rows();t++)for(a[t]=[],o=0;o<r.cols();o++){for(u=0,i=0;i<e.cols();i++)u+=e.toArray()[t][i]*r.toArray()[i][o];a[t][o]=u}return n(a)}for(a=[],t=0;t<e.rows();t++)for(a[t]=[],o=0;o<r.cols();o++){for(u=0,i=0;i<e.cols();i++)u+=e.toArray()[t][i]*r.toArray()[o];a[t][o]=u}return n(a)}},regress:function(e,r){var t=n.xtranspxinv(e),o=e.transpose(),i=n.matrixmult(n(t),o);return n.matrixmult(i,r)},regresst:function(e,r,t){var o=n.regress(e,r),i={anova:{}},a=n.jMatYBar(e,o);i.yBar=a;var u=r.mean();i.anova.residuals=n.residuals(r,a),i.anova.ssr=n.ssr(a,u),i.anova.msr=i.anova.ssr/(e[0].length-1),i.anova.sse=n.sse(r,a),i.anova.mse=i.anova.sse/(r.length-(e[0].length-1)-1),i.anova.sst=n.sst(r,u),i.anova.mst=i.anova.sst/(r.length-1),i.anova.r2=1-i.anova.sse/i.anova.sst,i.anova.r2<0&&(i.anova.r2=0),i.anova.fratio=i.anova.msr/i.anova.mse,i.anova.pvalue=n.anovaftest(i.anova.fratio,e[0].length-1,r.length-(e[0].length-1)-1),i.anova.rmse=Math.sqrt(i.anova.mse),i.anova.r2adj=1-i.anova.mse/i.anova.mst,i.anova.r2adj<0&&(i.anova.r2adj=0),i.stats=new Array(e[0].length);for(var s,c,f,l=n.xtranspxinv(e),m=0;m<o.length;m++)s=Math.sqrt(i.anova.mse*Math.abs(l[m][m])),c=Math.abs(o[m]/s),f=n.ttest(c,r.length-e[0].length-1,t),i.stats[m]=[o[m],s,c,f];return i.regress=o,i},xtranspx:function(e){return n.matrixmult(e.transpose(),e)},xtranspxinv:function(e){var r=n.matrixmult(e.transpose(),e);return n.inv(r)},jMatYBar:function(e,r){var t=n.matrixmult(e,r);return new n(t)},residuals:function(e,r){return n.matrixsubtract(e,r)},ssr:function(e,n){for(var r=0,t=0;t<e.length;t++)r+=Math.pow(e[t]-n,2);return r},sse:function(e,n){for(var r=0,t=0;t<e.length;t++)r+=Math.pow(e[t]-n[t],2);return r},sst:function(e,n){for(var r=0,t=0;t<e.length;t++)r+=Math.pow(e[t]-n,2);return r},matrixsubtract:function(e,r){for(var t=new Array(e.length),o=0;o<e.length;o++){t[o]=new Array(e[o].length);for(var i=0;i<e[o].length;i++)t[o][i]=e[o][i]-r[o][i]}return n(t)}}),n.jStat=n,n)},184:(e,n,r)=>{"use strict";r.d(n,{$:()=>a});var t=r(976),o=r(870),i=r(559);class a extends t.JsViewer{constructor(e){super(),this.canvas=o.canvas(),this.gridCellStyle=t.GridCellStyle.create(),this.renderer=e,this.root.append(this.canvas),this.canvas.style.width="100%",this.canvas.style.height="100%",o.tools.handleResize(this.canvas,((e,n)=>{this.canvas.width=e,this.canvas.height=n,this.render()}));const n=e=>n=>{this.gridCell&&e(this.gridCell,n)};this.canvas.onmousemove=n(this.renderer.onMouseMove),this.canvas.onmouseenter=n(this.renderer.onMouseEnter),this.canvas.onmouseleave=n(this.renderer.onMouseLeave)}static fromGridCell(e){const n=new a(new i.cv);return n.gridCell=e,n.render(),n}render(){if(!this.gridCell)return;const e=this.canvas.getContext("2d");e.clearRect(0,0,this.canvas.width,this.canvas.height),this.renderer.renderInternal(e,0,0,this.canvas.width,this.canvas.height,this.gridCell.dart,this.gridCellStyle)}}},840:(e,n,r)=>{"use strict";r.d(n,{YC:()=>s,lf:()=>c});var t=r(976),o=(r(469),r(363),r(875)),i=r(414),a=r.n(i);function u(e,n){return Math.random()*(n-e)+e}function s(e,n,r=1){const t=new Float32Array(e*r),i=new Float32Array(e*r),a=[u(1,2),u(1,2),u(1,2),u(-5,5)],s=0-Math.floor(e/2)*n,c=s+n*(e-1);for(let e=s,u=0;e<=c;e+=n,u++)for(let n=0;n<r;n++)t[u*r+n]=e-s+.1,i[u*r+n]=(0,o.Hg)(a,e);const f=(1===r?.2:.4)*(Math.max(...i)-Math.min(...i)),l=Math.min(...i);for(let e=0;e<t.length;e++)i[e]=-l+i[e]+u(0,f);return{x:t,y:i,params:a}}function c(e,n,r){var i;const u=t.DataFrame.create(e);for(let c=0;c<n;c++){const n=3===c?5:1,f=u.columns.addNewString(`json chart ${c}`);f.semType=o.j2;let l=c%2==0?r:1;for(let o=0;o<e;o++){const e={series:[],chartOptions:{showStatistics:1===l?["auc"]:[],xAxisName:"Conc.",yAxisName:"Activity",title:"Dose-Response curves"}};for(let o=0;o<l;o++){const u=s(15,.5,n);let f=t.Color.toHtml(t.Color.getCategoricalColor(c*r+o));null===(i=e.series)||void 0===i||i.push({parameters:void 0,fitLineColor:f,pointColor:f,showCurveConfidenceInterval:1===l,points:a().count().take(15*n).map((function(e){return{x:u.x[e],y:u.y[e]}})).toArray()})}f.set(o,JSON.stringify(e))}}return u}},188:(e,n,r)=>{"use strict";r.d(n,{No:()=>s,hS:()=>u});var t,o=r(976),i=(r(870),r(416));r(875),r(559),r(184),r(711),function(e){e.DATAFRAME="Dataframe",e.COLUMN="Column",e.CELL="Cell"}(t||(t={}));const a={count:"totalCount",nulls:"missingValueCount",unique:"uniqueCount",values:"valueCount",min:"min",max:"max",sum:"sum",avg:"avg",stdev:"stdev",variance:"variance",skew:"skew",kurt:"kurt",med:"med",q1:"q1",q2:"q2",q3:"q3"};function u(e,n){const r=(0,i.Y6)(e);return e.parameters?n.logX&&e.parameters[2]>0&&(e.parameters[2]=Math.log10(e.parameters[2])):e.parameters=(0,i.PK)(e,r,n).parameters,(0,i.tq)(e,r,n)}function s(e,n){var r,t,i;const s={logX:null===(r=e.chartOptions)||void 0===r?void 0:r.logX,logY:null===(t=e.chartOptions)||void 0===t?void 0:t.logY},c=[],f=[],l=[],m=[],h=[],p=[],d=[];for(let n=0,r=0;n<(null===(i=e.series)||void 0===i?void 0:i.length);n++){if(e.series[n].points.every((e=>e.outlier)))continue;const t=u(e.series[n],s);c[r]=t.rSquared,f[r]=t.auc,l[r]=t.interceptX,m[r]=t.interceptY,h[r]=t.slope,p[r]=t.top,d[r]=t.bottom,r++}return{rSquared:o.Stats.fromValues(c)[a[n]],auc:o.Stats.fromValues(f)[a[n]],interceptX:o.Stats.fromValues(l)[a[n]],interceptY:o.Stats.fromValues(m)[a[n]],slope:o.Stats.fromValues(h)[a[n]],top:o.Stats.fromValues(p)[a[n]],bottom:o.Stats.fromValues(d)[a[n]]}}o.ObjectHandler},711:(e,n,r)=>{"use strict";r.d(n,{f:()=>c});var t=r(976),o=r(875);const i={x:"xAxis",y:"yAxis"},a={min:"min",max:"max"};function u(e){var n,r,i;const a=null===(r=null===(n=e.getElementsByTagName("params")[0])||void 0===n?void 0:n.childNodes[0].nodeValue)||void 0===r?void 0:r.split(",").map(Number);let u=null===(i=e.getElementsByTagName("function")[0])||void 0===i?void 0:i.getAttribute("type");u=u&&"sigif"!==u?u:o.yB;const s=e.getElementsByTagName("settings")[0].getAttribute("markerColor"),c=e.getElementsByTagName("settings")[0].getAttribute("color"),f=!!e.getElementsByTagName("settings")[0].getAttribute("drawLine"),l={name:e.getAttribute("name"),fitFunction:u,markerType:t.MARKER_TYPE.CIRCLE,pointColor:s,fitLineColor:c,showFitLine:f,showPoints:"points",showCurveConfidenceInterval:!1,clickToToggle:!1};return a&&(l.parameters=[a[2],a[1],a[0],a[3]]),l}function s(e){const n=function(e){var n,r,t;const o=null===(n=e.getElementsByTagName("x")[0].childNodes[0].nodeValue)||void 0===n?void 0:n.split(","),i=null===(r=e.getElementsByTagName("y")[0].childNodes[0].nodeValue)||void 0===r?void 0:r.split(","),a=null===(t=e.getElementsByTagName("mask")[0].childNodes[0].nodeValue)||void 0===t?void 0:t.split(""),u=[];for(let e=0;e<o.length;e++)u[e]={x:+o[e],y:+i[e],outlier:!Boolean(a[e])};return u}(e),r=u(e),t={points:n};return Object.assign(t,r),t}function c(e){const n=(new DOMParser).parseFromString(e,"text/xml"),r=n.getElementsByTagName("grid")[0],t=(c=n.getElementsByTagName("settings")[0],{minX:+(o=r).getElementsByTagName(i.x)[0].getAttribute(a.min),minY:+o.getElementsByTagName(i.y)[0].getAttribute(a.min),maxX:+o.getElementsByTagName(i.x)[0].getAttribute(a.max),maxY:+o.getElementsByTagName(i.y)[0].getAttribute(a.max),xAxisName:c.getAttribute("xLabel"),yAxisName:c.getAttribute("yLabel"),logX:!!c.getAttribute("logX")});var o,c;const f=n.getElementsByTagName("seriesCollection")[0],l=u(f.getElementsByTagName("series")[0]),m=function(e){const n=[],r=e.getElementsByTagName("series").length;for(let t=0;t<r;t++){const r=e.getElementsByTagName("series")[t];n[t]=s(r)}return n}(f);return{chartOptions:t,seriesOptions:l,series:m}}},559:(e,n,r)=>{"use strict";r.d(n,{cv:()=>B,od:()=>N,Rj:()=>y,NH:()=>g,W$:()=>L,fi:()=>j,Ce:()=>E,BI:()=>O,kb:()=>X});var t=r(976),o=r(469),i=r(870),a=r(875),u=r(111),s=r(766);const c=window,f=new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2});class l{static getUniqueName(e,n,r){return c.grok_Utils_GetUniqueName(e,n,null==r?void 0:r.auto,null==r?void 0:r.idx,null==r?void 0:r.render,null==r?void 0:r.choices)}static isEmpty(e){return null==e||""==e}static formatNumber(e){return f.format(e)}}var m=r(416),h=r(711),p=r(184),d=r(188);const y=".fitChartFormat",g="3dx",x=100,v=55,w=38,b=45,T=5,C=25,_=18,A=15,k=30,M=4,S=3.5,N=-12,P={solid:[],dotted:[1,1],dashed:[5,5],dashdotted:[5,5,2,5]};function O(e,n,r){if(n&&r)for(const t of e)!(t.name in r)&&t.name in n&&(r[t.name]=n[t.name])}function L(e){var n,r,o,i,u;let s=e.cell.value;s.includes("|")&&(s=s.replaceAll("|",""));const c=(null===(r=null===(n=e.cell)||void 0===n?void 0:n.column)||void 0===r?void 0:r.type)===t.TYPE.STRING?e.cell.column.getTag(y)===g?(0,h.f)(s):null!==(o=JSON.parse(null!=s?s:"{}"))&&void 0!==o?o:{}:(0,m.TL)(),f=e.cell.column?(0,m.hq)(e.cell.column):{},l=e.cell.column?(0,m.jG)(e.cell.dataFrame):{};null!==(i=c.series)&&void 0!==i||(c.series=[]),null!==(u=c.chartOptions)&&void 0!==u||(c.chartOptions=f.chartOptions),O(a.kW,f.chartOptions,c.chartOptions),O(a.kW,l.chartOptions,c.chartOptions);for(const e of c.series)O(a.K0,f.seriesOptions,e),O(a.K0,l.seriesOptions,e);return c}function E(e,n,r){if(e.width<x||e.height<v)return[e,void 0,void 0];const t=n?b:w,o=n?k:A,i=r?C:T;return[e.cutLeft(t).cutBottom(o).cutTop(i).cutRight(_),e.getBottom(o).getTop(i).cutLeft(t).cutRight(_),e.getLeft(t).getRight(_).cutBottom(o).cutTop(i)]}function j(e){return null!=e&&""!==e&&void 0!==t.Color.fromHtml(e)}function q(e,n,r,t){e.moveTo(t.xToScreen(n)-M/2,t.yToScreen(r)),e.lineTo(t.xToScreen(n)+M/2,t.yToScreen(r))}function R(e,n,r,o,i,a){q(e,n,r.lowerAdjacentValue,o),e.moveTo(o.xToScreen(n),o.yToScreen(r.lowerAdjacentValue)),e.lineTo(o.xToScreen(n),o.yToScreen(r.upperAdjacentValue)),q(e,n,r.upperAdjacentValue,o),t.Paint.marker(e,t.MARKER_TYPE.CIRCLE,o.xToScreen(n),o.yToScreen(r.q2),a,S*i)}function F(e,n,r,o,i,a,u){for(let i=0;i<n.points.length;i++){const s=n.points[i],c=s.outlier?s.outlierColor&&t.Color.fromHtml(s.outlierColor)?t.Color.fromHtml(s.outlierColor):u:s.color&&t.Color.fromHtml(s.color)?t.Color.fromHtml(s.color):a,f=s.marker?s.marker:n.markerType,l=s.outlier?12*o:s.size?s.size:4*o;t.Paint.marker(e,s.outlier?t.MARKER_TYPE.OUTLIER:f,r.xToScreen(s.x),r.yToScreen(s.y),c,l),s.stdev&&!s.outlier&&(e.strokeStyle=t.Color.toHtml(c),e.beginPath(),e.moveTo(r.xToScreen(s.x),r.yToScreen(s.y+s.stdev)),e.lineTo(r.xToScreen(s.x),r.yToScreen(s.y-s.stdev)),e.stroke())}}function I(e,n,r,o,i){for(let a=0,s=null;a<n.points.length;a++){const c=n.points[a];if(c.outlier)continue;const f=a+1<n.points.length&&n.points[a+1].x===c.x;if(!s&&f)s=a;else if(null!==s&&!f){const f=[];for(let e=s,r=0;e<=a;e++,r++)f[r]=n.points[e].y;const l=(0,u.G)(f);if(e.beginPath(),R(e,c.x,l,r,o,i),e.stroke(),"both"===n.showPoints)for(let i=0;i<f.length;i++)(f[i]<l.lowerAdjacentValue||f[i]>l.upperAdjacentValue)&&t.Paint.marker(e,t.MARKER_TYPE.OUTLIER,r.xToScreen(c.x),r.yToScreen(f[i]),n.pointColor?t.Color.fromHtml(n.pointColor):t.Color.scatterPlotMarker,6*o);s=null}}}function Y(e,n,r,t,o,i,u,s){e.beginPath();const c=i?u?b:w:0,f=i?_:0,l=o===a.vK.TOP?n.confidenceTop:n.confidenceBottom;for(let n=c;n<=r.width-f;n++){const o=r.x+n,i=s.logX?Math.log10(t.xToWorld(o)):t.xToWorld(o),a=s.logY?t.yToScreen(Math.pow(10,l(i))):t.yToScreen(l(i));n===c?e.moveTo(o,a):e.lineTo(o,a)}e.stroke()}function V(e,n,r,t,o,i,a){e.beginPath();const u=o?i?b:w:0,s=o?_:0;for(let o=u;o<=r.width-s;o++){const i=r.x+o,s=a.logX?Math.log10(t.xToWorld(i)):t.xToWorld(i),c=a.logY?t.yToScreen(Math.pow(10,n.confidenceTop(s))):t.yToScreen(n.confidenceTop(s));o===u?e.moveTo(i,c):e.lineTo(i,c)}for(let o=r.width-s;o>=u;o--){const i=r.x+o,u=a.logX?Math.log10(t.xToWorld(i)):t.xToWorld(i),s=a.logY?t.yToScreen(Math.pow(10,n.confidenceBottom(u))):t.yToScreen(n.confidenceBottom(u));e.lineTo(i,s)}e.closePath(),e.fill()}function D(e,n,r,t,o,i){i.logX&&(r=Math.pow(10,r));const a=i.logX?Math.log10(r):r,u=i.logY?Math.pow(10,o(a)):o(a);e.moveTo(n.xToScreen(t.minX),n.yToScreen(u)),e.lineTo(n.xToScreen(r),n.yToScreen(u)),e.lineTo(n.xToScreen(r),n.yToScreen(t.minY))}function X(e){var n;for(let r=0;r<(null===(n=e.series)||void 0===n?void 0:n.length);r++){const n=e.series[r];if(n.points.every((e=>0!==e.x)))continue;let t=Number.MAX_VALUE,o=0,i=0;const a=[];for(let e=0;e<n.points.length;e++)n.points[e].x<t&&0!==n.points[e].x&&(t=n.points[e].x),n.points[e].x>o&&0!==n.points[e].x&&(o=n.points[e].x),a.includes(n.points[e].x)||(a[a.length]=n.points[e].x,i++);const u=Math.pow(10,Math.log10(t)-(Math.log10(o)-Math.log10(t)/(i-1)));for(let e=0;e<n.points.length;e++)0===n.points[e].x&&(n.points[e].x=u)}}class B extends t.GridCellRenderer{get name(){return a.d8}get cellType(){return a.d8}getDefaultSize(e){return{width:220,height:150}}onClick(e,n){var r,t,i,a,u,c,f,l;if(!e.cell.value)return;const p=e.cell.column.getTag(y)===g?(0,h.f)(e.cell.value):L(e);if(null===(r=p.series)||void 0===r?void 0:r.some((e=>0===e.points.length)))return;o.shell.o=e;const w=e.bounds.inflate(N/2,N/2),b=E(w,e.bounds.width>=180&&e.bounds.height>=140,e.bounds.width>=275&&e.bounds.height>=225)[0],T=(0,m.dU)(p),C=new s.l(T,b,null!==(i=null===(t=p.chartOptions)||void 0===t?void 0:t.logX)&&void 0!==i&&i,null!==(u=null===(a=p.chartOptions)||void 0===a?void 0:a.logY)&&void 0!==u&&u);for(let r=0;r<(null===(c=p.series)||void 0===c?void 0:c.length);r++)if(!(!p.series[r].clickToToggle||"points"!==p.series[r].showPoints||w.width<x||w.height<v))for(let t=0;t<p.series[r].points.length;t++){const o=p.series[r].points[t],i=C.xToScreen(o.x),a=C.yToScreen(o.y),u=(o.outlier?12:4)/2+2;if(n.offsetX>=i-u&&n.offsetX<=i+u&&n.offsetY>=a-u&&n.offsetY<=a+u){o.outlier=!o.outlier;const n=e.grid.dataFrame.columns.byTags({".sourceColumn":e.cell.column.name});if(n)for(const t of n){const n={logX:null===(f=p.chartOptions)||void 0===f?void 0:f.logX,logY:null===(l=p.chartOptions)||void 0===l?void 0:l.logY},o=null!==t.tags[".seriesAggregation"]?(0,d.No)(p,t.tags[".seriesAggregation"]):t.tags[".seriesNumber"]===r?(0,d.hS)(p.series[r],n):null;null!==o&&t.set(e.cell.rowIndex,o[t.tags[".statistics"]])}if(e.cell.column.getTag(y)!==g){const n=JSON.parse(e.cell.value);n.series[r].points[t].outlier=o.outlier,e.cell.value=JSON.stringify(n)}return}}}onDoubleClick(e,n){if(!e.cell.value)return;const r=p.$.fromGridCell(e),t=i.dialog({title:"Edit chart"}).add(r.root).show({resizable:!0}).root.getElementsByClassName("d4-dialog-contents dlg-edit-chart")[0].firstChild;r.canvas.width=t.clientWidth,r.canvas.height=t.clientHeight,r.render(),t.style.width="100%",t.style.height="100%",i.tools.handleResize(t,((e,n)=>{r.canvas.width=e,r.canvas.height=n,r.render()}))}renderCurves(e,n,r,o,i,u){var c,f,h,p,d,y,g,A,k,M,S,O,L,j,q,R,B,U,G,H,W,$,K,z,Q;e.save(),e.beginPath(),e.rect(n,r,o,i),e.clip(),(null===(c=u.chartOptions)||void 0===c?void 0:c.allowXZeroes)&&(null===(f=u.chartOptions)||void 0===f?void 0:f.logX)&&(null===(h=u.series)||void 0===h?void 0:h.some((e=>e.points.some((e=>0===e.x)))))&&X(u);const Z=new t.Rect(n,r,o,i).inflate(N/2,N/2),J=Z.width>=x&&Z.height>=v,ee=o>=180&&i>=140&&!!(null===(p=u.chartOptions)||void 0===p?void 0:p.xAxisName)&&!!u.chartOptions.yAxisName,ne=o>=275&&i>=225&&!!(null===(d=u.chartOptions)||void 0===d?void 0:d.title),re=o>=120&&i>=110,[te,oe,ie]=E(Z,ee,ne),ae=(0,m.dU)(u);(ae.x<0&&u.chartOptions||0===ae.x&&u.chartOptions&&!u.chartOptions.allowXZeroes)&&(u.chartOptions.logX=!1),ae.y<=0&&u.chartOptions&&(u.chartOptions.logY=!1);const ue=new s.l(ae,te,null!==(g=null===(y=u.chartOptions)||void 0===y?void 0:y.logX)&&void 0!==g&&g,null!==(k=null===(A=u.chartOptions)||void 0===A?void 0:A.logY)&&void 0!==k&&k),se=Math.min(te.width,te.height),ce=se>100?1:.2+se/100*.8,fe={logX:null===(M=u.chartOptions)||void 0===M?void 0:M.logX,logY:null===(S=u.chartOptions)||void 0===S?void 0:S.logY};e.save(),e.font='11px Roboto, "Roboto Local"',ue.drawCoordinateGrid(e,oe,ie),e.restore();for(let n=0;n<(null===(O=u.series)||void 0===O?void 0:O.length);n++){const r=u.series[n];if(r.points.some((e=>void 0===e.x||void 0===e.y)))continue;(o<70||i<45)&&(r.showPoints="",u.chartOptions&&(u.chartOptions.showStatistics=[])),r.points.sort(((e,n)=>e.x-n.x));let s=!0;const c=(0,m.Y6)(r);let f;if(r.parameters)(null===(L=u.chartOptions)||void 0===L?void 0:L.logX)&&r.parameters[2]>0&&(r.parameters[2]=Math.log10(r.parameters[2])),f=(0,m.kG)(r,c);else{const e=(0,m.PK)(r,c,fe);f=e.fittedCurve,r.parameters=e.parameters,s=!1}if(null===(j=r.showPoints)||void 0===j||j){const o=r.pointColor&&t.Color.fromHtml(r.pointColor)?r.pointColor:t.Color.toHtml(t.Color.getCategoricalColor(n)),i=r.outlierColor&&t.Color.fromHtml(r.outlierColor)?t.Color.fromHtml(r.outlierColor):t.Color.red;e.strokeStyle=o,"points"===r.showPoints?F(e,r,ue,ce,0,t.Color.fromHtml(o),i):["candlesticks","both"].includes(r.showPoints)&&I(e,r,ue,ce,t.Color.fromHtml(o))}if(null===(q=r.showFitLine)||void 0===q||q){const o=r.fitLineColor&&t.Color.fromHtml(r.fitLineColor)?r.fitLineColor:t.Color.toHtml(t.Color.getCategoricalColor(n));e.save(),e.strokeStyle=o,e.lineWidth=2*ce,e.beginPath(),r.lineStyle&&e.setLineDash(P[r.lineStyle]);const i=J?ee?b:w:0,a=J?_:0;for(let n=i;n<=Z.width-a;n++){const r=Z.x+n,t=(null===(R=u.chartOptions)||void 0===R?void 0:R.logX)?Math.log10(ue.xToWorld(r)):ue.xToWorld(r),o=(null===(B=u.chartOptions)||void 0===B?void 0:B.logY)?ue.yToScreen(Math.pow(10,f(t))):ue.yToScreen(f(t));n===i?e.moveTo(r,o):e.lineTo(r,o)}e.stroke(),e.restore()}if((null===(U=r.showFitLine)||void 0===U||U)&&null!==(G=r.showCurveConfidenceInterval)&&void 0!==G&&G){e.strokeStyle=null!==(H=r.confidenceIntervalColor)&&void 0!==H?H:a.Qc,e.fillStyle=null!==(W=r.confidenceIntervalColor)&&void 0!==W?W:a.XD;const n=(0,m.LC)(r,c,s,fe);Y(e,n,Z,ue,a.vK.TOP,J,ee,fe),Y(e,n,Z,ue,a.vK.BOTTOM,J,ee,fe),V(e,n,Z,ue,J,ee,fe)}if(r.droplines&&re){e.save(),e.strokeStyle="blue",e.lineWidth=ce,e.beginPath(),e.setLineDash([5,5]);for(let n=0;n<r.droplines.length;n++)"IC50"===r.droplines[n]&&D(e,ue,r.parameters[2],ae,f,fe);e.stroke(),e.restore()}if(null===($=u.chartOptions)||void 0===$?void 0:$.showStatistics){const o=(0,m.tq)(r,c,fe);for(let i=0;i<u.chartOptions.showStatistics.length;i++){const s=u.chartOptions.showStatistics[i],c=a.sw.find((e=>e.name===s));if(c){const a=l.formatNumber(c.get(o)),u=r.fitLineColor&&t.Color.fromHtml(r.fitLineColor)?r.fitLineColor:t.Color.toHtml(t.Color.getCategoricalColor(n));e.fillStyle=u,e.textAlign="left",e.fillText(c.name+": "+a,te.x+5,te.y+20+20*i)}}}}if(ne&&(e.font='12px Roboto, "Roboto Local"',e.textAlign="center",e.fillStyle="black",e.fillText(null===(K=u.chartOptions)||void 0===K?void 0:K.title,te.midX-5,r+15)),ee){e.font='11px Roboto, "Roboto Local"',e.textAlign="center",e.fillStyle="black",e.fillText(null===(z=u.chartOptions)||void 0===z?void 0:z.xAxisName,te.midX-5,r+i-10),e.translate(n,r),e.rotate(-Math.PI/2);const t=ne?C:T;e.fillText(null===(Q=u.chartOptions)||void 0===Q?void 0:Q.yAxisName,-(te.height/2+t+15),15),e.restore()}e.restore()}render(e,n,r,t,o,i,a){var u,s;if(t<20||o<10)return;if(!i.cell.value)return;const c=(null===(u=i.cell.column)||void 0===u?void 0:u.getTag(y))===g?(0,h.f)(i.cell.value):L(i);(null===(s=c.series)||void 0===s?void 0:s.some((e=>0===e.points.length)))||this.renderCurves(e,n,r,t,o,c)}onMouseMove(e,n){var r,t,o,a,u;if(!e.cell.value)return;if(e.bounds.width<70||e.bounds.height<45){const r=i.canvas(300,200);this.render(r.getContext("2d"),0,0,300,200,e,null);const t=i.divV([r]);i.tooltip.show(t,n.x,n.y)}const c=e.cell.column.getTag(y)===g?(0,h.f)(e.cell.value):L(e),f=e.bounds.inflate(N/2,N/2),l=E(f,e.bounds.width>=180&&e.bounds.height>=140,e.bounds.width>=275&&e.bounds.height>=225)[0],p=(0,m.dU)(c),d=new s.l(p,l,null!==(t=null===(r=c.chartOptions)||void 0===r?void 0:r.logX)&&void 0!==t&&t,null!==(a=null===(o=c.chartOptions)||void 0===o?void 0:o.logY)&&void 0!==a&&a);for(let e=0;e<(null===(u=c.series)||void 0===u?void 0:u.length);e++)if(!(!c.series[e].clickToToggle||"points"!==c.series[e].showPoints||f.width<x||f.height<v))for(let r=0;r<c.series[e].points.length;r++){const t=c.series[e].points[r],o=d.xToScreen(t.x),i=d.yToScreen(t.y),a=(t.outlier?12:4)/2+2;if(n.offsetX>=o-a&&n.offsetX<=o+a&&n.offsetY>=i-a&&n.offsetY<=i+a)return void(document.body.style.cursor="pointer")}document.body.style.cursor="default"}}},363:(e,n,r)=>{"use strict";var t=r(976);r(188),r(559),r(870),r(184),r(875),rxjs.operators,rxjs,r(840),r(711),new t.Package},976:e=>{"use strict";e.exports=DG},469:e=>{"use strict";e.exports=grok},870:e=>{"use strict";e.exports=ui},414:e=>{"use strict";e.exports=wu}},__webpack_module_cache__={};function __webpack_require__(e){var n=__webpack_module_cache__[e];if(void 0!==n)return n.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(n,{a:n}),n},__webpack_require__.d=(e,n)=>{for(var r in n)__webpack_require__.o(n,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__={};(()=>{"use strict";__webpack_require__.r(__webpack_exports__),__webpack_require__.d(__webpack_exports__,{_package:()=>K,test:()=>z,tests:()=>f});var e=__webpack_require__(976),n=__webpack_require__(469);__webpack_require__(133);const r=e.DataFrame.fromCsv('countries,fasta,smiles,molregno,LON,Zip Code,Street Address Line 1,ImageUrl,user_id,error_message,xray,flag,magnitude,CS-id,pdb_id,accel_a,time_offset,chart,fit,Questions,empty_number,empty_string\nBelgium,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C(=O)OCCCc1cccnc1)c2cccc(c2)C(=O)c3ccccc3,1480014,36.276729583740234,995042300,14016 ROUTE 31W,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,1,1,1QBS,1,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.497360340644872, 1.7058694986686864, 5.278052678195135, 0.16000320889028383],""points"":[{""x"":0.10000000149011612,""y"":2.374499797821045},{""x"":0.6000000238418579,""y"":2.6242473125457764},{""x"":1.100000023841858,""y"":2.367267608642578},{""x"":1.600000023841858,""y"":2.6723148822784424},{""x"":2.0999999046325684,""y"":2.6537344455718994},{""x"":2.5999999046325684,""y"":2.3651671409606934},{""x"":3.0999999046325684,""y"":2.5654284954071045},{""x"":3.5999999046325684,""y"":2.4160959720611572},{""x"":4.099999904632568,""y"":2.286726713180542},{""x"":4.599999904632568,""y"":2.5100042819976807},{""x"":5.099999904632568,""y"":1.6676985025405884},{""x"":5.599999904632568,""y"":0.680136501789093},{""x"":6.099999904632568,""y"":0.3391543924808502},{""x"":6.599999904632568,""y"":0.09038983285427094},{""x"":7.099999904632568,""y"":0.19802775979042053}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[7.525235855508179, 1.3186911876809984, 5.335672608564294, 0.7860743343958098],""points"":[{""x"":0.10000000149011612,""y"":7.988070487976074},{""x"":0.6000000238418579,""y"":7.018453121185303},{""x"":1.100000023841858,""y"":8.115279197692871},{""x"":1.600000023841858,""y"":7.486658096313477},{""x"":2.0999999046325684,""y"":7.396438121795654},{""x"":2.5999999046325684,""y"":7.477052211761475},{""x"":3.0999999046325684,""y"":6.913095474243164},{""x"":3.5999999046325684,""y"":8.01385498046875},{""x"":4.099999904632568,""y"":6.985900402069092},{""x"":4.599999904632568,""y"":6.970335960388184},{""x"":5.099999904632568,""y"":5.448817253112793},{""x"":5.599999904632568,""y"":2.5534818172454834},{""x"":6.099999904632568,""y"":1.893947958946228},{""x"":6.599999904632568,""y"":0.6340042352676392},{""x"":7.099999904632568,""y"":0.8403874039649963}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,100,abc\nBurundi,MDYKETLLMPKTDFPMRGGLPNKEPQIQEKW,COc1ccc2cc(ccc2c1)C(C)C(=O)Oc3ccc(C)cc3OC,1480015,36.276729583740234,995073444,80 STATE HIGHWAY 310,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,2,2,1ZP8,2,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.431460753103398, 2.1691498799246745, 5.266445597102774, 0.7825762827017926],""points"":[{""x"":0.10000000149011612,""y"":4.751083850860596},{""x"":0.6000000238418579,""y"":4.203000068664551},{""x"":1.100000023841858,""y"":4.415858745574951},{""x"":1.600000023841858,""y"":4.68414306640625},{""x"":2.0999999046325684,""y"":4.198400974273682},{""x"":2.5999999046325684,""y"":4.179222106933594},{""x"":3.0999999046325684,""y"":4.638473987579346},{""x"":3.5999999046325684,""y"":4.708553314208984},{""x"":4.099999904632568,""y"":4.291589260101318},{""x"":4.599999904632568,""y"":4.038082599639893},{""x"":5.099999904632568,""y"":3.4349939823150635},{""x"":5.599999904632568,""y"":1.2194708585739136},{""x"":6.099999904632568,""y"":1.1920831203460693},{""x"":6.599999904632568,""y"":0.5352635979652405},{""x"":7.099999904632568,""y"":0.3346920311450958}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.339458017970126, -1.0734184310171178, 4.746332950550934, 0.2482416857595658],""points"":[{""x"":0.10000000149011612,""y"":0.2139337658882141},{""x"":0.6000000238418579,""y"":0.4269562065601349},{""x"":1.100000023841858,""y"":0.2441573292016983},{""x"":1.600000023841858,""y"":0.146635964512825},{""x"":2.0999999046325684,""y"":0.08818462491035461},{""x"":2.5999999046325684,""y"":0.2560656666755676},{""x"":3.0999999046325684,""y"":0.42434045672416687},{""x"":3.5999999046325684,""y"":0.37111231684684753},{""x"":4.099999904632568,""y"":0.5581737160682678},{""x"":4.599999904632568,""y"":1.183590054512024},{""x"":5.099999904632568,""y"":1.5629843473434448},{""x"":5.599999904632568,""y"":2.3211288452148438},{""x"":6.099999904632568,""y"":2.229961633682251},{""x"":6.599999904632568,""y"":2.2560226917266846},{""x"":7.099999904632568,""y"":2.2142398357391357}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCameroon,MIEVFLFGIVLGLIPITLAGLFVTAYLQYRRGDQLDL,COc1ccc2cc(ccc2c1)C(C)C(=O)OCCCc3cccnc3,1480016,36.26095962524414,995153596,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,3,3,2BDJ,3,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[4.6760652578642325, 0.9046956320756703, 5.651408971856738, 0.07738846012184185],""points"":[{""x"":0.10000000149011612,""y"":4.32425594329834},{""x"":0.6000000238418579,""y"":4.668442249298096},{""x"":1.100000023841858,""y"":4.379785060882568},{""x"":1.600000023841858,""y"":5.0345139503479},{""x"":2.0999999046325684,""y"":4.878653526306152},{""x"":2.5999999046325684,""y"":4.3451313972473145},{""x"":3.0999999046325684,""y"":4.336992263793945},{""x"":3.5999999046325684,""y"":5.037430286407471},{""x"":4.099999904632568,""y"":5.0092692375183105},{""x"":4.599999904632568,""y"":4.151902675628662},{""x"":5.099999904632568,""y"":3.4066951274871826},{""x"":5.599999904632568,""y"":2.3732759952545166},{""x"":6.099999904632568,""y"":1.673728108406067},{""x"":6.599999904632568,""y"":0.48574790358543396},{""x"":7.099999904632568,""y"":0.2783052325248718}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[2.938395863010111, -1.4658480661392117, 5.462702751996584, 0.3473139023615039],""points"":[{""x"":0.10000000149011612,""y"":0.4941710829734802},{""x"":0.6000000238418579,""y"":0.15323974192142487},{""x"":1.100000023841858,""y"":0.46373432874679565},{""x"":1.600000023841858,""y"":0.3370431363582611},{""x"":2.0999999046325684,""y"":0.5179030299186707},{""x"":2.5999999046325684,""y"":0.27899765968322754},{""x"":3.0999999046325684,""y"":0.22075064480304718},{""x"":3.5999999046325684,""y"":0.5789918899536133},{""x"":4.099999904632568,""y"":0.21169911324977875},{""x"":4.599999904632568,""y"":0.27857646346092224},{""x"":5.099999904632568,""y"":1.0906332731246948},{""x"":5.599999904632568,""y"":1.8520300388336182},{""x"":6.099999904632568,""y"":2.7177059650421143},{""x"":6.599999904632568,""y"":2.8680918216705322},{""x"":7.099999904632568,""y"":3.2413077354431152}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCanada,MMELVLKTIIGPIVVGVVLRIVDKWLNKDK,CC(C(=O)NCCS)c1cccc(c1)C(=O)c2ccccc2,1480017,36.26095962524414,99515,30-56 WHITESTONE EXPY,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,4,4,1IAN,4,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[0.8597390975430008, 1.0957625732481946, 5.260537067987958, 0.07974187998177736],""points"":[{""x"":0.10000000149011612,""y"":0.8190152645111084},{""x"":0.6000000238418579,""y"":0.8421689867973328},{""x"":1.100000023841858,""y"":0.8740922212600708},{""x"":1.600000023841858,""y"":0.8924275040626526},{""x"":2.0999999046325684,""y"":0.8249067664146423},{""x"":2.5999999046325684,""y"":0.9327669143676758},{""x"":3.0999999046325684,""y"":0.8522974252700806},{""x"":3.5999999046325684,""y"":0.8174492716789246},{""x"":4.099999904632568,""y"":0.8394647240638733},{""x"":4.599999904632568,""y"":0.7139387726783752},{""x"":5.099999904632568,""y"":0.5561167597770691},{""x"":5.599999904632568,""y"":0.3276226818561554},{""x"":6.099999904632568,""y"":0.12479474395513535},{""x"":6.599999904632568,""y"":0.13006797432899475},{""x"":7.099999904632568,""y"":0.059702079743146896}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.760930219582546, 1.6591793293833013, 4.667155929720851, 0.7858109544121652],""points"":[{""x"":0.10000000149011612,""y"":6.156993389129639},{""x"":0.6000000238418579,""y"":5.236701965332031},{""x"":1.100000023841858,""y"":6.010560512542725},{""x"":1.600000023841858,""y"":5.495512962341309},{""x"":2.0999999046325684,""y"":6.087770462036133},{""x"":2.5999999046325684,""y"":5.79986572265625},{""x"":3.0999999046325684,""y"":5.597546577453613},{""x"":3.5999999046325684,""y"":5.520902156829834},{""x"":4.099999904632568,""y"":5.360654354095459},{""x"":4.599999904632568,""y"":3.5539746284484863},{""x"":5.099999904632568,""y"":1.577236294746399},{""x"":5.599999904632568,""y"":1.0001264810562134},{""x"":6.099999904632568,""y"":0.9305797815322876},{""x"":6.599999904632568,""y"":0.6033638715744019},{""x"":7.099999904632568,""y"":0.4203685522079468}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nColombia,MDRTDEVSNHTHDKPTLTWFEEIFEEYHSPFHN,FC(F)(F)c1ccc(OC2CCNCC2)cc1,1480029,36.3309440612793,995152050,1 COURT HOUSE SQUARE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,5,5,4UJ1,5,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[6.4995088314153655, 2.4270351004539914, 5.178659535348579, 0.625653346241577],""points"":[{""x"":0.10000000149011612,""y"":6.496231555938721},{""x"":0.6000000238418579,""y"":6.42543363571167},{""x"":1.100000023841858,""y"":7.040063858032227},{""x"":1.600000023841858,""y"":6.1115403175354},{""x"":2.0999999046325684,""y"":6.680728435516357},{""x"":2.5999999046325684,""y"":6.406774520874023},{""x"":3.0999999046325684,""y"":6.611269474029541},{""x"":3.5999999046325684,""y"":5.889094352722168},{""x"":4.099999904632568,""y"":6.75344705581665},{""x"":4.599999904632568,""y"":6.361435890197754},{""x"":5.099999904632568,""y"":4.1666975021362305},{""x"":5.599999904632568,""y"":1.172118902206421},{""x"":6.099999904632568,""y"":0.801048994064331},{""x"":6.599999904632568,""y"":0.4640021026134491},{""x"":7.099999904632568,""y"":0.0010357667924836278}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[1.4734381347446401, 1.1649805188074196, 4.82958608866421, 0.09500545496710007],""points"":[{""x"":0.10000000149011612,""y"":1.5279096364974976},{""x"":0.6000000238418579,""y"":1.3559974431991577},{""x"":1.100000023841858,""y"":1.5246378183364868},{""x"":1.600000023841858,""y"":1.5567657947540283},{""x"":2.0999999046325684,""y"":1.4114240407943726},{""x"":2.5999999046325684,""y"":1.4045010805130005},{""x"":3.0999999046325684,""y"":1.4769829511642456},{""x"":3.5999999046325684,""y"":1.4875500202178955},{""x"":4.099999904632568,""y"":1.2991987466812134},{""x"":4.599999904632568,""y"":0.922961413860321},{""x"":5.099999904632568,""y"":0.6520044803619385},{""x"":5.599999904632568,""y"":0.15350978076457977},{""x"":6.099999904632568,""y"":0.1078903079032898},{""x"":6.599999904632568,""y"":0.17276449501514435},{""x"":7.099999904632568,""y"":0.14066608250141144}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCosta Rica,MKSTKEEIQTIKTLLKDSRTAKYHKRLQIVL,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCCc3ccccc3,1480018,36.3309440612793,995084218,4041 SOUTHWESTERN BLVD,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,6,6,2BPW,6,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.4833641843311227, -1.8945978742090062, 4.671127708092568, 0.24159861311815153],""points"":[{""x"":0.10000000149011612,""y"":0.0969524160027504},{""x"":0.6000000238418579,""y"":0.028483040630817413},{""x"":1.100000023841858,""y"":0.22087176144123077},{""x"":1.600000023841858,""y"":0.0068915546871721745},{""x"":2.0999999046325684,""y"":0.4305879771709442},{""x"":2.5999999046325684,""y"":0.44774115085601807},{""x"":3.0999999046325684,""y"":0.45346319675445557},{""x"":3.5999999046325684,""y"":0.2370593100786209},{""x"":4.099999904632568,""y"":0.4657953977584839},{""x"":4.599999904632568,""y"":1.155200719833374},{""x"":5.099999904632568,""y"":2.2294070720672607},{""x"":5.599999904632568,""y"":2.4311530590057373},{""x"":6.099999904632568,""y"":2.33846116065979},{""x"":6.599999904632568,""y"":2.608201026916504},{""x"":7.099999904632568,""y"":2.8136143684387207}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.224573521642033, 1.4454033924198528, 5.6014197746076535, 0.2823216054197577],""points"":[{""x"":0.10000000149011612,""y"":4.95027494430542},{""x"":0.6000000238418579,""y"":5.1754679679870605},{""x"":1.100000023841858,""y"":5.276752948760986},{""x"":1.600000023841858,""y"":5.589294910430908},{""x"":2.0999999046325684,""y"":5.616994857788086},{""x"":2.5999999046325684,""y"":5.120813846588135},{""x"":3.0999999046325684,""y"":5.340766906738281},{""x"":3.5999999046325684,""y"":4.876471042633057},{""x"":4.099999904632568,""y"":4.94999361038208},{""x"":4.599999904632568,""y"":5.162564754486084},{""x"":5.099999904632568,""y"":4.399557590484619},{""x"":5.599999904632568,""y"":2.7977969646453857},{""x"":6.099999904632568,""y"":1.0229872465133667},{""x"":6.599999904632568,""y"":0.48275601863861084},{""x"":7.099999904632568,""y"":0.10408931970596313}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nCuba,MHAILRYFIRRLFYHIFYKIYSLISKKHQSLPSDVRQF,COc1ccc2c(c1)c(CC(=O)N3CCCC3C(=O)Oc4ccc(C)cc4OC)c(C)n2C(=O)c5ccc(Cl)cc5,1480019,36.33115768432617,995081928,1227 US HIGHWAY 11,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,7,7,1QBS,7,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.320838679713925, -1.2421619987316728, 4.831325425225256, 0.3236011098403072],""points"":[{""x"":0.10000000149011612,""y"":0.3727470338344574},{""x"":0.6000000238418579,""y"":0.12365014106035233},{""x"":1.100000023841858,""y"":0.48422467708587646},{""x"":1.600000023841858,""y"":0.2264465093612671},{""x"":2.0999999046325684,""y"":0.16821794211864471},{""x"":2.5999999046325684,""y"":0.3879014551639557},{""x"":3.0999999046325684,""y"":0.5470244884490967},{""x"":3.5999999046325684,""y"":0.3419053554534912},{""x"":4.099999904632568,""y"":0.7655120491981506},{""x"":4.599999904632568,""y"":1.2346516847610474},{""x"":5.099999904632568,""y"":2.453336715698242},{""x"":5.599999904632568,""y"":2.9565491676330566},{""x"":6.099999904632568,""y"":3.335299491882324},{""x"":6.599999904632568,""y"":3.240290880203247},{""x"":7.099999904632568,""y"":3.1107218265533447}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.6401853521511094, 1.26211588875013, 5.399028074402744, 0.5089580830068091],""points"":[{""x"":0.10000000149011612,""y"":3.8585598468780518},{""x"":0.6000000238418579,""y"":3.6077206134796143},{""x"":1.100000023841858,""y"":3.855252265930176},{""x"":1.600000023841858,""y"":3.619039297103882},{""x"":2.0999999046325684,""y"":3.839388370513916},{""x"":2.5999999046325684,""y"":3.335283041000366},{""x"":3.0999999046325684,""y"":3.571141481399536},{""x"":3.5999999046325684,""y"":3.4155046939849854},{""x"":4.099999904632568,""y"":3.7316646575927734},{""x"":4.599999904632568,""y"":3.0680155754089355},{""x"":5.099999904632568,""y"":2.891066551208496},{""x"":5.599999904632568,""y"":1.6022753715515137},{""x"":6.099999904632568,""y"":0.7652576565742493},{""x"":6.599999904632568,""y"":0.6875326037406921},{""x"":7.099999904632568,""y"":0.5828871726989746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nItaly,MSNFHNEHVMQFYRNNLKTKGVFGRQ,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO[N+](=O)[O-],1480020,36.33115768432617,99502,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,8,8,1ZP8,8,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[2.293592105923809, 1.3781586549141835, 5.1025898038676605, 0.03493851245291291],""points"":[{""x"":0.10000000149011612,""y"":2.1287283897399902},{""x"":0.6000000238418579,""y"":2.267972230911255},{""x"":1.100000023841858,""y"":2.398442506790161},{""x"":1.600000023841858,""y"":2.5130622386932373},{""x"":2.0999999046325684,""y"":2.3255116939544678},{""x"":2.5999999046325684,""y"":2.127340793609619},{""x"":3.0999999046325684,""y"":2.47259783744812},{""x"":3.5999999046325684,""y"":2.131181478500366},{""x"":4.099999904632568,""y"":2.090421438217163},{""x"":4.599999904632568,""y"":2.02299165725708},{""x"":5.099999904632568,""y"":1.1105059385299683},{""x"":5.599999904632568,""y"":0.4494485855102539},{""x"":6.099999904632568,""y"":0.1375635862350464},{""x"":6.599999904632568,""y"":0.036351121962070465},{""x"":7.099999904632568,""y"":0.1619771122932434}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.953125499439879, 1.2528620255306528, 5.187637440149802, 0.3110348753260886],""points"":[{""x"":0.10000000149011612,""y"":5.6585283279418945},{""x"":0.6000000238418579,""y"":5.911152362823486},{""x"":1.100000023841858,""y"":5.924920082092285},{""x"":1.600000023841858,""y"":5.8469438552856445},{""x"":2.0999999046325684,""y"":5.929472923278809},{""x"":2.5999999046325684,""y"":6.190037727355957},{""x"":3.0999999046325684,""y"":6.236179828643799},{""x"":3.5999999046325684,""y"":6.141019344329834},{""x"":4.099999904632568,""y"":5.295210838317871},{""x"":4.599999904632568,""y"":5.265801906585693},{""x"":5.099999904632568,""y"":3.3722851276397705},{""x"":5.599999904632568,""y"":1.8299226760864258},{""x"":6.099999904632568,""y"":0.32690900564193726},{""x"":6.599999904632568,""y"":0.6274543404579163},{""x"":7.099999904632568,""y"":0.8441857099533081}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nRwanda,MPNSEPASLLELFNSIATQGELVRSLKAGNASK,CC(C)Cc1ccc(cc1)C(C)C(=O)N2CCCC2C(=O)OCCO,1480021,36.33137130737305,995037247,"168-46 91ST AVE., 2ND FLR",https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,9,2BDJ,9,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[3.8209972202654474, 1.3779216716448506, 5.299882228439686, 0.06040645519069608],""points"":[{""x"":0.10000000149011612,""y"":3.7821109294891357},{""x"":0.6000000238418579,""y"":3.542433023452759},{""x"":1.100000023841858,""y"":3.7008674144744873},{""x"":1.600000023841858,""y"":3.717301607131958},{""x"":2.0999999046325684,""y"":4.024452209472656},{""x"":2.5999999046325684,""y"":4.013899326324463},{""x"":3.0999999046325684,""y"":3.945094347000122},{""x"":3.5999999046325684,""y"":3.866621971130371},{""x"":4.099999904632568,""y"":3.7461626529693604},{""x"":4.599999904632568,""y"":3.3454740047454834},{""x"":5.099999904632568,""y"":2.61944317817688},{""x"":5.599999904632568,""y"":0.999405026435852},{""x"":6.099999904632568,""y"":0.46259793639183044},{""x"":6.599999904632568,""y"":0.054134611040353775},{""x"":7.099999904632568,""y"":0.05711187422275543}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[5.6318079657726035, 1.8495493770000595, 5.391793312471116, 0.17060707587348442],""points"":[{""x"":0.10000000149011612,""y"":5.458079814910889},{""x"":0.6000000238418579,""y"":5.554427146911621},{""x"":1.100000023841858,""y"":5.799983024597168},{""x"":1.600000023841858,""y"":5.364140033721924},{""x"":2.0999999046325684,""y"":5.864485740661621},{""x"":2.5999999046325684,""y"":5.4509806632995605},{""x"":3.0999999046325684,""y"":5.702574729919434},{""x"":3.5999999046325684,""y"":5.7314534187316895},{""x"":4.099999904632568,""y"":5.5123443603515625},{""x"":4.599999904632568,""y"":5.724395751953125},{""x"":5.099999904632568,""y"":4.354506969451904},{""x"":5.599999904632568,""y"":1.7307666540145874},{""x"":6.099999904632568,""y"":0.6305936574935913},{""x"":6.599999904632568,""y"":0.035183437168598175},{""x"":7.099999904632568,""y"":0.7575169205665588}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\nSwitzerland,IRVVGRYLIEVWKAAGMDMDKVLFLWSSDEI,CN1CCC(CC1)Oc2ccc(cc2)C(F)(F)F,1480028,36.33137130737305,99504,92-11 179TH PLACE,https://datagrok.ai/img/slides/access-db-connect.png,id,ErrorMessage,"COMPND \nATOM \nEND",flag,9,10,1IAN,10,1.23,<chart></chart>,"{""series"":[{""name"":""Run:2023-08-08"",""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showPoints"":""points"",""parameters"":[1.1190255865097471, 2.3163895161544437, 5.4968866182279195, 0.2035204047289052],""points"":[{""x"":0.10000000149011612,""y"":1.1057683229446411},{""x"":0.6000000238418579,""y"":1.1019697189331055},{""x"":1.100000023841858,""y"":1.0818607807159424},{""x"":1.600000023841858,""y"":1.062997817993164},{""x"":2.0999999046325684,""y"":1.046447515487671},{""x"":2.5999999046325684,""y"":1.1217249631881714},{""x"":3.0999999046325684,""y"":1.2166996002197266},{""x"":3.5999999046325684,""y"":1.215477705001831},{""x"":4.099999904632568,""y"":1.0581893920898438},{""x"":4.599999904632568,""y"":1.1747995615005493},{""x"":5.099999904632568,""y"":1.0181127786636353},{""x"":5.599999904632568,""y"":0.5344523191452026},{""x"":6.099999904632568,""y"":0.2569526433944702},{""x"":6.599999904632568,""y"":0.1912207305431366},{""x"":7.099999904632568,""y"":0.15060538053512573}]},{""name"":""Run:2023-08-08"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showPoints"":""points"",""parameters"":[3.1038581025805785, 2.0032224204185245, 5.087602825989163, 0.13277988512492753],""points"":[{""x"":0.10000000149011612,""y"":3.0498509407043457},{""x"":0.6000000238418579,""y"":2.805217742919922},{""x"":1.100000023841858,""y"":3.3415253162384033},{""x"":1.600000023841858,""y"":3.0549843311309814},{""x"":2.0999999046325684,""y"":3.250074863433838},{""x"":2.5999999046325684,""y"":3.0432586669921875},{""x"":3.0999999046325684,""y"":3.265852451324463},{""x"":3.5999999046325684,""y"":2.9475724697113037},{""x"":4.099999904632568,""y"":3.1929898262023926},{""x"":4.599999904632568,""y"":2.7460060119628906},{""x"":5.099999904632568,""y"":1.6175861358642578},{""x"":5.599999904632568,""y"":0.3006608486175537},{""x"":6.099999904632568,""y"":0.3444803059101105},{""x"":6.599999904632568,""y"":0.015537971630692482},{""x"":7.099999904632568,""y"":0.5527358055114746}]}],""chartOptions"":{""xAxisName"":""Conc."",""yAxisName"":""Activity"",""title"":""Dose-Response curves""}}",text,,\n,,,,,,,,,,,,,,,,,,,,,');r.columns.add(e.Column.fromList(e.TYPE.BYTE_ARRAY,"BinaryImage",Array.from(new Uint8Array(11))));var t=function(e,n,r,t){return new(r||(r=Promise))((function(o,i){function a(e){try{s(t.next(e))}catch(e){i(e)}}function u(e){try{s(t.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,u)}s((t=t.apply(e,n||[])).next())}))};const o=3e4,i=108e5,a=console.log.bind(console),u=console.info.bind(console),s=console.warn.bind(console),c=console.error.bind(console),f={},l="Auto Tests",m="Demo",h="Detectors",p="Core",d={};let y;var g;!function(e){e.notNull=function(e,n){if(null==e)throw new Error(`${null==n?"Value":n} not defined`)}}(g||(g={}));class x{constructor(e,n){this.catchUnhandled=!0,this.report=!1,void 0!==e&&(this.catchUnhandled=e),void 0!==n&&(this.report=n)}}class v{constructor(e,n,r,i){var a;this.category=e,this.name=n,null!=i||(i={}),null!==(a=i.timeout)&&void 0!==a||(i.timeout=o),this.options=i,this.test=()=>t(this,void 0,void 0,(function*(){return new Promise(((e,n)=>t(this,void 0,void 0,(function*(){let t="";try{t=yield r()}catch(e){n(e)}e(t)}))))}))}}function w(e,n,r){null==f[y]&&(f[y]={}),null==f[y].tests&&(f[y].tests=[]),f[y].tests.push(new v(y,e,n,r))}function b(e,n=!0,r){if(r=r?`${r}, `:"",e!==n)throw new Error(`${r}Expected "${n}", got "${e}"`)}function T(e,n,r=.001,t){if(e===Number.POSITIVE_INFINITY&&n===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY&&n===Number.NEGATIVE_INFINITY||e===Number.NaN&&n===Number.NaN||isNaN(e)&&isNaN(n))return;const o=Math.abs(e-n)<r;if(b(o,!0,`${null!=t?t:""} (tolerance = ${r})`),!o)throw new Error(`Expected ${n}, got ${e} (tolerance = ${r})`)}function C(e,n){for(const[r,t]of Object.entries(n)){if(!e.hasOwnProperty(r))throw new Error(`Expected property "${r}" not found`);const n=e[r];if(n instanceof Array&&t instanceof Array)_(n,t);else if(n instanceof Object&&t instanceof Object)C(n,t);else if(Number.isFinite(n)&&Number.isFinite(t))T(n,t);else if(n!=t)throw new Error(`Expected (${t}) for key '${r}', got (${n})`)}}function _(e,n){const r=e.length,t=n.length;if(r!=t)throw new Error(`Arrays are of different length: actual array length is ${r} and expected array length is ${t}`);for(let t=0;t<r;t++)if(e[t]instanceof Array&&n[t]instanceof Array)_(e[t],n[t]);else if(e[t]instanceof Object&&n[t]instanceof Object)C(e[t],n[t]);else if(e[t]!=n[t])throw new Error(`Expected ${n[t]} at position ${t}, got ${e[t]}`)}function A(e,n,r){var t;y=e,n(),f[y]&&(f[y].clear=null===(t=null==r?void 0:r.clear)||void 0===t||t,f[y].timeout=null==r?void 0:r.timeout)}function k(e,n){return e.replace(new RegExp(n.name,"gi"),n.nqName)}function M(n){return`${n.toString()}\n${n.stack?e.Logger.translateStackTrace(n.stack):""}`}function S(r,u,s,c,f,l){var m,h,p,d,y,g;return t(this,void 0,void 0,(function*(){let t;s.length=0;let x="package";const v=null!=u&&r.name.toLowerCase()!==u.toLowerCase(),w=(null===(m=r.options)||void 0===m?void 0:m.skipReason)||v,b=v?"skipped":null===(h=r.options)||void 0===h?void 0:h.skipReason;w||a(`Started ${r.category} ${r.name}`);const T=Date.now();try{if(w)t={success:!0,result:b,ms:0,skipped:!0};else{let n=(null===(p=r.options)||void 0===p?void 0:p.timeout)===o&&c?c:null===(d=r.options)||void 0===d?void 0:d.timeout;n=e.Test.isInBenchmark&&n===o?i:n,t={success:!0,result:null!==(y=yield P(r.test,n))&&void 0!==y?y:"OK",ms:0,skipped:!1}}}catch(e){t={success:!1,result:M(e),ms:0,skipped:!1}}if((null===(g=r.options)||void 0===g?void 0:g.isAggregated)&&t.result.constructor===e.DataFrame){const e=t.result.col("success");if(x="core",e&&(t.success=e.stats.sum===e.length),!l){const e=t.result;e.columns.remove("stack"),e.rows.removeWhere((e=>e.get("success"))),t.result=e}t.result=t.result.toCsv()}if(t.logs=s.join("\n"),t.ms=Date.now()-T,w||a(`Finished ${r.category} ${r.name} for ${t.ms} ms`),t.category=r.category,t.name=r.name,!v){let e={success:t.success,result:t.result,ms:t.ms,skipped:t.skipped,type:x,packageName:f,category:r.category,test:r.name,logs:t.logs};if(t.result.constructor==Object){const n=Object.keys(t.result).reduce(((e,n)=>Object.assign(Object.assign({},e),{["result."+n]:t.result[n]})),{});e=Object.assign(Object.assign({},e),n)}n.log.usage(`${f}: ${r.category}: ${r.name}`,e,`test-${x} ${f}: ${r.category}: ${r.name}`)}return t}))}function N(e){return t(this,void 0,void 0,(function*(){yield new Promise((n=>setTimeout(n,e)))}))}function P(e,n){return t(this,void 0,void 0,(function*(){let r=null;const t=new Promise(((e,t)=>{r=setTimeout((()=>{t("EXECUTION TIMEOUT")}),n)}));try{return yield Promise.race([e(),t])}finally{r&&clearTimeout(r)}}))}e.DataFrame.fromColumns([e.Column.fromStrings("col",["val1","val2","val3"])]);var O=__webpack_require__(559),L=__webpack_require__(875),E=function(e,n,r,t){return new(r||(r=Promise))((function(o,i){function a(e){try{s(t.next(e))}catch(e){i(e)}}function u(e){try{s(t.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,u)}s((t=t.apply(e,n||[])).next())}))};A("detectors",(()=>{w("detectFitCurves",(()=>E(void 0,void 0,void 0,(function*(){const r=e.DataFrame.fromCsv('dataframes,json chart 0,json chart 1,json chart 2\n"null (15 rows, 2 columns)","{""series"":[{""parameters"":[1.4325498997897106,1.9857091601431633,1.1549088606928581,1.7111330488305754],""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showCurveConfidenceInterval"":false,""points"":[{""x"":0.10000000149011612,""y"":0.04513680189847946},{""x"":0.6000000238418579,""y"":0.05534003674983978},{""x"":1.100000023841858,""y"":0.041759949177503586},{""x"":1.600000023841858,""y"":0.019746985286474228},{""x"":2.0999999046325684,""y"":0.009008238092064857},{""x"":2.5999999046325684,""y"":0.00802786834537983},{""x"":3.0999999046325684,""y"":0.046114228665828705},{""x"":3.5999999046325684,""y"":0.0032935715280473232},{""x"":4.099999904632568,""y"":0.05305013433098793},{""x"":4.599999904632568,""y"":0.11946146935224533},{""x"":5.099999904632568,""y"":0.24304461479187012},{""x"":5.599999904632568,""y"":0.32507050037384033},{""x"":6.099999904632568,""y"":0.30492347478866577},{""x"":6.599999904632568,""y"":0.30675041675567627},{""x"":7.099999904632568,""y"":0.28282707929611206}]},{""fitFunction"":""sigmoid"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showCurveConfidenceInterval"":false,""points"":[{""x"":0.10000000149011612,""y"":0.027537694200873375},{""x"":0.6000000238418579,""y"":0.20163409411907196},{""x"":1.100000023841858,""y"":0.4537210166454315},{""x"":1.600000023841858,""y"":0.1709870994091034},{""x"":2.0999999046325684,""y"":0.35089364647865295},{""x"":2.5999999046325684,""y"":0.30297139286994934},{""x"":3.0999999046325684,""y"":0.3161645829677582},{""x"":3.5999999046325684,""y"":0.460237979888916},{""x"":4.099999904632568,""y"":0.5018354058265686},{""x"":4.599999904632568,""y"":1.2936394214630127},{""x"":5.099999904632568,""y"":2.336543321609497},{""x"":5.599999904632568,""y"":2.353417158126831},{""x"":6.099999904632568,""y"":2.5554966926574707},{""x"":6.599999904632568,""y"":2.7185072898864746},{""x"":7.099999904632568,""y"":2.8088953495025635}]}]}","{""series"":[{""parameters"":[1.4257157458000065,1.587135296876273,1.6780074048516793,4.72187609991688],""fitFunction"":""sigmoid"",""fitLineColor"":""#2ca02c"",""pointColor"":""#2ca02c"",""showCurveConfidenceInterval"":true,""points"":[{""x"":0.10000000149011612,""y"":0.5346568822860718},{""x"":0.6000000238418579,""y"":0.6445727348327637},{""x"":1.100000023841858,""y"":0.08188246190547943},{""x"":1.600000023841858,""y"":0.0516531839966774},{""x"":2.0999999046325684,""y"":0.17018724977970123},{""x"":2.5999999046325684,""y"":0.618033766746521},{""x"":3.0999999046325684,""y"":0.16852399706840515},{""x"":3.5999999046325684,""y"":0.013230039738118649},{""x"":4.099999904632568,""y"":0.6706985831260681},{""x"":4.599999904632568,""y"":0.6293138861656189},{""x"":5.099999904632568,""y"":1.4058887958526611},{""x"":5.599999904632568,""y"":2.6412644386291504},{""x"":6.099999904632568,""y"":3.775967597961426},{""x"":6.599999904632568,""y"":3.3188939094543457},{""x"":7.099999904632568,""y"":3.793793201446533}]}],""chartOptions"":{""showStatistics"":[""auc""]}}","{""series"":[{""parameters"":[1.4518023469757255,1.051351211186544,1.6612723878444138,-0.9253134758193626],""fitFunction"":""sigmoid"",""fitLineColor"":""#9467bd"",""pointColor"":""#9467bd"",""showCurveConfidenceInterval"":true,""points"":[{""x"":0.10000000149011612,""y"":2.5458569526672363},{""x"":0.10000000149011612,""y"":3.0017518997192383},{""x"":0.10000000149011612,""y"":2.4102466106414795},{""x"":0.10000000149011612,""y"":2.7017934322357178},{""x"":0.10000000149011612,""y"":2.8341686725616455},{""x"":0.6000000238418579,""y"":2.9751579761505127},{""x"":0.6000000238418579,""y"":2.8365142345428467},{""x"":0.6000000238418579,""y"":2.898362874984741},{""x"":0.6000000238418579,""y"":2.9964826107025146},{""x"":0.6000000238418579,""y"":2.6708292961120605},{""x"":1.100000023841858,""y"":3.263227939605713},{""x"":1.100000023841858,""y"":3.0655293464660645},{""x"":1.100000023841858,""y"":2.6620445251464844},{""x"":1.100000023841858,""y"":3.002741813659668},{""x"":1.100000023841858,""y"":3.1540098190307617},{""x"":1.600000023841858,""y"":2.8934433460235596},{""x"":1.600000023841858,""y"":2.7970690727233887},{""x"":1.600000023841858,""y"":3.0466723442077637},{""x"":1.600000023841858,""y"":3.179988145828247},{""x"":1.600000023841858,""y"":2.611898899078369},{""x"":2.0999999046325684,""y"":2.497966766357422},{""x"":2.0999999046325684,""y"":2.645627498626709},{""x"":2.0999999046325684,""y"":2.5474727153778076},{""x"":2.0999999046325684,""y"":2.530237913131714},{""x"":2.0999999046325684,""y"":2.9498236179351807},{""x"":2.5999999046325684,""y"":2.7639214992523193},{""x"":2.5999999046325684,""y"":3.007110595703125},{""x"":2.5999999046325684,""y"":2.71816086769104},{""x"":2.5999999046325684,""y"":3.050650119781494},{""x"":2.5999999046325684,""y"":2.591902017593384},{""x"":3.0999999046325684,""y"":2.79219388961792},{""x"":3.0999999046325684,""y"":2.380063056945801},{""x"":3.0999999046325684,""y"":3.2450575828552246},{""x"":3.0999999046325684,""y"":2.6954219341278076},{""x"":3.0999999046325684,""y"":2.368993043899536},{""x"":3.5999999046325684,""y"":3.2338552474975586},{""x"":3.5999999046325684,""y"":3.222881555557251},{""x"":3.5999999046325684,""y"":2.6137502193450928},{""x"":3.5999999046325684,""y"":2.3624353408813477},{""x"":3.5999999046325684,""y"":2.830970525741577},{""x"":4.099999904632568,""y"":2.8000826835632324},{""x"":4.099999904632568,""y"":2.8115334510803223},{""x"":4.099999904632568,""y"":2.8906726837158203},{""x"":4.099999904632568,""y"":2.5641937255859375},{""x"":4.099999904632568,""y"":2.3881938457489014},{""x"":4.599999904632568,""y"":2.076000928878784},{""x"":4.599999904632568,""y"":2.241201400756836},{""x"":4.599999904632568,""y"":2.018866777420044},{""x"":4.599999904632568,""y"":2.7197747230529785},{""x"":4.599999904632568,""y"":2.3649282455444336},{""x"":5.099999904632568,""y"":2.068617105484009},{""x"":5.099999904632568,""y"":2.0637989044189453},{""x"":5.099999904632568,""y"":1.5100634098052979},{""x"":5.099999904632568,""y"":1.9978814125061035},{""x"":5.099999904632568,""y"":2.1007437705993652},{""x"":5.599999904632568,""y"":0.7437329292297363},{""x"":5.599999904632568,""y"":0.8030821681022644},{""x"":5.599999904632568,""y"":1.0766953229904175},{""x"":5.599999904632568,""y"":1.5326048135757446},{""x"":5.599999904632568,""y"":1.5971065759658813},{""x"":6.099999904632568,""y"":0.31388434767723083},{""x"":6.099999904632568,""y"":0.6875622272491455},{""x"":6.099999904632568,""y"":0.855545163154602},{""x"":6.099999904632568,""y"":0.6559354662895203},{""x"":6.099999904632568,""y"":0.3100747764110565},{""x"":6.599999904632568,""y"":0.4792144000530243},{""x"":6.599999904632568,""y"":0.855309009552002},{""x"":6.599999904632568,""y"":0.18937373161315918},{""x"":6.599999904632568,""y"":0.3708323538303375},{""x"":6.599999904632568,""y"":0.08053481578826904},{""x"":7.099999904632568,""y"":0.7577306628227234},{""x"":7.099999904632568,""y"":0.3387751877307892},{""x"":7.099999904632568,""y"":0.1985611915588379},{""x"":7.099999904632568,""y"":0.172195702791214},{""x"":7.099999904632568,""y"":0.13258741796016693}]}],""chartOptions"":{""showStatistics"":[""auc""]}}"\n"null (15 rows, 2 columns)","{""series"":[{""parameters"":[1.4030933784862443,1.0245979562516274,1.7428150024861861,-3.5779850370795696],""fitFunction"":""sigmoid"",""fitLineColor"":""#1f77b4"",""pointColor"":""#1f77b4"",""showCurveConfidenceInterval"":false,""points"":[{""x"":0.10000000149011612,""y"":5.7036309242248535},{""x"":0.6000000238418579,""y"":5.746265888214111},{""x"":1.100000023841858,""y"":5.299612045288086},{""x"":1.600000023841858,""y"":5.343863487243652},{""x"":2.0999999046325684,""y"":5.506134033203125},{""x"":2.5999999046325684,""y"":5.4817914962768555},{""x"":3.0999999046325684,""y"":5.3505539894104},{""x"":3.5999999046325684,""y"":5.151522159576416},{""x"":4.099999904632568,""y"":5.212680339813232},{""x"":4.599999904632568,""y"":4.80598783493042},{""x"":5.099999904632568,""y"":3.351301431655884},{""x"":5.599999904632568,""y"":2.108116865158081},{""x"":6.099999904632568,""y"":1.246281623840332},{""x"":6.599999904632568,""y"":0.5875148773193359},{""x"":7.099999904632568,""y"":0.6986792683601379}]},{""fitFunction"":""sigmoid"",""fitLineColor"":""#ffbb78"",""pointColor"":""#ffbb78"",""showCurveConfidenceInterval"":false,""points"":[{""x"":0.10000000149011612,""y"":4.777379035949707},{""x"":0.6000000238418579,""y"":5.265642166137695},{""x"":1.100000023841858,""y"":5.713808059692383},{""x"":1.600000023841858,""y"":5.249830722808838},{""x"":2.0999999046325684,""y"":5.587547779083252},{""x"":2.5999999046325684,""y"":5.36907434463501},{""x"":3.0999999046325684,""y"":4.934175968170166},{""x"":3.5999999046325684,""y"":5.372972011566162},{""x"":4.099999904632568,""y"":5.017283916473389},{""x"":4.599999904632568,""y"":4.6751484870910645},{""x"":5.099999904632568,""y"":3.423663854598999},{""x"":5.599999904632568,""y"":1.594344973564148},{""x"":6.099999904632568,""y"":0.5661525130271912},{""x"":6.599999904632568,""y"":0.19819404184818268},{""x"":7.099999904632568,""y"":0.8421927690505981}]}]}","{""series"":[{""parameters"":[1.5400648543589148,1.7239324972922214,1.4063297934320662,0.33443731185267556],""fitFunction"":""sigmoid"",""fitLineColor"":""#2ca02c"",""pointColor"":""#2ca02c"",""showCurveConfidenceInterval"":true,""points"":[{""x"":0.10000000149011612,""y"":1.27737557888031},{""x"":0.6000000238418579,""y"":1.2780145406723022},{""x"":1.100000023841858,""y"":1.3489571809768677},{""x"":1.600000023841858,""y"":1.3250025510787964},{""x"":2.0999999046325684,""y"":1.309158444404602},{""x"":2.5999999046325684,""y"":1.441296935081482},{""x"":3.0999999046325684,""y"":1.3621265888214111},{""x"":3.5999999046325684,""y"":1.3409022092819214},{""x"":4.099999904632568,""y"":1.2703818082809448},{""x"":4.599999904632568,""y"":1.2195014953613281},{""x"":5.099999904632568,""y"":0.585429310798645},{""x"":5.599999904632568,""y"":0.19421088695526123},{""x"":6.099999904632568,""y"":0.2276361584663391},{""x"":6.599999904632568,""y"":0.03259352594614029},{""x"":7.099999904632568,""y"":0.03811067342758179}]}],""chartOptions"":{""showStatistics"":[""auc""]}}","{""series"":[{""parameters"":[1.3987701446422334,1.0025589776619843,1.950431059109577,1.57489342486818],""fitFunction"":""sigmoid"",""fitLineColor"":""#9467bd"",""pointColor"":""#9467bd"",""showCurveConfidenceInterval"":true,""points"":[{""x"":0.10000000149011612,""y"":0.03612012043595314},{""x"":0.10000000149011612,""y"":0.05706661567091942},{""x"":0.10000000149011612,""y"":0.007174440659582615},{""x"":0.10000000149011612,""y"":0.006656676065176725},{""x"":0.10000000149011612,""y"":0.03480849787592888},{""x"":0.6000000238418579,""y"":0.0665726289153099},{""x"":0.6000000238418579,""y"":0.054525356739759445},{""x"":0.6000000238418579,""y"":0.055943023413419724},{""x"":0.6000000238418579,""y"":0.0544852614402771},{""x"":0.6000000238418579,""y"":0.02734142541885376},{""x"":1.100000023841858,""y"":0.02047267183661461},{""x"":1.100000023841858,""y"":0.04814719781279564},{""x"":1.100000023841858,""y"":0.05629648640751839},{""x"":1.100000023841858,""y"":0.05200682207942009},{""x"":1.100000023841858,""y"":0.046626269817352295},{""x"":1.600000023841858,""y"":0.027950428426265717},{""x"":1.600000023841858,""y"":0.021106986328959465},{""x"":1.600000023841858,""y"":0.011796108447015285},{""x"":1.600000023841858,""y"":0.04013078659772873},{""x"":1.600000023841858,""y"":0.018657365813851357},{""x"":2.0999999046325684,""y"":0.010390376672148705},{""x"":2.0999999046325684,""y"":0.06717702001333237},{""x"":2.0999999046325684,""y"":0.015734216198325157},{""x"":2.0999999046325684,""y"":0.0005020603421144187},{""x"":2.0999999046325684,""y"":0.03601917624473572},{""x"":2.5999999046325684,""y"":0.04580968990921974},{""x"":2.5999999046325684,""y"":0.013811883516609669},{""x"":2.5999999046325684,""y"":0.0347907729446888},{""x"":2.5999999046325684,""y"":0.003400992602109909},{""x"":2.5999999046325684,""y"":0.0658077746629715},{""x"":3.0999999046325684,""y"":0.06470326334238052},{""x"":3.0999999046325684,""y"":0.040105774998664856},{""x"":3.0999999046325684,""y"":0.004536386113613844},{""x"":3.0999999046325684,""y"":0.028299888595938683},{""x"":3.0999999046325684,""y"":0.015297790057957172},{""x"":3.5999999046325684,""y"":0.010205036029219627},{""x"":3.5999999046325684,""y"":0.030351044610142708},{""x"":3.5999999046325684,""y"":0.02823905274271965},{""x"":3.5999999046325684,""y"":0.00543160829693079},{""x"":3.5999999046325684,""y"":0.03528806194663048},{""x"":4.099999904632568,""y"":0.024404611438512802},{""x"":4.099999904632568,""y"":0.021398605778813362},{""x"":4.099999904632568,""y"":0.01746137998998165},{""x"":4.099999904632568,""y"":0.06801135092973709},{""x"":4.099999904632568,""y"":0.02418249472975731},{""x"":4.599999904632568,""y"":0.08065827190876007},{""x"":4.599999904632568,""y"":0.03795705363154411},{""x"":4.599999904632568,""y"":0.03595327213406563},{""x"":4.599999904632568,""y"":0.019490951672196388},{""x"":4.599999904632568,""y"":0.0357535295188427},{""x"":5.099999904632568,""y"":0.06301134079694748},{""x"":5.099999904632568,""y"":0.04880264401435852},{""x"":5.099999904632568,""y"":0.046849530190229416},{""x"":5.099999904632568,""y"":0.046094998717308044},{""x"":5.099999904632568,""y"":0.07735799998044968},{""x"":5.599999904632568,""y"":0.10287926346063614},{""x"":5.599999904632568,""y"":0.15329882502555847},{""x"":5.599999904632568,""y"":0.09895746409893036},{""x"":5.599999904632568,""y"":0.10509312152862549},{""x"":5.599999904632568,""y"":0.10584071278572083},{""x"":6.099999904632568,""y"":0.19464170932769775},{""x"":6.099999904632568,""y"":0.1837087869644165},{""x"":6.099999904632568,""y"":0.19690236449241638},{""x"":6.099999904632568,""y"":0.14827826619148254},{""x"":6.099999904632568,""y"":0.15355728566646576},{""x"":6.599999904632568,""y"":0.21270307898521423},{""x"":6.599999904632568,""y"":0.19529509544372559},{""x"":6.599999904632568,""y"":0.20716492831707},{""x"":6.599999904632568,""y"":0.18739652633666992},{""x"":6.599999904632568,""y"":0.22446008026599884},{""x"":7.099999904632568,""y"":0.18822836875915527},{""x"":7.099999904632568,""y"":0.2324085384607315},{""x"":7.099999904632568,""y"":0.1877404898405075},{""x"":7.099999904632568,""y"":0.19784560799598694},{""x"":7.099999904632568,""y"":0.21554286777973175}]}],""chartOptions"":{""showStatistics"":[""auc""]}}"'),t=r.columns.byName("json chart 0"),o=r.columns.byName("json chart 1"),i=r.columns.byName("json chart 2");yield n.data.detectSemanticTypes(r),b(t.semType,L.j2),b(o.semType,L.j2),b(i.semType,L.j2)})))),w("detectXMLCurveChart",(()=>E(void 0,void 0,void 0,(function*(){const r=e.DataFrame.fromCsv('xmlCurveFitChart\n"<chart><grid><xAxis min=""0.0"" max=""5"" /><yAxis min=""-100"" max=""100"" /></grid><settings xLabel=""Concentration"" yLabel=""Activity"" logX=""true"" /><seriesCollection><series><x>7.2e-12,7.1e-12,7e-12,6e-8,6e-5,6e-4</x><y>112,115,116,100,123,124</y><fitLine><function type=""sigif""><params>2e-08,-1.5,125,-20</params></function></fitLine><settings color=""Green"" marker=""SquareBorder"" markerColor=""Yellow"" markerBorderColor=""Black"" errorBarColor=""Red"" showErrorBars=""True"" drawLine=""True"" bound=""True"" /></series></seriesCollection></chart>"'),t=r.columns.byName("xmlCurveFitChart");yield n.data.detectSemanticTypes(r),b(t.semType,L.j2),b(t.tags[O.Rj],O.NH)}))))}));var j=__webpack_require__(870),q=__webpack_require__(414),R=__webpack_require__.n(q),F=__webpack_require__(840),I=function(e,n,r,t){return new(r||(r=Promise))((function(o,i){function a(e){try{s(t.next(e))}catch(e){i(e)}}function u(e){try{s(t.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,u)}s((t=t.apply(e,n||[])).next())}))};function Y(n){const r={series:[],chartOptions:{showStatistics:["auc"]}},t=(0,F.YC)(n,.5),o=e.Color.toHtml(e.Color.scatterPlotMarker);return r.series[0]={fitLineColor:o,pointColor:o,markerType:e.MARKER_TYPE.CIRCLE,showFitLine:!0,showPoints:"points",showCurveConfidenceInterval:!0,fitFunction:"sigmoid",points:R().count().take(n).map((function(e){return{x:t.x[e],y:t.y[e]}})).toArray()},r}A("creation",(()=>{w("fit curve creation",(()=>I(void 0,void 0,void 0,(function*(){const r=Date.now(),t=(0,F.lf)(e.Test.isInBenchmark?1e3:100,5,2);n.shell.addTableView(t);const o=Date.now();return yield N(50),console.log(`Creation took ${o.valueOf()-r.valueOf()} ms`),`${e.Test.isInBenchmark?1e3:100} points, took ${o.valueOf()-r.valueOf()} ms`}))))})),A("rendering",(()=>{w("rendering same fitChartData on canvas",(()=>I(void 0,void 0,void 0,(function*(){const r=j.canvas(160,120);n.shell.newView("canvas",[r]);const t=r.getContext("2d"),o=new O.cv,i=Y(e.Test.isInBenchmark?50:15);for(let e=1;e<=1e3;e++)o.renderCurves(t,r.clientLeft,r.clientTop,160,120,i),t.clearRect(0,0,160,120);return"rendering performed 1000 times"})))),w("rendering different fitChartData on canvas",(()=>I(void 0,void 0,void 0,(function*(){const r=j.canvas(160,120);n.shell.newView("canvas",[r]);const t=r.getContext("2d"),o=new O.cv;for(let n=1;n<=1e3;n++){const n=Y(e.Test.isInBenchmark?50:15);o.renderCurves(t,r.clientLeft,r.clientTop,160,120,n),t.clearRect(0,0,160,120)}return"rendering performed 1000 times"})))),w("rendering in grid",(()=>I(void 0,void 0,void 0,(function*(){const e=(0,F.lf)(30,5,2),r=n.shell.addTableView(e);yield N(100);const t=r.grid.root.getElementsByTagName("canvas")[2],o=new Date;yield function(e,n,r,t){return I(this,void 0,void 0,(function*(){for(let n=0;n<10;n++)e.dispatchEvent(new WheelEvent("wheel",{deltaY:300})),yield N(10)}))}(t);const i=new Date;return console.log(`curves rendering took ${i.valueOf()-o.valueOf()} ms`),i.valueOf()-o.valueOf()+" ms"}))))}));var V=__webpack_require__(766);A("viewport",(()=>{w("viewportMethods",(()=>{return n=void 0,r=void 0,o=function*(){const n=new e.Rect(120,20,160,100).inflate(O.od/2,O.od/2),[r]=(0,O.Ce)(n,!1,!1),t=new e.Rect(.1,.06,7,5.94),o=new V.l(t,r,!1,!1);b(o.xToScreen(1.5),182.4),b(o.yToScreen(2.33),73.01346801346801),b(o.xToWorld(150),-.9652173913043479),b(o.yToWorld(67),2.855294117647059)},new((t=void 0)||(t=Promise))((function(e,i){function a(e){try{s(o.next(e))}catch(e){i(e)}}function u(e){try{s(o.throw(e))}catch(e){i(e)}}function s(n){var r;n.done?e(n.value):(r=n.value,r instanceof t?r:new t((function(e){e(r)}))).then(a,u)}s((o=o.apply(n,r||[])).next())}));var n,r,t,o}))}));var D=__webpack_require__(416),X=__webpack_require__(111),B=function(e,n,r,t){return new(r||(r=Promise))((function(o,i){function a(e){try{s(t.next(e))}catch(e){i(e)}}function u(e){try{s(t.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,u)}s((t=t.apply(e,n||[])).next())}))};const U={fitLineColor:"#1f77b4",pointColor:"#1f77b4",showCurveConfidenceInterval:!1,points:[{x:.10000000149011612,y:1.7412786483764648},{x:.6000000238418579,y:1.8561450242996216},{x:1.100000023841858,y:1.6065685749053955},{x:1.600000023841858,y:1.70476496219635},{x:2.0999999046325684,y:1.5737264156341553},{x:2.5999999046325684,y:1.6007002592086792},{x:3.0999999046325684,y:1.6796687841415405},{x:3.5999999046325684,y:1.656104326248169},{x:4.099999904632568,y:1.782997488975525},{x:4.599999904632568,y:1.530208945274353},{x:5.099999904632568,y:1.1572397947311401},{x:5.599999904632568,y:.8691964745521545},{x:6.099999904632568,y:.3228665590286255},{x:6.599999904632568,y:.2990703880786896},{x:7.099999904632568,y:.23361243307590485}],fitFunction:"sigmoid",clickToToggle:!1,showFitLine:!0,showPoints:"points",parameters:[1.6914372095641517,1.1536998642628853,5.410173358224149,.2089689354045083]},G={fitLineColor:"#2ca02c",pointColor:"#2ca02c",showCurveConfidenceInterval:!0,fitFunction:{name:"Polynomial",function:"([p1, p2, p3, p4], x) => p1 * x * x * x + p2 * x * x + p3 * x + p4",getInitialParameters:"(xs, ys) => [0.1, -1, 4, 4]",parameterNames:["Slope","Intercept","Parameter3","Parameter4"]},points:[{x:.10000000149011612,y:7.365033149719238},{x:.6000000238418579,y:6.595034599304199},{x:1.100000023841858,y:7.05179500579834},{x:1.600000023841858,y:7.251461982727051},{x:2.0999999046325684,y:7.775498867034912},{x:2.5999999046325684,y:7.748039722442627},{x:3.0999999046325684,y:6.8391804695129395},{x:3.5999999046325684,y:7.570991516113281},{x:4.099999904632568,y:6.387666702270508},{x:4.599999904632568,y:6.464827537536621},{x:5.099999904632568,y:3.932436227798462},{x:5.599999904632568,y:1.4741199016571045},{x:6.099999904632568,y:.47604307532310486},{x:6.599999904632568,y:.5836760401725769},{x:7.099999904632568,y:1.0317600965499878}],clickToToggle:!1,showFitLine:!0,showPoints:"points",parameters:[.07070206940832963,-1.138666933634074,3.947509109407932,3.9947960440506685]},H=(0,D.Y6)(U),W=(0,D.Y6)(G);A("fit",(()=>{w("getSeriesFitFunction",(()=>B(void 0,void 0,void 0,(function*(){const{xs:e,ys:n}=(0,D.q_)(U.points),{xs:r,ys:t}=(0,D.q_)(G.points);b(H.name,L.yB),b(W.name,"Polynomial"),_(H.parameterNames,["Top","Bottom","Slope","IC50"]),_(W.parameterNames,["Slope","Intercept","Parameter3","Parameter4"]),_(H.getInitialParameters(e,n),[1.8561450242996216,1,5.099999904632568,.23361243307590485]),_(W.getInitialParameters(r,t),[.1,-1,4,4]),b(H.y(U.parameters,1.1),1.6914214213007113),b(W.y(W.getInitialParameters(r,t),1.1),7.3231)})))),w("getCurve",(()=>B(void 0,void 0,void 0,(function*(){const e=(0,D.kG)(U,H),n=(0,D.kG)(G,W);b(e(2.5),1.6907865884456907),b(e(5.8858),.5356637992990292),b(n(1.56),7.6502648725700535),b(n(3.99876),6.09328601677405)})))),w("fitSeries",(()=>B(void 0,void 0,void 0,(function*(){const e=Date.now(),n=(0,D.PK)(U,H),r=(0,D.PK)(G,W),t=Date.now();return b(n.fittedCurve(2.5),1.690742266220136),b(r.fittedCurve(3.99876),6.09328601677405),_(n.parameters,[1.691390784119389,1.1540819399621425,5.4104428146970704,.20886765646057662]),_(r.parameters,[.07070206940832963,-1.138666933634074,3.947509109407932,3.9947960440506685]),t.valueOf()-e.valueOf()+" ms"})))),w("getSeriesConfidenceInterval",(()=>B(void 0,void 0,void 0,(function*(){const e=(0,D.LC)(U,H,!0),n=(0,D.LC)(G,W,!0);b(e.confidenceTop(2.578),1.8540854906189528),b(n.confidenceTop(2.3342),10.035230015978911),b(e.confidenceBottom(3.987),1.494930602732917),b(n.confidenceBottom(3.8796),4.168651824724921)})))),w("getSeriesStatistics",(()=>B(void 0,void 0,void 0,(function*(){const e=(0,D.tq)(U,H),n=(0,D.tq)(G,W);b(e.auc,9.33542235488813),b(n.auc,36.52554692824738),b(e.rSquared,.9781915962446398),b(n.rSquared,.8460557736673078)})))),w("calculateBoxPlotStatistics",(()=>B(void 0,void 0,void 0,(function*(){const e=(0,X.G)([.7654603719711304,.8199243545532227,.8257747292518616,.9558155536651611,.9596694707870483]);b(e.q1,.8199243545532227),b(e.q2,.8257747292518616),b(e.q3,.9558155536651611),b(e.lowerAdjacentValue,.7654603719711304),b(e.upperAdjacentValue,.9558155536651611)})))),w("sigmoid",(()=>B(void 0,void 0,void 0,(function*(){const e=[2.612687371569039,-1.421800778574126,5.16688669906018,.341788492203575];b((0,L.Hg)(e,.5),.34178901799627626),b((0,L.Hg)(e,2.5),.3421552218929382),b((0,L.Hg)(e,5.678976),2.254881739737238)}))))}));var $=function(e,n,r,t){return new(r||(r=Promise))((function(o,i){function a(e){try{s(t.next(e))}catch(e){i(e)}}function u(e){try{s(t.throw(e))}catch(e){i(e)}}function s(e){var n;e.done?o(e.value):(n=e.value,n instanceof r?n:new r((function(e){e(n)}))).then(a,u)}s((t=t.apply(e,n||[])).next())}))};const K=new e.Package;function z(o,i,y){return $(this,void 0,void 0,(function*(){const g=yield function(o){var i,y,g,w,T,C,_;return t(this,void 0,void 0,(function*(){const A=null===(y=null===(i=n.functions.getCurrentCall())||void 0===i?void 0:i.func)||void 0===y?void 0:y.package;yield function(o,i){var a;return t(this,void 0,void 0,(function*(){const i=o.id;if(d[i])return;const u=f;if(void 0!==u[l]||void 0!==u[m]||Object.keys(u).find((e=>e.startsWith(l)||e.startsWith(p))))return void(d[i]=!0);if("DevTools"===o.name){const n=e.Func.find({tags:["dartTest"]});for(const e of n){const n=e.name.split(/\s*\|\s*/g),r=null!==(a=n.pop())&&void 0!==a?a:e.name,o=n.length?p+": "+n.join(": "):p;void 0===u[o]&&(u[o]={tests:[],clear:!0}),u[o].tests.push(new v(o,r,(()=>t(this,void 0,void 0,(function*(){return yield e.apply()}))),{isAggregated:e.outputs.length>0,timeout:3e5}))}}const s=[],c=[],y=[],g=yield n.dapi.functions.filter(`package.id = "${i}"`).list(),x=new RegExp(/skip:\s*([^,\s]+)|wait:\s*(\d+)|cat:\s*([^,\s]+)|timeout:\s*(\d+)/g);for(const e of g){const o=e.options.test,i=e.options.demoPath;if(o&&Array.isArray(o)&&o.length)for(let r=0;r<o.length;r++){const i=o[r].matchAll(x),a={};Array.from(i).forEach((e=>{e[0].startsWith("skip")?a.skip=e[1]:e[0].startsWith("wait")?a.wait=parseInt(e[2]):e[0].startsWith("cat")?a.cat=e[3]:e[0].startsWith("timeout")&&(a.timeout=parseInt(e[4]))}));const c=new v(l,1===o.length?e.name:`${e.name} ${r+1}`,(()=>t(this,void 0,void 0,(function*(){const t=yield n.functions.eval(k(o[r],e));if(a.wait&&(yield N(a.wait)),"boolean"==typeof t&&!t)throw`Failed: ${o[r]}, expected true, got ${t}`}))),{skipReason:a.skip,timeout:a.timeout});if(a.cat){const e=l+": "+a.cat;c.category=e,void 0===u[e]&&(u[e]={tests:[],clear:!0}),u[e].tests.push(c)}else s.push(c)}if(i){const r=e.options.demoWait?parseInt(e.options.demoWait):void 0,o=new v(m,e.friendlyName,(()=>t(this,void 0,void 0,(function*(){if(n.shell.lastError="",yield e.apply(),yield N(r||2e3),n.shell.lastError)throw new Error(n.shell.lastError)}))),{skipReason:e.options.demoSkip});c.push(o)}if(e.hasTag("semTypeDetector")){const n=new v(h,e.friendlyName,(()=>t(this,void 0,void 0,(function*(){const n=[];for(const t of r.clone().columns){const r=yield e.apply([t]);n.push(r||t.semType)}b(n.filter((e=>e)).length,1)}))),{skipReason:e.options.skipTest});y.push(n)}}d[i]=!0,s.length&&(u[l]={tests:s,clear:!0}),c.length&&(u[m]={tests:c,clear:!0}),y.length&&(u[h]={tests:y,clear:!1})}))}(A);const P=[];console.log("Running tests"),null!=o||(o={}),null!==(g=(_=o).testContext)&&void 0!==g||(_.testContext=new x),n.shell.lastError="";const O=[],L=function(){const e=[];return console.log=(...n)=>{e.push(...n),a(...n)},console.info=(...n)=>{e.push(...n),u(...n)},console.warn=(...n)=>{e.push(...n),s(...n)},console.error=(...n)=>{e.push(...n),c(...n)},e}();try{for(const[r,t]of Object.entries(f)){if((null==o?void 0:o.category)&&!r.toLowerCase().startsWith(null==o?void 0:o.category.toLowerCase())||(null===(w=o.exclude)||void 0===w?void 0:w.some((e=>r.startsWith(e)))))continue;a(`Started ${r} category`),O.push(r);const i=null===(T=t.tests)||void 0===T?void 0:T.every((e=>{var n;return null===(n=e.options)||void 0===n?void 0:n.skipReason}));try{t.before&&!i&&(yield t.before())}catch(e){t.beforeStatus=M(e)}const u=null!==(C=t.tests)&&void 0!==C?C:[],s=[];if(t.clear)for(let r=0;r<u.length;r++)s.push(yield S(u[r],null==o?void 0:o.test,L,t.timeout,A.name,o.verbose)),n.shell.closeAll(),e.Balloon.closeAll();else for(let e=0;e<u.length;e++)s.push(yield S(u[e],null==o?void 0:o.test,L,t.timeout,A.name,o.verbose));const c=s.filter((e=>"skipped"!=e.result));try{t.after&&!i&&(yield t.after())}catch(e){t.afterStatus=M(e)}t.afterStatus&&c.push({category:r,name:"after",result:t.afterStatus,success:!1,ms:0,skipped:!1}),t.beforeStatus&&c.push({category:r,name:"before",result:t.beforeStatus,success:!1,ms:0,skipped:!1}),P.push(...c)}}finally{console.log=a,console.info=u,console.warn=s,console.error=c}if(o.testContext.catchUnhandled&&(yield N(1e3),n.shell.lastError.length>0&&P.push({category:"Unhandled exceptions",name:"exceptions",result:n.shell.lastError,success:!1,ms:0,skipped:!1})),!o.test&&P.length){const r=P.filter((e=>e.success)).length,t=P.filter((e=>e.skipped)).length,i=P.filter((e=>!e.success)),a=A.name;for(const e of O){const r=P.filter((n=>n.category===e)),t=r.filter((e=>!e.success)).length,o={success:0===t,passed:r.filter((e=>e.success)).length,skipped:r.filter((e=>e.skipped)).length,failed:t,type:"package",packageName:a,category:e};n.log.usage(`${a}: ${e}`,o,`category-package ${a}: ${e}`)}if(!o.category){const e={success:0===i.length,passed:r,skipped:t,failed:i.length,type:"package",packageName:a};n.log.usage(a,e,`package-package ${a}`)}if(o.testContext.report){const n=new e.Logger,o="Package @package tested: @successful successful, @skipped skipped, @failed failed tests",a={successful:r,skipped:t,failed:i.length,package:A};for(const e of i)Object.assign(a,{[`${e.category} | ${e.name}`]:e.result});n.log(o,a,"package-tested")}}return P}))}({category:o,test:i,testContext:y});return e.DataFrame.fromObjects(g)}))}})(),curves_test=__webpack_exports__})();
|
|
2
2
|
//# sourceMappingURL=package-test.js.map
|