-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathkeen-analysis.js.map
1 lines (1 loc) · 142 KB
/
keen-analysis.js.map
1
{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap","webpack:///./node_modules/keen-core/lib/utils/extend.js","webpack:///./node_modules/keen-core/lib/utils/each.js","webpack:///(webpack)/buildin/global.js","webpack:///./node_modules/promise-polyfill/src/polyfill.js","webpack:///./node_modules/promise-polyfill/src/finally.js","webpack:///./node_modules/whatwg-fetch/fetch.js","webpack:///./lib/utils/keys-to-underscore.js","webpack:///./node_modules/keen-core/lib/utils/serialize.js","webpack:///./node_modules/promise-polyfill/src/index.js","webpack:///./lib/utils/md5.js","webpack:///./lib/utils/cache-browser.js","webpack:///./lib/utils/http-browser.js","webpack:///./node_modules/abortcontroller-polyfill/dist/polyfill-patch-fetch.js","webpack:///./lib/request.js","webpack:///./lib/utils/validate-auth-credentials.js","webpack:///./node_modules/component-emitter/index.js","webpack:///./node_modules/keen-core/lib/utils/parse-params.js","webpack:///./node_modules/keen-core/lib/index.js","webpack:///./node_modules/process/browser.js","webpack:///./node_modules/setimmediate/setImmediate.js","webpack:///./node_modules/timers-browserify/main.js","webpack:///./lib/index.js","webpack:///./lib/browser.js"],"names":["mapKeysToUnderscore","obj","exludedKeys","keys","Object","convertedObj","forEach","value","key","includes","match","RegExp","replace","k","toLowerCase","Array","isArray","map","item","MD5","d","result","M","V","Y","X","length","_","m","f","r","charCodeAt","charAt","String","fromCharCode","i","n","h","t","g","e","md5_ii","md5_hh","md5_gg","md5_ff","safe_add","md5_cmn","bit_rol","indexedDBAvailable","self","cachingEnabled","db","cacheConfig","dbName","dbCollectionName","dbCollectionKey","maxAge","initializeIndexedDb","requestCacheConfig","Promise","resolve","reject","dbConnectionRequest","indexedDB","open","onerror","event","onupgradeneeded","target","objectStore","createObjectStore","keyPath","createIndex","unique","onsuccess","urlWithBodyHash","url","fetchOptions","JSON","stringify","body","saveToCache","responseJson","then","transactionSave","transaction","requestSave","add","expiryTime","Date","now","getFromCache","configOptions","cache","transactionCleanUp","indexCleanUp","index","upperBoundOpenKeyRange","IDBKeyRange","upperBound","openCursor","cursor","transactionDelete","delete","continue","transactionIndex","responseFromCache","get","sendFetch","method","config","options","headers","indexOf","api_key","params","undefined","mode","notFoundInCache","responseJSONFromCache","apiResponse","fetch","signal","catch","connectionError","response","ok","json","responseJSON","error_code","message","status","statusText","httpOptions","interval","group_by","analysis_type","val","res","isNaN","Number","resultParsers","parsedValue","func","event_collection","query","responseWithQuery","xhrObject","root","window","XMLHttpRequest","ActiveXObject","location","protocol","sendXhr","xhr","cb","callback","onreadystatechange","readyState","parse","responseText","setRequestHeader","send","sendJsonp","timestamp","getTime","scriptTag","document","createElement","parent","getElementsByTagName","callbackName","loaded","handleResponse","src","appendChild","a","b","removeChild","GET","POST","PUT","DEL","request","httpHandlers","requestUrlAndOptions","version","urlWithParams","urlParamsString","paramKeys","urlParam","decodeURIComponent","vals","encodeURIComponent","apiKey","bind","prototype","auth","str","timeout","num","Error","httpRequestType","httpHandler","split","pop","fetchAbortController","AbortController","httpHandlerResponse","requestPromise","abort","emit","validateAuthCredentials","projectId","masterKey","readKey","KeenLibrary","arguments","mapObj","analysisType","queryParams","analysisTypeExtracted","cacheOptionsExtracted","queryParamsExtracted","cacheOptions","includeMetadata","include_metadata","saved_query_name","savedQueryResultsUrl","name","dataset_name","queryBodyParams","timezone","getTimezoneOffset","post","Query","run","q","output","queries","promises","queryPromise","analysis","push","all","err","set","attributes","v","$1","dv","deepValue","deepKey","_deepKey","attribute","addFilter","property","operator","filters","pkg","KeenAnalysis","KeenAnalysisCore","put","del","keenGlobals","webpackKeenGlobals","Keen","extendLibrary"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAK;AACL;AACA;;AAEA;AACA;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;ACnEA;;AAEA;AACA,iBAAiB,sBAAsB;AACvC;AACA;AACA;AACA;AACA;AACA;;;;;;;ACTA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa,YAAY;AACzB;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC1BA;;AAEA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;;AAEA;AACA;AACA,4CAA4C;;AAE5C;;;;;;;;;;;ACnBA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;;AAED;AACA;AACA,CAAC;AACD;AACA;;;;;;;;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;;;;;;ACdA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA,KAAK;AACL;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,gBAAgB;AAChB;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA,OAAO;AACP,KAAK;AACL;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,wCAAwC,mBAAmB;AAC3D;AACA;;AAEA;AACA;AACA,kCAAkC,oBAAoB;AACtD;AACA;;AAEA;AACA;AACA,wCAAwC,4BAA4B;AACpE;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,mBAAmB,iBAAiB;AACpC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA,uDAAuD;AACvD,SAAS;AACT;AACA,SAAS;AACT,8EAA8E;AAC9E;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA,SAAS;AACT;AACA;AACA;;AAEA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA,8BAA8B,uBAAuB;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;;AAEA;AACA,uCAAuC,0BAA0B;AACjE;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA,+BAA+B,0BAA0B,eAAe;AACxE;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;AACA;AACA,OAAO;AACP;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,OAAO;;AAEP;AACA,KAAK;AACL;AACA;AACA,CAAC;;;;;;;;;;;;;;;;;;;;;;QCjdeA,mB,GAAAA,mB;AAAT,SAASA,mBAAT,CAA6BC,GAA7B,EAAkC;AACrC,QAAMC,cAAc,CAAC,OAAD,CAApB;;AAEA,QAAI,CAACD,GAAD,IAAQ,QAAOA,GAAP,yCAAOA,GAAP,OAAe,QAA3B,EAAqC,OAAOA,GAAP;;AAErC,QAAME,OAAOC,OAAOD,IAAP,CAAYF,GAAZ,KAAoB,EAAjC;AACA,QAAMI,eAAe,EAArB;AACAF,SAAKG,OAAL,CAAa,eAAO;AAChB,YAAMC,QAAQN,IAAIO,GAAJ,CAAd;AACA,YAAIN,Y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ED;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,KAAK;AACL;AACA;AACA,GAAG;AACH;AACA,GAAG;AACH;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,uCAAuC,OAAO;AAC9C;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA,GAAG;AACH;AACA,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA,WAAW;AACX,aAAa;AACb;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,iBAAiB;;AAErD;AACA;AACA,cAAc;AACd;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;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A;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,WAAW,MAAM;AACjB,YAAY;AACZ;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA,2CAA2C,SAAS;AACpD;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,WAAW,OAAO;AAClB,YAAY;AACZ;AACA;;AAEA;AACA;AACA;;;;;;;AClKA;;AAEA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA,6BAA6B,+CAA+C,EAAE;AAC9E;;AAEA;AACA;AACA;AACA;AACA;;;;;;;ACfA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA,oBAAoB,SAAS,IAAI,KAAK;AACtC,oBAAoB,SAAS,IAAI,KAAK;AACtC,oBAAoB,SAAS,IAAI,KAAK;AACtC,oBAAoB,SAAS,IAAI,KAAK,eAAe,UAAU;AAC/D,oBAAoB,SAAS,IAAI,KAAK,eAAe,UAAU;AAC/D,oBAAoB,SAAS,IAAI,KAAK,eAAe,UAAU;AAC/D,oBAAoB,SAAS,IAAI,KAAK,eAAe,UAAU;AAC/D,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;;AAEA;AACA;AACA,kDAAkD,SAAS,IAAI,KAAK;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,8BAA8B,YAAY;AAC1C;AACA,KAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;;AAEL;AACA;;AAEA;AACA;AACA;AACA,GAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA,CAAC,sIAAsI;;;;;;;;ACpOvI;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,KAAK;AACL;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,qCAAqC;;AAErC;AACA;AACA;;AAEA,2BAA2B;AAC3B;AACA;AACA;AACA,4BAA4B,UAAU;;;;;;;ACvLtC;AACA;;AAEA;AACA;AACA;;AAEA,uBAAuB;AACvB;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB,iBAAiB;AACtC;AACA;AACA;AACA,kBAAkB;AAClB;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,0CAA0C,sBAAsB,EAAE;AAClE;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,SAAS;AACT;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,yCAAyC;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA,UAAU;AACV;AACA;;AAEA,KAAK;AACL;AACA;;AA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AAoC;AAC9D;AACA,OAAK4G,MAAL,CAAYgJ,OAAZ,GAAsB,KAAKhJ,MAAL,CAAYgJ,OAAZ,IAAuB,EAA7C;AACA,OAAKhJ,MAAL,CAAYgJ,OAAZ,CAAoBf,IAApB,CAAyB;AACvB,qBAAiBa,QADM;AAEvB,gBAAYC,QAFW;AAGvB,sBAAkB3P;AAHK,GAAzB;AAKA,SAAO,IAAP;AACD,CATD;;AAWAkN,mBAAY9B,OAAZ,GAAsByE,kBAAIzE,OAA1B;;AAEO,IAAM0E,sCAAe5C,kBAArB;kBACQ4C,Y;;;;;;;;;;;;;;AC/Of;;;;AAEA;;;;AACA;;;;AACA;;IAAY5E,Y;;;;;;AAEZ6E,gBAAiBjE,SAAjB,CAA2B1F,GAA3B,GAAiC,IAAI6E,iBAAJ,CAAY,KAAZ,EAAmBC,YAAnB,CAAjC;AACA6E,gBAAiBjE,SAAjB,CAA2BsC,IAA3B,GAAkC,IAAInD,iBAAJ,CAAY,MAAZ,EAAoBC,YAApB,CAAlC;AACA6E,gBAAiBjE,SAAjB,CAA2BkE,GAA3B,GAAiC,IAAI/E,iBAAJ,CAAY,KAAZ,EAAmBC,YAAnB,CAAjC;AACA6E,gBAAiBjE,SAAjB,CAA2BmE,GAA3B,GAAiC,IAAIhF,iBAAJ,CAAY,QAAZ,EAAsBC,YAAtB,CAAjC;;AAEO,IAAIgF,oCAAcrJ,SAAlB;AACP,IAAI,OAAOsJ,kBAAP,KAA8B,WAAlC,EAA+C;AAC7C,UAFSD,WAET,iBAAcC,kBAAd;AACD;;AAEM,IAAMC,sBAAOL,gBAAiBM,aAAjB,CAA+BN,eAA/B,CAAb;AACA,IAAMD,sCAAeM,IAArB,C,CAA2B;kBACnBA,I","file":"keen-analysis.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(window, function() {\nreturn "," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 24);\n","module.exports = extend;\n\nfunction extend(target){\n for (var i = 1; i < arguments.length; i++) {\n for (var prop in arguments[i]){\n target[prop] = arguments[i][prop];\n }\n }\n return target;\n};\n","module.exports = each;\n\nfunction each(o, cb, s){\n var n;\n if (!o){\n return 0;\n }\n s = !s ? o : s;\n if (o instanceof Array){\n // Indexed arrays, needed for Safari\n for (n=0; n<o.length; n++) {\n if (cb.call(s, o[n], n, o) === false){\n return 0;\n }\n }\n } else {\n // Hashtables\n for (n in o){\n if (o.hasOwnProperty(n)) {\n if (cb.call(s, o[n], n, o) === false){\n return 0;\n }\n }\n }\n }\n return 1;\n}\n","var g;\r\n\r\n// This works in non-strict mode\r\ng = (function() {\r\n\treturn this;\r\n})();\r\n\r\ntry {\r\n\t// This works if eval is allowed (see CSP)\r\n\tg = g || Function(\"return this\")() || (1, eval)(\"this\");\r\n} catch (e) {\r\n\t// This works if the window reference is available\r\n\tif (typeof window === \"object\") g = window;\r\n}\r\n\r\n// g can still be undefined, but nothing to do about it...\r\n// We return undefined, instead of nothing here, so it's\r\n// easier to handle this case. if(!global) { ...}\r\n\r\nmodule.exports = g;\r\n","import Promise from './index';\nimport promiseFinally from './finally';\n\nvar globalNS = (function() {\n // the only reliable means to get the global object is\n // `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n throw new Error('unable to locate global object');\n})();\n\nif (!globalNS.Promise) {\n globalNS.Promise = Promise;\n} else if (!globalNS.Promise.prototype['finally']) {\n globalNS.Promise.prototype['finally'] = promiseFinally;\n}\n","export default function(callback) {\n var constructor = this.constructor;\n return this.then(\n function(value) {\n return constructor.resolve(callback()).then(function() {\n return value;\n });\n },\n function(reason) {\n return constructor.resolve(callback()).then(function() {\n return constructor.reject(reason);\n });\n }\n );\n}\n","(function(self) {\n 'use strict';\n\n if (self.fetch) {\n return\n }\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob: 'FileReader' in self && 'Blob' in self && (function() {\n try {\n new Blob()\n return true\n } catch(e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ]\n\n var isDataView = function(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n var isArrayBufferView = ArrayBuffer.isView || function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n }\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name)\n }\n if (/[^a-z0-9\\-#$%&'*+.\\^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value)\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift()\n return {done: value === undefined, value: value}\n }\n }\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n }\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {}\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value)\n }, this)\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1])\n }, this)\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name])\n }, this)\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name)\n value = normalizeValue(value)\n var oldValue = this.map[name]\n this.map[name] = oldValue ? oldValue+','+value : value\n }\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)]\n }\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name)\n return this.has(name) ? this.map[name] : null\n }\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n }\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value)\n }\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this)\n }\n }\n }\n\n Headers.prototype.keys = function() {\n var items = []\n this.forEach(function(value, name) { items.push(name) })\n return iteratorFor(items)\n }\n\n Headers.prototype.values = function() {\n var items = []\n this.forEach(function(value) { items.push(value) })\n return iteratorFor(items)\n }\n\n Headers.prototype.entries = function() {\n var items = []\n this.forEach(function(value, name) { items.push([name, value]) })\n return iteratorFor(items)\n }\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result)\n }\n reader.onerror = function() {\n reject(reader.error)\n }\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsArrayBuffer(blob)\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader()\n var promise = fileReaderReady(reader)\n reader.readAsText(blob)\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf)\n var chars = new Array(view.length)\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i])\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength)\n view.set(new Uint8Array(buf))\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false\n\n this._initBody = function(body) {\n this._bodyInit = body\n if (!body) {\n this._bodyText = ''\n } else if (typeof body === 'string') {\n this._bodyText = body\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString()\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer)\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer])\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body)\n } else {\n throw new Error('unsupported BodyInit type')\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8')\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type)\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8')\n }\n }\n }\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n }\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n }\n }\n\n this.text = function() {\n var rejected = consumed(this)\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n }\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n }\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n }\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase()\n return (methods.indexOf(upcased) > -1) ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {}\n var body = options.body\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url\n this.credentials = input.credentials\n if (!options.headers) {\n this.headers = new Headers(input.headers)\n }\n this.method = input.method\n this.mode = input.mode\n if (!body && input._bodyInit != null) {\n body = input._bodyInit\n input.bodyUsed = true\n }\n } else {\n this.url = String(input)\n }\n\n this.credentials = options.credentials || this.credentials || 'omit'\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers)\n }\n this.method = normalizeMethod(options.method || this.method || 'GET')\n this.mode = options.mode || this.mode || null\n this.referrer = null\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body)\n }\n\n Request.prototype.clone = function() {\n return new Request(this, { body: this._bodyInit })\n }\n\n function decode(body) {\n var form = new FormData()\n body.trim().split('&').forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=')\n var name = split.shift().replace(/\\+/g, ' ')\n var value = split.join('=').replace(/\\+/g, ' ')\n form.append(decodeURIComponent(name), decodeURIComponent(value))\n }\n })\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers()\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ')\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':')\n var key = parts.shift().trim()\n if (key) {\n var value = parts.join(':').trim()\n headers.append(key, value)\n }\n })\n return headers\n }\n\n Body.call(Request.prototype)\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {}\n }\n\n this.type = 'default'\n this.status = options.status === undefined ? 200 : options.status\n this.ok = this.status >= 200 && this.status < 300\n this.statusText = 'statusText' in options ? options.statusText : 'OK'\n this.headers = new Headers(options.headers)\n this.url = options.url || ''\n this._initBody(bodyInit)\n }\n\n Body.call(Response.prototype)\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n }\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''})\n response.type = 'error'\n return response\n }\n\n var redirectStatuses = [301, 302, 303, 307, 308]\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n }\n\n self.Headers = Headers\n self.Request = Request\n self.Response = Response\n\n self.fetch = function(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init)\n var xhr = new XMLHttpRequest()\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n }\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL')\n var body = 'response' in xhr ? xhr.response : xhr.responseText\n resolve(new Response(body, options))\n }\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'))\n }\n\n xhr.open(request.method, request.url, true)\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob'\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value)\n })\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)\n })\n }\n self.fetch.polyfill = true\n})(typeof self !== 'undefined' ? self : this);\n","export function mapKeysToUnderscore(obj) {\n const exludedKeys = ['cache'];\n\n if (!obj || typeof obj !== 'object') return obj;\n\n const keys = Object.keys(obj) || [];\n const convertedObj = {};\n keys.forEach(key => {\n const value = obj[key];\n if (exludedKeys.includes(key)) {\n return convertedObj[key] = value;\n }\n\n if ((key.match(new RegExp('[A-Z]')))) {\n key = key.replace(/[A-Z]/g, k => `_${k.toLowerCase()}`);\n }\n\n if (Array.isArray(value)) {\n return convertedObj[key] = value.map(item => mapKeysToUnderscore(item));\n }\n \n if (typeof value === 'object') {\n return convertedObj[key] = mapKeysToUnderscore(value);\n }\n\n convertedObj[key] = value;\n });\n\n return convertedObj;\n }","var each = require('./each'),\n extend = require('./extend');\n\nmodule.exports = serialize;\n\nfunction serialize(data){\n var query = [];\n each(data, function(value, key){\n if ('string' !== typeof value) {\n value = JSON.stringify(value);\n }\n query.push(key + '=' + encodeURIComponent(value));\n });\n return query.join('&');\n}\n","import promiseFinally from './finally';\n\n// Store setTimeout reference so promise-polyfill will be unaffected by\n// other code modifying setTimeout (like sinon.useFakeTimers())\nvar setTimeoutFunc = setTimeout;\n\nfunction noop() {}\n\n// Polyfill for Function.prototype.bind\nfunction bind(fn, thisArg) {\n return function() {\n fn.apply(thisArg, arguments);\n };\n}\n\nfunction Promise(fn) {\n if (!(this instanceof Promise))\n throw new TypeError('Promises must be constructed via new');\n if (typeof fn !== 'function') throw new TypeError('not a function');\n this._state = 0;\n this._handled = false;\n this._value = undefined;\n this._deferreds = [];\n\n doResolve(fn, this);\n}\n\nfunction handle(self, deferred) {\n while (self._state === 3) {\n self = self._value;\n }\n if (self._state === 0) {\n self._deferreds.push(deferred);\n return;\n }\n self._handled = true;\n Promise._immediateFn(function() {\n var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n return;\n }\n var ret;\n try {\n ret = cb(self._value);\n } catch (e) {\n reject(deferred.promise, e);\n return;\n }\n resolve(deferred.promise, ret);\n });\n}\n\nfunction resolve(self, newValue) {\n try {\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n if (newValue === self)\n throw new TypeError('A promise cannot be resolved with itself.');\n if (\n newValue &&\n (typeof newValue === 'object' || typeof newValue === 'function')\n ) {\n var then = newValue.then;\n if (newValue instanceof Promise) {\n self._state = 3;\n self._value = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(bind(then, newValue), self);\n return;\n }\n }\n self._state = 1;\n self._value = newValue;\n finale(self);\n } catch (e) {\n reject(self, e);\n }\n}\n\nfunction reject(self, newValue) {\n self._state = 2;\n self._value = newValue;\n finale(self);\n}\n\nfunction finale(self) {\n if (self._state === 2 && self._deferreds.length === 0) {\n Promise._immediateFn(function() {\n if (!self._handled) {\n Promise._unhandledRejectionFn(self._value);\n }\n });\n }\n\n for (var i = 0, len = self._deferreds.length; i < len; i++) {\n handle(self, self._deferreds[i]);\n }\n self._deferreds = null;\n}\n\nfunction Handler(onFulfilled, onRejected, promise) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}\n\nPromise.prototype['catch'] = function(onRejected) {\n return this.then(null, onRejected);\n};\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n var prom = new this.constructor(noop);\n\n handle(this, new Handler(onFulfilled, onRejected, prom));\n return prom;\n};\n\nPromise.prototype['finally'] = promiseFinally;\n\nPromise.all = function(arr) {\n return new Promise(function(resolve, reject) {\n if (!arr || typeof arr.length === 'undefined')\n throw new TypeError('Promise.all accepts an array');\n var args = Array.prototype.slice.call(arr);\n if (args.length === 0) return resolve([]);\n var remaining = args.length;\n\n function res(i, val) {\n try {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n var then = val.then;\n if (typeof then === 'function') {\n then.call(\n val,\n function(val) {\n res(i, val);\n },\n reject\n );\n return;\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n } catch (ex) {\n reject(ex);\n }\n }\n\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n};\n\nPromise.resolve = function(value) {\n if (value && typeof value === 'object' && value.constructor === Promise) {\n return value;\n }\n\n return new Promise(function(resolve) {\n resolve(value);\n });\n};\n\nPromise.reject = function(value) {\n return new Promise(function(resolve, reject) {\n reject(value);\n });\n};\n\nPromise.race = function(values) {\n return new Promise(function(resolve, reject) {\n for (var i = 0, len = values.length; i < len; i++) {\n values[i].then(resolve, reject);\n }\n });\n};\n\n// Use polyfill for setImmediate for performance gains\nPromise._immediateFn =\n (typeof setImmediate === 'function' &&\n function(fn) {\n setImmediate(fn);\n }) ||\n function(fn) {\n setTimeoutFunc(fn, 0);\n };\n\nPromise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n if (typeof console !== 'undefined' && console) {\n console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console\n }\n};\n\nexport default Promise;\n","export const MD5 = function(d){const result = M(V(Y(X(d),8*d.length)));return result.toLowerCase()};function M(d){for(var _,m=\"0123456789ABCDEF\",f=\"\",r=0;r<d.length;r++)_=d.charCodeAt(r),f+=m.charAt(_>>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<<m%32;return _}function V(d){for(var _=\"\",m=0;m<32*d.length;m+=8)_+=String.fromCharCode(d[m>>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,r=-1732584194,i=271733878,n=0;n<d.length;n+=16){var h=m,t=f,g=r,e=i;f=md5_ii(f=md5_ii(f=md5_ii(f=md5_ii(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_ff(f=md5_ff(f=md5_ff(f=md5_ff(f,r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+0],7,-680876936),f,r,d[n+1],12,-389564586),m,f,d[n+2],17,606105819),i,m,d[n+3],22,-1044525330),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+4],7,-176418897),f,r,d[n+5],12,1200080426),m,f,d[n+6],17,-1473231341),i,m,d[n+7],22,-45705983),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+8],7,1770035416),f,r,d[n+9],12,-1958414417),m,f,d[n+10],17,-42063),i,m,d[n+11],22,-1990404162),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+12],7,1804603682),f,r,d[n+13],12,-40341101),m,f,d[n+14],17,-1502002290),i,m,d[n+15],22,1236535329),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+1],5,-165796510),f,r,d[n+6],9,-1069501632),m,f,d[n+11],14,643717713),i,m,d[n+0],20,-373897302),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+5],5,-701558691),f,r,d[n+10],9,38016083),m,f,d[n+15],14,-660478335),i,m,d[n+4],20,-405537848),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+9],5,568446438),f,r,d[n+14],9,-1019803690),m,f,d[n+3],14,-187363961),i,m,d[n+8],20,1163531501),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+13],5,-1444681467),f,r,d[n+2],9,-51403784),m,f,d[n+7],14,1735328473),i,m,d[n+12],20,-1926607734),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+5],4,-378558),f,r,d[n+8],11,-2022574463),m,f,d[n+11],16,1839030562),i,m,d[n+14],23,-35309556),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+1],4,-1530992060),f,r,d[n+4],11,1272893353),m,f,d[n+7],16,-155497632),i,m,d[n+10],23,-1094730640),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+13],4,681279174),f,r,d[n+0],11,-358537222),m,f,d[n+3],16,-722521979),i,m,d[n+6],23,76029189),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+9],4,-640364487),f,r,d[n+12],11,-421815835),m,f,d[n+15],16,530742520),i,m,d[n+2],23,-995338651),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+0],6,-198630844),f,r,d[n+7],10,1126891415),m,f,d[n+14],15,-1416354905),i,m,d[n+5],21,-57434055),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+12],6,1700485571),f,r,d[n+3],10,-1894986606),m,f,d[n+10],15,-1051523),i,m,d[n+1],21,-2054922799),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+8],6,1873313359),f,r,d[n+15],10,-30611744),m,f,d[n+6],15,-1560198380),i,m,d[n+13],21,1309151649),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+4],6,-145523070),f,r,d[n+11],10,-1120210379),m,f,d[n+2],15,718787259),i,m,d[n+9],21,-343485551),m=safe_add(m,h),f=safe_add(f,t),r=safe_add(r,g),i=safe_add(i,e)}return Array(m,f,r,i)}function md5_cmn(d,_,m,f,r,i){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,i)),r),m)}function md5_ff(d,_,m,f,r,i,n){return md5_cmn(_&m|~_&f,d,_,r,i,n)}function md5_gg(d,_,m,f,r,i,n){return md5_cmn(_&f|m&~f,d,_,r,i,n)}function md5_hh(d,_,m,f,r,i,n){return md5_cmn(_^m^f,d,_,r,i,n)}function md5_ii(d,_,m,f,r,i,n){return md5_cmn(m^(_|~f),d,_,r,i,n)}function safe_add(d,_){var m=(65535&d)+(65535&_);return(d>>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}\n\nexport default MD5;\n","import 'promise-polyfill/src/polyfill';\nimport 'whatwg-fetch';\n\nimport MD5 from './md5';\n\nconst indexedDBAvailable = 'indexedDB' in self;\nlet cachingEnabled = true;\n\nif (!indexedDBAvailable) {\n // console.log(\"Your browser doesn't support a stable version of IndexedDB.\");\n cachingEnabled = false; // graceful degradation\n}\n\nlet db;\nlet cacheConfig = {\n dbName: 'keenAnalysisIndexedDB',\n dbCollectionName: 'requests',\n dbCollectionKey: 'url',\n maxAge: 60000\n};\n\nfunction initializeIndexedDb(requestCacheConfig = {}){\n if (db) { return Promise.resolve(); }\n if (!cachingEnabled) { return Promise.resolve(); }\n cacheConfig = {\n ...cacheConfig,\n ...requestCacheConfig\n };\n return new Promise((resolve, reject) => {\n const dbConnectionRequest = self.indexedDB.open(cacheConfig.dbName);\n dbConnectionRequest.onerror = function(event) {\n cachingEnabled = false;\n resolve();\n };\n\n dbConnectionRequest.onupgradeneeded = function(event) {\n const db = event.target.result;\n const objectStore = db\n .createObjectStore(cacheConfig.dbCollectionName,\n { keyPath: cacheConfig.dbCollectionKey });\n objectStore.createIndex(\n cacheConfig.dbCollectionKey,\n cacheConfig.dbCollectionKey,\n { unique: true }\n );\n objectStore.createIndex('expiryTime', 'expiryTime', { unique: false });\n };\n\n dbConnectionRequest.onsuccess = function(event) {\n db = event.target.result;\n db.onerror = function(event) {\n cachingEnabled = false; // graceful degradation\n };\n resolve(db);\n };\n });\n}\n\nconst urlWithBodyHash = (url, fetchOptions) => {\n return MD5(`${url}&body=${JSON.stringify(fetchOptions.body)}`);\n}\n\nexport const saveToCache = (url, fetchOptions, responseJson) => {\n return initializeIndexedDb().then(() => {\n const transactionSave = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName);\n const requestSave = transactionSave.add({\n url: urlWithBodyHash(url, fetchOptions),\n expiryTime: Date.now() + cacheConfig.maxAge,\n responseJson\n });\n requestSave.onsuccess = function(event) {\n };\n requestSave.onerror = function(event) {\n cachingEnabled = false;\n };\n });\n}\n\nexport const getFromCache = (url, fetchOptions, configOptions = {}) => {\n return initializeIndexedDb(configOptions.cache).then(() => {\n return new Promise((resolve, reject) => {\n if (!cachingEnabled) {\n return resolve(null);\n }\n\n const transactionCleanUp = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName);\n const indexCleanUp = transactionCleanUp.index('expiryTime');\n const upperBoundOpenKeyRange = IDBKeyRange.upperBound(Date.now(), true);\n indexCleanUp.openCursor(upperBoundOpenKeyRange).onsuccess = function(event) {\n let cursor = event.target.result;\n if (cursor) {\n let transactionDelete = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName)\n .delete(event.target.result.value[cacheConfig.dbCollectionKey]);\n cursor.continue();\n }\n };\n\n const transactionIndex = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName);\n const index = transactionIndex.index(cacheConfig.dbCollectionKey);\n const responseFromCache = index.get(urlWithBodyHash(url, fetchOptions));\n responseFromCache.onsuccess = function(event) {\n if (!event.target.result ||\n event.target.result.expiryTime < Date.now()\n ) {\n if (event.target.result && event.target.result.expiryTime < Date.now()){\n const transactionDelete = db\n .transaction(cacheConfig.dbCollectionName, \"readwrite\")\n .objectStore(cacheConfig.dbCollectionName)\n .delete(event.target.result[cacheConfig.dbCollectionKey]);\n transactionDelete.onsuccess = (event) => {\n resolve(getFromCache(url, fetchOptions, configOptions));\n };\n transactionDelete.onerror = (event) => {\n cachingEnabled = false;\n resolve(getFromCache(url, fetchOptions, configOptions));\n };\n return resolve(null);\n }\n return resolve(null);\n } else {\n return resolve(event.target.result.responseJson);\n }\n };\n responseFromCache.onerror = function(event) {\n cachingEnabled = false;\n resolve(getFromCache(url, fetchOptions, configOptions));\n };\n });\n });\n}\n","import 'promise-polyfill/src/polyfill';\nimport 'whatwg-fetch';\n\nimport each from 'keen-core/lib/utils/each';\nimport extend from 'keen-core/lib/utils/extend';\nimport serialize from 'keen-core/lib/utils/serialize';\n\nimport { getFromCache, saveToCache } from './cache-browser';\n\nconst sendFetch = (method, config, options = {}) => {\n const headers = {};\n let url = config.url;\n\n if (method === 'GET' || method === 'DELETE') {\n if(url.indexOf('?') === -1){\n url += '?';\n } else {\n url += '&';\n }\n if (config.api_key) {\n url += 'api_key=' + config.api_key + '&';\n }\n if (config.params) {\n url += serialize(config.params);\n }\n }\n\n each(config.headers, function(value, key){\n if (typeof value === 'string') {\n headers[key] = value;\n }\n });\n\n const fetchOptions = {\n method,\n body: (method !== 'GET' && config.params) ?\n JSON.stringify(config.params) : undefined,\n mode: 'cors',\n headers\n };\n\n if (config.cache\n && method !== 'DELETE'\n && method !== 'PUT'\n && !options.notFoundInCache\n ) {\n return getFromCache(url, fetchOptions, config)\n .then(responseJSONFromCache => {\n if (responseJSONFromCache) {\n return options.resolve(responseJSONFromCache);\n }\n sendFetch(method, config, {...options, notFoundInCache: true});\n });\n }\n\n let apiResponse;\n\n fetch(url, {\n ...fetchOptions,\n signal: options.signal // abort signal\n })\n .catch(connectionError => {\n options.reject(connectionError);\n return;\n })\n .then(response => {\n if (!response) return;\n apiResponse = response;\n if (response.ok && method === 'DELETE'){\n return {};\n }\n return response.json();\n })\n .then(responseJSON => {\n if (!responseJSON) return;\n if (responseJSON.error_code || !apiResponse.ok) {\n return options.reject({\n ok: false,\n error_code: responseJSON.error_code,\n body: responseJSON.message,\n status: apiResponse.status,\n statusText: apiResponse.statusText\n });\n }\n if (config.cache\n && method !== 'DELETE'\n && method !== 'PUT'\n ) {\n saveToCache(url, fetchOptions, responseJSON);\n }\n const httpOptions = extend({}, config);\n\n if(Array.isArray(responseJSON.result)){\n if(config.params.interval){\n if(config.params.group_by){\n if(config.params.analysis_type === 'extraction'){\n options.resolve(responseJSON);\n } else if (responseJSON.result && Array.isArray(responseJSON.result)){\n //interval and group by result\n responseJSON.result.forEach((val) => {\n if (!val.value) return val;\n if (!Array.isArray(val.value)) return val.value;\n val.value.forEach((res) => {\n if(!isNaN(Number(res.result))){\n res.result = Number(res.result);\n }\n })\n })\n }\n }\n else {\n //interval result\n responseJSON.result.forEach((val) => {\n if(!isNaN(Number(val.value))){\n val.value = Number(val.value);\n }\n })\n }\n }\n else {\n //group by result\n responseJSON.result.forEach((res) => {\n if(!isNaN(Number(res.result))){\n res.result = Number(res.result);\n }\n })\n }\n }\n else {\n //simple result\n if(!isNaN(Number(responseJSON.result))){\n responseJSON.result = Number(responseJSON.result);\n }\n }\n //math round values config check\n if(config.resultParsers){\n if(Array.isArray(responseJSON.result)){\n if(config.params.interval){\n if(config.params.group_by){\n //interval and group by result\n responseJSON.result.forEach((val) => {\n val.value.forEach((res) => {\n let parsedValue;\n config.resultParsers.forEach((func) => {\n parsedValue = parsedValue ? func(parsedValue) : func(res.result);\n })\n res.result = parsedValue;\n })\n })\n }\n else {\n //interval result\n responseJSON.result.forEach((val) => {\n let parsedValue;\n config.resultParsers.forEach((func) => {\n parsedValue = parsedValue ? func(parsedValue) : func(val.value);\n })\n val.value = parsedValue;\n })\n }\n }\n else {\n //group by result\n responseJSON.result.forEach((res) => {\n let parsedValue;\n config.resultParsers.forEach((func) => {\n parsedValue = parsedValue ? func(parsedValue) : func(res.result);\n })\n res.result = parsedValue;\n })\n }\n } else if (typeof responseJSON.result === 'object') {\n Object.keys(responseJSON.result).forEach((res) => {\n let parsedValue;\n config.resultParsers.forEach((func) => {\n parsedValue = parsedValue ? func(parsedValue) : func(responseJSON.result[res]);\n });\n responseJSON.result[res] = parsedValue;\n });\n } else {\n //simple result\n let parsedValue;\n config.resultParsers.forEach((func) => {\n parsedValue = parsedValue ? func(parsedValue) : func(responseJSON.result);\n });\n responseJSON.result = parsedValue;\n }\n }\n if (httpOptions.params &&\n typeof httpOptions.params.event_collection !== 'undefined'\n && typeof responseJSON.query === 'undefined') {\n const responseWithQuery = extend({ query: httpOptions.params }, responseJSON);\n options.resolve(responseWithQuery);\n }\n\n options.resolve(responseJSON);\n });\n}\n\n// XMLHttpRequest Support\n// ------------------------------\n// DEPRECATED - WILL BE REMOVED\nconst xhrObject = () => {\n const root = window || this;\n if (root.XMLHttpRequest &&\n (\n !root.ActiveXObject ||\n (root.location && root.location.protocol\n && 'file:' !== root.location.protocol)\n )\n ) {\n return new XMLHttpRequest;\n } else {\n try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}\n try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}\n }\n return false;\n}\n\nconst sendXhr = (method, config, options = {}) => {\n const xhr = xhrObject();\n const cb = options.callback;\n let url = config.url;\n\n xhr.onreadystatechange = function() {\n let response;\n if (xhr.readyState == 4) {\n if (xhr.status >= 200 && xhr.status < 300) {\n if (xhr.status === 204) {\n if (cb) {\n cb(null, xhr);\n }\n }\n else {\n try {\n response = JSON.parse( xhr.responseText );\n if (cb && response) {\n cb(null, response);\n }\n }\n catch (e) {\n if (cb) {\n cb(xhr, null);\n }\n }\n }\n }\n else {\n try {\n response = JSON.parse( xhr.responseText );\n if (cb && response) {\n cb(response, null);\n }\n }\n catch (e) {\n if (cb) {\n cb(xhr, null);\n }\n }\n }\n }\n };\n\n if (method !== 'GET') {\n xhr.open(method, url, true);\n each(config.headers, function(value, key){\n if (typeof value === 'string') {\n xhr.setRequestHeader(key, value);\n }\n });\n if (config.params) {\n xhr.send( JSON.stringify(config.params) );\n }\n else {\n xhr.send();\n }\n }\n else {\n url += '?';\n if (config.api_key) {\n url += 'api_key=' + config.api_key + '&';\n }\n if (config.params) {\n url += serialize(config.params);\n }\n xhr.open(method, url, true);\n each(config.headers, function(value, key){\n if (typeof value === 'string') {\n xhr.setRequestHeader(key, value);\n }\n });\n xhr.send();\n }\n\n return xhr;\n}\n\n// JSON-P Support\n// DEPRECATED - WILL BE REMOVED\nconst sendJsonp = (config, options = {}) => {\n let url = config.url;\n let cb = options.callback;\n const timestamp = new Date().getTime();\n const scriptTag = document.createElement('script');\n const parent = document.getElementsByTagName('head')[0];\n let callbackName = 'keenJSONPCallback';\n let loaded = false;\n\n callbackName += timestamp;\n while (callbackName in window) {\n callbackName += 'a';\n }\n\n window[callbackName] = function(response) {\n if (loaded === true) {\n return;\n }\n handleResponse(null, response);\n };\n\n if (config.params) {\n url += serialize(config.params);\n }\n\n // Early IE (no onerror event)\n scriptTag.onreadystatechange = function() {\n if (loaded === false && this.readyState === 'loaded') {\n handleResponse('An error occurred', null);\n }\n };\n\n // Not IE\n scriptTag.onerror = function() {\n // on IE9 both onerror and onreadystatechange are called\n if (loaded === false) {\n handleResponse('An error occurred', null);\n }\n };\n\n scriptTag.src = url + '&jsonp=' + callbackName;\n parent.appendChild(scriptTag);\n\n const handleResponse = (a, b) => {\n loaded = true;\n if (cb && typeof cb === 'function') {\n cb(a, b);\n cb = void 0;\n }\n window[callbackName] = undefined;\n try {\n delete window[callbackName];\n } catch(e){};\n parent.removeChild(scriptTag);\n }\n\n}\n\n// HTTP Handlers\n// ------------------------------\n\nexport const GET = (config, options) => {\n if (typeof fetch !== 'undefined') {\n return sendFetch('GET', config, options);\n }\n else if (xhrObject()) {\n return sendXhr('GET', config, options);\n }\n else {\n return sendJsonp(config, options);\n }\n}\n\nexport const POST = (config, options) => {\n if (typeof fetch !== 'undefined') {\n return sendFetch('POST', config, options);\n }\n else if (xhrObject()) {\n return sendXhr('POST', config, options);\n }\n else {\n options.reject('XHR POST not supported');\n }\n}\n\nexport const PUT = (config, options) => {\n if (typeof fetch !== 'undefined') {\n return sendFetch('PUT', config, options);\n }\n else if (xhrObject()) {\n return sendXhr('PUT', config, options);\n }\n else {\n options.reject('XHR PUT not supported');\n }\n}\n\nexport const DEL = (config, options) => {\n if (typeof fetch !== 'undefined') {\n return sendFetch('DELETE', config, options);\n }\n else if (xhrObject()) {\n return sendXhr('DELETE', config, options);\n }\n else {\n options.reject('XHR DELETE not supported');\n }\n}\n","(function (global, factory) {\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(factory());\n}(this, (function () { 'use strict';\n\nvar classCallCheck = function (instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n};\n\nvar createClass = function () {\n function defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n }\n\n return function (Constructor, protoProps, staticProps) {\n if (protoProps) defineProperties(Constructor.prototype, protoProps);\n if (staticProps) defineProperties(Constructor, staticProps);\n return Constructor;\n };\n}();\n\nvar get = function get(object, property, receiver) {\n if (object === null) object = Function.prototype;\n var desc = Object.getOwnPropertyDescriptor(object, property);\n\n if (desc === undefined) {\n var parent = Object.getPrototypeOf(object);\n\n if (parent === null) {\n return undefined;\n } else {\n return get(parent, property, receiver);\n }\n } else if (\"value\" in desc) {\n return desc.value;\n } else {\n var getter = desc.get;\n\n if (getter === undefined) {\n return undefined;\n }\n\n return getter.call(receiver);\n }\n};\n\nvar inherits = function (subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass);\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n enumerable: false,\n writable: true,\n configurable: true\n }\n });\n if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;\n};\n\nvar possibleConstructorReturn = function (self, call) {\n if (!self) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self;\n};\n\nvar Emitter = function () {\n function Emitter() {\n classCallCheck(this, Emitter);\n\n this.listeners = {};\n }\n\n createClass(Emitter, [{\n key: 'addEventListener',\n value: function addEventListener(type, callback) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n this.listeners[type].push(callback);\n }\n }, {\n key: 'removeEventListener',\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n var stack = this.listeners[type];\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i] === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: 'dispatchEvent',\n value: function dispatchEvent(event) {\n var _this = this;\n\n if (!(event.type in this.listeners)) {\n return;\n }\n var debounce = function debounce(callback) {\n setTimeout(function () {\n return callback.call(_this, event);\n });\n };\n var stack = this.listeners[event.type];\n for (var i = 0, l = stack.length; i < l; i++) {\n debounce(stack[i]);\n }\n return !event.defaultPrevented;\n }\n }]);\n return Emitter;\n}();\n\nvar AbortSignal = function (_Emitter) {\n inherits(AbortSignal, _Emitter);\n\n function AbortSignal() {\n classCallCheck(this, AbortSignal);\n\n var _this2 = possibleConstructorReturn(this, (AbortSignal.__proto__ || Object.getPrototypeOf(AbortSignal)).call(this));\n\n _this2.aborted = false;\n _this2.onabort = null;\n return _this2;\n }\n\n createClass(AbortSignal, [{\n key: 'toString',\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: 'dispatchEvent',\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n get(AbortSignal.prototype.__proto__ || Object.getPrototypeOf(AbortSignal.prototype), 'dispatchEvent', this).call(this, event);\n }\n }]);\n return AbortSignal;\n}(Emitter);\n\nvar AbortController = function () {\n function AbortController() {\n classCallCheck(this, AbortController);\n\n this.signal = new AbortSignal();\n }\n\n createClass(AbortController, [{\n key: 'abort',\n value: function abort() {\n var event = void 0;\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n this.signal.dispatchEvent(event);\n }\n }, {\n key: 'toString',\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = { fetch: patchTargets };\n }\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === undefined ? fetch.Request : _patchTargets$Request,\n _patchTargets$AbortCo = _patchTargets.AbortController,\n NativeAbortController = _patchTargets$AbortCo === undefined ? AbortController : _patchTargets$AbortCo;\n\n\n var Request = NativeRequest;\n // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection is wrapped in if (Request)\n if (Request) {\n // Do feature detecting\n var controller = new NativeAbortController();\n var signal = controller.signal;\n var request = new Request('/', { signal: signal });\n\n // Browser already supports abortable fetch (like FF v57 and fetch-polyfill)\n if (request.signal) {\n return { fetch: fetch, Request: Request };\n }\n\n Request = function Request(input, init) {\n var request = new NativeRequest(input, init);\n if (init && init.signal) {\n request.signal = init.signal;\n }\n return request;\n };\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError = void 0;\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n }\n\n // Return early if already aborted, thus avoiding making an HTTP request\n if (signal.aborted) {\n return Promise.reject(abortError);\n }\n\n // Turn an event into a promise, reject it once `abort` is dispatched\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, { once: true });\n });\n\n // Return the fastest promise (don't need to wait for request to finish)\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return { fetch: abortableFetch, Request: Request };\n}\n\n(function (self) {\n\n if (self.AbortController) {\n return;\n }\n\n self.AbortController = AbortController;\n self.AbortSignal = AbortSignal;\n\n if (!self.fetch) {\n console.warn('fetch() is not available, cannot install abortcontroller-polyfill');\n return;\n }\n\n var _abortableFetch = abortableFetchDecorator(self),\n fetch = _abortableFetch.fetch,\n Request = _abortableFetch.Request;\n\n self.fetch = fetch;\n self.Request = Request;\n})(typeof self !== 'undefined' ? self : global);\n\n})));\n","import each from 'keen-core/lib/utils/each';\nimport extend from 'keen-core/lib/utils/extend';\nimport 'abortcontroller-polyfill/dist/polyfill-patch-fetch';\nimport 'promise-polyfill/src/polyfill';\nimport { mapKeysToUnderscore } from './utils/keys-to-underscore';\n\nimport { version } from '../package.json';\n\nexport default function request(method, httpHandlers){\n this.httpHandlers = httpHandlers;\n return function(requestUrlAndOptions, options = {}){\n if (typeof requestUrlAndOptions === 'string') {\n // backward compatibility\n this.config = {\n api_key : undefined,\n method,\n params : {},\n url: requestUrlAndOptions,\n headers : {\n 'Authorization' : '',\n 'Content-type' : 'application/json',\n 'keen-sdk': `javascript-${version}`\n },\n ...options\n };\n return this;\n }\n\n if (requestUrlAndOptions && requestUrlAndOptions.params) {\n requestUrlAndOptions.params = mapKeysToUnderscore(requestUrlAndOptions.params);\n }\n\n if (method === 'DELETE') {\n // handle dated code example from the api reference docs\n const { url } = requestUrlAndOptions;\n let urlWithParams = url;\n let urlParamsString = '';\n const paramKeys = ['filters', 'timeframe', 'timezone'];\n paramKeys.forEach(key => {\n if (requestUrlAndOptions[key]) {\n let urlParam = requestUrlAndOptions[key];\n try {\n urlParam = JSON.parse(decodeURIComponent(requestUrlAndOptions[key]));\n } catch (e) {\n urlParam = requestUrlAndOptions[key];\n }\n if (Array.isArray(urlParam)) {\n urlParam = mapKeysToUnderscore({ vals: urlParam }).vals;\n }\n else if (typeof urlParam !== 'string') {\n urlParam = mapKeysToUnderscore(urlParam);\n }\n urlParamsString += `${key}=${encodeURIComponent(JSON.stringify(urlParam))}&`;\n }\n });\n if (urlWithParams.indexOf('?') === -1) {\n urlWithParams += '?';\n }\n urlWithParams += urlParamsString;\n\n this.config = {\n api_key : undefined,\n params : {},\n method,\n headers : {\n 'Authorization' : (requestUrlAndOptions.api_key || requestUrlAndOptions.apiKey),\n 'Content-type' : 'application/json',\n 'keen-sdk': `javascript-${version}`\n },\n ...requestUrlAndOptions,\n ...options,\n url: urlWithParams\n };\n return this.send();\n }\n\n this.config = {\n api_key : undefined,\n params : {},\n method,\n headers : {\n 'Authorization' : (requestUrlAndOptions.api_key || requestUrlAndOptions.apiKey),\n 'Content-type' : 'application/json',\n 'keen-sdk': `javascript-${version}`\n },\n ...requestUrlAndOptions,\n ...options\n };\n return this.send();\n }.bind(this);\n}\n\nrequest.prototype.auth = function(str){\n if (typeof str === 'string') {\n this.config.api_key = typeof str === 'string' ? str : undefined;\n this.headers({\n 'Authorization': str\n });\n }\n return this;\n};\n\nrequest.prototype.headers = function(obj){\n if (typeof obj === 'object') {\n each(obj, function(value, key){\n this.config['headers'][key] = value;\n }.bind(this));\n }\n return this;\n};\n\nrequest.prototype.timeout = function(num){\n this.config.timeout = typeof num === 'number' ? num : 300 * 1000;\n return this;\n};\n\nrequest.prototype.send = function(obj){\n if (this.config && !this.config.api_key && !this.config.apiKey) throw new Error('Please provide a valid API key');\n if (obj) {\n this.config.params = (obj && typeof obj === 'object') ? mapKeysToUnderscore(obj) : {};\n }\n let httpRequestType = this.config['method'];\n if (httpRequestType === 'DELETE') {\n // delete is a reserved word in JS, so to avoid bugs\n httpRequestType = 'DEL';\n }\n const httpHandler = this.httpHandlers[httpRequestType];\n const httpOptions = extend({}, this.config);\n const self = this;\n\n // Temporary mod to append analysis_type to responses\n // for generic HTTP requests to known query resources\n if (this.config['method'] !== 'DELETE'\n && typeof httpOptions.params.analysis_type === 'undefined') {\n if (httpOptions.url.indexOf('/queries/') > -1\n && httpOptions.url.indexOf('/saved/') < 0) {\n httpOptions.params.analysis_type =\n httpOptions.url.split('/queries/').pop();\n }\n }\n\n let fetchAbortController;\n if (typeof AbortController !== 'undefined') {\n fetchAbortController = new AbortController();\n }\n\n let httpHandlerResponse;\n const requestPromise = new Promise((resolve, reject) => {\n const options = {};\n if (fetchAbortController) {\n options.signal = fetchAbortController.signal;\n }\n options.resolve = resolve;\n options.reject = reject;\n httpHandlerResponse = httpHandler(httpOptions, options);\n return httpHandlerResponse;\n })\n .then(response => response)\n\n requestPromise.abort = () => {\n if (fetchAbortController) {\n // browser\n return fetchAbortController.abort();\n }\n\n //node\n httpHandlerResponse.emit('abort');\n }\n\n return requestPromise;\n};\n","export function validateAuthCredentials(config) {\n if (typeof config !== 'object') return;\n if (!config.projectId) throw new Error('Please provide valid project ID');\n if (!config.masterKey && !config.readKey) throw new Error('Please provide valid API key');\n return true;\n}","\r\n/**\r\n * Expose `Emitter`.\r\n */\r\n\r\nif (typeof module !== 'undefined') {\r\n module.exports = Emitter;\r\n}\r\n\r\n/**\r\n * Initialize a new `Emitter`.\r\n *\r\n * @api public\r\n */\r\n\r\nfunction Emitter(obj) {\r\n if (obj) return mixin(obj);\r\n};\r\n\r\n/**\r\n * Mixin the emitter properties.\r\n *\r\n * @param {Object} obj\r\n * @return {Object}\r\n * @api private\r\n */\r\n\r\nfunction mixin(obj) {\r\n for (var key in Emitter.prototype) {\r\n obj[key] = Emitter.prototype[key];\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Listen on the given `event` with `fn`.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.on =\r\nEmitter.prototype.addEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\r\n .push(fn);\r\n return this;\r\n};\r\n\r\n/**\r\n * Adds an `event` listener that will be invoked a single\r\n * time then automatically removed.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.once = function(event, fn){\r\n function on() {\r\n this.off(event, on);\r\n fn.apply(this, arguments);\r\n }\r\n\r\n on.fn = fn;\r\n this.on(event, on);\r\n return this;\r\n};\r\n\r\n/**\r\n * Remove the given callback for `event` or all\r\n * registered callbacks.\r\n *\r\n * @param {String} event\r\n * @param {Function} fn\r\n * @return {Emitter}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.off =\r\nEmitter.prototype.removeListener =\r\nEmitter.prototype.removeAllListeners =\r\nEmitter.prototype.removeEventListener = function(event, fn){\r\n this._callbacks = this._callbacks || {};\r\n\r\n // all\r\n if (0 == arguments.length) {\r\n this._callbacks = {};\r\n return this;\r\n }\r\n\r\n // specific event\r\n var callbacks = this._callbacks['$' + event];\r\n if (!callbacks) return this;\r\n\r\n // remove all handlers\r\n if (1 == arguments.length) {\r\n delete this._callbacks['$' + event];\r\n return this;\r\n }\r\n\r\n // remove specific handler\r\n var cb;\r\n for (var i = 0; i < callbacks.length; i++) {\r\n cb = callbacks[i];\r\n if (cb === fn || cb.fn === fn) {\r\n callbacks.splice(i, 1);\r\n break;\r\n }\r\n }\r\n return this;\r\n};\r\n\r\n/**\r\n * Emit `event` with the given args.\r\n *\r\n * @param {String} event\r\n * @param {Mixed} ...\r\n * @return {Emitter}\r\n */\r\n\r\nEmitter.prototype.emit = function(event){\r\n this._callbacks = this._callbacks || {};\r\n var args = [].slice.call(arguments, 1)\r\n , callbacks = this._callbacks['$' + event];\r\n\r\n if (callbacks) {\r\n callbacks = callbacks.slice(0);\r\n for (var i = 0, len = callbacks.length; i < len; ++i) {\r\n callbacks[i].apply(this, args);\r\n }\r\n }\r\n\r\n return this;\r\n};\r\n\r\n/**\r\n * Return array of callbacks for `event`.\r\n *\r\n * @param {String} event\r\n * @return {Array}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.listeners = function(event){\r\n this._callbacks = this._callbacks || {};\r\n return this._callbacks['$' + event] || [];\r\n};\r\n\r\n/**\r\n * Check if this emitter has `event` handlers.\r\n *\r\n * @param {String} event\r\n * @return {Boolean}\r\n * @api public\r\n */\r\n\r\nEmitter.prototype.hasListeners = function(event){\r\n return !! this.listeners(event).length;\r\n};\r\n","module.exports = parseParams;\n\nfunction parseParams(str){\n // via: http://stackoverflow.com/a/2880929/2511985\n var urlParams = {},\n match,\n pl = /\\+/g, // Regex for replacing addition symbol with a space\n search = /([^&=]+)=?([^&]*)/g,\n decode = function (s) { return decodeURIComponent(s.replace(pl, \" \")); },\n query = str.split(\"?\")[1];\n\n while (!!(match=search.exec(query))) {\n urlParams[decode(match[1])] = decode(match[2]);\n }\n return urlParams;\n};\n","(function(env){\n var previousKeen = env.Keen || undefined;\n var each = require('./utils/each'),\n extend = require('./utils/extend'),\n parseParams = require('./utils/parse-params'),\n serialize = require('./utils/serialize');\n\n var Emitter = require('component-emitter');\n\n function Client(props){\n if (this instanceof Client === false) {\n return new Client(props);\n }\n this.configure(props);\n\n // Set up event handling\n if (Client.debug) {\n this.on('error', Client.log);\n }\n this.emit('ready');\n Client.emit('client', this);\n }\n\n if (previousKeen && typeof previousKeen.resources === 'undefined') {\n Client.legacyVersion = previousKeen;\n }\n\n Emitter(Client);\n Emitter(Client.prototype);\n\n extend(Client, {\n debug: false,\n enabled: true,\n loaded: false,\n version: '__VERSION__'\n });\n\n // Set or extend helpers\n Client.helpers = Client.helpers || {};\n\n // Set or extend resources\n Client.resources = Client.resources || {};\n extend(Client.resources, {\n 'base' : '{protocol}://{host}',\n 'version' : '{protocol}://{host}/3.0',\n 'projects' : '{protocol}://{host}/3.0/projects',\n 'projectId' : '{protocol}://{host}/3.0/projects/{projectId}',\n 'events' : '{protocol}://{host}/3.0/projects/{projectId}/events',\n 'queries' : '{protocol}://{host}/3.0/projects/{projectId}/queries',\n 'datasets' : '{protocol}://{host}/3.0/projects/{projectId}/datasets'\n });\n\n // Set or extend utils\n Client.utils = Client.utils || {};\n extend(Client.utils, {\n 'each' : each,\n 'extend' : extend,\n 'parseParams' : parseParams,\n 'serialize' : serialize\n });\n\n Client.extendLibrary = function(target, source) {\n var previous = previousKeen || source;\n if (isDefined(previous) && isDefined(previous.resources)) {\n each(previous, function(value, key) {\n if (typeof value === 'object') {\n target[key] = target[key] || {};\n extend(target[key], value);\n }\n else {\n target[key] = target[key] || value;\n }\n });\n extend(target.prototype, previous.prototype);\n }\n return target;\n };\n\n Client.log = function(str){\n if (Client.debug && typeof console === 'object') {\n console.log('[Keen]', str);\n }\n };\n\n Client.noConflict = function(){\n if (typeof env.Keen !== 'undefined') {\n env.Keen = Client.legacyVersion || previousKeen;\n }\n return Client;\n };\n\n Client.ready = function(fn){\n if (Client.loaded) {\n fn();\n }\n else {\n Client.once('ready', fn);\n }\n };\n\n Client.prototype.configure = function(obj){\n var config = obj || {};\n this.config = this.config || {\n projectId : undefined,\n writeKey : undefined,\n host : 'api.keen.io',\n protocol : 'https',\n requestType : 'jsonp',\n resources : extend({}, Client.resources)\n };\n\n // IE<10 request shim\n if (typeof window !== 'undefined' && window.navigator && window.navigator.userAgent && window.navigator.userAgent.indexOf('MSIE') > -1) {\n config.protocol = document.location.protocol.replace(':', '');\n }\n\n if (config.host) {\n config.host.replace(/.*?:\\/\\//g, '');\n }\n\n extend(this.config, config);\n return this;\n };\n\n Client.prototype.masterKey = function(str){\n if (!arguments.length) return this.config.masterKey;\n this.config.masterKey = str ? String(str) : null;\n return this;\n };\n\n Client.prototype.projectId = function(str){\n if (!arguments.length) return this.config.projectId;\n this.config.projectId = (str ? String(str) : null);\n return this;\n };\n\n Client.prototype.resources = function(obj){\n if (!arguments.length) return this.config.resources;\n var self = this;\n if (typeof obj === 'object') {\n each(obj, function(value, key){\n self.config.resources[key] = (value ? value : null);\n });\n }\n return self;\n };\n\n Client.prototype.url = function(name){\n var args = Array.prototype.slice.call(arguments, 1),\n baseUrl = this.config.resources.base || '{protocol}://{host}',\n path;\n\n if (name && typeof name === 'string') {\n if (this.config.resources[name]) {\n path = this.config.resources[name];\n }\n else {\n path = baseUrl + name;\n }\n }\n else {\n path = baseUrl;\n }\n\n each(this.config, function(value, key){\n if (typeof value !== 'object') {\n path = path.replace('{' + key + '}', value);\n }\n });\n\n each(args, function(arg, i){\n if (typeof arg === 'string') {\n path += '/' + arg;\n }\n else if (typeof arg === 'object') {\n path += '?';\n each(arg, function(value, key){\n path += key + '=' + value + '&';\n });\n path = path.slice(0, -1);\n }\n });\n\n return path;\n };\n\n domReady(function(){\n Client.loaded = true;\n Client.emit('ready');\n });\n\n function domReady(fn){\n if (Client.loaded || typeof document === 'undefined') {\n fn();\n return;\n }\n // Firefox 3.5 shim\n if(document.readyState == null && document.addEventListener){\n document.addEventListener('DOMContentLoaded', function DOMContentLoaded(){\n document.removeEventListener('DOMContentLoaded', DOMContentLoaded, false);\n document.readyState = 'complete';\n }, false);\n document.readyState = 'loading';\n }\n testDom(fn);\n }\n\n function testDom(fn){\n if (/in/.test(document.readyState)) {\n setTimeout(function(){\n testDom(fn);\n }, 9);\n }\n else {\n fn();\n }\n }\n\n function isDefined(target) {\n return typeof target !== 'undefined';\n }\n\n function isUndefined(target) {\n return typeof target === 'undefined';\n }\n\n module.exports = Client;\n\n}).call(this, typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {});\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var script = doc.createElement(\"script\");\n script.onreadystatechange = function () {\n runIfPresent(handle);\n script.onreadystatechange = null;\n html.removeChild(script);\n script = null;\n };\n html.appendChild(script);\n };\n }\n\n function installSetTimeoutImplementation() {\n registerImmediate = function(handle) {\n setTimeout(runIfPresent, 0, handle);\n };\n }\n\n // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.\n var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);\n attachTo = attachTo && attachTo.setTimeout ? attachTo : global;\n\n // Don't get fooled by e.g. browserify environments.\n if ({}.toString.call(global.process) === \"[object process]\") {\n // For Node.js before 0.9\n installNextTickImplementation();\n\n } else if (canUsePostMessage()) {\n // For non-IE10 modern browsers\n installPostMessageImplementation();\n\n } else if (global.MessageChannel) {\n // For web workers, where supported\n installMessageChannelImplementation();\n\n } else if (doc && \"onreadystatechange\" in doc.createElement(\"script\")) {\n // For IE 6–8\n installReadyStateChangeImplementation();\n\n } else {\n // For older browsers\n installSetTimeoutImplementation();\n }\n\n attachTo.setImmediate = setImmediate;\n attachTo.clearImmediate = clearImmediate;\n}(typeof self === \"undefined\" ? typeof global === \"undefined\" ? this : global : self));\n","var scope = (typeof global !== \"undefined\" && global) ||\n (typeof self !== \"undefined\" && self) ||\n window;\nvar apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(scope, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\nrequire(\"setimmediate\");\n// On some exotic environments, it's not clear which object `setimmediate` was\n// able to install onto. Search each possibility in the same order as the\n// `setimmediate` library.\nexports.setImmediate = (typeof self !== \"undefined\" && self.setImmediate) ||\n (typeof global !== \"undefined\" && global.setImmediate) ||\n (this && this.setImmediate);\nexports.clearImmediate = (typeof self !== \"undefined\" && self.clearImmediate) ||\n (typeof global !== \"undefined\" && global.clearImmediate) ||\n (this && this.clearImmediate);\n","import 'promise-polyfill/src/polyfill';\nimport KeenLibrary from 'keen-core';\n\nimport each from 'keen-core/lib/utils/each';\nimport extend from 'keen-core/lib/utils/extend';\n\nimport { validateAuthCredentials } from './utils/validate-auth-credentials';\nimport { mapKeysToUnderscore } from './utils/keys-to-underscore';\n\nimport pkg from '../package.json';\n\nKeenLibrary.prototype.readKey = function(str){\n if (!arguments.length) return this.config.readKey;\n this.config.readKey = str ? String(str) : null;\n return this;\n};\n\nKeenLibrary.prototype.query = function(a, b = undefined, options = {}){\n validateAuthCredentials(this.config);\n // a - analysis type or config object\n // b - params\n const mapObj = {\n a: mapKeysToUnderscore(a),\n b: mapKeysToUnderscore(b)\n }\n let analysisType = mapObj.a;\n let queryParams = mapObj.b;\n\n // all this for backward compatibility, remove in next major version\n if (typeof a === 'object' && !b) {\n // initialized with single argument - config object\n const { analysis_type: analysisTypeExtracted,\n cache: cacheOptionsExtracted,\n ...queryParamsExtracted\n } = mapObj.a;\n analysisType = analysisTypeExtracted;\n queryParams = queryParamsExtracted;\n let cacheOptions = this.config.cache;\n if (cacheOptionsExtracted !== undefined) {\n cacheOptions = cacheOptionsExtracted;\n }\n options.cache = cacheOptions;\n }\n //math round values boolean for request.js\n options.resultParsers = this.config.resultParsers;\n\n // for deprecated queries\n if (options.cache === undefined && this.config.cache) {\n options.cache = { ...this.config.cache };\n }\n\n if (typeof queryParams === 'object' && (this.config.includeMetadata || this.config.include_metadata)) {\n queryParams.includeMetadata = true;\n }\n // read saved queries - DEPRECATED - to remove\n if (analysisType && queryParams && typeof queryParams === 'string') {\n if (queryParams.indexOf('/result') < 0) {\n queryParams += '/result';\n }\n return this\n .get({\n url: this.url('queries', analysisType, queryParams),\n api_key: this.config.readKey || this.config.masterKey\n }, options);\n }\n\n // read saved queries\n else if (queryParams && queryParams.saved_query_name) {\n let savedQueryResultsUrl =\n queryParams.saved_query_name.indexOf('/result') > -1 ?\n queryParams.saved_query_name\n :\n `${queryParams.saved_query_name}/result`\n ;\n return this\n .get({\n url: this.url(\n 'queries',\n 'saved',\n savedQueryResultsUrl\n ),\n api_key: this.config.readKey || this.config.masterKey\n },\n options);\n }\n\n // cached datasets - DEPRECATED\n else if (analysisType === 'dataset' && typeof queryParams === 'object') {\n return this\n .get({\n url: this.url('datasets', queryParams.name, 'results'),\n api_key: this.config.readKey || this.config.masterKey,\n params: queryParams\n }, options);\n }\n\n else if (queryParams && queryParams.dataset_name) {\n return this\n .get({\n url: this.url('datasets', queryParams.dataset_name, 'results'),\n api_key: this.config.readKey || this.config.masterKey,\n params: queryParams\n }, options);\n }\n\n // standard queries\n else if (analysisType && queryParams && typeof queryParams === 'object') {\n // Include analysis_type for downstream use\n const queryBodyParams = extend({ analysis_type: analysisType }, queryParams);\n\n // Localize timezone if none is set\n if (!queryBodyParams.timezone) {\n queryBodyParams.timezone = new Date().getTimezoneOffset() * -60;\n }\n\n return this\n .post({\n url: this.url('queries', analysisType),\n api_key: this.config.readKey || this.config.masterKey,\n params: queryBodyParams\n }, options);\n }\n else if (analysisType && typeof analysisType === 'string' && !queryParams) {\n return Promise.reject({\n error_code: 'SDKError',\n message: \".query() called with incorrect arguments\"\n });\n }\n};\n\n// Keen.Query handler\n// --------------------------------\nKeenLibrary.Query = Query;\n\nKeenLibrary.prototype.run = function(q, callback){\n const self = this;\n const cb = callback;\n let output;\n\n const queries = q instanceof Array? q : [q];\n const promises = [];\n\n each(queries, function(query, i){\n let queryPromise;\n if (typeof query === 'string') {\n queryPromise = self.query('saved', query + '/result');\n }\n else if (query instanceof KeenLibrary.Query) {\n // Include analysis_type for downstream use\n queryPromise = self.query(query.analysis, extend({ analysis_type: query.analysis }, query.params), query.options);\n } else {\n queryPromise = query;\n }\n // query.abort = queryPromise.abort;\n promises.push(queryPromise);\n });\n\n if (promises.length > 1) {\n output = Promise.all(promises);\n }\n else {\n // Only return single\n output = promises[0];\n }\n\n if (cb) {\n // Manually handle callback, as\n // Promise.nodeify drops nulls\n output.then(function(res){\n cb(null, res);\n });\n output['catch'](function(err){\n cb(err, null);\n });\n }\n\n return output;\n};\n\n// DEPRECATED\nfunction Query(analysisType, params = {}, options = {}) {\n this.analysis = analysisType;\n this.params = {};\n- this.set(params);\n this.options = {...options};\n}\n\nQuery.prototype.set = function(attributes) {\n // DEPRECATED\n const self = this;\n each(attributes, function(v, k){\n let key = k;\n let value = v;\n if (k.match(new RegExp('[A-Z]'))) {\n key = k.replace(/([A-Z])/g, function($1) { return '_'+$1.toLowerCase(); });\n }\n self.params[key] = value;\n if (value instanceof Array) {\n each(value, function(dv, index){\n if (dv instanceof Array == false && typeof dv === 'object') {\n each(dv, function(deepValue, deepKey){\n if (deepKey.match(new RegExp('[A-Z]'))) {\n var _deepKey = deepKey.replace(/([A-Z])/g, function($1) { return '_'+$1.toLowerCase(); });\n delete self.params[key][index][deepKey];\n self.params[key][index][_deepKey] = deepValue;\n }\n });\n }\n });\n }\n });\n return self;\n};\n\nQuery.prototype.get = function(attribute) {\n // DEPRECATED\n let key = attribute;\n if (key.match(new RegExp('[A-Z]'))) {\n key = key.replace(/([A-Z])/g, function($1) { return '_'+$1.toLowerCase(); });\n }\n if (this.params) {\n return this.params[key] || null;\n }\n};\n\nQuery.prototype.addFilter = function(property, operator, value) {\n // DEPRECATED\n this.params.filters = this.params.filters || [];\n this.params.filters.push({\n 'property_name': property,\n 'operator': operator,\n 'property_value': value\n });\n return this;\n};\n\nKeenLibrary.version = pkg.version;\n\nexport const KeenAnalysis = KeenLibrary;\nexport default KeenAnalysis;\n","import extend from 'keen-core/lib/utils/extend';\n\nimport KeenAnalysisCore from './index';\nimport request from './request';\nimport * as httpHandlers from './utils/http-browser';\n\nKeenAnalysisCore.prototype.get = new request('GET', httpHandlers);\nKeenAnalysisCore.prototype.post = new request('POST', httpHandlers);\nKeenAnalysisCore.prototype.put = new request('PUT', httpHandlers);\nKeenAnalysisCore.prototype.del = new request('DELETE', httpHandlers);\n\nexport let keenGlobals = undefined;\nif (typeof webpackKeenGlobals !== 'undefined') {\n keenGlobals = webpackKeenGlobals;\n}\n\nexport const Keen = KeenAnalysisCore.extendLibrary(KeenAnalysisCore);\nexport const KeenAnalysis = Keen; // backward compatibility - CDN\nexport default Keen;\n"],"sourceRoot":""}