forked from xsanisty/calx.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery-calx-2.0.0.min.js
215 lines (215 loc) · 106 KB
/
jquery-calx-2.0.0.min.js
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
var Zepto=Zepto||void 0,jQuery=jQuery||Zepto,numeral=numeral||void 0,moment=moment||void 0,jStat=jStat||void 0;
(function(q,y,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,TIME_AMPM:7,TIME_24:8,number:9,STRING:10,"=":11,"+":12,"(":13,")":14,"[":15,expseq:16,"]":17,"<":18,">":19,NOT:20,"-":21,"*":22,"/":23,"^":24,E:25,FUNCTION:26,cell:27,FIXEDCELL:28,":":29,CELL:30,SHEET:31,"!":32,";":33,",":34,VARIABLE:35,DECIMAL:36,NUMBER:37,"%":38,"#":39,$accept:0,$end:1},terminals_:{5:"EOF",7:"TIME_AMPM",8:"TIME_24",10:"STRING",11:"=",
12:"+",13:"(",14:")",15:"[",17:"]",18:"<",19:">",20:"NOT",21:"-",22:"*",23:"/",24:"^",25:"E",26:"FUNCTION",28:"FIXEDCELL",29:":",30:"CELL",31:"SHEET",32:"!",33:";",34:",",35:"VARIABLE",36:"DECIMAL",37:"NUMBER",38:"%",39:"#"},productions_:[0,[3,2],[4,1],[4,1],[4,1],[4,1],[4,1],[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],[27,1],[27,3],[27,1],[27,3],[27,3],[27,5],[16,1],[16,3],[16,3],[6,1],[6,3],[9,1],[9,3],[9,2],
[2,3],[2,4]],performAction:function(b,c,d,t,n,m,g){b=m.length-1;switch(n){case 1:return m[b-1];case 2:this.$=a.getVariable(m[b]);break;case 3:this.$=a.time(m[b]);break;case 4:this.$=a.time(m[b]);break;case 5:this.$=1*m[b];isNaN(this.$)&&(this.$=0);break;case 6:this.$=m[b].substring(1,m[b].length-1);break;case 7:this.$=a.comparator.equal.apply(a,[m[b-2],m[b]]);break;case 8:this.$=e.math.SUM.apply(a,[m[b-2],m[b]]);break;case 9:this.$=1*m[b-1];break;case 10:this.$=m[b-1];break;case 11:this.$=a.comparator.lessEqual.apply(a,
[m[b-3],m[b]]);break;case 12:this.$=a.comparator.greaterEqual.apply(a,[m[b-3],m[b]]);break;case 13:this.$=a.comparator.notEqual.apply(a,[m[b-3],m[b]]);break;case 14:this.$=m[b-2]!=m[b];break;case 15:this.$=a.comparator.greater.apply(a,[m[b-2],m[b]]);break;case 16:this.$=a.comparator.less.apply(a,[m[b-2],m[b]]);break;case 17:this.$=e.math.SUBTRACT.apply(a,[m[b-2],m[b]]);break;case 18:this.$=e.math.MULTIPLY.apply(a,[m[b-2],m[b]]);break;case 19:this.$=e.math.DIVIDE.apply(a,[m[b-2],m[b]]);break;case 20:this.$=
e.math.POWER.apply(a,[m[b-2],m[b]]);break;case 21:this.$=-1*m[b];isNaN(this.$)&&(this.$=0);break;case 22:this.$=1*m[b];isNaN(this.$)&&(this.$=0);break;case 23:this.$=Math.E;break;case 24:this.$=a.callFunction(m[b-2]);break;case 25:this.$=a.callFunction(m[b-3],m[b-1]);break;case 29:this.$=a.getCellValue(m[b]);break;case 30:this.$=a.getCellRangeValue(m[b-2],m[b]);break;case 31:this.$=a.getCellValue(m[b]);break;case 32:this.$=a.getCellRangeValue(m[b-2],m[b]);break;case 33:this.$=a.getRemoteCellValue(m[b-
2],m[b]);break;case 34:this.$=a.getRemoteCellRangeValue(m[b-4],m[b-2],m[b]);break;case 35:this.$=[m[b]];break;case 36:m[b-2].push(m[b]);this.$=m[b-2];break;case 37:m[b-2].push(m[b]);this.$=m[b-2];break;case 38:this.$=[m[b]];break;case 39:this.$=q.isArray(m[b-2])?m[b-2]:[m[b-2]];this.$.push(m[b]);break;case 40:this.$=1*m[b];break;case 41:this.$=1*(m[b-2]+"."+m[b]);break;case 42:this.$=.01*m[b-1];break;case 43:this.$=m[b-2]+m[b-1]+m[b];break;case 44:this.$=m[b-2]+m[b-1]+m[b]}},table:[{2:15,3:1,4:2,
6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{1:[3]},{5:[1,22],11:[1,23],12:[1,24],18:[1,25],19:[1,26],20:[1,27],21:[1,28],22:[1,29],23:[1,30],24:[1,31]},{5:[2,2],11:[2,2],12:[2,2],14:[2,2],17:[2,2],18:[2,2],19:[2,2],20:[2,2],21:[2,2],22:[2,2],23:[2,2],24:[2,2],33:[2,2],34:[2,2],36:[1,32]},{5:[2,3],11:[2,3],12:[2,3],14:[2,3],17:[2,3],18:[2,3],19:[2,3],20:[2,3],21:[2,3],22:[2,3],23:[2,3],
24:[2,3],33:[2,3],34:[2,3]},{5:[2,4],11:[2,4],12:[2,4],14:[2,4],17:[2,4],18:[2,4],19:[2,4],20:[2,4],21:[2,4],22:[2,4],23:[2,4],24:[2,4],33:[2,4],34:[2,4]},{5:[2,5],11:[2,5],12:[2,5],14:[2,5],17:[2,5],18:[2,5],19:[2,5],20:[2,5],21:[2,5],22:[2,5],23:[2,5],24:[2,5],33:[2,5],34:[2,5],38:[1,33]},{5:[2,6],11:[2,6],12:[2,6],14:[2,6],17:[2,6],18:[2,6],19:[2,6],20:[2,6],21:[2,6],22:[2,6],23:[2,6],24:[2,6],33:[2,6],34:[2,6]},{2:15,4:34,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],
25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:36,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],16:35,21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:37,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:38,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],
21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{5:[2,23],11:[2,23],12:[2,23],14:[2,23],17:[2,23],18:[2,23],19:[2,23],20:[2,23],21:[2,23],22:[2,23],23:[2,23],24:[2,23],33:[2,23],34:[2,23]},{13:[1,39]},{5:[2,26],11:[2,26],12:[2,26],14:[2,26],17:[2,26],18:[2,26],19:[2,26],20:[2,26],21:[2,26],22:[2,26],23:[2,26],24:[2,26],33:[2,26],34:[2,26]},{2:40,5:[2,27],11:[2,27],12:[2,27],14:[2,27],17:[2,27],18:[2,27],19:[2,27],20:[2,27],21:[2,27],22:[2,27],23:[2,
27],24:[2,27],33:[2,27],34:[2,27],35:[1,41],39:[1,21]},{5:[2,38],11:[2,38],12:[2,38],14:[2,38],17:[2,38],18:[2,38],19:[2,38],20:[2,38],21:[2,38],22:[2,38],23:[2,38],24:[2,38],33:[2,38],34:[2,38],36:[2,38],39:[1,42]},{5:[2,40],11:[2,40],12:[2,40],14:[2,40],17:[2,40],18:[2,40],19:[2,40],20:[2,40],21:[2,40],22:[2,40],23:[2,40],24:[2,40],33:[2,40],34:[2,40],36:[1,43],38:[2,40]},{5:[2,29],11:[2,29],12:[2,29],14:[2,29],17:[2,29],18:[2,29],19:[2,29],20:[2,29],21:[2,29],22:[2,29],23:[2,29],24:[2,29],29:[1,
44],33:[2,29],34:[2,29]},{5:[2,31],11:[2,31],12:[2,31],14:[2,31],17:[2,31],18:[2,31],19:[2,31],20:[2,31],21:[2,31],22:[2,31],23:[2,31],24:[2,31],29:[1,45],33:[2,31],34:[2,31]},{32:[1,46]},{35:[1,47]},{1:[2,1]},{2:15,4:48,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:49,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,
19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:52,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,50],12:[1,11],13:[1,8],15:[1,9],19:[1,51],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:54,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],11:[1,53],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:55,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,
12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:56,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:57,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:58,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],
25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:59,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{35:[1,60]},{5:[2,42],11:[2,42],12:[2,42],14:[2,42],17:[2,42],18:[2,42],19:[2,42],20:[2,42],21:[2,42],22:[2,42],23:[2,42],24:[2,42],33:[2,42],34:[2,42],38:[2,42]},{11:[1,23],12:[1,24],14:[1,61],18:[1,25],19:[1,26],20:[1,27],21:[1,28],22:[1,29],23:[1,
30],24:[1,31]},{17:[1,62],33:[1,63],34:[1,64]},{11:[1,23],12:[1,24],14:[2,35],17:[2,35],18:[1,25],19:[1,26],20:[1,27],21:[1,28],22:[1,29],23:[1,30],24:[1,31],33:[2,35],34:[2,35]},{5:[2,21],11:[2,21],12:[2,21],14:[2,21],17:[2,21],18:[2,21],19:[2,21],20:[2,21],21:[2,21],22:[1,29],23:[1,30],24:[1,31],33:[2,21],34:[2,21]},{5:[2,22],11:[2,22],12:[2,22],14:[2,22],17:[2,22],18:[2,22],19:[2,22],20:[2,22],21:[2,22],22:[1,29],23:[1,30],24:[1,31],33:[2,22],34:[2,22]},{2:15,4:36,6:3,7:[1,4],8:[1,5],9:6,10:[1,
7],12:[1,11],13:[1,8],14:[1,65],15:[1,9],16:66,21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{5:[2,28],11:[2,28],12:[2,28],14:[2,28],17:[2,28],18:[2,28],19:[2,28],20:[2,28],21:[2,28],22:[2,28],23:[2,28],24:[2,28],33:[2,28],34:[2,28]},{39:[1,42]},{35:[1,67]},{37:[1,68]},{28:[1,69]},{30:[1,70]},{30:[1,71]},{32:[1,72]},{5:[2,7],11:[2,7],12:[1,24],14:[2,7],17:[2,7],18:[1,25],19:[1,26],20:[1,27],21:[1,28],22:[1,29],23:[1,30],24:[1,31],33:[2,7],34:[2,7]},
{5:[2,8],11:[2,8],12:[2,8],14:[2,8],17:[2,8],18:[2,8],19:[2,8],20:[2,8],21:[2,8],22:[1,29],23:[1,30],24:[1,31],33:[2,8],34:[2,8]},{2:15,4:73,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:74,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{5:[2,16],11:[2,16],12:[1,24],14:[2,
16],17:[2,16],18:[2,16],19:[2,16],20:[2,16],21:[1,28],22:[1,29],23:[1,30],24:[1,31],33:[2,16],34:[2,16]},{2:15,4:75,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{5:[2,15],11:[2,15],12:[1,24],14:[2,15],17:[2,15],18:[2,15],19:[2,15],20:[2,15],21:[1,28],22:[1,29],23:[1,30],24:[1,31],33:[2,15],34:[2,15]},{5:[2,14],11:[2,14],12:[1,24],14:[2,14],17:[2,14],18:[1,25],19:[1,26],20:[2,14],21:[1,
28],22:[1,29],23:[1,30],24:[1,31],33:[2,14],34:[2,14]},{5:[2,17],11:[2,17],12:[2,17],14:[2,17],17:[2,17],18:[2,17],19:[2,17],20:[2,17],21:[2,17],22:[1,29],23:[1,30],24:[1,31],33:[2,17],34:[2,17]},{5:[2,18],11:[2,18],12:[2,18],14:[2,18],17:[2,18],18:[2,18],19:[2,18],20:[2,18],21:[2,18],22:[2,18],23:[2,18],24:[1,31],33:[2,18],34:[2,18]},{5:[2,19],11:[2,19],12:[2,19],14:[2,19],17:[2,19],18:[2,19],19:[2,19],20:[2,19],21:[2,19],22:[2,19],23:[2,19],24:[1,31],33:[2,19],34:[2,19]},{5:[2,20],11:[2,20],12:[2,
20],14:[2,20],17:[2,20],18:[2,20],19:[2,20],20:[2,20],21:[2,20],22:[2,20],23:[2,20],24:[2,20],33:[2,20],34:[2,20]},{5:[2,39],11:[2,39],12:[2,39],14:[2,39],17:[2,39],18:[2,39],19:[2,39],20:[2,39],21:[2,39],22:[2,39],23:[2,39],24:[2,39],33:[2,39],34:[2,39],36:[2,39]},{5:[2,9],11:[2,9],12:[2,9],14:[2,9],17:[2,9],18:[2,9],19:[2,9],20:[2,9],21:[2,9],22:[2,9],23:[2,9],24:[2,9],33:[2,9],34:[2,9]},{5:[2,10],11:[2,10],12:[2,10],14:[2,10],17:[2,10],18:[2,10],19:[2,10],20:[2,10],21:[2,10],22:[2,10],23:[2,10],
24:[2,10],33:[2,10],34:[2,10]},{2:15,4:76,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{2:15,4:77,6:3,7:[1,4],8:[1,5],9:6,10:[1,7],12:[1,11],13:[1,8],15:[1,9],21:[1,10],25:[1,12],26:[1,13],27:14,28:[1,18],30:[1,19],31:[1,20],35:[1,16],37:[1,17],39:[1,21]},{5:[2,24],11:[2,24],12:[2,24],14:[2,24],17:[2,24],18:[2,24],19:[2,24],20:[2,24],21:[2,24],22:[2,24],23:[2,24],24:[2,24],33:[2,24],34:[2,
24]},{14:[1,78],33:[1,63],34:[1,64]},{32:[1,79]},{5:[2,41],11:[2,41],12:[2,41],14:[2,41],17:[2,41],18:[2,41],19:[2,41],20:[2,41],21:[2,41],22:[2,41],23:[2,41],24:[2,41],33:[2,41],34:[2,41],38:[2,41]},{5:[2,30],11:[2,30],12:[2,30],14:[2,30],17:[2,30],18:[2,30],19:[2,30],20:[2,30],21:[2,30],22:[2,30],23:[2,30],24:[2,30],33:[2,30],34:[2,30]},{5:[2,32],11:[2,32],12:[2,32],14:[2,32],17:[2,32],18:[2,32],19:[2,32],20:[2,32],21:[2,32],22:[2,32],23:[2,32],24:[2,32],33:[2,32],34:[2,32]},{5:[2,33],11:[2,33],
12:[2,33],14:[2,33],17:[2,33],18:[2,33],19:[2,33],20:[2,33],21:[2,33],22:[2,33],23:[2,33],24:[2,33],29:[1,80],33:[2,33],34:[2,33]},{5:[2,43],11:[2,43],12:[2,43],14:[2,43],17:[2,43],18:[2,43],19:[2,43],20:[2,43],21:[2,43],22:[2,43],23:[2,43],24:[2,43],33:[2,43],34:[2,43],35:[2,43],39:[2,43]},{5:[2,11],11:[2,11],12:[1,24],14:[2,11],17:[2,11],18:[2,11],19:[2,11],20:[2,11],21:[1,28],22:[1,29],23:[1,30],24:[1,31],33:[2,11],34:[2,11]},{5:[2,13],11:[2,13],12:[1,24],14:[2,13],17:[2,13],18:[2,13],19:[2,13],
20:[2,13],21:[1,28],22:[1,29],23:[1,30],24:[1,31],33:[2,13],34:[2,13]},{5:[2,12],11:[2,12],12:[1,24],14:[2,12],17:[2,12],18:[2,12],19:[2,12],20:[2,12],21:[1,28],22:[1,29],23:[1,30],24:[1,31],33:[2,12],34:[2,12]},{11:[1,23],12:[1,24],14:[2,36],17:[2,36],18:[1,25],19:[1,26],20:[1,27],21:[1,28],22:[1,29],23:[1,30],24:[1,31],33:[2,36],34:[2,36]},{11:[1,23],12:[1,24],14:[2,37],17:[2,37],18:[1,25],19:[1,26],20:[1,27],21:[1,28],22:[1,29],23:[1,30],24:[1,31],33:[2,37],34:[2,37]},{5:[2,25],11:[2,25],12:[2,
25],14:[2,25],17:[2,25],18:[2,25],19:[2,25],20:[2,25],21:[2,25],22:[2,25],23:[2,25],24:[2,25],33:[2,25],34:[2,25]},{5:[2,44],11:[2,44],12:[2,44],14:[2,44],17:[2,44],18:[2,44],19:[2,44],20:[2,44],21:[2,44],22:[2,44],23:[2,44],24:[2,44],33:[2,44],34:[2,44],35:[2,44],39:[2,44]},{30:[1,81]},{5:[2,34],11:[2,34],12:[2,34],14:[2,34],17:[2,34],18:[2,34],19:[2,34],20:[2,34],21:[2,34],22:[2,34],23:[2,34],24:[2,34],33:[2,34],34:[2,34]}],defaultActions:{22:[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;m.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],m=[null],g=[],k=this.table,l="",p=0,q=0,r=0,s=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 u=this.lexer.yylloc;g.push(u);var y=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,x,C={},E,A;;){z=e[e.length-1];if(this.defaultActions[z])x=this.defaultActions[z];else{if(null===w||"undefined"==typeof w)w=c();x=k[z]&&k[z][w]}if("undefined"===typeof x||!x.length||!x[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;x="";if(r)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]+"'");x=this.lexer.showPosition?"Parse error on line "+(p+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[w]||w)+"'":"Parse error on line "+(p+1)+": Unexpected "+(1==w?"end of input":"'"+(this.terminals_[w]||w)+"'");this.parseError(x,{text:this.lexer.match,token:this.terminals_[w]||w,line:this.lexer.yylineno,loc:u,expected:A,recoverable:!1!==D})}if(3==r){if(1===w||1===B)throw Error(x||"Parsing halted while starting to recover from another error.");
q=this.lexer.yyleng;l=this.lexer.yytext;p=this.lexer.yylineno;u=this.lexer.yylloc;w=c()}if(!1===D)throw Error(x||"Parsing halted. No suitable error recovery rule available.");b(D);B=2==w?null:w;w=2;z=e[e.length-1];x=k[z]&&k[z][2];r=3}if(x[0]instanceof Array&&1<x.length)throw Error("Parse Error: multiple actions possible at state: "+z+", token: "+w);switch(x[0]){case 1:e.push(w);m.push(this.lexer.yytext);g.push(this.lexer.yylloc);e.push(x[1]);w=null;B?(w=B,B=null):(q=this.lexer.yyleng,l=this.lexer.yytext,
p=this.lexer.yylineno,u=this.lexer.yylloc,0<r&&r--);break;case 2:A=this.productions_[x[1]][1];C.$=m[m.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};y&&(C._$.range=[g[g.length-(A||1)].range[0],g[g.length-1].range[1]]);z=this.performAction.apply(C,[l,q,p,this.yy,x[1],m,g].concat(s));if("undefined"!==typeof z)return z;A&&(e=e.slice(0,-2*A),m=m.slice(0,-1*A),g=g.slice(0,-1*
A));e.push(this.productions_[x[1]][0]);m.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 10;case 2:return 10;case 3:return 31;case 4:return 26;case 5:return 7;case 6:return 8;case 7:return"cell"==a.obj.type?
31:35;case 8:return"cell"==a.obj.type?28:35;case 9:return"cell"==a.obj.type?30:35;case 10:return 26;case 11:return 35;case 12:return 35;case 13:return 37;case 15:return" ";case 16:return 36;case 17:return 29;case 18:return 33;case 19:return 34;case 20:return 22;case 21:return 23;case 22:return 21;case 23:return 12;case 24:return 24;case 25:return 13;case 26:return 14;case 27:return 15;case 28:return 17;case 29:return 19;case 30:return 18;case 31:return 20;case 32:return"PI";case 33:return 25;case 34:return'"';
case 35:return"'";case 36:return"!";case 37:return 11;case 38:return 38;case 39:return 39;case 40: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-z0-9_]+>[A-Za-z0-9_]+)/,/^(?:\$[A-Za-z]+\$[0-9]+)/,/^(?:[A-Za-z]+[0-9]+)/,/^(?:[A-Za-z]+(?=[(]))/,/^(?:[A-Za-z]{1,}[A-Za-z_0-9]+)/,
/^(?:[A-Za-z_]+)/,/^(?:[0-9]+)/,/^(?:\$)/,/^(?: )/,/^(?:[.])/,/^(?::)/,/^(?:;)/,/^(?:,)/,/^(?:\*)/,/^(?:\/)/,/^(?:-)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\))/,/^(?:\[)/,/^(?:\])/,/^(?:>)/,/^(?:<)/,/^(?:NOT\b)/,/^(?:PI\b)/,/^(?:E\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],inclusive:!0}}}}();c.lexer=d;b.prototype=c;c.Parser=b;return new b}
function u(a,b){this.sheet=a;this.el="undefined"!=typeof b?q(b):!1;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;this.init()}function s(a,b,c){this.identifier=a;this.el=q(b);this.lang="en";this.cells={};this.variables={};this.config=q.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 q)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},e={custom:{},date:{DATE:function(a,b,c){return"undefined"==typeof k?l.ERRKEY.momentRequired:"undefined"==typeof b?k(a):new Date(a,b-1,c)},DATEDIFF:function(a,b,c){return"undefined"==typeof k?l.ERRKEY.momentRequired:k(b).diff(k.utc(a),c)},DATEFORMAT:function(a,b){return"undefined"==typeof k?l.ERRKEY.momentRequired:
k(a).format(b)},DATEVALUE:function(a){return"undefined"==typeof k?l.ERRKEY.momentRequired:Math.ceil((k(a)-k("1900-1-1"))/864E5)+2},DAY:function(a){return"undefined"==typeof k?l.ERRKEY.momentRequired:k(new Date(a)).date()},DAYNAME:function(a){return l.DAY_NAME[e.date.WEEKDAY(a)-1]},DAYS:function(a,b){return"undefined"==typeof k?l.ERRKEY.momentRequired:k(new Date(a)).diff(k(new Date(b)),"days")},DAYS360:function(a,b,c){if("undefined"==typeof k)return l.ERRKEY.momentRequired;a=k(new Date(a));b=k(new Date(b));
var d=31,f=31,h=a.date(),e=b.date();if(c)h=31===h?30:h,e=31===e?30:e;else if(1===a.month()&&(d=a.daysInMonth()),1===b.month()&&(f=b.daysInMonth()),h=h===d?30:h,30===h||h===d)e=e===f?30:e;return 360*(b.year()-a.year())+30*(b.month()-a.month())+(e-h)},EDATE:function(a,b){return"undefined"==typeof k?l.ERRKEY.momentRequired:k(new Date(a)).add("months",b).toDate()},EOMONTH:function(a,b){if("undefined"==typeof k)return l.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?l.ERRKEY.momentRequired:k(new Date(a)).fromNow(b)},HOUR:function(a){return"undefined"==typeof k?l.ERRKEY.momentRequired:1>=a?Math.floor(24*a):k(new Date(a)).hours()},MINUTE:function(a){return"undefined"==typeof k?l.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?l.ERRKEY.momentRequired:k(new Date(a)).format("w")},MONTH:function(a){return"undefined"==
typeof k?l.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 l.ERRKEY.momentRequired;c=l.WEEKEND_TYPES["undefined"===typeof c?1:c];var f=k(a);a=b=k(b).diff(f,"days")+1;var h="",e=[];if("undefined"!==typeof d)for(h=0;h<d.length;h++)e[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<=e.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?l.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 l.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 l.ERRKEY.momentRequired;var c=k(new Date(a)).format("d");
return l.WEEK_TYPES["undefined"===typeof b?1:b][c]},WEEKNUM:function(a,b){if("undefined"==typeof k)return l.ERRKEY.momentRequired;var c=k(new Date(a)),d=k(new Date(c.year(),0,1)),f="undefined"===typeof b?1:b,h=l.WEEK_STARTS[f],v=d.format("d"),h=v<h?h-v+1:v-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 l.ERRKEY.momentRequired;c=l.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?l.ERRKEY.momentRequired:k(new Date(a)).year()},YEARFRAC:function(a,b,c){if("undefined"==typeof k)return l.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(),e=d.month(),t=d.date(),g=f.year();a=f.month();b=f.date();switch(c){case 0:return 31===t&&31===b?b=t=30:31===t?t=30:30===t&&31===b?b=30:1===e&&1===a&&d.daysInMonth()===t&&f.daysInMonth()===b?b=t=30:1===e&&d.daysInMonth()===t&&(t=30),(b+30*a+360*g-(t+30*e+360*h))/360;case 1:c=365;if(h===g||h+1===g&&(e>a||e===a&&t>=b)){if(h===g&&
k([h]).isLeapYear())c=366;else if(h=d,g=f,e=k(new Date(h.year(),2,1)),k([h.year()]).isLeapYear()&&0>h.diff(e)&&0<=g.diff(e)?h=!0:(e=k(new Date(g.year(),2,1)),h=k([g.year()]).isLeapYear()&&0<=g.diff(e)&&0>h.diff(e)?!0:!1),h||1===a&&29===b)c=366;return f.diff(d,"days")/c}a=g-h+1;a=k(new Date(g+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===t&&(t=30),31===b&&(b=30),(b+30*a+360*g-(t+30*e+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<l.MEMOIZED_FACT[a]||(l.MEMOIZED_FACT[a]=e.math.FACT(a-1)*a);return l.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=p.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&&""===q.trim(d)?"":f},SUMIF:function(a,b){for(var c=0,d=0;d<a.length;d++)c+=eval(a[d]+b)?a[d]:0;return c},SUMIFS:function(){for(var a=(arguments.length-1)/2,b=arguments[0],c=0,d=0;d<b.length;d++){for(var f=!0,h=0;h<a;h++)eval(arguments[2*h+1][d]+arguments[2*h+2])||(f=!1);c+=f?b[d]:0}return c},SUMPRODUCT:function(){for(var a=arguments.length+1,b=0,c=0;c<arguments[0].length;c++)for(var d=0;d<arguments[0][c].length;d++){for(var f=1,h=1;h<a;h++)f*=arguments[h-1][c][d];b+=f}return b},
SUMSQ:function(){for(var a=p.toArray(arguments),b=0,c=0;c<a.length;c++)b+=q.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,v,t){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(v)||0<=k(a).diff(k(c)))return"#NUM!";f="undefined"===typeof f?0:f;v="undefined"===typeof v?0:v;h=0;t=k(new Date(a));k(new Date(b));k(new Date(c));k([t.year()]).isLeapYear();switch(v){case 0:h=e.date.YEARFRAC(a,
c,v);break;case 1:h=e.date.YEARFRAC(a,c,v);break;case 2:h=e.date.YEARFRAC(a,c,v);break;case 3:h=e.date.YEARFRAC(a,c,v);break;case 4:h=e.date.YEARFRAC(a,c,v)}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 v=0;1===
d&&0===h&&(v=-c,d++);for(;d<=f;d++)v=1===h?v+(e.financial.FV(a,d-2,b,c,1)-b):v+e.financial.FV(a,d-1,b,c,0);return v*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 v=0;1===d&&(v=0===h?b+c*a:b,d++);for(;d<=f;d++)v=0<h?v+(b-(e.financial.FV(a,d-2,b,c,1)-b)*a):v+(b-e.financial.FV(a,d-1,b,c,0)*a);return v},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,t=d===c?c-1:d,g=2;g<=t;g++)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,g=1;g<=d;g++)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,g=!1,n=0;n<d.length;n++)h[n]=0===n?0:h[n-1]+365,0<d[n]&&(e=!0),0>d[n]&&(g=!0);if(!e||!g)return"#NUM!";var e=
"undefined"===typeof b?.1:b,m,k,g=0,n=!0;do k=c(d,h,e),n=e-k/f(d,h,e),m=Math.abs(n-e),e=n,n=1E-10<m&&1E-10<Math.abs(k);while(n&&50>++g);return n?"#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=[],v=0;v<a;v++)0>d[v]?f.push(d[v]):h.push(d[v]);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,g,n,m=0,k=e=0,l="undefined"===typeof h?.01:h;1E-10>Math.abs(l)||(e=Math.exp(a*Math.log(1+l)));h=c+b*a+d;g=c*e+b*(1/l+f)*(e-1)+d;k=n=0;for(m=l;1E-10<Math.abs(h-g)&&50>k;)l=(g*n-h*m)/
(g-h),n=m,m=l,1E-10>Math.abs(l)?e=c*(1+a*l)+b*(1+l*f)*a+d:(e=Math.exp(a*Math.log(1+l)),e=c*e+b*(1/l+f)*(e-1)+d),h=g,g=e,++k;return l},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,g=0;g<d.length;g++)0<d[g]&&(h=!0),0>d[g]&&(e=!0);if(!h||!e)return"#NUM!";c=c||.1;var n,h=0,e=!0;do n=a(d,b,c),e=c-n/f(d,b,c),g=Math.abs(e-c),c=e,
e=1E-10<g&&1E-10<Math.abs(n);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 l.ERRKEY.jStatRequired;var a=p.arrayMerge(arguments);return g.sum(g(a).subtract(g.mean(a)).abs()[0])/a.length},AVERAGE:function(){for(var a=p.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?l.ERRKEY.jStatRequired:g.mean(p.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 l.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 l.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?l.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 l.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?l.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?l.ERRKEY.jStatRequired:
g.chisquare.inv(a,b)},CHISQINVRT:function(){},CHISQTEST:function(){},CONFIDENCENORM:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.normalci(1,a,b,c)[1]-1},CONFIDENCET:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.tci(1,a,b,c)[1]-1},CORREL:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.corrcoeff.apply(this,arguments)},COUNT:function(){return p.arrayMerge(arguments).length},COUNTA:function(){var a=p.arrayMerge(arguments);return a.length-
e.statistic.COUNTBLANK(a)},COUNTBLANK:function(){for(var a=p.arrayMerge(arguments),b=0,c=0;c<a.length;c++)null!==a[c]&&""!==a[c]||b++;return b},COUNTIF:function(a,b){for(var c=0,d=0;d<a.length;d++)a[d].match(new RegExp(b))&&c++;return c},COUNTIFS:function(){for(var a=(arguments.length-1)/2,b=arguments[0],c=0,d=0;d<b.length;d++){for(var f=!0,h=0;h<a;h++)eval(arguments[2*h+1][d]+arguments[2*h+2])||(f=!1);c+=f?1:0}return c},COUNTUNIQUE:function(){return p.unique(p.arrayMerge(arguments)).length},COVARIANCEP:function(a,
b){if("undefined"==typeof g)return l.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?l.ERRKEY.jStatRequired:g.covariance.apply(this,arguments)},DEVSQ:function(){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var a=p.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?l.ERRKEY.jStatRequired:
c?g.exponential.cdf(a,b):g.exponential.pdf(a,b)},FDIST:function(a,b,c,d){return"undefined"==typeof g?l.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?l.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 l.ERRKEY.jStatRequired;
for(var d=g.mean(c),f=g.mean(b),h=c.length,e=0,t=0,n=0;n<h;n++)e+=(c[n]-d)*(b[n]-f),t+=Math.pow(c[n]-d,2);b=e/t;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?l.ERRKEY.jStatRequired:g.gammafn.apply(this,arguments)},GAMMADIST:function(a,b,c,d){},GAMMAINV:function(a,b,c){},GAMMALN:function(){return"undefined"==
typeof g?l.ERRKEY.jStatRequired:g.gammaln.apply(this,arguments)},GAMMALNPRECISE:function(){},GAUSS:function(a){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.normal.cdf(a,0,1)-.5},GEOMEAN:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.geomean(p.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,g=0,n=0,m=0;for(f=0;f<h;f++)var k=b[f],l=Math.log(a[f]),e=e+k,g=g+l,n=n+k*l,m=m+k*k;e/=h;g/=h;n/=h;m/=h;d?(a=(n-e*g)/(m-e*e),e=g-a*e):(a=n/m,e=0);g=[];for(f=0;f<c.length;f++)g.push(Math.exp(e+a*c[f]));return g},HARMEAN:function(){for(var a=p.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 g(a,b,c,d){for(var f=0,e=0;e<=a;e++)f+=h(e,b,c,d);return f}
return f?g(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 l.ERRKEY.jStatRequired;for(var a=p.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=p.objectToArray(a);return a.sort(function(a,b){return b-a})[b-1]},LINEST:function(a,b){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;
for(var c=g.mean(b),d=g.mean(a),f=b.length,e=0,k=0,t=0;t<f;t++)e+=(b[t]-c)*(a[t]-d),k+=Math.pow(b[t]-c,2);f=e/k;return[f,d-f*c]},LOGEST:function(){},LOGNORMDIST:function(a,b,c,d){return"undefined"==typeof g?l.ERRKEY.jStatRequired:d?g.lognormal.cdf(a,b,c):g.lognormal.pdf(a,b,c)},LOGNORMINV:function(a,b,c){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.lognormal.inv(a,b,c)},MAX:function(){for(var a=p.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=p.arrayMerge(arguments);return 0<a.length?Math.max.apply(Math,a):0},MEDIAN:function(){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.median(p.arrayMerge(arguments))},MIN:function(){for(var a=p.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=p.arrayMerge(arguments);return 0<a.length?Math.min.apply(Math,a):0},MODEMULT:function(){for(var a=p.arrayMerge(arguments),b=a.length,c={},d=
[],f=0,e,g=0;g<b;g++)e=a[g],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(p.arrayMerge(arguments)).sort(function(a,b){return a-b})[0]},NEGBINOMDIST:function(a,b,c,d){return"undefined"==typeof g?l.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?l.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?l.ERRKEY.jStatRequired:g.normal.inv(a,b,c)},NORMSDIST:function(a,b){return"undefined"==typeof g?l.ERRKEY.jStatRequired:b?g.normal.cdf(a,0,1):g.normal.pdf(a,0,1)},NORMSINV:function(a){return"undefined"==typeof g?l.ERRKEY.jStatRequired:g.normal.inv(a,0,1)},PEARSON:function(a,b){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var c=g.mean(a),d=g.mean(b),f=a.length,e=0,k=0,t=0,n=0;n<f;n++)e+=(a[n]-c)*(b[n]-d),k+=Math.pow(a[n]-c,2),t+=
Math.pow(b[n]-d,2);return e/Math.sqrt(k*t)},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 p.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 p.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=p.unique(a),f=a.length,
e=d.length;c=Math.pow(10,"undefined"===typeof c?3:c);for(var g=0,k=!1,n=0;!k&&n<e;)b===d[n]?(g=(a.indexOf(d[n])+1)/(f+1),k=!0):b>=d[n]&&(b<d[n+1]||n===e-1)&&(g=(a.indexOf(d[n])+1+(b-d[n])/(d[n+1]-d[n]))/(f+1),k=!0),n++;return Math.floor(g*c)/c},PERCENTRANKINC:function(a,b,c){a=a.sort(function(a,b){return a-b});var d=p.unique(a),f=a.length,e=d.length;c=Math.pow(10,"undefined"===typeof c?3:c);for(var g=0,k=!1,n=0;!k&&n<e;)b===d[n]?(g=a.indexOf(d[n])/(f-1),k=!0):b>=d[n]&&(b<d[n+1]||n===e-1)&&(g=(a.indexOf(d[n])+
(b-d[n])/(d[n+1]-d[n]))/(f-1),k=!0),n++;return Math.floor(g*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)/l.SQRT2PI},POISSONDIST:function(a,b,c){return"undefined"==typeof g?l.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,g=0,k=0;k<e;k++)f[k]>=c&&f[k]<=d&&(g+=b[a.indexOf(f[k])]);return g},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=p.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 l.ERRKEY.jStatRequired;for(var a=p.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 l.ERRKEY.jStatRequired;for(var a=p.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 l.ERRKEY.jStatRequired;for(var c=g.mean(b),d=g.mean(a),f=b.length,e=0,k=0,t=0;t<f;t++)e+=(b[t]-c)*(a[t]-d),k+=Math.pow(b[t]-c,2);return e/k},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=p.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=p.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 l.ERRKEY.jStatRequired;for(var a=p.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=p.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 l.ERRKEY.jStatRequired;for(var c=g.mean(b),d=g.mean(a),f=b.length,e=0,k=0,t=0,n=0;n<f;n++)e+=Math.pow(a[n]-d,2),k+=(b[n]-c)*(a[n]-d),t+=Math.pow(b[n]-c,2);return Math.sqrt((e-k*k/t)/
(f-2))},TDIST:function(a,b,c){return"undefined"==typeof g?l.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?l.ERRKEY.jStatRequired:g.studentt.inv(a,b)},TINV2T:function(){},TTEST:function(){},TREND:function(){},TRIMMEAN:function(a,b){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;var c=e.math.FLOOR(a.length*b,2)/2;return g.mean(p.initial(p.rest(a.sort(function(a,b){return a-b}),c),c))},
VARA:function(){if("undefined"==typeof g)return l.ERRKEY.jStatRequired;for(var a=p.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=p.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 l.ERRKEY.jStatRequired;for(var a=p.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=p.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<=l.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 y)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 y(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 y)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 y(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=q.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 y)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")?y(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 q.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 y?"#NAME?":y().unformat(a)}},trigonometry:{},general:{VLOOKUP:function(a,b,c,d){var f,e;typeof("object"==b)&&"Object"==b.constructor.name&&(b=p.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=[];for(f=0;f<e;f++){if(a==b[f][0])return b[f][c];d[f]=Math.abs(b[f][0]-a);isNaN(d[f])&&(d[f]=-1)}e=d.length;a=null;for(f=0;f<e;f++)0<=d[f]&&(a=null===a?d[f]:a<d[f]?a:d[f]);d=d.indexOf(a);return 0>d?"#N/A!":b[d][c]},HLOOKUP:function(a,b,c,d){typeof("object"==b)&&(b=p.rangeToTable(b));b=p.transposeTable(b);return e.general.VLOOKUP(a,
b,c,d)},SERVER:function(){if(null==this.config.ajaxUrl)return l.ERRKEY.ajaxUrlRequired;for(var a,b=arguments[0],c={},d=1;d<arguments.length;d++)c["params["+d+"]"]=arguments[d];c["function"]=b;q.ajax({url:this.config.ajaxUrl,method:this.config.ajaxMethod,data:c,async:!1,success:function(b){a=b},error:function(b){a=l.ERRKEY.sendRequestError}});return a},GRAPH:function(a,b){var c={},d=this.getActiveCell().el,f={};b="undefined"==typeof b?[]:b;for(var e,g=0;g<b.length;g++)e=b[g].split("="),c[e[0]]=e[1];
d.height()||d.css("height","300px");d.width||d.css("width","300px");switch(c.type){case "bar":e=p.rangeToTable(a);f.series={bars:{show:!0,barWidth:.6,align:"center"},stack:!0};break;case "pie":e=p.objectToArray(a);f.series={pie:{show:!0,radius:.8}};f.legend={show:!1};break;case "doughnut":case "donut":e=p.objectToArray(a);f.series={pie:{show:!0,innerRadius:.5,radius:.8}};f.legend={show:!1};break;default:e=p.rangeToTable(a)}"undefined"!=typeof c.orientation&&"vertical"==c.orientation&&(e=p.transposeTable(e));
if("undefined"!=typeof c.label){var g=this.evaluate(c.label),g=p.objectToArray(g),k=e.length,n,m,l;for(m=0;m<k;m++)for(n=e[m].length,l=0;l<n;l++)a=e[m][l],e[m][l]=[g[l],a];f.xaxis={mode:"categories",tickLength:0}}else for(k=e.length,m=0;m<k;m++)for(n=e[m].length,l=0;l<n;l++)a=e[m][l],e[m][l]=[l,a];if("undefined"!=typeof c.legend){c=this.evaluate(c.legend);c=p.objectToArray(c);g=[];for(k=0;k<e.length;k++)g.push({label:c[k],data:e[k]});e=g}f.grid={backgroundColor:{colors:["#fff","#eee"]},borderWidth:{top:0,
right:0,bottom:0,left:0}};q.plot(d,e,f);return!1}},engineering:{BIN2DEC:function(a){if(!p.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(!p.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?p.repeat("0",b-c.length)+c:"#NUM!"},BIN2OCT:function(a,b){if(!p.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?p.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,k=null,l=b,m=c,p=1,q=1,r,s=0;s<d.length;s++){r=null===d[s][2]?[]:d[s][2];if(d[s][1]===l||0<=r.indexOf(l))g=d[s];if(d[s][1]===m||0<=r.indexOf(m))k=d[s]}if(null===g)for(r=f[b.substring(0,2)],s=e[b.substring(0,1)],"da"===b.substring(0,2)&&(s=["dekao",10,"da"]),r?(p=r[2],l=b.substring(2)):s&&(p=s[1],l=b.substring(s[2].length)),b=0;b<d.length;b++)if(r=null===d[b][2]?[]:d[b][2],d[b][1]===l||0<=r.indexOf(l))g=
d[b];if(null===k)for(f=f[c.substring(0,2)],e=e[c.substring(0,1)],"da"===c.substring(0,2)&&(e=["dekao",10,"da"]),f?(q=f[2],m=c.substring(2)):e&&(q=e[1],m=c.substring(e[2].length)),c=0;c<d.length;c++)if(r=null===d[c][2]?[]:d[c][2],d[c][1]===m||0<=r.indexOf(m))k=d[c];return null===g||null===k||g[3]!==k[3]?"#N/A":a*g[6]*p/(k[6]*q)},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"+p.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?p.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?p.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?p.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"+
p.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?p.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?p.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),l="i";"j"===g?l="j":"j"===k&&(l="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,l)},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),l="i";"j"===g?l="j":"j"===k&&(l="j");return"#NUM!"===c||"#NUM!"===d||"#NUM!"===f||"#NUM!"===h?"#NUM!":e.engineering.COMPLEX(c-f,d-h,l)},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"+p.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?p.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?p.repeat("0",b-c.length)+c:"#NUM!"}},user_defined:{}},p={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,l;for(l=g;l<=c;l++)for(k=f;k<=d;k++)g=this.toChr(l)+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])""!==q.trim(a[c][b])&&
(d=d.concat(a[c][b]));else""!==q.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)""!==q.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,e,g;d=a.length;g=[];for(b=0;b<d;b++)for(e=a[b].length,c=0;c<e;c++)"undefined"==typeof g[c]&&(g[c]=[]),g[c].push(a[b][c]);return g}},l={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"]};u.fx=u.prototype;u.fx.init=function(){var a=this.el?this.el.attr("data-cell"):"",b=this.el?
this.el.attr("data-formula"):"",c=this.el?this.el.attr("data-format"):"",d=this.el?this.el.val():null;a&&""!=q.trim(a)?a=a.toUpperCase():(a="CALX"+this.sheet.counter,this.el&&this.el.attr("data-cell",a),this.sheet.counter++);b=b&&""!=q.trim(b)?b.replace(""",'"').replace("'","'").replace(""",'"'):!1;"input"!=this.el.prop("tagName").toLowerCase()||"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);c&&""!=q.trim(c)||(c=this.sheet.config.defaultFormat);this.formula=b;this.format=c;this.address=a;this.setValue(d)};u.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.apply(this.sheet);r.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);r.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.apply(this.sheet);this.sheet.config.autoCalculate&&a&&"function"==
typeof this.sheet.config.onBeforeRender&&this.sheet.config.onBeforeRender.apply(this.sheet);b&&this.renderComputedValue();this.sheet.config.autoCalculate&&a&&"function"==typeof this.sheet.config.onAfterRender&&this.sheet.config.onAfterRender.apply(this.sheet);return this};u.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,e,g,k,l,n,m,p;for(g in this.dependencies)-1===g.indexOf("#")?this.dependencies[g].removeDependant(d):this.dependencies[g].removeDependant(c+"!"+d),delete this.dependencies[g];if(b)for(g in a)if(n=b.match(a[g]),b=b.replace(a[g],""),null!==n)switch(g){case "remoteCellRange":for(d=0;d<n.length;d++)for(k in e=n[d].split("!"),m=q.trim(e[0]),l=e[1].split(":"),e=q.trim(l[0]),l=q.trim(l[1]),e=this.sheet.getRemoteCellRange(m,e,l),p=q(m).attr("data-calx-identifier"),
"undefined"!=typeof p&&"undefined"!=typeof r.sheetRegistry[p]&&(r.sheetRegistry[p].registerDependant(this.sheet),this.sheet.registerDependency(r.sheetRegistry[p])),e)l=m+"!"+k,"undefined"==typeof this.dependencies[l]&&!1!==e[k]&&(this.hasRemoteDependency(!0),this.dependencies[l]=e[k],e[k].registerDependant(c+"!"+this.getAddress(),this));break;case "remoteCell":for(d=0;d<n.length;d++)e=n[d].split("!"),m=q.trim(e[0]),l=q.trim(e[1]),e=this.sheet.getRemoteCell(m,l),p=q(m).attr("data-calx-identifier"),
"undefined"!=typeof p&&"undefined"!=typeof r.sheetRegistry[p]&&(r.sheetRegistry[p].registerDependant(this.sheet),this.sheet.registerDependency(r.sheetRegistry[p])),l=m+"!"+l,"undefined"==typeof this.dependencies[l]&&!1!==e&&(this.hasRemoteDependency(!0),this.dependencies[l]=e,e.registerDependant(c+"!"+this.getAddress(),this));break;case "cellRange":for(d=0;d<n.length;d++)for(k in l=n[d].split(":"),e=q.trim(l[0]),l=q.trim(l[1]),e=this.sheet.getCellRange(e,l),e)"undefined"==typeof this.dependencies[k]&&
!1!==e[k]&&(this.dependencies[k]=e[k],e[k].registerDependant(this.getAddress(),this));break;case "cell":for(d=0;d<n.length;d++)l=n[d],e=this.sheet.getCell(l),"undefined"==typeof this.dependencies[l]&&!1!==e&&(this.dependencies[l]=e,e.registerDependant(this.getAddress(),this))}return this};u.fx.removeDependency=function(a){"undefined"!=typeof this.dependencies[a]&&delete this.dependencies[a]};u.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)}};u.fx.registerDependant=function(a,b){"undefined"==typeof this.dependant[a]&&b&&(this.dependant[a]=b)};u.fx.removeDependant=function(a){"undefined"!=typeof this.dependant[a]&&delete this.dependant[a]};u.fx.processDependant=function(){var a;if(!1===this.isProcessed()||!0===r.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};u.fx.hasRemoteDependency=function(a){if("undefined"==typeof a)return this.remoteDependency;this.remoteDependency=a};u.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 y&&""!==c&&!1!==c&&null!==c&&-1==l.ERROR.indexOf(c)&&q.isNumeric(c)?y(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};
u.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.el.attr("data-format")&&""!=q.trim(a)?this.setValue(y().unformat(a+"")):this.setValue(a)}};u.fx.resyncFormula=function(){this.el&&this.el.attr("data-formula")!=this.formula&&(this.formula=this.el.attr("data-formula"),this.buildDependency())};u.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};u.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};u.fx.formTags=["input","select","textarea","button"];u.fx.setConditionalStyle=function(a){"function"==typeof a&&(this.conditionalStyle=a)};u.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};u.fx.getFormat=function(){return this.format};u.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};u.fx.getFormula=function(){return this.formula};
u.fx.getAddress=function(){return this.address};u.fx.getFormattedValue=function(){var a=this.formula?this.computedValue:this.value;return""!=this.format&&"undefined"!=typeof y&&""!==a&&!1!==a&&null!==a&&-1==l.ERROR.indexOf(a)&&q.isNumeric(a)?y(a).format(this.format):a};u.fx.setValue=function(a,b){this.format&&"undefined"!=typeof y&&""!==q.trim(a)?(this.value=y().unformat(a+""),-1<this.format.indexOf("%")&&-1==(a+"").indexOf("%")&&(this.value/=100)):this.value=q.isNumeric(a)?parseFloat(a):a;-1==this.sheet.affectedCell.indexOf(this.address)&&
this.sheet.affectedCell.push(this.address);return this};u.fx.getValue=function(){return this.formula?this.computedValue:this.value};u.fx.setAffected=function(a){this.affected="undefined"==typeof a?!0:a;return this};u.fx.isAffected=function(){return this.affected};u.fx.setProcessed=function(a){this.processed="undefined"==typeof a?!0:a;return this};u.fx.isProcessed=function(){return this.processed};u.fx.highlightDependant=function(){for(var a in this.dependant)this.dependant[a].el.css("border","solid 1px blue")};
u.fx.highlightDependency=function(){for(var a in this.dependencies)this.dependencies[a].el.css("border","solid 1px red")};s.fx=s.prototype;s.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 u(b,this);b.registerCell(c)});b.attachEvent()};s.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};s.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))};s.fx.buildCellDependency=function(){for(var a in this.cells)this.cells[a].buildDependency()};s.fx.renderComputedValue=function(){for(var a=0;a<this.affectedCell.length;a++)this.cells[this.affectedCell[a]].renderComputedValue();
this.clearAffectedCell()};s.fx.clearAffectedCell=function(){this.affectedCell=[]};s.fx.hasRelatedSheet=function(){return this.relatedSheet};s.fx.clearCalculatedFlag=function(){for(var a in this.dependant)this.dependant[a].setCalculated(!1);for(a in this.dependencies)this.dependencies[a].setCalculated(!1)};s.fx.isCalculated=function(){return this.calculated};s.fx.setCalculated=function(a){this.calculated="undefined"==typeof a?!0:a};s.fx.clearDependencies=function(){};s.fx.registerDependant=function(a){this.relatedSheet=
!0;"undefined"==typeof this.dependant[a.identifier]&&(this.dependant[a.identifier]=a)};s.fx.registerDependency=function(a){this.relatedSheet=!0;"undefined"==typeof this.dependencies[a.identifier]&&(this.dependencies[a.identifier]=a)};s.fx.obj={type:"cell"};s.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}};s.fx.getVariable=
function(a){a=a[0];var b=a.toUpperCase();return"TRUE"==b?!0:"FALSE"==b?!1:"NULL"==b?null:"undefined"==typeof l.VARIABLE[a]?"#UNDEFINED_VARIABLE!":l.VARIABLE[a]};s.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)};s.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?"};s.fx.getRemoteCell=function(a,b){var c=q(a).attr("data-calx-identifier");return c&&"undefined"!=typeof r.sheetRegistry[c]?r.sheetRegistry[c].getCell(b):!1};s.fx.getRemoteCellRange=function(a,b,c){return(a=q(a).attr("data-calx-identifier"))&&"undefined"!=typeof r.sheetRegistry[a]?r.sheetRegistry[a].getCellRange(b,c):!1};s.fx.getRemoteCellValue=function(a,b){var c=q(a).attr("data-calx-identifier");return c&&"undefined"!=typeof r.sheetRegistry[c]?
r.sheetRegistry[c].getCellValue(b):!1};s.fx.getRemoteCellRangeValue=function(a,b,c){return(a=q(a).attr("data-calx-identifier"))&&"undefined"!=typeof r.sheetRegistry[a]?r.sheetRegistry[a].getCellRangeValue(b,c):!1};s.fx.getCellRangeValue=function(a,b){a=a.toUpperCase();b=b.toUpperCase();var c=p.cellRange(a,b),d=c.length,e={},g;for(g=0;g<d;g++)e[c[g]]=this.getCellValue(c[g]);return e};s.fx.getCellValue=function(a){a=a.toUpperCase();return"undefined"==typeof this.cells[a]?!1:this.cells[a].getValue()};
s.fx.evaluate=function(a){return this.parser.parse(a)};s.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&&!q.contains(document,this.cells[d].el[0])&&delete this.cells[d];a.each(function(){var a=q(this).attr("data-cell");a&&"undefined"==typeof b.cells[a]?(c=new u(b,this),b.registerCell(c)):(b.cells[a].resyncValue(),b.cells[a].resyncFormula())});this.buildCellDependency()};s.fx.calculate=function(){this.clearAffectedCell();
"function"==typeof this.config.onBeforeCalculate&&this.config.onBeforeCalculate.apply(this);var a;this.clearProcessedFlag();for(a in this.cells)this.cells[a].processDependency();this.setCalculated();for(a in this.dependant)this.dependant[a].isCalculated()||this.dependant[a].calculate();for(a in this.cells)this.cells[a].hasRemoteDependency()&&this.cells[a].evaluateFormula();"function"==typeof this.config.onAfterCalculate&&this.config.onAfterCalculate.apply(this);"function"==typeof this.config.onBeforeRender&&
this.config.onBeforeRender.apply(this);this.renderComputedValue();"function"==typeof this.config.onAfterRender&&this.config.onAfterRender.apply(this);return this};s.fx.registerCell=function(a){this.cells[a.getAddress()]=a;-1==this.affectedCell.indexOf(a.getAddress())&&this.affectedCell.push(a.getAddress())};s.fx.getCell=function(a){a=a.toUpperCase();return"undefined"!=typeof this.cells[a]?this.cells[a]:!1};s.fx.getCellRange=function(a,b){a=a.toUpperCase();b=b.toUpperCase();var c=p.cellRange(a,b),
d=c.length,e={},g;for(g=0;g<d;g++)e[c[g]]=this.getCell(c[g]);return e};s.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};s.fx.scan=function(){};s.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 u(b,this);b.registerCell(c)});this.buildCellDependency()};s.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()};s.fx.setActiveCell=function(a){this.activeCell=a};s.fx.getActiveCell=function(){return this.activeCell};s.fx.attachEvent=function(){var a=this;this.el.on("calx.getValue","input[data-cell]",function(){var b=q(this).attr("data-cell"),b=a.cells[b],c=b.getValue(),d=b.getFormat();d&&-1<d.indexOf("%")&&(c=100*c+" %");b.isCheckbox||b.el.val(c)});
this.el.on("calx.renderComputedValue","input[data-cell]",function(){var b=q(this).attr("data-cell");a.cells[b].renderComputedValue()});this.el.on("calx.setValue","input[data-cell], select[data-cell]",function(){var b=q(this).attr("data-cell"),b=a.cells[b];if(b.isCheckbox&&"checkbox"==b.el.attr("type"))if(b.el.prop("checked"))b.setValue(b.el.val());else{var c=b.el.attr("data-unchecked");b.setValue("undefined"==typeof c?"":c)}else b.isCheckbox&&"radio"==b.el.attr("type")?(b.setValue(b.el.val()),a.el.find("[name="+
b.el.attr("name")+"]").not(b.el).each(function(){var b=q(this),c=b.attr("data-unchecked"),b=b.attr("data-cell");a.cells[b].setValue("undefined"==typeof c?"":c)})):b.setValue(b.el.val())});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=q(this).attr("data-cell"),b=a.cells[b];!0===r.isCalculating&&(r.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=q(this);b.attr("data-formula")||a.config.autoCalculate&&setTimeout(function(){b.trigger("calx.calculateCellDependant")},50)});this.el.on("blur","input[data-cell]",function(){q(this).trigger("calx.renderComputedValue")});this.el.on("change","select[data-cell], input[data-cell][type=checkbox], input[data-cell][type=radio]",function(){q(this).trigger("calx.setValue");a.config.autoCalculate&&
q(this).trigger("calx.calculateCellDependant")});this.el.on("focus","input[data-cell]",function(){q(this).trigger("calx.getValue")});this.el.on("keyup","input[data-cell]",function(a){if(q(this).attr("data-formula"))return a.preventDefault(),!1;q(this).trigger("calx.setValue")})};s.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 r={isCalculating:!1,
sheetRegistry:{},init:function(a){var b;this.each(function(){(b=q(this).attr("data-calx-identifier"))&&"undefined"!=typeof r.sheetRegistry[b]?r.sheetRegistry[b].refresh():(b="CALX"+(new Date).valueOf(),r.sheetRegistry[b]=new s(b,this,a))});for(b in r.sheetRegistry)r.sheetRegistry[b].buildCellDependency();for(b in r.sheetRegistry){if(r.sheetRegistry[b].config.checkCircularReference){var c=r.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),q.error(c))}r.sheetRegistry[b].config.autoCalculate&&(r.sheetRegistry[b].renderComputedValue(),r.sheetRegistry[b].calculate())}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){if("object"==
typeof a)for(var c in a)l.VARIABLE[c]=a[c];else l.VARIABLE[a]=b},refresh:function(){return this.each(function(){var a=q(this).attr("data-calx-identifier");a&&"undefined"==typeof r.sheetRegistry[a]&&r.sheetRegistry[a].refresh()})},update:function(){return this.each(function(){var a=q(this).attr("data-calx-identifier");a&&"undefined"!=typeof r.sheetRegistry[a]&&r.sheetRegistry[a].update()})},getSheet:function(){var a=q(this).attr("data-calx-identifier");return"undefined"==typeof r.sheetRegistry[a]?
!1:r.sheetRegistry[a]},getCell:function(a){var b=q(this).attr("data-calx-identifier");return r.sheetRegistry[b].getCell(a)},getUtility:function(){return p},evaluate:function(a){var b=q(this).attr("data-calx-identifier");return r.sheetRegistry[b].evaluate(a)},destroy:function(){this.each(function(){var a=q(this),b=a.attr("data-calx-identifier");a.removeAttr("data-calx-identifier");"undefined"!=typeof r.sheetRegistry[b]&&(r.sheetRegistry[b].detachEvent(),r.sheetRegistry[b].clearDependencies(),delete r.sheetRegistry[b])});
return this},reset:function(){return this.each(function(){var a=q(this).attr("data-calx-identifier");a&&"undefined"!=typeof r.sheetRegistry[a]&&r.sheetRegistry[a].reset()})},calculate:function(){return this.each(function(){var a=q(this).attr("data-calx-identifier");a&&"undefined"!=typeof r.sheetRegistry[a]&&r.sheetRegistry[a].calculate()})}};q.fn.calx=function(a,b){if(r[a])return r[a].apply(this,Array.prototype.slice.call(arguments,1));if("object"==typeof a||"undefined"==typeof a)return r.init.apply(this,
arguments);q.error("Method "+a+" does not exist on jQuery.calx")}})(jQuery,numeral,moment,jStat);