d26b395fwzu5fz.cloudfront.net
Open in
urlscan Pro
18.66.188.98
Public Scan
URL:
https://d26b395fwzu5fz.cloudfront.net/2.1.2/keen.min.js
Submission: On January 16 via api from LU — Scanned from DE
Submission: On January 16 via api from LU — Scanned from DE
Form analysis
0 forms found in the DOMText Content
"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(a){return 10>a?"0"+a:a}function quote(a){return escapable.lastIndex=0,escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g,h=gap,i=b[a];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(a)),"function"==typeof rep&&(i=rep.call(b,a,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";if(gap+=indent,g=[],"[object Array]"===Object.prototype.toString.apply(i)){for(f=i.length,c=0;f>c;c+=1)g[c]=str(c,i)||"null";return e=0===g.length?"[]":gap?"[\n"+gap+g.join(",\n"+gap)+"\n"+h+"]":"["+g.join(",")+"]",gap=h,e}if(rep&&"object"==typeof rep)for(f=rep.length,c=0;f>c;c+=1)"string"==typeof rep[c]&&(d=rep[c],e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));else for(d in i)Object.prototype.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&g.push(quote(d)+(gap?": ":":")+e));return e=0===g.length?"{}":gap?"{\n"+gap+g.join(",\n"+gap)+"\n"+h+"}":"{"+g.join(",")+"}",gap=h,e}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;"function"!=typeof JSON.stringify&&(JSON.stringify=function(a,b,c){var d;if(gap="",indent="","number"==typeof c)for(d=0;c>d;d+=1)indent+=" ";else"string"==typeof c&&(indent=c);if(rep=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return str("",{"":a})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&"object"==typeof e)for(c in e)Object.prototype.hasOwnProperty.call(e,c)&&(d=walk(e,c),void 0!==d?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;if(text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})),/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),function(a,b){"object"==typeof exports?module.exports=b():"function"==typeof define&&define.amd?define("spinner",b):a.Spinner=b()}(this,function(){"use strict";function a(a,b){var c,d=document.createElement(a||"div");for(c in b)d[c]=b[c];return d}function b(a){for(var b=1,c=arguments.length;c>b;b++)a.appendChild(arguments[b]);return a}function c(a,b,c,d){var e=["opacity",b,~~(100*a),c,d].join("-"),f=.01+c/d*100,g=Math.max(1-(1-a)/b*(100-f),a),h=j.substring(0,j.indexOf("Animation")).toLowerCase(),i=h&&"-"+h+"-"||"";return l[e]||(m.insertRule("@"+i+"keyframes "+e+"{0%{opacity:"+g+"}"+f+"%{opacity:"+a+"}"+(f+.01)+"%{opacity:1}"+(f+b)%100+"%{opacity:"+a+"}100%{opacity:"+g+"}}",m.cssRules.length),l[e]=1),e}function d(a,b){var c,d,e=a.style;if(void 0!==e[b])return b;for(b=b.charAt(0).toUpperCase()+b.slice(1),d=0;d<k.length;d++)if(c=k[d]+b,void 0!==e[c])return c}function e(a,b){for(var c in b)a.style[d(a,c)||c]=b[c];return a}function f(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)void 0===a[d]&&(a[d]=c[d])}return a}function g(a){for(var b={x:a.offsetLeft,y:a.offsetTop};a=a.offsetParent;)b.x+=a.offsetLeft,b.y+=a.offsetTop;return b}function h(a){return"undefined"==typeof this?new h(a):void(this.opts=f(a||{},h.defaults,n))}function i(){function c(b,c){return a("<"+b+' xmlns="urn:schemas-microsoft.com:vml" class="spin-vml">',c)}m.addRule(".spin-vml","behavior:url(#default#VML)"),h.prototype.lines=function(a,d){function f(){return e(c("group",{coordsize:j+" "+j,coordorigin:-i+" "+-i}),{width:j,height:j})}function g(a,g,h){b(l,b(e(f(),{rotation:360/d.lines*a+"deg",left:~~g}),b(e(c("roundrect",{arcsize:d.corners}),{width:i,height:d.width,left:d.radius,top:-d.width>>1,filter:h}),c("fill",{color:d.color,opacity:d.opacity}),c("stroke",{opacity:0}))))}var h,i=d.length+d.width,j=2*i,k=2*-(d.width+d.length)+"px",l=e(f(),{position:"absolute",top:k,left:k});if(d.shadow)for(h=1;h<=d.lines;h++)g(h,-2,"progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)");for(h=1;h<=d.lines;h++)g(h);return b(a,l)},h.prototype.opacity=function(a,b,c,d){var e=a.firstChild;d=d.shadow&&d.lines||0,e&&b+d<e.childNodes.length&&(e=e.childNodes[b+d],e=e&&e.firstChild,e=e&&e.firstChild,e&&(e.opacity=c))}}var j,k=["webkit","Moz","ms","O"],l={},m=function(){var c=a("style",{type:"text/css"});return b(document.getElementsByTagName("head")[0],c),c.sheet||c.styleSheet}(),n={lines:12,length:7,width:5,radius:10,rotate:0,corners:1,color:"#000",direction:1,speed:1,trail:100,opacity:.25,fps:20,zIndex:2e9,className:"spinner",top:"auto",left:"auto",position:"relative"};h.defaults={},f(h.prototype,{spin:function(b){this.stop();var c,d,f=this,h=f.opts,i=f.el=e(a(0,{className:h.className}),{position:h.position,width:0,zIndex:h.zIndex}),k=h.radius+h.length+h.width;if(b&&(b.insertBefore(i,b.firstChild||null),d=g(b),c=g(i),e(i,{left:("auto"==h.left?d.x-c.x+(b.offsetWidth>>1):parseInt(h.left,10)+k)+"px",top:("auto"==h.top?d.y-c.y+(b.offsetHeight>>1):parseInt(h.top,10)+k)+"px"})),i.setAttribute("role","progressbar"),f.lines(i,f.opts),!j){var l,m=0,n=(h.lines-1)*(1-h.direction)/2,o=h.fps,p=o/h.speed,q=(1-h.opacity)/(p*h.trail/100),r=p/h.lines;!function s(){m++;for(var a=0;a<h.lines;a++)l=Math.max(1-(m+(h.lines-a)*r)%p*q,h.opacity),f.opacity(i,a*h.direction+n,l,h);f.timeout=f.el&&setTimeout(s,~~(1e3/o))}()}return f},stop:function(){var a=this.el;return a&&(clearTimeout(this.timeout),a.parentNode&&a.parentNode.removeChild(a),this.el=void 0),this},lines:function(d,f){function g(b,c){return e(a(),{position:"absolute",width:f.length+f.width+"px",height:f.width+"px",background:b,boxShadow:c,transformOrigin:"left",transform:"rotate("+~~(360/f.lines*i+f.rotate)+"deg) translate("+f.radius+"px,0)",borderRadius:(f.corners*f.width>>1)+"px"})}for(var h,i=0,k=(f.lines-1)*(1-f.direction)/2;i<f.lines;i++)h=e(a(),{position:"absolute",top:1+~(f.width/2)+"px",transform:f.hwaccel?"translate3d(0,0,0)":"",opacity:f.opacity,animation:j&&c(f.opacity,f.trail,k+i*f.direction,f.lines)+" "+1/f.speed+"s linear infinite"}),f.shadow&&b(h,e(g("#000","0 0 4px #000"),{top:"2px"})),b(d,b(h,g(f.color,"0 0 1px rgba(0,0,0,.1)")));return d},opacity:function(a,b,c){b<a.childNodes.length&&(a.childNodes[b].style.opacity=c)}});var o=e(a("group"),{behavior:"url(#default#VML)"});return!d(o,"transform")&&o.adj?i():j=d(o,"animation"),h}),window.Keen=window.Keen||{},function(){function a(){return"undefined"==typeof XMLHttpRequest?!1:"withCredentials"in new XMLHttpRequest}function b(a,b,c,d,e,f,g){var h=new XMLHttpRequest;if(h.onreadystatechange=function(){if(4==h.readyState)if(h.status>=200&&h.status<300){var a;try{a=JSON.parse(h.responseText)}catch(b){console.log("Could not JSON parse HTTP response: "+h.responseText),g&&g(h,b)}a&&f&&f(a)}else console.log("HTTP request failed."),g&&g(h,null)},h.open(a,b,!0),e&&h.setRequestHeader("Authorization",e),d&&h.setRequestHeader("Content-Type","application/json"),c)for(var i in c)c.hasOwnProperty(i)&&h.setRequestHeader(i,c[i]);var j=d?JSON.stringify(d):null;h.send(j)}function c(a,b,c,d){if(b&&a.indexOf("api_key")<0){var e=a.indexOf("?")>0?"&":"?";a=a+e+"api_key="+b}for(var f="keenJSONPCallback"+(new Date).getTime();f in window;)f+="a";var g=!1;window[f]=function(a){g=!0,c&&a&&c(a),window[f]=void 0},a=a+"&jsonp="+f;var h=document.createElement("script");h.id="keen-jsonp",h.src=a,document.getElementsByTagName("head")[0].appendChild(h),h.onreadystatechange=function(){g===!1&&"loaded"===this.readyState&&(g=!0,d&&d())},h.onerror=function(){g===!1&&(g=!0,d&&d())}}function d(a,b,c,d,f){var g=null,h="object"==typeof c.attributes.timeframe;if("string"==typeof c.attributes.timezone){var i=d.result[0].timeframe.start,j=new Date(i),k=j.getUTCHours(),l=j.getUTCMinutes(),m=i.slice(i.length-6,i.length).slice(0,1),n=60*k+l;"-"===m&&(n=-n),g=n}else g=c.attributes.timezone/60;var o="";if(void 0!=c&&void 0!=c.attributes&&void 0!=c.attributes.timezone&&a.setMinutes(a.getMinutes()+a.getTimezoneOffset()+g),"daily"==b||-1!=b.indexOf("day")){if(h&&d.result.length>1&&0==f){var p=e(d.result[1].timeframe.start);p.getDate()==a.getDate()&&a.setDate(a.getDate()-1)}o+=1+a.getMonth(),o+="/",o+=a.getDate()}else"weekly"==b||-1!=b.indexOf("week")?(o+=1+a.getMonth(),o+="/",o+=a.getDate()):"hourly"==b||-1!=b.indexOf("hours")?(o+=a.getHours(),o+=":",o+="00"):"monthly"==b||-1!=b.indexOf("month")?(o+=1+a.getMonth(),o+="/",o+=(a.getFullYear()+"").slice(-2)):"minutely"==b||-1!=b.indexOf("minute")?(o+=a.getHours(),o+=":",o+=("0"+a.getMinutes()).slice(-2)):console.log("Invalid interval: "+b);return o}function e(a){var b,c,d=[1,4,5,6,7,10,11],e=0;if(c=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(a)){for(var f,g=0;f=d[g];++g)c[f]=+c[f]||0;c[2]=(+c[2]||1)-1,c[3]=+c[3]||1,"Z"!==c[8]&&void 0!==c[9]&&(e=60*c[10]+c[11],"+"===c[9]&&(e=0-e)),b=Date.UTC(c[1],c[2],c[3],c[4],c[5]+e,c[6],c[7])}else b=Date.parse?Date.parse(a):0/0;return new Date(b)}function f(){return-60*(new Date).getTimezoneOffset()}function g(a){return _.each(a,function(b,c){_.isUndefined(b)&&delete a[c]}),_.map(a,function(a,b){return _.isString(a)||(a=JSON.stringify(a)),a=encodeURIComponent(a),b+"="+a}).join("&")}var h=!1;("undefined"==typeof console||"undefined"==typeof console.log)&&(console={},console.log=h?function(a){alert(a)}:function(){});var i=function(){};if(i.extend=function(a,b){var c=i.prototype.extend;i._prototyping=!0;var d=new this;c.call(d,a),d.base=function(){},delete i._prototyping;var e=d.constructor,f=d.constructor=function(){if(!i._prototyping)if(this._constructing||this.constructor==f)this._constructing=!0,e.apply(this,arguments),delete this._constructing;else if(null!=arguments[0])return(arguments[0].extend||c).call(arguments[0],d)};return f.ancestor=this,f.extend=this.extend,f.forEach=this.forEach,f.implement=this.implement,f.prototype=d,f.toString=this.toString,f.valueOf=function(a){return"object"==a?f:e.valueOf()},c.call(f,b),"function"==typeof f.init&&f.init(),f},i.prototype={extend:function(a,b){if(arguments.length>1){var c=this[a];if(c&&"function"==typeof b&&(!c.valueOf||c.valueOf()!=b.valueOf())&&/\bbase\b/.test(b)){var d=b.valueOf();b=function(){var a=this.base||i.prototype.base;this.base=c;var b=d.apply(this,arguments);return this.base=a,b},b.valueOf=function(a){return"object"==a?b:d},b.toString=i.toString}this[a]=b}else if(a){var e=i.prototype.extend;i._prototyping||"function"==typeof this||(e=this.extend||e);for(var f={toSource:null},g=["constructor","toString","valueOf"],h=i._prototyping?0:1;j=g[h++];)a[j]!=f[j]&&e.call(this,j,a[j]);for(var j in a)f[j]||e.call(this,j,a[j])}return this}},i=i.extend({constructor:function(){this.extend(arguments[0])}},{ancestor:Object,version:"1.1",forEach:function(a,b,c){for(var d in a)void 0===this.prototype[d]&&b.call(c,a[d],d,a)},implement:function(){for(var a=0;a<arguments.length;a++)"function"==typeof arguments[a]?arguments[a](this.prototype):this.prototype.extend(arguments[a]);return this},toString:function(){return String(this.valueOf())}}),Keen.configure=function(a){return this.client=new Keen.Client(a),this.client},Keen.addEvent=function(a,b,c,d){this.client&&this.client.uploadEvent(a,b,c,d)},Keen.trackExternalLink=function(a,b,c,d,e){var f=a,g=null,h=!1;a.nodeName?window.event&&1==window.event.metaKey&&(h=!0):(g=a,f=g.target,h=a.metaKey||!1),void 0===d&&(d=500);var i=!1,j=function(){};return"A"===f.nodeName?j=function(){h||i||(i=!0,window.location=f.href)}:"FORM"===f.nodeName&&(j=function(){i||(i=!0,f.submit())}),e&&(j=function(){i||(i=!0,e())}),Keen.addEvent(b,c,j,j),setTimeout(function(){j()},d),h?void 0:!1},Keen.getEventCollections=function(a,b){var c=this.client.getKeenUrl("/events");this.client.getJSON(c,a,b)},Keen.getEventCollectionProperties=function(a,b,c){var d=this.client.getKeenUrl("/events/"+a);this.client.getJSON(d,b,c)},Keen.setGlobalProperties=function(a){if(this.client){if(!a||"function"!=typeof a)throw new Error("Invalid value for global properties: "+a);this.client.globalProperties=a}},Keen.addChartsReadyHandler=function(a){"undefined"==typeof this.chartsReadyHandlers&&(this.chartsReadyHandlers=[]),this.chartsReadyHandlers.push(a),this.chartsReady&&this.runChartsReadyHandlers()},Keen.onChartsReady=function(a){this.chartsReady?a():(this.addChartsReadyHandler(a),this.loadChartsDependencies())},Keen.runChartsReadyHandlers=function(){_.each(this.chartsReadyHandlers,function(a){a()},this)},Keen.loadChartsDependencies=function(){if(!this.startedLoadingChartsDependencies){this.startedLoadingChartsDependencies=!0;var a=function(a,b){var c,d=document,e=d.head||d.getElementsByTagName("head");setTimeout(function(){if("item"in e){if(!e[0])return void setTimeout(arguments.callee,25);e=e[0]}var c=d.createElement("script"),f=!1;c.onload=c.onreadystatechange=function(){return c.readyState&&"complete"!==c.readyState&&"loaded"!==c.readyState||f?!1:(c.onload=c.onreadystatechange=null,f=!0,void b())},c.src=a,e.insertBefore(c,e.firstChild)},0),null==d.readyState&&d.addEventListener&&(d.readyState="loading",d.addEventListener("DOMContentLoaded",c=function(){d.removeEventListener("DOMContentLoaded",c,!1),d.readyState="complete"},!1))},b=this,c=function(){b.chartsReady=!0,b.runChartsReadyHandlers()},d=function(){"undefined"==typeof google?console.log("Problem loading visualizations. Please contact us!"):google.load("visualization","1.0",{packages:["corechart"],callback:c})};a("https://www.google.com/jsapi",function(){"undefined"==typeof _?a("https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.2/underscore-min.js",d):d()})}},Keen.Client=function(a){if("undefined"==typeof a.projectId||!a.projectId)throw new Error("Configuration must include a valid projectId");this.projectId=a.projectId,this.writeKey=a.writeKey,this.readKey=a.readKey,this.globalProperties=null,this.keenUrl="https://api.keen.io",void 0!==a&&void 0!==a.keenUrl&&(this.keenUrl=a.keenUrl)},Keen.Client.prototype.uploadEvent=function(d,e,f,g){var h=this.getKeenUrl("/events/"+d),i={};this.globalProperties&&(i=this.globalProperties(d));for(var j in e)e.hasOwnProperty(j)&&(i[j]=e[j]);if(a())b("POST",h,null,i,this.writeKey,f,g);else{var k=JSON.stringify(i),l=Keen.Base64.encode(k);h=h+"?api_key="+this.writeKey,h=h+"&data="+l,h=h+"&modified="+(new Date).getTime(),c(h,null,f,g)}},Keen.Client.prototype.getKeenUrl=function(a){return this.keenUrl+"/3.0/projects/"+this.projectId+a},Keen.Client.prototype.getJSON=function(d,e,f){a()?b("GET",d,null,null,this.readKey,e,f):c(d,this.readKey,e,f)},Keen.Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Keen.Base64._utf8_encode(a);j<a.length;)b=a.charCodeAt(j++),c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=b>>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+Keen.Base64._keyStr.charAt(e)+Keen.Base64._keyStr.charAt(f)+Keen.Base64._keyStr.charAt(g)+Keen.Base64._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j<a.length;)e=Keen.Base64._keyStr.indexOf(a.charAt(j++)),f=Keen.Base64._keyStr.indexOf(a.charAt(j++)),g=Keen.Base64._keyStr.indexOf(a.charAt(j++)),h=Keen.Base64._keyStr.indexOf(a.charAt(j++)),b=e<<2|f>>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!=g&&(i+=String.fromCharCode(c)),64!=h&&(i+=String.fromCharCode(d));return i=Keen.Base64._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b},_utf8_decode:function(a){for(var b="",c=0,d=c1=c2=0;c<a.length;)d=a.charCodeAt(c),128>d?(b+=String.fromCharCode(d),c++):d>191&&224>d?(c2=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&c2),c+=2):(c2=a.charCodeAt(c+1),c3=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&c2)<<6|63&c3),c+=3);return b}},Keen._cf&&(Keen.configure(Keen._cf),Keen._cf=null),Keen._gp&&(Keen.setGlobalProperties(Keen._gp),Keen._gp=null),Keen._eq&&Keen._eq.length>0){for(var j=0;j<Keen._eq.length;j++){var k=Keen._eq[j].shift(),l=Keen._eq[j].shift(),m=Keen._eq[j].shift(),n=Keen._eq[j].shift();Keen.addEvent(k,l,m,n)}Keen._eq=null}if(Keen._ocrq&&Keen._ocrq.length>0){for(var j=0;j<Keen._ocrq.length;j++){var o=Keen._ocrq[j];Keen.onChartsReady(o)}Keen._ocrq=null}Keen.BaseVisualization=i.extend({}),Keen.BaseVisualization.prototype.getLabel=function(){if(_.isUndefined(this.options.label)||null==this.options.label){if(_.isUndefined(this.query.queryName)){var a="";return a+=this.query.attributes.analysisType,a+=" - ",a+=this.query.attributes.eventCollection}return this.query.queryName}return this.options.label},Keen.Number=Keen.BaseVisualization.extend({constructor:function(a,b){this.query=a,this.options={height:"150px",width:"300px","font-family":"'Helvetica Neue', Helvetica, Arial, sans-serif",color:"white","border-radius":"0px","number-background-color":"#7dcc77","label-background-color":"#9CD898",prefix:"",suffix:""},this.options=_.extend(this.options,b)}}),Keen.Number.prototype.draw=function(a,b){var c=function(a){return+a.replace(/[^\d.-]+/gi,"")},d=function(a){return a.replace(/[^A-Za-z%]+/gi,"")};a.innerHTML="";var e=document.createElement("div");a.appendChild(e),e.style.width=this.options.width,e.style.height=this.options.height,e.style.display="block",e.style.textAlign="center",e.style.backgroundColor=this.options["number-background-color"],e.style.borderRadius=this.options["border-radius"];var f=document.createElement("h1");e.appendChild(f);var g=document.createTextNode("Loading...");f.style.fontSize=8*c(this.options.height)/15*.5+d(this.options.height),f.appendChild(g),f.style.height=2*c(this.options.height)/3+d(this.options.height),f.style.lineHeight=f.style.height,f.style.color=this.options.color,f.style.fontWeight="bold",f.style.fontFamily=this.options["font-family"],f.style.margin=0,f.style.padding=0,f.style.textShadow="none";var h=document.createElement("h2");h.appendChild(document.createTextNode(this.getLabel())),e.appendChild(h),h.style.height=c(this.options.height)/3+d(this.options.height),h.style.lineHeight=h.style.height,h.style.fontSize=c(this.options.height)/3*.32+d(this.options.height),h.style.color=f.style.color,h.style.textTransform="uppercase",h.style.fontWeight="normal",h.style.fontFamily=f.style.fontFamily,h.style.margin=0,h.style.padding=0,h.style.borderTop="1px solid",h.style.borderTopColor=this.options.color,h.style.backgroundColor=this.options["label-background-color"],h.style.textShadow="none";var i=_.bind(function(a){this.data=a.result,null==this.data&&(this.data=0),f.replaceChild(document.createTextNode(this.options.prefix+Keen.prettyNumber(this.data)+this.options.suffix),g),f.style.fontSize=8*c(this.options.height)/15+d(this.options.height),null==this.data&&(this.data=0)},this);_.isUndefined(b)?this.query.getResponse(i):i(b)},Keen.LineChart=Keen.BaseVisualization.extend({constructor:function(a,b){this.query=a,this.options={chartAreaHeight:null,chartAreaWidth:null,chartAreaLeft:null,chartAreaTop:null,height:300,width:600,lineWidth:5,color:"#00afd7",backgroundColor:"white",title:null,label:null,xAxisLabel:null,yAxisLabel:null,yAxisMin:0,yAxisMax:null,viewMode:null,showLegend:!0,xAxisLabelAngle:null,font:"Arial",override:{}},this.options=_.extend(this.options,b),this.client=_.isUndefined(this.options.client)?Keen.client:this.options.client}}),Keen.LineChart.prototype.draw=function(a,b){a.innerHTML="",a.style.width=this.options.width+"px",a.style.height=this.options.height+"px",a.style.display="block",Keen.showLoading(a);var c=function(a){var b={};return b.height=a.height,b.width=a.width,b.lineWidth=a.lineWidth,b.colors=[a.color],b.backgroundColor=a.backgroundColor,b.title=a.title,b.fontName=a.font,b.hAxis={title:a.xAxisLabel,viewWindow:{}},b.vAxis={title:a.yAxisLabel,viewWindow:{}},null!=a.yAxisMin&&(b.vAxis.viewWindow.min=a.yAxisMin),null!=a.yAxisMax&&(b.vAxis.viewWindow.max=a.yAxisMax),a.showLegend||(b.legend={position:"none"}),null!=a.xAxisLabelAngle&&(b.hAxis.slantedText=!0,b.hAxis.slantedTextAngle=a.xAxisLabelAngle),b.chartArea={left:a.chartAreaLeft,top:a.chartAreaTop,height:a.chartAreaHeight,width:a.chartAreaWidth},null!=a.override&&(b=_.extend(b,a.override)),b},f=_.bind(function(b){this.data=b.result;var f=new google.visualization.DataTable;f.addColumn("string","Date"),f.addColumn("number",this.getLabel());var g=0;if(f.addRows(_.map(this.data,function(a){var c=e(a.timeframe.start),f=d(c,this.query.attributes.interval,this.query,b,g);return g++,null==a.value&&(a.value=0),[f,a.value]},this)),google){var h=new google.visualization.AreaChart(a),i=c(this.options);h.draw(f,i)}else console.log("Charting is not yet ready. Are you waiting for onChartsReady?")},this);_.isUndefined(b)?this.query.getResponse(f):f(b)},Keen.MultiLineChart=Keen.BaseVisualization.extend({constructor:function(a,b){this.query=a,this.options={height:300,width:600,chartAreaHeight:null,chartAreaWidth:null,chartAreaLeft:null,chartAreaTop:null,title:null,showLegend:!0,colors:null,lineWidth:5,backgroundColor:"white",fontColor:"black",font:null,xAxisLabel:null,yAxisLabel:null,xAxisLabelAngle:null,labelMapping:{}},this.options=_.extend(this.options,b),this.client=_.isUndefined(this.options.client)?Keen.client:this.options.client}}),Keen.MultiLineChart.prototype.draw=function(a,b){a.innerHTML="",a.style.width=this.options.width+"px",a.style.height=this.options.height+"px",a.style.display="block",Keen.showLoading(a);var c=[],f=function(a){var b={};return b.height=a.height,b.width=a.width,b.lineWidth=a.lineWidth,b.colors=a.colors,b.backgroundColor=a.backgroundColor,b.title=a.title,b.fontName=a.font,b.hAxis={title:a.xAxisLabel},b.vAxis={title:a.yAxisLabel,viewWindow:{min:0}},a.showLegend||(b.legend={position:"none"}),null!=a.xAxisLabelAngle&&(b.hAxis.slantedText=!0,b.hAxis.slantedTextAngle=a.xAxisLabelAngle),b.chartArea={left:a.chartAreaLeft,top:a.chartAreaTop,height:a.chartAreaHeight,width:a.chartAreaWidth},b.series=c,b},g=_.bind(function(b){this.data=b.result;var g=[];_.each(this.data[0].value,function(a){g.push(null!=this.options.labelMapping[a[this.query.attributes.groupBy]]?this.options.labelMapping[a[this.query.attributes.groupBy]]+"":a[this.query.attributes.groupBy]+"");var b={};this.options.colorMapping&&this.options.colorMapping[a[this.query.attributes.groupBy]]&&(b.color=this.options.colorMapping[a[this.query.attributes.groupBy]]),c.push(b)},this),0==g.length&&(g.push(""),this.options.showLegend=!1);var h=new google.visualization.DataTable;if(h.addColumn("string","Date"),_.each(g,function(a){h.addColumn("number",a)}),_.each(this.data,function(a){var c=[],f=e(a.timeframe.start),g=d(f,this.query.attributes.interval,this.query,b);c.push(g),_.each(a.value,function(a){null==a.result&&(a.result=0),c.push(a.result)},this),1==c.length&&c.push(null),h.addRow(c)},this),google){var i=new google.visualization.LineChart(a),j=f(this.options);i.draw(h,j)}else console.log("Charting is not yet ready. Are you waiting for onChartsReady?")},this);_.isUndefined(b)?this.query.getResponse(g):g(b)},Keen.PieChart=Keen.BaseVisualization.extend({constructor:function(a,b){this.query=a,this.options={height:300,width:600,chartAreaHeight:null,chartAreaWidth:null,chartAreaLeft:null,chartAreaTop:null,minimumSlicePercentage:"1",title:null,showLegend:!0,colors:null,backgroundColor:"white",font:null,fontColor:"black",labelMapping:{},colorMapping:{},pieSliceText:"percentage"},this.options=_.extend(this.options,b),this.client=_.isUndefined(this.options.client)?Keen.client:this.options.client}}),Keen.PieChart.prototype.draw=function(a,b){a.innerHTML="",a.style.width=this.options.width+"px",a.style.height=this.options.height+"px",a.style.display="block",Keen.showLoading(a);var c=[],d=function(a){var b={};return b.legend={},b.height=a.height,b.width=a.width,b.title=a.title,b.sliceVisibilityThreshold=.01*a.minimumSlicePercentage,b.colors=a.colors,b.backgroundColor=a.backgroundColor,a.showLegend||(b.legend.position="none"),b.fontName=a.font,b.titleTextStyle={color:a.fontColor},b.legend.textStyle={color:a.fontColor},b.pieSliceText=a.pieSliceText,b.chartArea={left:a.chartAreaLeft,top:a.chartAreaTop,height:a.chartAreaHeight,width:a.chartAreaWidth},b.slices=c,b},e=_.bind(function(b){this.data=b.result;var e=new google.visualization.DataTable;if(e.addColumn("string","Group By"),e.addColumn("number",this.getLabel()),_.each(this.data,function(a){var b="";b=null!=this.options.labelMapping[a[this.query.attributes.groupBy]]?this.options.labelMapping[a[this.query.attributes.groupBy]]:a[this.query.attributes.groupBy]+"";var d=a.result,f={};this.options.colorMapping&&this.options.colorMapping[b]&&(f.color=this.options.colorMapping[b]),c.push(f),e.addRow([b,d])},this),google){var f=new google.visualization.PieChart(a);f.draw(e,d(this.options))}else console.log("Charting is not yet ready. Are you waiting for onChartsReady?")},this);_.isUndefined(b)?this.query.getResponse(e):e(b)},Keen.FunnelChart=Keen.BaseVisualization.extend({constructor:function(a,b){this.query=a,this.options={height:300,width:600,chartAreaHeight:null,chartAreaWidth:null,chartAreaLeft:null,chartAreaTop:null,title:null,showLegend:!1,color:"#f35757",backgroundColor:"white",fontColor:"black",font:"Arial"},this.options=_.extend(this.options,b),this.client=_.isUndefined(this.options.client)?Keen.client:this.options.client}}),Keen.FunnelChart.prototype.draw=function(a,b){a.innerHTML="",a.style.width=this.options.width+"px",a.style.height=this.options.height+"px",a.style.display="block",Keen.showLoading(a);var c=function(a){var b={};return b.legend={},b.height=a.height,b.width=a.width,b.title=a.title,b.colors=[a.color],b.fontName=a.font,b.backgroundColor=a.backgroundColor,a.showLegend||(b.legend.position="none"),b.titleTextStyle={color:a.fontColor},b.legend.textStyle={color:a.fontColor},b.chartArea={left:a.chartAreaLeft,top:a.chartAreaTop,height:a.chartAreaHeight,width:a.chartAreaWidth},b.vAxis={viewWindow:{min:0},format:"#"},b.bar={groupWidth:"90%"},b},d=_.bind(function(b){this.numbers=b.result,this.steps=b.steps;var d=new google.visualization.DataTable;d.addColumn("string","Action"),d.addColumn("number","Count");for(var e=null,f=0;f<this.numbers.length;f++){null==e&&(e=this.numbers[f]);var g=0===e?0:Math.round(this.numbers[f]/e*100),h=this.steps[f].event_collection;_.isUndefined(this.query.steps[f].name)||(h=this.query.steps[f].name),d.addRow([h+" ("+g+"%)",this.numbers[f]])}if(google){var i=new google.visualization.ColumnChart(a);i.draw(d,c(this.options))}else console.log("Charting is not yet ready. Are you waiting for onChartsReady?")},this);_.isUndefined(b)?this.query.getResponse(d):d(b)},Keen.BaseQuery=i.extend({getResponse:function(a){function b(b){return a(b)}function c(a,b){console.log("got an error:"),console.log(a),console.log(b)}if(_.isUndefined(this.client.readKey))console.log("Error: Please add a readKey to Keen.configure() to perform analysis.");else{var d=this.getPath(),e=this.buildParams();d+="?",d+=g(e);var f=this.client.getKeenUrl(d);this.client.getJSON(f,b,c)}},getPath:function(){console.log("getPath() must be overridden")},buildParams:function(){console.log("buildParams() must be overridden")}}),Keen.SavedQuery=Keen.BaseQuery.extend({constructor:function(a,b){this.queryName=a,this.client=b?b:Keen.client},getPath:function(){return"/saved_queries/"+encodeURIComponent(this.queryName)+"/result"},buildParams:function(){return{api_key:this.client.readKey}}}),Keen.AdHocQuery=Keen.BaseQuery.extend({constructor:function(a,b,c){_.isUndefined(b)&&(b={});var d=_.defaults(b,{filters:[]});d.eventCollection=a,_.isUndefined(d.timezone)&&(d.timezone=f()),this.attributes={},_.extend(this.attributes,d),this.client=c?c:Keen.client},getPath:function(){return"/queries/"+this.attributes.analysisType},buildParams:function(){return{api_key:this.client.readKey,event_collection:this.attributes.eventCollection,filters:this.attributes.filters,timeframe:this.attributes.timeframe,timezone:this.attributes.timezone,target_property:this.attributes.targetProperty,group_by:this.attributes.groupBy,latest:this.attributes.latest}}}),Keen.AdHocQuery.prototype.addFilter=function(a,b,c){return this.attributes.filters.push({property_name:a,operator:b,property_value:c}),this},Keen.AdHocQuery.prototype.timeframe=function(a){return this.attributes.timeframe=a,this},Keen.AdHocQuery.prototype.latest=function(a){return this.attributes.latest=a,this},Keen.AdHocQuery.prototype.timezone=function(a){return this.attributes.timezone=a,this},Keen.AdHocQuery.prototype.analysisType=function(a){return this.attributes.analysisType=a,this},Keen.AdHocQuery.prototype.targetProperty=function(a){return this.attributes.targetProperty=a,this},Keen.AdHocQuery.prototype.groupBy=function(a){return this.attributes.groupBy=a,this},Keen.Funnel=Keen.BaseQuery.extend({constructor:function(a,b,c){_.isUndefined(b)&&(b={}),this.attributes=b,_.isUndefined(a)&&(a=[]),this.steps=a;for(var d=0;d<this.steps.length;d++)this.steps[d]=this.steps[d].buildParams();_.isUndefined(this.attributes.timezone)&&(this.attributes.timezone=f()),this.client=c?c:Keen.client},getPath:function(){return"/queries/funnel"},buildParams:function(){if(!_.isUndefined(this.attributes.actorProperty))for(var a=0;a<this.steps.length;a++)_.isUndefined(this.steps[a].actor_property)&&(this.steps[a].actor_property=this.attributes.actorProperty);return{api_key:this.client.readKey,steps:this.steps,timeframe:this.attributes.timeframe,timezone:this.attributes.timezone,actor_property:this.attributes.actorProperty}},draw:function(a,b){var c=new Keen.FunnelChart(this,b);c.draw(a)}}),Keen.Funnel.prototype.timeframe=function(a){return this.attributes.timeframe=a,this},Keen.Funnel.prototype.actorProperty=function(a){return this.attributes.actorProperty=a,this},Keen.Funnel.prototype.timezone=function(a){return this.attributes.timezone=a,this},Keen.Funnel.prototype.addStep=function(a){return this.steps.push(a.buildParams()),this},Keen.Step=Keen.AdHocQuery.extend({constructor:function(a,b){_.isUndefined(b)&&(b={}),this.attributes=_.defaults(b,{filters:[]}),this.attributes.eventCollection=a,_.isUndefined(this.attributes.timezone)&&(this.attributes.timezone=f())},buildParams:function(){return{event_collection:this.attributes.eventCollection,actor_property:this.attributes.actorProperty,filters:this.attributes.filters,timeframe:this.attributes.timeframe,timezone:this.attributes.timezone,name:this.attributes.name}}}),Keen.Step.prototype.name=function(a){return this.attributes.name=a,this},Keen.Step.prototype.actorProperty=function(a){return this.attributes.actorProperty=a,this},Keen.Metric=Keen.AdHocQuery.extend({}),Keen.Metric.prototype.draw=function(a,b){if(_.isUndefined(this.attributes.groupBy)){var c=new Keen.Number(this,b);c.draw(a)}else{var d=new Keen.PieChart(this,b);d.draw(a)}},Keen.Series=Keen.AdHocQuery.extend({buildParams:function(){var a=this.base(); return a.interval=this.attributes.interval,a},draw:function(a,b){if(_.isUndefined(this.attributes.groupBy)){var c=new Keen.LineChart(this,b);c.draw(a)}else{var d=new Keen.MultiLineChart(this,b);d.draw(a)}}}),Keen.Series.prototype.interval=function(a){return this.attributes.interval=a,this},Keen.showLoading=function(a){(new Spinner).spin(a)},Keen.prettyNumber=function(a){function b(a,c){var a=String(a),d=a.split(".");if(d.length>1){a=d[0];var f=d[1];2==a.length&&f.length>0?f.length>0?a=a+"."+f.charAt(0):a+="0":1==a.length&&f.length>0&&(a=a+"."+f.charAt(0),a+=f.length>1?f.charAt(1):"0")}var g=a.length;return a.split(".").length>1&&g--,3>=g?String(a)+e[c]:b(Number(a)/1e3,c+1)}var c=a.toPrecision(3);if(Number(c)==a&&String(a).length<=4)return String(a);if(a>=1||-1>=a){var d="";0>a&&(a=-a,d="-");var e=["","k","M","B","T"];return d+b(a,0)}return a.toPrecision(3)},Date.prototype.stdTimezoneOffset=function(){var a=new Date(this.getFullYear(),-1,1),b=new Date(this.getFullYear(),6,1);return Math.max(a.getTimezoneOffset(),b.getTimezoneOffset())},Date.prototype.dst=function(){return this.getTimezoneOffset()<this.stdTimezoneOffset()},Keen.loadedCallback&&"function"==typeof Keen.loadedCallback&&Keen.loadedCallback()}();