Array.prototype.Where=function(n,t){var r=[],i,u;if(typeof n=="function")for(i=0;i<this.length;i++)n(this[i])&&r.push(this[i]);else for(i=0,u=this.length;i<u;i++)this[i][n]===t&&r.push(this[i]);return r};Array.prototype.GroupBy=function(n){for(var i=[],t=0,r=this.length;t<r;t++)i[this[t][n]]||(i[this[t][n]]=[]),i[this[t][n]].push(this[t]);return i};Array.prototype.filter=function(n,t){var u,i,r,f,e;if(n=n||"Id",u=[],typeof n=="function")for(i=0,r=this.length;i<r;i++)n(this[i])&&u.push(this[i]);else for(t.constructor!==Array&&(t=[t]),i=0,r=this.length;i<r;i++)for(f=0,e=t.length;f<e;f++)this[i][n]==t[f]&&u.push(this[i]);return u};Array.prototype.first=function(n){if(typeof n=="function")for(var t=0,i=this.length;t<i;t++)if(n(this[t]))return this[t];return null};Array.prototype.initMap=function(){this.map=[];for(var n=0;n<this.length;n++)this.map[this[n].Id]=this[n]};Array.prototype.Max=function(n){var i=this[0],t,r;if(n&&i[n]!=="undefined"){for(i=i[n],t=0,r=this.length;t<r;t++)i<this[t][n]&&(i=this[t][n]);return i}for(t=0,r=this.length;t<r;t++)i<this[t]&&(i=this[t]);return i};Array.prototype.Min=function(n){var i=this[0],t,r;if(n&&i[n]!=="undefined"){for(i=i[n],t=0,r=this.length;t<r;t++)i>this[t][n]&&(i=this[t][n]);return i}for(t=0,r=this.length;t<r;t++)i>this[t]&&(i=this[t]);return i};Array.prototype.Sum=function(n){for(var i=0,t=0;t<this.length;t++)n(this[t])&&(i+=n(this[t]));return i};String.prototype.Format=function(){var t=this.valueOf(),n,i;if(arguments.length>0)for(n=0,i=arguments.length;n<i;n++)(typeof arguments[n]=="string"||typeof arguments[n]=="number")&&(t=t.replace(new RegExp("\\{"+n+"\\}","g"),arguments[n]));return t};String.prototype.parseDate=function(offset){try{var d=eval(this.replace(/\/(Date\([0-9-]+\))\//gi,"new $1")),utc=d.getTime()+d.getTimezoneOffset()*6e4;return offset=offset||0,new Date(utc+36e5*offset)}catch(e){return null}}