App Engine Python SDK version 1.9.13
[gae.git] / python / google / appengine / ext / analytics / static / analytics_js.js
blobf22e50a6f77392e035fada40f0257c8557d677e2
1 /* Copyright 2008-9 Google Inc. All Rights Reserved. */ (function(){var l,m=this,n=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
2 else if("function"==b&&"undefined"==typeof a.call)return"object";return b},q=function(a){return"string"==typeof a},r=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}},aa=Date.now||function(){return+new Date},s=function(a,b){var c=a.split("."),e=m;c[0]in e||!e.execScript||e.execScript("var "+c[0]);for(var d;c.length&&(d=c.shift());)c.length||void 0===b?e=e[d]?e[d]:e[d]={}:e[d]=b},t=function(a,b){function c(){}
3 c.prototype=b.prototype;a.o=b.prototype;a.prototype=new c;a.u=function(a,c,f){return b.prototype[c].apply(a,Array.prototype.slice.call(arguments,2))}};var u=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,u);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))};t(u,Error);var ba=function(a,b){for(var c=a.split("%s"),e="",d=Array.prototype.slice.call(arguments,1);d.length&&1<c.length;)e+=c.shift()+d.shift();return e+c.join("%s")},v=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},x=function(a){a=String(a);var b=a.indexOf(".");-1==b&&(b=a.length);b=Math.max(0,2-b);return Array(b+1).join("0")+a},y=function(a,b){return a<b?-1:a>b?1:0};var z=function(a,b){b.unshift(a);u.call(this,ba.apply(null,b));b.shift()};t(z,u);var A=function(a,b,c){if(!a){var e="Assertion failed";if(b)var e=e+(": "+b),d=Array.prototype.slice.call(arguments,2);throw new z(""+e,d||[]);}};var C=Array.prototype,D=C.indexOf?function(a,b,c){A(null!=a.length);return C.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(q(a))return q(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},ca=C.forEach?function(a,b,c){A(null!=a.length);C.forEach.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=q(a)?a.split(""):a,f=0;f<e;f++)f in d&&b.call(c,d[f],f,a)},da=C.filter?function(a,b,c){A(null!=a.length);return C.filter.call(a,b,
4 c)}:function(a,b,c){for(var e=a.length,d=[],f=0,g=q(a)?a.split(""):a,h=0;h<e;h++)if(h in g){var w=g[h];b.call(c,w,h,a)&&(d[f++]=w)}return d},ea=function(a){var b=a.length;if(0<b){for(var c=Array(b),e=0;e<b;e++)c[e]=a[e];return c}return[]},E=function(a,b,c){A(null!=a.length);return 2>=arguments.length?C.slice.call(a,b):C.slice.call(a,b,c)};var F;t:{var G=m.navigator;if(G){var H=G.userAgent;if(H){F=H;break t}}F=""}var I=function(a){return-1!=F.indexOf(a)};var J=I("Opera")||I("OPR"),K=I("Trident")||I("MSIE"),L=I("Gecko")&&-1==F.toLowerCase().indexOf("webkit")&&!(I("Trident")||I("MSIE")),M=-1!=F.toLowerCase().indexOf("webkit"),N=function(){var a=m.document;return a?a.documentMode:void 0},fa=function(){var a="",b;if(J&&m.opera)return a=m.opera.version,"function"==n(a)?a():a;L?b=/rv\:([^\);]+)(\)|;)/:K?b=/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/:M&&(b=/WebKit\/(\S+)/);b&&(a=(a=b.exec(F))?a[1]:"");return K&&(b=N(),b>parseFloat(a))?String(b):a}(),ga={},O=function(a){var b;
5 if(!(b=ga[a])){b=0;for(var c=v(String(fa)).split("."),e=v(String(a)).split("."),d=Math.max(c.length,e.length),f=0;0==b&&f<d;f++){var g=c[f]||"",h=e[f]||"",w=RegExp("(\\d*)(\\D*)","g"),p=RegExp("(\\d*)(\\D*)","g");do{var k=w.exec(g)||["","",""],B=p.exec(h)||["","",""];if(0==k[0].length&&0==B[0].length)break;b=y(0==k[1].length?0:parseInt(k[1],10),0==B[1].length?0:parseInt(B[1],10))||y(0==k[2].length,0==B[2].length)||y(k[2],B[2])}while(0==b)}b=ga[a]=0<=b}return b},ha=m.document,ia=ha&&K?N()||("CSS1Compat"==
6 ha.compatMode?parseInt(fa,10):5):void 0;!L&&!K||K&&K&&9<=ia||L&&O("1.9.1");K&&O("9");var P=function(a,b,c){var e=document;c=c||e;var d=a&&"*"!=a?a.toUpperCase():"";if(c.querySelectorAll&&c.querySelector&&(d||b))return c.querySelectorAll(d+(b?"."+b:""));if(b&&c.getElementsByClassName){a=c.getElementsByClassName(b);if(d){c={};for(var f=e=0,g;g=a[f];f++)d==g.nodeName&&(c[e++]=g);c.length=e;return c}return a}a=c.getElementsByTagName(d||"*");if(b){c={};for(f=e=0;g=a[f];f++){var d=g.className,h;if(h="function"==typeof d.split)h=0<=D(d.split(/\s+/),b);h&&(c[e++]=g)}c.length=e;return c}return a};var ja=function(a){a=a.className;return q(a)&&a.match(/\S+/g)||[]},ka=function(a,b){for(var c=ja(a),e=E(arguments,1),d=c,f=0;f<e.length;f++)0<=D(d,e[f])||d.push(e[f]);c=c.join(" ");a.className=c},ma=function(a,b){var c=ja(a),e=E(arguments,1),c=la(c,e).join(" ");a.className=c},la=function(a,b){return da(a,function(a){return!(0<=D(b,a))})};var Q=function(a){Q[" "](a);return a};Q[" "]=function(){};var na=!K||K&&9<=ia,oa=K&&!O("9");!M||O("528");L&&O("1.9b")||K&&O("8")||J&&O("9.5")||M&&O("528");L&&!O("8")||K&&O("9");var R=function(a,b){this.type=a;this.currentTarget=this.target=b;this.defaultPrevented=this.j=!1};R.prototype.preventDefault=function(){this.defaultPrevented=!0};var S=function(a,b){R.call(this,a?a.type:"");this.relatedTarget=this.currentTarget=this.target=null;this.charCode=this.keyCode=this.button=this.screenY=this.screenX=this.clientY=this.clientX=this.offsetY=this.offsetX=0;this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.k=this.state=null;if(a){var c=this.type=a.type;this.target=a.target||a.srcElement;this.currentTarget=b;var e=a.relatedTarget;if(e){if(L){var d;t:{try{Q(e.nodeName);d=!0;break t}catch(f){}d=!1}d||(e=null)}}else"mouseover"==
7 c?e=a.fromElement:"mouseout"==c&&(e=a.toElement);this.relatedTarget=e;this.offsetX=M||void 0!==a.offsetX?a.offsetX:a.layerX;this.offsetY=M||void 0!==a.offsetY?a.offsetY:a.layerY;this.clientX=void 0!==a.clientX?a.clientX:a.pageX;this.clientY=void 0!==a.clientY?a.clientY:a.pageY;this.screenX=a.screenX||0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=
8 a.metaKey;this.state=a.state;this.k=a;a.defaultPrevented&&this.preventDefault()}};t(S,R);S.prototype.preventDefault=function(){S.o.preventDefault.call(this);var a=this.k;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,oa)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var pa="closure_listenable_"+(1E6*Math.random()|0),qa=0;var ra=function(a,b,c,e,d){this.c=a;this.e=null;this.src=b;this.type=c;this.g=!!e;this.f=d;this.key=++qa;this.d=this.h=!1},sa=function(a){a.d=!0;a.c=null;a.e=null;a.src=null;a.f=null};var T=function(a){this.src=a;this.b={};this.i=0};T.prototype.add=function(a,b,c,e,d){var f=a.toString();a=this.b[f];a||(a=this.b[f]=[],this.i++);var g;t:{for(g=0;g<a.length;++g){var h=a[g];if(!h.d&&h.c==b&&h.g==!!e&&h.f==d)break t}g=-1}-1<g?(b=a[g],c||(b.h=!1)):(b=new ra(b,this.src,f,!!e,d),b.h=c,a.push(b));return b};var ta=function(a,b){var c=b.type;if(c in a.b){var e=a.b[c],d=D(e,b),f;if(f=0<=d)A(null!=e.length),C.splice.call(e,d,1);f&&(sa(b),0==a.b[c].length&&(delete a.b[c],a.i--))}};var U="closure_lm_"+(1E6*Math.random()|0),V={},ua=0,wa=function(){var a=va,b=na?function(c){return a.call(b.src,b.c,c)}:function(c){c=a.call(b.src,b.c,c);if(!c)return c};return b},xa=function(a,b,c,e,d){if("array"==n(b))for(var f=0;f<b.length;f++)xa(a,b[f],c,e,d);else if(c=ya(c),a&&a[pa])a.t(b,c,e,d);else{if(!b)throw Error("Invalid event type");var f=!!e,g=W(a);g||(a[U]=g=new T(a));c=g.add(b,c,!0,e,d);c.e||(e=wa(),c.e=e,e.src=a,e.c=c,a.addEventListener?a.addEventListener(b.toString(),e,f):a.attachEvent(za(b.toString()),
9 e),ua++)}},za=function(a){return a in V?V[a]:V[a]="on"+a},Ba=function(a,b,c,e){var d=1;if(a=W(a))if(b=a.b[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.g==c&&!f.d&&(d&=!1!==Aa(f,e))}return Boolean(d)},Aa=function(a,b){var c=a.c,e=a.f||a.src;if(a.h&&"number"!=typeof a&&a&&!a.d){var d=a.src;if(d&&d[pa])ta(d.s,a);else{var f=a.type,g=a.e;d.removeEventListener?d.removeEventListener(f,g,a.g):d.detachEvent&&d.detachEvent(za(f),g);ua--;(f=W(d))?(ta(f,a),0==f.i&&(f.src=null,d[U]=null)):
10 sa(a)}}return c.call(e,b)},va=function(a,b){if(a.d)return!0;if(!na){var c;if(!(c=b))t:{c=["window","event"];for(var e=m,d;d=c.shift();)if(null!=e[d])e=e[d];else{c=null;break t}c=e}d=c;c=new S(d,this);e=!0;if(!(0>d.keyCode||void 0!=d.returnValue)){t:{var f=!1;if(0==d.keyCode)try{d.keyCode=-1;break t}catch(g){f=!0}if(f||void 0==d.returnValue)d.returnValue=!0}d=[];for(f=c.currentTarget;f;f=f.parentNode)d.push(f);for(var f=a.type,h=d.length-1;!c.j&&0<=h;h--)c.currentTarget=d[h],e&=Ba(d[h],f,!0,c);for(h=
11 0;!c.j&&h<d.length;h++)c.currentTarget=d[h],e&=Ba(d[h],f,!1,c)}return e}return Aa(a,new S(b,this))},W=function(a){a=a[U];return a instanceof T?a:null},X="__closure_events_fn_"+(1E9*Math.random()>>>0),ya=function(a){A(a,"Listener can not be null.");if("function"==n(a))return a;A(a.handleEvent,"An object listener must have handleEvent method.");a[X]||(a[X]=function(b){return a.handleEvent(b)});return a[X]};var Z=function(a,b,c){"number"==typeof a?(this.a=Ca(a,b||0,c||1),Y(this,c||1)):(b=typeof a,"object"==b&&null!=a||"function"==b?(this.a=Ca(a.getFullYear(),a.getMonth(),a.getDate()),Y(this,a.getDate())):(this.a=new Date(aa()),this.a.setHours(0),this.a.setMinutes(0),this.a.setSeconds(0),this.a.setMilliseconds(0)))},Ca=function(a,b,c){b=new Date(a,b,c);0<=a&&100>a&&b.setFullYear(b.getFullYear()-1900);return b};l=Z.prototype;l.getFullYear=function(){return this.a.getFullYear()};l.getYear=function(){return this.getFullYear()};
12 l.getMonth=function(){return this.a.getMonth()};l.getDate=function(){return this.a.getDate()};l.getTime=function(){return this.a.getTime()};l.getUTCHours=function(){return this.a.getUTCHours()};l.setFullYear=function(a){this.a.setFullYear(a)};l.setMonth=function(a){this.a.setMonth(a)};l.setDate=function(a){this.a.setDate(a)};
13 l.add=function(a){if(a.p||a.n){var b=this.getMonth()+a.n+12*a.p,c=this.getYear()+Math.floor(b/12),b=b%12;0>b&&(b+=12);var e;t:{switch(b){case 1:e=0!=c%4||0==c%100&&0!=c%400?28:29;break t;case 5:case 8:case 10:case 3:e=30;break t}e=31}e=Math.min(e,this.getDate());this.setDate(1);this.setFullYear(c);this.setMonth(b);this.setDate(e)}a.m&&(b=new Date(this.getYear(),this.getMonth(),this.getDate(),12),a=new Date(b.getTime()+864E5*a.m),this.setDate(1),this.setFullYear(a.getFullYear()),this.setMonth(a.getMonth()),
14 this.setDate(a.getDate()),Y(this,a.getDate()))};l.r=function(){return[this.getFullYear(),x(this.getMonth()+1),x(this.getDate())].join("")+""};l.toString=function(){return this.r()};var Y=function(a,b){if(a.getDate()!=b){var c=a.getDate()<b?1:-1;a.a.setUTCHours(a.a.getUTCHours()+c)}};Z.prototype.valueOf=function(){return this.a.valueOf()};var $=function(){};$.l=function(){$.q||($.q=new $)};$.l();new Z(0,0,1);new Z(9999,11,31);K||M&&O("525");$.l();s("ae.init",function(){Da();Ea();xa(window,"load",function(){});Fa()});
15 var Da=function(){var a;if(a=q("ae-content")?document.getElementById("ae-content"):"ae-content"){a=P("table","ae-table-striped",a);for(var b=0,c;c=a[b];b++){c=P("tbody",null,c);for(var e=0,d;d=c[e];e++){d=P("tr",null,d);for(var f=0,g;g=d[f];f++)f%2&&ka(g,"ae-even")}}}},Ea=function(){var a=P(null,"ae-noscript",void 0);ca(ea(a),function(a){ma(a,"ae-noscript")})},Fa=function(){m._gaq=m._gaq||[];m._gaq.push(function(){m._gaq._createAsyncTracker("UA-3739047-3","ae")._trackPageview()});(function(){var a=
16 document.createElement("script");a.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";a.setAttribute("async","true");document.documentElement.firstChild.appendChild(a)})()};s("ae.trackPageView",function(){m._gaq&&m._gaq._getAsyncTracker("ae")._trackPageview()});var Ha=function(a){if(void 0==a||null==a||0==a.length)return 0;a=Math.max.apply(Math,a);return Ga(a)},Ga=function(a){var b=5;2>b&&(b=2);b-=1;return Math.ceil(a/b)*b},Ia=function(a,b,c){a=a.getSelection();1==a.length&&(a=a[0],null!=a.row&&(null!=b.starttime&&(c+="&starttime="+b.starttime),null!=b.endtime&&(c+="&endtime="+b.endtime),null!=b.latency_lower&&(c+="&latency_lower="+b.latency_lower),null!=b.latency_upper&&(c+="&latency_upper="+b.latency_upper),b=c+"&detail="+a.row,window.location.href=b))},
17 Ja=function(a,b,c,e,d){var f=new google.visualization.DataTable;f.addColumn("string","");f.addColumn("number","");f.addColumn({type:"string",role:"tooltip"});for(var g=0;g<b.length;g++)f.addRow(["",b[g],c[g]]);c=Math.max(10*b.length,200);b=Ha(b);a=new google.visualization.ColumnChart(document.getElementById("rpctime-"+a));a.draw(f,{height:100,width:c,legend:"none",chartArea:{left:40},fontSize:11,vAxis:{minValue:0,maxValue:b,gridlines:{count:5}}});google.visualization.events.addListener(a,"select",
18 r(Ia,a,e,d))};s("ae.Charts.latencyHistogram",function(a,b,c){var e=new google.visualization.DataTable;e.addColumn("string","");e.addColumn("number","");for(var d=0;d<b.length;d++)e.addRow([""+a[d],b[d]]);for(d=b.length;d<a.length;d++)e.addRow([""+a[d],0]);b=Ha(b);(new google.visualization.ColumnChart(document.getElementById("latency-"+c))).draw(e,{legend:"none",width:20*a.length,height:200,vAxis:{maxValue:b,gridlines:{count:5}}})});
19 s("ae.Charts.latencyTimestampScatter",function(a,b,c,e,d){var f=new google.visualization.DataTable;f.addColumn("number","Time (seconds from start)");f.addColumn("number","Latency");for(var g=0;g<a.length;g++){var h=Math.round(a[g]-c);f.addRow([h,b[g]])}a=e.starttime?e.starttime:0;b=new google.visualization.ScatterChart(document.getElementById("LatencyVsTimestamp"));b.draw(f,{hAxis:{title:"Time (seconds from start of recording)",minValue:a},vAxis:{title:"Request Latency (milliseconds)",minValue:0},
20 tooltip:{trigger:"none"},legend:"none"});google.visualization.events.addListener(b,"select",r(Ia,b,e,d))});
21 s("ae.Charts.entityCountBarChart",function(a,b,c,e){var d=new google.visualization.DataTable;d.addColumn("string","");d.addColumn("number","Reads");d.addColumn({type:"string",role:"tooltip"});d.addColumn("number","Misses");d.addColumn({type:"string",role:"tooltip"});d.addColumn("number","Writes");d.addColumn({type:"string",role:"tooltip"});var f=50;f>b.length&&(f=b.length);for(var g=0;g<f;g++)d.addRow(["",b[g][1]-b[g][3],b[g][0],b[g][3],b[g][0],b[g][2],b[g][0]]);b=20*f;f=b+130;a=new google.visualization.ColumnChart(document.getElementById(e+
22 "-"+a));c=Ga(c);a.draw(d,{height:100,width:f,chartArea:{width:b},fontSize:10,isStacked:!0,vAxis:{minValue:0,maxValue:c,gridlines:{count:5}}})});
23 s("ae.Charts.rpcVariationCandlestick",function(a){var b=new google.visualization.DataTable;b.addColumn("string","");b.addColumn("number","");b.addColumn("number","");b.addColumn("number","");b.addColumn("number","");b.addRows(a);(new google.visualization.CandlestickChart(document.getElementById("rpcvariation"))).draw(b,{vAxis:{title:"RPC Latency variation (milliseconds)"},hAxis:{textPosition:"out",slantedText:!0,slantedTextAngle:45,textStyle:{fontSize:13}},height:250,chartArea:{top:10,height:100},
24 legend:"none",tooltip:{trigger:"none"}})});s("ae.Charts.totalTimeBarChart",function(a,b,c,e){for(var d=[],f=0;f<b.length;f++)d[f]=b[f]+" milliseconds";Ja(a,b,d,c,e)});s("ae.Charts.rpcTimeBarChart",function(a,b,c,e,d){var f=[],g=[],h=c.indices,w=c.times;c=c.stats;for(var p=0;p<b;p++)f[p]=0,g[p]=null;for(p=0;p<h.length;p++){f[h[p]]=w[p];b=c[p];var k="Calls: "+b[0];if(0<b[1]||0<b[2]||0<b[3])k+=" Entities";0<b[1]&&(k+=" R:"+b[1]);0<b[2]&&(k+=" W:"+b[2]);0<b[3]&&(k+=" M:"+b[3]);g[h[p]]=k}Ja(a,f,g,e,d)});})();