text: !function(t){"use strict";var e=t.tablesorter,n={events:"tablesorter-initialized update updateAll updateRows addRows updateCell filterReset filterEnd ".split(" ").join(".tsmath "),getRow:function(n,a,r,i){var o,l,u=n.config,s=[],h=r.closest("tr"),c=h.children();return h.hasClass(a.filter_filteredRow||"filtered")||(a.math_ignore.length&&(c=c.not("["+i+"=ignore]").not("[data-column="+a.math_ignore.join("],[data-column=")+"]")),s=c.not(r).map(function(){return o=t(this),l=o.attr(u.textAttribute),"undefined"==typeof l&&(l=this.textContent||o.text()),l=e.formatFloat(l.replace(/[^\w,. \-()]/g,""),n),isNaN(l)?0:l}).get()),s},getColumn:function(n,a,r,i,o){var l,u,s,h,c,f=[],d=n.config,m=a.filter_filteredRow||"filtered",p=parseInt(r.attr("data-column"),10),g=d.$table.children("tbody").children(),v=r.closest("tr");if("above"===i)for(h=g.index(v),l=h;l>=0;)s=g.eq(l).children().filter("[data-column="+p+"]"),c=s.filter("["+o+"^=above]").length,(!g.eq(l).hasClass(m)&&g.eq(l).not("["+o+"=ignore]").length&&l!==h||c&&l!==h)&&(c?l=0:s.length&&(u=s.attr(d.textAttribute),"undefined"==typeof u&&(u=s[0].textContent||s.text()),u=e.formatFloat(u.replace(/[^\w,. \-()]/g,""),n),f.push(isNaN(u)?0:u))),l--;else g.each(function(){s=t(this).children().filter("[data-column="+p+"]"),t(this).hasClass(m)||!s.not("["+o+"^=above],["+o+"^=col]").length||s.is(r)||(u=s.attr(d.textAttribute),"undefined"==typeof u&&(u=(s[0]?s[0].textContent:"")||s.text()),u=e.formatFloat(u.replace(/[^\w,. \-()]/g,""),n),f.push(isNaN(u)?0:u))});return f},getAll:function(n,a,r){var i,o,l,u=[],s=n.config,h=a.filter_filteredRow||"filtered",c=s.$table.children("tbody").children();return c.each(function(){t(this).hasClass(h)||t(this).children().each(function(){o=t(this),l=parseInt(o.attr("data-column"),10),!o.filter("["+r+"]").length&&t.inArray(l,a.math_ignore)<0&&(i=o.attr(s.textAttribute),"undefined"==typeof i&&(i=(o[0]?o[0].textContent:"")||o.text()),i=e.formatFloat(i.replace(/[^\w,. \-()]/g,""),n),u.push(isNaN(i)?0:i))})}),u},recalculate:function(t,a,r,i){if(a&&(!r.math_isUpdating||i)){i&&e.computeColumnIndex(a.$table.children("tbody").children());var o="data-"+(r.math_data||"math"),l=a.$tbodies.find("["+o+"]");n.mathType(t,r,l,r.math_priority,o),l=a.$table.find("."+a.cssInfoBlock+", tfoot").find("["+o+"]"),n.mathType(t,r,l,r.math_priority,o),n.mathType(t,r,a.$table.find("["+o+"^=all]"),["all"],o),r.math_isUpdating=!0,a.$table.trigger("update")}},mathType:function(a,r,i,o,l){if(i.length){var u,s,h,c,f,d=e.equations;"all"===o[0]&&(f=n.getAll(a,r,l)),t.each(o,function(e,o){i.filter("["+l+"^="+o+"]").each(function(){h=t(this),u=(h.attr(l)||"").replace(o+"-",""),c="row"===o?n.getRow(a,r,h,l):"all"===o?f:n.getColumn(a,r,h,o,l),d[u]&&(s=d[u](c),a.config.debug&&console&&console.log&&console.log(h.attr(l),c,"=",s),n.output(h,r,s,c))})})}},output:function(n,a,r,i){var o=e.formatMask(n.attr("data-"+a.math_data+"-mask")||a.math_mask,r,a.math_wrapPrefix,a.math_wrapSuffix);t.isFunction(a.math_complete)&&(o=a.math_complete(n,a,o,r,i)),o!==!1&&n.html(o)}};e.formatMask=function(t,e,n,a){if(!t||isNaN(+e))return e;var r,i,o,l,u,s,h,c,f,d,m,p,g,v,_,b,x,y,w,C="",q="";if(_=t.length,b=t.search(/[0-9\-\+#]/),x=b>0?t.substring(0,b):"",C=x,b>0&&n&&(C=/\{content\}/.test(n||"")?(n||"").replace(/\{content\}/g,x||""):(n||"")+x),w=t.split("").reverse().join(""),y=w.search(/[0-9\-\+#]/),g=_-y,g+="."===t.substring(g,g+1)?1:0,x=y>0?t.substring(g,_):"",q=x,""!==x&&a&&(q=/\{content\}/.test(a||"")?(a||"").replace(/\{content\}/g,x||""):x+(a||"")),t=t.substring(b,g),e="-"==t.charAt(0)?-e:+e,r=0>e?e=-e:0,i=t.match(/[^\d\-\+#]/g),o=i&&i[i.length-1]||".",l=i&&i[1]&&i[0]||",",t=t.split(o),e=e.toFixed(t[1]&&t[1].length),e=+e+"",s=t[1]&&t[1].lastIndexOf("0"),c=e.split("."),(!c[1]||c[1]&&c[1].length<=s)&&(e=(+e).toFixed(s+1)),f=t[0].split(l),t[0]=f.join(""),u=t[0]&&t[0].indexOf("0"),u>-1)for(;c[0].length<t[0].length-u;)c[0]="0"+c[0];else 0===+c[0]&&(c[0]="");if(e=e.split("."),e[0]=c[0],h=f[1]&&f[f.length-1].length){for(d=e[0],m="",p=d.length%h,v=d.length,g=0;v>g;g++)m+=d.charAt(g),!((g-p+1)%h)&&v-h>g&&(m+=l);e[0]=m}return e[1]=t[1]&&e[1]?o+e[1]:"",C+((r?"-":"")+e[0]+e[1])+q},e.equations={count:function(t){return t.length},sum:function(e){var n=0;return t.each(e,function(t){n+=e[t]}),n},mean:function(t){var n=e.equations.sum(t);return n/t.length},median:function(t){t.sort(function(t,e){return t-e});var e=Math.floor(t.length/2);return t.length%2?t[e]:(t[e-1]+t[e])/2},mode:function(t){if(0===t.length)return"none";var e,n,a={},r=1,i=[t[0]];for(e=0;e<t.length;e++)n=t[e],a[n]=a[n]?a[n]+1:1,a[n]>r?(i=[n],r=a[n]):a[n]===r&&(i.push(n),r=a[n]);return i.sort(function(t,e){return t-e})},max:function(t){return Math.max.apply(Math,t)},min:function(t){return Math.min.apply(Math,t)},range:function(t){var e=t.sort(function(t,e){return t-e});return e[t.length-1]-e[0]},variance:function(t,n){for(var a=e.equations.mean(t),r=0,i=t.length;i--;)r+=Math.pow(t[i]-a,2);return r/=t.length-(n?0:1)},varp:function(t){return e.equations.variance(t,!0)},vars:function(t){return e.equations.variance(t)},stdevs:function(t){var n=e.equations.variance(t);return Math.sqrt(n)},stdevp:function(t){var n=e.equations.variance(t,!0);return Math.sqrt(n)}},e.addWidget({id:"math",priority:100,options:{math_data:"math",math_ignore:[],math_mask:"#,##0.00",math_complete:null,math_priority:["row","above","col"],math_prefix:"",math_suffix:"",math_event:"recalculate"},init:function(t,a,r,i){r.$table.off((n.events+" updateComplete.tsmath "+i.math_event).replace(/\s+/g," ")).on(n.events+" "+i.math_event,function(a){var o="tablesorter-initialized"===a.type;"updateAll"===a.type?e.computeColumnIndex(r.$table.children("tbody").children()):(!i.math_isUpdating||o)&&n.recalculate(t,r,i,o)}).on("updateComplete.tsmath",function(){setTimeout(function(){i.math_isUpdating=!1},500)}),i.math_isUpdating=!1},remove:function(e,a,r,i){i||t(e).off((n.events+" updateComplete.tsmath "+r.math_event).replace(/\s+/g," ")).find("[data-"+r.math_data+"]").empty()}})}(jQuery);