(function e(b,g,d){function c(m,j){if(!g[m]){if(!b[m]){var i=typeof require=="function"&&require;if(!j&&i){return i(m,!0)}if(a){return a(m,!0)}var k=new Error("Cannot find module '"+m+"'");throw k.code="MODULE_NOT_FOUND",k}var h=g[m]={exports:{}};b[m][0].call(h.exports,function(l){var o=b[m][1][l];return c(o?o:l)},h,h.exports,e,b,g,d)}return g[m].exports}var a=typeof require=="function"&&require;for(var f=0;f<d.length;f++){c(d[f])}return c})({1:[function(c,d,b){d.exports=f;function f(g){if(g){return a(g)}}function a(h){for(var g in f.prototype){h[g]=f.prototype[g]}return h}f.prototype.on=f.prototype.addEventListener=function(h,g){this._callbacks=this._callbacks||{};(this._callbacks["$"+h]=this._callbacks["$"+h]||[]).push(g);return this};f.prototype.once=function(i,h){function g(){this.off(i,g);h.apply(this,arguments)}g.fn=h;this.on(i,g);return this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(l,j){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var k=this._callbacks["$"+l];if(!k){return this}if(1==arguments.length){delete this._callbacks["$"+l];return this}var g;for(var h=0;h<k.length;h++){g=k[h];if(g===j||g.fn===j){k.splice(h,1);break}}return this};f.prototype.emit=function(l){this._callbacks=this._callbacks||{};var h=[].slice.call(arguments,1),k=this._callbacks["$"+l];if(k){k=k.slice(0);for(var j=0,g=k.length;j<g;++j){k[j].apply(this,h)}}return this};f.prototype.listeners=function(g){this._callbacks=this._callbacks||{};return this._callbacks["$"+g]||[]};f.prototype.hasListeners=function(g){return !!this.listeners(g).length}},{}],2:[function(b,c,a){
/*!
  * domready (c) Dustin Diaz 2012 - License MIT
  */
!function(d,f){if(typeof c!="undefined"){c.exports=f()}else{if(typeof define=="function"&&typeof define.amd=="object"){define(f)}else{this[d]=f()}}}("domready",function(m){var r=[],l,k=false,n=document,g=n.documentElement,q=g.doScroll,d="DOMContentLoaded",h="addEventListener",p="onreadystatechange",j="readyState",s=q?/^loaded|^c/:/^loaded|c/,i=s.test(n[j]);function o(t){i=1;while(t=r.shift()){t()}}n[h]&&n[h](d,l=function(){n.removeEventListener(d,l,k);o()},k);q&&n.attachEvent(p,l=function(){if(/^c/.test(n[j])){n.detachEvent(p,l);o()}});return(m=q?function(f){self!=top?i?f():r.push(f):function(){try{g.doScroll("left")}catch(t){return setTimeout(function(){m(f)},50)}f()}()}:function(f){i?f():r.push(f)})})},{}],3:[function(b,c,a){(function(d){
/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
(function(){var g=typeof define==="function"&&define.amd;var i={"function":true,object:true};var l=i[typeof a]&&a&&!a.nodeType&&a;var m=i[typeof window]&&window||this,f=l&&i[typeof c]&&c&&!c.nodeType&&typeof d=="object"&&d;if(f&&(f.global===f||f.window===f||f.self===f)){m=f}function n(af,Z){af||(af=m.Object());Z||(Z=m.Object());var O=af.Number||m.Number,V=af.String||m.String,B=af.Object||m.Object,W=af.Date||m.Date,X=af.SyntaxError||m.SyntaxError,ae=af.TypeError||m.TypeError,N=af.Math||m.Math,ac=af.JSON||m.JSON;if(typeof ac=="object"&&ac){Z.stringify=ac.stringify;Z.parse=ac.parse}var r=B.prototype,y=r.toString,v,q,P;var F=new W(-3509827334573292);try{F=F.getUTCFullYear()==-109252&&F.getUTCMonth()===0&&F.getUTCDate()===1&&F.getUTCHours()==10&&F.getUTCMinutes()==37&&F.getUTCSeconds()==6&&F.getUTCMilliseconds()==708}catch(z){}function s(ag){if(s[ag]!==P){return s[ag]}var ah;if(ag=="bug-string-char-index"){ah="a"[0]!="a"}else{if(ag=="json"){ah=s("json-stringify")&&s("json-parse")}else{var ao,al='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(ag=="json-stringify"){var am=Z.stringify,an=typeof am=="function"&&F;if(an){(ao=function(){return 1}).toJSON=ao;try{an=am(0)==="0"&&am(new O())==="0"&&am(new V())=='""'&&am(y)===P&&am(P)===P&&am()===P&&am(ao)==="1"&&am([ao])=="[1]"&&am([P])=="[null]"&&am(null)=="null"&&am([P,y,null])=="[null,null,null]"&&am({a:[ao,true,false,null,"\x00\b\n\f\r\t"]})==al&&am(null,ao)==="1"&&am([1,2],null,1)=="[\n 1,\n 2\n]"&&am(new W(-8640000000000000))=='"-271821-04-20T00:00:00.000Z"'&&am(new W(8640000000000000))=='"+275760-09-13T00:00:00.000Z"'&&am(new W(-62198755200000))=='"-000001-01-01T00:00:00.000Z"'&&am(new W(-1))=='"1969-12-31T23:59:59.999Z"'}catch(ai){an=false}}ah=an}if(ag=="json-parse"){var ak=Z.parse;if(typeof ak=="function"){try{if(ak("0")===0&&!ak(false)){ao=ak(al);var aj=ao.a.length==5&&ao.a[0]===1;if(aj){try{aj=!ak('"\t"')}catch(ai){}if(aj){try{aj=ak("01")!==1}catch(ai){}}if(aj){try{aj=ak("1.")!==1}catch(ai){}}}}}catch(ai){aj=false}}ah=aj}}}return s[ag]=!!ah}if(!s("json")){var Y="[object Function]",U="[object Date]",R="[object Number]",S="[object String]",I="[object Array]",E="[object Boolean]";var J=s("bug-string-char-index");if(!F){var w=N.floor;var ad=[0,31,59,90,120,151,181,212,243,273,304,334];var H=function(ag,ah){return ad[ah]+365*(ag-1970)+w((ag-1969+(ah=+(ah>1)))/4)-w((ag-1901+ah)/100)+w((ag-1601+ah)/400)}}if(!(v=r.hasOwnProperty)){v=function(ai){var ag={},ah;if((ag.__proto__=null,ag.__proto__={toString:1},ag).toString!=y){v=function(al){var ak=this.__proto__,aj=al in (this.__proto__=null,this);this.__proto__=ak;return aj}}else{ah=ag.constructor;v=function(ak){var aj=(this.constructor||ah).prototype;return ak in this&&!(ak in aj&&this[ak]===aj[ak])}}ag=null;return v.call(this,ai)}}q=function(ai,al){var aj=0,ag,ah,ak;(ag=function(){this.valueOf=0}).prototype.valueOf=0;ah=new ag();for(ak in ah){if(v.call(ah,ak)){aj++}}ag=ah=null;if(!aj){ah=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];q=function(an,ar){var aq=y.call(an)==Y,ap,ao;var am=!aq&&typeof an.constructor!="function"&&i[typeof an.hasOwnProperty]&&an.hasOwnProperty||v;for(ap in an){if(!(aq&&ap=="prototype")&&am.call(an,ap)){ar(ap)}}for(ao=ah.length;ap=ah[--ao];am.call(an,ap)&&ar(ap)){}}}else{if(aj==2){q=function(an,aq){var am={},ap=y.call(an)==Y,ao;for(ao in an){if(!(ap&&ao=="prototype")&&!v.call(am,ao)&&(am[ao]=1)&&v.call(an,ao)){aq(ao)}}}}else{q=function(an,aq){var ap=y.call(an)==Y,ao,am;for(ao in an){if(!(ap&&ao=="prototype")&&v.call(an,ao)&&!(am=ao==="constructor")){aq(ao)}}if(am||v.call(an,(ao="constructor"))){aq(ao)}}}}return q(ai,al)};if(!s("json-stringify")){var u={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var M="000000";var x=function(ag,ah){return(M+(ah||0)).slice(-ag)};var D="\\u00";var G=function(am){var ah='"',ak=0,al=am.length,ag=!J||al>10;var aj=ag&&(J?am.split(""):am);for(;ak<al;ak++){var ai=am.charCodeAt(ak);switch(ai){case 8:case 9:case 10:case 12:case 13:case 34:case 92:ah+=u[ai];break;default:if(ai<32){ah+=D+x(2,ai.toString(16));break}ah+=ag?aj[ak]:am.charAt(ak)}}return ah+'"'};var t=function(am,aE,ak,ap,aB,ag,an){var ax,ai,au,aD,aC,ao,aA,ay,av,ar,aw,ah,al,aj,az,at;try{ax=aE[am]}catch(aq){}if(typeof ax=="object"&&ax){ai=y.call(ax);if(ai==U&&!v.call(ax,"toJSON")){if(ax>-1/0&&ax<1/0){if(H){aC=w(ax/86400000);for(au=w(aC/365.2425)+1970-1;H(au+1,0)<=aC;au++){}for(aD=w((aC-H(au,0))/30.42);H(au,aD+1)<=aC;aD++){}aC=1+aC-H(au,aD);ao=(ax%86400000+86400000)%86400000;aA=w(ao/3600000)%24;ay=w(ao/60000)%60;av=w(ao/1000)%60;ar=ao%1000}else{au=ax.getUTCFullYear();aD=ax.getUTCMonth();aC=ax.getUTCDate();aA=ax.getUTCHours();ay=ax.getUTCMinutes();av=ax.getUTCSeconds();ar=ax.getUTCMilliseconds()}ax=(au<=0||au>=10000?(au<0?"-":"+")+x(6,au<0?-au:au):x(4,au))+"-"+x(2,aD+1)+"-"+x(2,aC)+"T"+x(2,aA)+":"+x(2,ay)+":"+x(2,av)+"."+x(3,ar)+"Z"}else{ax=null}}else{if(typeof ax.toJSON=="function"&&((ai!=R&&ai!=S&&ai!=I)||v.call(ax,"toJSON"))){ax=ax.toJSON(am)}}}if(ak){ax=ak.call(aE,am,ax)}if(ax===null){return"null"}ai=y.call(ax);if(ai==E){return""+ax}else{if(ai==R){return ax>-1/0&&ax<1/0?""+ax:"null"}else{if(ai==S){return G(""+ax)}}}if(typeof ax=="object"){for(aj=an.length;aj--;){if(an[aj]===ax){throw ae()}}an.push(ax);aw=[];az=ag;ag+=aB;if(ai==I){for(al=0,aj=ax.length;al<aj;al++){ah=t(al,ax,ak,ap,aB,ag,an);aw.push(ah===P?"null":ah)}at=aw.length?(aB?"[\n"+ag+aw.join(",\n"+ag)+"\n"+az+"]":("["+aw.join(",")+"]")):"[]"}else{q(ap||ax,function(aG){var aF=t(aG,ax,ak,ap,aB,ag,an);if(aF!==P){aw.push(G(aG)+":"+(aB?" ":"")+aF)}});at=aw.length?(aB?"{\n"+ag+aw.join(",\n"+ag)+"\n"+az+"}":("{"+aw.join(",")+"}")):"{}"}an.pop();return at}};Z.stringify=function(ag,ai,aj){var ah,ap,an,am;if(i[typeof ai]&&ai){if((am=y.call(ai))==Y){ap=ai}else{if(am==I){an={};for(var al=0,ak=ai.length,ao;al<ak;ao=ai[al++],((am=y.call(ao)),am==S||am==R)&&(an[ao]=1)){}}}}if(aj){if((am=y.call(aj))==R){if((aj-=aj%1)>0){for(ah="",aj>10&&(aj=10);ah.length<aj;ah+=" "){}}}else{if(am==S){ah=aj.length<=10?aj:aj.slice(0,10)}}}return t("",(ao={},ao[""]=ag,ao),ap,an,ah,"",[])}}if(!s("json-parse")){var Q=V.fromCharCode;var p={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"};var K,ab;var L=function(){K=ab=null;throw X()};var C=function(){var al=ab,aj=al.length,ak,ai,ag,am,ah;while(K<aj){ah=al.charCodeAt(K);switch(ah){case 9:case 10:case 13:case 32:K++;break;case 123:case 125:case 91:case 93:case 58:case 44:ak=J?al.charAt(K):al[K];K++;return ak;case 34:for(ak="@",K++;K<aj;){ah=al.charCodeAt(K);if(ah<32){L()}else{if(ah==92){ah=al.charCodeAt(++K);switch(ah){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:ak+=p[ah];K++;break;case 117:ai=++K;for(ag=K+4;K<ag;K++){ah=al.charCodeAt(K);if(!(ah>=48&&ah<=57||ah>=97&&ah<=102||ah>=65&&ah<=70)){L()}}ak+=Q("0x"+al.slice(ai,K));break;default:L()}}else{if(ah==34){break}ah=al.charCodeAt(K);ai=K;while(ah>=32&&ah!=92&&ah!=34){ah=al.charCodeAt(++K)}ak+=al.slice(ai,K)}}}if(al.charCodeAt(K)==34){K++;return ak}L();default:ai=K;if(ah==45){am=true;ah=al.charCodeAt(++K)}if(ah>=48&&ah<=57){if(ah==48&&((ah=al.charCodeAt(K+1)),ah>=48&&ah<=57)){L()}am=false;for(;K<aj&&((ah=al.charCodeAt(K)),ah>=48&&ah<=57);K++){}if(al.charCodeAt(K)==46){ag=++K;for(;ag<aj&&((ah=al.charCodeAt(ag)),ah>=48&&ah<=57);ag++){}if(ag==K){L()}K=ag}ah=al.charCodeAt(K);if(ah==101||ah==69){ah=al.charCodeAt(++K);if(ah==43||ah==45){K++}for(ag=K;ag<aj&&((ah=al.charCodeAt(ag)),ah>=48&&ah<=57);ag++){}if(ag==K){L()}K=ag}return +al.slice(ai,K)}if(am){L()}if(al.slice(K,K+4)=="true"){K+=4;return true}else{if(al.slice(K,K+5)=="false"){K+=5;return false}else{if(al.slice(K,K+4)=="null"){K+=4;return null}}}L()}}return"$"};var aa=function(ah){var ag,ai;if(ah=="$"){L()}if(typeof ah=="string"){if((J?ah.charAt(0):ah[0])=="@"){return ah.slice(1)}if(ah=="["){ag=[];for(;;ai||(ai=true)){ah=C();if(ah=="]"){break}if(ai){if(ah==","){ah=C();if(ah=="]"){L()}}else{L()}}if(ah==","){L()}ag.push(aa(ah))}return ag}else{if(ah=="{"){ag={};for(;;ai||(ai=true)){ah=C();if(ah=="}"){break}if(ai){if(ah==","){ah=C();if(ah=="}"){L()}}else{L()}}if(ah==","||typeof ah!="string"||(J?ah.charAt(0):ah[0])!="@"||C()!=":"){L()}ag[ah.slice(1)]=aa(C())}return ag}}L()}return ah};var T=function(ai,ah,aj){var ag=A(ai,ah,aj);if(ag===P){delete ai[ah]}else{ai[ah]=ag}};var A=function(aj,ai,ak){var ah=aj[ai],ag;if(typeof ah=="object"&&ah){if(y.call(ah)==I){for(ag=ah.length;ag--;){T(ah,ag,ak)}}else{q(ah,function(al){T(ah,al,ak)})}}return ak.call(aj,ai,ah)};Z.parse=function(ai,aj){var ag,ah;K=0;ab=""+ai;ag=aa(C());if(C()!="$"){L()}K=ab=null;return aj&&y.call(aj)==Y?A((ah={},ah[""]=ag,ah),"",aj):ag}}}Z.runInContext=n;return Z}if(l&&!g){n(m,l)}else{var j=m.JSON,o=m.JSON3,h=false;var k=n(m,(m.JSON3={noConflict:function(){if(!h){h=true;m.JSON=j;m.JSON3=o;j=o=null}return k}}));m.JSON={parse:k.parse,stringify:k.stringify}}if(g){define(function(){return k})}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],4:[function(i,b,t){var l=i("emitter");var k=i("reduce");var p="undefined"==typeof window?this:window;function f(){}function m(u){var v={}.toString.call(u);switch(v){case"[object File]":case"[object Blob]":case"[object FormData]":return true;default:return false}}function n(){if(p.XMLHttpRequest&&("file:"!=p.location.protocol||!p.ActiveXObject)){return new XMLHttpRequest}else{try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(u){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(u){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(u){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(u){}}return false}var r="".trim?function(u){return u.trim()}:function(u){return u.replace(/(^\s*|\s*$)/g,"")};function j(u){return u===Object(u)}function o(w){if(!j(w)){return w}var v=[];for(var u in w){if(null!=w[u]){v.push(encodeURIComponent(u)+"="+encodeURIComponent(w[u]))}}return v.join("&")}d.serializeObject=o;function h(A){var y={};var w=A.split("&");var x;var z;for(var v=0,u=w.length;v<u;++v){z=w[v];x=z.split("=");y[decodeURIComponent(x[0])]=decodeURIComponent(x[1])}return y}d.parseString=h;d.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"};d.serialize={"application/x-www-form-urlencoded":o,"application/json":JSON.stringify};d.parse={"application/x-www-form-urlencoded":h,"application/json":JSON.parse};function c(z){var B=z.split(/\r?\n/);var w={};var y;var C;var A;var u;B.pop();for(var v=0,x=B.length;v<x;++v){C=B[v];y=C.indexOf(":");A=C.slice(0,y).toLowerCase();u=r(C.slice(y+1));w[A]=u}return w}function g(u){return u.split(/ *; */).shift()}function s(u){return k(u.split(/ *; */),function(x,z){var w=z.split(/ *= */),v=w.shift(),y=w.shift();if(v&&y){x[v]=y}return x},{})}function a(v,u){u=u||{};this.req=v;this.xhr=this.req.xhr;this.text=this.req.method!="HEAD"?this.xhr.responseText:null;this.setStatusProperties(this.xhr.status);this.header=this.headers=c(this.xhr.getAllResponseHeaders());this.header["content-type"]=this.xhr.getResponseHeader("content-type");this.setHeaderProperties(this.header);this.body=this.req.method!="HEAD"?this.parseBody(this.text):null}a.prototype.get=function(u){return this.header[u.toLowerCase()]};a.prototype.setHeaderProperties=function(x){var v=this.header["content-type"]||"";this.type=g(v);var w=s(v);for(var u in w){this[u]=w[u]}};a.prototype.parseBody=function(v){var u=d.parse[this.type];return u&&v&&v.length?u(v):null};a.prototype.setStatusProperties=function(u){var v=u/100|0;this.status=u;this.statusType=v;this.info=1==v;this.ok=2==v;this.clientError=4==v;this.serverError=5==v;this.error=(4==v||5==v)?this.toError():false;this.accepted=202==u;this.noContent=204==u||1223==u;this.badRequest=400==u;this.unauthorized=401==u;this.notAcceptable=406==u;this.notFound=404==u;this.forbidden=403==u};a.prototype.toError=function(){var w=this.req;var y=w.method;var u=w.url;var x="cannot "+y+" "+u+" ("+this.status+")";var v=new Error(x);v.status=this.status;v.method=y;v.url=u;return v};d.Response=a;function q(w,v){var u=this;l.call(this);this._query=this._query||[];this.method=w;this.url=v;this.header={};this._header={};this.on("end",function(){var y=null;var x=null;try{x=new a(u)}catch(z){y=new Error("Parser is unable to parse the response");y.parse=true;y.original=z}u.callback(y,x)})}l(q.prototype);q.prototype.use=function(u){u(this);return this};q.prototype.timeout=function(u){this._timeout=u;return this};q.prototype.clearTimeout=function(){this._timeout=0;clearTimeout(this._timer);return this};q.prototype.abort=function(){if(this.aborted){return}this.aborted=true;this.xhr.abort();this.clearTimeout();this.emit("abort");return this};q.prototype.set=function(v,w){if(j(v)){for(var u in v){this.set(u,v[u])}return this}this._header[v.toLowerCase()]=w;this.header[v]=w;return this};q.prototype.unset=function(u){delete this._header[u.toLowerCase()];delete this.header[u];return this};q.prototype.getHeader=function(u){return this._header[u.toLowerCase()]};q.prototype.type=function(u){this.set("Content-Type",d.types[u]||u);return this};q.prototype.accept=function(u){this.set("Accept",d.types[u]||u);return this};q.prototype.auth=function(u,v){var w=btoa(u+":"+v);this.set("Authorization","Basic "+w);return this};q.prototype.query=function(u){if("string"!=typeof u){u=o(u)}if(u){this._query.push(u)}return this};q.prototype.field=function(u,v){if(!this._formData){this._formData=new FormData()}this._formData.append(u,v);return this};q.prototype.attach=function(w,v,u){if(!this._formData){this._formData=new FormData()}this._formData.append(w,v,u);return this};q.prototype.send=function(w){var x=j(w);var v=this.getHeader("Content-Type");if(x&&j(this._data)){for(var u in w){this._data[u]=w[u]}}else{if("string"==typeof w){if(!v){this.type("form")}v=this.getHeader("Content-Type");if("application/x-www-form-urlencoded"==v){this._data=this._data?this._data+"&"+w:w}else{this._data=(this._data||"")+w}}else{this._data=w}}if(!x){return this}if(!v){this.type("json")}return this};q.prototype.callback=function(w,u){var v=this._callback;this.clearTimeout();if(2==v.length){return v(w,u)}if(w){return this.emit("error",w)}v(u)};q.prototype.crossDomainError=function(){var u=new Error("Origin is not allowed by Access-Control-Allow-Origin");u.crossDomain=true;this.callback(u)};q.prototype.timeoutError=function(){var v=this._timeout;var u=new Error("timeout of "+v+"ms exceeded");u.timeout=v;this.callback(u)};q.prototype.withCredentials=function(){this._withCredentials=true;return this};q.prototype.end=function(w){var u=this;var B=this.xhr=n();var z=this._query.join("&");var y=this._timeout;var x=this._formData||this._data;this._callback=w||f;B.onreadystatechange=function(){if(4!=B.readyState){return}if(0==B.status){if(u.aborted){return u.timeoutError()}return u.crossDomainError()}u.emit("end")};if(B.upload){B.upload.onprogress=function(C){C.percent=C.loaded/C.total*100;u.emit("progress",C)}}if(y&&!this._timer){this._timer=setTimeout(function(){u.abort()},y)}if(z){z=d.serializeObject(z);this.url+=~this.url.indexOf("?")?"&"+z:"?"+z}B.open(this.method,this.url,true);if(this._withCredentials){B.withCredentials=true}if("GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof x&&!m(x)){var v=d.serialize[this.getHeader("Content-Type")];if(v){x=v(x)}}for(var A in this.header){if(null==this.header[A]){continue}B.setRequestHeader(A,this.header[A])}this.emit("request",this);B.send(x);return this};d.Request=q;function d(v,u){if("function"==typeof u){return new q("GET",v).end(u)}if(1==arguments.length){return new q("GET",v)}return new q(v,u)}d.get=function(u,x,v){var w=d("GET",u);if("function"==typeof x){v=x,x=null}if(x){w.query(x)}if(v){w.end(v)}return w};d.head=function(u,x,v){var w=d("HEAD",u);if("function"==typeof x){v=x,x=null}if(x){w.send(x)}if(v){w.end(v)}return w};d.del=function(u,v){var w=d("DELETE",u);if(v){w.end(v)}return w};d.patch=function(u,x,v){var w=d("PATCH",u);if("function"==typeof x){v=x,x=null}if(x){w.send(x)}if(v){w.end(v)}return w};d.post=function(u,x,v){var w=d("POST",u);if("function"==typeof x){v=x,x=null}if(x){w.send(x)}if(v){w.end(v)}return w};d.put=function(u,x,v){var w=d("PUT",u);if("function"==typeof x){v=x,x=null}if(x){w.send(x)}if(v){w.end(v)}return w};b.exports=d},{emitter:5,reduce:6}],5:[function(c,d,b){d.exports=f;function f(g){if(g){return a(g)}}function a(h){for(var g in f.prototype){h[g]=f.prototype[g]}return h}f.prototype.on=f.prototype.addEventListener=function(h,g){this._callbacks=this._callbacks||{};(this._callbacks[h]=this._callbacks[h]||[]).push(g);return this};f.prototype.once=function(j,i){var h=this;this._callbacks=this._callbacks||{};function g(){h.off(j,g);i.apply(this,arguments)}g.fn=i;this.on(j,g);return this};f.prototype.off=f.prototype.removeListener=f.prototype.removeAllListeners=f.prototype.removeEventListener=function(l,j){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var k=this._callbacks[l];if(!k){return this}if(1==arguments.length){delete this._callbacks[l];return this}var g;for(var h=0;h<k.length;h++){g=k[h];if(g===j||g.fn===j){k.splice(h,1);break}}return this};f.prototype.emit=function(l){this._callbacks=this._callbacks||{};var h=[].slice.call(arguments,1),k=this._callbacks[l];if(k){k=k.slice(0);for(var j=0,g=k.length;j<g;++j){k[j].apply(this,h)}}return this};f.prototype.listeners=function(g){this._callbacks=this._callbacks||{};return this._callbacks[g]||[]};f.prototype.hasListeners=function(g){return !!this.listeners(g).length}},{}],6:[function(b,c,a){c.exports=function(g,i,h){var f=0;var d=g.length;var j=arguments.length==3?h:g[f++];while(f<d){j=i.call(null,j,g[f],++f,g)}return j}},{}],7:[function(c,d,b){var a=c("./index"),f=c("./utils/each");d.exports=function(){var h=window.Keen||null,j=window._Keen||null,g,i;if(h&&j){g=j.clients||{},i=j.ready||[];f(g,function(l,n){f(a.prototype,function(p,o){h.prototype[o]=p});f(["Query","Request","Dataset","Dataviz"],function(o){h[o]=(a[o])?a[o]:function(){}});if(l._config){l.configure.call(l,l._config)}if(l._setGlobalProperties){f(l._setGlobalProperties,function(o){l.setGlobalProperties.apply(l,o)})}if(l._addEvent){f(l._addEvent,function(o){l.addEvent.apply(l,o)})}var m=l._on||[];if(l._on){f(l._on,function(o){l.on.apply(l,o)});l.trigger("ready")}f(["_config","_setGlobalProperties","_addEvent","_on"],function(o){if(l[o]){l[o]=undefined;try{delete l[o]}catch(p){}}})});f(i,function(l,m){a.once("ready",l)})}window._Keen=undefined;try{delete window._Keen}catch(k){}}},{"./index":14,"./utils/each":20}],8:[function(b,c,a){c.exports=function(){return"undefined"==typeof window?"server":"browser"}},{}],9:[function(b,d,a){var f=b("../utils/each"),c=b("../utils/json-shim");d.exports=function(h){var g=[];f(h,function(j,i){if("string"!==typeof j){j=c.stringify(j)}g.push(i+"="+encodeURIComponent(j))});return"?"+g.join("&")}},{"../utils/each":20,"../utils/json-shim":23}],10:[function(b,c,a){c.exports=function(){if("undefined"!==typeof window){if(navigator.userAgent.indexOf("MSIE")!==-1||navigator.appVersion.indexOf("Trident/")>0){return 2000}}return 16000}},{}],11:[function(b,c,a){c.exports=function(){var d="undefined"==typeof window?this:window;if(d.XMLHttpRequest&&("file:"!=d.location.protocol||!d.ActiveXObject)){return new XMLHttpRequest}else{try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(f){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(f){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(f){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(f){}}return false}},{}],12:[function(b,c,a){c.exports=function(h,g,i){var f=i||function(){};if(g&&!g.ok){var d=g.body&&g.body.error_code;h=new Error(d?g.body.message:"Unknown error occurred");h.code=d?g.body.error_code:"UnknownError"}if(h){f(h,null)}else{f(null,g.body)}return}},{}],13:[function(f,b,g){var n=f("superagent");var l=f("../utils/each"),a=f("./get-xhr-object");b.exports=function(o,p){return function(q){var r=q.constructor.prototype.end;if("undefined"===typeof window){return}q.requestType=q.requestType||{};q.requestType.type=o;q.requestType.options=q.requestType.options||{async:true,success:{responseText:'{ "created": true }',status:201},error:{responseText:'{ "error_code": "ERROR", "message": "Request failed" }',status:404}};if(p){if("boolean"===typeof p.async){q.requestType.options.async=p.async}if(p.success){extend(q.requestType.options.success,p.success)}if(p.error){extend(q.requestType.options.error,p.error)}}q.end=function(u){var t=this,s=(this.requestType)?this.requestType.type:"xhr",w,v;if(("GET"!==t.method||"xhr"===s)&&t.requestType.options.async){r.call(t,u);return}w=t._query.join("&");v=t._timeout;t._callback=u||noop;if(v&&!t._timer){t._timer=setTimeout(function(){h.call(t)},v)}if(w){w=n.serializeObject(w);t.url+=~t.url.indexOf("?")?"&"+w:"?"+w}t.emit("request",t);if(!t.requestType.options.async){k.call(t)}else{if("jsonp"===s){j.call(t)}else{if("beacon"===s){i.call(t)}}}return t};return q}};function k(){var o=a();if(o){o.open("GET",this.url,false);o.send(null)}return this}function j(){var p=this,t=new Date().getTime(),o=document.createElement("script"),s=document.getElementsByTagName("head")[0],u="keenJSONPCallback",q=false;u+=t;while(u in window){u+="a"}window[u]=function(v){if(q===true){return}q=true;d.call(p,v);r()};o.src=p.url+"&jsonp="+u;s.appendChild(o);o.onreadystatechange=function(){if(q===false&&p.readyState==="loaded"){q=true;c.call(p);r()}};o.onerror=function(){if(q===false){q=true;c.call(p);r()}};function r(){window[u]=undefined;try{delete window[u]}catch(v){}s.removeChild(o)}}function i(){var p=this,o=document.createElement("img"),q=false;o.onload=function(){q=true;if("naturalHeight" in this){if(this.naturalHeight+this.naturalWidth===0){this.onerror();return}}else{if(this.width+this.height===0){this.onerror();return}}d.call(p)};o.onerror=function(){q=true;c.call(p)};o.src=p.url+"&c=clv1"}function d(p){var q=this.requestType.options["success"],o="";m.call(this,q);if(p){try{o=JSON.stringify(p)}catch(r){}}else{o=q.responseText}this.xhr.responseText=o;this.xhr.status=q.status;this.emit("end")}function c(){var o=this.requestType.options["error"];m.call(this,o);this.xhr.responseText=o.responseText;this.xhr.status=o.status;this.emit("end")}function h(){this.aborted=true;this.clearTimeout();this.emit("abort")}function m(o){this.xhr={getAllResponseHeaders:function(){return""},getResponseHeader:function(){return"application/json"},responseText:o.responseText,status:o.status};return this}},{"../utils/each":20,"./get-xhr-object":11,superagent:4}],14:[function(d,f,c){var b="undefined"!==typeof window?window:this;var h=b.Keen;var g=d("./utils/emitter-shim");function a(i){this.configure(i||{});a.trigger("client",this)}a.debug=false;a.enabled=true;a.loaded=true;a.version="3.2.7";g(a);g(a.prototype);a.prototype.configure=function(i){var j=i||{};if(j.host){j.host.replace(/.*?:\/\//g,"")}if(j.protocol&&j.protocol==="auto"){j.protocol=location.protocol.replace(/:/g,"")}this.config={projectId:j.projectId,writeKey:j.writeKey,readKey:j.readKey,masterKey:j.masterKey,requestType:j.requestType||"jsonp",host:j.host||"api.keen.io/3.0",protocol:j.protocol||"https",globalProperties:null};if(a.debug){this.on("error",a.log)}this.trigger("ready")};a.prototype.projectId=function(i){if(!arguments.length){return this.config.projectId}this.config.projectId=(i?String(i):null);return this};a.prototype.masterKey=function(i){if(!arguments.length){return this.config.masterKey}this.config.masterKey=(i?String(i):null);return this};a.prototype.readKey=function(i){if(!arguments.length){return this.config.readKey}this.config.readKey=(i?String(i):null);return this};a.prototype.writeKey=function(i){if(!arguments.length){return this.config.writeKey}this.config.writeKey=(i?String(i):null);return this};a.prototype.url=function(i){if(!this.projectId()){this.trigger("error","Client is missing projectId property");return}return this.config.protocol+"://"+this.config.host+"/projects/"+this.projectId()+i};a.log=function(i){if(a.debug&&typeof console=="object"){console.log("[Keen IO]",i)}};a.noConflict=function(){b.Keen=h;return a};a.ready=function(i){if(a.loaded){i()}else{a.once("ready",i)}};f.exports=a},{"./utils/emitter-shim":21}],15:[function(f,c,h){var p=f("../utils/json-shim");var g=f("superagent");var i=f("../index");var j=f("../utils/base64"),m=f("../utils/each"),n=f("../helpers/get-context"),d=f("../helpers/get-query-string"),b=f("../helpers/get-url-max-length"),a=f("../helpers/get-xhr-object"),k=f("../helpers/superagent-request-types"),o=f("../helpers/superagent-handle-response");c.exports=function(x,A,B,t){var C=this,v=this.url("/events/"+encodeURIComponent(x)),q=this.config.requestType,u={},s=B,r,z;r=("boolean"===typeof t)?t:true;if(!i.enabled){y.call(C,"Keen.enabled = false");return}if(!C.projectId()){y.call(C,"Missing projectId property");return}if(!C.writeKey()){y.call(C,"Missing writeKey property");return}if(!x||typeof x!=="string"){y.call(C,"Collection name must be a string");return}if(C.config.globalProperties){u=C.config.globalProperties(x)}m(A,function(E,D){u[D]=E});if(!a()&&"xhr"===q){q="jsonp"}if("xhr"!==q||!r){z=l.call(C,v,u)}if(z&&n()==="browser"){g.get(z).use(k(q,{async:r})).end(w)}else{if(a()||n()==="server"){g.post(v).set("Content-Type","application/json").set("Authorization",C.writeKey()).send(u).end(w)}else{C.trigger("error","Request not sent: URL length exceeds current browser limit, and XHR (POST) is not supported.")}}function w(E,D){o(E,D,s);s=B=null}function y(E){var D="Event not recorded: "+E;C.trigger("error",D);if(s){s.call(C,D,null);s=B=null}}return};function l(q,r){q+=d({api_key:this.writeKey(),data:j.encode(p.stringify(r)),modified:new Date().getTime()});return(q.length<b())?q:false}},{"../helpers/get-context":8,"../helpers/get-query-string":9,"../helpers/get-url-max-length":10,"../helpers/get-xhr-object":11,"../helpers/superagent-handle-response":12,"../helpers/superagent-request-types":13,"../index":14,"../utils/base64":19,"../utils/each":20,"../utils/json-shim":23,superagent:4}],16:[function(c,b,f){var g=c("../index");var d=c("superagent");var i=c("../utils/each"),j=c("../helpers/get-context"),a=c("../helpers/get-xhr-object"),h=c("../helpers/superagent-request-types"),k=c("../helpers/superagent-handle-response");b.exports=function(p,r){var n=this,m=this.url("/events"),o={},l=r;if(!g.enabled){q.call(n,"Keen.enabled = false");return}if(!n.projectId()){q.call(n,"Missing projectId property");return}if(!n.writeKey()){q.call(n,"Missing writeKey property");return}if(arguments.length>2){q.call(n,"Incorrect arguments provided to #addEvents method");return}if(typeof p!=="object"||p instanceof Array){q.call(n,"Request payload must be an object");return}if(n.config.globalProperties){i(p,function(s,t){i(s,function(u,v){var w=n.config.globalProperties(t);i(u,function(y,x){w[x]=y});o[t].push(w)})})}else{o=p}if(a()||j()==="server"){d.post(m).set("Content-Type","application/json").set("Authorization",n.writeKey()).send(o).end(function(t,s){k(t,s,l);l=r=null})}else{n.trigger("error","Events not recorded: XHR support is required for batch upload")}function q(t){var s="Events not recorded: "+t;n.trigger("error",s);if(l){l.call(n,s,null);l=r=null}}return}},{"../helpers/get-context":8,"../helpers/get-xhr-object":11,"../helpers/superagent-handle-response":12,"../helpers/superagent-request-types":13,"../index":14,"../utils/each":20,superagent:4}],17:[function(b,c,a){c.exports=function(d){if(d&&typeof(d)=="function"){this.config.globalProperties=d}else{this.trigger("error","Invalid value for global properties: "+d)}}},{}],18:[function(b,c,a){var d=b("./addEvent");c.exports=function(k,f,n,l,m){var o=k,j=(o.currentTarget)?o.currentTarget:(o.srcElement||o.target),g=l||500,h=false,q="",p,i;if(j.getAttribute!==void 0){q=j.getAttribute("target")}else{if(j.target){q=j.target}}if((q=="_blank"||q=="blank")&&!o.metaKey){i=window.open("about:blank");i.document.location=j.href}if(j.nodeName==="A"){p=function(){if(!h&&!o.metaKey&&(q!=="_blank"&&q!=="blank")){h=true;window.location=j.href}}}else{if(j.nodeName==="FORM"){p=function(){if(!h){h=true;j.submit()}}}else{this.trigger("error","#trackExternalLink method not attached to an <a> or <form> DOM element")}}if(m){p=function(){if(!h){h=true;m()}}}d.call(this,f,n,p);setTimeout(p,g);if(!o.metaKey){return false}}},{"./addEvent":15}],19:[function(b,c,a){c.exports={map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(f){var d="",l=0,h=this.map,k,j,g,s,r,q,p;f=this.utf8.encode(f);while(l<f.length){k=f.charCodeAt(l++);j=f.charCodeAt(l++);g=f.charCodeAt(l++);s=(k>>2);r=(((k&3)<<4)|(j>>4));q=(isNaN(j)?64:((j&15)<<2)|(g>>6));p=(isNaN(j)||isNaN(g))?64:g&63;d=d+h.charAt(s)+h.charAt(r)+h.charAt(q)+h.charAt(p)}return d},decode:function(f){var d="",p=0,h=this.map,g=String.fromCharCode,t,s,r,q,l,k,j;f=f.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(p<f.length){t=h.indexOf(f.charAt(p++));s=h.indexOf(f.charAt(p++));r=h.indexOf(f.charAt(p++));q=h.indexOf(f.charAt(p++));l=(t<<2)|(s>>4);k=((s&15)<<4)|(r>>2);j=((r&3)<<6)|q;d=d+(g(l)+((r!=64)?g(k):""))+(((q!=64)?g(j):""))}return this.utf8.decode(d)},utf8:{encode:function(j){var f="",d=0,h=String.fromCharCode,g;while(d<j.length){g=j.charCodeAt(d++);f=f+((g<128)?h(g):((g>127)&&(g<2048))?(h((g>>6)|192)+h((g&63)|128)):(h((g>>12)|224)+h(((g>>6)&63)|128)+h((g&63)|128)))}return f},decode:function(k){var g="",f=0,j=String.fromCharCode,d,h;while(f<k.length){h=k.charCodeAt(f);g=g+((h<128)?[j(h),f++][0]:((h>191)&&(h<224))?[j(((h&31)<<6)|((d=k.charCodeAt(f+1))&63)),(f+=2)][0]:[j(((h&15)<<12)|(((d=k.charCodeAt(f+1))&63)<<6)|((c3=k.charCodeAt(f+2))&63)),(f+=3)][0])}return g}}}},{}],20:[function(b,c,a){c.exports=function(g,d,f){var h;if(!g){return 0}f=!f?g:f;if(g instanceof Array){for(h=0;h<g.length;h++){if(d.call(f,g[h],h,g)===false){return 0}}}else{for(h in g){if(g.hasOwnProperty(h)){if(d.call(f,g[h],h,g)===false){return 0}}}}return 1}},{}],21:[function(b,c,a){var d=b("component-emitter");d.prototype.trigger=d.prototype.emit;c.exports=d},{"component-emitter":1}],22:[function(b,c,a){c.exports=function(f){for(var d=1;d<arguments.length;d++){for(var g in arguments[d]){f[g]=arguments[d][g]}}return f}},{}],23:[function(b,c,a){c.exports=("undefined"!==typeof window&&window.JSON)?window.JSON:b("json3")},{json3:3}],24:[function(b,c,a){function d(l){var f={},g,i=/\+/g,h=/([^&=]+)=?([^&]*)/g,k=function(m){return decodeURIComponent(m.replace(i," "))},j=l.split("?")[1];while(!!(g=h.exec(j))){f[k(g[1])]=k(g[2])}return f}c.exports=d},{}],25:[function(b,c,a){(function(d){(function(i){if(typeof define==="function"&&define.amd){define("keen",[],function(){return i()})}if(typeof a==="object"&&typeof c!=="undefined"){c.exports=i()}var h=null;if(typeof window!=="undefined"){h=window}else{if(typeof d!=="undefined"){h=d}else{if(typeof self!=="undefined"){h=self}}}if(h){h.Keen=i()}})(function(){var f=b("./core"),g=b("./core/utils/extend");g(f.prototype,{addEvent:b("./core/lib/addEvent"),addEvents:b("./core/lib/addEvents"),setGlobalProperties:b("./core/lib/setGlobalProperties"),trackExternalLink:b("./core/lib/trackExternalLink")});f.Base64=b("./core/utils/base64");f.utils={domready:b("domready"),each:b("./core/utils/each"),extend:g,parseParams:b("./core/utils/parseParams")};if(f.loaded){setTimeout(function(){f.utils.domready(function(){f.emit("ready")})},0)}b("./core/async")();c.exports=f;return f})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./core":14,"./core/async":7,"./core/lib/addEvent":15,"./core/lib/addEvents":16,"./core/lib/setGlobalProperties":17,"./core/lib/trackExternalLink":18,"./core/utils/base64":19,"./core/utils/each":20,"./core/utils/extend":22,"./core/utils/parseParams":24,domready:2}]},{},[25]);