"undefined"==typeof Zepto&&(Zepto=void 0);"undefined"==typeof jQuery&&(jQuery=Zepto);"undefined"==typeof numeral&&(numeral=void 0);"undefined"==typeof moment&&(moment=void 0);"undefined"==typeof jStat&&(jStat=void 0);
(function(r,x,k,g){function F(a){function b(){this.yy={}}var c={trace:function(){},yy:{},symbols_:{error:2,expressions:3,e:4,EOF:5,variableSequence:6,TRUE:7,FALSE:8,NULL:9,TIME_AMPM:10,TIME_24:11,number:12,STRING:13,"&":14,"=":15,"+":16,"(":17,")":18,"[":19,expseq:20,"]":21,"<":22,">":23,NOT:24,"-":25,"*":26,"/":27,"^":28,E:29,FUNCTION:30,cell:31,FIXEDCELL:32,":":33,CELL:34,SHEET:35,"!":36,RANGE:37,";":38,",":39,VARIABLE:40,DECIMAL:41,NUMBER:42,"%":43,"#":44,$accept:0,$end:1},terminals_:{5:"EOF",
7:"TRUE",8:"FALSE",9:"NULL",10:"TIME_AMPM",11:"TIME_24",13:"STRING",14:"&",15:"=",16:"+",17:"(",18:")",19:"[",21:"]",22:"<",23:">",24:"NOT",25:"-",26:"*",27:"/",28:"^",29:"E",30:"FUNCTION",32:"FIXEDCELL",33:":",34:"CELL",35:"SHEET",36:"!",37:"RANGE",38:";",39:",",40:"VARIABLE",41:"DECIMAL",42:"NUMBER",43:"%",44:"#"},productions_:[0,[3,2],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,3],[4,3],[4,3],[4,3],[4,3],[4,4],[4,4],[4,4],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,2],[4,2],[4,1],[4,3],
[4,4],[4,1],[4,1],[4,2],[31,1],[31,3],[31,1],[31,3],[31,3],[31,5],[31,1],[31,3],[20,1],[20,3],[20,3],[6,1],[6,3],[12,1],[12,3],[12,2],[2,3],[2,4]],performAction:function(b,c,d,p,m,l,g){b=l.length-1;switch(m){case 1:return l[b-1];case 2:this.$=a.getVariable(l[b]);break;case 3:this.$=!0;break;case 4:this.$=!1;break;case 5:this.$=null;break;case 6:this.$=a.time(l[b]);break;case 7:this.$=a.time(l[b]);break;case 8:this.$=1*l[b];isNaN(this.$)&&(this.$=0);break;case 9:this.$=l[b].substring(1,l[b].length-
1);break;case 10:this.$=""+l[b-2]+l[b];break;case 11:this.$=a.comparator.equal.call(a,l[b-2],l[b]);break;case 12:this.$=e.math.SUM.call(a,l[b-2],l[b]);break;case 13:this.$=1*l[b-1];break;case 14:this.$=l[b-1];break;case 15:this.$=a.comparator.lessEqual.call(a,l[b-3],l[b]);break;case 16:this.$=a.comparator.greaterEqual.call(a,l[b-3],l[b]);break;case 17:this.$=a.comparator.notEqual.call(a,l[b-3],l[b]);break;case 18:this.$=l[b-2]!=l[b];break;case 19:this.$=a.comparator.greater.call(a,l[b-2],l[b]);break;
case 20:this.$=a.comparator.less.call(a,l[b-2],l[b]);break;case 21:this.$=e.math.SUBTRACT.call(a,l[b-2],l[b]);break;case 22:this.$=e.math.MULTIPLY.call(a,l[b-2],l[b]);break;case 23:this.$=e.math.DIVIDE.call(a,l[b-2],l[b]);break;case 24:this.$=e.math.POWER.call(a,l[b-2],l[b]);break;case 25:this.$=-1*l[b];isNaN(this.$)&&(this.$=0);break;case 26:this.$=1*l[b];isNaN(this.$)&&(this.$=0);break;case 27:this.$=Math.E;break;case 28:this.$=a.callFunction(l[b-2]);break;case 29:this.$=a.callFunction(l[b-3],l[b-
1]);break;case 33:this.$=a.getCellValue(l[b]);break;case 34:this.$=a.getCellRangeValue(l[b-2],l[b]);break;case 35:this.$=a.getCellValue(l[b]);break;case 36:this.$=a.getCellRangeValue(l[b-2],l[b]);break;case 37:this.$=a.getRemoteCellValue(l[b-2],l[b]);break;case 38:this.$=a.getRemoteCellRangeValue(l[b-4],l[b-2],l[b]);break;case 39:this.$=a.getColumnRange(l[b]);break;case 40:this.$=a.getRemoteColumnRange(l[b-2],l[b]);break;case 41:this.$=[l[b]];break;case 42:l[b-2].push(l[b]);this.$=l[b-2];break;case 43:l[b-
2].push(l[b]);this.$=l[b-2];break;case 44:this.$=[l[b]];break;case 45:this.$=r.isArray(l[b-2])?l[b-2]:[l[b-2]];this.$.push(l[b]);break;case 46:this.$=1*l[b];break;case 47:this.$=1*(l[b-2]+"."+l[b]);break;case 48:this.$=.01*l[b-1];break;case 49:this.$=l[b-2]+l[b-1]+l[b];break;case 50:this.$=l[b-2]+l[b-1]+l[b]}},table:[{2:18,3:1,4:2,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,
19],42:[1,20],44:[1,25]},{1:[3]},{5:[1,26],14:[1,27],15:[1,28],16:[1,29],22:[1,30],23:[1,31],24:[1,32],25:[1,33],26:[1,34],27:[1,35],28:[1,36]},{5:[2,2],14:[2,2],15:[2,2],16:[2,2],18:[2,2],21:[2,2],22:[2,2],23:[2,2],24:[2,2],25:[2,2],26:[2,2],27:[2,2],28:[2,2],38:[2,2],39:[2,2],41:[1,37]},{5:[2,3],14:[2,3],15:[2,3],16:[2,3],18:[2,3],21:[2,3],22:[2,3],23:[2,3],24:[2,3],25:[2,3],26:[2,3],27:[2,3],28:[2,3],38:[2,3],39:[2,3]},{5:[2,4],14:[2,4],15:[2,4],16:[2,4],18:[2,4],21:[2,4],22:[2,4],23:[2,4],24:[2,
4],25:[2,4],26:[2,4],27:[2,4],28:[2,4],38:[2,4],39:[2,4]},{5:[2,5],14:[2,5],15:[2,5],16:[2,5],18:[2,5],21:[2,5],22:[2,5],23:[2,5],24:[2,5],25:[2,5],26:[2,5],27:[2,5],28:[2,5],38:[2,5],39:[2,5]},{5:[2,6],14:[2,6],15:[2,6],16:[2,6],18:[2,6],21:[2,6],22:[2,6],23:[2,6],24:[2,6],25:[2,6],26:[2,6],27:[2,6],28:[2,6],38:[2,6],39:[2,6]},{5:[2,7],14:[2,7],15:[2,7],16:[2,7],18:[2,7],21:[2,7],22:[2,7],23:[2,7],24:[2,7],25:[2,7],26:[2,7],27:[2,7],28:[2,7],38:[2,7],39:[2,7]},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],
18:[2,8],21:[2,8],22:[2,8],23:[2,8],24:[2,8],25:[2,8],26:[2,8],27:[2,8],28:[2,8],38:[2,8],39:[2,8],43:[1,38]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],18:[2,9],21:[2,9],22:[2,9],23:[2,9],24:[2,9],25:[2,9],26:[2,9],27:[2,9],28:[2,9],38:[2,9],39:[2,9]},{2:18,4:39,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:41,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],
11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],20:40,25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:42,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:43,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,
16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{5:[2,27],14:[2,27],15:[2,27],16:[2,27],18:[2,27],21:[2,27],22:[2,27],23:[2,27],24:[2,27],25:[2,27],26:[2,27],27:[2,27],28:[2,27],38:[2,27],39:[2,27]},{17:[1,44]},{5:[2,30],14:[2,30],15:[2,30],16:[2,30],18:[2,30],21:[2,30],22:[2,30],23:[2,30],24:[2,30],25:[2,30],26:[2,30],27:[2,30],28:[2,30],38:[2,30],39:[2,30]},{2:45,5:[2,31],14:[2,31],15:[2,31],16:[2,31],18:[2,31],21:[2,31],22:[2,31],23:[2,31],24:[2,31],25:[2,31],26:[2,
31],27:[2,31],28:[2,31],38:[2,31],39:[2,31],40:[1,46],44:[1,25]},{5:[2,44],14:[2,44],15:[2,44],16:[2,44],18:[2,44],21:[2,44],22:[2,44],23:[2,44],24:[2,44],25:[2,44],26:[2,44],27:[2,44],28:[2,44],38:[2,44],39:[2,44],41:[2,44],44:[1,47]},{5:[2,46],14:[2,46],15:[2,46],16:[2,46],18:[2,46],21:[2,46],22:[2,46],23:[2,46],24:[2,46],25:[2,46],26:[2,46],27:[2,46],28:[2,46],38:[2,46],39:[2,46],41:[1,48],43:[2,46]},{5:[2,33],14:[2,33],15:[2,33],16:[2,33],18:[2,33],21:[2,33],22:[2,33],23:[2,33],24:[2,33],25:[2,
33],26:[2,33],27:[2,33],28:[2,33],33:[1,49],38:[2,33],39:[2,33]},{5:[2,35],14:[2,35],15:[2,35],16:[2,35],18:[2,35],21:[2,35],22:[2,35],23:[2,35],24:[2,35],25:[2,35],26:[2,35],27:[2,35],28:[2,35],33:[1,50],38:[2,35],39:[2,35]},{36:[1,51]},{5:[2,39],14:[2,39],15:[2,39],16:[2,39],18:[2,39],21:[2,39],22:[2,39],23:[2,39],24:[2,39],25:[2,39],26:[2,39],27:[2,39],28:[2,39],38:[2,39],39:[2,39]},{40:[1,52]},{1:[2,1]},{2:18,4:53,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],
19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:54,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:55,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],
40:[1,19],42:[1,20],44:[1,25]},{2:18,4:58,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],15:[1,56],16:[1,14],17:[1,11],19:[1,12],23:[1,57],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:60,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],15:[1,59],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:61,6:3,7:[1,4],
8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:62,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:63,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,
13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:64,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:65,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,
20],44:[1,25]},{40:[1,66]},{5:[2,48],14:[2,48],15:[2,48],16:[2,48],18:[2,48],21:[2,48],22:[2,48],23:[2,48],24:[2,48],25:[2,48],26:[2,48],27:[2,48],28:[2,48],38:[2,48],39:[2,48],43:[2,48]},{14:[1,27],15:[1,28],16:[1,29],18:[1,67],22:[1,30],23:[1,31],24:[1,32],25:[1,33],26:[1,34],27:[1,35],28:[1,36]},{21:[1,68],38:[1,69],39:[1,70]},{14:[1,27],15:[1,28],16:[1,29],18:[2,41],21:[2,41],22:[1,30],23:[1,31],24:[1,32],25:[1,33],26:[1,34],27:[1,35],28:[1,36],38:[2,41],39:[2,41]},{5:[2,25],14:[2,25],15:[2,25],
16:[2,25],18:[2,25],21:[2,25],22:[2,25],23:[2,25],24:[2,25],25:[2,25],26:[1,34],27:[1,35],28:[1,36],38:[2,25],39:[2,25]},{5:[2,26],14:[2,26],15:[2,26],16:[2,26],18:[2,26],21:[2,26],22:[2,26],23:[2,26],24:[2,26],25:[2,26],26:[1,34],27:[1,35],28:[1,36],38:[2,26],39:[2,26]},{2:18,4:41,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],18:[1,71],19:[1,12],20:72,25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{5:[2,
32],14:[2,32],15:[2,32],16:[2,32],18:[2,32],21:[2,32],22:[2,32],23:[2,32],24:[2,32],25:[2,32],26:[2,32],27:[2,32],28:[2,32],38:[2,32],39:[2,32]},{44:[1,47]},{40:[1,73]},{42:[1,74]},{32:[1,75]},{34:[1,76]},{34:[1,77],37:[1,78]},{36:[1,79]},{5:[2,10],14:[2,10],15:[2,10],16:[1,29],18:[2,10],21:[2,10],22:[1,30],23:[1,31],24:[1,32],25:[1,33],26:[1,34],27:[1,35],28:[1,36],38:[2,10],39:[2,10]},{5:[2,11],14:[2,11],15:[2,11],16:[1,29],18:[2,11],21:[2,11],22:[1,30],23:[1,31],24:[1,32],25:[1,33],26:[1,34],27:[1,
35],28:[1,36],38:[2,11],39:[2,11]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12],21:[2,12],22:[2,12],23:[2,12],24:[2,12],25:[2,12],26:[1,34],27:[1,35],28:[1,36],38:[2,12],39:[2,12]},{2:18,4:80,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{2:18,4:81,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,
13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{5:[2,20],14:[2,20],15:[2,20],16:[1,29],18:[2,20],21:[2,20],22:[2,20],23:[2,20],24:[2,20],25:[1,33],26:[1,34],27:[1,35],28:[1,36],38:[2,20],39:[2,20]},{2:18,4:82,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{5:[2,19],14:[2,19],15:[2,19],16:[1,29],
18:[2,19],21:[2,19],22:[2,19],23:[2,19],24:[2,19],25:[1,33],26:[1,34],27:[1,35],28:[1,36],38:[2,19],39:[2,19]},{5:[2,18],14:[2,18],15:[2,18],16:[1,29],18:[2,18],21:[2,18],22:[1,30],23:[1,31],24:[2,18],25:[1,33],26:[1,34],27:[1,35],28:[1,36],38:[2,18],39:[2,18]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],18:[2,21],21:[2,21],22:[2,21],23:[2,21],24:[2,21],25:[2,21],26:[1,34],27:[1,35],28:[1,36],38:[2,21],39:[2,21]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],18:[2,22],21:[2,22],22:[2,22],23:[2,22],24:[2,22],
25:[2,22],26:[2,22],27:[2,22],28:[1,36],38:[2,22],39:[2,22]},{5:[2,23],14:[2,23],15:[2,23],16:[2,23],18:[2,23],21:[2,23],22:[2,23],23:[2,23],24:[2,23],25:[2,23],26:[2,23],27:[2,23],28:[1,36],38:[2,23],39:[2,23]},{5:[2,24],14:[2,24],15:[2,24],16:[2,24],18:[2,24],21:[2,24],22:[2,24],23:[2,24],24:[2,24],25:[2,24],26:[2,24],27:[2,24],28:[2,24],38:[2,24],39:[2,24]},{5:[2,45],14:[2,45],15:[2,45],16:[2,45],18:[2,45],21:[2,45],22:[2,45],23:[2,45],24:[2,45],25:[2,45],26:[2,45],27:[2,45],28:[2,45],38:[2,45],
39:[2,45],41:[2,45]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13],21:[2,13],22:[2,13],23:[2,13],24:[2,13],25:[2,13],26:[2,13],27:[2,13],28:[2,13],38:[2,13],39:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14],21:[2,14],22:[2,14],23:[2,14],24:[2,14],25:[2,14],26:[2,14],27:[2,14],28:[2,14],38:[2,14],39:[2,14]},{2:18,4:83,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],
40:[1,19],42:[1,20],44:[1,25]},{2:18,4:84,6:3,7:[1,4],8:[1,5],9:[1,6],10:[1,7],11:[1,8],12:9,13:[1,10],16:[1,14],17:[1,11],19:[1,12],25:[1,13],29:[1,15],30:[1,16],31:17,32:[1,21],34:[1,22],35:[1,23],37:[1,24],40:[1,19],42:[1,20],44:[1,25]},{5:[2,28],14:[2,28],15:[2,28],16:[2,28],18:[2,28],21:[2,28],22:[2,28],23:[2,28],24:[2,28],25:[2,28],26:[2,28],27:[2,28],28:[2,28],38:[2,28],39:[2,28]},{18:[1,85],38:[1,69],39:[1,70]},{36:[1,86]},{5:[2,47],14:[2,47],15:[2,47],16:[2,47],18:[2,47],21:[2,47],22:[2,
47],23:[2,47],24:[2,47],25:[2,47],26:[2,47],27:[2,47],28:[2,47],38:[2,47],39:[2,47],43:[2,47]},{5:[2,34],14:[2,34],15:[2,34],16:[2,34],18:[2,34],21:[2,34],22:[2,34],23:[2,34],24:[2,34],25:[2,34],26:[2,34],27:[2,34],28:[2,34],38:[2,34],39:[2,34]},{5:[2,36],14:[2,36],15:[2,36],16:[2,36],18:[2,36],21:[2,36],22:[2,36],23:[2,36],24:[2,36],25:[2,36],26:[2,36],27:[2,36],28:[2,36],38:[2,36],39:[2,36]},{5:[2,37],14:[2,37],15:[2,37],16:[2,37],18:[2,37],21:[2,37],22:[2,37],23:[2,37],24:[2,37],25:[2,37],26:[2,
37],27:[2,37],28:[2,37],33:[1,87],38:[2,37],39:[2,37]},{5:[2,40],14:[2,40],15:[2,40],16:[2,40],18:[2,40],21:[2,40],22:[2,40],23:[2,40],24:[2,40],25:[2,40],26:[2,40],27:[2,40],28:[2,40],38:[2,40],39:[2,40]},{5:[2,49],14:[2,49],15:[2,49],16:[2,49],18:[2,49],21:[2,49],22:[2,49],23:[2,49],24:[2,49],25:[2,49],26:[2,49],27:[2,49],28:[2,49],38:[2,49],39:[2,49],40:[2,49],44:[2,49]},{5:[2,15],14:[2,15],15:[2,15],16:[1,29],18:[2,15],21:[2,15],22:[2,15],23:[2,15],24:[2,15],25:[1,33],26:[1,34],27:[1,35],28:[1,
36],38:[2,15],39:[2,15]},{5:[2,17],14:[2,17],15:[2,17],16:[1,29],18:[2,17],21:[2,17],22:[2,17],23:[2,17],24:[2,17],25:[1,33],26:[1,34],27:[1,35],28:[1,36],38:[2,17],39:[2,17]},{5:[2,16],14:[2,16],15:[2,16],16:[1,29],18:[2,16],21:[2,16],22:[2,16],23:[2,16],24:[2,16],25:[1,33],26:[1,34],27:[1,35],28:[1,36],38:[2,16],39:[2,16]},{14:[1,27],15:[1,28],16:[1,29],18:[2,42],21:[2,42],22:[1,30],23:[1,31],24:[1,32],25:[1,33],26:[1,34],27:[1,35],28:[1,36],38:[2,42],39:[2,42]},{14:[1,27],15:[1,28],16:[1,29],18:[2,
43],21:[2,43],22:[1,30],23:[1,31],24:[1,32],25:[1,33],26:[1,34],27:[1,35],28:[1,36],38:[2,43],39:[2,43]},{5:[2,29],14:[2,29],15:[2,29],16:[2,29],18:[2,29],21:[2,29],22:[2,29],23:[2,29],24:[2,29],25:[2,29],26:[2,29],27:[2,29],28:[2,29],38:[2,29],39:[2,29]},{5:[2,50],14:[2,50],15:[2,50],16:[2,50],18:[2,50],21:[2,50],22:[2,50],23:[2,50],24:[2,50],25:[2,50],26:[2,50],27:[2,50],28:[2,50],38:[2,50],39:[2,50],40:[2,50],44:[2,50]},{34:[1,88]},{5:[2,38],14:[2,38],15:[2,38],16:[2,38],18:[2,38],21:[2,38],22:[2,
38],23:[2,38],24:[2,38],25:[2,38],26:[2,38],27:[2,38],28:[2,38],38:[2,38],39:[2,38]}],defaultActions:{26:[2,1]},parseError:function(a,b){if(b.recoverable)this.trace(a);else throw Error(a);},parse:function(a){function b(a){e.length-=2*a;l.length-=a;g.length-=a}function c(){var a;a=d.lexer.lex()||1;"number"!==typeof a&&(a=d.symbols_[a]||a);return a}var d=this,e=[0],l=[null],g=[],k=this.table,n="",s=0,r=0,t=0,u=g.slice.call(arguments,1);this.lexer.setInput(a);this.lexer.yy=this.yy;this.yy.lexer=this.lexer;
this.yy.parser=this;"undefined"==typeof this.lexer.yylloc&&(this.lexer.yylloc={});var v=this.lexer.yylloc;g.push(v);var x=this.lexer.options&&this.lexer.options.ranges;this.parseError="function"===typeof this.yy.parseError?this.yy.parseError:Object.getPrototypeOf(this).parseError;for(var w,B,z,y,C={},E,A;;){z=e[e.length-1];if(this.defaultActions[z])y=this.defaultActions[z];else{if(null===w||"undefined"==typeof w)w=c();y=k[z]&&k[z][w]}if("undefined"===typeof y||!y.length||!y[0]){A=function(a){for(var b=
e.length-1,c=0;;){if((2).toString()in k[a])return c;if(0===a||2>b)return!1;b-=2;a=e[b];++c}};var D;y="";if(t)1!==B&&(D=A(z));else{D=A(z);A=[];for(E in k[z])this.terminals_[E]&&2<E&&A.push("'"+this.terminals_[E]+"'");y=this.lexer.showPosition?"Parse error on line "+(s+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[w]||w)+"'":"Parse error on line "+(s+1)+": Unexpected "+(1==w?"end of input":"'"+(this.terminals_[w]||w)+"'");this.parseError(y,{text:this.lexer.match,
token:this.terminals_[w]||w,line:this.lexer.yylineno,loc:v,expected:A,recoverable:!1!==D})}if(3==t){if(1===w||1===B)throw Error(y||"Parsing halted while starting to recover from another error.");r=this.lexer.yyleng;n=this.lexer.yytext;s=this.lexer.yylineno;v=this.lexer.yylloc;w=c()}if(!1===D)throw Error(y||"Parsing halted. No suitable error recovery rule available.");b(D);B=2==w?null:w;w=2;z=e[e.length-1];y=k[z]&&k[z][2];t=3}if(y[0]instanceof Array&&1<y.length)throw Error("Parse Error: multiple actions possible at state: "+
z+", token: "+w);switch(y[0]){case 1:e.push(w);l.push(this.lexer.yytext);g.push(this.lexer.yylloc);e.push(y[1]);w=null;B?(w=B,B=null):(r=this.lexer.yyleng,n=this.lexer.yytext,s=this.lexer.yylineno,v=this.lexer.yylloc,0<t&&t--);break;case 2:A=this.productions_[y[1]][1];C.$=l[l.length-A];C._$={first_line:g[g.length-(A||1)].first_line,last_line:g[g.length-1].last_line,first_column:g[g.length-(A||1)].first_column,last_column:g[g.length-1].last_column};x&&(C._$.range=[g[g.length-(A||1)].range[0],g[g.length-
1].range[1]]);z=this.performAction.apply(C,[n,r,s,this.yy,y[1],l,g].concat(u));if("undefined"!==typeof z)return z;A&&(e=e.slice(0,-2*A),l=l.slice(0,-1*A),g=g.slice(0,-1*A));e.push(this.productions_[y[1]][0]);l.push(C.$);g.push(C._$);z=k[e[e.length-2]][e[e.length-1]];e.push(z);break;case 3:return!0}}}},d=function(){return{EOF:1,parseError:function(a,b){if(this.yy.parser)this.yy.parser.parseError(a,b);else throw Error(a);},setInput:function(a){this._input=a;this._more=this._backtrack=this.done=!1;this.yylineno=
this.yyleng=0;this.yytext=this.matched=this.match="";this.conditionStack=["INITIAL"];this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0};this.options.ranges&&(this.yylloc.range=[0,0]);this.offset=0;return this},input:function(){var a=this._input[0];this.yytext+=a;this.yyleng++;this.offset++;this.match+=a;this.matched+=a;a.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++;this.options.ranges&&this.yylloc.range[1]++;this._input=this._input.slice(1);
return a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-b-1);this.offset-=b;a=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1);this.matched=this.matched.substr(0,this.matched.length-1);c.length-1&&(this.yylineno-=c.length-1);var d=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?
(c.length===a.length?this.yylloc.first_column:0)+a[a.length-c.length].length-c[0].length:this.yylloc.first_column-b};this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-b]);this.yyleng=this.yytext.length;return this},more:function(){this._more=!0;return this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+
this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(20<a.length?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;20>a.length&&(a+=this._input.substr(0,20-a.length));return(a.substr(0,20)+(20<a.length?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=Array(a.length+1).join("-");
return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d;this.options.backtrack_lexer&&(d={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&
(d.yylloc.range=this.yylloc.range.slice(0)));if(c=a[0].match(/(?:\r\n?|\n).*/g))this.yylineno+=c.length;this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:c?c[c.length-1].length-c[c.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length};this.yytext+=a[0];this.match+=a[0];this.matches=a;this.yyleng=this.yytext.length;this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]);this._backtrack=
this._more=!1;this._input=this._input.slice(a[0].length);this.matched+=a[0];c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]);this.done&&this._input&&(this.done=!1);if(c)return c;if(this._backtrack)for(var e in d)this[e]=d[e];return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c;this._more||(this.match=this.yytext="");for(var d=this._currentRules(),e=0;e<d.length;e++)if((b=this._input.match(this.rules[d[e]]))&&(!a||
b[0].length>a[0].length))if(a=b,c=e,this.options.backtrack_lexer){a=this.test_match(b,d[e]);if(!1!==a)return a;if(this._backtrack)a=!1;else return!1}else if(!this.options.flex)break;return a?(a=this.test_match(a,d[c]),!1!==a?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},
popState:function(){return 0<this.conditionStack.length-1?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){a=this.conditionStack.length-1-Math.abs(a||0);return 0<=a?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},
options:{},performAction:function(b,c,d,e){switch(d){case 1:return 13;case 2:return 13;case 3:return 35;case 4:return 30;case 5:return 10;case 6:return 11;case 7:return"cell"==a.obj.type?32:40;case 8:return"cell"==a.obj.type?34:40;case 9:return 37;case 10:return 30;case 11:return 40;case 12:return 40;case 13:return 42;case 15:return" ";case 16:return 41;case 17:return 33;case 18:return 38;case 19:return 39;case 20:return 26;case 21:return 27;case 22:return 25;case 23:return 16;case 24:return 28;case 25:return 17;
case 26:return 18;case 27:return 19;case 28:return 21;case 29:return 23;case 30:return 22;case 31:return 24;case 32:return"PI";case 33:return 29;case 34:return 7;case 35:return 8;case 36:return 9;case 37:return'"';case 38:return"'";case 39:return"!";case 40:return 15;case 41:return 43;case 42:return 44;case 43:return 14;case 44:return 5}},rules:[/^(?:\s+)/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:#[A-Za-z0-9_]+)/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+(?=[(]))/,/^(?:([0]?[1-9]|1[0-2])[:][0-5][0-9]([:][0-5][0-9])?[ ]?(AM|am|aM|Am|PM|pm|pM|Pm))/,
/^(?:([0]?[0-9]|1[0-9]|2[0-3])[:][0-5][0-9]([:][0-5][0-9])?)/,/^(?:\$[A-Za-z]+\$[0-9]+)/,/^(?:[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z]+[:][A-Za-z]+)/,/^(?:[A-Za-z]+(?=[(]))/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,/^(?:[A-Za-z_]+)/,/^(?:[0-9]+)/,/^(?:\$)/,/^(?: )/,/^(?:[.])/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:>)/,/^(?:<)/,/^(?:NOT\b)/,/^(?:PI\b)/,/^(?:E\b)/,/^(?:TRUE\b)/,/^(?:FALSE\b)/,/^(?:NULL\b)/,/^(?:")/,/^(?:')/,/^(?:!)/,/^(?:=)/,
/^(?:%)/,/^(?:[#])/,/^(?:[&])/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!0}}}}();c.lexer=d;b.prototype=c;c.Parser=b;return new b}function v(a,b,c){this.sheet=a;this.floatValue=this.computedValue=this.formattedValue=this.value=null;this.processed=this.affected=!1;this.dependencies={};this.dependant={};this.conditionalStyle=!1;this.address="";this.isCheckbox=this.remoteDependency=
!1;"undefined"!=typeof b?this.el=r(b):(this.el=!1,this.address="undefined"!=typeof c?c:"");this.init()}function u(a,b,c){this.identifier=a;this.el=r(b);this.lang="en";this.cells={};this.variables={};this.config=r.extend({},G,c);this.counter=1;this.relatedSheet=!1;this.elementId=this.el.attr("id");this.dependant={};this.dependencies={};this.calculating=this.calculated=!1;this.activeCell=null;this.totalCell=0;this.affectedCell=[];this.init()}if("undefined"==typeof r)return!1;"function"!==typeof Array.indexOf&&
(Array.prototype.indexOf=function(a,b){for(var c=b||0;c<this.length;c++)if(this[c]==a)return c;return-1});"function"!==typeof Object.getPrototypeOf&&(Object.getPrototypeOf="object"===typeof"test".__proto__?function(a){return a.__proto__}:function(a){return a.constructor.prototype});var G={autoCalculate:!0,autoCalculateTrigger:"blur",onBeforeCalculate:null,onAfterCalculate:null,onBeforeRender:null,onAfterRender:null,defaultFormat:!1,ajaxUrl:null,ajaxMethod:"get",graphHandler:"flot",checkCircularReference:!1,
data:{}},e={custom:{},date:{DATE:function(a,b,c){return"undefined"==typeof k?n.ERRKEY.momentRequired:"undefined"==typeof b?k(a):new Date(a,b-1,c)},DATEDIFF:function(a,b,c){return"undefined"==typeof k?n.ERRKEY.momentRequired:k(b).diff(k.utc(a),c)},DATEFORMAT:function(a,b){return"undefined"==typeof k?n.ERRKEY.momentRequired:k(a).format(b)},DATEVALUE:function(a){return"undefined"==typeof k?n.ERRKEY.momentRequired:Math.ceil((k(a)-k("1900-1-1"))/864E5)+2},DAY:function(a){return"undefined"==typeof k?n.ERRKEY.momentRequired:
k(new Date(a)).date()},DAYNAME:function(a){return n.DAY_NAME[e.date.WEEKDAY(a)-1]},DAYS:function(a,b){return"undefined"==typeof k?n.ERRKEY.momentRequired:k(new Date(a)).diff(k(new Date(b)),"days")},DAYS360:function(a,b,c){if("undefined"==typeof k)return n.ERRKEY.momentRequired;a=k(new Date(a));b=k(new Date(b));var d=31,f=31,h=a.date(),q=b.date();if(c)h=31===h?30:h,q=31===q?30:q;else if(1===a.month()&&(d=a.daysInMonth()),1===b.month()&&(f=b.daysInMonth()),h=h===d?30:h,30===h||h===d)q=q===f?30:q;return 360*
(b.year()-a.year())+30*(b.month()-a.month())+(q-h)},EDATE:function(a,b){return"undefined"==typeof k?n.ERRKEY.momentRequired:k(new Date(a)).add("months",b).toDate()},EOMONTH:function(a,b){if("undefined"==typeof k)return n.ERRKEY.momentRequired;var c=k(new Date(a)).add("months",b);return new Date(c.year(),c.month(),c.daysInMonth())},FROMNOW:function(a,b){return"undefined"==typeof k?n.ERRKEY.momentRequired:k(new Date(a)).fromNow(b)},HOUR:function(a){return"undefined"==typeof k?n.ERRKEY.momentRequired:
1>=a?Math.floor(24*a):k(new Date(a)).hours()},MINUTE:function(a){return"undefined"==typeof k?n.ERRKEY.momentRequired:1>=a?Math.floor(1440*a)-60*Math.floor(24*a):k(new Date(a)).minutes()},ISOWEEKNUM:function(a){return"undefined"==typeof k?n.ERRKEY.momentRequired:k(new Date(a)).format("w")},MONTH:function(a){return"undefined"==typeof k?n.ERRKEY.momentRequired:k(new Date(a)).month()+1},NETWORKDAYS:function(a,b,c){return e.date.NETWORKDAYSINTL(a,b,1,c)},NETWORKDAYSINTL:function(a,b,c,d){if("undefined"==
typeof k)return n.ERRKEY.momentRequired;c=n.WEEKEND_TYPES["undefined"===typeof c?1:c];var f=k(a);a=b=k(b).diff(f,"days")+1;var h="",q=[];if("undefined"!==typeof d)for(h=0;h<d.length;h++)q[h]=k(new Date(d[h])).format("MM-DD-YYYY");for(d=0;d<b;)h=f.format("d"),0<=c.indexOf(parseInt(h,10))?a--:0<=q.indexOf(f.format("MM-DD-YYYY"))&&a--,f=f.add("days",1),d++;return a},NOW:function(){return new Date},SECOND:function(a){return"undefined"==typeof k?n.ERRKEY.momentRequired:k(new Date(a)).seconds()},TIME:function(a,
b,c){return(3600*a+60*b+c)/86400},TIMEVALUE:function(a){if("undefined"==typeof k)return n.ERRKEY.momentRequired;a=k(new Date(a));return(3600*a.hours()+60*a.minutes()+a.seconds())/86400},TODAY:function(){return new Date},WEEKDAY:function(a,b){if("undefined"==typeof k)return n.ERRKEY.momentRequired;var c=k(new Date(a)).format("d");return n.WEEK_TYPES["undefined"===typeof b?1:b][c]},WEEKNUM:function(a,b){if("undefined"==typeof k)return n.ERRKEY.momentRequired;var c=k(new Date(a)),d=k(new Date(c.year(),
0,1)),f="undefined"===typeof b?1:b,h=n.WEEK_STARTS[f],q=d.format("d"),h=q<h?h-q+1:q-h;return 21===f?e.date.ISOWEEKNUM(a):Math.floor(c.diff(d.subtract("days",h),"days")/7)+1},WORKDAY:function(a,b,c){return e.date.WORKDAYINTL(a,b,1,c)},WORKDAYINTL:function(a,b,c,d){if("undefined"==typeof k)return n.ERRKEY.momentRequired;c=n.WEEKEND_TYPES["undefined"===typeof c?1:c];a=k(new Date(a));var f="",h=[];if("undefined"!==typeof d)for(f=0;f<d.length;f++)h[f]=k(new Date(d[f])).format("MM-DD-YYYY");for(d=0;d<b;)a=
a.add("days",1),f=a.format("d"),0>c.indexOf(parseInt(f,10))&&0>h.indexOf(a.format("MM-DD-YYYY"))&&d++;return a.toDate()},YEAR:function(a){return"undefined"==typeof k?n.ERRKEY.momentRequired:k(new Date(a)).year()},YEARFRAC:function(a,b,c){if("undefined"==typeof k)return n.ERRKEY.momentRequired;c="undefined"===typeof c?0:c;var d=k(new Date(a)),f=k(new Date(b));if(!d.isValid()||!f.isValid())return"#VALUE!";if(-1===[0,1,2,3,4].indexOf(c))return"#NUM!";if(d===f)return 0;0<d.diff(f)&&(f=k(new Date(a)),
d=k(new Date(b)));var h=d.year(),q=d.month(),e=d.date(),m=f.year();a=f.month();b=f.date();switch(c){case 0:return 31===e&&31===b?b=e=30:31===e?e=30:30===e&&31===b?b=30:1===q&&1===a&&d.daysInMonth()===e&&f.daysInMonth()===b?b=e=30:1===q&&d.daysInMonth()===e&&(e=30),(b+30*a+360*m-(e+30*q+360*h))/360;case 1:c=365;if(h===m||h+1===m&&(q>a||q===a&&e>=b)){if(h===m&&k([h]).isLeapYear())c=366;else if(h=d,m=f,q=k(new Date(h.year(),2,1)),k([h.year()]).isLeapYear()&&0>h.diff(q)&&0<=m.diff(q)?h=!0:(q=k(new Date(m.year(),
2,1)),h=k([m.year()]).isLeapYear()&&0<=m.diff(q)&&0>h.diff(q)?!0:!1),h||1===a&&29===b)c=366;return f.diff(d,"days")/c}a=m-h+1;a=k(new Date(m+1,0,1)).diff(k(new Date(h,0,1)),"days")/a;return f.diff(d,"days")/a;case 2:return f.diff(d,"days")/360;case 3:return f.diff(d,"days")/365;case 4:return 31===e&&(e=30),31===b&&(b=30),(b+30*a+360*m-(e+30*q+360*h))/360}}},math:{ABS:function(a){return Math.abs(a)},ACOS:function(a){return Math.acos(a)},ACOSH:function(a){return Math.log(a+Math.sqrt(a*a-1))},ACOT:function(a){return Math.atan(1/
a)},ACOTH:function(a){return.5*Math.log((a+1)/(a-1))},AGGREGATE:function(a,b){for(var c=[],d=2;d<arguments.length;d++)switch(a){case 1:c[d-2]=e.statistic.AVERAGE(arguments[d]);break;case 2:c[d-2]=e.statistic.COUNT(arguments[d]);break;case 3:c[d-2]=e.statistic.COUNTA(arguments[d]);break;case 4:c[d-2]=e.statistic.MAX(arguments[d]);break;case 5:c[d-2]=e.statistic.MIN(arguments[d]);break;case 6:c[d-2]=e.statistic.PRODUCT(arguments[d]);break;case 7:c[d-2]=e.statistic.STDEVS(arguments[d]);break;case 8:c[d-
2]=e.statistic.STDEVP(arguments[d]);break;case 9:c[d-2]=e.math.SUM(arguments[d]);break;case 10:c[d-2]=e.statistic.VARS(arguments[d]);break;case 11:c[d-2]=e.statistic.VARP(arguments[d]);break;case 12:c[d-2]=e.statistic.MEDIAN(arguments[d]);break;case 13:c[d-2]=e.statistic.MODESNGL(arguments[d]);break;case 14:c[d-2]=e.statistic.LARGE(arguments[d]);break;case 15:c[d-2]=e.statistic.SMALL(arguments[d]);break;case 16:c[d-2]=e.statistic.PERCENTILEINC(arguments[d]);break;case 17:c[d-2]=e.statistic.QUARTILEINC(arguments[d]);
break;case 18:c[d-2]=e.statistic.PERCENTILEEXC(arguments[d]);break;case 19:c[d-2]=e.statistic.QUARTILEEXC(arguments[d])}return c},ARABIC:function(a){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(a))return"#VALUE!";var b=0;a.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(a){b+={M:1E3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[a]});return b},ASIN:function(a){return Math.asin(a)},ASINH:function(a){return Math.log(a+Math.sqrt(a*a+1))},ATAN:function(a){return Math.atan(a)},
ATAN2:function(a,b){return Math.atan2(a,b)},ATANH:function(a){return Math.log((1+a)/(1-a))/2},BASE:function(a,b,c){c="undefined"===typeof c?0:c;a=a.toString(b);return Array(Math.max(c+1-a.length,0)).join("0")+a},CEILING:function(a,b,c){if(0===b)return 0;b="undefined"===typeof b?1:Math.abs(b);c="undefined"===typeof c?0:c;var d=-Math.floor(Math.log(b)/Math.log(10));return 0<=a?e.math.ROUND(Math.ceil(a/b)*b,d):0===c?-e.math.ROUND(Math.floor(Math.abs(a)/b)*b,d):-e.math.ROUND(Math.ceil(Math.abs(a)/b)*
b,d)},CEILINGMATH:function(a,b,c){return e.math.CEILING(a,b,c)},CEILINGPRECISE:function(a,b,c){return e.math.CEILING(a,b,c)},COMBIN:function(a,b){return e.math.FACT(a)/(e.math.FACT(b)*e.math.FACT(a-b))},COMBINA:function(a,b){return 0===a&&0===b?1:e.math.COMBIN(a+b-1,a-1)},COS:function(a){return Math.cos(a)},COSH:function(a){return(Math.exp(a)+Math.exp(-a))/2},COT:function(a){return 1/Math.tan(a)},COTH:function(a){a=Math.exp(2*a);return(a+1)/(a-1)},CSC:function(a){return 1/Math.sin(a)},CSCH:function(a){return 2/
(Math.exp(a)-Math.exp(-a))},DECIMAL:function(a,b){return parseInt(a,b)},DEGREES:function(a){return 180*a/Math.PI},DIVIDE:function(a,b){return""===a||""===b?"":0==b?"#DIV/0":parseFloat(a)/parseFloat(b)},EVEN:function(a){return e.math.CEILING(a,-2,-1)},EXP:function(a){return Math.exp(a)},FACT:function(a){a=Math.floor(a);if(0===a||1===a)return 1;0<n.MEMOIZED_FACT[a]||(n.MEMOIZED_FACT[a]=e.math.FACT(a-1)*a);return n.MEMOIZED_FACT[a]},FACTDOUBLE:function(a){a=Math.floor(a);return 0>=a?1:a*e.math.FACTDOUBLE(a-
2)},FLOOR:function(a,b,c){if(0===b)return 0;b="undefined"===typeof b?1:Math.abs(b);c="undefined"===typeof c?0:c;var d=-Math.floor(Math.log(b)/Math.log(10));return 0<=a?e.math.ROUND(Math.floor(a/b)*b,d):0===c?-e.math.ROUND(Math.ceil(Math.abs(a)/b)*b,d):-e.math.ROUND(Math.floor(Math.abs(a)/b)*b,d)},FLOORMATH:function(a,b,c){return e.math.FLOOR(a,b,c)},FLOORPRECISE:function(a,b,c){return e.math.FLOOR(a,b,c)},GCD:function(){for(var a,b,c=arguments.length-1,d=arguments[c];c;)for(b=arguments[--c];a=b%d;b=
d,d=a);return d},INT:function(a){return Math.floor(a)},ISEVEN:function(a){return Math.floor(Math.abs(a))&1?!1:!0},ISOCEILING:function(a,b,c){return e.math.CEILING(a,b,c)},ISODD:function(a){return Math.floor(Math.abs(a))&1?!0:!1},LCM:function(){for(var a=s.toArray(arguments),b,c,d,f=1;void 0!==(d=a.pop());)for(;1<d;){if(d%2){b=3;for(c=Math.floor(Math.sqrt(d));b<=c&&d%b;b+=2);c=b<=c?b:d}else c=2;d/=c;f*=c;for(b=a.length;b;0===a[--b]%c&&1===(a[b]/=c)&&a.splice(b,1));}return f},LN:function(a){return Math.log(a)},
LOG:function(a,b){b="undefined"===typeof b?10:b;return Math.log(a)/Math.log(b)},LOG10:function(a){return Math.log(a)/Math.log(10)},MOD:function(a,b){var c=Math.abs(a%b);return 0<b?c:-c},MROUND:function(a,b){if(0>a*b)throw Error("Number and multiple must have the same sign.");return Math.round(a/b)*b},MULTINOMIAL:function(){for(var a=0,b=1,c=0;c<arguments.length;c++)a+=arguments[c],b*=e.math.FACT(arguments[c]);return e.math.FACT(a)/b},MULTIPLY:function(a,b){if(""===a||""===b)return"";a=isNaN(parseFloat(a))?
0:parseFloat(a);b=isNaN(parseFloat(b))?0:parseFloat(b);return a*b},ODD:function(a){var b=Math.ceil(Math.abs(a)),b=b&1?b:b+1;return 0<a?b:-b},PI:function(){return Math.PI},POWER:function(a,b){return Math.pow(a,b)},PRODUCT:function(){for(var a=1,b=0;b<arguments.length;b++)a*=arguments[b];return a},QUOTIENT:function(a,b){return(a/b).toFixed(0)},RADIANS:function(a){return a*Math.PI/180},RAND:function(){return Math.random()},RANDBETWEEN:function(a,b){return a+Math.ceil((b-a+1)*Math.random())-1},ROUND:function(a,
b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},ROUNDDOWN:function(a,b){return(0<a?1:-1)*Math.floor(Math.abs(a)*Math.pow(10,b))/Math.pow(10,b)},ROUNDUP:function(a,b){return(0<a?1:-1)*Math.ceil(Math.abs(a)*Math.pow(10,b))/Math.pow(10,b)},SERIESSUM:function(a,b,c,d){for(var f=d[0]*Math.pow(a,b),h=1;h<d.length;h++)f+=d[h]*Math.pow(a,b+h*c);return f},SEC:function(a){return 1/Math.cos(a)},SECH:function(a){return 2/(Math.exp(a)+Math.exp(-a))},SIGN:function(a){return 0>a?-1:0===a?0:1},SIN:function(a){return Math.sin(a)},
SINH:function(a){return(Math.exp(a)-Math.exp(-a))/2},SQRT:function(a){return Math.sqrt(a)},SQRTPI:function(a){return Math.sqrt(a*Math.PI)},SUBTOTAL:function(a){for(var b=[],c=1;c<arguments.length;c++)switch(a){case 1:b[c-1]=e.statistic.AVERAGE(arguments[c]);break;case 2:b[c-1]=e.statistic.COUNT(arguments[c]);break;case 3:b[c-1]=e.statistic.COUNTA(arguments[c]);break;case 4:b[c-1]=e.statistic.MAX(arguments[c]);break;case 5:b[c-1]=e.statistic.MIN(arguments[c]);break;case 6:b[c-1]=e.statistic.PRODUCT(arguments[c]);
break;case 7:b[c-1]=e.statistic.STDEV(arguments[c]);break;case 8:b[c-1]=e.statistic.STDEVP(arguments[c]);break;case 9:b[c-1]=e.math.SUM(arguments[c]);break;case 10:b[c-1]=e.statistic.VAR(arguments[c]);break;case 11:b[c-1]=e.statistic.VARP(arguments[c])}return b},SUBTRACT:function(a,b){if(""===a&&""===b)return"";a=isNaN(parseFloat(a))?0:parseFloat(a);b=isNaN(parseFloat(b))?0:parseFloat(b);return a-b},SUM:function(){var a,b,c,d="",f=0;for(b=0;b<arguments.length;b++)if("object"==typeof arguments[b])for(a in arguments[b])d+=
"undefined"!=typeof arguments[b][a]?arguments[b][a]:"",c=isNaN(parseFloat(arguments[b][a],10))?0:parseFloat(arguments[b][a],10),f+=c;else d+="undefined"!=typeof arguments[b]?arguments[b]:"",c=isNaN(parseFloat(arguments[b],10))?0:parseFloat(arguments[b],10),f+=c;return 0===f&&""===r.trim(d)?"":f},SUMIF:function(a,b,c){var d=0;a=s.objectToArray(a);c="undefined"==typeof c?a:s.objectToArray(c);for(var f=0;f<a.length;f++)this.evaluate(a[f]+b)&&(d+=c[f]);return d},SUMIFS:function(){for(var a=(arguments.length-
1)/2,b=s.objectToArray(arguments[0]),c=0,d=0;d<b.length;d++){for(var f=!0,h=0;h<a;h++){var e=arguments[2*h+1],p=s.objectToArray(arguments[2*h+2]);f&&(f=this.evaluate(p[d]+e))}c+=f?b[d]:0}return c},SUMPRODUCT:function(){for(var a in arguments)if(arguments[a]=s.objectToArray(arguments[a]),0<a&&arguments[a-1].length!==arguments[a].length)return"#VALUE!";a=[];for(var b=0;b<arguments.length;b++)for(var c=0;c<arguments[b].length;c++)a[c]=0==b?arguments[b][c]:e.math.MULTIPLY(a[c],arguments[b][c]);return e.math.SUM(a)},
SUMSQ:function(){for(var a=s.toArray(arguments),b=0,c=0;c<a.length;c++)b+=r.isNumeric(a[c])?a[c]*a[c]:0;return b},SUMX2MY2:function(a,b){for(var c=0,d=0;d<a.length;d++)c+=a[d]*a[d]-b[d]*b[d];return c},SUMX2PY2:function(a,b){for(var c=0,d=0;d<a.length;d++)c+=a[d]*a[d]+b[d]*b[d];return c},SUMXMY2:function(a,b){for(var c=0,d=0;d<a.length;d++)c+=Math.pow(a[d]-b[d],2);return c},TAN:function(a){return Math.tan(a)},TANH:function(a){a=Math.exp(2*a);return(a-1)/(a+1)},TRUNC:function(a,b){b="undefined"===typeof b?
0:b;return(0<a?1:-1)*Math.floor(Math.abs(a)*Math.pow(10,b))/Math.pow(10,b)}},financial:{ACCRINT:function(a,b,c,d,f,h,q,p){if("undefined"==typeof k)return"#NAME?";if(!k(a).isValid()||!k(b).isValid()||!k(c).isValid())return"#VALUE!";if(0>=d||0>=f||-1===[1,2,4].indexOf(h)||-1===[0,1,2,3,4].indexOf(q)||0<=k(a).diff(k(c)))return"#NUM!";f="undefined"===typeof f?0:f;q="undefined"===typeof q?0:q;h=0;p=k(new Date(a));k(new Date(b));k(new Date(c));k([p.year()]).isLeapYear();switch(q){case 0:h=e.date.YEARFRAC(a,
c,q);break;case 1:h=e.date.YEARFRAC(a,c,q);break;case 2:h=e.date.YEARFRAC(a,c,q);break;case 3:h=e.date.YEARFRAC(a,c,q);break;case 4:h=e.date.YEARFRAC(a,c,q)}return f*d*h},ACCRINTM:function(){},AMORDEGRC:function(){},AMORLINC:function(){},COUPDAYBS:function(){},COUPDAYS:function(){},COUPDAYSNC:function(){},COUPNCD:function(){},COUPNUM:function(){},COUPPCD:function(){},CUMIPMT:function(a,b,c,d,f,h){if(0>=a||0>=b||0>=c||1>d||1>f||d>f||0!==h&&1!==h)return"#NUM!";b=e.financial.PMT(a,b,c,0,h);var q=0;1===
d&&0===h&&(q=-c,d++);for(;d<=f;d++)q=1===h?q+(e.financial.FV(a,d-2,b,c,1)-b):q+e.financial.FV(a,d-1,b,c,0);return q*a},CUMPRINC:function(a,b,c,d,f,h){if(0>=a||0>=b||0>=c||1>d||1>f||d>f||0!==h&&1!==h)return"#NUM!";b=e.financial.PMT(a,b,c,0,h);var q=0;1===d&&(q=0===h?b+c*a:b,d++);for(;d<=f;d++)q=0<h?q+(b-(e.financial.FV(a,d-2,b,c,1)-b)*a):q+(b-e.financial.FV(a,d-1,b,c,0)*a);return q},DB:function(a,b,c,d,f){f="undefined"===typeof f?12:f;if(isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d)||isNaN(f))return"#VALUE!";
if(0>a||0>b||0>c||0>d||-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(f)||d>c)return"#NUM!";if(b>=a)return 0;b=(1-Math.pow(b/a,1/c)).toFixed(3);for(var h=f=a*b*f/12,e=0,p=d===c?c-1:d,m=2;m<=p;m++)e=(a-h)*b,h+=e;return 1===d?f:d===c?(a-h)*b:e},DDB:function(a,b,c,d,f){f="undefined"===typeof f?2:f;if(isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d)||isNaN(f))return"#VALUE!";if(0>a||0>b||0>c||0>d||0>=f||d>c)return"#NUM!";if(b>=a)return 0;for(var h=0,e=0,p=1;p<=d;p++)e=Math.min(f/c*(a-h),a-b-h),h+=e;return e},DISC:function(){},
DOLLARDE:function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";if(0<=b&&1>b)return"#DIV/0!";b=parseInt(b,10);var c=parseInt(a,10),c=c+a%1*Math.pow(10,Math.ceil(Math.log(b)/Math.LN10))/b,d=Math.pow(10,Math.ceil(Math.log(b)/Math.LN2)+1);return c=Math.round(c*d)/d},DOLLARFR:function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";if(0<=b&&1>b)return"#DIV/0!";b=parseInt(b,10);var c=parseInt(a,10);return c+=a%1*Math.pow(10,-Math.ceil(Math.log(b)/Math.LN10))*b},DURATION:function(){},
EFFECT:function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";if(0>=a||1>b)return"#NUM!";b=parseInt(b,10);return Math.pow(1+a/b,b)-1},FV:function(a,b,c,d,f){f="undefined"===typeof f?0:f;0===a?a=d+c*b:(b=Math.pow(1+a,b),a=1===f?d*b+c*(1+a)*(b-1)/a:d*b+c*(b-1)/a);return-a},FVSCHEDULE:function(a,b){for(var c=a,d=0;d<b.length;d++){if(isNaN(b[d]))return"#VALUE!";c*=1+b[d]}return c},INTRATE:function(){},IPMT:function(a,b,c,d,f,h){h="undefined"===typeof h?0:h;c=e.financial.PMT(a,c,d,f,h);return(1===b?1===h?
0:-d:1===h?e.financial.FV(a,b-2,c,d,1)-c:e.financial.FV(a,b-1,c,d,0))*a},IRR:function(a,b){var c,d=[],f;for(f in a)c=parseFloat(a[f],10),c=isNaN(c)?0:c,d.push(c);c=function(a,b,c){c+=1;for(var d=a[0],f=1;f<a.length;f++)d+=a[f]/Math.pow(c,(b[f]-b[0])/365);return d};f=function(a,b,c){c+=1;for(var d=0,f=1;f<a.length;f++)var h=(b[f]-b[0])/365,d=d-h*a[f]/Math.pow(c,h+1);return d};for(var h=[],e=!1,p=!1,m=0;m<d.length;m++)h[m]=0===m?0:h[m-1]+365,0<d[m]&&(e=!0),0>d[m]&&(p=!0);if(!e||!p)return"#NUM!";var e=
"undefined"===typeof b?.1:b,l,g,p=0,m=!0;do g=c(d,h,e),m=e-g/f(d,h,e),l=Math.abs(m-e),e=m,m=1E-10<l&&1E-10<Math.abs(g);while(m&&50>++p);return m?"#NUM!":e},ISPMT:function(a,b,c,d){return d*a*(b/c-1)},MDURATION:function(){},MIRR:function(a,b,c){var d=[],f;for(f in a)d.push(a[f]);a=d.length;f=[];for(var h=[],q=0;q<a;q++)0>d[q]?f.push(d[q]):h.push(d[q]);c=-e.financial.NPV(c,h)*Math.pow(1+c,a-1);b=e.financial.NPV(b,f)*(1+b);return Math.pow(c/b,1/(a-1))-1},NOMINAL:function(a,b){if(isNaN(a)||isNaN(b))return"#VALUE!";
if(0>=a||1>b)return"#NUM!";b=parseInt(b,10);return(Math.pow(a+1,1/b)-1)*b},NPER:function(a,b,c,d,f){f="undefined"===typeof f?0:f;return Math.log((b*(1+a*f)-("undefined"===typeof d?0:d)*a)/(c*a+b*(1+a*f)))/Math.log(1+a)},NPV:function(){for(var a,b=[],c=0;c<arguments.length;c++)if("object"==typeof arguments[c])for(var d in arguments[c])a=parseFloat(arguments[c][d],10),a=isNaN(a)?0:a,b=b.concat([a]);else a=parseFloat(arguments[c],10),a=isNaN(a)?0:a,b=b.concat([a]);a=b[0];c=0;for(d=1;d<b.length;d++)c+=
b[d]/Math.pow(1+a,d);return c},ODDFPRICE:function(){},ODDFYIELD:function(){},ODDLPRICE:function(){},ODDLYIELD:function(){},PDURATION:function(a,b,c){return isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0>=a?"#NUM!":(Math.log(c)-Math.log(b))/Math.log(1+a)},PMT:function(a,b,c,d,f){f="undefined"===typeof f?0:f;d="undefined"===typeof d?0:d;0===a?a=(c+d)/b:(b=Math.pow(1+a,b),a=1===f?(d*a/(b-1)+c*a/(1-1/b))/(1+a):d*a/(b-1)+c*a/(1-1/b));return-a},PPMT:function(a,b,c,d,f,h){return e.financial.PMT(a,c,d,f,h)-e.financial.IPMT(a,
b,c,d,f,h)},PRICE:function(){},PRICEDISC:function(){},PRICEMAT:function(){},PV:function(a,b,c,d,f){f="undefined"===typeof f?0:f;d="undefined"===typeof d?0:d;return 0===a?-c*b-d:((1-Math.pow(1+a,b))/a*c*(1+a*f)-d)/Math.pow(1+a,b)},RATE:function(a,b,c,d,f,h){d="undefined"===typeof d?0:d;f="undefined"===typeof f?0:f;var e,p,m,l=0,g=e=0,k="undefined"===typeof h?.01:h;1E-10>Math.abs(k)||(e=Math.exp(a*Math.log(1+k)));h=c+b*a+d;p=c*e+b*(1/k+f)*(e-1)+d;g=m=0;for(l=k;1E-10<Math.abs(h-p)&&50>g;)k=(p*m-h*l)/
(p-h),m=l,l=k,1E-10>Math.abs(k)?e=c*(1+a*k)+b*(1+k*f)*a+d:(e=Math.exp(a*Math.log(1+k)),e=c*e+b*(1/k+f)*(e-1)+d),h=p,p=e,++g;return k},RECEIVED:function(){},RRI:function(a,b,c){return isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0===a||0===b?"#NUM!":Math.pow(c/b,1/a)-1},SLN:function(a,b,c){return isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0===c?"#NUM!":(a-b)/c},SYD:function(a,b,c,d){if(isNaN(a)||isNaN(b)||isNaN(c)||isNaN(d))return"#VALUE!";if(0===c||1>d||d>c)return"#NUM!";d=parseInt(d,10);return(a-b)*(c-d+1)*
2/(c*(c+1))},TBILLEQ:function(a,b,c){return k(a).isValid()&&k(b).isValid()?0>=c||0<k(a).diff(k(b))||1<k(b).diff(k(a),"years")?"#NUM!":365*c/(360-c*e.date.DAYS360(a,b)):"#VALUE!"},TBILLPRICE:function(a,b,c){return k(a).isValid()&&k(b).isValid()?0>=c||0<k(a).diff(k(b))||1<k(b).diff(k(a),"years")?"#NUM!":100*(1-c*e.date.DAYS360(a,b)/360):"#VALUE!"},TBILLYIELD:function(a,b,c){return k(a).isValid()&&k(b).isValid()?0>=c||0<k(a).diff(k(b))||1<k(b).diff(k(a),"years")?"#NUM!":360*(100-c)/(c*e.date.DAYS360(a,
b)):"#VALUE!"},VDB:function(){},XIRR:function(a,b,c){var d=[],f;for(f in a)d.push(a[f]);a=function(a,b,c){c+=1;for(var d=a[0],f=1;f<a.length;f++)d+=a[f]/Math.pow(c,k(b[f]).diff(k(b[0]),"days")/365);return d};f=function(a,b,c){c+=1;for(var d=0,f=1;f<a.length;f++)var h=k(b[f]).diff(k(b[0]),"days")/365,d=d-h*a[f]/Math.pow(c,h+1);return d};for(var h=!1,e=!1,p=0;p<d.length;p++)0<d[p]&&(h=!0),0>d[p]&&(e=!0);if(!h||!e)return"#NUM!";c=c||.1;var m,h=0,e=!0;do m=a(d,b,c),e=c-m/f(d,b,c),p=Math.abs(e-c),c=e,
e=1E-10<p&&1E-10<Math.abs(m);while(e&&50>++h);return e?"#NUM!":c},XNPV:function(a,b,c){for(var d=0,f=0;f<b.length;f++)d+=b[f]/Math.pow(1+a,k(c[f]).diff(k(c[0]),"days")/365);return d},YIELD:function(){},YIELDDISC:function(){},YIELDMAT:function(){}},statistic:{AVEDEV:function(){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;var a=s.arrayMerge(arguments);return g.sum(g(a).subtract(g.mean(a)).abs()[0])/a.length},AVERAGE:function(){for(var a=s.arrayMerge(arguments),b=a.length,c=0,d=0,f=0,h=0;h<
b;h++)!0!==a[h]&&!1!==a[h]&&(f=parseFloat(a[h]),d+=isNaN(f)?0:f,c++);return d/c},AVERAGEA:function(){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.mean(s.arrayMerge(arguments))},AVERAGEIF:function(a,b,c){c="undefined"===typeof c?a:c;for(var d=0,f=0,h=0;h<a.length;h++)eval(a[h]+b)&&(f+=c[h],d++);return f/d},AVERAGEIFS:function(){for(var a=(arguments.length-1)/2,b=arguments[0],c=0,d=0,f=0;f<b.length;f++){for(var h=!0,e=0;e<a;e++)eval(arguments[2*e+1][f]+arguments[2*e+2])||(h=!1);h&&(d+=b[f],
c++)}return d/c},BETADIST:function(a,b,c,d,f,h){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;f="undefined"===typeof f?0:f;a=(a-f)/(("undefined"===typeof h?1:h)-f);return d?g.beta.cdf(a,b,c):g.beta.pdf(a,b,c)},BETAINV:function(a,b,c,d,f){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;d="undefined"===typeof d?0:d;f="undefined"===typeof f?1:f;return g.beta.inv(a,b,c)*(f-d)+d},BINOMDIST:function(a,b,c,d){return"undefined"==typeof g?n.ERRKEY.jStatRequired:d?g.binomial.cdf(a,b,c):g.binomial.pdf(a,
b,c)},BINOMDISTRANGE:function(a,b,c,d){d="undefined"===typeof d?c:d;for(var f=0;c<=d;c++)f+=e.math.COMBIN(a,c)*Math.pow(b,c)*Math.pow(1-b,a-c);return f},BINOMINV:function(a,b,c){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var d=0;d<=a;){if(g.binomial.cdf(d,a,b)>=c)return d;d++}},CHISQDIST:function(a,b,c){return"undefined"==typeof g?n.ERRKEY.jStatRequired:c?g.chisquare.cdf(a,b):g.chisquare.pdf(a,b)},CHISQDISTRT:function(a,b){},CHISQINV:function(a,b){return"undefined"==typeof g?n.ERRKEY.jStatRequired:
g.chisquare.inv(a,b)},CHISQINVRT:function(){},CHISQTEST:function(){},CONFIDENCENORM:function(a,b,c){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.normalci(1,a,b,c)[1]-1},CONFIDENCET:function(a,b,c){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.tci(1,a,b,c)[1]-1},CORREL:function(){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.corrcoeff.apply(this,arguments)},COUNT:function(){return s.arrayMerge(arguments).length},COUNTA:function(){var a=s.arrayMerge(arguments);return a.length-
e.statistic.COUNTBLANK(a)},COUNTBLANK:function(){for(var a=s.arrayMerge(arguments),b=0,c=0;c<a.length;c++)null!==a[c]&&""!==a[c]||b++;return b},COUNTIF:function(a,b){var c=0,d;for(d in a)a[d].match(new RegExp(b))&&c++;return c},COUNTIFS:function(){var a=(arguments.length-1)/2,b=arguments[0],c=0,d;for(d in b){for(var b=!0,f=0;f<a;f++)eval(arguments[2*f+1][d]+arguments[2*f+2])||(b=!1);c+=b?1:0}return c},COUNTUNIQUE:function(){return s.unique(s.arrayMerge(arguments)).length},COVARIANCEP:function(a,b){if("undefined"==
typeof g)return n.ERRKEY.jStatRequired;for(var c=g.mean(a),d=g.mean(b),f=0,h=a.length,e=0;e<h;e++)f+=(a[e]-c)*(b[e]-d);return f/h},COVARIANCES:function(){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.covariance.apply(this,arguments)},DEVSQ:function(){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var a=s.arrayMerge(arguments),b=g.mean(a),c=0,d=0;d<a.length;d++)c+=Math.pow(a[d]-b,2);return c},EXPONDIST:function(a,b,c){return"undefined"==typeof g?n.ERRKEY.jStatRequired:c?g.exponential.cdf(a,
b):g.exponential.pdf(a,b)},FDIST:function(a,b,c,d){return"undefined"==typeof g?n.ERRKEY.jStatRequired:d?g.centralF.cdf(a,b,c):g.centralF.pdf(a,b,c)},FDISTRT:function(){},FINV:function(a,b,c){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.centralF.inv(a,b,c)},FINVRT:function(){},FTEST:function(){},FISHER:function(a){return Math.log((1+a)/(1-a))/2},FISHERINV:function(a){a=Math.exp(2*a);return(a-1)/(a+1)},FORECAST:function(a,b,c){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var d=
g.mean(c),f=g.mean(b),h=c.length,e=0,p=0,m=0;m<h;m++)e+=(c[m]-d)*(b[m]-f),p+=Math.pow(c[m]-d,2);b=e/p;return f-b*d+b*a},FREQUENCY:function(a,b){for(var c=a.length,d=b.length,f=[],h=0;h<=d;h++)for(var e=f[h]=0;e<c;e++)0===h?a[e]<=b[0]&&(f[0]+=1):h<d?a[e]>b[h-1]&&a[e]<=b[h]&&(f[h]+=1):h===d&&a[e]>b[d-1]&&(f[d]+=1);return f},GAMMA:function(){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.gammafn.apply(this,arguments)},GAMMADIST:function(a,b,c,d){},GAMMAINV:function(a,b,c){},GAMMALN:function(){return"undefined"==
typeof g?n.ERRKEY.jStatRequired:g.gammaln.apply(this,arguments)},GAMMALNPRECISE:function(){},GAUSS:function(a){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.normal.cdf(a,0,1)-.5},GEOMEAN:function(){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.geomean(s.arrayMerge(arguments))},GROWTH:function(a,b,c,d){var f;if("undefined"===typeof b)for(b=[],f=1;f<=a.length;f++)b.push(f);if("undefined"===typeof c)for(c=[],f=1;f<=a.length;f++)c.push(f);"undefined"===typeof d&&(d=!0);var h=a.length,e=
0,p=0,m=0,l=0;for(f=0;f<h;f++)var g=b[f],k=Math.log(a[f]),e=e+g,p=p+k,m=m+g*k,l=l+g*g;e/=h;p/=h;m/=h;l/=h;d?(a=(m-e*p)/(l-e*e),e=p-a*e):(a=m/l,e=0);p=[];for(f=0;f<c.length;f++)p.push(Math.exp(e+a*c[f]));return p},HARMEAN:function(){for(var a=s.arrayMerge(arguments),b=a.length,c=0,d=0;d<b;d++)c+=1/a[d];return b/c},HYPGEOMDIST:function(a,b,c,d,f){function h(a,b,c,d){return e.math.COMBIN(c,a)*e.math.COMBIN(d-c,b-a)/e.math.COMBIN(d,b)}function q(a,b,c,d){for(var f=0,e=0;e<=a;e++)f+=h(e,b,c,d);return f}
return f?q(a,b,c,d):h(a,b,c,d)},INTERCEPT:function(a,b){return e.statistic.FORECAST(0,a,b)},KURT:function(){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var a=s.arrayMerge(arguments),b=g.mean(a),c=a.length,d=0,f=0;f<c;f++)d+=Math.pow(a[f]-b,4);d/=Math.pow(g.stdev(a,!0),4);return c*(c+1)/((c-1)*(c-2)*(c-3))*d-3*(c-1)*(c-1)/((c-2)*(c-3))},LARGE:function(a,b){a=s.objectToArray(a);return a.sort(function(a,b){return b-a})[b-1]},LINEST:function(a,b){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;
for(var c=g.mean(b),d=g.mean(a),f=b.length,e=0,q=0,p=0;p<f;p++)e+=(b[p]-c)*(a[p]-d),q+=Math.pow(b[p]-c,2);f=e/q;return[f,d-f*c]},LOGEST:function(){},LOGNORMDIST:function(a,b,c,d){return"undefined"==typeof g?n.ERRKEY.jStatRequired:d?g.lognormal.cdf(a,b,c):g.lognormal.pdf(a,b,c)},LOGNORMINV:function(a,b,c){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.lognormal.inv(a,b,c)},MAX:function(){for(var a=s.arrayMerge(arguments),b=a.length,c=0<b?a[0]:0,d=0;d<b;d++)c=a[d]>c&&!0!==a[d]&&!1!==a[d]?a[d]:
c;return c},MAXA:function(){var a=s.arrayMerge(arguments);return 0<a.length?Math.max.apply(Math,a):0},MEDIAN:function(){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.median(s.arrayMerge(arguments))},MIN:function(){for(var a=s.arrayMerge(arguments),b=a.length,c=0<b?a[0]:0,d=0;d<b;d++)c=a[d]<c&&!0!==a[d]&&!1!==a[d]?a[d]:c;return c},MINA:function(){var a=s.arrayMerge(arguments);return 0<a.length?Math.min.apply(Math,a):0},MODEMULT:function(){for(var a=s.arrayMerge(arguments),b=a.length,c={},d=
[],f=0,e,q=0;q<b;q++)e=a[q],c[e]=c[e]?c[e]+1:1,c[e]>f&&(f=c[e],d=[]),c[e]===f&&(d[d.length]=e);return d},MODESNGL:function(){return e.statistic.MODEMULT(s.arrayMerge(arguments)).sort(function(a,b){return a-b})[0]},NEGBINOMDIST:function(a,b,c,d){return"undefined"==typeof g?n.ERRKEY.jStatRequired:d?g.negbin.cdf(a,b,c):g.negbin.pdf(a,b,c)},NORMDIST:function(a,b,c,d){return"undefined"==typeof g?n.ERRKEY.jStatRequired:isNaN(a)||isNaN(b)||isNaN(c)?"#VALUE!":0>=c?"#NUM!":d?g.normal.cdf(a,b,c):g.normal.pdf(a,
b,c)},NORMINV:function(a,b,c){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.normal.inv(a,b,c)},NORMSDIST:function(a,b){return"undefined"==typeof g?n.ERRKEY.jStatRequired:b?g.normal.cdf(a,0,1):g.normal.pdf(a,0,1)},NORMSINV:function(a){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.normal.inv(a,0,1)},PEARSON:function(a,b){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var c=g.mean(a),d=g.mean(b),f=a.length,e=0,q=0,p=0,m=0;m<f;m++)e+=(a[m]-c)*(b[m]-d),q+=Math.pow(a[m]-c,2),p+=
Math.pow(b[m]-d,2);return e/Math.sqrt(q*p)},PERCENTILEEXC:function(a,b){a=a.sort(function(a,b){return a-b});var c=a.length;if(b<1/(c+1)||b>1-1/(c+1))return"#NUM!";var c=b*(c+1)-1,d=Math.floor(c);return s.cleanFloat(c===d?a[c]:a[d]+(c-d)*(a[d+1]-a[d]))},PERCENTILEINC:function(a,b){a=a.sort(function(a,b){return a-b});var c=b*(a.length-1),d=Math.floor(c);return s.cleanFloat(c===d?a[c]:a[d]+(c-d)*(a[d+1]-a[d]))},PERCENTRANKEXC:function(a,b,c){a=a.sort(function(a,b){return a-b});var d=s.unique(a),f=a.length,
e=d.length;c=Math.pow(10,"undefined"===typeof c?3:c);for(var q=0,p=!1,g=0;!p&&g<e;)b===d[g]?(q=(a.indexOf(d[g])+1)/(f+1),p=!0):b>=d[g]&&(b<d[g+1]||g===e-1)&&(q=(a.indexOf(d[g])+1+(b-d[g])/(d[g+1]-d[g]))/(f+1),p=!0),g++;return Math.floor(q*c)/c},PERCENTRANKINC:function(a,b,c){a=a.sort(function(a,b){return a-b});var d=s.unique(a),f=a.length,e=d.length;c=Math.pow(10,"undefined"===typeof c?3:c);for(var q=0,g=!1,m=0;!g&&m<e;)b===d[m]?(q=a.indexOf(d[m])/(f-1),g=!0):b>=d[m]&&(b<d[m+1]||m===e-1)&&(q=(a.indexOf(d[m])+
(b-d[m])/(d[m+1]-d[m]))/(f-1),g=!0),m++;return Math.floor(q*c)/c},PERMUT:function(a,b){return e.math.FACT(a)/e.math.FACT(a-b)},PERMUTATIONA:function(a,b){return Math.pow(a,b)},PHI:function(a){return Math.exp(-.5*a*a)/n.SQRT2PI},POISSONDIST:function(a,b,c){return"undefined"==typeof g?n.ERRKEY.jStatRequired:c?g.poisson.cdf(a,b):g.poisson.pdf(a,b)},PROB:function(a,b,c,d){if("undefined"===typeof c)return 0;d="undefined"===typeof d?c:d;if(c===d)return 0<=a.indexOf(c)?b[a.indexOf(c)]:0;for(var f=a.sort(function(a,
b){return a-b}),e=f.length,q=0,g=0;g<e;g++)f[g]>=c&&f[g]<=d&&(q+=b[a.indexOf(f[g])]);return q},QUARTILEEXC:function(a,b){switch(b){case 1:return e.statistic.PERCENTILEEXC(a,.25);case 2:return e.statistic.PERCENTILEEXC(a,.5);case 3:return e.statistic.PERCENTILEEXC(a,.75);default:return"#NUM!"}},QUARTILEINC:function(a,b){switch(b){case 1:return e.statistic.PERCENTILEINC(a,.25);case 2:return e.statistic.PERCENTILEINC(a,.5);case 3:return e.statistic.PERCENTILEINC(a,.75);default:return"#NUM!"}},RANKAVG:function(a,
b,c){b=b.sort(("undefined"===typeof c?0:c)?function(a,b){return a-b}:function(a,b){return b-a});c=s.countIn(b,a);return 1<c?(2*b.indexOf(a)+c+1)/2:b.indexOf(a)+1},RANKEQ:function(a,b,c){b=b.sort(("undefined"===typeof c?0:c)?function(a,b){return a-b}:function(a,b){return b-a});return b.indexOf(a)+1},RSQ:function(a,b){return Math.pow(e.statistic.PEARSON(a,b),2)},SKEW:function(){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var a=s.arrayMerge(arguments),b=g.mean(a),c=a.length,d=0,f=0;f<
c;f++)d+=Math.pow(a[f]-b,3);return c*d/((c-1)*(c-2)*Math.pow(g.stdev(a,!0),3))},SKEWP:function(){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var a=s.arrayMerge(arguments),b=g.mean(a),c=a.length,d=0,f=0,e=0;e<c;e++)f+=Math.pow(a[e]-b,3),d+=Math.pow(a[e]-b,2);return f/c/Math.pow(d/c,1.5)},SLOPE:function(a,b){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var c=g.mean(b),d=g.mean(a),f=b.length,e=0,q=0,p=0;p<f;p++)e+=(b[p]-c)*(a[p]-d),q+=Math.pow(b[p]-c,2);return e/q},SMALL:function(a,
b){return a.sort(function(a,b){return a-b})[b-1]},STANDARDIZE:function(a,b,c){return(a-b)/c},STDEVA:function(){for(var a=s.arrayMerge(arguments),b=a.length,c=0,d=g.mean(a),f=0;f<b;f++)c+=Math.pow(a[f]-d,2);return Math.sqrt(c/(b-1))},STDEVP:function(){for(var a=s.arrayMerge(arguments),b=a.length,c=0,d=0,f=e.statistic.AVERAGE(a),h=0;h<b;h++)!0!==a[h]&&!1!==a[h]&&(c+=Math.pow(a[h]-f,2),d++);return Math.sqrt(c/d)},STDEVPA:function(){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var a=s.arrayMerge(arguments),
b=a.length,c=0,d=g.mean(a),f=0;f<b;f++)c+=Math.pow(a[f]-d,2);return Math.sqrt(c/b)},STDEVS:function(){for(var a=s.arrayMerge(arguments),b=a.length,c=0,d=0,f=e.statistic.AVERAGE(a),h=0;h<b;h++)!0!==a[h]&&!1!==a[h]&&(c+=Math.pow(a[h]-f,2),d++);return Math.sqrt(c/(d-1))},STEYX:function(a,b){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var c=g.mean(b),d=g.mean(a),f=b.length,e=0,q=0,p=0,m=0;m<f;m++)e+=Math.pow(a[m]-d,2),q+=(b[m]-c)*(a[m]-d),p+=Math.pow(b[m]-c,2);return Math.sqrt((e-q*q/p)/
(f-2))},TDIST:function(a,b,c){return"undefined"==typeof g?n.ERRKEY.jStatRequired:c?g.studentt.cdf(a,b):g.studentt.pdf(a,b)},TDIST2T:function(){},TDISTRT:function(){},TINV:function(a,b){return"undefined"==typeof g?n.ERRKEY.jStatRequired:g.studentt.inv(a,b)},TINV2T:function(){},TTEST:function(){},TREND:function(){},TRIMMEAN:function(a,b){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;var c=e.math.FLOOR(a.length*b,2)/2;return g.mean(s.initial(s.rest(a.sort(function(a,b){return a-b}),c),c))},
VARA:function(){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var a=s.arrayMerge(arguments),b=a.length,c=0,d=g.mean(a),f=0;f<b;f++)c+=Math.pow(a[f]-d,2);return c/(b-1)},VARP:function(){for(var a=s.arrayMerge(arguments),b=a.length,c=0,d=0,f=e.statistic.AVERAGE(a),h=0;h<b;h++)!0!==a[h]&&!1!==a[h]&&(c+=Math.pow(a[h]-f,2),d++);return c/d},VARPA:function(){if("undefined"==typeof g)return n.ERRKEY.jStatRequired;for(var a=s.arrayMerge(arguments),b=a.length,c=0,d=g.mean(a),f=0;f<b;f++)c+=Math.pow(a[f]-
d,2);return c/b},VARS:function(){for(var a=s.arrayMerge(arguments),b=a.length,c=0,d=0,f=e.statistic.AVERAGE(a),h=0;h<b;h++)!0!==a[h]&&!1!==a[h]&&(c+=Math.pow(a[h]-f,2),d++);return c/(d-1)},WEIBULLDIST:function(a,b,c,d){return d?1-Math.exp(-Math.pow(a/c,b)):Math.pow(a,b-1)*Math.exp(-Math.pow(a/c,b))*b/Math.pow(c,b)},ZTEST:function(a,b,c){var d=a.length;c="undefined"===typeof c?e.statistic.STDEVS(a):c;return 1-e.statistic.NORMSDIST((e.statistic.AVERAGE(a)-b)/(c/Math.sqrt(d)),e.logical.TRUE)}},logical:{AND:function(){for(var a=
!0,b=0;b<arguments.length;b++)arguments[b]||(a=!1);return a},CHOOSE:function(){var a=arguments[0];return"undefined"==typeof arguments[a]?"#NUM!":arguments[a]},FALSE:function(){return!1},IF:function(a,b,c){return a?"undefined"===typeof b?!0:b:"undefined"===typeof c?!0:c},IFERROR:function(a,b){return 0<=n.ERROR.indexOf(a)?b:a},IFNA:function(a,b){return"#N/A"===a?b:a},NOT:function(a){return!a},OR:function(){for(var a=!1,b=0;b<arguments.length;b++)arguments[b]&&(a=!0);return a},SWITCH:function(){var a;
if(0<arguments.length){var b=arguments[0],c=arguments.length-1,d=Math.floor(c/2),f=!1,c=0===c%2?null:arguments[arguments.length-1];if(d)for(var e=0;e<d;e++)if(b==arguments[2*e+1]){a=arguments[2*e+2];f=!0;break}!f&&c&&(a=c)}return a},TRUE:function(){return!0},XOR:function(){for(var a=0,b=0;b<arguments.length;b++)arguments[b]&&a++;return Math.floor(Math.abs(a))&1?!0:!1},NULL:function(){return null}},geometry:{},text:{CONCAT:function(){var a="",b;for(b in arguments)a="object"==typeof arguments[b]?a+
e.text.CONCAT.apply(this,arguments[b]):a+arguments[b];return a},CHAR:function(a){return String.fromCharCode(a)},CLEAN:function(a){return a.replace(/[\0-\x1F]/g,"")},CODE:function(a){return a.charCodeAt(0)},CONCATENATE:function(){for(var a="",b=0;b<arguments.length;b++)null!==arguments[b]&&void 0!==arguments[b]&&(a+=arguments[b]);return a},DOLLAR:function(a,b){if("undefined"==typeof x)return"#NAME?";b="undefined"===typeof b?2:b;var c="";0>=b?(a=Math.round(a*Math.pow(10,b))/Math.pow(10,b),c="($0,0)"):
0<b&&(c="($0,0."+Array(b+1).join("0")+")");return x(a).format(c)},EXACT:function(a,b){return a===b},FIND:function(a,b,c){return b?b.indexOf(a,("undefined"===typeof c?0:c)-1)+1:null},FIXED:function(a,b,c){if("undefined"==typeof x)return"#NAME?";b="undefined"===typeof b?2:b;c=("undefined"===typeof c?0:c)?"0":"0,0";0>=b?a=Math.round(a*Math.pow(10,b))/Math.pow(10,b):0<b&&(c+="."+Array(b+1).join("0"));return x(a).format(c)},HTML2TEXT:function(a){var b="";a&&(a instanceof Array?a.forEach(function(a){""!==
b&&(b+="\n");b+=a.replace(/<(?:.|\n)*?>/gm,"")}):b=a.replace(/<(?:.|\n)*?>/gm,""));return b},HUMANIZE:function(a){return a instanceof Date?(a=k(a),a.hours()||a.minutes()||a.seconds()?a.format("dddd, MMMM Do YYYY, h:mm:ss"):a.format("dddd, MMMM Do YYYY")):a},JOIN:function(a,b){return a.join(b)},LEFT:function(a,b){return a?a.substring(0,"undefined"===typeof b?1:b):null},LEN:function(a){return(a+"").length},LOWER:function(a){return a?a.toLowerCase():a},MID:function(a,b,c){return a.substring(b-1,c)},
NUMBERVALUE:function(a,b,c){c="undefined"===typeof c?",":c;return Number(a.replace("undefined"===typeof b?".":b,".").replace(c,""))},PROPER:function(a){return a.replace(/\w\S*/g,function(a){return a.charAt(0).toUpperCase()+a.substr(1).toLowerCase()})},REGEXEXTRACT:function(a,b){var c=a.match(new RegExp(b));return c?c[0]:null},REGEXMATCH:function(a,b,c){var d=a.match(new RegExp(b));return c?d:a.match(new RegExp(b))?!0:!1},REGEXREPLACE:function(a,b,c){return a.replace(new RegExp(b),c)},REPLACE:function(a,
b,c,d){return a.substr(0,b-1)+d+a.substr(b-1+c)},REPT:function(a,b){return Array(b+1).join(a)},RIGHT:function(a,b){return a?a.substring(a.length-("undefined"===typeof b?1:b)):null},ROMAN:function(a){a=String(a).split("");for(var b=" C CC CCC CD D DC DCC DCCC CM  X XX XXX XL L LX LXX LXXX XC  I II III IV V VI VII VIII IX".split(" "),c="",d=3;d--;)c=(b[+a.pop()+10*d]||"")+c;return Array(+a.join("")+1).join("M")+c},SEARCH:function(a,b,c){c="undefined"===typeof c?0:c;return b.toLowerCase().indexOf(a.toLowerCase(),
c-1)+1},SPLIT:function(a,b){a=r.trim(a);return a.split(a,b||/\s+/)},SUBSTITUTE:function(a,b,c,d){if(a&&b&&c){if("undefined"===typeof d)return a.replace(new RegExp(b,"g"),c);for(var f=0,e=0;0<a.indexOf(b,f);)if(f=a.indexOf(b,f+1),e++,e===d)return a.substring(0,f)+c+a.substring(f+b.length)}else return a},T:function(a){return"string"===typeof a?a:null},TEXT:function(a,b){if("undefined"==typeof x)return"#NAME?";var c="";if(a)if(a instanceof Object)try{c=JSON.stringify(a)}catch(d){}else"string"===typeof a?
c=b?0<=b.indexOf("0")?x(a).format(b):k(new Date(a)).format(b):a:a.toString&&"function"===typeof a.toString&&(c=a.toString());return c},TRIM:function(a){return r.trim(a)},UNICHAR:function(a){return e.text.CHAR(a)},UNICODE:function(a){return e.text.CODE(a)},UPPER:function(a){return a.toUpperCase()},VALUE:function(a){return"undefined"==typeof x?"#NAME?":x().unformat(a)}},trigonometry:{},general:{VLOOKUP:function(a,b,c,d){var f,e;typeof("object"==b)&&"Object"==b.constructor.name&&(b=s.rangeToTable(b));
e=b.length;f=b[0].length;c-=1;if(c>f-1)return"#REF!";if(0>c)return"#VALUE!";if(0==("undefined"==typeof d?!1:d)){for(f=0;f<e;f++)if(a==b[f][0])return b[f][c];return"#N/A!"}d={};var g;for(f=0;f<e;f++){if(a==b[f][0])return b[f][c];g=b[f][0]-a;0>g&&(d[f]=g)}e=a=null;for(var p in d)null==a?(a=d[p],e=p):(a=a>d[p]?a:d[p],e=a>d[p]?e:p);return null==e?"#N/A!":b[e][c]},HLOOKUP:function(a,b,c,d){typeof("object"==b)&&(b=s.rangeToTable(b));b=s.transposeTable(b);return e.general.VLOOKUP(a,b,c,d)},LOOKUP:function(a,
b,c){var d,f,e=[];c="undefined"==typeof c?!1:c;typeof("object"==b)&&"Object"==b.constructor.name&&(b=s.objectToArray(b),f=b.length);typeof("object"==c)&&"Object"==c.constructor.name&&(c=s.objectToArray(c));if(a<Math.min.apply(Math,b))return"#N/A!";for(d=0;d<f;d++){if(a==b[d])return c?c[d]:b[d];e[d]=a-b[d]}a=e.length;f=Math.max.apply(Math,e);for(d=0;d<a;d++)0>e[d]&&(e[d]=f);a=Math.min.apply(Math,e);d=e.indexOf(a);return c?c[d]:b[d]},SERVER:function(){if(null==this.config.ajaxUrl)return n.ERRKEY.ajaxUrlRequired;
for(var a,b=arguments[0],c={},d=1;d<arguments.length;d++)c["params["+d+"]"]=arguments[d];c["function"]=b;r.ajax({url:this.config.ajaxUrl,method:this.config.ajaxMethod,data:c,async:!1,success:function(b){a=b},error:function(b){a=n.ERRKEY.sendRequestError}});return a},GRAPH:function(a,b){var c={},d=this.getActiveCell().el,f={};b="undefined"==typeof b?[]:b;for(var e,g,p=0;p<b.length;p++)e=b[p].split("="),c[e[0]]=e[1];d.height()||d.css("height","300px");d.width||d.css("width","300px");switch(c.type){case "bar":g=
s.rangeToTable(a);typeof("undefined"!=c.reverse)&&"true"==c.reverse&&g.reverse();f.series={bars:{show:!0,barWidth:.6,align:"center"},stack:!0};"undefined"!=typeof c.bar_orientation&&"horizontal"==c.bar_orientation&&(f.series.bars.horizontal=!0);break;case "pie":g=s.objectToArray(a);f.series={pie:{show:!0,radius:.8}};f.legend={show:!1};break;case "doughnut":case "donut":g=s.objectToArray(a);f.series={pie:{show:!0,innerRadius:.5,radius:.8}};f.legend={show:!1};break;default:g=s.rangeToTable(a),typeof("undefined"!=
c.reverse)&&"true"==c.reverse&&g.reverse()}"undefined"!=typeof c.orientation&&"vertical"==c.orientation&&(g=s.transposeTable(g));if("undefined"!=typeof c.label){e=this.evaluate(c.label);e=s.objectToArray(e);var p=g.length,m,l,k;for(l=0;l<p;l++)for(m=g[l].length,k=0;k<m;k++)a=g[l][k],g[l][k]=[e[k],a];f.xaxis={mode:"categories",tickLength:0}}else for(p=g.length,l=0;l<p;l++)for(m=g[l].length,k=0;k<m;k++)a=g[l][k],g[l][k]="undefined"!=typeof c.bar_orientation&&"horizontal"==c.bar_orientation?[a,k]:[k,
a];if("undefined"!=typeof c.legend){e=this.evaluate(c.legend);e=s.objectToArray(e);p=[];for(m=0;m<g.length;m++)p.push({label:e[m],data:g[m]});g=p}"undefined"!=typeof c.show_x_axis&&"false"==c.show_x_axis&&(f.xaxis=f.xaxis||{},f.xaxis.show=!1);"undefined"!=typeof c.show_y_axis&&"false"==c.show_y_axis&&(f.yaxis=f.yaxis||{},f.yaxis.show=!1);f.grid={backgroundColor:{colors:["#fff","#eee"]},borderWidth:{top:0,right:0,bottom:0,left:0}};setTimeout(function(){r.plot(d,g,f)},100);return!1}},engineering:{BIN2DEC:function(a){if(!s.isValidBinary(a))return"#NUM!";
var b=parseInt(a,2);a=a.toString();return 10===a.length&&"1"===a.substring(0,1)?parseInt(a.substring(1),2)-512:b},BIN2HEX:function(a,b){if(!s.isValidBinary(a))return"#NUM!";var c=a.toString();if(10===c.length&&"1"===c.substring(0,1))return(0xfffffffe00+parseInt(c.substring(1),2)).toString(16);c=parseInt(a,2).toString(16);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?s.repeat("0",b-c.length)+c:"#NUM!"},BIN2OCT:function(a,b){if(!s.isValidBinary(a))return"#NUM!";
var c=a.toString();if(10===c.length&&"1"===c.substring(0,1))return(1073741312+parseInt(c.substring(1),2)).toString(8);c=parseInt(a,2).toString(8);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?s.repeat("0",b-c.length)+c:"#NUM!"},BITAND:function(a,b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||isNaN(b)?"#VALUE!":0>a||0>b||Math.floor(a)!==a||Math.floor(b)!==b||0xffffffffffff<a||0xffffffffffff<b?"#NUM!":a&b},BITLSHIFT:function(a,
b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||isNaN(b)?"#VALUE!":0>a||Math.floor(a)!==a||0xffffffffffff<a||53<Math.abs(b)?"#NUM!":0<=b?a<<b:a>>-b},BITOR:function(a,b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||isNaN(b)?"#VALUE!":0>a||0>b||Math.floor(a)!==a||Math.floor(b)!==b||0xffffffffffff<a||0xffffffffffff<b?"#NUM!":a|b},BITRSHIFT:function(a,b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||isNaN(b)?"#VALUE!":0>a||Math.floor(a)!==a||0xffffffffffff<a||53<Math.abs(b)?
"#NUM!":0<=b?a>>b:a<<-b},BITXOR:function(a,b){a=parseFloat(a,10);b=parseFloat(b,10);return isNaN(a)||isNaN(b)?"#VALUE!":0>a||0>b||Math.floor(a)!==a||Math.floor(b)!==b||0xffffffffffff<a||0xffffffffffff<b?"#NUM!":a^b},COMPLEX:function(a,b,c){if(isNaN(a)||isNaN(b))return"#VALUE!";c="undefined"===typeof c?"i":c;return"i"!==c&&"j"!==c?"#VALUE!":0===a&&0===b?0:0===a?1===b?c:b.toString()+c:0===b?a.toString():a.toString()+(0<b?"+":"")+(1===b?c:b.toString()+c)},CONVERT:function(a,b,c){if(isNaN(a))return"#VALUE!";
for(var d=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818E-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414E-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576E-18],["a.u. of length","a?",null,"length",!1,!1,5.29177210818182E-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162E-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516E-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,
1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["\u00e5ngstr\u00f6m","\u00c5",["ang"],"length",!1,!0,1E-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667E-11],["bar","bar",null,"pressure",!1,!1,1E5],["barn","b",null,"area",!1,!1,1E-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela",
"cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic \u00e5ngstr\u00f6m","ang3",["ang^3"],"volume",!1,!0,1E-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,1.6387064E-5],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715E-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4.16818182544058E9],
["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369E-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,2.365882365E-4],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828E-27],["day","d",["day"],"time",!1,!0,86400],["degree","\u00b0",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],
"force",!1,!0,1E-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1E-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,2.95735295625E-5],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",
!1,!0,1],["grain","grain",null,"mass",!1,!0,6.47989E-5],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1E4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)",
"uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",
["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1E-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,2.7777777777778E-4],["meter per second",
"m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,2.90888208665722E-4],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,
"volume",!1,!0,5E-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818E-34],["n.u. of mass","m?",null,"mass",!1,!1,9.10938261616162E-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687E-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["\u0153rsted","Oe ",null,"magnetic_field_intensity",!1,
!1,79.5774715459477],["ohm","\u03a9",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdest\u00e4rke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1E-4],["pica (1/6 inch)","pica",null,"length",!1,!0,3.5277777777778E-4],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",
!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,9.46352946E-4],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,4.84813681109536E-6],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,
!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square \u00e5ngstr\u00f6m","ang2",["ang^2"],"area",!1,!0,1E-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,6.4516E-4],["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189E31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2",
"Picapt^2"],"area",!1,!0,1.792111111111E-5],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1E-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1E-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,1.47868E-5],["teaspoon","tsp",null,"volume",!1,!0,4.92892E-6],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie",
"c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1E3],["U.K. pint","uk_pt",null,"volume",!1,!0,5.6826125E-4],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,4.73176473E-4],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,
1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],f={Yi:["yobi",80,1.2089258196146292E24,"Yi","yotta"],Zi:["zebi",70,1.1805916207174113E21,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,
"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},e={Y:["yotta",1E24,"Y"],Z:["zetta",1E21,"Z"],E:["exa",1E18,"E"],P:["peta",1E15,"P"],T:["tera",1E12,"T"],G:["giga",1E9,"G"],M:["mega",1E6,"M"],k:["kilo",1E3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1E-6,"u"],n:["nano",1E-9,"n"],p:["pico",1E-12,"p"],f:["femto",1E-15,"f"],a:["atto",1E-18,"a"],z:["zepto",1E-21,"z"],y:["yocto",1E-24,"y"]},g=null,p=null,k=b,l=c,n=1,s=1,r,t=0;t<d.length;t++){r=
null===d[t][2]?[]:d[t][2];if(d[t][1]===k||0<=r.indexOf(k))g=d[t];if(d[t][1]===l||0<=r.indexOf(l))p=d[t]}if(null===g)for(r=f[b.substring(0,2)],t=e[b.substring(0,1)],"da"===b.substring(0,2)&&(t=["dekao",10,"da"]),r?(n=r[2],k=b.substring(2)):t&&(n=t[1],k=b.substring(t[2].length)),b=0;b<d.length;b++)if(r=null===d[b][2]?[]:d[b][2],d[b][1]===k||0<=r.indexOf(k))g=d[b];if(null===p)for(f=f[c.substring(0,2)],e=e[c.substring(0,1)],"da"===c.substring(0,2)&&(e=["dekao",10,"da"]),f?(s=f[2],l=c.substring(2)):e&&
(s=e[1],l=c.substring(e[2].length)),c=0;c<d.length;c++)if(r=null===d[c][2]?[]:d[c][2],d[c][1]===l||0<=r.indexOf(l))p=d[c];return null===g||null===p||g[3]!==p[3]?"#N/A":a*g[6]*n/(p[6]*s)},DEC2BIN:function(a,b){if(isNaN(a))return"#VALUE!";if(!/^-?[0-9]{1,3}$/.test(a)||-512>a||511<a)return"#NUM!";if(0>a)return"1"+s.repeat("0",9-(512+a).toString(2).length)+(512+a).toString(2);var c=parseInt(a,10).toString(2);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);
return b>=c.length?s.repeat("0",b-c.length)+c:"#NUM!"},DEC2HEX:function(a,b){if(isNaN(a))return"#VALUE!";if(!/^-?[0-9]{1,12}$/.test(a)||-549755813888>a||549755813887<a)return"#NUM!";if(0>a)return(1099511627776+a).toString(16);var c=parseInt(a,10).toString(16);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?s.repeat("0",b-c.length)+c:"#NUM!"},DEC2OCT:function(a,b){if(isNaN(a))return"#VALUE!";if(!/^-?[0-9]{1,9}$/.test(a)||-536870912>
a||536870911<a)return"#NUM!";if(0>a)return(1073741824+a).toString(8);var c=parseInt(a,10).toString(8);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?s.repeat("0",b-c.length)+c:"#NUM!"},DELTA:function(a,b){b="undefined"===typeof b?0:b;return isNaN(a)||isNaN(b)?"#VALUE!":a===b?1:0},ERF:function(a,b){b="undefined"===typeof b?0:b;return isNaN(a)||isNaN(b)?"#VALUE!":g.erf(a)},ERFC:function(a){return isNaN(a)?"#VALUE!":g.erfc(a)},ERFCPRECISE:function(){},
ERFPRECISE:function(){},GESTEP:function(a,b){b="undefined"===typeof b?0:b;return isNaN(a)||isNaN(b)?"#VALUE!":a>=b?1:0},HEX2BIN:function(a,b){if(!/^[0-9A-Fa-f]{1,10}$/.test(a))return"#NUM!";var c=10===a.length&&"f"===a.substring(0,1).toLowerCase()?!0:!1,d=c?parseInt(a,16)-1099511627776:parseInt(a,16);if(-512>d||511<d)return"#NUM!";if(c)return"1"+s.repeat("0",9-(512+d).toString(2).length)+(512+d).toString(2);c=d.toString(2);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";
b=Math.floor(b);return b>=c.length?s.repeat("0",b-c.length)+c:"#NUM!"},HEX2DEC:function(a){if(!/^[0-9A-Fa-f]{1,10}$/.test(a))return"#NUM!";a=parseInt(a,16);return 549755813888<=a?a-1099511627776:a},HEX2OCT:function(a,b){if(!/^[0-9A-Fa-f]{1,10}$/.test(a))return"#NUM!";var c=parseInt(a,16);if(536870911<c&&0xffe0000000>c)return"#NUM!";if(0xffe0000000<=c)return(c-0xffc0000000).toString(8);c=c.toString(8);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);
return b>=c.length?s.repeat("0",b-c.length)+c:"#NUM!"},IMABS:function(a){var b=e.engineering.IMREAL(a);a=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===a?"#NUM!":Math.sqrt(Math.pow(b,2)+Math.pow(a,2))},IMAGINARY:function(a){if(0===a||"0"===a)return 0;if(0<=["i","j"].indexOf(a))return 1;a=a.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j");var b=a.indexOf("+"),c=a.indexOf("-");0===b&&(b=a.indexOf("+",1));0===c&&(c=a.indexOf("-",1));var d=a.substring(a.length-
1,a.length),d="i"===d||"j"===d;return 0<=b||0<=c?d?0<=b?isNaN(a.substring(0,b))||isNaN(a.substring(b+1,a.length-1))?"#NUM!":Number(a.substring(b+1,a.length-1)):isNaN(a.substring(0,c))||isNaN(a.substring(c+1,a.length-1))?"#NUM!":-Number(a.substring(c+1,a.length-1)):"#NUM!":d?isNaN(a.substring(0,a.length-1))?"#NUM!":a.substring(0,a.length-1):isNaN(a)?"#NUM!":0},IMARGUMENT:function(a){var b=e.engineering.IMREAL(a);a=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===a?"#NUM!":0===b&&0===a?"#DIV/0!":
0===b&&0<a?Math.PI/2:0===b&&0>a?-Math.PI/2:0===a&&0<b?0:0===a&&0>b?-Math.PI:0<b?Math.atan(a/b):0>b&&0<=a?Math.atan(a/b)+Math.PI:Math.atan(a/b)-Math.PI},IMCONJUGATE:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a),d=a.substring(a.length-1);return"#NUM!"===b||"#NUM!"===c?"#NUM!":0!==c?e.engineering.COMPLEX(b,-c,"i"===d||"j"===d?d:"i"):a},IMCOS:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===
a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.cos(b)*(Math.exp(c)+Math.exp(-c))/2,-Math.sin(b)*(Math.exp(c)-Math.exp(-c))/2,a)},IMCOSH:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.cos(c)*(Math.exp(b)+Math.exp(-b))/2,Math.sin(c)*(Math.exp(b)-Math.exp(-b))/2,a)},IMCOT:function(a){if(!0===
a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV(e.engineering.IMCOS(a),e.engineering.IMSIN(a))},IMCSC:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV("1",e.engineering.IMSIN(a))},IMCSCH:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);
return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV("1",e.engineering.IMSINH(a))},IMDIV:function(a,b){var c=e.engineering.IMREAL(a),d=e.engineering.IMAGINARY(a),f=e.engineering.IMREAL(b),h=e.engineering.IMAGINARY(b),g=a.substring(a.length-1),k=a.substring(a.length-1),m="i";"j"===g?m="j":"j"===k&&(m="j");if("#NUM!"===c||"#NUM!"===d||"#NUM!"===f||"#NUM!"===h||0===f&&0===h)return"#NUM!";g=f*f+h*h;return e.engineering.COMPLEX((c*f+d*h)/g,(d*f-c*h)/g,m)},IMEXP:function(a){var b=e.engineering.IMREAL(a),
c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";if("#NUM!"===b||"#NUM!"===c)return"#NUM!";b=Math.exp(b);return e.engineering.COMPLEX(b*Math.cos(c),b*Math.sin(c),a)},IMLN:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.log(Math.sqrt(b*b+c*c)),Math.atan(c/b),a)},IMLOG10:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);
a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.log(Math.sqrt(b*b+c*c))/Math.log(10),Math.atan(c/b)/Math.log(10),a)},IMLOG2:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.log(Math.sqrt(b*b+c*c))/Math.log(2),Math.atan(c/b)/Math.log(2),a)},IMPOWER:function(a,b){if(isNaN(b))return"#VALUE!";var c=
e.engineering.IMREAL(a),d=e.engineering.IMAGINARY(a),f=a.substring(a.length-1),f="i"===f||"j"===f?f:"i";if("#NUM!"===c||"#NUM!"===d)return"#NUM!";c=Math.pow(e.engineering.IMABS(a),b);d=e.engineering.IMARGUMENT(a);return e.engineering.COMPLEX(c*Math.cos(b*d),c*Math.sin(b*d),f)},IMPRODUCT:function(){for(var a=arguments[0],b=1;b<arguments.length;b++){var c=e.engineering.IMREAL(a),a=e.engineering.IMAGINARY(a),d=e.engineering.IMREAL(arguments[b]),f=e.engineering.IMAGINARY(arguments[b]);if("#NUM!"===c||
"#NUM!"===a||"#NUM!"===d||"#NUM!"===f)return"#NUM!";a=e.engineering.COMPLEX(c*d-a*f,c*f+a*d)}return a},IMREAL:function(a){if(0===a||"0"===a||0<="i +i 1i +1i -i -1i j +j 1j +1j -j -1j".split(" ").indexOf(a))return 0;var b=a.indexOf("+"),c=a.indexOf("-");0===b&&(b=a.indexOf("+",1));0===c&&(c=a.indexOf("-",1));var d=a.substring(a.length-1,a.length),d="i"===d||"j"===d;return 0<=b||0<=c?d?0<=b?isNaN(a.substring(0,b))||isNaN(a.substring(b+1,a.length-1))?"#NUM!":Number(a.substring(0,b)):isNaN(a.substring(0,
c))||isNaN(a.substring(c+1,a.length-1))?"#NUM!":Number(a.substring(0,c)):"#NUM!":d?isNaN(a.substring(0,a.length-1))?"#NUM!":0:isNaN(a)?"#NUM!":a},IMSEC:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV("1",e.engineering.IMCOS(a))},IMSECH:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV("1",
e.engineering.IMCOSH(a))},IMSIN:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.sin(b)*(Math.exp(c)+Math.exp(-c))/2,Math.cos(b)*(Math.exp(c)-Math.exp(-c))/2,a)},IMSINH:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);a=a.substring(a.length-1);a="i"===a||"j"===a?a:"i";return"#NUM!"===
b||"#NUM!"===c?"#NUM!":e.engineering.COMPLEX(Math.cos(c)*(Math.exp(b)-Math.exp(-b))/2,Math.sin(c)*(Math.exp(b)+Math.exp(-b))/2,a)},IMSQRT:function(a){var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a),d=a.substring(a.length-1),d="i"===d||"j"===d?d:"i";if("#NUM!"===b||"#NUM!"===c)return"#NUM!";b=Math.sqrt(e.engineering.IMABS(a));a=e.engineering.IMARGUMENT(a);return e.engineering.COMPLEX(b*Math.cos(a/2),b*Math.sin(a/2),d)},IMSUB:function(a,b){var c=e.engineering.IMREAL(a),d=e.engineering.IMAGINARY(a),
f=e.engineering.IMREAL(b),h=e.engineering.IMAGINARY(b),g=a.substring(a.length-1),k=a.substring(a.length-1),m="i";"j"===g?m="j":"j"===k&&(m="j");return"#NUM!"===c||"#NUM!"===d||"#NUM!"===f||"#NUM!"===h?"#NUM!":e.engineering.COMPLEX(c-f,d-h,m)},IMSUM:function(){for(var a=arguments[0],b=1;b<arguments.length;b++){var c=e.engineering.IMREAL(a),a=e.engineering.IMAGINARY(a),d=e.engineering.IMREAL(arguments[b]),f=e.engineering.IMAGINARY(arguments[b]);if("#NUM!"===c||"#NUM!"===a||"#NUM!"===d||"#NUM!"===f)return"#NUM!";
a=e.engineering.COMPLEX(c+d,a+f)}return a},IMTAN:function(a){if(!0===a||!1===a)return"#VALUE!";var b=e.engineering.IMREAL(a),c=e.engineering.IMAGINARY(a);return"#NUM!"===b||"#NUM!"===c?"#NUM!":e.engineering.IMDIV(e.engineering.IMSIN(a),e.engineering.IMCOS(a))},OCT2BIN:function(a,b){if(!/^[0-7]{1,10}$/.test(a))return"#NUM!";var c=10===a.length&&"7"===a.substring(0,1)?!0:!1,d=c?parseInt(a,8)-1073741824:parseInt(a,8);if(-512>d||511<d)return"#NUM!";if(c)return"1"+s.repeat("0",9-(512+d).toString(2).length)+
(512+d).toString(2);c=d.toString(2);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?s.repeat("0",b-c.length)+c:"#NUM!"},OCT2DEC:function(a){if(!/^[0-7]{1,10}$/.test(a))return"#NUM!";a=parseInt(a,8);return 536870912<=a?a-1073741824:a},OCT2HEX:function(a,b){if(!/^[0-7]{1,10}$/.test(a))return"#NUM!";var c=parseInt(a,8);if(536870912<=c)return"ff"+(c+3221225472).toString(16);c=c.toString(16);if("undefined"===typeof b)return c;if(isNaN(b))return"#VALUE!";
if(0>b)return"#NUM!";b=Math.floor(b);return b>=c.length?s.repeat("0",b-c.length)+c:"#NUM!"}},user_defined:{}},s={toChr:function(a){var b="";for(a-=1;0<=a;)b=String.fromCharCode(a%26+97)+b,a=Math.floor(a/26)-1;return b.toUpperCase()},toNum:function(a){a=a.split("");var b="ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),c,d,f=0;c=0;for(d=a.length-1;c<a.length;c+=1,d-=1)f+=Math.pow(b.length,d)*(b.indexOf(a[c])+1);return f},cellRange:function(a,b){var c=/[A-Z]+/,d=/[0-9]+/,f=a.toUpperCase(),e=b.toUpperCase(),g=
this.toNum(f.match(c)[0]),c=this.toNum(e.match(c)[0]),f=parseInt(f.match(d)[0],10),d=parseInt(e.match(d)[0],10),e=[],k,m;if(g<c)for(m=g;m<=c;m++)if(f<d)for(k=f;k<=d;k++)g=this.toChr(m)+k,e.push(g);else for(k=f;k>=d;k--)g=this.toChr(m)+k,e.push(g);else for(m=g;m>=c;m--)if(f<d)for(k=f;k<=d;k++)g=this.toChr(m)+k,e.push(g);else for(k=f;k>=d;k--)g=this.toChr(m)+k,e.push(g);return e},isValidBinary:function(a){return/^[01]{1,10}$/.test(a)},strRepeat:function(a,b){if(1>b)return"";for(var c="";0<b;)b&1&&(c+=
a),b>>=1,a+=a;return c},repeat:function(a,b,c){if(null==a)return"";b=~~b;if(null==c)return this.strRepeat(String(a),b);for(var d=[];0<b;d[--b]=a);return d.join(c)},unique:function(a){return a.reduce(function(a,c){0>a.indexOf(c)&&a.push(c);return a},[])},initial:function(a,b,c){return Array.prototype.slice.call(a,0,Math.max(0,a.length-(null==b||c?1:b)))},rest:function(a,b,c){return Array.prototype.slice.call(a,null==b||c?1:b)},arrayMerge:function(a){var b,c,d=[];for(c=0;c<a.length;c++)if("object"==
typeof a[c])for(b in a[c])""!==r.trim(a[c][b])&&(d=d.concat(a[c][b]));else""!==r.trim(d.concat(a[c]))&&(d=d.concat(a[c]));return d},toArray:function(a){return Array.prototype.slice.call(a,0)},objectToArray:function(a){var b=[],c;for(c in a)b.push(a[c]);return b},trimEmptyCell:function(a){var b={},c;for(c in a)""!==r.trim(a[c])&&(b[c]=a[c]);return b},cleanFloat:function(a){var b=Math.pow(10,14);return Math.round(a*b)/b},countIn:function(a,b){for(var c=0,d=0;d<a.length;d++)a[d]===b&&c++;return c},rangeToTable:function(a){var b,
c,d=0,f=/[A-Z]+/,e=/[0-9]+/,g=[],k=[];for(b in a)c=this.toNum(b.match(f)[0])-1,d=parseInt(b.match(e)[0],10)-1,"undefined"==typeof g[d]&&(g[d]=[]),g[d][c]=a[b];a=0;b=g.length;for(d=0;d<b;d++)if("undefined"!=typeof g[d]){f=g[d].length;"undefined"==typeof k[a]&&(k[a]=[]);for(c=0;c<f;c++)"undefined"!=typeof g[d][c]&&k[a].push(g[d][c]);a++}return k},transposeTable:function(a){var b,c,d,f,e;d=a.length;e=[];for(b=0;b<d;b++)for(f=a[b].length,c=0;c<f;c++)"undefined"==typeof e[c]&&(e[c]=[]),e[c].push(a[b][c]);
return e}},n={MEMOIZED_FACT:[],SQRT2PI:2.5066282746310002,WEEK_STARTS:[void 0,0,1,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,1,2,3,4,5,6,0],WEEK_TYPES:[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]],WEEKEND_TYPES:[[],[6,0],[0,1],[1,2],[2,3],[3,4],[4,5],[5,6],void 0,void 0,void 0,[0],[1],[2],[3],[4],[5],[6]],DAY_NAME:"Sunday Monday Thuesday Wednesday Thursday Friday Saturday".split(" "),
ERROR:"#DIV/0! #N/A #NAME? #NUM! #NULL! #REF! #VALUE! #ERROR! #ERROR_MOMENT_JS_REQUIRED! #ERROR_JSTAT_JS_REQUIRED! #ERROR_AJAX_URL_REQUIRED! #ERROR_SEND_REQUEST! #UNDEFINED_VARIABLE!".split(" "),ERRKEY:{jStatRequired:"#ERROR_JSTAT_JS_REQUIRED!",momentRequired:"#ERROR_MOMENT_JS_REQUIRED!",ajaxUrlRequired:"#ERROR_AJAX_URL_REQUIRED!",sendRequestError:"#ERROR_SEND_REQUEST!"},VARIABLE:{},SELF_RENDER_FORMULA:["GRAPH"]};v.fx=v.prototype;v.fx.init=function(){var a=this.el?this.el.attr("data-cell"):this.address,
b=this.el?this.el.attr("data-formula"):"",c=this.el?this.el.attr("data-format"):!1,d=this.el?this.el.val():null,f=this.el?this.el.prop("tagName").toLowerCase():"";a&&""!=r.trim(a)?a=a.toUpperCase():(a="CALX"+this.sheet.counter,this.el&&this.el.attr("data-cell",a),this.sheet.counter++);b=b&&""!=r.trim(b)?b.replace("&quot;",'"').replace("&#39;","'").replace("&#34;",'"'):!1;"input"!=f||"checkbox"!=this.el.attr("type")&&"radio"!=this.el.attr("type")||(d=this.el.attr("data-unchecked"),d="undefined"==typeof d?
"":d,d=this.el.prop("checked")?this.el.val():d,this.isCheckbox=!0);this.el&&-1==this.formTags.indexOf(f)&&(d=this.el.text());if(!1===c||"undefined"===typeof c)c=this.sheet.config.defaultFormat;this.formula=b;this.format=c;this.address=a;c&&"undefined"!=typeof x&&""!==r.trim(d)?(a=x().unformat(d),-1<c.indexOf("%")&&-1==d.indexOf("%")&&(a/=100)):a=r.isNumeric(d)?parseFloat(d):d;this.setValue(a);""!=r.trim(d)&&r.isNumeric(d)&&this.renderComputedValue()};v.fx.calculate=function(a,b){a="undefined"==typeof a?
!0:a;b="undefined"==typeof b?!0:b;this.sheet.clearAffectedCell();this.sheet.config.autoCalculate&&a&&"function"==typeof this.sheet.config.onBeforeCalculate&&this.sheet.config.onBeforeCalculate.call(this.sheet);t.isCalculating=!0;this.evaluateFormula();for(var c in this.dependant)this.dependant[c].processDependant();for(c in this.sheet.dependant)this.sheet.dependant[c].calculate(!1,!1);t.isCalculating=!1;if(this.sheet.hasRelatedSheet())for(c in this.sheet.cells)this.sheet.cells[c].hasRemoteDependency()&&
(this.sheet.cells[c].evaluateFormula(),this.sheet.cells[c].processDependant(),this.sheet.cells[c].renderComputedValue());this.sheet.config.autoCalculate&&a&&"function"==typeof this.sheet.config.onAfterCalculate&&this.sheet.config.onAfterCalculate.call(this.sheet);this.sheet.config.autoCalculate&&a&&"function"==typeof this.sheet.config.onBeforeRender&&this.sheet.config.onBeforeRender.call(this.sheet);b&&this.renderComputedValue();this.sheet.config.autoCalculate&&a&&"function"==typeof this.sheet.config.onAfterRender&&
this.sheet.config.onAfterRender.call(this.sheet);return this};v.fx.buildDependency=function(){var a={remoteCellRange:/\#[A-Za-z0-9_]+\s*!\s*[A-Za-z]+[0-9]+\s*:\s*[A-Za-z]+[0-9]+/g,remoteCell:/\#[A-Za-z0-9_]+\s*!\s*[A-Za-z]+[0-9]+/g,cellRange:/[A-Za-z]+[0-9]+\s*:\s*[A-Za-z]+[0-9]+/g,cell:/[A-Z]+[0-9]+/g},b=this.formula,c="#"+this.sheet.el.attr("id"),d=this.address,f,e,g,k,m,l,n;for(e in this.dependencies)-1===e.indexOf("#")?this.dependencies[e].removeDependant(d):this.dependencies[e].removeDependant(c+
"!"+d),delete this.dependencies[e];if(b)for(e in a)if(m=b.match(a[e]),b=b.replace(a[e],""),null!==m)switch(e){case "remoteCellRange":for(d=0;d<m.length;d++){f=m[d].split("!");l=r.trim(f[0]);k=f[1].split(":");f=r.trim(k[0]);k=r.trim(k[1]);f=this.sheet.getRemoteCellRange(l,f,k);n=r(l).attr("data-calx-identifier");if("undefined"==typeof n||"undefined"==typeof t.sheetRegistry[n])r(l).calx(),n=r(l).attr("data-calx-identifier");"undefined"!=typeof n&&"undefined"!=typeof t.sheetRegistry[n]&&(t.sheetRegistry[n].registerDependant(this.sheet),
this.sheet.registerDependency(t.sheetRegistry[n]));for(g in f)k=l+"!"+g,"undefined"==typeof this.dependencies[k]&&!1!==f[g]&&(this.hasRemoteDependency(!0),this.dependencies[k]=f[g],f[g].registerDependant(c+"!"+this.getAddress(),this))}break;case "remoteCell":for(d=0;d<m.length;d++)f=m[d].split("!"),l=r.trim(f[0]),k=r.trim(f[1]),f=this.sheet.getRemoteCell(l,k),n=r(l).attr("data-calx-identifier"),"undefined"!=typeof n&&"undefined"!=typeof t.sheetRegistry[n]||r(l).calx(),"undefined"!=typeof n&&"undefined"!=
typeof t.sheetRegistry[n]&&(t.sheetRegistry[n].registerDependant(this.sheet),this.sheet.registerDependency(t.sheetRegistry[n])),k=l+"!"+k,"undefined"==typeof this.dependencies[k]&&!1!==f&&(this.hasRemoteDependency(!0),this.dependencies[k]=f,f.registerDependant(c+"!"+this.getAddress(),this));break;case "cellRange":for(d=0;d<m.length;d++)for(g in k=m[d].split(":"),f=r.trim(k[0]),k=r.trim(k[1]),f=this.sheet.getCellRange(f,k),f)"undefined"==typeof this.dependencies[g]&&!1!==f[g]&&(this.dependencies[g]=
f[g],f[g].registerDependant(this.getAddress(),this));break;case "cell":for(d=0;d<m.length;d++)k=m[d],f=this.sheet.getCell(k),"undefined"==typeof this.dependencies[k]&&!1!==f&&(this.dependencies[k]=f,f.registerDependant(this.getAddress(),this))}return this};v.fx.removeDependency=function(a){"undefined"!=typeof this.dependencies[a]&&delete this.dependencies[a]};v.fx.processDependency=function(){if(0==this.isProcessed()){for(var a in this.dependencies)0==this.dependencies[a].isProcessed()&&this.dependencies[a].processDependency();
this.evaluateFormula();this.setProcessed(!0);-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address)}};v.fx.registerDependant=function(a,b){"undefined"==typeof this.dependant[a]&&b&&(this.dependant[a]=b)};v.fx.removeDependant=function(a){"undefined"!=typeof this.dependant[a]&&delete this.dependant[a]};v.fx.processDependant=function(){var a;if(!1===this.isProcessed()||!0===t.isCalculating){this.processDependency();for(var b in this.dependant)if(!this.dependant[b].isProcessed()&&
(a=this.dependant[b].processDependant(),!1===a))return a;this.setAffected(!1);this.setProcessed(!0);-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address)}else return!1};v.fx.hasRemoteDependency=function(a){if("undefined"==typeof a)return this.remoteDependency;this.remoteDependency=a};v.fx.renderComputedValue=function(){if(this.formula&&"graph"==this.formula.substring(0,5).toLowerCase())return this;if(!1!==this.el){var a=this.el.prop("tagName").toLowerCase(),
b=-1<this.formTags.indexOf(a),c=this.formula?this.computedValue:this.value,d=""!=this.format&&"undefined"!=typeof x&&""!==c&&!1!==c&&null!==c&&-1==n.ERROR.indexOf(c)&&r.isNumeric(c)?x(c).format(this.format):c;b?this.isCheckbox?this.el.prop("checked",c==this.el.val()):"select"==a?this.el.val(c):"input"!=a&&"textarea"!=a||this.el.val(d):this.el.html(d)}"function"==typeof this.conditionalStyle&&(a=this.conditionalStyle.apply(null,[this.getValue(),this.el]),"object"==typeof a&&this.el.css(a));return this};
v.fx.resyncValue=function(){if(!1!==this.el){var a=this.el.prop("tagName").toLowerCase(),a=-1<this.formTags.indexOf(a)?this.el.val():this.el.text();this.isCheckbox&&!this.el.prop("checked")&&(a=this.el.attr("data-unchecked-value")||"");this.setValue(a)}};v.fx.resyncFormula=function(){this.el&&this.el.attr("data-formula")!=this.formula&&(this.formula=this.el.attr("data-formula"),this.buildDependency())};v.fx.checkCircularReference=function(a){var b,c=!1;"undefined"==typeof a&&(a=this.getAddress());
if(!1!==this.formula){for(b in this.dependencies)if(c=c||b==a)return!0;for(b in this.dependencies)if(c=c||this.dependencies[b].checkCircularReference(a))return!0}return c};v.fx.evaluateFormula=function(){if(this.formula)try{return this.sheet.setActiveCell(this),this.computedValue=this.sheet.evaluate(this.formula)}catch(a){this.computedValue="#ERROR!"}return!1};v.fx.formTags=["input","select","textarea","button"];v.fx.setConditionalStyle=function(a){"function"==typeof a&&(this.conditionalStyle=a)};
v.fx.setFormat=function(a){this.format=a;!1!==this.el&&(this.el.attr("data-format",a),this.renderComputedValue());-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address);return this};v.fx.getFormat=function(){return this.format};v.fx.setFormula=function(a){if("string"!==typeof a)return!1;this.formula=a;!1!==this.el&&this.el.attr("data-formula",a);this.buildDependency();-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address);
return this};v.fx.getFormula=function(){return this.formula};v.fx.getAddress=function(){return this.address};v.fx.getFormattedValue=function(){var a=this.formula?this.computedValue:this.value;return""!=this.format&&"undefined"!=typeof x&&""!==a&&!1!==a&&null!==a&&-1==n.ERROR.indexOf(a)&&r.isNumeric(a)?x(a).format(this.format):a};v.fx.setValue=function(a){this.value=a;-1==this.sheet.affectedCell.indexOf(this.address)&&this.sheet.affectedCell.push(this.address);return this};v.fx.getValue=function(){return this.formula?
this.computedValue:this.value};v.fx.setAffected=function(a){this.affected="undefined"==typeof a?!0:a;return this};v.fx.isAffected=function(){return this.affected};v.fx.setProcessed=function(a){this.processed="undefined"==typeof a?!0:a;return this};v.fx.isProcessed=function(){return this.processed};v.fx.highlightDependant=function(){for(var a in this.dependant)this.dependant[a].el.css("border","solid 1px blue")};v.fx.highlightDependency=function(){for(var a in this.dependencies)this.dependencies[a].el.css("border",
"solid 1px red")};u.fx=u.prototype;u.fx.init=function(){var a=this.el.find("[data-cell],[data-formula],[data-format]"),b=this,c;this.totalCell=a.length;this.parser=F(this);this.el.attr("data-calx-identifier",this.identifier);a.each(function(){c=new v(b,this);b.registerCell(c)});for(var d in this.config.data)"undefined"==typeof this.cells[d]&&(c=new v(b,void 0,d),b.registerCell(c));b.attachEvent()};u.fx.checkCircularReference=function(){var a,b={isCircular:!1,cell:null};for(a in this.cells)if(b.isCircular=
this.cells[a].checkCircularReference(),!0===b.isCircular){b.cell=this.cells[a];break}return b};u.fx.clearProcessedFlag=function(){for(var a in this.cells)!1!==this.cells[a].formula?(this.cells[a].setProcessed(!1),this.cells[a].setAffected(!0)):(this.cells[a].setProcessed(!0),this.cells[a].setAffected(!1))};u.fx.buildCellDependency=function(){for(var a in this.cells)this.cells[a].buildDependency()};u.fx.renderComputedValue=function(){for(var a=0;a<this.affectedCell.length;a++)this.cells[this.affectedCell[a]].renderComputedValue();
this.clearAffectedCell()};u.fx.clearAffectedCell=function(){this.affectedCell=[]};u.fx.hasRelatedSheet=function(){return this.relatedSheet};u.fx.clearCalculatedFlag=function(){for(var a in this.dependant)this.dependant[a].setCalculated(!1);for(a in this.dependencies)this.dependencies[a].setCalculated(!1)};u.fx.isCalculated=function(){return this.calculated};u.fx.setCalculated=function(a){this.calculated="undefined"==typeof a?!0:a};u.fx.clearDependencies=function(){};u.fx.registerDependant=function(a){this.relatedSheet=
!0;"undefined"==typeof this.dependant[a.identifier]&&(this.dependant[a.identifier]=a)};u.fx.registerDependency=function(a){this.relatedSheet=!0;"undefined"==typeof this.dependencies[a.identifier]&&(this.dependencies[a.identifier]=a)};u.fx.obj={type:"cell"};u.fx.comparator={greater:function(a,b){return a>b},greaterEqual:function(a,b){return a>=b},less:function(a,b){return a<b},lessEqual:function(a,b){return a<=b},equal:function(a,b){return a==b},notEqual:function(a,b){return a!=b}};u.fx.getVariable=
function(a){a=a[0];var b=a.toUpperCase();return"TRUE"==b?!0:"FALSE"==b?!1:"NULL"==b?null:"undefined"==typeof this.variables[a]?"undefined"==typeof n.VARIABLE[a]?"#UNDEFINED_VARIABLE!":"function"==typeof n.VARIABLE[a]?n.VARIABLE[a].call(this):n.VARIABLE[a]:"function"==typeof this.variables[a]?this.variables[a].call(this):this.variables[a]};u.fx.time=function(a){var b=a.split(":");a=new Date;var c="undefined"==typeof b[0]?0:b[0],d="undefined"==typeof b[1]?0:b[1],b="undefined"==typeof b[2]?0:b[2];return new Date(a.getFullYear(),
a.getMonth(),a.getDate(),c,d,b)};u.fx.callFunction=function(a,b){var c,d;d=a.toUpperCase();if("function"==typeof e[d])return e[d].apply(this,b);for(c in e)if("function"==typeof e[c][d])return e[c][d].apply(this,b);return"#NAME?"};u.fx.getRemoteCell=function(a,b){var c=r(a).attr("data-calx-identifier");return c&&"undefined"!=typeof t.sheetRegistry[c]?t.sheetRegistry[c].getCell(b):!1};u.fx.getRemoteCellRange=function(a,b,c){return(a=r(a).attr("data-calx-identifier"))&&"undefined"!=typeof t.sheetRegistry[a]?
t.sheetRegistry[a].getCellRange(b,c):!1};u.fx.getRemoteCellValue=function(a,b){var c=r(a).attr("data-calx-identifier");return c&&"undefined"!=typeof t.sheetRegistry[c]?t.sheetRegistry[c].getCellValue(b):!1};u.fx.getRemoteCellRangeValue=function(a,b,c){return(a=r(a).attr("data-calx-identifier"))&&"undefined"!=typeof t.sheetRegistry[a]?t.sheetRegistry[a].getCellRangeValue(b,c):!1};u.fx.getCellRangeValue=function(a,b){a=a.toUpperCase();b=b.toUpperCase();var c=s.cellRange(a,b),d=c.length,f={},e;for(e=
0;e<d;e++)f[c[e]]=this.getCellValue(c[e]);return f};u.fx.getCellValue=function(a){a=a.toUpperCase();return"undefined"==typeof this.cells[a]?!1:this.cells[a].getValue()};u.fx.evaluate=function(a){return this.parser.parse(a)};u.fx.update=function(){var a=this.el.find("[data-cell],[data-formula],[data-format]"),b=this,c;this.totalCell=a.length;for(var d in this.cells)this.cells[d].el&&!r.contains(document,this.cells[d].el[0])&&delete this.cells[d];a.each(function(){var a=r(this).attr("data-cell");a&&
"undefined"==typeof b.cells[a]?(c=new v(b,this),b.registerCell(c)):(b.cells[a].resyncValue(),b.cells[a].resyncFormula())});this.buildCellDependency()};u.fx.calculate=function(){this.clearAffectedCell();"function"==typeof this.config.onBeforeCalculate&&this.config.onBeforeCalculate.call(this);var a;this.calculateDependency(this.identifier);this.clearProcessedFlag();for(a in this.cells)this.cells[a].processDependency();this.setCalculated();for(a in this.cells)this.cells[a].hasRemoteDependency()&&this.cells[a].evaluateFormula();
this.calculateDependant(this.identifier);"function"==typeof this.config.onAfterCalculate&&this.config.onAfterCalculate.call(this);"function"==typeof this.config.onBeforeRender&&this.config.onBeforeRender.call(this);this.renderComputedValue();"function"==typeof this.config.onAfterRender&&this.config.onAfterRender.call(this);return this};u.fx.calculateDependant=function(a){};u.fx.calculateDependency=function(a){};u.fx.registerCell=function(a){var b=a.getAddress();this.cells[b]=a;"undefined"!=typeof this.config.data[b]&&
(b=this.config.data[b],"undefined"!=typeof b.value&&(a.setValue(b.value),a.renderComputedValue()),"undefined"!=typeof b.format&&a.setFormat(b.format),"undefined"!=typeof b.formula&&a.setFormula(b.formula),"undefined"!=typeof b.conditional_style&&a.setConditionalStyle(b.conditional_style));-1==this.affectedCell.indexOf(a.getAddress())&&this.affectedCell.push(a.getAddress())};u.fx.registerVariable=function(a,b){if("object"==typeof a)for(var c in a)this.variables[c]=a[c];else this.variables[a]=b};u.fx.getCell=
function(a){a=a.toUpperCase();return"undefined"!=typeof this.cells[a]?this.cells[a]:!1};u.fx.getCellRange=function(a,b){a=a.toUpperCase();b=b.toUpperCase();var c=s.cellRange(a,b),d=c.length,e={},g;for(g=0;g<d;g++)e[c[g]]=this.getCell(c[g]);return e};u.fx.applyChange=function(){for(var a in this.cells)this.cells[a].processDependency(!1,!1);for(a in this.cells)this.cells[a].renderComputedValue();return this};u.fx.scan=function(){};u.fx.refresh=function(){var a=this.el.find("[data-cell],[data-formula],[data-format]"),
b=this,c;this.totalCell=a.length;this.cells={};a.each(function(){c=new v(b,this);b.registerCell(c)});this.buildCellDependency()};u.fx.reset=function(){("form"==this.el.prop("tagName").toLowerCase()?this.el:this.el.find("form")).each(function(){this.reset()});for(var a in this.cells)this.cells[a].resyncValue();this.calculate()};u.fx.setActiveCell=function(a){this.activeCell=a};u.fx.getActiveCell=function(){return this.activeCell};u.fx.attachEvent=function(){var a=this;this.el.on("calx.getValue","input[data-cell]",
function(){var b=r(this).attr("data-cell"),b=a.cells[b],c=b.getValue(),d=b.getFormat();d&&0<=d.indexOf("%")&&(c=100*c+" %");b.isCheckbox||b.el.val(c)});this.el.on("calx.renderComputedValue","input[data-cell]",function(){var b=r(this).attr("data-cell");a.cells[b].renderComputedValue()});this.el.on("calx.setValue","input[data-cell], select[data-cell]",function(){var b=r(this).attr("data-cell"),b=a.cells[b],c=b.getValue(),d=b.el.val(),e=b.getFormat();b.isCheckbox&&"checkbox"==b.el.attr("type")?b.el.prop("checked")?
b.setValue(d):(e=b.el.attr("data-unchecked"),d=e="undefined"==typeof e?"":e,b.setValue(e)):b.isCheckbox&&"radio"==b.el.attr("type")?(b.setValue(d),a.el.find("[name="+b.el.attr("name")+"]").not(b.el).each(function(){var b=r(this),c=b.attr("data-unchecked"),b=b.attr("data-cell");a.cells[b].setValue("undefined"==typeof c?"":c)})):(e&&"undefined"!=typeof x&&""!==r.trim(d)?(rawValue=x().unformat(d),-1<e.indexOf("%")&&-1==d.indexOf("%")&&(rawValue/=100)):rawValue=r.isNumeric(d)?parseFloat(d):d,b.setValue(rawValue));
c!=d&&b.setAffected(!0)});this.el.on("calx.calculateSheet","input[data-cell]",function(){a.calculate()});this.el.on("calx.calculateCellDependant","input[data-cell], select[data-cell]",function(){var b=r(this).attr("data-cell"),b=a.cells[b];b.isAffected()&&(!0===t.isCalculating&&(t.isCalculating=!1),a.clearProcessedFlag(),b.calculate(!0,!1),a.hasRelatedSheet()?a.calculate():a.renderComputedValue())});this.el.on(a.config.autoCalculateTrigger,"input[data-cell]",function(){var b=r(this);b.attr("data-formula")||
a.config.autoCalculate&&setTimeout(function(){b.trigger("calx.calculateCellDependant")},50)});this.el.on("blur","input[data-cell]",function(){r(this).trigger("calx.renderComputedValue")});this.el.on("change","select[data-cell]",function(){r(this).trigger("calx.setValue");a.config.autoCalculate&&r(this).trigger("calx.calculateCellDependant")});this.el.on("click","input[data-cell][type=checkbox], input[data-cell][type=radio]",function(){r(this).trigger("calx.setValue");a.config.autoCalculate&&r(this).trigger("calx.calculateCellDependant")});
this.el.on("focus","input[data-cell]",function(){r(this).trigger("calx.getValue")});this.el.on("keyup","input[data-cell]",function(a){if(r(this).attr("data-formula"))return a.preventDefault(),!1;r(this).trigger("calx.setValue")})};u.fx.detachEvent=function(){this.el.off("calx.getValue");this.el.off("calx.setValue");this.el.off("calx.renderComputedValue");this.el.off("calx.calculateSheet");this.el.off("calx.calculateCellDependant")};var t={isCalculating:!1,version:"2.2.7",sheetRegistry:{},init:function(a){var b;
this.each(function(){(b=r(this).attr("data-calx-identifier"))&&"undefined"!=typeof t.sheetRegistry[b]?t.sheetRegistry[b].refresh():(b="CALX"+(new Date).valueOf(),t.sheetRegistry[b]=new u(b,this,a))});for(b in t.sheetRegistry)t.sheetRegistry[b].buildCellDependency();for(b in t.sheetRegistry){if(t.sheetRegistry[b].config.checkCircularReference){var c=t.sheetRegistry[b].checkCircularReference();c.isCircular&&(c="Circular reference detected, this may cause calx to stop working.\ncell : "+c.cell.getAddress()+
"\nformula : "+c.cell.getFormula()+"\n\nPlease check each cells involved in the formula that has direct or indirect reference to "+c.cell.getAddress(),alert(c),r.error(c))}t.sheetRegistry[b].config.autoCalculate&&t.sheetRegistry[b].calculate();t.sheetRegistry[b].renderComputedValue()}return this},registerFunction:function(a,b,c){if("undefined"==typeof c?0:c)for(var d in e)"undefined"!=typeof e[d][a]&&delete e[d][a];e.user_defined[a]=b},registerVariable:function(a,b,c){c="undefined"==typeof c?!1:c;
0===this.length&&(c=!0);if(c)if("object"==typeof a)for(var d in a)n.VARIABLE[d]=a[d];else n.VARIABLE[a]=b;else this.each(function(){var c=r(this).attr("data-calx-identifier");c&&"undefined"!=typeof t.sheetRegistry[c]&&(t.sheetRegistry[c].registerVariable(a,b),t.sheetRegistry[c].calculate())});return this},refresh:function(){return this.each(function(){var a=r(this).attr("data-calx-identifier");a&&"undefined"!=typeof t.sheetRegistry[a]&&t.sheetRegistry[a].refresh()})},update:function(){return this.each(function(){var a=
r(this).attr("data-calx-identifier");a&&"undefined"!=typeof t.sheetRegistry[a]&&t.sheetRegistry[a].update()})},getSheet:function(){var a=r(this).attr("data-calx-identifier");return"undefined"==typeof t.sheetRegistry[a]?!1:t.sheetRegistry[a]},getCell:function(a){var b=r(this).attr("data-calx-identifier");return t.sheetRegistry[b].getCell(a)},getUtility:function(){return s},getFormula:function(){return e},evaluate:function(a){var b=r(this).attr("data-calx-identifier");return t.sheetRegistry[b].evaluate(a)},
destroy:function(){this.each(function(){var a=r(this),b=a.attr("data-calx-identifier");a.removeAttr("data-calx-identifier");"undefined"!=typeof t.sheetRegistry[b]&&(t.sheetRegistry[b].detachEvent(),t.sheetRegistry[b].clearDependencies(),delete t.sheetRegistry[b])});return this},reset:function(){return this.each(function(){var a=r(this).attr("data-calx-identifier");a&&"undefined"!=typeof t.sheetRegistry[a]&&t.sheetRegistry[a].reset()})},calculate:function(){return this.each(function(){var a=r(this).attr("data-calx-identifier");
a&&"undefined"!=typeof t.sheetRegistry[a]&&t.sheetRegistry[a].calculate()})},setValue:function(a,b){var c=r(this).attr("data-calx-identifier"),c=t.sheetRegistry[c];c.getCell(a).setValue(b).renderComputedValue();c.config.autoCalculate&&c.calculate()}};r.fn.calx=function(a,b){if(t[a])return t[a].apply(this,Array.prototype.slice.call(arguments,1));if("object"==typeof a||"undefined"==typeof a)return t.init.apply(this,arguments);r.error("Method "+a+" does not exist on jQuery.calx")}})(jQuery,numeral,moment,
jStat);
